@cloudflare/realtimekit 1.2.4-staging.6 → 1.2.4-staging.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1378,6 +1378,36 @@ interface ChatMessage {
1378
1378
  * @generated MessageType for protobuf message socket.chat.ChatMessage
1379
1379
  */
1380
1380
  declare const ChatMessage: ChatMessage$Type;
1381
+ declare class GetPaginatedChatMessageFilters$Type extends MessageType$1<GetPaginatedChatMessageFilters> {
1382
+ constructor();
1383
+ }
1384
+ /**
1385
+ * @generated from protobuf message socket.chat.GetPaginatedChatMessageFilters
1386
+ */
1387
+ interface GetPaginatedChatMessageFilters {
1388
+ /**
1389
+ * @generated from protobuf oneof: filters
1390
+ */
1391
+ filters: {
1392
+ oneofKind: "pinned";
1393
+ /**
1394
+ * @generated from protobuf field: bool pinned = 1;
1395
+ */
1396
+ pinned: boolean;
1397
+ } | {
1398
+ oneofKind: "userId";
1399
+ /**
1400
+ * @generated from protobuf field: string user_id = 2;
1401
+ */
1402
+ userId: string;
1403
+ } | {
1404
+ oneofKind: undefined;
1405
+ };
1406
+ }
1407
+ /**
1408
+ * @generated MessageType for protobuf message socket.chat.GetPaginatedChatMessageFilters
1409
+ */
1410
+ declare const GetPaginatedChatMessageFilters: GetPaginatedChatMessageFilters$Type;
1381
1411
  declare class GetPaginatedChatMessageRoomResponse$Type extends MessageType$1<GetPaginatedChatMessageRoomResponse> {
1382
1412
  constructor();
1383
1413
  }
@@ -1490,82 +1520,6 @@ interface DeleteChatMessageResponse {
1490
1520
  * @generated MessageType for protobuf message socket.chat.DeleteChatMessageResponse
1491
1521
  */
1492
1522
  declare const DeleteChatMessageResponse: DeleteChatMessageResponse$Type;
1493
- declare class LatestMessageAndUnreadCount$Type extends MessageType$1<LatestMessageAndUnreadCount> {
1494
- constructor();
1495
- }
1496
- /**
1497
- * @generated from protobuf message socket.chat.LatestMessageAndUnreadCount
1498
- */
1499
- interface LatestMessageAndUnreadCount {
1500
- /**
1501
- * @generated from protobuf field: optional socket.chat.ChatMessage message = 1;
1502
- */
1503
- message?: ChatMessage;
1504
- /**
1505
- * @generated from protobuf field: uint64 unread_count = 2 [jstype = JS_NUMBER];
1506
- */
1507
- unreadCount: number;
1508
- }
1509
- /**
1510
- * @generated MessageType for protobuf message socket.chat.LatestMessageAndUnreadCount
1511
- */
1512
- declare const LatestMessageAndUnreadCount: LatestMessageAndUnreadCount$Type;
1513
- declare class ChatChannel$Type extends MessageType$1<ChatChannel$1> {
1514
- constructor();
1515
- }
1516
- /**
1517
- * @generated from protobuf message socket.chat.ChatChannel
1518
- */
1519
- interface ChatChannel$1 {
1520
- /**
1521
- * @generated from protobuf field: string chat_channel_id = 1;
1522
- */
1523
- chatChannelId: string;
1524
- /**
1525
- * @generated from protobuf field: string display_name = 2;
1526
- */
1527
- displayName: string;
1528
- /**
1529
- * @generated from protobuf field: optional string display_picture_url = 3;
1530
- */
1531
- displayPictureUrl?: string;
1532
- /**
1533
- * @generated from protobuf field: string visibility = 4;
1534
- */
1535
- visibility: string;
1536
- /**
1537
- * @generated from protobuf field: bool is_direct_message = 5;
1538
- */
1539
- isDirectMessage: boolean;
1540
- /**
1541
- * @generated from protobuf field: socket.chat.LatestMessageAndUnreadCount latest_message_and_unread_count = 6;
1542
- */
1543
- latestMessageAndUnreadCount?: LatestMessageAndUnreadCount;
1544
- /**
1545
- * @generated from protobuf field: repeated string target_user_ids = 7;
1546
- */
1547
- targetUserIds: string[];
1548
- }
1549
- /**
1550
- * @generated MessageType for protobuf message socket.chat.ChatChannel
1551
- */
1552
- declare const ChatChannel$1: ChatChannel$Type;
1553
- declare class GetChatChannelResponse$Type extends MessageType$1<GetChatChannelResponse> {
1554
- constructor();
1555
- }
1556
- /**
1557
- * @generated from protobuf message socket.chat.GetChatChannelResponse
1558
- */
1559
- interface GetChatChannelResponse {
1560
- /**
1561
- * @generated from protobuf field: repeated socket.chat.ChatChannel chat_channels = 1;
1562
- */
1563
- chatChannels: ChatChannel$1[];
1564
- }
1565
- /**
1566
- * @generated MessageType for protobuf message socket.chat.GetChatChannelResponse
1567
- */
1568
- declare const GetChatChannelResponse: GetChatChannelResponse$Type;
1569
1523
  declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1570
1524
  constructor();
1571
1525
  }
@@ -2893,33 +2847,38 @@ declare class SocketService {
2893
2847
  flush(): any;
2894
2848
  handleSocketConnectionEvents(): void;
2895
2849
  }
2896
- type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
2897
- declare class PluginSocketHandler {
2898
- constructor(context: Context<ContextState>, socketService: SocketService);
2850
+ declare enum ChatMessageType {
2851
+ TEXT = 0,
2852
+ IMAGE = 1,
2853
+ FILE = 2,
2854
+ CUSTOM = 3
2855
+ }
2856
+ type ChatSocketMessage = SendChatMessageToRoomResponse | SendChatMessageToPeersResponse | EditChatMessageResponse | DeleteChatMessageResponse;
2857
+ interface SearchFilters {
2858
+ timestamp?: number;
2859
+ limit?: number;
2860
+ reversed?: boolean;
2861
+ offset?: number;
2862
+ }
2863
+ declare class ChatSocketHandler {
2864
+ readonly telemetry: Telemetry;
2899
2865
  readonly logger: Logger;
2900
- addPlugin(pluginId: string, staggered: boolean): void;
2901
- removePlugin(pluginId: string): void;
2902
- getActivePlugins(): Promise<EnablePluginsResponse>;
2903
- customPluginEventToRoom(pluginId: string, data: any, messageId?: string): void;
2904
- customPluginEventToPeers(pluginId: string, peerIds: string[], data: any, messageId?: string): void;
2905
- enablePluginForRoom(pluginId: string, messageId?: string): void;
2906
- enablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
2907
- disablePluginForRoom(pluginId: string, messageId?: string): void;
2908
- disablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
2909
- storeInsertKeys(pluginId: string, store: string, insertKeys: {
2910
- key: string;
2911
- payload?: any;
2912
- }[], messageId?: string): void;
2913
- storeGetKeys(pluginId: string, store: string, getKeys: {
2914
- key: string;
2915
- }[], messageId?: string): void;
2916
- storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
2917
- key: string;
2918
- }[], messageId?: string): void;
2919
- storeDelete(pluginId: string, store: string, messageId?: string): void;
2920
- getPluginDataOld(pluginId: string, store: string): void;
2921
- storePluginDataOld(pluginId: string, store: string, data: any): void;
2922
- on(event: number, handler: (socketMessage: PluginSocketMessage, messageId?: string) => void): void;
2866
+ constructor(context: Context<ContextState>, socketService: SocketService);
2867
+ getChatMessages(): Promise<{
2868
+ id: string;
2869
+ payload: Uint8Array;
2870
+ }>;
2871
+ getChatMessagesPaginated(timeStamp: number, size: number, reversed: boolean, filters?: GetPaginatedChatMessageFilters['filters']): Promise<GetPaginatedChatMessageRoomResponse>;
2872
+ sendMessageToRoom(message: string, messageType: ChatMessageType): void;
2873
+ sendMessageToPeers(message: string, messageType: ChatMessageType, peerIds: string[]): void;
2874
+ sendMessage(message: string, messageType: ChatMessageType, peerIds?: string[]): void;
2875
+ editMessage(chatId: string, message: string, payloadType: ChatMessageType, pinned?: boolean): Promise<ChatMessage>;
2876
+ deleteMessage(chatId: string): Promise<{
2877
+ id: string;
2878
+ }>;
2879
+ searchMessages(query: string, filters: SearchFilters): Promise<ChatMessage[]>;
2880
+ setPinState(message: Message, pin: boolean): Promise<PinChatMessageResponse>;
2881
+ on(event: number, handler: (socketMessage: ChatSocketMessage) => void): void;
2923
2882
  }
