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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1386,6 +1386,36 @@ interface ChatMessage {
1386
1386
  * @generated MessageType for protobuf message socket.chat.ChatMessage
1387
1387
  */
1388
1388
  declare const ChatMessage: ChatMessage$Type;
1389
+ declare class GetPaginatedChatMessageFilters$Type extends MessageType$1<GetPaginatedChatMessageFilters> {
1390
+ constructor();
1391
+ }
1392
+ /**
1393
+ * @generated from protobuf message socket.chat.GetPaginatedChatMessageFilters
1394
+ */
1395
+ interface GetPaginatedChatMessageFilters {
1396
+ /**
1397
+ * @generated from protobuf oneof: filters
1398
+ */
1399
+ filters: {
1400
+ oneofKind: "pinned";
1401
+ /**
1402
+ * @generated from protobuf field: bool pinned = 1;
1403
+ */
1404
+ pinned: boolean;
1405
+ } | {
1406
+ oneofKind: "userId";
1407
+ /**
1408
+ * @generated from protobuf field: string user_id = 2;
1409
+ */
1410
+ userId: string;
1411
+ } | {
1412
+ oneofKind: undefined;
1413
+ };
1414
+ }
1415
+ /**
1416
+ * @generated MessageType for protobuf message socket.chat.GetPaginatedChatMessageFilters
1417
+ */
1418
+ declare const GetPaginatedChatMessageFilters: GetPaginatedChatMessageFilters$Type;
1389
1419
  declare class GetPaginatedChatMessageRoomResponse$Type extends MessageType$1<GetPaginatedChatMessageRoomResponse> {
1390
1420
  constructor();
1391
1421
  }
@@ -1499,83 +1529,6 @@ interface DeleteChatMessageResponse {
1499
1529
  */
1500
1530
  declare const DeleteChatMessageResponse: DeleteChatMessageResponse$Type;
1501
1531
 
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
1532
  declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1580
1533
  constructor();
1581
1534
  }
@@ -2916,33 +2869,38 @@ declare class SocketService {
2916
2869
  handleSocketConnectionEvents(): void;
2917
2870
  }
2918
2871
 
2919
- type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
2920
- declare class PluginSocketHandler {
2921
- constructor(context: Context<ContextState>, socketService: SocketService);
2872
+ declare enum ChatMessageType {
2873
+ TEXT = 0,
2874
+ IMAGE = 1,
2875
+ FILE = 2,
2876
+ CUSTOM = 3
2877
+ }
2878
+ type ChatSocketMessage = SendChatMessageToRoomResponse | SendChatMessageToPeersResponse | EditChatMessageResponse | DeleteChatMessageResponse;
2879
+ interface SearchFilters {
2880
+ timestamp?: number;
2881
+ limit?: number;
2882
+ reversed?: boolean;
2883
+ offset?: number;
2884
+ }
2885
+ declare class ChatSocketHandler {
2886
+ get telemetry(): Telemetry;
2922
2887
  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;
2888
+ constructor(context: Context<ContextState>, socketService: SocketService);
2889
+ getChatMessages(): Promise<{
2890
+ id: string;
2891
+ payload: Uint8Array;
2892
+ }>;
2893
+ getChatMessagesPaginated(timeStamp: number, size: number, reversed: boolean, filters?: GetPaginatedChatMessageFilters['filters']): Promise<GetPaginatedChatMessageRoomResponse>;
2894
+ sendMessageToRoom(message: string, messageType: ChatMessageType): void;
2895
+ sendMessageToPeers(message: string, messageType: ChatMessageType, peerIds: string[]): void;
2896
+ sendMessage(message: string, messageType: ChatMessageType, peerIds?: string[]): void;
2897
+ editMessage(chatId: string, message: string, payloadType: ChatMessageType, pinned?: boolean): Promise<ChatMessage>;
2898
+ deleteMessage(chatId: string): Promise<{
2899
+ id: string;
2900
+ }>;
2901
+ searchMessages(query: string, filters: SearchFilters): Promise<ChatMessage[]>;
2902
+ setPinState(message: Message, pin: boolean): Promise<PinChatMessageResponse>;
2903
+ on(event: number, handler: (socketMessage: ChatSocketMessage) => void): void;
2946
2904
  }
2947
2905
 
2948
2906
  declare class SelectedPeers {
@@ -3217,454 +3175,77 @@ declare class ClientMap<T extends (EventMap & WildCardEvent<T>), U extends {
3217
3175
  toArray(): U[];
3218
3176
  }
3219
3177
 
3220
- interface GenericHandlerResult {
3221
- offerSdp: RTCSessionDescriptionInit;
3222
- callback: (answer: RTCSessionDescriptionInit) => Promise<any>;
3223
- sender?: RTCRtpSender;
3178
+ type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
3179
+ declare class PluginSocketHandler {
3180
+ constructor(context: Context<ContextState>, socketService: SocketService);
3181
+ get logger(): Logger;
3182
+ addPlugin(pluginId: string, staggered: boolean): void;
3183
+ removePlugin(pluginId: string): void;
3184
+ getActivePlugins(): Promise<EnablePluginsResponse>;
3185
+ customPluginEventToRoom(pluginId: string, data: any, messageId?: string): void;
3186
+ customPluginEventToPeers(pluginId: string, peerIds: string[], data: any, messageId?: string): void;
3187
+ enablePluginForRoom(pluginId: string, messageId?: string): void;
3188
+ enablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3189
+ disablePluginForRoom(pluginId: string, messageId?: string): void;
3190
+ disablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3191
+ storeInsertKeys(pluginId: string, store: string, insertKeys: {
3192
+ key: string;
3193
+ payload?: any;
3194
+ }[], messageId?: string): void;
3195
+ storeGetKeys(pluginId: string, store: string, getKeys: {
3196
+ key: string;
3197
+ }[], messageId?: string): void;
3198
+ storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
3199
+ key: string;
3200
+ }[], messageId?: string): void;
3201
+ storeDelete(pluginId: string, store: string, messageId?: string): void;
3202
+ getPluginDataOld(pluginId: string, store: string): void;
3203
+ storePluginDataOld(pluginId: string, store: string, data: any): void;
3204
+ on(event: number, handler: (socketMessage: PluginSocketMessage, messageId?: string) => void): void;
3224
3205
  }
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 = {
3206
+
3207
+ interface PluginResponse {
3208
+ baseURL: string;
3209
+ createdAt: string;
3210
+ description: string;
3211
+ id: string;
3234
3212
  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;
3213
+ organizationId: string;
3214
+ picture: string;
3215
+ private: boolean;
3216
+ published: boolean;
3217
+ staggered: boolean;
3218
+ tags: string[];
3219
+ type: string;
3220
+ updatedAt: string;
3246
3221
  }
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;
3222
+ interface PluginViews {
3223
+ [viewId: string]: {
3224
+ url: string;
3225
+ suggestedPosition: string;
3226
+ };
3275
3227
  }
3276
-
3277
- type DCMessage = {
3278
- type: string;
3279
- payload: Record<string, unknown>;
3280
- };
3281
-
3282
- type TransportPromiseEvents = {
3283
- 'close': {
3284
- answer: RTCSessionDescriptionInit;
3228
+ interface PluginConfig {
3229
+ name: string;
3230
+ pluginId: string;
3231
+ version: string;
3232
+ description: string;
3233
+ author?: string;
3234
+ repository?: string;
3235
+ tags?: string[];
3236
+ picture?: string;
3237
+ url?: string;
3238
+ files: {
3239
+ include: string[];
3240
+ exclude?: string[];
3285
3241
  };
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
- };
3242
+ views?: PluginViews;
3243
+ contentScript?: string;
3244
+ permissions?: {
3245
+ [key: string]: {
3246
+ default: boolean;
3247
+ description: string;
3248
+ };
3668
3249
  };
3669
3250
  config?: {
3670
3251
  [key: string]: string;
@@ -3971,18 +3552,6 @@ type PresetV2CamelCased = {
3971
3552
  text: boolean;
3972
3553
  files: boolean;
3973
3554
  };
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
3555
  };
3987
3556
  isRecorder?: boolean;
3988
3557
  recorderType: RecorderType$1;
@@ -4129,8 +3698,6 @@ declare class PermissionPreset extends TypedEventEmitter<PermissionEvents> {
4129
3698
  get canProduceAudio(): Readonly<MediaProductionPermissionType>;
4130
3699
  get chatPublic(): Readonly<PresetPermissions['chat']['public']>;
4131
3700
  get chatPrivate(): Readonly<PresetPermissions['chat']['private']>;
4132
- get chatChannel(): Readonly<PresetPermissions['chat']['channel']>;
4133
- get chatMessage(): Readonly<PresetPermissions['chat']['message']>;
4134
3701
  get connectedMeetings(): Readonly<PresetPermissions['connectedMeetings']>;
4135
3702
  get hiddenParticipant(): Readonly<boolean>;
4136
3703
  get showParticipantList(): Readonly<boolean>;
@@ -4265,6 +3832,67 @@ declare class API {
4265
3832
  setOrganizationId(id: string): void;
4266
3833
  }
4267
3834
 
3835
+ type StageSocketMessage = GetStageRequestsResponse | GetStagePeersResponse | DenyStageAccessRequest | PeerStatusUpdate;
3836
+ declare class StageSocketHandler {
3837
+ constructor(socketService: SocketService);
3838
+ getStageRequests(): Promise<GetStageRequestsResponse>;
3839
+ requestAccess(): void;
3840
+ cancelRequestAccess(): void;
3841
+ grantAccess(userIds: string[]): Promise<void>;
3842
+ denyAccess(userIds: string[]): Promise<void>;
3843
+ joinStage(): Promise<{
3844
+ id: string;
3845
+ payload: Uint8Array;
3846
+ }>;
3847
+ leaveStage(userId: string): Promise<{
3848
+ id: string;
3849
+ payload: Uint8Array;
3850
+ }>;
3851
+ kick(userIds: string[]): Promise<{
3852
+ id: string;
3853
+ payload: Uint8Array;
3854
+ }>;
3855
+ on(event: number, handler: (socketMessage: StageSocketMessage, messageId?: string) => void): void;
3856
+ getPeerInfo(peerId: string): Promise<PeerInfoResponse>;
3857
+ }
3858
+
3859
+ type StageStatus = 'OFF_STAGE' | 'REQUESTED_TO_JOIN_STAGE' | 'ACCEPTED_TO_JOIN_STAGE' | 'ON_STAGE';
3860
+ interface StageRequestPayload {
3861
+ displayName: string;
3862
+ userId: string;
3863
+ peerId: string;
3864
+ }
3865
+ type StageEvents = {
3866
+ ['stageAccessRequestUpdate']: (requests?: StageRequestPayload[]) => void;
3867
+ ['stageStatusUpdate']: (status: StageStatus) => void;
3868
+ ['newStageRequest']: (payload: {
3869
+ count: number;
3870
+ }) => void;
3871
+ ['stageRequestApproved']: () => void;
3872
+ ['stageRequestRejected']: () => void;
3873
+ ['*']: (eventName: string, ...args: any[]) => void;
3874
+ };
3875
+ declare class Stage extends TypedEventEmitter<StageEvents> {
3876
+ get telemetry(): Telemetry;
3877
+ constructor(context: Context<ContextState>, self: Self, participants: Participants, stageSocketHandler: StageSocketHandler, roomSocketHandler: RoomSocketHandler);
3878
+ get status(): StageStatus;
3879
+ private setupEvents;
3880
+ getAccessRequests(): {
3881
+ stageRequests: StageRequestPayload[];
3882
+ };
3883
+ requestAccess(): Promise<void>;
3884
+ cancelRequestAccess(): Promise<void>;
3885
+ grantAccess(userIds: string[]): Promise<void>;
3886
+ denyAccess(userIds: string[]): Promise<void>;
3887
+ get peerId(): string;
3888
+ join(): Promise<void>;
3889
+ leave(): Promise<void>;
3890
+ kick(userIds: string[]): Promise<{
3891
+ id: string;
3892
+ payload: Uint8Array;
3893
+ }>;
3894
+ }
3895
+
4268
3896
  declare class PollSocketHandler {
4269
3897
  get logger(): Logger;
4270
3898
  get telemetry(): Telemetry;
@@ -4499,7 +4127,6 @@ declare const ERROR_CODES: {
4499
4127
  '0504': string;
4500
4128
  '0505': string;
4501
4129
  '0506': string;
4502
- '0510': string;
4503
4130
  '0600': string;
4504
4131
  '0601': string;
4505
4132
  '0602': string;
@@ -4871,92 +4498,370 @@ declare class Client {
4871
4498
  leaveRoom(state?: LeaveRoomState): Promise<void>;
4872
4499
  }
4873
4500
 
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;
4501
+ type ClientType = {
4502
+ callStats?: unknown;
4503
+ Telemetry?: typeof Telemetry;
4504
+ };
4505
+ declare global {
4506
+ interface Navigator {
4507
+ RNLocalMediaHandlerImpl?: any;
4508
+ RNAudioSampleHandlerImpl?: any;
4509
+ RNBackgroundTimerImpl?: any;
4510
+ RNDeviceInfoImpl?: any;
4511
+ isReactNative?: boolean;
4512
+ }
4513
+ interface Window {
4514
+ RTK?: ClientType;
4515
+ FAST_RTK?: boolean;
4516
+ MediaStreamTrackProcessor?: any;
4517
+ MediaStreamTrackGenerator?: any;
4518
+ TransformStream?: any;
4519
+ }
4884
4520
  }
4885
- interface UpdateChannelRequestPayload {
4886
- memberIds?: string[];
4887
- displayName?: string;
4888
- displayPictureUrl?: string;
4889
- visibility?: string;
4521
+
4522
+ interface GenericHandlerResult {
4523
+ offerSdp: RTCSessionDescriptionInit;
4524
+ callback: (answer: RTCSessionDescriptionInit) => Promise<any>;
4525
+ sender?: RTCRtpSender;
4890
4526
  }
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;
4527
+ type HandlerRunOptions = {
4528
+ direction: 'send' | 'recv';
4529
+ iceServers?: RTCIceServer[];
4530
+ iceTransportPolicy?: RTCIceTransportPolicy;
4531
+ additionalSettings?: any;
4532
+ proprietaryConstraints?: any;
4533
+ onTrackHandler?: (event: RTCTrackEvent) => void;
4534
+ };
4535
+ type CodecOption = {
4536
+ name: string;
4537
+ parameters?: string[];
4538
+ };
4539
+ type HandlerSendOptions = {
4540
+ track: MediaStreamTrack | 'audio' | 'video';
4541
+ screenShare?: boolean;
4542
+ encodings?: RTCRtpEncodingParameters[];
4543
+ codecs?: RTCRtpCodecCapability[];
4544
+ codecOptions?: CodecOption[];
4545
+ };
4546
+ interface HandlerSendResult extends GenericHandlerResult {
4547
+ mid: string;
4548
+ }
4549
+ declare abstract class HandlerInterface<TransportPromiseEvents> extends EnhancedEventEmitter<TransportPromiseEvents> {
4550
+ protected _sendWebStream: MediaStream;
4551
+ protected _sendScreenShareStream: MediaStream;
4552
+ protected _direction?: 'send' | 'recv';
4553
+ pc: RTCPeerConnection;
4554
+ protected _transportReady: boolean;
4555
+ private readonly _mapMidTransceiver;
4556
+ enableHighBitrate: boolean;
4557
+ enableStereo: boolean;
4558
+ enableDtx: boolean;
4559
+ get midTransceiverMap(): Map<string, RTCRtpTransceiver>;
4560
+ abstract get name(): string;
4561
+ close(): void;
4562
+ restartIce(): Promise<GenericHandlerResult>;
4563
+ init({ direction, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, onTrackHandler, }: HandlerRunOptions): void;
4564
+ connect(): Promise<GenericHandlerResult>;
4565
+ getTransportStats(): Promise<RTCStatsReport>;
4566
+ protected _assertSendDirection(): void;
4567
+ protected _assertRecvDirection(): void;
4568
+ getReceiverStats(localId: string): Promise<RTCStatsReport>;
4569
+ stopSending(localId: string): Promise<GenericHandlerResult>;
4570
+ abstract send(options: HandlerSendOptions): Promise<HandlerSendResult>;
4571
+ replaceTrack(localId: string, track: MediaStreamTrack | null): Promise<void>;
4572
+ setMaxSpatialLayer(localId: string, spatialLayer: number): Promise<void>;
4573
+ setRtpEncodingParameters(localId: string, params: any): Promise<void>;
4574
+ getSenderStats(localId: string): Promise<RTCStatsReport>;
4575
+ _addEventListeners(): void;
4576
+ addCustomEventListeners(): void;
4577
+ }
4578
+
4579
+ type DCMessage = {
4580
+ type: string;
4581
+ payload: Record<string, unknown>;
4582
+ };
4583
+
4584
+ type TransportPromiseEvents = {
4585
+ 'close': {
4586
+ answer: RTCSessionDescriptionInit;
4587
+ };
4588
+ 'negotiate': {
4589
+ description: RTCSessionDescriptionInit;
4590
+ };
4591
+ };
4592
+
4593
+ type ConsumerOptions = {
4594
+ id?: string;
4595
+ producerId: string;
4596
+ producingPeerId: string;
4597
+ producingTransportId: string;
4598
+ kind?: 'audio' | 'video';
4599
+ paused?: boolean;
4600
+ appData?: Record<string, unknown>;
4601
+ mimeType?: string;
4602
+ localId: string;
4603
+ handler: HandlerInterface<TransportPromiseEvents>;
4604
+ track?: MediaStreamTrack;
4605
+ rtpReceiver?: RTCRtpReceiver;
4606
+ transceiver: RTCRtpTransceiver;
4607
+ closeTranscieverOnClose?: boolean;
4608
+ };
4609
+ type MediaKind$1 = 'audio' | 'video';
4610
+ declare class Consumer extends EnhancedEventEmitter<TransportPromiseEvents> {
4611
+ readonly rtpReceiver: RTCRtpReceiver;
4612
+ readonly id: string;
4613
+ readonly localId: string;
4614
+ readonly producerId: string;
4615
+ readonly producingTransportId: string;
4616
+ readonly mimeType: string;
4617
+ readonly track: MediaStreamTrack;
4618
+ readonly peerId: string;
4619
+ readonly appData: Record<string, unknown>;
4620
+ readonly transceiver: RTCRtpTransceiver;
4621
+ constructor(context: Context<ContextState>, opts: ConsumerOptions);
4622
+ get closed(): boolean;
4623
+ get kind(): MediaKind$1;
4624
+ get paused(): boolean;
4625
+ close(reason?: string, closeTranscieverOnClose?: boolean): void;
4626
+ getStats(): Promise<RTCStatsReport>;
4627
+ pause(): void;
4628
+ resume(): void;
4900
4629
  }
4901
4630
 
4902
- type ClientType = {
4903
- callStats?: unknown;
4904
- Telemetry?: typeof Telemetry;
4631
+ 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"];
4632
+ declare const e2eeEvents: readonly ["participantEncryptionStatusChanged", "encryptionError"];
4633
+ declare const e2eeKeyEvents: readonly ["setKey", "ratchetRequest", "keyRatcheted"];
4634
+ type LocalMediaEvents = (typeof localMediaEvents)[number];
4635
+ type EncryptionEvents = (typeof e2eeEvents)[number];
4636
+ type KeyProviderEvents = (typeof e2eeKeyEvents)[number];
4637
+ type ParticipantEvents = {
4638
+ ['videoUpdate']: (payload: {
4639
+ videoEnabled: boolean;
4640
+ videoTrack: MediaStreamTrack;
4641
+ }) => void;
4642
+ ['audioUpdate']: (payload: {
4643
+ audioEnabled: boolean;
4644
+ audioTrack: MediaStreamTrack;
4645
+ }) => void;
4646
+ ['screenShareUpdate']: (payload: {
4647
+ screenShareEnabled: boolean;
4648
+ screenShareTracks: {
4649
+ audio: MediaStreamTrack;
4650
+ video: MediaStreamTrack;
4651
+ };
4652
+ }) => void;
4653
+ ['pinned']: (payload: Participant) => void;
4654
+ ['unpinned']: (payload: Participant) => void;
4655
+ ['poorConnection']: (payload: {
4656
+ score: number;
4657
+ kind: string;
4658
+ }) => void;
4659
+ ['stageStatusUpdate']: (payload: Participant) => void;
4660
+ ['mediaScoreUpdate']: (payload: {
4661
+ kind: MediaKind$1;
4662
+ isScreenshare: boolean;
4663
+ score: number;
4664
+ participantId: string;
4665
+ scoreStats: ConsumerScoreStats;
4666
+ }) => void;
4667
+ ['kicked']: () => void;
4668
+ ['*']: (event: string, ...args: any[]) => void;
4669
+ };
4670
+ type SelfEvents = {
4671
+ ['toggleTile']: (payload: {
4672
+ hidden: boolean;
4673
+ }) => void;
4674
+ ['videoUpdate']: (payload: {
4675
+ videoEnabled: boolean;
4676
+ videoTrack: MediaStreamTrack;
4677
+ }) => void;
4678
+ ['audioUpdate']: (payload: {
4679
+ audioEnabled: boolean;
4680
+ audioTrack: MediaStreamTrack;
4681
+ }) => void;
4682
+ ['screenShareUpdate']: (payload: {
4683
+ screenShareEnabled: boolean;
4684
+ screenShareTracks: {
4685
+ audio?: MediaStreamTrack;
4686
+ video?: MediaStreamTrack;
4687
+ };
4688
+ }) => void;
4689
+ ['deviceUpdate']: ({ device }: {
4690
+ device: MediaDeviceInfo;
4691
+ }) => void;
4692
+ ['deviceListUpdate']: (changedDevices: {
4693
+ added: MediaDeviceInfo[];
4694
+ removed: MediaDeviceInfo[];
4695
+ devices: MediaDeviceInfo[];
4696
+ }) => void;
4697
+ ['pinned']: (payload: Self) => void;
4698
+ ['unpinned']: (payload: Self) => void;
4699
+ ['mediaPermissionUpdate']: (payload: {
4700
+ message: keyof typeof MediaPermission;
4701
+ kind: 'audio' | 'video' | 'screenshare';
4702
+ }) => void;
4703
+ ['mediaPermissionError']: (payload: {
4704
+ message: keyof typeof MediaPermission;
4705
+ constraints: any;
4706
+ kind: 'audio' | 'video' | 'screenshare';
4707
+ }) => void;
4708
+ ['mediaScoreUpdate']: (payload: {
4709
+ kind: MediaKind$1;
4710
+ isScreenshare: boolean;
4711
+ score: number;
4712
+ participantId: string;
4713
+ scoreStats: ProducerScoreStats;
4714
+ }) => void;
4715
+ ['waitlisted']: () => void;
4716
+ ['roomLeft']: (payload: {
4717
+ state: LeaveRoomState;
4718
+ }) => void;
4719
+ ['roomJoined']: (payload: {
4720
+ reconnected: boolean;
4721
+ }) => void;
4722
+ ['autoplayError']: (error: Error) => void;
4723
+ ['*']: (event: string, ...args: any[]) => void;
4724
+ };
4725
+
4726
+ type ParticipantMapEvents = {
4727
+ ['participantJoined']: (payload: Participant) => void;
4728
+ ['participantLeft']: (payload: Participant) => void;
4729
+ ['participantsCleared']: () => void;
4730
+ ['participantsUpdate']: () => void;
4731
+ ['kicked']: (payload: {
4732
+ id: string;
4733
+ }) => void;
4905
4734
  };
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
- }
4735
+ declare class ParticipantMap<T extends Pick<Participant, 'id' | keyof TypedEventEmitter<ParticipantEvents>> = Participant> extends ClientMap<ParticipantEvents, T, ParticipantMapEvents> {
4736
+ constructor(logger: Logger, options?: MapEvents<ParticipantMapEvents>);
4737
+ add(participant: T, emitEvent?: boolean): this;
4738
+ clear(emitEvent?: boolean, removeListeners?: boolean): void;
4739
+ delete(participantId: string, emitEvent?: boolean, removeListeners?: boolean): boolean;
4921
4740
  }
4922
4741
 
4923
- declare enum ChatMessageType {
4924
- TEXT = 0,
4925
- IMAGE = 1,
4926
- FILE = 2,
4927
- CUSTOM = 3
4742
+ declare const modes: readonly ["ACTIVE_GRID", "PAGINATED", "MANUAL"];
4743
+ type ViewMode = (typeof modes)[number];
4744
+ interface BroadcastMessagePayload {
4745
+ [key: string]: boolean | number | string | Date | ActiveTab;
4928
4746
  }
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;
4747
+ interface PeerProducerConfig {
4748
+ audio: boolean;
4749
+ video: boolean;
4750
+ screenshareAudio: boolean;
4751
+ screenshareVideo: boolean;
4936
4752
  }
4937
- declare class ChatSocketHandler {
4753
+ type BroadcastMessageTarget = {
4754
+ participantIds: string[];
4755
+ } | {
4756
+ presetNames: string[];
4757
+ } | {
4758
+ meetingIds: string[];
4759
+ };
4760
+ type ParticipantsEvents = {
4761
+ ['viewModeChanged']: (payload: {
4762
+ viewMode: string;
4763
+ currentPage: number;
4764
+ pageCount: number;
4765
+ }) => void;
4766
+ ['activeSpeaker']: (payload: {
4767
+ peerId: string;
4768
+ volume: number;
4769
+ }) => void;
4770
+ ['broadcastedMessage']: (payload: {
4771
+ type: string;
4772
+ payload: BroadcastMessagePayload;
4773
+ timestamp: number;
4774
+ }) => void;
4775
+ ['poorConnection']: (payload: {
4776
+ participantId: string;
4777
+ score: number;
4778
+ kind: string;
4779
+ }) => void;
4780
+ ['pageChanged']: (payload: {
4781
+ viewMode: string;
4782
+ currentPage: number;
4783
+ pageCount: number;
4784
+ }) => void;
4785
+ ['mediaScoreUpdate']: (payload: {
4786
+ kind: string;
4787
+ isScreenshare: boolean;
4788
+ score: number;
4789
+ participantId: string;
4790
+ scoreStats: ConsumerScoreStats;
4791
+ }) => void;
4792
+ ['media_decode_error']: (payload: {
4793
+ reason: string;
4794
+ code: '1702' | '1703';
4795
+ }) => void;
4796
+ ['*']: (event: string, ...args: any[]) => void;
4797
+ };
4798
+ declare class Participants extends TypedEventEmitter<ParticipantsEvents> {
4799
+ readonly waitlisted: Readonly<ParticipantMap<Omit<Participant, 'audioTrack' | 'videoTrack' | 'screenShareTracks'>>>;
4800
+ readonly joined: Readonly<ParticipantMap>;
4801
+ readonly active: Readonly<ParticipantMap>;
4802
+ readonly videoSubscribed: Readonly<ParticipantMap>;
4803
+ readonly audioSubscribed: Readonly<ParticipantMap>;
4804
+ readonly pinned: Readonly<ParticipantMap>;
4805
+ readonly all: Readonly<BasicParticipantsMap>;
4806
+ get pip(): Pip;
4807
+ rateLimitConfig: {
4808
+ maxInvocations: number;
4809
+ period: number;
4810
+ };
4811
+ get rateLimits(): {
4812
+ maxInvocations: number;
4813
+ period: number;
4814
+ };
4815
+ updateRateLimits(num: number, period: number): void;
4938
4816
  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;
4817
+ viewMode: ViewMode;
4818
+ currentPage: number;
4819
+ lastActiveSpeaker: string;
4820
+ selectedPeers: SelectedPeers;
4821
+ constructor(context: Context<ContextState>, self: Self, roomSocketHandler: RoomSocketHandler);
4822
+ setupEvents(): void;
4823
+ get count(): number;
4824
+ get maxActiveParticipantsCount(): number;
4825
+ setMaxActiveParticipantsCount(limit: number): void;
4826
+ get pageCount(): number;
4827
+ acceptWaitingRoomRequest(id: string): void;
4828
+ acceptAllWaitingRoomRequest(userIds: string[]): Promise<void>;
4829
+ rejectWaitingRoomRequest(id: string): Promise<void>;
4830
+ setViewMode(viewMode: ViewMode): Promise<void>;
4831
+ subscribe(peerIds: string[], kinds?: ('audio' | 'video' | 'screenshareAudio' | 'screenshareVideo')[]): Promise<void>;
4832
+ unsubscribe(peerIds: string[], kinds?: ('audio' | 'video' | 'screenshareAudio' | 'screenshareVideo')[]): Promise<void>;
4833
+ getPeerIdsForCurrentPage(): string[];
4834
+ setPage(page: number): Promise<void>;
4835
+ disableAllAudio(allowUnmute: boolean): Promise<void>;
4836
+ disableAllVideo(): Promise<void>;
4837
+ disableAudio(participantId: string): Promise<void>;
4838
+ disableVideo(participantId: string): Promise<void>;
4839
+ kick(participantId: string): Promise<void>;
4840
+ kickAll(): Promise<void>;
4841
+ broadcastMessage(type: Exclude<string, 'spotlight'>, payload: BroadcastMessagePayload, target?: BroadcastMessageTarget): Promise<void>;
4842
+ getAllJoinedPeers(searchQuery: string, limit: number, offset: number): Promise<{
4953
4843
  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;
4844
+ userId: string;
4845
+ name: string;
4846
+ displayName: string;
4847
+ stageType: StageStatus;
4848
+ customParticipantId: string;
4849
+ presetId: string;
4850
+ picture: string;
4851
+ waitlisted: boolean;
4852
+ stageStatus: StageStatus;
4853
+ metadata: {
4854
+ preset_name: string;
4855
+ };
4856
+ recorderType: string;
4857
+ flags: {
4858
+ hiddenParticipant: boolean;
4859
+ hidden_participant: boolean;
4860
+ recorder: boolean;
4861
+ };
4862
+ }[]>;
4863
+ updatePermissions(participantIds: string[], permissions: PresetUpdates): Promise<void>;
4864
+ getParticipantsInMeetingPreJoin(): Promise<RoomPeersInfoResponse>;
4960
4865
  }
4961
4866
 
4962
4867
  interface RecordingConfig {
@@ -4981,7 +4886,7 @@ declare class APIClient extends API {
4981
4886
  getPluginDetails(pluginId: string): Promise<PluginResponse>;
4982
4887
  getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
4983
4888
  authorizePlugin(pluginId: string): Promise<string>;
4984
- getPresignedUrls(filename: string, viewType: string): Promise<{
4889
+ getPresignedUrls(filename: string): Promise<{
4985
4890
  getLocation: any;
4986
4891
  putLocation: any;
4987
4892
  }>;
@@ -5021,8 +4926,6 @@ interface BaseMessage<T extends MessageType> {
5021
4926
  pluginId?: string;
5022
4927
  pinned?: boolean;
5023
4928
  targetUserIds?: string[];
5024
- channelId?: string;
5025
- channelIndex?: string;
5026
4929
  }
5027
4930
  interface TextMessage extends BaseMessage<MessageType.text> {
5028
4931
  message: string;
@@ -5083,28 +4986,30 @@ interface FileMessagePayload {
5083
4986
  type MessagePayload = TextMessagePayload | ImageMessagePayload | FileMessagePayload | CustomMessagePayload;
5084
4987
  interface ChatUpdateParams {
5085
4988
  action: 'add' | 'edit' | 'delete';
5086
- message: Message | {
5087
- id: string;
5088
- channelId: string;
5089
- };
4989
+ message: Message;
5090
4990
  messages: Message[];
5091
4991
  }
5092
4992
  type ChatEvents = {
5093
4993
  ['chatUpdate']: (payload: ChatUpdateParams) => void;
5094
4994
  ['pinMessage']: (payload: Omit<ChatUpdateParams, 'action'>) => void;
5095
4995
  ['unpinMessage']: (payload: Omit<ChatUpdateParams, 'action'>) => void;
5096
- ['channelCreate']: (channel: ChatChannel) => void;
5097
- ['channelMessageUpdate']: (channel: ChatChannel) => void;
5098
- ['channelUpdate']: (channel?: ChatChannel) => void;
5099
4996
  ['*']: (event: string, ...args: any[]) => void;
5100
4997
  };
4998
+ interface FetchMessageOptions {
4999
+ timestamp?: number;
5000
+ offset: number;
5001
+ limit: number;
5002
+ direction: 'before' | 'after';
5003
+ }
5004
+ interface FetchPrivateMessagesOptions extends FetchMessageOptions {
5005
+ userId: string;
5006
+ }
5101
5007
  declare class Chat extends TypedEventEmitter<ChatEvents> {
5102
5008
  messages: Message[];
5103
- channels: ChatChannel[];
5104
5009
  maxTextLimit: number;
5105
5010
  get telemetry(): Telemetry;
5106
5011
  setMaxTextLimit(limit: number): void;
5107
- constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, chatChannelSocketHandler: ChatChannelSocketHandler, self: Self, participants: Participants);
5012
+ constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, self: Self, participants: Participants);
5108
5013
  private sendMessageInternal;
5109
5014
  private sendTextMessageInternal;
5110
5015
  private sendImageMessageInternal;
@@ -5119,40 +5024,23 @@ declare class Chat extends TypedEventEmitter<ChatEvents> {
5119
5024
  sendImageMessage(image: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
5120
5025
  sendFileMessage(file: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
5121
5026
  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>;
5027
+ editTextMessage(messageId: string, message: string): Promise<void>;
5028
+ editImageMessage(messageId: string, image: File | ReactNativeFile): Promise<void>;
5029
+ editFileMessage(messageId: string, file: File | ReactNativeFile): Promise<void>;
5030
+ editMessage(messageId: string, message: MessagePayload): Promise<void>;
5031
+ deleteMessage(messageId: string): Promise<void>;
5127
5032
  getMessagesByUser(userId: string): Message[];
5128
5033
  getMessagesByType(type: keyof typeof MessageType): Message[];
5129
5034
  pin(id: string): Promise<void>;
5130
5035
  unpin(id: string): Promise<void>;
5131
- fetchMessages({ timestamp, offset, limit, direction, searchQuery, type, userId, }: {
5132
- timestamp?: number;
5133
- offset: number;
5134
- limit: number;
5135
- direction: 'before' | 'after';
5136
- searchQuery?: string;
5137
- type?: keyof typeof MessageType;
5138
- userId?: string;
5139
- }): Promise<Message[]>;
5140
- getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number, channelId?: string): Promise<{
5036
+ fetchMessages({ timestamp, limit, direction, }: FetchMessageOptions): Promise<Message[]>;
5037
+ fetchPrivateMessages({ timestamp, limit, direction, userId, }: FetchPrivateMessagesOptions): Promise<Message[]>;
5038
+ fetchPinnedMessages({ timestamp, limit, direction, }: FetchMessageOptions): Promise<Message[]>;
5039
+ getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number): Promise<{
5141
5040
  messages: Message[];
5142
5041
  next: boolean;
5143
5042
  }>;
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
5043
  searchMessages(query: string, filters: unknown): Promise<unknown[]>;
5155
- markLastReadMessage(channelId: string, message: Message): Promise<void>;
5156
5044
  get pinned(): Message[];
5157
5045
  }
5158
5046