@cometchat/calls-sdk-javascript 5.0.4 → 5.0.6-beta.1

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
@@ -298,6 +298,12 @@ export declare class CallLog {
298
298
  * The recordings of the call log.
299
299
  */
300
300
  private recordings;
301
+ /**
302
+ * @type {Transcription[]}
303
+ * The transcripts of the call log. Only populated when the request opted in
304
+ * via `CallLogRequestBuilder.setHasTranscriptions(true)`.
305
+ */
306
+ private transcriptions;
301
307
  /**
302
308
  * Creates a new instance of CallLog.
303
309
  * @param data - The data to initialize the call log with.
@@ -503,6 +509,19 @@ export declare class CallLog {
503
509
  * @param value - The recordings to set.
504
510
  */
505
511
  setRecordings(value: Recording[]): void;
512
+ /**
513
+ * Gets the transcripts of the call log.
514
+ * @returns The transcripts of the call log, or an empty array when the server
515
+ * omitted them — never `undefined`. The array is absent unless the request
516
+ * opted in via `CallLogRequestBuilder.setHasTranscriptions(true)`, and the
517
+ * server currently omits it even then, so callers must not have to null-check.
518
+ */
519
+ getTranscriptions(): Transcription[];
520
+ /**
521
+ * Sets the transcripts of the call log.
522
+ * @param value - The transcripts to set.
523
+ */
524
+ setTranscriptions(value: Transcription[]): void;
506
525
  /**
507
526
  * Creates a new instance of CallLog from JSON data.
508
527
  * @param data - The JSON data to create the call log from.
@@ -539,6 +558,11 @@ declare class CallLogRequest {
539
558
  * Whether the call has a recording or not.
540
559
  */
541
560
  private hasRecording;
561
+ /**
562
+ * Whether to restrict the list to calls that have transcripts (and have the
563
+ * server attach each call's `transcriptions` array).
564
+ */
565
+ private hasTranscriptions;
542
566
  /**
543
567
  * The category of call to filter by.
544
568
  */
@@ -616,6 +640,7 @@ declare class CallLogRequestBuilder {
616
640
  /** @private */ callType: string;
617
641
  /** @private */ callStatus: string;
618
642
  /** @private */ hasRecording: boolean;
643
+ /** @private */ hasTranscriptions: boolean;
619
644
  /** @private */ callCategory: string;
620
645
  /** @private */ callDirection: string;
621
646
  /** @private */ uid: string;
@@ -645,6 +670,14 @@ declare class CallLogRequestBuilder {
645
670
  * @returns The CallLogRequestBuilder object.
646
671
  */
647
672
  setHasRecording(hasRecording: boolean): this;
673
+ /**
674
+ * Sets whether only calls that have transcripts should be fetched. Opting in
675
+ * also makes the server attach each call's `transcriptions` array, readable
676
+ * via `CallLog.getTranscriptions()`.
677
+ * @param hasTranscriptions - Whether to restrict the list to transcribed calls.
678
+ * @returns The CallLogRequestBuilder object.
679
+ */
680
+ setHasTranscriptions(hasTranscriptions: boolean): this;
648
681
  /**
649
682
  * Sets the category of call to be fetched.
650
683
  * @param callCategory - The category of call to be fetched. Can be either 'call' or 'meet'.
@@ -978,6 +1011,67 @@ declare const CAMERA_FACING: {
978
1011
 
979
1012
  declare type CameraFacing = ValueOf<typeof CAMERA_FACING>;
980
1013
 
1014
+ declare const CAPTION_LANGUAGES: readonly [{
1015
+ readonly code: "en-US";
1016
+ readonly label: "English (United States)";
1017
+ }, {
1018
+ readonly code: "de-DE";
1019
+ readonly label: "German (Germany)";
1020
+ }, {
1021
+ readonly code: "en-GB";
1022
+ readonly label: "English (United Kingdom)";
1023
+ }, {
1024
+ readonly code: "es-ES";
1025
+ readonly label: "Spanish (Spain)";
1026
+ }, {
1027
+ readonly code: "fr-FR";
1028
+ readonly label: "French (France)";
1029
+ }, {
1030
+ readonly code: "hi-IN";
1031
+ readonly label: "Hindi (India)";
1032
+ }, {
1033
+ readonly code: "hu-HU";
1034
+ readonly label: "Hungarian (Hungary)";
1035
+ }, {
1036
+ readonly code: "it-IT";
1037
+ readonly label: "Italian (Italy)";
1038
+ }, {
1039
+ readonly code: "ja-JP";
1040
+ readonly label: "Japanese (Japan)";
1041
+ }, {
1042
+ readonly code: "ko-KR";
1043
+ readonly label: "Korean (South Korea)";
1044
+ }, {
1045
+ readonly code: "lt-LT";
1046
+ readonly label: "Lithuanian (Lithuania)";
1047
+ }, {
1048
+ readonly code: "ms-MY";
1049
+ readonly label: "Malay (Malaysia)";
1050
+ }, {
1051
+ readonly code: "nl-NL";
1052
+ readonly label: "Dutch (Netherlands)";
1053
+ }, {
1054
+ readonly code: "pt-PT";
1055
+ readonly label: "Portuguese (Portugal)";
1056
+ }, {
1057
+ readonly code: "ru-RU";
1058
+ readonly label: "Russian (Russia)";
1059
+ }, {
1060
+ readonly code: "sv-SE";
1061
+ readonly label: "Swedish (Sweden)";
1062
+ }, {
1063
+ readonly code: "tr-TR";
1064
+ readonly label: "Turkish (Turkey)";
1065
+ }, {
1066
+ readonly code: "zh";
1067
+ readonly label: "Chinese Mandarin (Simplified, China)";
1068
+ }, {
1069
+ readonly code: "zh-TW";
1070
+ readonly label: "Chinese Mandarin (Traditional, Taiwan)";
1071
+ }];
1072
+
1073
+ declare type CaptionLanguageCode = (typeof CAPTION_LANGUAGES)[number]['code'] | (string & {});
1074
+
981
1075
  declare interface CometChatAPIException extends Error {
982
1076
  readonly name: 'COMET_CHAT_API_ERROR' | 'NETWORK_ERROR' | 'VALIDATION_ERROR' | 'BAD_RESPONSE' | 'UNKNOWN_ERROR';
983
1077
  readonly details?: unknown;
@@ -1006,6 +1100,7 @@ export declare class CometChatCalls extends SessionMethods {
1006
1100
  };
1007
1101
  };
1008
1102
  static CallLogRequestBuilder: typeof CallLogRequestBuilder;
1103
+ static TranscriptRequestBuilder: typeof TranscriptRequestBuilder;
1009
1104
  static CallLog: typeof CallLog;
1010
1105
  /** @deprecated */
1011
1106
  static MainVideoContainerSetting: typeof MainVideoContainerSetting;
@@ -1183,6 +1278,14 @@ declare type ConfigStateBoth = {
1183
1278
  * @default false
1184
1279
  */
1185
1280
  autoStartRecording: boolean;
1281
+ /**
1282
+ * Automatically starts live transcription as soon as the call begins,
1283
+ * without the user pressing the transcription button. Transcription must
1284
+ * be enabled for your app for this to take effect.
1285
+ *
1286
+ * @default false
1287
+ */
1288
+ autoStartTranscription: boolean;
1186
1289
  /**
1187
1290
  * Hides the recording button from the call controls, preventing the user
1188
1291
  * from manually starting or stopping recording from within the SDK UI.
@@ -1313,6 +1416,28 @@ declare type ConfigStateBoth = {
1313
1416
  * @default false
1314
1417
  */
1315
1418
  hideSwitchCameraButton: boolean;
1419
+ /**
1420
+ * Hides the closed-caption button that lets the user show or hide live
1421
+ * captions on screen. Even when set to `false`, the button only appears
1422
+ * while transcription is running, since captions are produced from the
1423
+ * live transcript.
1424
+ *
1425
+ * @default true
1426
+ */
1427
+ hideClosedCaptionButton: boolean;
1428
+ /**
1429
+ * Hides the transcription button from the call controls, preventing the
1430
+ * user from manually starting or stopping live transcription from within
1431
+ * the SDK UI.
1432
+ *
1433
+ * @default true
1434
+ */
1435
+ hideTranscriptionButton: boolean;
1436
+ /**
1437
+ * The currently selected caption/transcription language code (e.g.
1438
+ * `en-US`). Selected from the closed-caption settings dropdown.
1439
+ */
1440
+ captionLanguage: CaptionLanguageCode;
1316
1441
  /**
1317
1442
  * Enables the per-participant context menu — opened by right-clicking (web)
1318
1443
  * or long-pressing (mobile) a participant's tile — that exposes actions such
@@ -2312,6 +2437,14 @@ declare class SessionMethodsCore {
2312
2437
  * If recording is active, it will be stopped, and vice versa.
2313
2438
  */
2314
2439
  static toggleRecording(): void;
2440
+ /**
2441
+ * Starts transcription of the call.
2442
+ */
2443
+ static startTranscription(): void;
2444
+ /**
2445
+ * Stops the ongoing call transcription.
2446
+ */
2447
+ static stopTranscription(): void;
2315
2448
  /**
2316
2449
  * Pins a participant's video to focus on them.
2317
2450
  * @param participantId - The ID of the participant to pin.
@@ -2382,6 +2515,252 @@ declare type THEX = `#${string}`;
2382
2515
 
2383
2516
  declare type TPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
2384
2517
 
2518
+ /**
2519
+ * A single meeting-transcript artifact returned by the paginated
2520
+ * `GET /calls/:sessionId/transcriptions` endpoint.
2521
+ *
2522
+ * A record is a *pointer* to a downloadable transcript file, not the transcript
2523
+ * text/utterances themselves — fetch {@link Transcript.transcriptUrl} separately
2524
+ * to retrieve the content.
2525
+ *
2526
+ * Every field is optional: the server strips keys whose value is empty, so a
2527
+ * sparse record (e.g. `mid` absent until the pipeline sends `uniqueMeetingId`)
2528
+ * is normal and must parse without error.
2529
+ */
2530
+ export declare interface Transcript {
2531
+ /** Transcript id. */
2532
+ tid?: string;
2533
+ /** Meeting id; absent until the pipeline sends `uniqueMeetingId`. */
2534
+ mid?: string;
2535
+ /** Room name. */
2536
+ roomName?: string;
2537
+ /** Meeting start time, epoch SECONDS. */
2538
+ startTime?: number;
2539
+ /** Meeting end time, epoch SECONDS. */
2540
+ endTime?: number;
2541
+ /** Meeting url. */
2542
+ url?: string;
2543
+ /** Transcript date. */
2544
+ transcriptDate?: string;
2545
+ /** Downloadable transcript JSON url. */
2546
+ transcriptUrl?: string;
2547
+ /** Arbitrary metadata bag. */
2548
+ metaData?: Record<string, unknown>;
2549
+ }
2550
+
2551
+ /**
2552
+ * Represents a transcript artifact attached to a call log.
2553
+ *
2554
+ * Only present when the list request opted in via
2555
+ * `CallLogRequestBuilder.setHasTranscriptions(true)` — the server omits the
2556
+ * `transcriptions` array otherwise.
2557
+ *
2558
+ * A record is a *pointer* to a downloadable transcript file, not the transcript
2559
+ * text itself: fetch {@link Transcription.getTranscriptURL} separately to
2560
+ * retrieve the content.
2561
+ */
2562
+ export declare class Transcription {
2563
+ /**
2564
+ * The transcript ID.
2565
+ */
2566
+ private tid;
2567
+ /**
2568
+ * The meeting ID; absent until the pipeline sends `uniqueMeetingId`.
2569
+ */
2570
+ private mid;
2571
+ /**
2572
+ * The room name of the meeting the transcript belongs to.
2573
+ */
2574
+ private roomName;
2575
+ /**
2576
+ * The start time of the transcribed meeting, in epoch seconds.
2577
+ */
2578
+ private startTime;
2579
+ /**
2580
+ * The end time of the transcribed meeting, in epoch seconds.
2581
+ */
2582
+ private endTime;
2583
+ /**
2584
+ * The transcript date.
2585
+ */
2586
+ private transcriptDate;
2587
+ /**
2588
+ * The URL of the downloadable transcript JSON.
2589
+ */
2590
+ private transcriptUrl;
2591
+ /**
2592
+ * Creates a new instance of the Transcription class.
2593
+ * @param data - The data to initialize the transcription object.
2594
+ */
2595
+ constructor(data: any);
2596
+ /**
2597
+ * Gets the transcript ID.
2598
+ * @returns The transcript ID.
2599
+ */
2600
+ getTid(): string;
2601
+ /**
2602
+ * Sets the transcript ID.
2603
+ * @param value - The transcript ID to set.
2604
+ */
2605
+ setTid(value: string): void;
2606
+ /**
2607
+ * Gets the meeting ID.
2608
+ * @returns The meeting ID.
2609
+ */
2610
+ getMid(): string;
2611
+ /**
2612
+ * Sets the meeting ID.
2613
+ * @param value - The meeting ID to set.
2614
+ */
2615
+ setMid(value: string): void;
2616
+ /**
2617
+ * Gets the room name.
2618
+ * @returns The room name.
2619
+ */
2620
+ getRoomName(): string;
2621
+ /**
2622
+ * Sets the room name.
2623
+ * @param value - The room name to set.
2624
+ */
2625
+ setRoomName(value: string): void;
2626
+ /**
2627
+ * Gets the start time of the transcribed meeting.
2628
+ * @returns The start time, in epoch seconds.
2629
+ */
2630
+ getStartTime(): number;
2631
+ /**
2632
+ * Sets the start time of the transcribed meeting.
2633
+ * @param value - The start time, in epoch seconds.
2634
+ */
2635
+ setStartTime(value: number): void;
2636
+ /**
2637
+ * Gets the end time of the transcribed meeting.
2638
+ * @returns The end time, in epoch seconds.
2639
+ */
2640
+ getEndTime(): number;
2641
+ /**
2642
+ * Sets the end time of the transcribed meeting.
2643
+ * @param value - The end time, in epoch seconds.
2644
+ */
2645
+ setEndTime(value: number): void;
2646
+ /**
2647
+ * Gets the transcript date.
2648
+ * @returns The transcript date.
2649
+ */
2650
+ getTranscriptDate(): string;
2651
+ /**
2652
+ * Sets the transcript date.
2653
+ * @param value - The transcript date to set.
2654
+ */
2655
+ setTranscriptDate(value: string): void;
2656
+ /**
2657
+ * Gets the URL of the downloadable transcript JSON.
2658
+ * @returns The transcript URL.
2659
+ */
2660
+ getTranscriptURL(): string;
2661
+ /**
2662
+ * Sets the URL of the downloadable transcript JSON.
2663
+ * @param value - The transcript URL to set.
2664
+ */
2665
+ setTranscriptURL(value: string): void;
2666
+ /**
2667
+ * Creates a new Transcription object from the given JSON data.
2668
+ *
2669
+ * Every key is passed through untouched, so newly-added server fields survive
2670
+ * without an SDK release.
2671
+ * @param data - The JSON data to create the Transcription object from.
2672
+ * @returns A new Transcription object.
2673
+ */
2674
+ static getTranscriptionFromJson(data: any): Transcription;
2675
+ }
2676
+
2677
+ /**
2678
+ * A single, stateful request for one meeting's transcript artifacts. Holds the
2679
+ * pagination cursor and drives the paginated endpoint via `fetchNext()` /
2680
+ * `fetchPrevious()`. Create one with {@link TranscriptRequestBuilder}.
2681
+ */
2682
+ declare class TranscriptRequest {
2683
+ private readonly limit;
2684
+ private readonly sessionId;
2685
+ private readonly config;
2686
+ /** Total pages reported by the server; `null` until a response reports one. */
2687
+ private totalPages;
2688
+ /** Page cursor; `0` before the first fetch. */
2689
+ private currentPage;
2690
+ /** Guards against overlapping in-flight fetches. */
2691
+ private inProgress;
2692
+ constructor(builder: TranscriptRequestBuilder, config: TranscriptRuntimeConfig);
2693
+ /**
2694
+ * Fetches the next page of transcripts.
2695
+ * @returns The page's transcripts, or `[]` when there are no more pages.
2696
+ * @throws {CometChatCallsException} on auth, concurrency, network or response errors.
2697
+ */
2698
+ fetchNext(): Promise<Transcript[]>;
2699
+ /**
2700
+ * Fetches the previous page of transcripts.
2701
+ * @returns The page's transcripts, or `[]` when already at the first page.
2702
+ * @throws {CometChatCallsException} on auth, concurrency, network or response errors.
2703
+ */
2704
+ fetchPrevious(): Promise<Transcript[] | []>;
2705
+ private makeAPICall;
2706
+ }
2707
+
2708
+ /**
2709
+ * Builder for a {@link TranscriptRequest}.
2710
+ *
2711
+ * @example
2712
+ * const request = new CometChatCalls.TranscriptRequestBuilder()
2713
+ * .setSessionId('v1.us.2547167fe69871fd.pranav')
2714
+ * .setLimit(10)
2715
+ * .build();
2716
+ * const page = await request.fetchNext();
2717
+ */
2718
+ declare class TranscriptRequestBuilder {
2719
+ /* Excluded from this release type: limit */
2720
+ /* Excluded from this release type: sessionId */
2721
+ /**
2722
+ * Sets the meeting/session id whose transcripts to fetch. Required.
2723
+ * @param sessionId - The session id (e.g. `v1.us.<appId>.<user>`).
2724
+ */
2725
+ setSessionId(sessionId: string): this;
2726
+ /**
2727
+ * Sets the page size. Optional; defaults to 30 and is clamped to `[1, 1000]`.
2728
+ * @param limit - Transcripts to fetch per page.
2729
+ */
2730
+ setLimit(limit: number): this;
2731
+ /**
2732
+ * Validates pre-flight state and builds the request.
2733
+ * @throws {CometChatCallsException} `NOT_INITIALIZED` if `init()` was not called,
2734
+ * or `SESSION_ID_REQUIRED` if no session id was set.
2735
+ */
2736
+ build(): TranscriptRequest;
2737
+ }
2738
+
2739
+ /**
2740
+ * Runtime context the transcript request needs but cannot reach on its own:
2741
+ * `getBaseURL('call')`, `appSettings` and `appId` are all private static on
2742
+ * `CometChatCalls`. The facade stashes this config at `finalizeInit()` (mirroring
2743
+ * how `APIHandler.setAppSettings({ host })` is already wired), and the request
2744
+ * reads it back here.
2745
+ *
2746
+ * The auth token is intentionally a live getter, not a captured value: the token
2747
+ * can change across a re-login, so it is read at fetch time from the public
2748
+ * `CometChatCalls.getUserAuthToken()`.
2749
+ */
2750
+ declare interface TranscriptRuntimeConfig {
2751
+ /**
2752
+ * Calls base URL — `getBaseURL('call')`, honours the `appSettings.host`
2753
+ * override. `/calls/:sessionId/transcriptions` is a sub-route of the same
2754
+ * `/calls` resource the call-log list uses, so it lives on the calls host
2755
+ * (`<appId>.call-<region>.cometchat.io`), NOT the chat admin api host.
2756
+ */
2757
+ callsBaseURL: string;
2758
+ /** App id from the init'd settings. */
2759
+ appId: string;
2760
+ /** Live auth-token accessor (from the logged-in user); `null` when logged out. */
2761
+ getAuthToken: () => string | null;
2762
+ }
2763
+
2385
2764
  declare type _TRegion = 'eu' | 'us' | 'in';
2386
2765
 
2387
2766
  declare type TRGB = `rgb(${number}, ${number}, ${number})`;