2924
2883
  declare class SelectedPeers {
2925
2884
  private readonly _activeSpeakerPeers;
@@ -3203,466 +3162,76 @@ declare class ClientMap<T extends (EventMap & WildCardEvent<T>), U extends {
3203
3162
  clear(emitEvent?: boolean, removeListeners?: boolean): void;
3204
3163
  toArray(): U[];
3205
3164
  }
3206
- interface GenericHandlerResult {
3207
- offerSdp: RTCSessionDescriptionInit;
3208
- callback: (answer: RTCSessionDescriptionInit) => Promise<any>;
3209
- sender?: RTCRtpSender;
3165
+ type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
3166
+ declare class PluginSocketHandler {
3167
+ constructor(context: Context<ContextState>, socketService: SocketService);
3168
+ readonly logger: Logger;
3169
+ addPlugin(pluginId: string, staggered: boolean): void;
3170
+ removePlugin(pluginId: string): void;
3171
+ getActivePlugins(): Promise<EnablePluginsResponse>;
3172
+ customPluginEventToRoom(pluginId: string, data: any, messageId?: string): void;
3173
+ customPluginEventToPeers(pluginId: string, peerIds: string[], data: any, messageId?: string): void;
3174
+ enablePluginForRoom(pluginId: string, messageId?: string): void;
3175
+ enablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3176
+ disablePluginForRoom(pluginId: string, messageId?: string): void;
3177
+ disablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3178
+ storeInsertKeys(pluginId: string, store: string, insertKeys: {
3179
+ key: string;
3180
+ payload?: any;
3181
+ }[], messageId?: string): void;
3182
+ storeGetKeys(pluginId: string, store: string, getKeys: {
3183
+ key: string;
3184
+ }[], messageId?: string): void;
3185
+ storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
3186
+ key: string;
3187
+ }[], messageId?: string): void;
3188
+ storeDelete(pluginId: string, store: string, messageId?: string): void;
3189
+ getPluginDataOld(pluginId: string, store: string): void;
3190
+ storePluginDataOld(pluginId: string, store: string, data: any): void;
3191
+ on(event: number, handler: (socketMessage: PluginSocketMessage, messageId?: string) => void): void;
3210
3192
  }
