chore: upgrade i18next 26, prettier 3, fontsource-variable, domhandler 6, lint-staged 17
- i18next 23->26 + react-i18next 15->17 - prettier 2->3, reformat all files - replace @fontsource/inter with @fontsource-variable/inter 5, update import path - domhandler 5->6 (aligns with transitive deps) - lint-staged 16->17
This commit is contained in:
@@ -22,7 +22,7 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||
|
||||
private get screenshareButton(): HTMLElement | undefined {
|
||||
const screenshareBtn = this.document?.querySelector(
|
||||
'[data-testid="incall_screenshare"]'
|
||||
'[data-testid="incall_screenshare"]',
|
||||
) as HTMLElement | null;
|
||||
|
||||
return screenshareBtn ?? undefined;
|
||||
@@ -43,7 +43,7 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||
|
||||
private get spotlightButton(): HTMLInputElement | undefined {
|
||||
const spotlightButton = this.document?.querySelector(
|
||||
'input[value="spotlight"]'
|
||||
'input[value="spotlight"]',
|
||||
) as HTMLInputElement | null;
|
||||
|
||||
return spotlightButton ?? undefined;
|
||||
@@ -51,7 +51,7 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||
|
||||
private get gridButton(): HTMLInputElement | undefined {
|
||||
const gridButton = this.document?.querySelector(
|
||||
'input[value="grid"]'
|
||||
'input[value="grid"]',
|
||||
) as HTMLInputElement | null;
|
||||
|
||||
return gridButton ?? undefined;
|
||||
@@ -106,7 +106,7 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||
desired.video,
|
||||
desired.sound,
|
||||
this.screenshare,
|
||||
this.spotlight
|
||||
this.spotlight,
|
||||
);
|
||||
await this.applyState();
|
||||
}
|
||||
@@ -158,7 +158,7 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||
data.video_enabled ?? this.video,
|
||||
this.sound,
|
||||
this.screenshare,
|
||||
this.spotlight
|
||||
this.spotlight,
|
||||
);
|
||||
|
||||
this.state = state;
|
||||
@@ -180,7 +180,7 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||
this.video,
|
||||
this.sound,
|
||||
screenshare,
|
||||
spotlight
|
||||
spotlight,
|
||||
);
|
||||
this.emitStateUpdate();
|
||||
|
||||
@@ -226,7 +226,7 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||
this.video,
|
||||
sound,
|
||||
this.screenshare,
|
||||
this.spotlight
|
||||
this.spotlight,
|
||||
);
|
||||
this.state = state;
|
||||
this.emitStateUpdate();
|
||||
|
||||
@@ -14,7 +14,7 @@ export class CallControlState {
|
||||
video: boolean,
|
||||
sound: boolean,
|
||||
screenshare = false,
|
||||
spotlight = false
|
||||
spotlight = false,
|
||||
) {
|
||||
this.microphone = microphone;
|
||||
this.video = video;
|
||||
|
||||
@@ -96,7 +96,7 @@ export class CallEmbed {
|
||||
themeKind: ElementCallThemeKind,
|
||||
noiseSuppression = true,
|
||||
initialAudio = true,
|
||||
initialVideo = false
|
||||
initialVideo = false,
|
||||
): Widget {
|
||||
const userId = mx.getSafeUserId();
|
||||
const deviceId = mx.getDeviceId() ?? '';
|
||||
@@ -130,7 +130,7 @@ export class CallEmbed {
|
||||
|
||||
const widgetUrl = new URL(
|
||||
`${trimTrailingSlash(import.meta.env.BASE_URL)}/public/element-call/index.html`,
|
||||
window.location.origin
|
||||
window.location.origin,
|
||||
);
|
||||
widgetUrl.search = params.toString();
|
||||
|
||||
@@ -170,10 +170,10 @@ export class CallEmbed {
|
||||
room: Room,
|
||||
widget: Widget,
|
||||
container: HTMLElement,
|
||||
initialControlState?: CallControlState
|
||||
initialControlState?: CallControlState,
|
||||
) {
|
||||
const iframe = CallEmbed.getIframe(
|
||||
widget.getCompleteUrl({ currentUserId: mx.getSafeUserId() })
|
||||
widget.getCompleteUrl({ currentUserId: mx.getSafeUserId() }),
|
||||
);
|
||||
container.append(iframe);
|
||||
|
||||
@@ -199,7 +199,7 @@ export class CallEmbed {
|
||||
return;
|
||||
}
|
||||
this.control.onMediaState(evt);
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
this.start();
|
||||
@@ -243,7 +243,7 @@ export class CallEmbed {
|
||||
// Room widgets get locked to the room they were added in
|
||||
this.call.setViewedRoomId(this.roomId);
|
||||
this.disposables.push(
|
||||
this.listenAction(ElementWidgetActions.JoinCall, this.onCallJoined.bind(this))
|
||||
this.listenAction(ElementWidgetActions.JoinCall, this.onCallJoined.bind(this)),
|
||||
);
|
||||
|
||||
// Populate the map of "read up to" events for this widget with the current event in every room.
|
||||
|
||||
@@ -32,7 +32,10 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
|
||||
private readonly mx: MatrixClient;
|
||||
|
||||
public constructor(mx: MatrixClient, private inRoomId: string) {
|
||||
public constructor(
|
||||
mx: MatrixClient,
|
||||
private inRoomId: string,
|
||||
) {
|
||||
super();
|
||||
this.mx = mx;
|
||||
|
||||
@@ -51,7 +54,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
eventType: string,
|
||||
content: IContent,
|
||||
stateKey: string | null = null,
|
||||
targetRoomId: string | null = null
|
||||
targetRoomId: string | null = null,
|
||||
): Promise<ISendEventDetails> {
|
||||
const client = this.mx;
|
||||
const roomId = targetRoomId || this.inRoomId;
|
||||
@@ -64,7 +67,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
roomId,
|
||||
eventType as keyof StateEvents,
|
||||
content as StateEvents[keyof StateEvents],
|
||||
stateKey
|
||||
stateKey,
|
||||
);
|
||||
} else if (eventType === EventType.RoomRedaction) {
|
||||
// special case: extract the `redacts` property and call redact
|
||||
@@ -73,7 +76,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
r = await client.sendEvent(
|
||||
roomId,
|
||||
eventType as keyof TimelineEvents,
|
||||
content as TimelineEvents[keyof TimelineEvents]
|
||||
content as TimelineEvents[keyof TimelineEvents],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -86,7 +89,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
eventType: string,
|
||||
content: IContent,
|
||||
stateKey: string | null = null,
|
||||
targetRoomId: string | null = null
|
||||
targetRoomId: string | null = null,
|
||||
): Promise<ISendDelayedEventDetails> {
|
||||
const client = this.mx;
|
||||
const roomId = targetRoomId || this.inRoomId;
|
||||
@@ -115,7 +118,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
delayOpts,
|
||||
eventType as keyof StateEvents,
|
||||
content as StateEvents[keyof StateEvents],
|
||||
stateKey
|
||||
stateKey,
|
||||
);
|
||||
} else {
|
||||
// message event
|
||||
@@ -124,7 +127,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
delayOpts,
|
||||
null,
|
||||
eventType as keyof TimelineEvents,
|
||||
content as TimelineEvents[keyof TimelineEvents]
|
||||
content as TimelineEvents[keyof TimelineEvents],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,7 +139,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
|
||||
public async updateDelayedEvent(
|
||||
delayId: string,
|
||||
action: UpdateDelayedEventAction
|
||||
action: UpdateDelayedEventAction,
|
||||
): Promise<void> {
|
||||
const client = this.mx;
|
||||
|
||||
@@ -148,7 +151,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
public async sendToDevice(
|
||||
eventType: string,
|
||||
encrypted: boolean,
|
||||
contentMap: { [userId: string]: { [deviceId: string]: object } }
|
||||
contentMap: { [userId: string]: { [deviceId: string]: object } },
|
||||
): Promise<void> {
|
||||
const client = this.mx;
|
||||
|
||||
@@ -176,11 +179,11 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
const batch = await crypto.encryptToDeviceMessages(
|
||||
eventType,
|
||||
recipients,
|
||||
JSON.parse(stringifiedContent)
|
||||
JSON.parse(stringifiedContent),
|
||||
);
|
||||
|
||||
await client.queueToDevice(batch);
|
||||
})
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
await client.queueToDevice({
|
||||
@@ -190,7 +193,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
userId,
|
||||
deviceId,
|
||||
payload: content,
|
||||
}))
|
||||
})),
|
||||
),
|
||||
});
|
||||
}
|
||||
@@ -202,7 +205,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
msgtype: string | undefined,
|
||||
stateKey: string | undefined,
|
||||
limit: number,
|
||||
since: string | undefined
|
||||
since: string | undefined,
|
||||
): Promise<IRoomEvent[]> {
|
||||
const safeLimit =
|
||||
limit > 0 ? Math.min(limit, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER; // relatively arbitrary
|
||||
@@ -240,7 +243,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
public async readRoomState(
|
||||
roomId: string,
|
||||
eventType: string,
|
||||
stateKey: string | undefined
|
||||
stateKey: string | undefined,
|
||||
): Promise<IRoomEvent[]> {
|
||||
const room = this.mx.getRoom(roomId);
|
||||
if (room === null) return [];
|
||||
@@ -261,7 +264,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
from?: string,
|
||||
to?: string,
|
||||
limit?: number,
|
||||
direction?: 'f' | 'b'
|
||||
direction?: 'f' | 'b',
|
||||
): Promise<IReadEventRelationsResult> {
|
||||
const client = this.mx;
|
||||
const dir = direction as Direction;
|
||||
@@ -276,7 +279,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
eventId,
|
||||
relationType ?? null,
|
||||
eventType ?? null,
|
||||
{ from, to, limit, dir }
|
||||
{ from, to, limit, dir },
|
||||
);
|
||||
|
||||
return {
|
||||
@@ -288,7 +291,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||
|
||||
public async searchUserDirectory(
|
||||
searchTerm: string,
|
||||
limit?: number
|
||||
limit?: number,
|
||||
): Promise<ISearchUserDirectoryResult> {
|
||||
const client = this.mx;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { CallControlState } from './CallControlState';
|
||||
export const useClientWidgetApiEvent = <T>(
|
||||
api: ClientWidgetApi | undefined,
|
||||
type: string,
|
||||
callback: (event: CustomEvent<T>) => void
|
||||
callback: (event: CustomEvent<T>) => void,
|
||||
) => {
|
||||
useEffect(() => {
|
||||
api?.on(`action:${type}`, callback);
|
||||
@@ -24,9 +24,9 @@ export const useSendClientWidgetApiAction = (api: ClientWidgetApi) => {
|
||||
const sendWidgetAction = useCallback(
|
||||
async <T extends IWidgetApiRequestData = IWidgetApiRequestData>(
|
||||
action: string,
|
||||
data: T
|
||||
data: T,
|
||||
): Promise<IWidgetApiAcknowledgeResponseData> => api.transport.send(action, data),
|
||||
[api]
|
||||
[api],
|
||||
);
|
||||
|
||||
return sendWidgetAction;
|
||||
|
||||
@@ -9,7 +9,7 @@ import { EventType } from 'matrix-js-sdk';
|
||||
export function getCallCapabilities(
|
||||
roomId: string,
|
||||
userId: string,
|
||||
deviceId: string
|
||||
deviceId: string,
|
||||
): Set<Capability> {
|
||||
const capabilities: Set<Capability> = new Set();
|
||||
|
||||
@@ -24,60 +24,60 @@ export function getCallCapabilities(
|
||||
capabilities.add(`org.matrix.msc2762.state:${roomId}`);
|
||||
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomMember).raw
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomMember).raw,
|
||||
);
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, 'org.matrix.msc3401.call').raw
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, 'org.matrix.msc3401.call').raw,
|
||||
);
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomEncryption).raw
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomEncryption).raw,
|
||||
);
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomName).raw
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomName).raw,
|
||||
);
|
||||
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(
|
||||
EventDirection.Send,
|
||||
'org.matrix.msc3401.call.member',
|
||||
userId
|
||||
).raw
|
||||
userId,
|
||||
).raw,
|
||||
);
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(
|
||||
EventDirection.Send,
|
||||
'org.matrix.msc3401.call.member',
|
||||
`_${userId}_${deviceId}_m.call`
|
||||
).raw
|
||||
`_${userId}_${deviceId}_m.call`,
|
||||
).raw,
|
||||
);
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(
|
||||
EventDirection.Send,
|
||||
'org.matrix.msc3401.call.member',
|
||||
`${userId}_${deviceId}_m.call`
|
||||
).raw
|
||||
`${userId}_${deviceId}_m.call`,
|
||||
).raw,
|
||||
);
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(
|
||||
EventDirection.Send,
|
||||
'org.matrix.msc3401.call.member',
|
||||
`_${userId}_${deviceId}`
|
||||
).raw
|
||||
`_${userId}_${deviceId}`,
|
||||
).raw,
|
||||
);
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(
|
||||
EventDirection.Send,
|
||||
'org.matrix.msc3401.call.member',
|
||||
`${userId}_${deviceId}`
|
||||
).raw
|
||||
`${userId}_${deviceId}`,
|
||||
).raw,
|
||||
);
|
||||
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, 'org.matrix.msc3401.call.member')
|
||||
.raw
|
||||
.raw,
|
||||
);
|
||||
capabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomCreate).raw
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomCreate).raw,
|
||||
);
|
||||
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user