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

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