@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.
@@ -1490,82 +1490,6 @@ interface DeleteChatMessageResponse {
1490
1490
  * @generated MessageType for protobuf message socket.chat.DeleteChatMessageResponse
1491
1491
  */
1492
1492
  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
1493
  declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1570
1494
  constructor();
1571
1495
  }
@@ -2893,33 +2817,38 @@ declare class SocketService {
2893
2817
  flush(): any;
2894
2818
  handleSocketConnectionEvents(): void;
2895
2819
  }
2896
- type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
2897
- declare class PluginSocketHandler {
2898
- constructor(context: Context<ContextState>, socketService: SocketService);
2820
+ declare enum ChatMessageType {
2821
+ TEXT = 0,
2822
+ IMAGE = 1,
2823
+ FILE = 2,
2824
+ CUSTOM = 3
2825
+ }
2826
+ type ChatSocketMessage = SendChatMessageToRoomResponse | SendChatMessageToPeersResponse | EditChatMessageResponse | DeleteChatMessageResponse;
2827
+ interface SearchFilters {
2828
+ timestamp?: number;
2829
+ limit?: number;
2830
+ reversed?: boolean;
2831
+ offset?: number;
2832
+ }
2833
+ declare class ChatSocketHandler {
2834
+ readonly telemetry: Telemetry;
2899
2835
  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;
2836
+ constructor(context: Context<ContextState>, socketService: SocketService);
2837
+ getChatMessages(): Promise<{
2838
+ id: string;
2839
+ payload: Uint8Array;
2840
+ }>;
2841
+ getChatMessagesPaginated(timeStamp: number, size: number, reversed: boolean, offset?: number): Promise<GetPaginatedChatMessageRoomResponse>;
2842
+ sendMessageToRoom(message: string, messageType: ChatMessageType): void;
2843
+ sendMessageToPeers(message: string, messageType: ChatMessageType, peerIds: string[]): void;
2844
+ sendMessage(message: string, messageType: ChatMessageType, peerIds?: string[]): void;
2845
+ editMessage(chatId: string, message: string, payloadType: ChatMessageType, pinned?: boolean): Promise<ChatMessage>;
2846
+ deleteMessage(chatId: string): Promise<{
2847
+ id: string;
2848
+ }>;
2849
+ searchMessages(query: string, filters: SearchFilters): Promise<ChatMessage[]>;
2850
+ setPinState(message: Message, pin: boolean): Promise<PinChatMessageResponse>;
2851
+ on(event: number, handler: (socketMessage: ChatSocketMessage) => void): void;
2923
2852
  }
2924
2853
  declare class SelectedPeers {
2925
2854
  private readonly _activeSpeakerPeers;
@@ -3203,466 +3132,76 @@ declare class ClientMap<T extends (EventMap & WildCardEvent<T>), U extends {
3203
3132
  clear(emitEvent?: boolean, removeListeners?: boolean): void;
3204
3133
  toArray(): U[];
3205
3134
  }
3206
- interface GenericHandlerResult {
3207
- offerSdp: RTCSessionDescriptionInit;
3208
- callback: (answer: RTCSessionDescriptionInit) => Promise<any>;
3209
- sender?: RTCRtpSender;
3135
+ type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
3136
+ declare class PluginSocketHandler {
3137
+ constructor(context: Context<ContextState>, socketService: SocketService);
3138
+ readonly logger: Logger;
3139
+ addPlugin(pluginId: string, staggered: boolean): void;
3140
+ removePlugin(pluginId: string): void;
3141
+ getActivePlugins(): Promise<EnablePluginsResponse>;
3142
+ customPluginEventToRoom(pluginId: string, data: any, messageId?: string): void;
3143
+ customPluginEventToPeers(pluginId: string, peerIds: string[], data: any, messageId?: string): void;
3144
+ enablePluginForRoom(pluginId: string, messageId?: string): void;
3145
+ enablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3146
+ disablePluginForRoom(pluginId: string, messageId?: string): void;
3147
+ disablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3148
+ storeInsertKeys(pluginId: string, store: string, insertKeys: {
3149
+ key: string;
3150
+ payload?: any;
3151
+ }[], messageId?: string): void;
3152
+ storeGetKeys(pluginId: string, store: string, getKeys: {
3153
+ key: string;
3154
+ }[], messageId?: string): void;
3155
+ storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
3156
+ key: string;
3157
+ }[], messageId?: string): void;
3158
+ storeDelete(pluginId: string, store: string, messageId?: string): void;
3159
+ getPluginDataOld(pluginId: string, store: string): void;
3160
+ storePluginDataOld(pluginId: string, store: string, data: any): void;
3161
+ on(event: number, handler: (socketMessage: PluginSocketMessage, messageId?: string) => void): void;
3210
3162
  }
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 = {
3163
+ interface PluginResponse {
3164
+ baseURL: string;
3165
+ createdAt: string;
3166
+ description: string;
3167
+ id: string;
3220
3168
  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;
3169
+ organizationId: string;
3170
+ picture: string;
3171
+ private: boolean;
3172
+ published: boolean;
3173
+ staggered: boolean;
3174
+ tags: string[];
3175
+ type: string;
3176
+ updatedAt: string;
3232
3177
  }
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;
3178
+ interface PluginViews {
3179
+ [viewId: string]: {
3180
+ url: string;
3181
+ suggestedPosition: string;
3182
+ };
3261
3183
  }
3262
- type DCMessage = {
3263
- type: string;
3264
- payload: Record<string, unknown>;
3265
- };
3266
- type TransportPromiseEvents = {
3267
- 'close': {
3268
- answer: RTCSessionDescriptionInit;
3184
+ interface PluginConfig {
3185
+ name: string;
3186
+ pluginId: string;
3187
+ version: string;
3188
+ description: string;
3189
+ author?: string;
3190
+ repository?: string;
3191
+ tags?: string[];
3192
+ picture?: string;
3193
+ url?: string;
3194
+ files: {
3195
+ include: string[];
3196
+ exclude?: string[];
3269
3197
  };
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
- };
3198
+ views?: PluginViews;
3199
+ contentScript?: string;
3200
+ permissions?: {
3201
+ [key: string]: {
3202
+ default: boolean;
3203
+ description: string;
3204
+ };
3666
3205
  };
3667
3206
  config?: {
3668
3207
  [key: string]: string;
@@ -3961,18 +3500,6 @@ type PresetV2CamelCased = {
3961
3500
  text: boolean;
3962
3501
  files: boolean;
3963
3502
  };
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
3503
  };
3977
3504
  isRecorder?: boolean;
3978
3505
  recorderType: RecorderType$1;
@@ -4118,8 +3645,6 @@ declare class PermissionPreset extends TypedEventEmitter<PermissionEvents> {
4118
3645
  readonly canProduceAudio: Readonly<MediaProductionPermissionType>;
4119
3646
  readonly chatPublic: Readonly<PresetPermissions['chat']['public']>;
4120
3647
  readonly chatPrivate: Readonly<PresetPermissions['chat']['private']>;
4121
- readonly chatChannel: Readonly<PresetPermissions['chat']['channel']>;
4122
- readonly chatMessage: Readonly<PresetPermissions['chat']['message']>;
4123
3648
  readonly connectedMeetings: Readonly<PresetPermissions['connectedMeetings']>;
4124
3649
  readonly hiddenParticipant: Readonly<boolean>;
4125
3650
  readonly showParticipantList: Readonly<boolean>;
@@ -4250,6 +3775,65 @@ declare class API {
4250
3775
  setRoomUUID(id: string): void;
4251
3776
  setOrganizationId(id: string): void;
4252
3777
  }
3778
+ type StageSocketMessage = GetStageRequestsResponse | GetStagePeersResponse | DenyStageAccessRequest | PeerStatusUpdate;
3779
+ declare class StageSocketHandler {
3780
+ constructor(socketService: SocketService);
3781
+ getStageRequests(): Promise<GetStageRequestsResponse>;
3782
+ requestAccess(): void;
3783
+ cancelRequestAccess(): void;
3784
+ grantAccess(userIds: string[]): Promise<void>;
3785
+ denyAccess(userIds: string[]): Promise<void>;
3786
+ joinStage(): Promise<{
3787
+ id: string;
3788
+ payload: Uint8Array;
3789
+ }>;
3790
+ leaveStage(userId: string): Promise<{
3791
+ id: string;
3792
+ payload: Uint8Array;
3793
+ }>;
3794
+ kick(userIds: string[]): Promise<{
3795
+ id: string;
3796
+ payload: Uint8Array;
3797
+ }>;
3798
+ on(event: number, handler: (socketMessage: StageSocketMessage, messageId?: string) => void): void;
3799
+ getPeerInfo(peerId: string): Promise<PeerInfoResponse>;
3800
+ }
3801
+ type StageStatus = 'OFF_STAGE' | 'REQUESTED_TO_JOIN_STAGE' | 'ACCEPTED_TO_JOIN_STAGE' | 'ON_STAGE';
3802
+ interface StageRequestPayload {
3803
+ displayName: string;
3804
+ userId: string;
3805
+ peerId: string;
3806
+ }
3807
+ type StageEvents = {
3808
+ ['stageAccessRequestUpdate']: (requests?: StageRequestPayload[]) => void;
3809
+ ['stageStatusUpdate']: (status: StageStatus) => void;
3810
+ ['newStageRequest']: (payload: {
3811
+ count: number;
3812
+ }) => void;
3813
+ ['stageRequestApproved']: () => void;
3814
+ ['stageRequestRejected']: () => void;
3815
+ ['*']: (eventName: string, ...args: any[]) => void;
3816
+ };
3817
+ declare class Stage extends TypedEventEmitter<StageEvents> {
3818
+ readonly telemetry: Telemetry;
3819
+ constructor(context: Context<ContextState>, self: Self, participants: Participants, stageSocketHandler: StageSocketHandler, roomSocketHandler: RoomSocketHandler);
3820
+ readonly status: StageStatus;
3821
+ private setupEvents;
3822
+ getAccessRequests(): {
3823
+ stageRequests: StageRequestPayload[];
3824
+ };
3825
+ requestAccess(): Promise<void>;
3826
+ cancelRequestAccess(): Promise<void>;
3827
+ grantAccess(userIds: string[]): Promise<void>;
3828
+ denyAccess(userIds: string[]): Promise<void>;
3829
+ readonly peerId: string;
3830
+ join(): Promise<void>;
3831
+ leave(): Promise<void>;
3832
+ kick(userIds: string[]): Promise<{
3833
+ id: string;
3834
+ payload: Uint8Array;
3835
+ }>;
3836
+ }
4253
3837
  declare class PollSocketHandler {
4254
3838
  readonly logger: Logger;
4255
3839
  readonly telemetry: Telemetry;
@@ -4474,7 +4058,6 @@ declare const ERROR_CODES: {
4474
4058
  '0504': string;
4475
4059
  '0505': string;
4476
4060
  '0506': string;
4477
- '0510': string;
4478
4061
  '0600': string;
4479
4062
  '0601': string;
4480
4063
  '0602': string;
@@ -4837,90 +4420,384 @@ declare class Client {
4837
4420
  joinRoom(): Promise<void>;
4838
4421
  leaveRoom(state?: LeaveRoomState): Promise<void>;
4839
4422
  }
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
4423
  type ClientType = {
4868
4424
  callStats?: unknown;
4869
4425
  Telemetry?: typeof Telemetry;
4870
4426
  };
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
- }
4427
+ declare global {
4428
+ interface Navigator {
4429
+ RNLocalMediaHandlerImpl?: any;
4430
+ RNAudioSampleHandlerImpl?: any;
4431
+ RNBackgroundTimerImpl?: any;
4432
+ RNDeviceInfoImpl?: any;
4433
+ isReactNative?: boolean;
4434
+ }
4435
+ interface Window {
4436
+ RTK?: ClientType;
4437
+ FAST_RTK?: boolean;
4438
+ MediaStreamTrackProcessor?: any;
4439
+ MediaStreamTrackGenerator?: any;
4440
+ TransformStream?: any;
4441
+ }
4442
+ }
4443
+ interface GenericHandlerResult {
4444
+ offerSdp: RTCSessionDescriptionInit;
4445
+ callback: (answer: RTCSessionDescriptionInit) => Promise<any>;
4446
+ sender?: RTCRtpSender;
4447
+ }
4448
+ type HandlerRunOptions = {
4449
+ direction: 'send' | 'recv';
4450
+ iceServers?: RTCIceServer[];
4451
+ iceTransportPolicy?: RTCIceTransportPolicy;
4452
+ additionalSettings?: any;
4453
+ proprietaryConstraints?: any;
4454
+ onTrackHandler?: (event: RTCTrackEvent) => void;
4455
+ };
4456
+ type CodecOption = {
4457
+ name: string;
4458
+ parameters?: string[];
4459
+ };
4460
+ type HandlerSendOptions = {
4461
+ track: MediaStreamTrack | 'audio' | 'video';
4462
+ screenShare?: boolean;
4463
+ encodings?: RTCRtpEncodingParameters[];
4464
+ codecs?: RTCRtpCodecCapability[];
4465
+ codecOptions?: CodecOption[];
4466
+ };
4467
+ interface HandlerSendResult extends GenericHandlerResult {
4468
+ mid: string;
4469
+ }
4470
+ declare abstract class HandlerInterface<TransportPromiseEvents> extends EnhancedEventEmitter<TransportPromiseEvents> {
4471
+ protected _sendWebStream: MediaStream;
4472
+ protected _sendScreenShareStream: MediaStream;
4473
+ protected _direction?: 'send' | 'recv';
4474
+ pc: RTCPeerConnection;
4475
+ protected _transportReady: boolean;
4476
+ private readonly _mapMidTransceiver;
4477
+ enableHighBitrate: boolean;
4478
+ enableStereo: boolean;
4479
+ enableDtx: boolean;
4480
+ readonly midTransceiverMap: Map<string, RTCRtpTransceiver>;
4481
+ abstract readonly name: string;
4482
+ close(): void;
4483
+ restartIce(): Promise<GenericHandlerResult>;
4484
+ init({ direction, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, onTrackHandler, }: HandlerRunOptions): void;
4485
+ connect(): Promise<GenericHandlerResult>;
4486
+ getTransportStats(): Promise<RTCStatsReport>;
4487
+ protected _assertSendDirection(): void;
4488
+ protected _assertRecvDirection(): void;
4489
+ getReceiverStats(localId: string): Promise<RTCStatsReport>;
4490
+ stopSending(localId: string): Promise<GenericHandlerResult>;
4491
+ abstract send(options: HandlerSendOptions): Promise<HandlerSendResult>;
4492
+ replaceTrack(localId: string, track: MediaStreamTrack | null): Promise<void>;
4493
+ setMaxSpatialLayer(localId: string, spatialLayer: number): Promise<void>;
4494
+ setRtpEncodingParameters(localId: string, params: any): Promise<void>;
4495
+ getSenderStats(localId: string): Promise<RTCStatsReport>;
4496
+ _addEventListeners(): void;
4497
+ addCustomEventListeners(): void;
4498
+ }
4499
+ type DCMessage = {
4500
+ type: string;
4501
+ payload: Record<string, unknown>;
4502
+ };
4503
+ type TransportPromiseEvents = {
4504
+ 'close': {
4505
+ answer: RTCSessionDescriptionInit;
4506
+ };
4507
+ 'negotiate': {
4508
+ description: RTCSessionDescriptionInit;
4509
+ };
4510
+ };
4511
+ type ConsumerOptions = {
4512
+ id?: string;
4513
+ producerId: string;
4514
+ producingPeerId: string;
4515
+ producingTransportId: string;
4516
+ kind?: 'audio' | 'video';
4517
+ paused?: boolean;
4518
+ appData?: Record<string, unknown>;
4519
+ mimeType?: string;
4520
+ localId: string;
4521
+ handler: HandlerInterface<TransportPromiseEvents>;
4522
+ track?: MediaStreamTrack;
4523
+ rtpReceiver?: RTCRtpReceiver;
4524
+ transceiver: RTCRtpTransceiver;
4525
+ closeTranscieverOnClose?: boolean;
4526
+ };
4527
+ type MediaKind$1 = 'audio' | 'video';
4528
+ declare class Consumer extends EnhancedEventEmitter<TransportPromiseEvents> {
4529
+ readonly rtpReceiver: RTCRtpReceiver;
4530
+ readonly id: string;
4531
+ readonly localId: string;
4532
+ readonly producerId: string;
4533
+ readonly producingTransportId: string;
4534
+ readonly mimeType: string;
4535
+ readonly track: MediaStreamTrack;
4536
+ readonly peerId: string;
4537
+ readonly appData: Record<string, unknown>;
4538
+ readonly transceiver: RTCRtpTransceiver;
4539
+ constructor(context: Context<ContextState>, opts: ConsumerOptions);
4540
+ readonly closed: boolean;
4541
+ readonly kind: MediaKind$1;
4542
+ readonly paused: boolean;
4543
+ close(reason?: string, closeTranscieverOnClose?: boolean): void;
4544
+ getStats(): Promise<RTCStatsReport>;
4545
+ pause(): void;
4546
+ resume(): void;
4547
+ }
4548
+ declare const localMediaEvents: readonly [
4549
+ "AUDIO_TRACK_CHANGE",
4550
+ "VIDEO_TRACK_CHANGE",
4551
+ "SCREENSHARE_TRACK_CHANGE",
4552
+ "SCREENSHARE_ENDED",
4553
+ "AUDIO_TRACK_SILENT",
4554
+ "FORCE_MUTE_AUDIO",
4555
+ "FORCE_MUTE_VIDEO",
4556
+ "DEVICE_CHANGE",
4557
+ "DEVICE_LIST_UPDATED"
4558
+ ];
4559
+ declare const e2eeEvents: readonly [
4560
+ "participantEncryptionStatusChanged",
4561
+ "encryptionError"
4562
+ ];
4563
+ declare const e2eeKeyEvents: readonly [
4564
+ "setKey",
4565
+ "ratchetRequest",
4566
+ "keyRatcheted"
4567
+ ];
4568
+ type LocalMediaEvents = (typeof localMediaEvents)[number];
4569
+ type EncryptionEvents = (typeof e2eeEvents)[number];
4570
+ type KeyProviderEvents = (typeof e2eeKeyEvents)[number];
4571
+ type ParticipantEvents = {
4572
+ ['videoUpdate']: (payload: {
4573
+ videoEnabled: boolean;
4574
+ videoTrack: MediaStreamTrack;
4575
+ }) => void;
4576
+ ['audioUpdate']: (payload: {
4577
+ audioEnabled: boolean;
4578
+ audioTrack: MediaStreamTrack;
4579
+ }) => void;
4580
+ ['screenShareUpdate']: (payload: {
4581
+ screenShareEnabled: boolean;
4582
+ screenShareTracks: {
4583
+ audio: MediaStreamTrack;
4584
+ video: MediaStreamTrack;
4585
+ };
4586
+ }) => void;
4587
+ ['pinned']: (payload: Participant) => void;
4588
+ ['unpinned']: (payload: Participant) => void;
4589
+ ['poorConnection']: (payload: {
4590
+ score: number;
4591
+ kind: string;
4592
+ }) => void;
4593
+ ['stageStatusUpdate']: (payload: Participant) => void;
4594
+ ['mediaScoreUpdate']: (payload: {
4595
+ kind: MediaKind$1;
4596
+ isScreenshare: boolean;
4597
+ score: number;
4598
+ participantId: string;
4599
+ scoreStats: ConsumerScoreStats;
4600
+ }) => void;
4601
+ ['kicked']: () => void;
4602
+ ['*']: (event: string, ...args: any[]) => void;
4603
+ };
4604
+ type SelfEvents = {
4605
+ ['toggleTile']: (payload: {
4606
+ hidden: boolean;
4607
+ }) => void;
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
+ ['deviceUpdate']: ({ device }: {
4624
+ device: MediaDeviceInfo;
4625
+ }) => void;
4626
+ ['deviceListUpdate']: (changedDevices: {
4627
+ added: MediaDeviceInfo[];
4628
+ removed: MediaDeviceInfo[];
4629
+ devices: MediaDeviceInfo[];
4630
+ }) => void;
4631
+ ['pinned']: (payload: Self) => void;
4632
+ ['unpinned']: (payload: Self) => void;
4633
+ ['mediaPermissionUpdate']: (payload: {
4634
+ message: keyof typeof MediaPermission;
4635
+ kind: 'audio' | 'video' | 'screenshare';
4636
+ }) => void;
4637
+ ['mediaPermissionError']: (payload: {
4638
+ message: keyof typeof MediaPermission;
4639
+ constraints: any;
4640
+ kind: 'audio' | 'video' | 'screenshare';
4641
+ }) => void;
4642
+ ['mediaScoreUpdate']: (payload: {
4643
+ kind: MediaKind$1;
4644
+ isScreenshare: boolean;
4645
+ score: number;
4646
+ participantId: string;
4647
+ scoreStats: ProducerScoreStats;
4648
+ }) => void;
4649
+ ['waitlisted']: () => void;
4650
+ ['roomLeft']: (payload: {
4651
+ state: LeaveRoomState;
4652
+ }) => void;
4653
+ ['roomJoined']: (payload: {
4654
+ reconnected: boolean;
4655
+ }) => void;
4656
+ ['autoplayError']: (error: Error) => void;
4657
+ ['*']: (event: string, ...args: any[]) => void;
4658
+ };
4659
+ type ParticipantMapEvents = {
4660
+ ['participantJoined']: (payload: Participant) => void;
4661
+ ['participantLeft']: (payload: Participant) => void;
4662
+ ['participantsCleared']: () => void;
4663
+ ['participantsUpdate']: () => void;
4664
+ ['kicked']: (payload: {
4665
+ id: string;
4666
+ }) => void;
4667
+ };
4668
+ declare class ParticipantMap<T extends Pick<Participant, 'id' | keyof TypedEventEmitter<ParticipantEvents>> = Participant> extends ClientMap<ParticipantEvents, T, ParticipantMapEvents> {
4669
+ constructor(logger: Logger, options?: MapEvents<ParticipantMapEvents>);
4670
+ add(participant: T, emitEvent?: boolean): this;
4671
+ clear(emitEvent?: boolean, removeListeners?: boolean): void;
4672
+ delete(participantId: string, emitEvent?: boolean, removeListeners?: boolean): boolean;
4886
4673
  }
4887
- declare enum ChatMessageType {
4888
- TEXT = 0,
4889
- IMAGE = 1,
4890
- FILE = 2,
4891
- CUSTOM = 3
4674
+ declare const modes: readonly [
4675
+ "ACTIVE_GRID",
4676
+ "PAGINATED",
4677
+ "MANUAL"
4678
+ ];
4679
+ type ViewMode = (typeof modes)[number];
4680
+ interface BroadcastMessagePayload {
4681
+ [key: string]: boolean | number | string | Date | ActiveTab;
4892
4682
  }
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;
4683
+ interface PeerProducerConfig {
4684
+ audio: boolean;
4685
+ video: boolean;
4686
+ screenshareAudio: boolean;
4687
+ screenshareVideo: boolean;
4900
4688
  }
4901
- declare class ChatSocketHandler {
4689
+ type BroadcastMessageTarget = {
4690
+ participantIds: string[];
4691
+ } | {
4692
+ presetNames: string[];
4693
+ } | {
4694
+ meetingIds: string[];
4695
+ };
4696
+ type ParticipantsEvents = {
4697
+ ['viewModeChanged']: (payload: {
4698
+ viewMode: string;
4699
+ currentPage: number;
4700
+ pageCount: number;
4701
+ }) => void;
4702
+ ['activeSpeaker']: (payload: {
4703
+ peerId: string;
4704
+ volume: number;
4705
+ }) => void;
4706
+ ['broadcastedMessage']: (payload: {
4707
+ type: string;
4708
+ payload: BroadcastMessagePayload;
4709
+ timestamp: number;
4710
+ }) => void;
4711
+ ['poorConnection']: (payload: {
4712
+ participantId: string;
4713
+ score: number;
4714
+ kind: string;
4715
+ }) => void;
4716
+ ['pageChanged']: (payload: {
4717
+ viewMode: string;
4718
+ currentPage: number;
4719
+ pageCount: number;
4720
+ }) => void;
4721
+ ['mediaScoreUpdate']: (payload: {
4722
+ kind: string;
4723
+ isScreenshare: boolean;
4724
+ score: number;
4725
+ participantId: string;
4726
+ scoreStats: ConsumerScoreStats;
4727
+ }) => void;
4728
+ ['media_decode_error']: (payload: {
4729
+ reason: string;
4730
+ code: '1702' | '1703';
4731
+ }) => void;
4732
+ ['*']: (event: string, ...args: any[]) => void;
4733
+ };
4734
+ declare class Participants extends TypedEventEmitter<ParticipantsEvents> {
4735
+ readonly waitlisted: Readonly<ParticipantMap<Pick<Participant, Exclude<keyof Participant, 'audioTrack' | 'videoTrack' | 'screenShareTracks'>>>>;
4736
+ readonly joined: Readonly<ParticipantMap>;
4737
+ readonly active: Readonly<ParticipantMap>;
4738
+ readonly videoSubscribed: Readonly<ParticipantMap>;
4739
+ readonly audioSubscribed: Readonly<ParticipantMap>;
4740
+ readonly pinned: Readonly<ParticipantMap>;
4741
+ readonly all: Readonly<BasicParticipantsMap>;
4742
+ readonly pip: Pip;
4743
+ rateLimitConfig: {
4744
+ maxInvocations: number;
4745
+ period: number;
4746
+ };
4747
+ readonly rateLimits: {
4748
+ maxInvocations: number;
4749
+ period: number;
4750
+ };
4751
+ updateRateLimits(num: number, period: number): void;
4902
4752
  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;
4753
+ viewMode: ViewMode;
4754
+ currentPage: number;
4755
+ lastActiveSpeaker: string;
4756
+ selectedPeers: SelectedPeers;
4757
+ constructor(context: Context<ContextState>, self: Self, roomSocketHandler: RoomSocketHandler);
4758
+ setupEvents(): void;
4759
+ readonly count: number;
4760
+ readonly maxActiveParticipantsCount: number;
4761
+ setMaxActiveParticipantsCount(limit: number): void;
4762
+ readonly pageCount: number;
4763
+ acceptWaitingRoomRequest(id: string): void;
4764
+ acceptAllWaitingRoomRequest(userIds: string[]): Promise<void>;
4765
+ rejectWaitingRoomRequest(id: string): Promise<void>;
4766
+ setViewMode(viewMode: ViewMode): Promise<void>;
4767
+ subscribe(peerIds: string[], kinds?: ('audio' | 'video' | 'screenshareAudio' | 'screenshareVideo')[]): Promise<void>;
4768
+ unsubscribe(peerIds: string[], kinds?: ('audio' | 'video' | 'screenshareAudio' | 'screenshareVideo')[]): Promise<void>;
4769
+ getPeerIdsForCurrentPage(): string[];
4770
+ setPage(page: number): Promise<void>;
4771
+ disableAllAudio(allowUnmute: boolean): Promise<void>;
4772
+ disableAllVideo(): Promise<void>;
4773
+ disableAudio(participantId: string): Promise<void>;
4774
+ disableVideo(participantId: string): Promise<void>;
4775
+ kick(participantId: string): Promise<void>;
4776
+ kickAll(): Promise<void>;
4777
+ broadcastMessage(type: Exclude<string, 'spotlight'>, payload: BroadcastMessagePayload, target?: BroadcastMessageTarget): Promise<void>;
4778
+ getAllJoinedPeers(searchQuery: string, limit: number, offset: number): Promise<{
4917
4779
  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;
4780
+ userId: string;
4781
+ name: string;
4782
+ displayName: string;
4783
+ stageType: StageStatus;
4784
+ customParticipantId: string;
4785
+ presetId: string;
4786
+ picture: string;
4787
+ waitlisted: boolean;
4788
+ stageStatus: StageStatus;
4789
+ metadata: {
4790
+ preset_name: string;
4791
+ };
4792
+ recorderType: string;
4793
+ flags: {
4794
+ hiddenParticipant: boolean;
4795
+ hidden_participant: boolean;
4796
+ recorder: boolean;
4797
+ };
4798
+ }[]>;
4799
+ updatePermissions(participantIds: string[], permissions: PresetUpdates): Promise<void>;
4800
+ getParticipantsInMeetingPreJoin(): Promise<RoomPeersInfoResponse>;
4924
4801
  }
4925
4802
  interface RecordingConfig {
4926
4803
  fileNamePrefix?: string;
@@ -4944,7 +4821,7 @@ declare class APIClient extends API {
4944
4821
  getPluginDetails(pluginId: string): Promise<PluginResponse>;
4945
4822
  getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
4946
4823
  authorizePlugin(pluginId: string): Promise<string>;
4947
- getPresignedUrls(filename: string, viewType: string): Promise<{
4824
+ getPresignedUrls(filename: string): Promise<{
4948
4825
  getLocation: any;
4949
4826
  putLocation: any;
4950
4827
  }>;
@@ -4983,8 +4860,6 @@ interface BaseMessage<T extends MessageType> {
4983
4860
  pluginId?: string;
4984
4861
  pinned?: boolean;
4985
4862
  targetUserIds?: string[];
4986
- channelId?: string;
4987
- channelIndex?: string;
4988
4863
  }
4989
4864
  interface TextMessage extends BaseMessage<MessageType.text> {
4990
4865
  message: string;
@@ -5045,28 +4920,21 @@ interface FileMessagePayload {
5045
4920
  type MessagePayload = TextMessagePayload | ImageMessagePayload | FileMessagePayload | CustomMessagePayload;
5046
4921
  interface ChatUpdateParams {
5047
4922
  action: 'add' | 'edit' | 'delete';
5048
- message: Message | {
5049
- id: string;
5050
- channelId: string;
5051
- };
4923
+ message: Message;
5052
4924
  messages: Message[];
5053
4925
  }
5054
4926
  type ChatEvents = {
5055
4927
  ['chatUpdate']: (payload: ChatUpdateParams) => void;
5056
4928
  ['pinMessage']: (payload: Pick<ChatUpdateParams, Exclude<keyof ChatUpdateParams, 'action'>>) => void;
5057
4929
  ['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
4930
  ['*']: (event: string, ...args: any[]) => void;
5062
4931
  };
5063
4932
  declare class Chat extends TypedEventEmitter<ChatEvents> {
5064
4933
  messages: Message[];
5065
- channels: ChatChannel[];
5066
4934
  maxTextLimit: number;
5067
4935
  readonly telemetry: Telemetry;
5068
4936
  setMaxTextLimit(limit: number): void;
5069
- constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, chatChannelSocketHandler: ChatChannelSocketHandler, self: Self, participants: Participants);
4937
+ constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, self: Self, participants: Participants);
5070
4938
  private sendMessageInternal;
5071
4939
  private sendTextMessageInternal;
5072
4940
  private sendImageMessageInternal;
@@ -5081,11 +4949,11 @@ declare class Chat extends TypedEventEmitter<ChatEvents> {
5081
4949
  sendImageMessage(image: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
5082
4950
  sendFileMessage(file: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
5083
4951
  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>;
4952
+ editTextMessage(messageId: string, message: string): Promise<void>;
4953
+ editImageMessage(messageId: string, image: File | ReactNativeFile): Promise<void>;
4954
+ editFileMessage(messageId: string, file: File | ReactNativeFile): Promise<void>;
4955
+ editMessage(messageId: string, message: MessagePayload): Promise<void>;
4956
+ deleteMessage(messageId: string): Promise<void>;
5089
4957
  getMessagesByUser(userId: string): Message[];
5090
4958
  getMessagesByType(type: keyof typeof MessageType): Message[];
5091
4959
  pin(id: string): Promise<void>;
@@ -5099,22 +4967,11 @@ declare class Chat extends TypedEventEmitter<ChatEvents> {
5099
4967
  type?: keyof typeof MessageType;
5100
4968
  userId?: string;
5101
4969
  }): Promise<Message[]>;
5102
- getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number, channelId?: string): Promise<{
4970
+ getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number): Promise<{
5103
4971
  messages: Message[];
5104
4972
  next: boolean;
5105
4973
  }>;
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
4974
  searchMessages(query: string, filters: unknown): Promise<unknown[]>;
5117
- markLastReadMessage(channelId: string, message: Message): Promise<void>;
5118
4975
  readonly pinned: Message[];
5119
4976
  }
5120
4977
  declare const enum PRODUCERS_TYPE {