@cometchat/calls-sdk-react-native 5.0.3-beta.1 → 5.0.3

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.
@@ -82,6 +82,8 @@ import java.util.Set;
82
82
  for (AudioDeviceInfo info: deviceInfos) {
83
83
  switch (info.getType()) {
84
84
  case AudioDeviceInfo.TYPE_BLUETOOTH_SCO:
85
+ case AudioDeviceInfo.TYPE_BLE_HEADSET:
86
+ case AudioDeviceInfo.TYPE_BLE_SPEAKER:
85
87
  devices.add(AudioModeModule.DEVICE_BLUETOOTH);
86
88
  break;
87
89
  case AudioDeviceInfo.TYPE_BUILTIN_EARPIECE:
@@ -184,7 +186,8 @@ import java.util.Set;
184
186
  case AudioModeModule.DEVICE_BLUETOOTH:
185
187
  return new int[] {
186
188
  AudioDeviceInfo.TYPE_BLUETOOTH_SCO,
187
- AudioDeviceInfo.TYPE_BLE_HEADSET
189
+ AudioDeviceInfo.TYPE_BLE_HEADSET,
190
+ AudioDeviceInfo.TYPE_BLE_SPEAKER
188
191
  };
189
192
  case AudioModeModule.DEVICE_HEADPHONES:
190
193
  return new int[] {
@@ -312,4 +315,4 @@ import java.util.Set;
312
315
 
313
316
  return true;
314
317
  }
315
- }
318
+ }
package/dist/index.d.mts CHANGED
@@ -1775,9 +1775,42 @@ declare const CallAppSettingsSchema: v.ObjectSchema<{
1775
1775
  readonly adminHost: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1776
1776
  readonly clientHost: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1777
1777
  readonly host: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1778
+ /**
1779
+ * Caller opt-out for SDK-identification telemetry. When `true`, the Calls SDK never
1780
+ * self-reports to `/user_sessions` (checked at the send chokepoint, so it covers both
1781
+ * the init session-restore path and every login-success path). Defaults to sending.
1782
+ */
1783
+ readonly disableSdkIdentification: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1778
1784
  }, undefined>;
1779
1785
  type CallAppSettings = v.InferOutput<typeof CallAppSettingsSchema>;
1780
1786
  //#endregion
1787
+ //#region src/settings.d.ts
1788
+ interface CometChatSettings {
1789
+ appId: string;
1790
+ region: string;
1791
+ credentials?: {
1792
+ authKey?: string;
1793
+ };
1794
+ callsSDK?: {
1795
+ adminHost?: string | null;
1796
+ clientHost?: string | null;
1797
+ host?: string | null;
1798
+ disableSdkIdentification?: boolean | null;
1799
+ };
1800
+ chatSDK?: Record<string, unknown>;
1801
+ uiKit?: Record<string, unknown>;
1802
+ }
1803
+ /**
1804
+ * Maps a `cometchat-settings.json` object onto the Calls SDK's own `CallAppSettings`
1805
+ * shape. Kept parallel to how the Chat SDK's `initFromSettings` maps the same file onto
1806
+ * its internal `AppSettings`: `appId`/`region` at the root, `authKey` under
1807
+ * `credentials`, and host overrides under the SDK-specific (`callsSDK`) section.
1808
+ *
1809
+ * The result is passed to the same valibot schema `init` uses, so validation stays
1810
+ * identical across both entry points.
1811
+ */
1812
+ declare function callAppSettingsFromSettings(settings: CometChatSettings): CallAppSettings;
1813
+ //#endregion
1781
1814
  //#region src/native-communication/native-to-js.native.d.ts
1782
1815
  declare function setupNativeEventListeners(): void;
1783
1816
  //#endregion
@@ -4386,6 +4419,34 @@ declare class CometChatCalls extends SessionMethodsCore {
4386
4419
  readonly success: true;
4387
4420
  readonly error: null;
4388
4421
  }>;