3211
- type HandlerRunOptions = {
3212
- direction: 'send' | 'recv';
3213
- iceServers?: RTCIceServer[];
3214
- iceTransportPolicy?: RTCIceTransportPolicy;
3215
- additionalSettings?: any;
3216
- proprietaryConstraints?: any;
3217
- onTrackHandler?: (event: RTCTrackEvent) => void;
3218
- };
3219
- type CodecOption = {
3193
+ interface PluginResponse {
3194
+ baseURL: string;
3195
+ createdAt: string;
3196
+ description: string;
3197
+ id: string;
3220
3198
  name: string;
3221
- parameters?: string[];
3222
- };
3223
- type HandlerSendOptions = {
3224
- track: MediaStreamTrack | 'audio' | 'video';
3225
- screenShare?: boolean;
3226
- encodings?: RTCRtpEncodingParameters[];
3227
- codecs?: RTCRtpCodecCapability[];
3228
- codecOptions?: CodecOption[];
3229
- };
3230
- interface HandlerSendResult extends GenericHandlerResult {
3231
- mid: string;
3199
+ organizationId: string;
3200
+ picture: string;
3201
+ private: boolean;
3202
+ published: boolean;
3203
+ staggered: boolean;
3204
+ tags: string[];
3205
+ type: string;
3206
+ updatedAt: string;
3232
3207
  }
3233
- declare abstract class HandlerInterface<TransportPromiseEvents> extends EnhancedEventEmitter<TransportPromiseEvents> {
3234
- protected _sendWebStream: MediaStream;
3235
- protected _sendScreenShareStream: MediaStream;
3236
- protected _direction?: 'send' | 'recv';
3237
- pc: RTCPeerConnection;
3238
- protected _transportReady: boolean;
3239
- private readonly _mapMidTransceiver;
3240
- enableHighBitrate: boolean;
3241
- enableStereo: boolean;
3242
- enableDtx: boolean;
3243
- readonly midTransceiverMap: Map<string, RTCRtpTransceiver>;
3244
- abstract readonly name: string;
3245
- close(): void;
3246
- restartIce(): Promise<GenericHandlerResult>;
3247
- init({ direction, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, onTrackHandler, }: HandlerRunOptions): void;
3248
- connect(): Promise<GenericHandlerResult>;
3249
- getTransportStats(): Promise<RTCStatsReport>;
3250
- protected _assertSendDirection(): void;
3251
- protected _assertRecvDirection(): void;
3252
- getReceiverStats(localId: string): Promise<RTCStatsReport>;
3253
- stopSending(localId: string): Promise<GenericHandlerResult>;
3254
- abstract send(options: HandlerSendOptions): Promise<HandlerSendResult>;
3255
- replaceTrack(localId: string, track: MediaStreamTrack | null): Promise<void>;
3256
- setMaxSpatialLayer(localId: string, spatialLayer: number): Promise<void>;
3257
- setRtpEncodingParameters(localId: string, params: any): Promise<void>;
3258
- getSenderStats(localId: string): Promise<RTCStatsReport>;
3259
- _addEventListeners(): void;
3260
- addCustomEventListeners(): void;
3208
+ interface PluginViews {
3209
+ [viewId: string]: {
3210
+ url: string;
3211
+ suggestedPosition: string;
3212
+ };
3261
3213
  }
3262
- type DCMessage = {
3263
- type: string;
3264
- payload: Record<string, unknown>;
3265
- };
3266
- type TransportPromiseEvents = {
3267
- 'close': {
3268
- answer: RTCSessionDescriptionInit;
3214
+ interface PluginConfig {
3215
+ name: string;
3216
+ pluginId: string;
3217
+ version: string;
3218
+ description: string;
3219
+ author?: string;
3220
+ repository?: string;
3221
+ tags?: string[];
3222
+ picture?: string;
3223
+ url?: string;
3224
+ files: {
3225
+ include: string[];
3226
+ exclude?: string[];
3269
3227
  };
3270
- 'negotiate': {
3271
- description: RTCSessionDescriptionInit;
3272
- };
3273
- };
3274
- type ConsumerOptions = {
3275
- id?: string;
3276
- producerId: string;
3277
- producingPeerId: string;
3278
- producingTransportId: string;
3279
- kind?: 'audio' | 'video';
3280
- paused?: boolean;
3281
- appData?: Record<string, unknown>;
3282
- mimeType?: string;
3283
- localId: string;
3284
- handler: HandlerInterface<TransportPromiseEvents>;
3285
- track?: MediaStreamTrack;
3286
- rtpReceiver?: RTCRtpReceiver;
3287
- transceiver: RTCRtpTransceiver;
3288
- closeTranscieverOnClose?: boolean;
3289
- };
3290
- type MediaKind$1 = 'audio' | 'video';
3291
- declare class Consumer extends EnhancedEventEmitter<TransportPromiseEvents> {
3292
- readonly rtpReceiver: RTCRtpReceiver;
3293
- readonly id: string;
3294
- readonly localId: string;
3295
- readonly producerId: string;
3296
- readonly producingTransportId: string;
3297
- readonly mimeType: string;
3298
- readonly track: MediaStreamTrack;
3299
- readonly peerId: string;
3300
- readonly appData: Record<string, unknown>;
3301
- readonly transceiver: RTCRtpTransceiver;
3302
- constructor(context: Context<ContextState>, opts: ConsumerOptions);
3303
- readonly closed: boolean;
3304
- readonly kind: MediaKind$1;
3305
- readonly paused: boolean;
3306
- close(reason?: string, closeTranscieverOnClose?: boolean): void;
3307
- getStats(): Promise<RTCStatsReport>;
3308
- pause(): void;
3309
- resume(): void;
3310
- }
3311
- declare const localMediaEvents: readonly [
3312
- "AUDIO_TRACK_CHANGE",
3313
- "VIDEO_TRACK_CHANGE",
3314
- "SCREENSHARE_TRACK_CHANGE",
3315
- "SCREENSHARE_ENDED",
3316
- "AUDIO_TRACK_SILENT",
3317
- "FORCE_MUTE_AUDIO",
3318
- "FORCE_MUTE_VIDEO",
3319
- "DEVICE_CHANGE",
3320
- "DEVICE_LIST_UPDATED"
3321
- ];
3322
- declare const e2eeEvents: readonly [
3323
- "participantEncryptionStatusChanged",
3324
- "encryptionError"
3325
- ];
3326
- declare const e2eeKeyEvents: readonly [
3327
- "setKey",
3328
- "ratchetRequest",
3329
- "keyRatcheted"
3330
- ];
3331
- type LocalMediaEvents = (typeof localMediaEvents)[number];
3332
- type EncryptionEvents = (typeof e2eeEvents)[number];
3333
- type KeyProviderEvents = (typeof e2eeKeyEvents)[number];
3334
- type ParticipantEvents = {
3335
- ['videoUpdate']: (payload: {
3336
- videoEnabled: boolean;
3337
- videoTrack: MediaStreamTrack;
3338
- }) => void;
3339
- ['audioUpdate']: (payload: {
3340
- audioEnabled: boolean;
3341
- audioTrack: MediaStreamTrack;
3342
- }) => void;
3343
- ['screenShareUpdate']: (payload: {
3344
- screenShareEnabled: boolean;
3345
- screenShareTracks: {
3346
- audio: MediaStreamTrack;
3347
- video: MediaStreamTrack;
3348
- };
3349
- }) => void;
3350
- ['pinned']: (payload: Participant) => void;
3351
- ['unpinned']: (payload: Participant) => void;
3352
- ['poorConnection']: (payload: {
3353
- score: number;
3354
- kind: string;
3355
- }) => void;
3356
- ['stageStatusUpdate']: (payload: Participant) => void;
3357
- ['mediaScoreUpdate']: (payload: {
3358
- kind: MediaKind$1;
3359
- isScreenshare: boolean;
3360
- score: number;
3361
- participantId: string;
3362
- scoreStats: ConsumerScoreStats;
3363
- }) => void;
3364
- ['kicked']: () => void;
3365
- ['*']: (event: string, ...args: any[]) => void;
3366
- };
3367
- type SelfEvents = {
3368
- ['toggleTile']: (payload: {
3369
- hidden: boolean;
3370
- }) => void;
3371
- ['videoUpdate']: (payload: {
3372
- videoEnabled: boolean;
3373
- videoTrack: MediaStreamTrack;
3374
- }) => void;
3375
- ['audioUpdate']: (payload: {
3376
- audioEnabled: boolean;
3377
- audioTrack: MediaStreamTrack;
3378
- }) => void;
3379
- ['screenShareUpdate']: (payload: {
3380
- screenShareEnabled: boolean;
3381
- screenShareTracks: {
3382
- audio?: MediaStreamTrack;
3383
- video?: MediaStreamTrack;
3384
- };
3385
- }) => void;
3386
- ['deviceUpdate']: ({ device }: {
3387
- device: MediaDeviceInfo;
3388
- }) => void;
3389
- ['deviceListUpdate']: (changedDevices: {
3390
- added: MediaDeviceInfo[];
3391
- removed: MediaDeviceInfo[];
3392
- devices: MediaDeviceInfo[];
3393
- }) => void;
3394
- ['pinned']: (payload: Self) => void;
3395
- ['unpinned']: (payload: Self) => void;
3396
- ['mediaPermissionUpdate']: (payload: {
3397
- message: keyof typeof MediaPermission;
3398
- kind: 'audio' | 'video' | 'screenshare';
3399
- }) => void;
3400
- ['mediaPermissionError']: (payload: {
3401
- message: keyof typeof MediaPermission;
3402
- constraints: any;
3403
- kind: 'audio' | 'video' | 'screenshare';
3404
- }) => void;
3405
- ['mediaScoreUpdate']: (payload: {
3406
- kind: MediaKind$1;
3407
- isScreenshare: boolean;
3408
- score: number;
3409
- participantId: string;
3410
- scoreStats: ProducerScoreStats;
3411
- }) => void;
3412
- ['waitlisted']: () => void;
3413
- ['roomLeft']: (payload: {
3414
- state: LeaveRoomState;
3415
- }) => void;
3416
- ['roomJoined']: (payload: {
3417
- reconnected: boolean;
3418
- }) => void;
3419
- ['autoplayError']: (error: Error) => void;
3420
- ['*']: (event: string, ...args: any[]) => void;
3421
- };
3422
- type ParticipantMapEvents = {
3423
- ['participantJoined']: (payload: Participant) => void;
3424
- ['participantLeft']: (payload: Participant) => void;
3425
- ['participantsCleared']: () => void;
3426
- ['participantsUpdate']: () => void;
3427
- ['kicked']: (payload: {
3428
- id: string;
3429
- }) => void;
3430
- };
3431
- declare class ParticipantMap<T extends Pick<Participant, 'id' | keyof TypedEventEmitter<ParticipantEvents>> = Participant> extends ClientMap<ParticipantEvents, T, ParticipantMapEvents> {
3432
- constructor(logger: Logger, options?: MapEvents<ParticipantMapEvents>);
3433
- add(participant: T, emitEvent?: boolean): this;
3434
- clear(emitEvent?: boolean, removeListeners?: boolean): void;
3435
- delete(participantId: string, emitEvent?: boolean, removeListeners?: boolean): boolean;
3436
- }
3437
- type StageSocketMessage = GetStageRequestsResponse | GetStagePeersResponse | DenyStageAccessRequest | PeerStatusUpdate;
3438
- declare class StageSocketHandler {
3439
- constructor(socketService: SocketService);
3440
- getStageRequests(): Promise<GetStageRequestsResponse>;
3441
- requestAccess(): void;
3442
- cancelRequestAccess(): void;
3443
- grantAccess(userIds: string[]): Promise<void>;
3444
- denyAccess(userIds: string[]): Promise<void>;
3445
- joinStage(): Promise<{
3446
- id: string;
3447
- payload: Uint8Array;
3448
- }>;
3449
- leaveStage(userId: string): Promise<{
3450
- id: string;
3451
- payload: Uint8Array;
3452
- }>;
3453
- kick(userIds: string[]): Promise<{
3454
- id: string;
3455
- payload: Uint8Array;
3456
- }>;
3457
- on(event: number, handler: (socketMessage: StageSocketMessage, messageId?: string) => void): void;
3458
- getPeerInfo(peerId: string): Promise<PeerInfoResponse>;
3459
- }
3460
- type StageStatus = 'OFF_STAGE' | 'REQUESTED_TO_JOIN_STAGE' | 'ACCEPTED_TO_JOIN_STAGE' | 'ON_STAGE';
3461
- interface StageRequestPayload {
3462
- displayName: string;
3463
- userId: string;
3464
- peerId: string;
3465
- }
3466
- type StageEvents = {
3467
- ['stageAccessRequestUpdate']: (requests?: StageRequestPayload[]) => void;
3468
- ['stageStatusUpdate']: (status: StageStatus) => void;
3469
- ['newStageRequest']: (payload: {
3470
- count: number;
3471
- }) => void;
3472
- ['stageRequestApproved']: () => void;
3473
- ['stageRequestRejected']: () => void;
3474
- ['*']: (eventName: string, ...args: any[]) => void;
3475
- };
3476
- declare class Stage extends TypedEventEmitter<StageEvents> {
3477
- readonly telemetry: Telemetry;
3478
- constructor(context: Context<ContextState>, self: Self, participants: Participants, stageSocketHandler: StageSocketHandler, roomSocketHandler: RoomSocketHandler);
3479
- readonly status: StageStatus;
3480
- private setupEvents;
3481
- getAccessRequests(): {
3482
- stageRequests: StageRequestPayload[];
3483
- };
3484
- requestAccess(): Promise<void>;
3485
- cancelRequestAccess(): Promise<void>;
3486
- grantAccess(userIds: string[]): Promise<void>;
3487
- denyAccess(userIds: string[]): Promise<void>;
3488
- readonly peerId: string;
3489
- join(): Promise<void>;
3490
- leave(): Promise<void>;
3491
- kick(userIds: string[]): Promise<{
3492
- id: string;
3493
- payload: Uint8Array;
3494
- }>;
3495
- }
3496
- declare const modes: readonly [
3497
- "ACTIVE_GRID",
3498
- "PAGINATED",
3499
- "MANUAL"
3500
- ];
3501
- type ViewMode = (typeof modes)[number];
3502
- interface BroadcastMessagePayload {
3503
- [key: string]: boolean | number | string | Date | ActiveTab;
3504
- }
3505
- interface PeerProducerConfig {
3506
- audio: boolean;
3507
- video: boolean;
3508
- screenshareAudio: boolean;
3509
- screenshareVideo: boolean;
3510
- }
3511
- type BroadcastMessageTarget = {
3512
- participantIds: string[];
3513
- } | {
3514
- presetNames: string[];
3515
- } | {
3516
- meetingIds: string[];
3517
- };
3518
- type ParticipantsEvents = {
3519
- ['viewModeChanged']: (payload: {
3520
- viewMode: string;
3521
- currentPage: number;
3522
- pageCount: number;
3523
- }) => void;
3524
- ['activeSpeaker']: (payload: {
3525
- peerId: string;
3526
- volume: number;
3527
- }) => void;
3528
- ['broadcastedMessage']: (payload: {
3529
- type: string;
3530
- payload: BroadcastMessagePayload;
3531
- timestamp: number;
3532
- }) => void;
3533
- ['poorConnection']: (payload: {
3534
- participantId: string;
3535
- score: number;
3536
- kind: string;
3537
- }) => void;
3538
- ['pageChanged']: (payload: {
3539
- viewMode: string;
3540
- currentPage: number;
3541
- pageCount: number;
3542
- }) => void;
3543
- ['mediaScoreUpdate']: (payload: {
3544
- kind: string;
3545
- isScreenshare: boolean;
3546
- score: number;
3547
- participantId: string;
3548
- scoreStats: ConsumerScoreStats;
3549
- }) => void;
3550
- ['media_decode_error']: (payload: {
3551
- reason: string;
3552
- code: '1702' | '1703';
3553
- }) => void;
3554
- ['*']: (event: string, ...args: any[]) => void;
3555
- };
3556
- declare class Participants extends TypedEventEmitter<ParticipantsEvents> {
3557
- readonly waitlisted: Readonly<ParticipantMap<Pick<Participant, Exclude<keyof Participant, 'audioTrack' | 'videoTrack' | 'screenShareTracks'>>>>;
3558
- readonly joined: Readonly<ParticipantMap>;
3559
- readonly active: Readonly<ParticipantMap>;
3560
- readonly videoSubscribed: Readonly<ParticipantMap>;
3561
- readonly audioSubscribed: Readonly<ParticipantMap>;
3562
- readonly pinned: Readonly<ParticipantMap>;
3563
- readonly all: Readonly<BasicParticipantsMap>;
3564
- readonly pip: Pip;
3565
- rateLimitConfig: {
3566
- maxInvocations: number;
3567
- period: number;
3568
- };
3569
- readonly rateLimits: {
3570
- maxInvocations: number;
3571
- period: number;
3572
- };
3573
- updateRateLimits(num: number, period: number): void;
3574
- readonly telemetry: Telemetry;
3575
- viewMode: ViewMode;
3576
- currentPage: number;
3577
- lastActiveSpeaker: string;
3578
- selectedPeers: SelectedPeers;
3579
- constructor(context: Context<ContextState>, self: Self, roomSocketHandler: RoomSocketHandler);
3580
- setupEvents(): void;
3581
- readonly count: number;
3582
- readonly maxActiveParticipantsCount: number;
3583
- setMaxActiveParticipantsCount(limit: number): void;
3584
- readonly pageCount: number;
3585
- acceptWaitingRoomRequest(id: string): void;
3586
- acceptAllWaitingRoomRequest(userIds: string[]): Promise<void>;
3587
- rejectWaitingRoomRequest(id: string): Promise<void>;
3588
- setViewMode(viewMode: ViewMode): Promise<void>;
3589
- subscribe(peerIds: string[], kinds?: ('audio' | 'video' | 'screenshareAudio' | 'screenshareVideo')[]): Promise<void>;
3590
- unsubscribe(peerIds: string[], kinds?: ('audio' | 'video' | 'screenshareAudio' | 'screenshareVideo')[]): Promise<void>;
3591
- getPeerIdsForCurrentPage(): string[];
3592
- setPage(page: number): Promise<void>;
3593
- disableAllAudio(allowUnmute: boolean): Promise<void>;
3594
- disableAllVideo(): Promise<void>;
3595
- disableAudio(participantId: string): Promise<void>;
3596
- disableVideo(participantId: string): Promise<void>;
3597
- kick(participantId: string): Promise<void>;
3598
- kickAll(): Promise<void>;
3599
- broadcastMessage(type: Exclude<string, 'spotlight'>, payload: BroadcastMessagePayload, target?: BroadcastMessageTarget): Promise<void>;
3600
- getAllJoinedPeers(searchQuery: string, limit: number, offset: number): Promise<{
3601
- id: string;
3602
- userId: string;
3603
- name: string;
3604
- displayName: string;
3605
- stageType: StageStatus;
3606
- customParticipantId: string;
3607
- presetId: string;
3608
- picture: string;
3609
- waitlisted: boolean;
3610
- stageStatus: StageStatus;
3611
- metadata: {
3612
- preset_name: string;
3613
- };
3614
- recorderType: string;
3615
- flags: {
3616
- hiddenParticipant: boolean;
3617
- hidden_participant: boolean;
3618
- recorder: boolean;
3619
- };
3620
- }[]>;
3621
- updatePermissions(participantIds: string[], permissions: PresetUpdates): Promise<void>;
3622
- getParticipantsInMeetingPreJoin(): Promise<RoomPeersInfoResponse>;
3623
- }
3624
- interface PluginResponse {
3625
- baseURL: string;
3626
- createdAt: string;
3627
- description: string;
3628
- id: string;
3629
- name: string;
3630
- organizationId: string;
3631
- picture: string;
3632
- private: boolean;
3633
- published: boolean;
3634
- staggered: boolean;
3635
- tags: string[];
3636
- type: string;
3637
- updatedAt: string;
3638
- }
3639
- interface PluginViews {
3640
- [viewId: string]: {
3641
- url: string;
3642
- suggestedPosition: string;
3643
- };
3644
- }
3645
- interface PluginConfig {
3646
- name: string;
3647
- pluginId: string;
3648
- version: string;
3649
- description: string;
3650
- author?: string;
3651
- repository?: string;
3652
- tags?: string[];
3653
- picture?: string;
3654
- url?: string;
3655
- files: {
3656
- include: string[];
3657
- exclude?: string[];
3658
- };
3659
- views?: PluginViews;
3660
- contentScript?: string;
3661
- permissions?: {
3662
- [key: string]: {
3663
- default: boolean;
3664
- description: string;
3665
- };
3228
+ views?: PluginViews;
3229
+ contentScript?: string;
3230
+ permissions?: {
3231
+ [key: string]: {
3232
+ default: boolean;
3233
+ description: string;
3234
+ };
3666
3235
  };
3667
3236
  config?: {
3668
3237
  [key: string]: string;
@@ -3961,18 +3530,6 @@ type PresetV2CamelCased = {
3961
3530
  text: boolean;
3962
3531
  files: boolean;
3963
3532
  };
3964
- channel?: {
3965
- canCreate: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3966
- canDelete: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3967
- canUpdate: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3968
- canReadAll: boolean;
3969
- };
3970
- message?: {
3971
- canDelete: 'NONE' | 'SELF' | 'ALL';
3972
- canEdit: 'NONE' | 'SELF' | 'ALL';
3973
- deleteCutoffTimeSeconds: number;
3974
- editCutoffTimeSeconds: number;
3975
- };
3976
3533
  };
3977
3534
  isRecorder?: boolean;
3978
3535
  recorderType: RecorderType$1;
@@ -4118,8 +3675,6 @@ declare class PermissionPreset extends TypedEventEmitter<PermissionEvents> {
4118
3675
  readonly canProduceAudio: Readonly<MediaProductionPermissionType>;
4119
3676
  readonly chatPublic: Readonly<PresetPermissions['chat']['public']>;
4120
3677
  readonly chatPrivate: Readonly<PresetPermissions['chat']['private']>;
4121
- readonly chatChannel: Readonly<PresetPermissions['chat']['channel']>;
4122
- readonly chatMessage: Readonly<PresetPermissions['chat']['message']>;
4123
3678
  readonly connectedMeetings: Readonly<PresetPermissions['connectedMeetings']>;
4124
3679
  readonly hiddenParticipant: Readonly<boolean>;
4125
3680
  readonly showParticipantList: Readonly<boolean>;
@@ -4250,6 +3805,65 @@ declare class API {
4250
3805
  setRoomUUID(id: string): void;
4251
3806
  setOrganizationId(id: string): void;
4252
3807
  }
3808
+ type StageSocketMessage = GetStageRequestsResponse | GetStagePeersResponse | DenyStageAccessRequest | PeerStatusUpdate;
3809
+ declare class StageSocketHandler {
3810
+ constructor(socketService: SocketService);
3811
+ getStageRequests(): Promise<GetStageRequestsResponse>;
3812
+ requestAccess(): void;
3813
+ cancelRequestAccess(): void;
3814
+ grantAccess(userIds: string[]): Promise<void>;
3815
+ denyAccess(userIds: string[]): Promise<void>;
3816
+ joinStage(): Promise<{
3817
+ id: string;
3818
+ payload: Uint8Array;
3819
+ }>;
3820
+ leaveStage(userId: string): Promise<{
3821
+ id: string;
3822
+ payload: Uint8Array;
3823
+ }>;
3824
+ kick(userIds: string[]): Promise<{
3825
+ id: string;
3826
+ payload: Uint8Array;
3827
+ }>;
3828
+ on(event: number, handler: (socketMessage: StageSocketMessage, messageId?: string) => void): void;
3829
+ getPeerInfo(peerId: string): Promise<PeerInfoResponse>;
3830
+ }
3831
+ type StageStatus = 'OFF_STAGE' | 'REQUESTED_TO_JOIN_STAGE' | 'ACCEPTED_TO_JOIN_STAGE' | 'ON_STAGE';
3832
+ interface StageRequestPayload {
3833
+ displayName: string;
3834
+ userId: string;
3835
+ peerId: string;
3836
+ }
3837
+ type StageEvents = {
3838
+ ['stageAccessRequestUpdate']: (requests?: StageRequestPayload[]) => void;
3839
+ ['stageStatusUpdate']: (status: StageStatus) => void;
3840
+ ['newStageRequest']: (payload: {
3841
+ count: number;
3842
+ }) => void;
3843
+ ['stageRequestApproved']: () => void;
3844
+ ['stageRequestRejected']: () => void;
3845
+ ['*']: (eventName: string, ...args: any[]) => void;
3846
+ };
3847
+ declare class Stage extends TypedEventEmitter<StageEvents> {
3848
+ readonly telemetry: Telemetry;
3849
+ constructor(context: Context<ContextState>, self: Self, participants: Participants, stageSocketHandler: StageSocketHandler, roomSocketHandler: RoomSocketHandler);
3850
+ readonly status: StageStatus;
3851
+ private setupEvents;
3852
+ getAccessRequests(): {
3853
+ stageRequests: StageRequestPayload[];
3854
+ };
3855
+ requestAccess(): Promise<void>;
3856
+ cancelRequestAccess(): Promise<void>;
3857
+ grantAccess(userIds: string[]): Promise<void>;
3858
+ denyAccess(userIds: string[]): Promise<void>;
3859
+ readonly peerId: string;
3860
+ join(): Promise<void>;
3861
+ leave(): Promise<void>;
3862
+ kick(userIds: string[]): Promise<{
3863
+ id: string;
3864
+ payload: Uint8Array;
3865
+ }>;
3866
+ }
4253
3867
  declare class PollSocketHandler {
4254
3868
  readonly logger: Logger;
4255
3869
  readonly telemetry: Telemetry;
@@ -4474,7 +4088,6 @@ declare const ERROR_CODES: {
4474
4088
  '0504': string;
4475
4089
  '0505': string;
4476
4090
  '0506': string;
4477
- '0510': string;
4478
4091
  '0600': string;
4479
4092
  '0601': string;
4480
4093
  '0602': string;
@@ -4837,90 +4450,384 @@ declare class Client {
4837
4450
  joinRoom(): Promise<void>;
4838
4451
  leaveRoom(state?: LeaveRoomState): Promise<void>;
4839
4452
  }
4840
- type ChatChannelSocketMessage = GetChatChannelResponse;
4841
- interface ChatChannel {
4842
- id: string;
4843
- displayName: string;
4844
- memberIds: string[];
4845
- displayPictureUrl?: string;
4846
- visibility?: string;
4847
- isDirectMessage?: boolean;
4848
- latestMessage?: Message;
4849
- unreadCount: number;
4850
- }
4851
- interface UpdateChannelRequestPayload {
4852
- memberIds?: string[];
4853
- displayName?: string;
4854
- displayPictureUrl?: string;
4855
- visibility?: string;
4856
- }
4857
- declare class ChatChannelSocketHandler {
4858
- readonly telemetry: Telemetry;
4859
- readonly logger: Logger;
4860
- constructor(context: Context<ContextState>, socketService: SocketService);
4861
- createChannel(displayName: string, memberIds: string[], displayPictureUrl?: string, visibility?: string, isDirectMessage?: boolean): Promise<ChatChannel>;
4862
- updateChannel(channelId: string, payload: UpdateChannelRequestPayload): Promise<ChatChannel>;
4863
- static formatChannel(socketChannel: ChatChannel$1): ChatChannel;
4864
- getChannelMembers(channelId: string): Promise<BasicParticipant[]>;
4865
- on(event: number, handler: (socketMessage: ChatChannelSocketMessage) => void): void;
4866
- }
4867
4453
  type ClientType = {
4868
4454
  callStats?: unknown;
4869
4455
  Telemetry?: typeof Telemetry;
4870
4456
  };
4871
- declare global {
4872
- interface Navigator {
4873
- RNLocalMediaHandlerImpl?: any;
4874
- RNAudioSampleHandlerImpl?: any;
4875
- RNBackgroundTimerImpl?: any;
4876
- RNDeviceInfoImpl?: any;
4877
- isReactNative?: boolean;
4878
- }
4879
- interface Window {
4880
- RTK?: ClientType;
4881
- FAST_RTK?: boolean;
4882
- MediaStreamTrackProcessor?: any;
4883
- MediaStreamTrackGenerator?: any;
4884
- TransformStream?: any;
4885
- }
4457
+ declare global {
4458
+ interface Navigator {
4459
+ RNLocalMediaHandlerImpl?: any;
4460
+ RNAudioSampleHandlerImpl?: any;
4461
+ RNBackgroundTimerImpl?: any;
4462
+ RNDeviceInfoImpl?: any;
4463
+ isReactNative?: boolean;
4464
+ }
4465
+ interface Window {
4466
+ RTK?: ClientType;
4467
+ FAST_RTK?: boolean;
4468
+ MediaStreamTrackProcessor?: any;
4469
+ MediaStreamTrackGenerator?: any;
4470
+ TransformStream?: any;
4471
+ }
4472
+ }
4473
+ interface GenericHandlerResult {
4474
+ offerSdp: RTCSessionDescriptionInit;
4475
+ callback: (answer: RTCSessionDescriptionInit) => Promise<any>;
4476
+ sender?: RTCRtpSender;
4477
+ }
4478
+ type HandlerRunOptions = {
4479
+ direction: 'send' | 'recv';
4480
+ iceServers?: RTCIceServer[];
4481
+ iceTransportPolicy?: RTCIceTransportPolicy;
4482
+ additionalSettings?: any;
4483
+ proprietaryConstraints?: any;
4484
+ onTrackHandler?: (event: RTCTrackEvent) => void;
4485
+ };
4486
+ type CodecOption = {
4487
+ name: string;
4488
+ parameters?: string[];
4489
+ };
4490
+ type HandlerSendOptions = {
4491
+ track: MediaStreamTrack | 'audio' | 'video';
4492
+ screenShare?: boolean;
4493
+ encodings?: RTCRtpEncodingParameters[];
4494
+ codecs?: RTCRtpCodecCapability[];
4495
+ codecOptions?: CodecOption[];
4496
+ };
4497
+ interface HandlerSendResult extends GenericHandlerResult {
4498
+ mid: string;
4499
+ }
4500
+ declare abstract class HandlerInterface<TransportPromiseEvents> extends EnhancedEventEmitter<TransportPromiseEvents> {
4501
+ protected _sendWebStream: MediaStream;
4502
+ protected _sendScreenShareStream: MediaStream;
4503
+ protected _direction?: 'send' | 'recv';
4504
+ pc: RTCPeerConnection;
4505
+ protected _transportReady: boolean;
4506
+ private readonly _mapMidTransceiver;
4507
+ enableHighBitrate: boolean;
4508
+ enableStereo: boolean;
4509
+ enableDtx: boolean;
4510
+ readonly midTransceiverMap: Map<string, RTCRtpTransceiver>;
4511
+ abstract readonly name: string;
4512
+ close(): void;
4513
+ restartIce(): Promise<GenericHandlerResult>;
4514
+ init({ direction, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, onTrackHandler, }: HandlerRunOptions): void;
4515
+ connect(): Promise<GenericHandlerResult>;
4516
+ getTransportStats(): Promise<RTCStatsReport>;
4517
+ protected _assertSendDirection(): void;
4518
+ protected _assertRecvDirection(): void;
4519
+ getReceiverStats(localId: string): Promise<RTCStatsReport>;
4520
+ stopSending(localId: string): Promise<GenericHandlerResult>;
4521
+ abstract send(options: HandlerSendOptions): Promise<HandlerSendResult>;
4522
+ replaceTrack(localId: string, track: MediaStreamTrack | null): Promise<void>;
4523
+ setMaxSpatialLayer(localId: string, spatialLayer: number): Promise<void>;
4524
+ setRtpEncodingParameters(localId: string, params: any): Promise<void>;
4525
+ getSenderStats(localId: string): Promise<RTCStatsReport>;
4526
+ _addEventListeners(): void;
4527
+ addCustomEventListeners(): void;
4528
+ }
4529
+ type DCMessage = {
4530
+ type: string;
4531
+ payload: Record<string, unknown>;
4532
+ };
4533
+ type TransportPromiseEvents = {
4534
+ 'close': {
4535
+ answer: RTCSessionDescriptionInit;
4536
+ };
4537
+ 'negotiate': {
4538
+ description: RTCSessionDescriptionInit;
4539
+ };
4540
+ };
4541
+ type ConsumerOptions = {
4542
+ id?: string;
4543
+ producerId: string;
4544
+ producingPeerId: string;
4545
+ producingTransportId: string;
4546
+ kind?: 'audio' | 'video';
4547
+ paused?: boolean;
4548
+ appData?: Record<string, unknown>;
4549
+ mimeType?: string;
4550
+ localId: string;
4551
+ handler: HandlerInterface<TransportPromiseEvents>;
4552
+ track?: MediaStreamTrack;
4553
+ rtpReceiver?: RTCRtpReceiver;
4554
+ transceiver: RTCRtpTransceiver;
4555
+ closeTranscieverOnClose?: boolean;
4556
+ };
4557
+ type MediaKind$1 = 'audio' | 'video';
4558
+ declare class Consumer extends EnhancedEventEmitter<TransportPromiseEvents> {
4559
+ readonly rtpReceiver: RTCRtpReceiver;
4560
+ readonly id: string;
4561
+ readonly localId: string;
4562
+ readonly producerId: string;
4563
+ readonly producingTransportId: string;
4564
+ readonly mimeType: string;
4565
+ readonly track: MediaStreamTrack;
4566
+ readonly peerId: string;
4567
+ readonly appData: Record<string, unknown>;
4568
+ readonly transceiver: RTCRtpTransceiver;
4569
+ constructor(context: Context<ContextState>, opts: ConsumerOptions);
4570
+ readonly closed: boolean;
4571
+ readonly kind: MediaKind$1;
4572
+ readonly paused: boolean;
4573
+ close(reason?: string, closeTranscieverOnClose?: boolean): void;
4574
+ getStats(): Promise<RTCStatsReport>;
4575
+ pause(): void;
4576
+ resume(): void;
4577
+ }
4578
+ declare const localMediaEvents: readonly [
4579
+ "AUDIO_TRACK_CHANGE",
4580
+ "VIDEO_TRACK_CHANGE",
4581
+ "SCREENSHARE_TRACK_CHANGE",
4582
+ "SCREENSHARE_ENDED",
4583
+ "AUDIO_TRACK_SILENT",
4584
+ "FORCE_MUTE_AUDIO",
4585
+ "FORCE_MUTE_VIDEO",
4586
+ "DEVICE_CHANGE",
4587
+ "DEVICE_LIST_UPDATED"
4588
+ ];
4589
+ declare const e2eeEvents: readonly [
4590
+ "participantEncryptionStatusChanged",
4591
+ "encryptionError"
4592
+ ];
4593
+ declare const e2eeKeyEvents: readonly [
4594
+ "setKey",
4595
+ "ratchetRequest",
4596
+ "keyRatcheted"
4597
+ ];
4598
+ type LocalMediaEvents = (typeof localMediaEvents)[number];
4599
+ type EncryptionEvents = (typeof e2eeEvents)[number];
4600
+ type KeyProviderEvents = (typeof e2eeKeyEvents)[number];
4601
+ type ParticipantEvents = {
4602
+ ['videoUpdate']: (payload: {
4603
+ videoEnabled: boolean;
4604
+ videoTrack: MediaStreamTrack;
4605
+ }) => void;
4606
+ ['audioUpdate']: (payload: {
4607
+ audioEnabled: boolean;
4608
+ audioTrack: MediaStreamTrack;
4609
+ }) => void;
4610
+ ['screenShareUpdate']: (payload: {
4611
+ screenShareEnabled: boolean;
4612
+ screenShareTracks: {
4613
+ audio: MediaStreamTrack;
4614
+ video: MediaStreamTrack;
4615
+ };
4616
+ }) => void;
4617
+ ['pinned']: (payload: Participant) => void;
4618
+ ['unpinned']: (payload: Participant) => void;
4619
+ ['poorConnection']: (payload: {
4620
+ score: number;
4621
+ kind: string;
4622
+ }) => void;
4623
+ ['stageStatusUpdate']: (payload: Participant) => void;
4624
+ ['mediaScoreUpdate']: (payload: {
4625
+ kind: MediaKind$1;
4626
+ isScreenshare: boolean;
4627
+ score: number;
4628
+ participantId: string;
4629
+ scoreStats: ConsumerScoreStats;
4630
+ }) => void;
4631
+ ['kicked']: () => void;
4632
+ ['*']: (event: string, ...args: any[]) => void;
4633
+ };
4634
+ type SelfEvents = {
4635
+ ['toggleTile']: (payload: {
4636
+ hidden: boolean;
4637
+ }) => void;
4638
+ ['videoUpdate']: (payload: {
4639
+ videoEnabled: boolean;
4640
+ videoTrack: MediaStreamTrack;
4641
+ }) => void;
4642
+ ['audioUpdate']: (payload: {
4643
+ audioEnabled: boolean;
4644
+ audioTrack: MediaStreamTrack;
4645
+ }) => void;
4646
+ ['screenShareUpdate']: (payload: {
4647
+ screenShareEnabled: boolean;
4648
+ screenShareTracks: {
4649
+ audio?: MediaStreamTrack;
4650
+ video?: MediaStreamTrack;
4651
+ };
4652
+ }) => void;
4653
+ ['deviceUpdate']: ({ device }: {
4654
+ device: MediaDeviceInfo;
4655
+ }) => void;
4656
+ ['deviceListUpdate']: (changedDevices: {
4657
+ added: MediaDeviceInfo[];
4658
+ removed: MediaDeviceInfo[];
4659
+ devices: MediaDeviceInfo[];
4660
+ }) => void;
4661
+ ['pinned']: (payload: Self) => void;
4662
+ ['unpinned']: (payload: Self) => void;
4663
+ ['mediaPermissionUpdate']: (payload: {
4664
+ message: keyof typeof MediaPermission;
4665
+ kind: 'audio' | 'video' | 'screenshare';
4666
+ }) => void;
4667
+ ['mediaPermissionError']: (payload: {
4668
+ message: keyof typeof MediaPermission;
4669
+ constraints: any;
4670
+ kind: 'audio' | 'video' | 'screenshare';
4671
+ }) => void;
4672
+ ['mediaScoreUpdate']: (payload: {
4673
+ kind: MediaKind$1;
4674
+ isScreenshare: boolean;
4675
+ score: number;
4676
+ participantId: string;
4677
+ scoreStats: ProducerScoreStats;
4678
+ }) => void;
4679
+ ['waitlisted']: () => void;
4680
+ ['roomLeft']: (payload: {
4681
+ state: LeaveRoomState;
4682
+ }) => void;
4683
+ ['roomJoined']: (payload: {
4684
+ reconnected: boolean;
4685
+ }) => void;
4686
+ ['autoplayError']: (error: Error) => void;
4687
+ ['*']: (event: string, ...args: any[]) => void;
4688
+ };
4689
+ type ParticipantMapEvents = {
4690
+ ['participantJoined']: (payload: Participant) => void;
4691
+ ['participantLeft']: (payload: Participant) => void;
4692
+ ['participantsCleared']: () => void;
4693
+ ['participantsUpdate']: () => void;
4694
+ ['kicked']: (payload: {
4695
+ id: string;
4696
+ }) => void;
4697
+ };
4698
+ declare class ParticipantMap<T extends Pick<Participant, 'id' | keyof TypedEventEmitter<ParticipantEvents>> = Participant> extends ClientMap<ParticipantEvents, T, ParticipantMapEvents> {
4699
+ constructor(logger: Logger, options?: MapEvents<ParticipantMapEvents>);
4700
+ add(participant: T, emitEvent?: boolean): this;
4701
+ clear(emitEvent?: boolean, removeListeners?: boolean): void;
4702
+ delete(participantId: string, emitEvent?: boolean, removeListeners?: boolean): boolean;
4886
4703
  }
4887
- declare enum ChatMessageType {
4888
- TEXT = 0,
4889
- IMAGE = 1,
4890
- FILE = 2,
4891
- CUSTOM = 3
4704
+ declare const modes: readonly [
4705
+ "ACTIVE_GRID",
4706
+ "PAGINATED",
4707
+ "MANUAL"
4708
+ ];
4709
+ type ViewMode = (typeof modes)[number];
4710
+ interface BroadcastMessagePayload {
4711
+ [key: string]: boolean | number | string | Date | ActiveTab;
4892
4712
  }
4893
- type ChatSocketMessage = SendChatMessageToRoomResponse | SendChatMessageToPeersResponse | EditChatMessageResponse | DeleteChatMessageResponse;
4894
- interface SearchFilters {
4895
- channelId?: string;
4896
- timestamp?: number;
4897
- limit?: number;
4898
- reversed?: boolean;
4899
- offset?: number;
4713
+ interface PeerProducerConfig {
4714
+ audio: boolean;
4715
+ video: boolean;
4716
+ screenshareAudio: boolean;
4717
+ screenshareVideo: boolean;
4900
4718
  }
4901
- declare class ChatSocketHandler {
4719
+ type BroadcastMessageTarget = {
4720
+ participantIds: string[];
4721
+ } | {
4722
+ presetNames: string[];
4723
+ } | {
4724
+ meetingIds: string[];
4725
+ };
4726
+ type ParticipantsEvents = {
4727
+ ['viewModeChanged']: (payload: {
4728
+ viewMode: string;
4729
+ currentPage: number;
4730
+ pageCount: number;
4731
+ }) => void;
4732
+ ['activeSpeaker']: (payload: {
4733
+ peerId: string;
4734
+ volume: number;
4735
+ }) => void;
4736
+ ['broadcastedMessage']: (payload: {
4737
+ type: string;
4738
+ payload: BroadcastMessagePayload;
4739
+ timestamp: number;
4740
+ }) => void;
4741
+ ['poorConnection']: (payload: {
4742
+ participantId: string;
4743
+ score: number;
4744
+ kind: string;
4745
+ }) => void;
4746
+ ['pageChanged']: (payload: {
4747
+ viewMode: string;
4748
+ currentPage: number;
4749
+ pageCount: number;
4750
+ }) => void;
4751
+ ['mediaScoreUpdate']: (payload: {
4752
+ kind: string;
4753
+ isScreenshare: boolean;
4754
+ score: number;
4755
+ participantId: string;
4756
+ scoreStats: ConsumerScoreStats;
4757
+ }) => void;
4758
+ ['media_decode_error']: (payload: {
4759
+ reason: string;
4760
+ code: '1702' | '1703';
4761
+ }) => void;
4762
+ ['*']: (event: string, ...args: any[]) => void;
4763
+ };
4764
+ declare class Participants extends TypedEventEmitter<ParticipantsEvents> {
4765
+ readonly waitlisted: Readonly<ParticipantMap<Pick<Participant, Exclude<keyof Participant, 'audioTrack' | 'videoTrack' | 'screenShareTracks'>>>>;
4766
+ readonly joined: Readonly<ParticipantMap>;
4767
+ readonly active: Readonly<ParticipantMap>;
4768
+ readonly videoSubscribed: Readonly<ParticipantMap>;
4769
+ readonly audioSubscribed: Readonly<ParticipantMap>;
4770
+ readonly pinned: Readonly<ParticipantMap>;
4771
+ readonly all: Readonly<BasicParticipantsMap>;
4772
+ readonly pip: Pip;
4773
+ rateLimitConfig: {
4774
+ maxInvocations: number;
4775
+ period: number;
4776
+ };
4777
+ readonly rateLimits: {
4778
+ maxInvocations: number;
4779
+ period: number;
4780
+ };
4781
+ updateRateLimits(num: number, period: number): void;
4902
4782
  readonly telemetry: Telemetry;
4903
- readonly logger: Logger;
4904
- constructor(context: Context<ContextState>, socketService: SocketService);
4905
- getChatMessages(): Promise<{
4906
- id: string;
4907
- payload: Uint8Array;
4908
- }>;
4909
- getChatMessagesPaginated(timeStamp: number, size: number, reversed: boolean, offset?: number, channelId?: string): Promise<GetPaginatedChatMessageRoomResponse>;
4910
- sendMessageToRoom(message: string, messageType: ChatMessageType): void;
4911
- sendMessageToPeers(message: string, messageType: ChatMessageType, peerIds: string[]): void;
4912
- sendMessageToChannel(message: string, messageType: ChatMessageType, channelId: string): void;
4913
- sendMessage(message: string, messageType: ChatMessageType, peerIds?: string[], channelId?: string): void;
4914
- editMessage(chatId: string, message: string, payloadType: ChatMessageType, channelId?: string, pinned?: boolean): Promise<ChatMessage>;
4915
- deleteMessage(chatId: string, channelId?: string): Promise<{
4916
- channelId?: string;
4783
+ viewMode: ViewMode;
4784
+ currentPage: number;
4785
+ lastActiveSpeaker: string;
4786
+ selectedPeers: SelectedPeers;
4787
+ constructor(context: Context<ContextState>, self: Self, roomSocketHandler: RoomSocketHandler);
4788
+ setupEvents(): void;
4789
+ readonly count: number;
4790
+ readonly maxActiveParticipantsCount: number;
4791
+ setMaxActiveParticipantsCount(limit: number): void;
4792
+ readonly pageCount: number;
4793
+ acceptWaitingRoomRequest(id: string): void;
4794
+ acceptAllWaitingRoomRequest(userIds: string[]): Promise<void>;
4795
+ rejectWaitingRoomRequest(id: string): Promise<void>;
4796
+ setViewMode(viewMode: ViewMode): Promise<void>;
4797
+ subscribe(peerIds: string[], kinds?: ('audio' | 'video' | 'screenshareAudio' | 'screenshareVideo')[]): Promise<void>;
4798
+ unsubscribe(peerIds: string[], kinds?: ('audio' | 'video' | 'screenshareAudio' | 'screenshareVideo')[]): Promise<void>;
4799
+ getPeerIdsForCurrentPage(): string[];
4800
+ setPage(page: number): Promise<void>;
4801
+ disableAllAudio(allowUnmute: boolean): Promise<void>;
4802
+ disableAllVideo(): Promise<void>;
4803
+ disableAudio(participantId: string): Promise<void>;
4804
+ disableVideo(participantId: string): Promise<void>;
4805
+ kick(participantId: string): Promise<void>;
4806
+ kickAll(): Promise<void>;
4807
+ broadcastMessage(type: Exclude<string, 'spotlight'>, payload: BroadcastMessagePayload, target?: BroadcastMessageTarget): Promise<void>;
4808
+ getAllJoinedPeers(searchQuery: string, limit: number, offset: number): Promise<{
4917
4809
  id: string;
4918
- }>;
4919
- searchMessages(query: string, filters: SearchFilters): Promise<ChatMessage[]>;
4920
- getAllChannels(): Promise<ChatChannel[]>;
4921
- markLastReadMessage(channelId: string, message: Message): Promise<string>;
4922
- setPinState(message: Message, pin: boolean): Promise<PinChatMessageResponse>;
4923
- on(event: number, handler: (socketMessage: ChatSocketMessage) => void): void;
4810
+ userId: string;
4811
+ name: string;
4812
+ displayName: string;
4813
+ stageType: StageStatus;
4814
+ customParticipantId: string;
4815
+ presetId: string;
4816
+ picture: string;
4817
+ waitlisted: boolean;
4818
+ stageStatus: StageStatus;
4819
+ metadata: {
4820
+ preset_name: string;
4821
+ };
4822
+ recorderType: string;
4823
+ flags: {
4824
+ hiddenParticipant: boolean;
4825
+ hidden_participant: boolean;
4826
+ recorder: boolean;
4827
+ };
4828
+ }[]>;
4829
+ updatePermissions(participantIds: string[], permissions: PresetUpdates): Promise<void>;
4830
+ getParticipantsInMeetingPreJoin(): Promise<RoomPeersInfoResponse>;
4924
4831
  }
4925
4832
  interface RecordingConfig {
4926
4833
  fileNamePrefix?: string;
@@ -4944,7 +4851,7 @@ declare class APIClient extends API {
4944
4851
  getPluginDetails(pluginId: string): Promise<PluginResponse>;
4945
4852
  getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
4946
4853
  authorizePlugin(pluginId: string): Promise<string>;
4947
- getPresignedUrls(filename: string, viewType: string): Promise<{
4854
+ getPresignedUrls(filename: string): Promise<{
4948
4855
  getLocation: any;
4949
4856
  putLocation: any;
4950
4857
  }>;
@@ -4983,8 +4890,6 @@ interface BaseMessage<T extends MessageType> {
4983
4890
  pluginId?: string;
4984
4891
  pinned?: boolean;
4985
4892
  targetUserIds?: string[];
4986
- channelId?: string;
4987
- channelIndex?: string;
4988
4893
  }
4989
4894
  interface TextMessage extends BaseMessage<MessageType.text> {
4990
4895
  message: string;
@@ -5045,28 +4950,30 @@ interface FileMessagePayload {
5045
4950
  type MessagePayload = TextMessagePayload | ImageMessagePayload | FileMessagePayload | CustomMessagePayload;
5046
4951
  interface ChatUpdateParams {
5047
4952
  action: 'add' | 'edit' | 'delete';
5048
- message: Message | {
5049
- id: string;
5050
- channelId: string;
5051
- };
4953
+ message: Message;
5052
4954
  messages: Message[];
5053
4955
  }
5054
4956
  type ChatEvents = {
5055
4957
  ['chatUpdate']: (payload: ChatUpdateParams) => void;
5056
4958
  ['pinMessage']: (payload: Pick<ChatUpdateParams, Exclude<keyof ChatUpdateParams, 'action'>>) => void;
5057
4959
  ['unpinMessage']: (payload: Pick<ChatUpdateParams, Exclude<keyof ChatUpdateParams, 'action'>>) => void;
5058
- ['channelCreate']: (channel: ChatChannel) => void;
5059
- ['channelMessageUpdate']: (channel: ChatChannel) => void;
5060
- ['channelUpdate']: (channel?: ChatChannel) => void;
5061
4960
  ['*']: (event: string, ...args: any[]) => void;
5062
4961
  };
4962
+ interface FetchMessageOptions {
4963
+ timestamp?: number;
4964
+ offset: number;
4965
+ limit: number;
4966
+ direction: 'before' | 'after';
4967
+ }
4968
+ interface FetchPrivateMessagesOptions extends FetchMessageOptions {
4969
+ userId: string;
4970
+ }
5063
4971
  declare class Chat extends TypedEventEmitter<ChatEvents> {
5064
4972
  messages: Message[];
5065
- channels: ChatChannel[];
5066
4973
  maxTextLimit: number;
5067
4974
  readonly telemetry: Telemetry;
5068
4975
  setMaxTextLimit(limit: number): void;
5069
- constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, chatChannelSocketHandler: ChatChannelSocketHandler, self: Self, participants: Participants);
4976
+ constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, self: Self, participants: Participants);
5070
4977
  private sendMessageInternal;
5071
4978
  private sendTextMessageInternal;
5072
4979
  private sendImageMessageInternal;
@@ -5081,40 +4988,23 @@ declare class Chat extends TypedEventEmitter<ChatEvents> {
5081
4988
  sendImageMessage(image: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
5082
4989
  sendFileMessage(file: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
5083
4990
  sendMessage(message: MessagePayload, participantIds?: string[]): Promise<void>;
5084
- editTextMessage(messageId: string, message: string, channelId?: string): Promise<void>;
5085
- editImageMessage(messageId: string, image: File | ReactNativeFile, channelId?: string): Promise<void>;
5086
- editFileMessage(messageId: string, file: File | ReactNativeFile, channelId?: string): Promise<void>;
5087
- editMessage(messageId: string, message: MessagePayload, channelId?: string): Promise<void>;
5088
- deleteMessage(messageId: string, channelId?: string): Promise<void>;
4991
+ editTextMessage(messageId: string, message: string): Promise<void>;
4992
+ editImageMessage(messageId: string, image: File | ReactNativeFile): Promise<void>;
4993
+ editFileMessage(messageId: string, file: File | ReactNativeFile): Promise<void>;
4994
+ editMessage(messageId: string, message: MessagePayload): Promise<void>;
4995
+ deleteMessage(messageId: string): Promise<void>;
5089
4996
  getMessagesByUser(userId: string): Message[];
5090
4997
  getMessagesByType(type: keyof typeof MessageType): Message[];
5091
4998
  pin(id: string): Promise<void>;
5092
4999
  unpin(id: string): Promise<void>;
5093
- fetchMessages({ timestamp, offset, limit, direction, searchQuery, type, userId, }: {
5094
- timestamp?: number;
5095
- offset: number;
5096
- limit: number;
5097
- direction: 'before' | 'after';
5098
- searchQuery?: string;
5099
- type?: keyof typeof MessageType;
5100
- userId?: string;
5101
- }): Promise<Message[]>;
5102
- getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number, channelId?: string): Promise<{
5000
+ fetchMessages({ timestamp, limit, direction, }: FetchMessageOptions): Promise<Message[]>;
5001
+ fetchPrivateMessages({ timestamp, limit, direction, userId, }: FetchPrivateMessagesOptions): Promise<Message[]>;
5002
+ fetchPinnedMessages({ timestamp, limit, direction, }: FetchMessageOptions): Promise<Message[]>;
5003
+ getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number): Promise<{
5103
5004
  messages: Message[];
5104
5005
  next: boolean;
5105
5006
  }>;
5106
- createChannel(channelName: string, memberIds: string[], options?: {
5107
- displayPictureUrl?: string;
5108
- visibility?: string;
5109
- isDirectMessage?: boolean;
5110
- }): Promise<ChatChannel>;
5111
- updateChannel(channelId: string, payload: UpdateChannelRequestPayload): Promise<ChatChannel>;
5112
- sendMessageToChannel(message: MessagePayload, channelId: string, options?: {
5113
- replyTo?: Message;
5114
- }): Promise<void>;
5115
- getChannelMembers(channelId: string): Promise<BasicParticipant[]>;
5116
5007
  searchMessages(query: string, filters: unknown): Promise<unknown[]>;
5117
- markLastReadMessage(channelId: string, message: Message): Promise<void>;
5118
5008
  readonly pinned: Message[];
5119
5009
  }
5120
5010
  declare const enum PRODUCERS_TYPE {