@cometchat/calls-sdk-javascript 5.0.2 → 5.0.4

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.
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ declare type AudioMode = {
19
19
  type: AudioModeType;
20
20
  selected: boolean;
21
21
  uid?: string;
22
+ name?: string;
22
23
  };
23
24
 
24
25
  declare type AudioModeType = 'BLUETOOTH' | 'EARPIECE' | 'HEADPHONES' | 'SPEAKER';
@@ -233,10 +234,22 @@ export declare class CallLog {
233
234
  * The time the call was initiated at.
234
235
  */
235
236
  private initiatedAt;
237
+ /**
238
+ * The time the call started at. Sent by the calls host in place of
239
+ * `initiatedAt`; read {@link getStartedAt} and fall back to
240
+ * {@link getInitiatedAt} when only one of the two is present.
241
+ */
242
+ private startedAt;
236
243
  /**
237
244
  * The call category of the call log.
238
245
  */
239
246
  private callCategory;
247
+ /**
248
+ * The mode of the call log. Sent by the calls host in place of
249
+ * `callCategory`; read {@link getMode} and fall back to
250
+ * {@link getCallCategory} when only one of the two is present.
251
+ */
252
+ private mode;
240
253
  /**
241
254
  * @type {CallUser}
242
255
  * The initiator of the call log.
@@ -350,6 +363,26 @@ export declare class CallLog {
350
363
  * @param value - The time the call was initiated at.
351
364
  */
352
365
  setInitiatedAt(value: number): void;
366
+ /**
367
+ * Gets the time the call started at.
368
+ * @returns The time the call started at.
369
+ */
370
+ getStartedAt(): number;
371
+ /**
372
+ * Sets the time the call started at.
373
+ * @param value - The time the call started at.
374
+ */
375
+ setStartedAt(value: number): void;
376
+ /**
377
+ * Gets the mode of the call log.
378
+ * @returns The mode of the call log.
379
+ */
380
+ getMode(): string;
381
+ /**
382
+ * Sets the mode of the call log.
383
+ * @param value - The mode to set.
384
+ */
385
+ setMode(value: string): void;
353
386
  /**
354
387
  * Gets the call category of the call log.
355
388
  * @returns The call category of the call log.
@@ -545,6 +578,16 @@ declare class CallLogRequest {
545
578
  * @returns A promise that resolves to an array of CallLog objects, or an empty array if there are no previous pages, or rejects with a CometChatCallsException if there was an error..
546
579
  */
547
580
  fetchPrevious(): Promise<CallLog[] | []>;
581
+ /**
582
+ * Gets the page the cursor currently sits on.
583
+ * @returns The current page, or `0` before the first successful fetch.
584
+ */
585
+ getCurrentPage(): number;
586
+ /**
587
+ * Gets the number of pages the server reported.
588
+ * @returns The total page count, or `0` before the first successful fetch.
589
+ */
590
+ getTotalPages(): number;
548
591
  /**
549
592
  * Makes an API call to fetch call logs.
550
593
  * @param isFetchNext Whether to fetch the next page of call logs.
@@ -991,6 +1034,29 @@ export declare class CometChatCalls extends SessionMethods {
991
1034
  readonly success: true;
992
1035
  readonly error: null;
993
1036
  }>;
1037
+ /**
1038
+ * Shared tail of {@link init} / {@link initFromSettings}. Both entry points validate
1039
+ */
1040
+ private static finalizeInit;
1041
+ /**
1042
+ * Initializes the CometChat Calls SDK from a `cometchat-settings.json` object.
1043
+ * Parallels the Chat SDK's `initFromSettings` (file-based init for skills-driven
1044
+ * integrations): it maps the shared settings shape onto the Calls SDK's own
1045
+ * `CallAppSettings` and then performs exactly the same work as {@link init}.
1046
+ * @param settings - Parsed `cometchat-settings.json` object.
1047
+ * @returns An object indicating success or failure with error details.
1048
+ */
1049
+ static initFromSettings(settings: CometChatSettings): Promise<{
1050
+ readonly success: false;
1051
+ readonly error: {
1052
+ readonly name: "VALIDATION_ERROR";
1053
+ readonly message: `Invalid app settings: ${string}`;
1054
+ readonly timestamp: number;
1055
+ };
1056
+ } | {
1057
+ readonly success: true;
1058
+ readonly error: null;
1059
+ }>;
994
1060
  static login(uid: string, authKey?: string): Promise<User_2>;
995
1061
  static loginWithAuthToken(authToken: string): Promise<User_2>;
996
1062
  static logout(): Promise<string>;
@@ -1003,6 +1069,13 @@ export declare class CometChatCalls extends SessionMethods {
1003
1069
  token: string;
1004
1070
  }>;
1005
1071
  private static getBaseURL;
1072
+ /**
1073
+ * SDK-identification telemetry chokepoint. Fire-and-forget, deduped, non-fatal.
1074
+ * Called from login success AND init()-session-restore. Sends `/user_sessions`
1075
+ * ONLY when the Chat SDK is absent (it otherwise handles this telemetry itself).
1076
+ * Never awaited on the happy path; never throws.
1077
+ */
1078
+ private static reportSdkIdentification;
1006
1079
  private static loginWithUID;
1007
1080
  private static authenticateWithToken;
1008
1081
  private static logoutInternal;
@@ -1057,6 +1130,21 @@ declare interface CometChatException {
1057
1130
  message?: string;
1058
1131
  }
1059
1132
 
1133
+ declare interface CometChatSettings {
1134
+ appId: string;
1135
+ region: string;
1136
+ credentials?: {
1137
+ authKey?: string;
1138
+ };
1139
+ callsSDK?: {
1140
+ adminHost?: string | null;
1141
+ clientHost?: string | null;
1142
+ host?: string | null;
1143
+ };
1144
+ chatSDK?: Record<string, unknown>;
1145
+ uiKit?: Record<string, unknown>;
1146
+ }
1147
+
1060
1148
  /**
1061
1149
  * Configuration that applies on both web and mobile platforms.
1062
1150
  */
@@ -1102,6 +1190,29 @@ declare type ConfigStateBoth = {
1102
1190
  * @default true
1103
1191
  */
1104
1192
  hideRecordingButton: boolean;
1193
+ /**
1194
+ * Hides the streaming button from the call controls, preventing the user
1195
+ * from manually starting or stopping a live stream from within the SDK UI.
1196
+ *
1197
+ * @default true
1198
+ */
1199
+ hideStreamingButton: boolean;
1200
+ /**
1201
+ * The RTMP URL to stream to when the user starts a live stream from the
1202
+ * call controls. When set, pressing the start-streaming button skips the
1203
+ * confirmation dialog (which normally asks for a URL and key) and starts
1204
+ * streaming to this URL immediately.
1205
+ *
1206
+ * @default undefined — the user is asked for a URL when starting a stream
1207
+ */
1208
+ streamUrl?: string;
1209
+ /**
1210
+ * The stream key sent along with `streamUrl` when a live stream is
1211
+ * started. Ignored when `streamUrl` is not set.
1212
+ *
1213
+ * @default undefined
1214
+ */
1215
+ streamKey?: string;
1105
1216
  /**
1106
1217
  * Hides the entire bottom control bar (mic, camera, leave, and every other
1107
1218
  * call control). Useful when the host app provides its own controls.
@@ -1188,6 +1299,13 @@ declare type ConfigStateBoth = {
1188
1299
  * @default false
1189
1300
  */
1190
1301
  hideRecordingStatusIndicator: boolean;
1302
+ /**
1303
+ * Hides the "streaming live" badge shown while the session is being
1304
+ * streamed. The stream itself is unaffected.
1305
+ *
1306
+ * @default false
1307
+ */
1308
+ hideStreamingStatusIndicator: boolean;
1191
1309
  /**
1192
1310
  * Hides the button that switches between the front and rear cameras.
1193
1311
  * Mainly relevant on mobile devices with more than one camera.
@@ -1388,6 +1506,8 @@ declare const EVENT_LISTENER_METHODS: {
1388
1506
  readonly onVideoResumed: "onVideoResumed";
1389
1507
  readonly onRecordingStarted: "onRecordingStarted";
1390
1508
  readonly onRecordingStopped: "onRecordingStopped";
1509
+ readonly onStreamingStarted: "onStreamingStarted";
1510
+ readonly onStreamingStopped: "onStreamingStopped";
1391
1511
  readonly onScreenShareStarted: "onScreenShareStarted";
1392
1512
  readonly onScreenShareStopped: "onScreenShareStopped";
1393
1513
  };
@@ -1404,6 +1524,8 @@ declare const EVENT_LISTENER_METHODS: {
1404
1524
  readonly onParticipantStoppedScreenShare: "onParticipantStoppedScreenShare";
1405
1525
  readonly onParticipantStartedRecording: "onParticipantStartedRecording";
1406
1526
  readonly onParticipantStoppedRecording: "onParticipantStoppedRecording";
1527
+ readonly onParticipantStartedStreaming: "onParticipantStartedStreaming";
1528
+ readonly onParticipantStoppedStreaming: "onParticipantStoppedStreaming";
1407
1529
  readonly onDominantSpeakerChanged: "onDominantSpeakerChanged";
1408
1530
  readonly onParticipantListChanged: "onParticipantListChanged";
1409
1531
  };
@@ -2099,9 +2221,15 @@ declare class SessionMethods extends SessionMethodsCore {
2099
2221
 
2100
2222
  declare class SessionMethodsCore {
2101
2223
  /**
2102
- * Mutes the local user's audio during the call.
2224
+ * Mutes or unmutes the local user's audio during the call.
2225
+ *
2226
+ * The boolean parameter exists for backward compatibility with the v4 SDK,
2227
+ * where `muteAudio(false)` was the way to unmute. New code should prefer
2228
+ * {@link SessionMethodsCore.unmuteAudio} for clarity.
2229
+ *
2230
+ * @param muteAudio - `true` (default) mutes the local audio track, `false` unmutes it.
2103
2231
  */
2104
- static muteAudio(): void;
2232
+ static muteAudio(muteAudio?: boolean): void;
2105
2233
  /**
2106
2234
  * Unmutes the local user's audio during the call.
2107
2235
  */
@@ -2112,9 +2240,15 @@ declare class SessionMethodsCore {
2112
2240
  */
2113
2241
  static toggleAudio(): void;
2114
2242
  /**
2115
- * Pauses the local user's video stream.
2243
+ * Pauses or resumes the local user's video stream.
2244
+ *
2245
+ * The boolean parameter exists for backward compatibility with the v4 SDK,
2246
+ * where `pauseVideo(false)` was the way to resume. New code should prefer
2247
+ * {@link SessionMethodsCore.resumeVideo} for clarity.
2248
+ *
2249
+ * @param pauseVideo - `true` (default) pauses the local video track, `false` resumes it.
2116
2250
  */
2117
- static pauseVideo(): void;
2251
+ static pauseVideo(pauseVideo?: boolean): void;
2118
2252
  /**
2119
2253
  * Resumes the local user's video stream.
2120
2254
  */
@@ -2155,6 +2289,16 @@ declare class SessionMethodsCore {
2155
2289
  * @param layout - The type of layout to set (tile, sidebar or spotlight).
2156
2290
  */
2157
2291
  static setLayout(layout: Layout): void;
2292
+ /**
2293
+ * Starts streaming the call to the given RTMP destination.
2294
+ * @param streamUrl - The RTMP ingest URL (e.g., "rtmp://a.rtmp.youtube.com/live2").
2295
+ * @param streamKey - The stream key for the destination (e.g., "xxxx-xxxx-xxxx-xxxx-xxxx").
2296
+ */
2297
+ static startStreaming(streamUrl: string, streamKey: string): void;
2298
+ /**
2299
+ * Stops the ongoing call streaming.
2300
+ */
2301
+ static stopStreaming(): void;
2158
2302
  /**
2159
2303
  * Starts recording the call.
2160
2304
  */