4422
+ /**
4423
+ * Shared tail of {@link init} / {@link initFromSettings}. Both entry points validate
4424
+ * and map their own inputs, then hand the validated {@link CallAppSettings} here so
4425
+ * the post-validation work — persisting the telemetry integration source (BEFORE any
4426
+ * report) and firing SDK-identification once on a restored session — lives in exactly
4427
+ * one place and cannot drift between the two paths. The ONLY per-entry-point
4428
+ * difference is `integrationSource`.
4429
+ */
4430
+ private static finalizeInit;
4431
+ /**
4432
+ * Initializes the CometChat Calls SDK from a `cometchat-settings.json` object.
4433
+ * Parallels the Chat SDK's `initFromSettings` (file-based init for skills-driven
4434
+ * integrations): it maps the shared settings shape onto the Calls SDK's own
4435
+ * `CallAppSettings` and then performs exactly the same work as {@link init}.
4436
+ * @param settings - Parsed `cometchat-settings.json` object.
4437
+ * @returns An object indicating success or failure with error details.
4438
+ */
4439
+ static initFromSettings(settings: CometChatSettings): Promise<{
4440
+ readonly success: false;
4441
+ readonly error: {
4442
+ readonly name: "VALIDATION_ERROR";
4443
+ readonly message: `Invalid app settings: ${string}`;
4444
+ readonly timestamp: number;
4445
+ };
4446
+ } | {
4447
+ readonly success: true;
4448
+ readonly error: null;
4449
+ }>;
4389
4450
  /**
4390
4451
  * Logs in a user with their UID and an optional auth key.
4391
4452
  * If no auth key is provided, the one from app settings is used.
@@ -4446,11 +4507,17 @@ declare class CometChatCalls extends SessionMethodsCore {
4446
4507
  token: string;
4447
4508
  }>;
4448
4509
  private static getBaseURL;
4510
+ /**
4511
+ * SDK-identification telemetry chokepoint. Fire-and-forget, deduped, non-fatal.
4512
+ * Called from login success AND init()-session-restore. Sends `/user_sessions`
4513
+ * ONLY when the Chat SDK is absent (it otherwise handles this telemetry itself).
4514
+ * Never awaited on the happy path; never throws.
4515
+ */
4516
+ private static reportSdkIdentification;
4449
4517
  private static loginWithUID;
4450
4518
  private static authenticateWithToken;
4451
4519
  private static logoutInternal;
4452
4520
  private static callGenerateTokenAPI;
4453
- private static callVerifyTokenAPI;
4454
4521
  private static getStorageKey;
4455
4522
  private static saveUser;
4456
4523
  private static getSavedUser;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as zustand3 from "zustand";
1
+ import * as zustand0 from "zustand";
2
2
  import * as zustand_middleware0 from "zustand/middleware";
3
3
  import { AppStateStatus } from "react-native";
4
4
  import JitsiMeetJS from "@cometchat/calls-lib-webrtc";
@@ -390,7 +390,7 @@ type Actions$5 = {
390
390
  isMobileSDK: () => boolean;
391
391
  isMobile: () => boolean;
392
392
  };
