@cometchat/calls-sdk-react-native 5.0.0-beta.2 → 5.0.0-beta.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.
package/dist/index.js CHANGED
@@ -75,17 +75,24 @@ var EventBus = class {
75
75
  }
76
76
  }
77
77
  }
78
- subscribe(actionType, listener) {
78
+ subscribe(actionType, listener, options) {
79
+ if (options?.signal?.aborted) {
80
+ return () => {};
81
+ }
79
82
  if (!this.actionListenersMap.get(actionType)) {
80
83
  this.actionListenersMap.set(actionType, []);
81
84
  }
82
85
  this.actionListenersMap.get(actionType)?.push(listener);
83
- return () => {
86
+ const unsubscribe = () => {
84
87
  const listenersList = this.actionListenersMap.get(actionType);
85
88
  if (listenersList) {
86
89
  this.actionListenersMap.set(actionType, listenersList.filter((l) => l !== listener));
87
90
  }
88
91
  };
92
+ if (options?.signal) {
93
+ options.signal.addEventListener("abort", unsubscribe, { once: true });
94
+ }
95
+ return unsubscribe;
89
96
  }
90
97
  };
91
98
  const eventBus = new EventBus();
@@ -439,9 +446,9 @@ function getDefaultDevice(devices) {
439
446
 
440
447
  //#endregion
441
448
  //#region calls-sdk-core/utils/try-catch.ts
442
- async function tryCatch(promise) {
449
+ async function tryCatch(promise, timeoutMs) {
443
450
  try {
444
- const data = await promise;
451
+ const data = timeoutMs != null ? await Promise.race([promise, new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), timeoutMs))]) : await promise;
445
452
  return {
446
453
  data,
447
454
  error: null
@@ -516,18 +523,6 @@ var SessionMethodsCore = class {
516
523
  leaveSession();
517
524
  }
518
525
  /**
519
- * Starts sharing the user's screen with other participants.
520
- */
521
- static startScreenSharing() {
522
- startScreenSharing();
523
- }
524
- /**
525
- * Stops the ongoing screen sharing session.
526
- */
527
- static stopScreenSharing() {
528
- stopScreenSharing();
529
- }
530
- /**
531
526
  * Raises the user's virtual hand in the call.
532
527
  */
533
528
  static raiseHand() {
@@ -561,18 +556,6 @@ var SessionMethodsCore = class {
561
556
  */
562
557
  static stopRecording() {}
563
558
  /**
564
- * Enables Picture-in-Picture (PIP) layout during the call.
565
- */
566
- static enablePictureInPictureLayout() {
567
- enablePictureInPictureLayout();
568
- }
569
- /**
570
- * Disables Picture-in-Picture (PIP) layout.
571
- */
572
- static disablePictureInPictureLayout() {
573
- disablePictureInPictureLayout();
574
- }
575
- /**
576
559
  * Pins a participant's video to focus on them.
577
560
  * @param participantId - The ID of the participant to pin.
578
561
  * @param type - The type of the participant.
@@ -608,18 +591,6 @@ var SessionMethodsCore = class {
608
591
  setChatButtonUnreadCount(count);
609
592
  }
610
593
  /**
611
- * @deprecated use startScreenSharing() instead
612
- */
613
- static startScreenShare() {
614
- this.startScreenSharing();
615
- }
616
- /**
617
- * @deprecated use stopScreenSharing() instead
618
- */
619
- static stopScreenShare() {
620
- this.stopScreenSharing();
621
- }
622
- /**
623
594
  * @deprecated switchToVideoCall is deprecated and not supported.
624
595
  */
625
596
  static switchToVideoCall() {
@@ -710,6 +681,27 @@ async function createLocalTrack(type, deviceId = null, cameraFacing = CAMERA_FAC
710
681
  }
711
682
  }
712
683
  }
684
+ function createLocalTracks() {
685
+ const enableCompanionMode = useConfigStore.getState().enableCompanionMode;
686
+ if (!enableCompanionMode) {
687
+ const audioInputDeviceId = useConfigStore.getState().audioInputDeviceId ?? useBaseStore.getState().audioInputDevice?.deviceId;
688
+ createLocalTrack("audio", audioInputDeviceId);
689
+ }
690
+ const sessionType = useConfigStore.getState().sessionType;
691
+ if (sessionType === SESSION_TYPE.VIDEO) {
692
+ const videoInputDeviceIdP1 = useConfigStore.getState().videoInputDeviceId;
693
+ const videoInputDeviceIdP2 = useBaseStore.getState().videoInputDevice?.deviceId;
694
+ const initialCameraFacingP1 = useConfigStore.getState().initialCameraFacing;
695
+ const initialCameraFacingP2 = useBaseStore.getState().cameraFacing;
696
+ if (videoInputDeviceIdP1) {
697
+ createLocalTrack("video", videoInputDeviceIdP1);
698
+ } else if (initialCameraFacingP1) {
699
+ createLocalTrack("video", null, initialCameraFacingP2);
700
+ } else {
701
+ createLocalTrack("video", videoInputDeviceIdP2, initialCameraFacingP2);
702
+ }
703
+ }
704
+ }
713
705
  function updateAudioInputDevice(deviceId) {
714
706
  const audioInputDevices = useBaseStore.getState().audioInputDevices.filter((device) => device.deviceId !== "");
715
707
  if (audioInputDevices.length > 0) {
@@ -909,7 +901,6 @@ const initialState$7 = {
909
901
  hideLeaveSessionButton: false,
910
902
  hideToggleAudioButton: false,
911
903
  hideParticipantListButton: false,
912
- hideSwitchLayoutButton: false,
913
904
  hideChatButton: true,
914
905
  hideToggleVideoButton: false,
915
906
  hideScreenSharingButton: false,
@@ -926,7 +917,9 @@ const initialState$7 = {
926
917
  idleTimeoutPeriodAfterPrompt: 18e4,
927
918
  enableSpotlightDrag: true,
928
919
  enableSpotlightSwap: true,
929
- showFrameRate: false
920
+ showFrameRate: false,
921
+ enableCompanionMode: false,
922
+ isPeerCall: false
930
923
  };
931
924
  const useConfigStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$7, (set) => ({ reset: () => set(initialState$7) }))));
932
925
  const setConfig = (config) => {
@@ -1204,13 +1197,22 @@ const useConferenceStore = (0, zustand.create)()((0, zustand_middleware.subscrib
1204
1197
  leaveConference: async () => {
1205
1198
  const conference = useConferenceStore.getState().conference;
1206
1199
  if (conference) {
1207
- const { error } = await tryCatch(conference.leave());
1200
+ const { error } = await tryCatch(conference.leave(), 500);
1208
1201
  if (error) {
1209
1202
  console.warn("Error leaving conference:", error);
1210
1203
  eventBus.publish({ type: EVENT_LISTENER_METHODS.SessionStatusListener.onSessionLeft });
1211
1204
  }
1212
1205
  }
1213
1206
  },
1207
+ endConference: async () => {
1208
+ const conference = useConferenceStore.getState().conference;
1209
+ if (conference) {
1210
+ const { error } = await tryCatch(conference.end());
1211
+ if (error) {
1212
+ console.warn("Error ending conference:", error);
1213
+ }
1214
+ }
1215
+ },
1214
1216
  stopRecording: async () => {
1215
1217
  const conference = useConferenceStore.getState().conference;
1216
1218
  if (conference) {
@@ -2054,12 +2056,34 @@ const useConnectionStore = (0, zustand.create)()((0, zustand_middleware.subscrib
2054
2056
  },
2055
2057
  reset: () => set(initialState$2)
2056
2058
  }))));
2059
+ function waitForConnection() {
2060
+ const { connectionStatus } = useConnectionStore.getState();
2061
+ if (connectionStatus === "connected") return Promise.resolve();
2062
+ return new Promise((resolve, reject) => {
2063
+ const timeout = setTimeout(() => {
2064
+ unsub();
2065
+ reject(new Error("Connection timed out after 3 seconds"));
2066
+ }, 3e3);
2067
+ const unsub = useConnectionStore.subscribe((s) => s.connectionStatus, (status) => {
2068
+ if (status === "connected") {
2069
+ clearTimeout(timeout);
2070
+ unsub();
2071
+ resolve();
2072
+ } else if (status === "error") {
2073
+ clearTimeout(timeout);
2074
+ unsub();
2075
+ reject(useConnectionStore.getState().error);
2076
+ }
2077
+ });
2078
+ });
2079
+ }
2057
2080
 
2058
2081
  //#endregion
2059
2082
  //#region calls-sdk-core/store/utils/hooks.ts
2060
2083
  const useHideMuteAudioButton = () => {
2061
2084
  const hideMuteAudioButton = useConfigStore((state) => state.hideToggleAudioButton);
2062
- return hideMuteAudioButton;
2085
+ const enableCompanionMode = useConfigStore((state) => state.enableCompanionMode);
2086
+ return hideMuteAudioButton || enableCompanionMode;
2063
2087
  };
2064
2088
  const useHideToggleVideoButton = () => {
2065
2089
  const hideToggleVideoButton = useConfigStore((state) => state.hideToggleVideoButton);
@@ -2377,8 +2401,13 @@ var ConferenceListener = class {
2377
2401
  track.removeAllListeners(lib_jitsi_meet.default.events.track.NO_DATA_FROM_SOURCE);
2378
2402
  }
2379
2403
  onConferenceJoinInProgress() {}
2380
- onConferenceFailed(_conference, error, message) {
2381
- console.error("Conference failed:", error, message);
2404
+ onConferenceFailed(errorName, error, message) {
2405
+ console.log();
2406
+ if (errorName === lib_jitsi_meet.default.errors.conference.CONFERENCE_DESTROYED) {
2407
+ leaveSession({ forceLeave: true });
2408
+ return;
2409
+ }
2410
+ console.error("Conference failed:", errorName, error, message);
2382
2411
  useConferenceStore.setState({
2383
2412
  conferenceStatus: "error",
2384
2413
  conferenceJoined: false,
@@ -2578,17 +2607,23 @@ function addConferenceListeners(conference) {
2578
2607
  }
2579
2608
  });
2580
2609
  }
2581
- async function createConference(connection, roomName) {
2610
+ async function _createConference() {
2611
+ const sessionId = useConfigStore.getState().sessionId;
2612
+ const connection = useConnectionStore.getState().connection;
2582
2613
  if (!connection) {
2583
2614
  throw new Error("No connection available");
2584
2615
  }
2616
+ const connectionStatus = useConnectionStore.getState().connectionStatus;
2617
+ if (connectionStatus !== "connected") {
2618
+ await waitForConnection();
2619
+ }
2585
2620
  const existingConference = useConferenceStore.getState().conference;
2586
2621
  if (existingConference) {
2587
2622
  console.log("Conference already exists, skipping creation");
2588
2623
  return;
2589
2624
  }
2590
2625
  const connectionConfig = useConnectionStore.getState().connectionConfig;
2591
- const conference = connection.initJitsiConference(roomName, connectionConfig);
2626
+ const conference = connection.initJitsiConference(sessionId, connectionConfig);
2592
2627
  const localAudioTrack = getLocalTrack(MEDIA_TYPE.AUDIO)?.originalTrack;
2593
2628
  const localVideoTrack = getLocalTrack(MEDIA_TYPE.VIDEO)?.originalTrack;
2594
2629
  if (localAudioTrack) {
@@ -2603,6 +2638,20 @@ async function createConference(connection, roomName) {
2603
2638
  conference.setDisplayName(useParticipantStore.getState().localParticipant.name);
2604
2639
  conference.join();
2605
2640
  }
2641
+ async function createConference() {
2642
+ const conference = useConferenceStore.getState().conference;
2643
+ if (!conference) {
2644
+ const result = await tryCatch(_createConference());
2645
+ if (result.error) {
2646
+ console.error("Error creating conference", result.error);
2647
+ useConferenceStore.setState({
2648
+ conferenceStatus: "error",
2649
+ conferenceJoined: false,
2650
+ conferenceError: result.error.message
2651
+ });
2652
+ }
2653
+ }
2654
+ }
2606
2655
  function muteParticipant(participantId) {
2607
2656
  const conference = useConferenceStore.getState().conference;
2608
2657
  conference?.muteParticipant(participantId, "audio");
@@ -2614,7 +2663,12 @@ function pauseParticipantVideo(participantId) {
2614
2663
 
2615
2664
  //#endregion
2616
2665
  //#region calls-sdk-core/handlers/connection.ts
2617
- function connect(roomName) {
2666
+ async function connect(autoJoinConference = true) {
2667
+ const existingConnection = useConnectionStore.getState().connection;
2668
+ if (existingConnection) {
2669
+ createConference();
2670
+ return;
2671
+ }
2618
2672
  const options = useConnectionStore.getState().connectionConfig;
2619
2673
  const jwt = useConnectionStore.getState().jwt;
2620
2674
  const iAmRecorder = useConfigStore.getState().iAmRecorder;
@@ -2630,15 +2684,8 @@ function connect(roomName) {
2630
2684
  async function onConnectionEstablished() {
2631
2685
  useConnectionStore.getState().connectionEstablished(connection);
2632
2686
  eventBus.publish({ type: INTERNAL_EVENTS.onConnectionEstablished });
2633
- const result = await tryCatch(createConference(connection, roomName));
2634
- if (result.error) {
2635
- console.error("Error creating conference", result.error);
2636
- useConferenceStore.setState({
2637
- conferenceStatus: "error",
2638
- conferenceJoined: false,
2639
- conferenceError: result.error.message
2640
- });
2641
- }
2687
+ if (!autoJoinConference) return;
2688
+ createConference();
2642
2689
  }
2643
2690
  function onConnectionFailed(err, message, ...args) {
2644
2691
  unsubscribe();
@@ -2844,6 +2891,7 @@ function initializeLib() {
2844
2891
  let isSessionStarted = false;
2845
2892
  let reconnectTimeoutId = null;
2846
2893
  const RECONNECT_DEBOUNCE_DELAY = 3e3;
2894
+ initializeLib();
2847
2895
  function startSession() {
2848
2896
  const sessionId = useConfigStore.getState().sessionId;
2849
2897
  if (!sessionId) {
@@ -2856,29 +2904,13 @@ function startSession() {
2856
2904
  }
2857
2905
  isSessionStarted = true;
2858
2906
  console.log(`Session started in room: ${sessionId}`);
2859
- initializeLib();
2860
- const audioInputDeviceId = useConfigStore.getState().audioInputDeviceId ?? useBaseStore.getState().audioInputDevice?.deviceId;
2861
- createLocalTrack("audio", audioInputDeviceId);
2862
- const sessionType = useConfigStore.getState().sessionType;
2863
- if (sessionType === SESSION_TYPE.VIDEO) {
2864
- const videoInputDeviceIdP1 = useConfigStore.getState().videoInputDeviceId;
2865
- const videoInputDeviceIdP2 = useBaseStore.getState().videoInputDevice?.deviceId;
2866
- const initialCameraFacingP1 = useConfigStore.getState().initialCameraFacing;
2867
- const initialCameraFacingP2 = useBaseStore.getState().cameraFacing;
2868
- if (videoInputDeviceIdP1) {
2869
- createLocalTrack("video", videoInputDeviceIdP1);
2870
- } else if (initialCameraFacingP1) {
2871
- createLocalTrack("video", null, initialCameraFacingP2);
2872
- } else {
2873
- createLocalTrack("video", videoInputDeviceIdP2, initialCameraFacingP2);
2874
- }
2875
- }
2907
+ createLocalTracks();
2876
2908
  const audioOutputDeviceId = useConfigStore.getState().audioOutputDeviceId ?? useBaseStore.getState().audioOutputDevice?.deviceId;
2877
2909
  if (audioOutputDeviceId) {
2878
2910
  updateAudioOutputDevice(audioOutputDeviceId);
2879
2911
  }
2880
2912
  eventBus.startEmitting();
2881
- const test = tryCatchSync(() => connect(sessionId));
2913
+ const test = tryCatchSync(() => connect());
2882
2914
  if (test.error) {
2883
2915
  console.error("Error connecting to session:", test.error);
2884
2916
  useConnectionStore.getState().connectionFailed(test.error.message);
@@ -2895,8 +2927,14 @@ async function _leaveSession() {
2895
2927
  await useConnectionStore.getState().disconnect();
2896
2928
  }
2897
2929
  const sessionMutex = new Mutex();
2898
- function leaveSession() {
2930
+ function leaveSession(options = {}) {
2899
2931
  return sessionMutex.run(async () => {
2932
+ const isPeerCall = useConfigStore.getState().isPeerCall;
2933
+ const shouldEnd = isPeerCall && !options.forceLeave;
2934
+ if (shouldEnd) {
2935
+ useConferenceStore.getState().endConference();
2936
+ return;
2937
+ }
2900
2938
  useBaseStore.getState().clearIdealTimeoutTimer();
2901
2939
  cancelPendingReconnect();
2902
2940
  await _leaveSession();
@@ -3993,6 +4031,11 @@ const PopupMenu = ({ visible, onClose, options, anchorLayout }) => {
3993
4031
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Modal, {
3994
4032
  transparent: true,
3995
4033
  animationType: "none",
4034
+ supportedOrientations: [
4035
+ "portrait",
4036
+ "landscape-left",
4037
+ "landscape-right"
4038
+ ],
3996
4039
  onRequestClose: onClose,
3997
4040
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
3998
4041
  style: styles$27.backdrop,
@@ -5079,6 +5122,11 @@ function ConfirmationDialog() {
5079
5122
  visible,
5080
5123
  transparent: true,
5081
5124
  animationType: "fade",
5125
+ supportedOrientations: [
5126
+ "portrait",
5127
+ "landscape-left",
5128
+ "landscape-right"
5129
+ ],
5082
5130
  onRequestClose: handleBackdropPress,
5083
5131
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
5084
5132
  style: styles$15.backdrop,
@@ -5883,6 +5931,11 @@ const IdealTimeoutModal = ({ style = {} }) => {
5883
5931
  transparent: true,
5884
5932
  visible: idleTimeoutModalVisible,
5885
5933
  animationType: "none",
5934
+ supportedOrientations: [
5935
+ "portrait",
5936
+ "landscape-left",
5937
+ "landscape-right"
5938
+ ],
5886
5939
  statusBarTranslucent: true,
5887
5940
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.TouchableWithoutFeedback, {
5888
5941
  onPress: handleOverlayPress,
@@ -5935,7 +5988,7 @@ const IdealTimeoutModal = ({ style = {} }) => {
5935
5988
  })
5936
5989
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.TouchableOpacity, {
5937
5990
  style: [styles$6.button, styles$6.buttonPrimary],
5938
- onPress: leaveSession,
5991
+ onPress: () => leaveSession(),
5939
5992
  activeOpacity: .8,
5940
5993
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
5941
5994
  style: [commonStyles.bodyMedium, styles$6.buttonPrimaryText],
@@ -5964,6 +6017,7 @@ const styles$6 = react_native.StyleSheet.create({
5964
6017
  borderWidth: 1,
5965
6018
  borderColor: "#383838",
5966
6019
  width: "100%",
6020
+ maxWidth: 372,
5967
6021
  paddingTop: 32,
5968
6022
  paddingHorizontal: 20,
5969
6023
  paddingBottom: 20,
@@ -6505,11 +6559,11 @@ function CallUI(props) {
6505
6559
  const isConferenceJoined = useIsConferenceJoined();
6506
6560
  (0, react.useLayoutEffect)(() => {
6507
6561
  eventBus.publish({ type: INTERNAL_EVENTS.lifecycle.componentDidMount });
6508
- updateConfig(props.callSettings);
6562
+ updateConfig(props.sessionSettings);
6509
6563
  return () => {
6510
6564
  eventBus.publish({ type: INTERNAL_EVENTS.lifecycle.componentWillUnmount }, true);
6511
6565
  };
6512
- }, [props.callSettings]);
6566
+ }, [props.sessionSettings]);
6513
6567
  (0, react.useEffect)(() => {
6514
6568
  useBaseStore.setState({ sdkPlatform: react_native.Platform.OS });
6515
6569
  startSession();
@@ -6526,13 +6580,13 @@ function CallUI(props) {
6526
6580
  (0, react.useEffect)(() => {
6527
6581
  if (react_native.Platform.OS === "android") {
6528
6582
  AudioModeModule_default.setMode(type === SESSION_TYPE.VOICE ? AudioModeModule_default.AUDIO_CALL : AudioModeModule_default.VIDEO_CALL);
6529
- if (props.callSettings.audioMode) {
6530
- AudioModeModule_default.setAudioDevice(props.callSettings.audioMode);
6583
+ if (props.sessionSettings.audioMode) {
6584
+ AudioModeModule_default.setAudioDevice(props.sessionSettings.audioMode);
6531
6585
  }
6532
6586
  } else if (react_native.Platform.OS === "ios") {
6533
6587
  AudioModeModule_default.updateDeviceList();
6534
6588
  }
6535
- }, [props.callSettings.audioMode, type]);
6589
+ }, [props.sessionSettings.audioMode, type]);
6536
6590
  if (isPIPLayoutEnabled) {
6537
6591
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PiPTile_default, {});
6538
6592
  }
@@ -6824,8 +6878,8 @@ async function callVerifyTokenAPI({ appId, region, calltoken, baseURL }) {
6824
6878
  }
6825
6879
 
6826
6880
  //#endregion
6827
- //#region src/AppRN.tsx
6828
- function App(props) {
6881
+ //#region src/AppReactNativeSDK.tsx
6882
+ function AppReactNativeSDK(props) {
6829
6883
  const [internalSettings, setInternalSettings] = react.default.useState(null);
6830
6884
  const [infoMessage, setInfoMessage] = react.default.useState(null);
6831
6885
  (0, react.useEffect)(() => {
@@ -6837,7 +6891,7 @@ function App(props) {
6837
6891
  }, []);
6838
6892
  (0, react.useEffect)(() => {
6839
6893
  const listeners = [];
6840
- const cs = props.callSettings ?? {};
6894
+ const cs = props.sessionSettings ?? {};
6841
6895
  if (cs.listener?.onUserJoined) {
6842
6896
  listeners.push(CometChatCalls.addEventListener("onParticipantJoined", cs.listener.onUserJoined));
6843
6897
  }
@@ -6875,7 +6929,7 @@ function App(props) {
6875
6929
  listener();
6876
6930
  });
6877
6931
  };
6878
- }, [props.callSettings]);
6932
+ }, [props.sessionSettings]);
6879
6933
  (0, react.useEffect)(() => {
6880
6934
  callVerifyTokenAPI({
6881
6935
  appId: CometChatCalls.appSettings?.appId || "",
@@ -6904,14 +6958,12 @@ function App(props) {
6904
6958
  visible: true
6905
6959
  });
6906
6960
  }
6907
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(index_native_default, { callSettings: {
6908
- ...props.callSettings,
6909
- ...convertLegacyCallSettingsToV5Props(props?.callSettings ?? {}),
6961
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(index_native_default, { sessionSettings: {
6962
+ ...props.sessionSettings,
6963
+ ...convertLegacyCallSettingsToV5Props(props?.sessionSettings ?? {}),
6910
6964
  internalSettings
6911
6965
  } });
6912
6966
  }
6913
- var AppRN_default = App;
6914
- const AppComponent = App;
6915
6967
 
6916
6968
  //#endregion
6917
6969
  //#region src/v4/Constants.ts
@@ -10644,7 +10696,7 @@ var CometChatCalls = class extends SessionMethodsCore {
10644
10696
  static OngoingCallListener = OngoingCallListener;
10645
10697
  static CallSettingsBuilder = CallSettingsBuilder;
10646
10698
  static CallAppSettingsBuilder = CallAppSettingsBuilder;
10647
- static Component = AppComponent;
10699
+ static Component = AppReactNativeSDK;
10648
10700
  /**
10649
10701
  * Initializes the CometChat Calls SDK with the provided app settings.
10650
10702
  * Must be called before any other SDK methods.
@@ -10735,7 +10787,6 @@ var CometChatCalls = class extends SessionMethodsCore {
10735
10787
  if (this.loggedInUser && this.loggedInUser.uid !== uid) {
10736
10788
  await this.logoutInternal();
10737
10789
  }
10738
- console.log("Logging in user with UID:", uid);
10739
10790
  const authToken = await this.loginWithUID(uid, resolvedAuthKey);
10740
10791
  const user = await this.authenticateWithToken(authToken);
10741
10792
  this.loginInProgress = false;
@@ -11104,10 +11155,23 @@ var CometChatCalls = class extends SessionMethodsCore {
11104
11155
  * Adds an event listener for SDK events.
11105
11156
  * @param eventType - The type of event to listen for.
11106
11157
  * @param listener - The callback function to invoke when the event fires.
11158
+ * @param options - Optional configuration including an AbortSignal for automatic cleanup.
11107
11159
  * @returns An unsubscribe function to remove the listener.
11108
11160
  */
11109
- static addEventListener(eventType, listener) {
11110
- return eventBus.subscribe(eventType, listener);
11161
+ static addEventListener(eventType, listener, options) {
11162
+ return eventBus.subscribe(eventType, listener, options);
11163
+ }
11164
+ /**
11165
+ * Enables Picture-in-Picture (PIP) layout during the call.
11166
+ */
11167
+ static enablePictureInPictureLayout() {
11168
+ enablePictureInPictureLayout();
11169
+ }
11170
+ /**
11171
+ * Disables Picture-in-Picture (PIP) layout.
11172
+ */
11173
+ static disablePictureInPictureLayout() {
11174
+ disablePictureInPictureLayout();
11111
11175
  }
11112
11176
  };
11113
11177