@cometchat/calls-sdk-react-native 5.0.0-beta.10 → 5.0.0-beta.12

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.
@@ -23,7 +23,6 @@ public class MyAppPackage implements ReactPackage {
23
23
 
24
24
  modules.add(new AudioModeModule(reactContext));
25
25
  modules.add(new KeepAwakeModule(reactContext));
26
- modules.add(new ToastModule(reactContext));
27
26
 
28
27
  if (AudioModeModule.useConnectionService()) {
29
28
  modules.add(new RNConnectionService(reactContext));
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import * as v from "valibot";
2
2
  import * as zustand7 from "zustand";
3
3
  import * as zustand_middleware0 from "zustand/middleware";
4
4
  import React from "react";
5
- import JitsiMeetJS from "lib-jitsi-meet";
5
+ import JitsiMeetJS from "@cometchat/calls-lib-webrtc";
6
6
  import { AppStateStatus } from "react-native";
7
7
 
8
8
  //#region calls-sdk-core/event-listeners/onTrack.d.ts
@@ -89,6 +89,7 @@ declare const VIDEO_PAUSE_AUTHORITY: {
89
89
  };
90
90
  declare const CONFERENCE_COMMANDS: {
91
91
  userInfo: string;
92
+ initialConfig: string;
92
93
  };
93
94
  declare const VIDEO_QUALITY_LEVELS: {
94
95
  ULTRA: number;
@@ -338,7 +339,8 @@ type BaseState = {
338
339
  chatButtonUnreadCount: number;
339
340
  enableNoiseReduction: boolean;
340
341
  sdkPlatform: SDKPlatform;
341
- webOSName?: WebOSName;
342
+ platformVersion?: string | number;
343
+ userAgent?: string;
342
344
  previewVideoTrack?: any;
343
345
  isMobileBrowser: boolean;
344
346
  mainAreaDimension: {
@@ -1029,7 +1031,6 @@ type ValueOf<T> = T[keyof T];
1029
1031
  type ParticipantRole = ValueOf<typeof PARTICIPANT_ROLE>;
1030
1032
  type NotificationType = 'info' | 'success' | 'warning' | 'error';
1031
1033
  type SDKPlatform = ValueOf<typeof SDK_PLATFORM>;
1032
- type WebOSName = 'android' | 'ios' | 'macos' | 'windows' | 'linux' | 'unknown';
1033
1034
  interface ITrackOptions {
1034
1035
  cameraDeviceId?: string | null;
1035
1036
  constraints?: {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as zustand1 from "zustand";
1
+ import * as zustand3 from "zustand";
2
2
  import * as zustand_middleware0 from "zustand/middleware";
3
3
  import { AppStateStatus } from "react-native";
4
- import JitsiMeetJS from "lib-jitsi-meet";
4
+ import JitsiMeetJS from "@cometchat/calls-lib-webrtc";
5
5
  import * as v from "valibot";
6
6
  import React from "react";
7
7
 
@@ -89,6 +89,7 @@ declare const VIDEO_PAUSE_AUTHORITY: {
89
89
  };
90
90
  declare const CONFERENCE_COMMANDS: {
91
91
  userInfo: string;
92
+ initialConfig: string;
92
93
  };
93
94
  declare const VIDEO_QUALITY_LEVELS: {
94
95
  ULTRA: number;
@@ -338,7 +339,8 @@ type BaseState = {
338
339
  chatButtonUnreadCount: number;
339
340
  enableNoiseReduction: boolean;
340
341
  sdkPlatform: SDKPlatform;
341
- webOSName?: WebOSName;
342
+ platformVersion?: string | number;
343
+ userAgent?: string;
342
344
  previewVideoTrack?: any;
343
345
  isMobileBrowser: boolean;
344
346
  mainAreaDimension: {
@@ -373,7 +375,7 @@ type Actions$5 = {
373
375
  isMobileSDK: () => boolean;
374
376
  isMobile: () => boolean;
375
377
  };
376
- declare const useBaseStore: zustand1.UseBoundStore<Omit<Omit<zustand1.StoreApi<BaseState & Actions$5>, "subscribe"> & {
378
+ declare const useBaseStore: zustand3.UseBoundStore<Omit<Omit<zustand3.StoreApi<BaseState & Actions$5>, "subscribe"> & {
377
379
  subscribe: {
378
380
  (listener: (selectedState: BaseState & Actions$5, previousSelectedState: BaseState & Actions$5) => void): () => void;
379
381
  <U>(selector: (state: BaseState & Actions$5) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -453,7 +455,7 @@ type Actions$4 = {
453
455
  endConference: () => Promise<void>;
454
456
  stopRecording: () => Promise<void>;
455
457
  };
456
- declare const useConferenceStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
458
+ declare const useConferenceStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
457
459
  subscribe: {
458
460
  (listener: (selectedState: ConferenceState & Actions$4, previousSelectedState: ConferenceState & Actions$4) => void): () => void;
459
461
  <U>(selector: (state: ConferenceState & Actions$4) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -538,7 +540,7 @@ type ConfigState = ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & Co
538
540
  type Actions$3 = {
539
541
  reset: () => void;
540
542
  };
541
- declare const useConfigStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
543
+ declare const useConfigStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
542
544
  subscribe: {
543
545
  (listener: (selectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3, previousSelectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => void): () => void;
544
546
  <U>(selector: (state: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -690,7 +692,7 @@ type Actions$2 = {
690
692
  disconnect: () => Promise<void>;
691
693
  reset: () => void;
692
694
  };
693
- declare const useConnectionStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
695
+ declare const useConnectionStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
694
696
  subscribe: {
695
697
  (listener: (selectedState: ConnectionState & Actions$2, previousSelectedState: ConnectionState & Actions$2) => void): () => void;
696
698
  <U>(selector: (state: ConnectionState & Actions$2) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -741,7 +743,7 @@ type Actions$1 = {
741
743
  getParticipantById: (pid: string) => HumanParticipant | undefined;
742
744
  reset: () => void;
743
745
  };
744
- declare const useParticipantStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
746
+ declare const useParticipantStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
745
747
  subscribe: {
746
748
  (listener: (selectedState: ParticipantsState & Actions$1, previousSelectedState: ParticipantsState & Actions$1) => void): () => void;
747
749
  <U>(selector: (state: ParticipantsState & Actions$1) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -786,7 +788,7 @@ interface ToastActions {
786
788
  clearAll: () => void;
787
789
  reset: () => void;
788
790
  }
789
- declare const useToastStore: zustand1.UseBoundStore<zustand1.StoreApi<ToastState & ToastActions>>;
791
+ declare const useToastStore: zustand3.UseBoundStore<zustand3.StoreApi<ToastState & ToastActions>>;
790
792
  declare function showToast(params: {
791
793
  message: string;
792
794
  type?: NotificationType;
@@ -819,7 +821,7 @@ type Actions = {
819
821
  updateTrack: (originalTrack: any, updatedTrack: Partial<Track>) => void;
820
822
  updateLocalTrack: (mediaType: MediaType, updatedTrack: Partial<Track>) => void;
821
823
  };
822
- declare const useTracksStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<TracksState & Actions>, "subscribe"> & {
824
+ declare const useTracksStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<TracksState & Actions>, "subscribe"> & {
823
825
  subscribe: {
824
826
  (listener: (selectedState: TracksState & Actions, previousSelectedState: TracksState & Actions) => void): () => void;
825
827
  <U>(selector: (state: TracksState & Actions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -1029,7 +1031,6 @@ type ValueOf<T> = T[keyof T];
1029
1031
  type ParticipantRole = ValueOf<typeof PARTICIPANT_ROLE>;
1030
1032
  type NotificationType = 'info' | 'success' | 'warning' | 'error';
1031
1033
  type SDKPlatform = ValueOf<typeof SDK_PLATFORM>;
1032
- type WebOSName = 'android' | 'ios' | 'macos' | 'windows' | 'linux' | 'unknown';
1033
1034
  interface ITrackOptions {
1034
1035
  cameraDeviceId?: string | null;
1035
1036
  constraints?: {
@@ -1311,7 +1312,7 @@ interface TranslationState {
1311
1312
  translations: Record<string, typeof __json_default_export>;
1312
1313
  currentLocale: CometChatSupportedLocale | Omit<string, CometChatSupportedLocale>;
1313
1314
  }
1314
- declare const useTranslationStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1315
+ declare const useTranslationStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1315
1316
  reset: () => void;
1316
1317
  setLocale: (locale: CometChatSupportedLocale) => void;
1317
1318
  }>, "subscribe"> & {
package/dist/index.js CHANGED
@@ -33,8 +33,8 @@ let zustand_middleware = require("zustand/middleware");
33
33
  let zustand_shallow = require("zustand/shallow");
34
34
  let react = require("react");
35
35
  react = __toESM(react);
36
- let lib_jitsi_meet = require("lib-jitsi-meet");
37
- lib_jitsi_meet = __toESM(lib_jitsi_meet);
36
+ let __cometchat_calls_lib_webrtc = require("@cometchat/calls-lib-webrtc");
37
+ __cometchat_calls_lib_webrtc = __toESM(__cometchat_calls_lib_webrtc);
38
38
  let __react_native_async_storage_async_storage = require("@react-native-async-storage/async-storage");
39
39
  __react_native_async_storage_async_storage = __toESM(__react_native_async_storage_async_storage);
40
40
  let react_native = require("react-native");
@@ -136,7 +136,10 @@ const VIDEO_PAUSE_AUTHORITY = {
136
136
  BACKGROUND: 1 << 1,
137
137
  SCREEN_SHARE: 1 << 2
138
138
  };
139
- const CONFERENCE_COMMANDS = { userInfo: "user-info" };
139
+ const CONFERENCE_COMMANDS = {
140
+ userInfo: "user-info",
141
+ initialConfig: "initial_config"
142
+ };
140
143
  const VIDEO_QUALITY_LEVELS = {
141
144
  ULTRA: 2160,
142
145
  HIGH: 720,
@@ -726,7 +729,7 @@ async function createLocalTrackF(type, deviceId = null, timeout = null, addition
726
729
  if (iAmRecorder) {
727
730
  return;
728
731
  }
729
- const { data: tracks, error } = await tryCatch(lib_jitsi_meet.default.createLocalTracks({
732
+ const { data: tracks, error } = await tryCatch(__cometchat_calls_lib_webrtc.default.createLocalTracks({
730
733
  devices: [type],
731
734
  cameraDeviceId: deviceId,
732
735
  micDeviceId: deviceId,
@@ -836,11 +839,11 @@ function updateVideoInputDeviceState(device, skipSubscribe = false) {
836
839
  }
837
840
  }
838
841
  function updateAudioOutputDevice(deviceId) {
839
- if (!lib_jitsi_meet.default.mediaDevices.isDeviceChangeAvailable("output")) {
842
+ if (!__cometchat_calls_lib_webrtc.default.mediaDevices.isDeviceChangeAvailable("output")) {
840
843
  console.warn("Adjusting audio output is not supported");
841
844
  return;
842
845
  }
843
- lib_jitsi_meet.default.mediaDevices.setAudioOutputDevice(deviceId).then(() => {
846
+ __cometchat_calls_lib_webrtc.default.mediaDevices.setAudioOutputDevice(deviceId).then(() => {
844
847
  const audioOutputDevices = useBaseStore.getState().audioOutputDevices;
845
848
  const device = audioOutputDevices.find((d) => d.deviceId === deviceId);
846
849
  if (device) {
@@ -1246,6 +1249,32 @@ useParticipantStore.subscribe((state) => state.participants.filter((p) => p.uid)
1246
1249
  }
1247
1250
  });
1248
1251
 
1252
+ //#endregion
1253
+ //#region calls-sdk-core/store/utils/send-initial-config.ts
1254
+ function sendInitialConfig() {
1255
+ const conference = useConferenceStore.getState().conference;
1256
+ if (!conference?.room) {
1257
+ return;
1258
+ }
1259
+ const config = useConfigStore.getState();
1260
+ const localParticipant = useParticipantStore.getState().localParticipant;
1261
+ const attributes = {
1262
+ session_id: config.sessionId,
1263
+ is_audio_only: String(config.sessionType === "VOICE"),
1264
+ is_audio_muted: String(config.startAudioMuted),
1265
+ is_video_muted: String(config.startVideoPaused),
1266
+ start_recording_on_call_start: String(config.autoStartRecording),
1267
+ uid: localParticipant.uid,
1268
+ platform: useBaseStore.getState().sdkPlatform,
1269
+ platform_version: useBaseStore.getState().platformVersion,
1270
+ user_agent: useBaseStore.getState().userAgent,
1271
+ meeting_id: conference.room?.xmpp?.getJid?.() ?? config.sessionId,
1272
+ mode: config.layout,
1273
+ commit_id: "bffd2c83"
1274
+ };
1275
+ conference.room.addOrReplaceInPresence(CONFERENCE_COMMANDS.initialConfig, { attributes });
1276
+ }
1277
+
1249
1278
  //#endregion
1250
1279
  //#region calls-sdk-core/store/conference.ts
1251
1280
  const initialState$6 = {
@@ -1258,8 +1287,8 @@ const initialState$6 = {
1258
1287
  connectionQuality: new Map(),
1259
1288
  raiseHandMap: new Map(),
1260
1289
  recording: {
1261
- status: lib_jitsi_meet.default.constants.recording.status.OFF,
1262
- mode: lib_jitsi_meet.default.constants.recording.mode.FILE
1290
+ status: __cometchat_calls_lib_webrtc.default.constants.recording.status.OFF,
1291
+ mode: __cometchat_calls_lib_webrtc.default.constants.recording.mode.FILE
1263
1292
  },
1264
1293
  isRecording: false
1265
1294
  };
@@ -1282,7 +1311,9 @@ const useConferenceStore = (0, zustand.create)()((0, zustand_middleware.subscrib
1282
1311
  },
1283
1312
  lowerHand: (participantId) => {
1284
1313
  const hasRaisedHand = useConferenceStore.getState().raiseHandMap.has(participantId);
1285
- if (!hasRaisedHand) return;
1314
+ if (!hasRaisedHand) {
1315
+ return;
1316
+ }
1286
1317
  set((state) => {
1287
1318
  const raiseHandMap = new Map(state.raiseHandMap);
1288
1319
  raiseHandMap.delete(participantId);
@@ -1373,7 +1404,7 @@ useConferenceStore.subscribe((state) => state.recording, (recording) => {
1373
1404
  const recordingMode = recording.mode;
1374
1405
  const recordingError = recording.error;
1375
1406
  const initiator = recording.initiator;
1376
- const isRecording = !recordingError && initiator && recordingMode === lib_jitsi_meet.default.constants.recording.mode.FILE && (recordingStatus === lib_jitsi_meet.default.constants.recording.status.ON || recordingStatus === lib_jitsi_meet.default.constants.recording.status.PENDING);
1407
+ const isRecording = !recordingError && initiator && recordingMode === __cometchat_calls_lib_webrtc.default.constants.recording.mode.FILE && (recordingStatus === __cometchat_calls_lib_webrtc.default.constants.recording.status.ON || recordingStatus === __cometchat_calls_lib_webrtc.default.constants.recording.status.PENDING);
1377
1408
  if (isRecording) {
1378
1409
  useConferenceStore.setState({ isRecording: true });
1379
1410
  } else {
@@ -1415,7 +1446,7 @@ async function startRecording() {
1415
1446
  const conference = useConferenceStore.getState().conference;
1416
1447
  if (conference) {
1417
1448
  const { data, error } = await tryCatch(conference.startRecording({
1418
- mode: lib_jitsi_meet.default.constants.recording.mode.FILE,
1449
+ mode: __cometchat_calls_lib_webrtc.default.constants.recording.mode.FILE,
1419
1450
  appData: JSON.stringify({ startedAt: Date.now() })
1420
1451
  }));
1421
1452
  if (data) {
@@ -1440,9 +1471,10 @@ const getIsConferenceJoined = () => {
1440
1471
  return conferenceStatus === "joined" || conferenceStatus === "restored";
1441
1472
  };
1442
1473
  useConferenceStore.subscribe((state) => state.conference, (conference) => {
1474
+ sendInitialConfig();
1443
1475
  if (conference) {
1444
1476
  const localParticipant = useParticipantStore.getState().localParticipant;
1445
- conference?.sendCommand(CONFERENCE_COMMANDS.userInfo, { value: JSON.stringify(localParticipant) });
1477
+ conference.sendCommand(CONFERENCE_COMMANDS.userInfo, { value: JSON.stringify(localParticipant) });
1446
1478
  }
1447
1479
  });
1448
1480
 
@@ -1876,7 +1908,6 @@ const initialState$4 = {
1876
1908
  chatButtonUnreadCount: 0,
1877
1909
  enableNoiseReduction: true,
1878
1910
  sdkPlatform: SDK_PLATFORM.WEB,
1879
- webOSName: "unknown",
1880
1911
  isMobileBrowser: false,
1881
1912
  visibleParticipants: {
1882
1913
  startIndex: 0,
@@ -2583,13 +2614,13 @@ var ConferenceListener = class {
2583
2614
  } else {
2584
2615
  useTracksStore.getState().removeTrack(track);
2585
2616
  }
2586
- track.removeAllListeners(lib_jitsi_meet.default.events.track.TRACK_MUTE_CHANGED);
2587
- track.removeAllListeners(lib_jitsi_meet.default.events.track.TRACK_VIDEOTYPE_CHANGED);
2588
- track.removeAllListeners(lib_jitsi_meet.default.events.track.NO_DATA_FROM_SOURCE);
2617
+ track.removeAllListeners(__cometchat_calls_lib_webrtc.default.events.track.TRACK_MUTE_CHANGED);
2618
+ track.removeAllListeners(__cometchat_calls_lib_webrtc.default.events.track.TRACK_VIDEOTYPE_CHANGED);
2619
+ track.removeAllListeners(__cometchat_calls_lib_webrtc.default.events.track.NO_DATA_FROM_SOURCE);
2589
2620
  }
2590
2621
  onConferenceJoinInProgress() {}
2591
2622
  onConferenceFailed(errorName, error, message) {
2592
- if (errorName === lib_jitsi_meet.default.errors.conference.CONFERENCE_DESTROYED) {
2623
+ if (errorName === __cometchat_calls_lib_webrtc.default.errors.conference.CONFERENCE_DESTROYED) {
2593
2624
  leaveSession({ forceLeave: true });
2594
2625
  return;
2595
2626
  }
@@ -2781,30 +2812,30 @@ const UserInfoCommandSchema = valibot.pick(HumanParticipantSchema, ["avatar", "u
2781
2812
  //#endregion
2782
2813
  //#region calls-sdk-core/handlers/conference.ts
2783
2814
  function addConferenceListeners(conference) {
2784
- conference.on(lib_jitsi_meet.default.events.conference.USER_JOINED, conferenceListener.onUserJoined);
2785
- conference.on(lib_jitsi_meet.default.events.conference.USER_LEFT, conferenceListener.onUserLeft);
2786
- conference.on(lib_jitsi_meet.default.events.conference.TRACK_ADDED, conferenceListener.onTrackAdded);
2787
- conference.on(lib_jitsi_meet.default.events.conference.TRACK_REMOVED, conferenceListener.onTrackRemoved);
2788
- conference.on(lib_jitsi_meet.default.events.conference.CONFERENCE_JOIN_IN_PROGRESS, conferenceListener.onConferenceJoinInProgress);
2789
- conference.on(lib_jitsi_meet.default.events.conference.CONFERENCE_FAILED, conferenceListener.onConferenceFailed);
2790
- conference.on(lib_jitsi_meet.default.events.conference.RECORDER_STATE_CHANGED, conferenceListener.onRecorderStateChanged);
2791
- conference.on(lib_jitsi_meet.default.events.conference.CONNECTION_ESTABLISHED, conferenceListener.onConnectionEstablished);
2792
- conference.on(lib_jitsi_meet.default.events.conference.CONNECTION_INTERRUPTED, conferenceListener.onConnectionInterrupted);
2793
- conference.on(lib_jitsi_meet.default.events.conference.CONNECTION_RESTORED, conferenceListener.onConnectionRestored);
2794
- conference.on(lib_jitsi_meet.default.events.conference.P2P_STATUS, conferenceListener.onP2PStatus);
2795
- conference.on(lib_jitsi_meet.default.events.conference.TRACK_MUTE_CHANGED, conferenceListener.onTrackMuteChanged);
2796
- conference.on(lib_jitsi_meet.default.events.conference.CONFERENCE_JOINED, conferenceListener.onConferenceJoined);
2797
- conference.on(lib_jitsi_meet.default.events.conference.CONFERENCE_LEFT, conferenceListener.onConferenceLeft);
2798
- conference.on(lib_jitsi_meet.default.events.conference.PARTICIPANT_SOURCE_UPDATED, conferenceListener.onParticipantSourceUpdated);
2799
- conference.on(lib_jitsi_meet.default.events.conference.CONFERENCE_CREATED_TIMESTAMP, conferenceListener.onConferenceCreatedTimestamp);
2800
- conference.on(lib_jitsi_meet.default.events.conference.DOMINANT_SPEAKER_CHANGED, conferenceListener.onDominantSpeakerChanged);
2801
- conference.on(lib_jitsi_meet.default.events.connectionQuality.LOCAL_STATS_UPDATED, conferenceListener.onLocalStatsUpdated);
2802
- conference.on(lib_jitsi_meet.default.events.connectionQuality.REMOTE_STATS_UPDATED, conferenceListener.onRemoteStatsUpdated);
2803
- conference.on(lib_jitsi_meet.default.events.conference.PARTICIPANT_PROPERTY_CHANGED, conferenceListener.onParticipantPropertyChanged);
2804
- conference.on(lib_jitsi_meet.default.events.conference.USER_ROLE_CHANGED, conferenceListener.onUserRoleChanged);
2805
- conference.on(lib_jitsi_meet.default.events.conference.TALK_WHILE_MUTED, conferenceListener.onTalkWhileMuted);
2806
- conference.on(lib_jitsi_meet.default.events.conference.TRACK_UNMUTE_REJECTED, conferenceListener.onTrackUnmuteRejected);
2807
- conference.on(lib_jitsi_meet.default.events.conference.TRACK_AUDIO_LEVEL_CHANGED, conferenceListener.onTrackAudioLevelChanged);
2815
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.USER_JOINED, conferenceListener.onUserJoined);
2816
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.USER_LEFT, conferenceListener.onUserLeft);
2817
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.TRACK_ADDED, conferenceListener.onTrackAdded);
2818
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.TRACK_REMOVED, conferenceListener.onTrackRemoved);
2819
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.CONFERENCE_JOIN_IN_PROGRESS, conferenceListener.onConferenceJoinInProgress);
2820
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.CONFERENCE_FAILED, conferenceListener.onConferenceFailed);
2821
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.RECORDER_STATE_CHANGED, conferenceListener.onRecorderStateChanged);
2822
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.CONNECTION_ESTABLISHED, conferenceListener.onConnectionEstablished);
2823
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.CONNECTION_INTERRUPTED, conferenceListener.onConnectionInterrupted);
2824
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.CONNECTION_RESTORED, conferenceListener.onConnectionRestored);
2825
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.P2P_STATUS, conferenceListener.onP2PStatus);
2826
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.TRACK_MUTE_CHANGED, conferenceListener.onTrackMuteChanged);
2827
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.CONFERENCE_JOINED, conferenceListener.onConferenceJoined);
2828
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.CONFERENCE_LEFT, conferenceListener.onConferenceLeft);
2829
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.PARTICIPANT_SOURCE_UPDATED, conferenceListener.onParticipantSourceUpdated);
2830
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.CONFERENCE_CREATED_TIMESTAMP, conferenceListener.onConferenceCreatedTimestamp);
2831
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.DOMINANT_SPEAKER_CHANGED, conferenceListener.onDominantSpeakerChanged);
2832
+ conference.on(__cometchat_calls_lib_webrtc.default.events.connectionQuality.LOCAL_STATS_UPDATED, conferenceListener.onLocalStatsUpdated);
2833
+ conference.on(__cometchat_calls_lib_webrtc.default.events.connectionQuality.REMOTE_STATS_UPDATED, conferenceListener.onRemoteStatsUpdated);
2834
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.PARTICIPANT_PROPERTY_CHANGED, conferenceListener.onParticipantPropertyChanged);
2835
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.USER_ROLE_CHANGED, conferenceListener.onUserRoleChanged);
2836
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.TALK_WHILE_MUTED, conferenceListener.onTalkWhileMuted);
2837
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.TRACK_UNMUTE_REJECTED, conferenceListener.onTrackUnmuteRejected);
2838
+ conference.on(__cometchat_calls_lib_webrtc.default.events.conference.TRACK_AUDIO_LEVEL_CHANGED, conferenceListener.onTrackAudioLevelChanged);
2808
2839
  conference.addCommandListener(CONFERENCE_COMMANDS.userInfo, (data, id) => {
2809
2840
  const vData = valibot.safeParse(UserInfoCommandSchema, safeParseJson(data.value));
2810
2841
  if (vData.success) {
@@ -2883,12 +2914,12 @@ async function connect(autoJoinConference = true) {
2883
2914
  if (options && iAmRecorder) {
2884
2915
  options.p2p = { enabled: false };
2885
2916
  }
2886
- const connection = new lib_jitsi_meet.default.JitsiConnection(null, jwt, options);
2917
+ const connection = new __cometchat_calls_lib_webrtc.default.JitsiConnection(null, jwt, options);
2887
2918
  useConnectionStore.getState().connectionWillConnect(connection);
2888
- connection.addEventListener(lib_jitsi_meet.default.events.connection.CONNECTION_ESTABLISHED, onConnectionEstablished);
2889
- connection.addEventListener(lib_jitsi_meet.default.events.connection.CONNECTION_FAILED, onConnectionFailed);
2890
- connection.addEventListener(lib_jitsi_meet.default.events.connection.CONNECTION_DISCONNECTED, onDisconnected);
2891
- connection.addEventListener(lib_jitsi_meet.default.events.connection.PROPERTIES_UPDATED, onPropertiesUpdated);
2919
+ connection.addEventListener(__cometchat_calls_lib_webrtc.default.events.connection.CONNECTION_ESTABLISHED, onConnectionEstablished);
2920
+ connection.addEventListener(__cometchat_calls_lib_webrtc.default.events.connection.CONNECTION_FAILED, onConnectionFailed);
2921
+ connection.addEventListener(__cometchat_calls_lib_webrtc.default.events.connection.CONNECTION_DISCONNECTED, onDisconnected);
2922
+ connection.addEventListener(__cometchat_calls_lib_webrtc.default.events.connection.PROPERTIES_UPDATED, onPropertiesUpdated);
2892
2923
  async function onConnectionEstablished() {
2893
2924
  useConnectionStore.getState().connectionEstablished(connection);
2894
2925
  eventBus.publish({ type: INTERNAL_EVENTS.onConnectionEstablished });
@@ -2905,9 +2936,9 @@ async function connect(autoJoinConference = true) {
2905
2936
  console.log("Properties updated", properties);
2906
2937
  }
2907
2938
  function unsubscribe() {
2908
- connection.removeEventListener(lib_jitsi_meet.default.events.connection.PROPERTIES_UPDATED, onPropertiesUpdated);
2909
- connection.removeEventListener(lib_jitsi_meet.default.events.connection.CONNECTION_FAILED, onConnectionFailed);
2910
- connection.removeEventListener(lib_jitsi_meet.default.events.connection.CONNECTION_DISCONNECTED, onDisconnected);
2939
+ connection.removeEventListener(__cometchat_calls_lib_webrtc.default.events.connection.PROPERTIES_UPDATED, onPropertiesUpdated);
2940
+ connection.removeEventListener(__cometchat_calls_lib_webrtc.default.events.connection.CONNECTION_FAILED, onConnectionFailed);
2941
+ connection.removeEventListener(__cometchat_calls_lib_webrtc.default.events.connection.CONNECTION_DISCONNECTED, onDisconnected);
2911
2942
  }
2912
2943
  const xmpp_username_override = localStorage.getItem("xmpp_username_override");
2913
2944
  const xmpp_password_override = localStorage.getItem("xmpp_password_override");
@@ -2964,7 +2995,7 @@ function updateInputOutputDevices(onlyUpdateIfLabelIsEmpty = false) {
2964
2995
  if (onlyUpdateIfLabelIsEmpty && isLabelEmpty()) {
2965
2996
  return;
2966
2997
  }
2967
- const { mediaDevices } = lib_jitsi_meet.default;
2998
+ const { mediaDevices } = __cometchat_calls_lib_webrtc.default;
2968
2999
  if (mediaDevices.isDeviceChangeAvailable()) {
2969
3000
  mediaDevices.enumerateDevices((devices) => {
2970
3001
  const audioInputDevices = devices.filter((device) => device.kind === "audioinput" && device.deviceId !== "");
@@ -2979,8 +3010,8 @@ function updateInputOutputDevices(onlyUpdateIfLabelIsEmpty = false) {
2979
3010
  }
2980
3011
  }
2981
3012
  function _initDeviceList() {
2982
- const { mediaDevices } = lib_jitsi_meet.default;
2983
- mediaDevices.addEventListener(lib_jitsi_meet.default.events.mediaDevices.DEVICE_LIST_CHANGED, (devices) => {
3013
+ const { mediaDevices } = __cometchat_calls_lib_webrtc.default;
3014
+ mediaDevices.addEventListener(__cometchat_calls_lib_webrtc.default.events.mediaDevices.DEVICE_LIST_CHANGED, (devices) => {
2984
3015
  const existingAudioInputDevices = useBaseStore.getState().audioInputDevices;
2985
3016
  const existingAudioOutputDevices = useBaseStore.getState().audioOutputDevices;
2986
3017
  const existingVideoInputDevices = useBaseStore.getState().videoInputDevices;
@@ -2999,7 +3030,7 @@ const initDeviceList = runOnce(_initDeviceList);
2999
3030
  //#region calls-sdk-core/handlers/screen-share.ts
3000
3031
  function startScreenSharing() {
3001
3032
  const desktopSharingFrameRate = useBaseStore.getState().desktopSharingFrameRate;
3002
- lib_jitsi_meet.default.createLocalTracks({
3033
+ __cometchat_calls_lib_webrtc.default.createLocalTracks({
3003
3034
  devices: ["desktop"],
3004
3035
  desktopSharingFrameRate
3005
3036
  }).then((tracks) => {
@@ -3091,8 +3122,8 @@ var Mutex = class {
3091
3122
  //#endregion
3092
3123
  //#region calls-sdk-core/handlers/init.ts
3093
3124
  function initializeLib() {
3094
- lib_jitsi_meet.default.init();
3095
- lib_jitsi_meet.default.setLogLevel(lib_jitsi_meet.default.logLevels.ERROR);
3125
+ __cometchat_calls_lib_webrtc.default.init();
3126
+ __cometchat_calls_lib_webrtc.default.setLogLevel(__cometchat_calls_lib_webrtc.default.logLevels.ERROR);
3096
3127
  console.log("JitsiMeetJS initialized successfully.");
3097
3128
  }
3098
3129
 
@@ -3205,7 +3236,7 @@ function onTrack(track) {
3205
3236
  originalTrack: track,
3206
3237
  ...track.getVideoType() === "desktop" ? { muted: 0 } : typeof muted === "boolean" ? { muted } : {}
3207
3238
  });
3208
- track.on(lib_jitsi_meet.default.events.track.LOCAL_TRACK_STOPPED, (t) => {
3239
+ track.on(__cometchat_calls_lib_webrtc.default.events.track.LOCAL_TRACK_STOPPED, (t) => {
3209
3240
  if (t.getVideoType() === "desktop") {
3210
3241
  stopScreenSharing();
3211
3242
  }
@@ -3213,15 +3244,15 @@ function onTrack(track) {
3213
3244
  } else {
3214
3245
  useTracksStore.getState().addTrack(track);
3215
3246
  }
3216
- track.removeAllListeners(lib_jitsi_meet.default.events.track.TRACK_MUTE_CHANGED);
3217
- track.removeAllListeners(lib_jitsi_meet.default.events.track.TRACK_VIDEOTYPE_CHANGED);
3218
- track.on(lib_jitsi_meet.default.events.track.TRACK_MUTE_CHANGED, (t) => {
3247
+ track.removeAllListeners(__cometchat_calls_lib_webrtc.default.events.track.TRACK_MUTE_CHANGED);
3248
+ track.removeAllListeners(__cometchat_calls_lib_webrtc.default.events.track.TRACK_VIDEOTYPE_CHANGED);
3249
+ track.on(__cometchat_calls_lib_webrtc.default.events.track.TRACK_MUTE_CHANGED, (t) => {
3219
3250
  if (t.isLocal()) {
3220
3251
  return;
3221
3252
  }
3222
3253
  useTracksStore.getState().updateTrack(t, { muted: t.isMuted() ? 1 : 0 });
3223
3254
  });
3224
- track.on(lib_jitsi_meet.default.events.track.TRACK_VIDEOTYPE_CHANGED, (type) => {
3255
+ track.on(__cometchat_calls_lib_webrtc.default.events.track.TRACK_VIDEOTYPE_CHANGED, (type) => {
3225
3256
  useTracksStore.getState().updateTrack(track, {
3226
3257
  videoType: type,
3227
3258
  mediaType: type === "desktop" ? "screenshare" : "video"
@@ -3612,6 +3643,9 @@ eventBus.subscribe(INTERNAL_EVENTS.lifecycle.componentDidMount, () => {
3612
3643
  });
3613
3644
  });
3614
3645
  useBaseStore.subscribe((state) => state.appState, (appState) => {
3646
+ if (!getIsConferenceJoined()) {
3647
+ return;
3648
+ }
3615
3649
  const sessionType = useConfigStore.getState().sessionType;
3616
3650
  if (sessionType !== SESSION_TYPE.VIDEO) {
3617
3651
  return;
@@ -5717,6 +5751,7 @@ const ControlPane = () => {
5717
5751
  }
5718
5752
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
5719
5753
  style: controlPaneStyles.controlPane,
5754
+ testID: "cometchat-control-panel",
5720
5755
  children: [
5721
5756
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Audio_native_default, {}),
5722
5757
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Video_native_default, {}),
@@ -6088,6 +6123,7 @@ const Header = () => {
6088
6123
  }
6089
6124
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
6090
6125
  style: styles$7.headerContainer,
6126
+ testID: "cometchat-header-panel",
6091
6127
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
6092
6128
  style: styles$7.meetingInfo,
6093
6129
  children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
@@ -6797,8 +6833,9 @@ function CallUI(props) {
6797
6833
  } else {
6798
6834
  useBaseStore.setState({ sdkPlatform: react_native.Platform.OS === "ios" ? "react-native-ios" : "react-native-android" });
6799
6835
  }
6836
+ useBaseStore.setState({ platformVersion: react_native.Platform.Version });
6800
6837
  startSession();
6801
- }, []);
6838
+ }, [props.sessionSettings.sdkPlatform]);
6802
6839
  (0, react.useEffect)(() => {
6803
6840
  const sub = AudioModeEventEmitter.addListener(AudioModeModule_default.DEVICE_CHANGE_EVENT, (e) => {
6804
6841
  console.log("AudioMode.DEVICE_CHANGE_EVENT", e);
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { create } from "zustand";
4
4
  import { combine, persist, subscribeWithSelector } from "zustand/middleware";
5
5
  import { shallow } from "zustand/shallow";
6
6
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
7
- import JitsiMeetJS from "lib-jitsi-meet";
7
+ import JitsiMeetJS from "@cometchat/calls-lib-webrtc";
8
8
  import AsyncStorage from "@react-native-async-storage/async-storage";
9
9
  import { ActivityIndicator, Animated, AppState, DeviceEventEmitter, Dimensions, FlatList, Image, Modal, NativeEventEmitter, NativeModules, PanResponder, Platform, Pressable, ScrollView, StyleSheet, Text, TextInput, TouchableOpacity, TouchableWithoutFeedback, View } from "react-native";
10
10
  import { RTCView, permissions } from "react-native-webrtc";
@@ -104,7 +104,10 @@ const VIDEO_PAUSE_AUTHORITY = {
104
104
  BACKGROUND: 1 << 1,
105
105
  SCREEN_SHARE: 1 << 2
106
106
  };
107
- const CONFERENCE_COMMANDS = { userInfo: "user-info" };
107
+ const CONFERENCE_COMMANDS = {
108
+ userInfo: "user-info",
109
+ initialConfig: "initial_config"
110
+ };
108
111
  const VIDEO_QUALITY_LEVELS = {
109
112
  ULTRA: 2160,
110
113
  HIGH: 720,
@@ -1214,6 +1217,32 @@ useParticipantStore.subscribe((state) => state.participants.filter((p) => p.uid)
1214
1217
  }
1215
1218
  });
1216
1219
 
1220
+ //#endregion
1221
+ //#region calls-sdk-core/store/utils/send-initial-config.ts
1222
+ function sendInitialConfig() {
1223
+ const conference = useConferenceStore.getState().conference;
1224
+ if (!conference?.room) {
1225
+ return;
1226
+ }
1227
+ const config = useConfigStore.getState();
1228
+ const localParticipant = useParticipantStore.getState().localParticipant;
1229
+ const attributes = {
1230
+ session_id: config.sessionId,
1231
+ is_audio_only: String(config.sessionType === "VOICE"),
1232
+ is_audio_muted: String(config.startAudioMuted),
1233
+ is_video_muted: String(config.startVideoPaused),
1234
+ start_recording_on_call_start: String(config.autoStartRecording),
1235
+ uid: localParticipant.uid,
1236
+ platform: useBaseStore.getState().sdkPlatform,
1237
+ platform_version: useBaseStore.getState().platformVersion,
1238
+ user_agent: useBaseStore.getState().userAgent,
1239
+ meeting_id: conference.room?.xmpp?.getJid?.() ?? config.sessionId,
1240
+ mode: config.layout,
1241
+ commit_id: "bffd2c83"
1242
+ };
1243
+ conference.room.addOrReplaceInPresence(CONFERENCE_COMMANDS.initialConfig, { attributes });
1244
+ }
1245
+
1217
1246
  //#endregion
1218
1247
  //#region calls-sdk-core/store/conference.ts
1219
1248
  const initialState$6 = {
@@ -1250,7 +1279,9 @@ const useConferenceStore = create()(subscribeWithSelector(combine(initialState$6
1250
1279
  },
1251
1280
  lowerHand: (participantId) => {
1252
1281
  const hasRaisedHand = useConferenceStore.getState().raiseHandMap.has(participantId);
1253
- if (!hasRaisedHand) return;
1282
+ if (!hasRaisedHand) {
1283
+ return;
1284
+ }
1254
1285
  set((state) => {
1255
1286
  const raiseHandMap = new Map(state.raiseHandMap);
1256
1287
  raiseHandMap.delete(participantId);
@@ -1408,9 +1439,10 @@ const getIsConferenceJoined = () => {
1408
1439
  return conferenceStatus === "joined" || conferenceStatus === "restored";
1409
1440
  };
1410
1441
  useConferenceStore.subscribe((state) => state.conference, (conference) => {
1442
+ sendInitialConfig();
1411
1443
  if (conference) {
1412
1444
  const localParticipant = useParticipantStore.getState().localParticipant;
1413
- conference?.sendCommand(CONFERENCE_COMMANDS.userInfo, { value: JSON.stringify(localParticipant) });
1445
+ conference.sendCommand(CONFERENCE_COMMANDS.userInfo, { value: JSON.stringify(localParticipant) });
1414
1446
  }
1415
1447
  });
1416
1448
 
@@ -1844,7 +1876,6 @@ const initialState$4 = {
1844
1876
  chatButtonUnreadCount: 0,
1845
1877
  enableNoiseReduction: true,
1846
1878
  sdkPlatform: SDK_PLATFORM.WEB,
1847
- webOSName: "unknown",
1848
1879
  isMobileBrowser: false,
1849
1880
  visibleParticipants: {
1850
1881
  startIndex: 0,
@@ -3580,6 +3611,9 @@ eventBus.subscribe(INTERNAL_EVENTS.lifecycle.componentDidMount, () => {
3580
3611
  });
3581
3612
  });
3582
3613
  useBaseStore.subscribe((state) => state.appState, (appState) => {
3614
+ if (!getIsConferenceJoined()) {
3615
+ return;
3616
+ }
3583
3617
  const sessionType = useConfigStore.getState().sessionType;
3584
3618
  if (sessionType !== SESSION_TYPE.VIDEO) {
3585
3619
  return;
@@ -5685,6 +5719,7 @@ const ControlPane = () => {
5685
5719
  }
5686
5720
  return /* @__PURE__ */ jsxs(View, {
5687
5721
  style: controlPaneStyles.controlPane,
5722
+ testID: "cometchat-control-panel",
5688
5723
  children: [
5689
5724
  /* @__PURE__ */ jsx(Audio_native_default, {}),
5690
5725
  /* @__PURE__ */ jsx(Video_native_default, {}),
@@ -6056,6 +6091,7 @@ const Header = () => {
6056
6091
  }
6057
6092
  return /* @__PURE__ */ jsxs(View, {
6058
6093
  style: styles$7.headerContainer,
6094
+ testID: "cometchat-header-panel",
6059
6095
  children: [/* @__PURE__ */ jsxs(View, {
6060
6096
  style: styles$7.meetingInfo,
6061
6097
  children: [title && /* @__PURE__ */ jsx(Text, {
@@ -6765,8 +6801,9 @@ function CallUI(props) {
6765
6801
  } else {
6766
6802
  useBaseStore.setState({ sdkPlatform: Platform.OS === "ios" ? "react-native-ios" : "react-native-android" });
6767
6803
  }
6804
+ useBaseStore.setState({ platformVersion: Platform.Version });
6768
6805
  startSession();
6769
- }, []);
6806
+ }, [props.sessionSettings.sdkPlatform]);
6770
6807
  useEffect(() => {
6771
6808
  const sub = AudioModeEventEmitter.addListener(AudioModeModule_default.DEVICE_CHANGE_EVENT, (e) => {
6772
6809
  console.log("AudioMode.DEVICE_CHANGE_EVENT", e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/calls-sdk-react-native",
3
- "version": "5.0.0-beta.10",
3
+ "version": "5.0.0-beta.12",
4
4
  "description": "CometChat Calls SDK for React Native provides voice and video calling capabilities for React Native applications.",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "promise.allsettled": "^1.0.7",
22
22
  "text-encoding": "^0.7.0",
23
23
  "valibot": "^1.2.0",
24
- "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1790.0.0+311766e3/lib-jitsi-meet.tgz",
24
+ "@cometchat/calls-lib-webrtc": "https://dl.cloudsmith.io/public/cometchat/call-team/raw/files/lib-jitsi-meet.tgz",
25
25
  "zustand": "^5.0.4"
26
26
  },
27
27
  "engines": {
@@ -1,29 +0,0 @@
1
- package com.cometchat.calls;
2
-
3
- import android.widget.Toast;
4
- import androidx.annotation.NonNull;
5
-
6
- import com.facebook.react.bridge.ReactApplicationContext;
7
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
8
- import com.facebook.react.bridge.ReactMethod;
9
-
10
- public class ToastModule extends ReactContextBaseJavaModule {
11
-
12
- private final ReactApplicationContext reactContext;
13
-
14
- public ToastModule(ReactApplicationContext reactContext) {
15
- super(reactContext);
16
- this.reactContext = reactContext;
17
- }
18
-
19
- @NonNull
20
- @Override
21
- public String getName() {
22
- return "ToastModule";
23
- }
24
-
25
- @ReactMethod
26
- public void showToast(String message) {
27
- Toast.makeText(reactContext, message, Toast.LENGTH_SHORT).show();
28
- }
29
- }