393
- declare const useBaseStore: zustand3.UseBoundStore<Omit<Omit<zustand3.StoreApi<BaseState & Actions$5>, "subscribe"> & {
393
+ declare const useBaseStore: zustand0.UseBoundStore<Omit<Omit<zustand0.StoreApi<BaseState & Actions$5>, "subscribe"> & {
394
394
  subscribe: {
395
395
  (listener: (selectedState: BaseState & Actions$5, previousSelectedState: BaseState & Actions$5) => void): () => void;
396
396
  <U>(selector: (state: BaseState & Actions$5) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -476,7 +476,7 @@ type Actions$4 = {
476
476
  endConference: () => Promise<void>;
477
477
  stopRecording: () => Promise<void>;
478
478
  };
479
- declare const useConferenceStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
479
+ declare const useConferenceStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
480
480
  subscribe: {
481
481
  (listener: (selectedState: ConferenceState & Actions$4, previousSelectedState: ConferenceState & Actions$4) => void): () => void;
482
482
  <U>(selector: (state: ConferenceState & Actions$4) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -833,7 +833,7 @@ type ConfigState = ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & Co
833
833
  type Actions$3 = {
834
834
  reset: () => void;
835
835
  };
836
- declare const useConfigStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
836
+ declare const useConfigStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
837
837
  subscribe: {
838
838
  (listener: (selectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3, previousSelectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => void): () => void;
839
839
  <U>(selector: (state: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -986,7 +986,7 @@ type Actions$2 = {
986
986
  disconnect: () => Promise<void>;
987
987
  reset: () => void;
988
988
  };
989
- declare const useConnectionStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
989
+ declare const useConnectionStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
990
990
  subscribe: {
991
991
  (listener: (selectedState: ConnectionState & Actions$2, previousSelectedState: ConnectionState & Actions$2) => void): () => void;
992
992
  <U>(selector: (state: ConnectionState & Actions$2) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -1037,7 +1037,7 @@ type Actions$1 = {
1037
1037
  getParticipantById: (pid: string) => HumanParticipant | undefined;
1038
1038
  reset: () => void;
1039
1039
  };
1040
- declare const useParticipantStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
1040
+ declare const useParticipantStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
1041
1041
  subscribe: {
1042
1042
  (listener: (selectedState: ParticipantsState & Actions$1, previousSelectedState: ParticipantsState & Actions$1) => void): () => void;
1043
1043
  <U>(selector: (state: ParticipantsState & Actions$1) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -1084,7 +1084,7 @@ interface ToastActions {
1084
1084
  clearAll: () => void;
1085
1085
  reset: () => void;
1086
1086
  }
1087
- declare const useToastStore: zustand3.UseBoundStore<zustand3.StoreApi<ToastState & ToastActions>>;
1087
+ declare const useToastStore: zustand0.UseBoundStore<zustand0.StoreApi<ToastState & ToastActions>>;
1088
1088
  declare function showToast(params: {
1089
1089
  id?: string;
1090
1090
  message: string;
@@ -1120,7 +1120,7 @@ type Actions = {
1120
1120
  updateTrack: (originalTrack: any, updatedTrack: Partial<Track>) => void;
1121
1121
  updateLocalTrack: (mediaType: MediaType, updatedTrack: Partial<Track>) => void;
1122
1122
  };
1123
- declare const useTracksStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<TracksState & Actions>, "subscribe"> & {
1123
+ declare const useTracksStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<TracksState & Actions>, "subscribe"> & {
1124
1124
  subscribe: {
1125
1125
  (listener: (selectedState: TracksState & Actions, previousSelectedState: TracksState & Actions) => void): () => void;
1126
1126
  <U>(selector: (state: TracksState & Actions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -1628,7 +1628,7 @@ interface TranslationState {
1628
1628
  translations: Record<string, typeof __json_default_export>;
1629
1629
  currentLocale: CometChatSupportedLocale | Omit<string, CometChatSupportedLocale>;
1630
1630
  }
1631
- declare const useTranslationStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1631
+ declare const useTranslationStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1632
1632
  reset: () => void;
1633
1633
  setLocale: (locale: CometChatSupportedLocale) => void;
1634
1634
  }>, "subscribe"> & {
@@ -1775,9 +1775,42 @@ declare const CallAppSettingsSchema: v.ObjectSchema<{
1775
1775
  readonly adminHost: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1776
1776
  readonly clientHost: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1777
1777
  readonly host: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1778
+ /**
1779
+ * Caller opt-out for SDK-identification telemetry. When `true`, the Calls SDK never
1780
+ * self-reports to `/user_sessions` (checked at the send chokepoint, so it covers both
1781
+ * the init session-restore path and every login-success path). Defaults to sending.
1782
+ */
1783
+ readonly disableSdkIdentification: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1778
1784
  }, undefined>;
1779
1785
  type CallAppSettings = v.InferOutput<typeof CallAppSettingsSchema>;
1780
1786
  //#endregion
1787
+ //#region src/settings.d.ts
1788
+ interface CometChatSettings {
1789
+ appId: string;
1790
+ region: string;
1791
+ credentials?: {
1792
+ authKey?: string;
1793
+ };
1794
+ callsSDK?: {
1795
+ adminHost?: string | null;
1796
+ clientHost?: string | null;
1797
+ host?: string | null;
1798
+ disableSdkIdentification?: boolean | null;
1799
+ };
1800
+ chatSDK?: Record<string, unknown>;
1801
+ uiKit?: Record<string, unknown>;
1802
+ }
1803
+ /**
1804
+ * Maps a `cometchat-settings.json` object onto the Calls SDK's own `CallAppSettings`
1805
+ * shape. Kept parallel to how the Chat SDK's `initFromSettings` maps the same file onto
1806
+ * its internal `AppSettings`: `appId`/`region` at the root, `authKey` under
1807
+ * `credentials`, and host overrides under the SDK-specific (`callsSDK`) section.
1808
+ *
1809
+ * The result is passed to the same valibot schema `init` uses, so validation stays
1810
+ * identical across both entry points.
1811
+ */
1812
+ declare function callAppSettingsFromSettings(settings: CometChatSettings): CallAppSettings;
1813
+ //#endregion
1781
1814
  //#region src/native-communication/native-to-js.native.d.ts
1782
1815
  declare function setupNativeEventListeners(): void;
1783
1816
  //#endregion
@@ -4386,6 +4419,34 @@ declare class CometChatCalls extends SessionMethodsCore {
4386
4419
  readonly success: true;
4387
4420
  readonly error: null;
4388
4421
  }>;
4422
+ /**
4423
+ * Shared tail of {@link init} / {@link initFromSettings}. Both entry points validate
4424
+ * and map their own inputs, then hand the validated {@link CallAppSettings} here so
4425
+ * the post-validation work — persisting the telemetry integration source (BEFORE any
4426
+ * report) and firing SDK-identification once on a restored session — lives in exactly
4427
+ * one place and cannot drift between the two paths. The ONLY per-entry-point
4428
+ * difference is `integrationSource`.
4429
+ */
4430
+ private static finalizeInit;
4431
+ /**
4432
+ * Initializes the CometChat Calls SDK from a `cometchat-settings.json` object.
4433
+ * Parallels the Chat SDK's `initFromSettings` (file-based init for skills-driven
4434
+ * integrations): it maps the shared settings shape onto the Calls SDK's own
4435
+ * `CallAppSettings` and then performs exactly the same work as {@link init}.
4436
+ * @param settings - Parsed `cometchat-settings.json` object.
4437
+ * @returns An object indicating success or failure with error details.
4438
+ */
4439
+ static initFromSettings(settings: CometChatSettings): Promise<{
4440
+ readonly success: false;
4441
+ readonly error: {
4442
+ readonly name: "VALIDATION_ERROR";
4443
+ readonly message: `Invalid app settings: ${string}`;
4444
+ readonly timestamp: number;
4445
+ };
4446
+ } | {
4447
+ readonly success: true;
4448
+ readonly error: null;
4449
+ }>;
4389
4450
  /**
4390
4451
  * Logs in a user with their UID and an optional auth key.
4391
4452
  * If no auth key is provided, the one from app settings is used.
@@ -4446,11 +4507,17 @@ declare class CometChatCalls extends SessionMethodsCore {
4446
4507
  token: string;
4447
4508
  }>;
4448
4509
  private static getBaseURL;
4510
+ /**
4511
+ * SDK-identification telemetry chokepoint. Fire-and-forget, deduped, non-fatal.
4512
+ * Called from login success AND init()-session-restore. Sends `/user_sessions`
4513
+ * ONLY when the Chat SDK is absent (it otherwise handles this telemetry itself).
4514
+ * Never awaited on the happy path; never throws.
4515
+ */
4516
+ private static reportSdkIdentification;
4449
4517
  private static loginWithUID;
4450
4518
  private static authenticateWithToken;
4451
4519
  private static logoutInternal;
4452
4520
  private static callGenerateTokenAPI;
4453
- private static callVerifyTokenAPI;
4454
4521
  private static getStorageKey;
4455
4522
  private static saveUser;
4456
4523
  private static getSavedUser;