@cometchat/calls-sdk-react-native 5.0.0-beta.6 → 5.0.0-beta.8

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.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- import * as zustand0 from "zustand";
2
+ import * as zustand7 from "zustand";
3
3
  import * as zustand_middleware0 from "zustand/middleware";
4
4
  import React from "react";
5
5
  import JitsiMeetJS from "lib-jitsi-meet";
@@ -373,7 +373,7 @@ type Actions$5 = {
373
373
  isMobileSDK: () => boolean;
374
374
  isMobile: () => boolean;
375
375
  };
376
- declare const useBaseStore: zustand0.UseBoundStore<Omit<Omit<zustand0.StoreApi<BaseState & Actions$5>, "subscribe"> & {
376
+ declare const useBaseStore: zustand7.UseBoundStore<Omit<Omit<zustand7.StoreApi<BaseState & Actions$5>, "subscribe"> & {
377
377
  subscribe: {
378
378
  (listener: (selectedState: BaseState & Actions$5, previousSelectedState: BaseState & Actions$5) => void): () => void;
379
379
  <U>(selector: (state: BaseState & Actions$5) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -453,7 +453,7 @@ type Actions$4 = {
453
453
  endConference: () => Promise<void>;
454
454
  stopRecording: () => Promise<void>;
455
455
  };
456
- declare const useConferenceStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
456
+ declare const useConferenceStore: zustand7.UseBoundStore<Omit<zustand7.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
457
457
  subscribe: {
458
458
  (listener: (selectedState: ConferenceState & Actions$4, previousSelectedState: ConferenceState & Actions$4) => void): () => void;
459
459
  <U>(selector: (state: ConferenceState & Actions$4) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -529,7 +529,7 @@ type ConfigState = ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & Co
529
529
  type Actions$3 = {
530
530
  reset: () => void;
531
531
  };
532
- declare const useConfigStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
532
+ declare const useConfigStore: zustand7.UseBoundStore<Omit<zustand7.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
533
533
  subscribe: {
534
534
  (listener: (selectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3, previousSelectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => void): () => void;
535
535
  <U>(selector: (state: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -681,7 +681,7 @@ type Actions$2 = {
681
681
  disconnect: () => Promise<void>;
682
682
  reset: () => void;
683
683
  };
684
- declare const useConnectionStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
684
+ declare const useConnectionStore: zustand7.UseBoundStore<Omit<zustand7.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
685
685
  subscribe: {
686
686
  (listener: (selectedState: ConnectionState & Actions$2, previousSelectedState: ConnectionState & Actions$2) => void): () => void;
687
687
  <U>(selector: (state: ConnectionState & Actions$2) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -732,7 +732,7 @@ type Actions$1 = {
732
732
  getParticipantById: (pid: string) => HumanParticipant | undefined;
733
733
  reset: () => void;
734
734
  };
735
- declare const useParticipantStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
735
+ declare const useParticipantStore: zustand7.UseBoundStore<Omit<zustand7.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
736
736
  subscribe: {
737
737
  (listener: (selectedState: ParticipantsState & Actions$1, previousSelectedState: ParticipantsState & Actions$1) => void): () => void;
738
738
  <U>(selector: (state: ParticipantsState & Actions$1) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -754,6 +754,38 @@ declare const getMainParticipantFromState: (state: {
754
754
  localParticipant: HumanParticipant;
755
755
  }) => Participant$2;
756
756
  //#endregion
757
+ //#region calls-sdk-core/store/toast.d.ts
758
+ interface ToastAction {
759
+ label: string;
760
+ onPress: () => void;
761
+ }
762
+ interface ToastItem {
763
+ id: string;
764
+ message: string;
765
+ type: NotificationType;
766
+ duration: number;
767
+ position: 'top' | 'bottom';
768
+ action?: ToastAction;
769
+ createdAt: number;
770
+ }
771
+ interface ToastState {
772
+ toasts: ToastItem[];
773
+ }
774
+ interface ToastActions {
775
+ addToast: (toast: Omit<ToastItem, 'id' | 'createdAt'>) => string;
776
+ removeToast: (id: string) => void;
777
+ clearAll: () => void;
778
+ reset: () => void;
779
+ }
780
+ declare const useToastStore: zustand7.UseBoundStore<zustand7.StoreApi<ToastState & ToastActions>>;
781
+ declare function showToast(params: {
782
+ message: string;
783
+ type?: NotificationType;
784
+ duration?: number;
785
+ position?: 'top' | 'bottom';
786
+ action?: ToastAction;
787
+ }): string;
788
+ //#endregion
757
789
  //#region calls-sdk-core/store/tracks.d.ts
758
790
  type Track = {
759
791
  local: boolean;
@@ -778,7 +810,7 @@ type Actions = {
778
810
  updateTrack: (originalTrack: any, updatedTrack: Partial<Track>) => void;
779
811
  updateLocalTrack: (mediaType: MediaType, updatedTrack: Partial<Track>) => void;
780
812
  };
781
- declare const useTracksStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<TracksState & Actions>, "subscribe"> & {
813
+ declare const useTracksStore: zustand7.UseBoundStore<Omit<zustand7.StoreApi<TracksState & Actions>, "subscribe"> & {
782
814
  subscribe: {
783
815
  (listener: (selectedState: TracksState & Actions, previousSelectedState: TracksState & Actions) => void): () => void;
784
816
  <U>(selector: (state: TracksState & Actions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -860,6 +892,11 @@ declare class SessionMethodsCore {
860
892
  * Local user leaves the current session.
861
893
  */
862
894
  static leaveSession(): void;
895
+ /**
896
+ * Ends the current session for all participants.
897
+ * This will terminate the conference and disconnect everyone.
898
+ */
899
+ static endSessionForAll(): void;
863
900
  /**
864
901
  * Raises the user's virtual hand in the call.
865
902
  */
@@ -1116,6 +1153,7 @@ declare function removeScreenShareParticipant(participantId: string): void;
1116
1153
  declare function startSession(): void;
1117
1154
  declare function leaveSession(options?: {
1118
1155
  forceLeave?: boolean;
1156
+ shouldEndSession?: boolean;
1119
1157
  }): Promise<void>;
1120
1158
  declare function leaveSessionDueToIdleTimeout(): Promise<void>;
1121
1159
  declare function reconnectSession(): Promise<void>;
@@ -1264,7 +1302,7 @@ interface TranslationState {
1264
1302
  translations: Record<string, typeof __json_default_export>;
1265
1303
  currentLocale: CometChatSupportedLocale | Omit<string, CometChatSupportedLocale>;
1266
1304
  }
1267
- declare const useTranslationStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1305
+ declare const useTranslationStore: zustand7.UseBoundStore<Omit<zustand7.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1268
1306
  reset: () => void;
1269
1307
  setLocale: (locale: CometChatSupportedLocale) => void;
1270
1308
  }>, "subscribe"> & {
@@ -2651,6 +2689,10 @@ declare class MainVideoContainerSetting {
2651
2689
  //#region src/AppReactNativeSDK.d.ts
2652
2690
  interface AppProps extends Partial<ConfigStateMobile & ConfigStateBoth> {
2653
2691
  callToken: string;
2692
+ /**
2693
+ * @deprecated Use `sessionSettings` instead.
2694
+ */
2695
+ callSettings?: CallSettings | Partial<ConfigStateMobile & ConfigStateBoth>;
2654
2696
  sessionSettings?: CallSettings | Partial<ConfigStateMobile & ConfigStateBoth>;
2655
2697
  }
2656
2698
  declare function AppReactNativeSDK(props: AppProps): React.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as zustand0 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
4
  import JitsiMeetJS from "lib-jitsi-meet";
@@ -373,7 +373,7 @@ type Actions$5 = {
373
373
  isMobileSDK: () => boolean;
374
374
  isMobile: () => boolean;
375
375
  };
376
- declare const useBaseStore: zustand0.UseBoundStore<Omit<Omit<zustand0.StoreApi<BaseState & Actions$5>, "subscribe"> & {
376
+ declare const useBaseStore: zustand3.UseBoundStore<Omit<Omit<zustand3.StoreApi<BaseState & Actions$5>, "subscribe"> & {
377
377
  subscribe: {
378
378
  (listener: (selectedState: BaseState & Actions$5, previousSelectedState: BaseState & Actions$5) => void): () => void;
379
379
  <U>(selector: (state: BaseState & Actions$5) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -453,7 +453,7 @@ type Actions$4 = {
453
453
  endConference: () => Promise<void>;
454
454
  stopRecording: () => Promise<void>;
455
455
  };
456
- declare const useConferenceStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
456
+ declare const useConferenceStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
457
457
  subscribe: {
458
458
  (listener: (selectedState: ConferenceState & Actions$4, previousSelectedState: ConferenceState & Actions$4) => void): () => void;
459
459
  <U>(selector: (state: ConferenceState & Actions$4) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -529,7 +529,7 @@ type ConfigState = ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & Co
529
529
  type Actions$3 = {
530
530
  reset: () => void;
531
531
  };
532
- declare const useConfigStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
532
+ declare const useConfigStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
533
533
  subscribe: {
534
534
  (listener: (selectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3, previousSelectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => void): () => void;
535
535
  <U>(selector: (state: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -681,7 +681,7 @@ type Actions$2 = {
681
681
  disconnect: () => Promise<void>;
682
682
  reset: () => void;
683
683
  };
684
- declare const useConnectionStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
684
+ declare const useConnectionStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
685
685
  subscribe: {
686
686
  (listener: (selectedState: ConnectionState & Actions$2, previousSelectedState: ConnectionState & Actions$2) => void): () => void;
687
687
  <U>(selector: (state: ConnectionState & Actions$2) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -732,7 +732,7 @@ type Actions$1 = {
732
732
  getParticipantById: (pid: string) => HumanParticipant | undefined;
733
733
  reset: () => void;
734
734
  };
735
- declare const useParticipantStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
735
+ declare const useParticipantStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
736
736
  subscribe: {
737
737
  (listener: (selectedState: ParticipantsState & Actions$1, previousSelectedState: ParticipantsState & Actions$1) => void): () => void;
738
738
  <U>(selector: (state: ParticipantsState & Actions$1) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -754,6 +754,38 @@ declare const getMainParticipantFromState: (state: {
754
754
  localParticipant: HumanParticipant;
755
755
  }) => Participant$2;
756
756
  //#endregion
757
+ //#region calls-sdk-core/store/toast.d.ts
758
+ interface ToastAction {
759
+ label: string;
760
+ onPress: () => void;
761
+ }
762
+ interface ToastItem {
763
+ id: string;
764
+ message: string;
765
+ type: NotificationType;
766
+ duration: number;
767
+ position: 'top' | 'bottom';
768
+ action?: ToastAction;
769
+ createdAt: number;
770
+ }
771
+ interface ToastState {
772
+ toasts: ToastItem[];
773
+ }
774
+ interface ToastActions {
775
+ addToast: (toast: Omit<ToastItem, 'id' | 'createdAt'>) => string;
776
+ removeToast: (id: string) => void;
777
+ clearAll: () => void;
778
+ reset: () => void;
779
+ }
780
+ declare const useToastStore: zustand3.UseBoundStore<zustand3.StoreApi<ToastState & ToastActions>>;
781
+ declare function showToast(params: {
782
+ message: string;
783
+ type?: NotificationType;
784
+ duration?: number;
785
+ position?: 'top' | 'bottom';
786
+ action?: ToastAction;
787
+ }): string;
788
+ //#endregion
757
789
  //#region calls-sdk-core/store/tracks.d.ts
758
790
  type Track = {
759
791
  local: boolean;
@@ -778,7 +810,7 @@ type Actions = {
778
810
  updateTrack: (originalTrack: any, updatedTrack: Partial<Track>) => void;
779
811
  updateLocalTrack: (mediaType: MediaType, updatedTrack: Partial<Track>) => void;
780
812
  };
781
- declare const useTracksStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<TracksState & Actions>, "subscribe"> & {
813
+ declare const useTracksStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<TracksState & Actions>, "subscribe"> & {
782
814
  subscribe: {
783
815
  (listener: (selectedState: TracksState & Actions, previousSelectedState: TracksState & Actions) => void): () => void;
784
816
  <U>(selector: (state: TracksState & Actions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -860,6 +892,11 @@ declare class SessionMethodsCore {
860
892
  * Local user leaves the current session.
861
893
  */
862
894
  static leaveSession(): void;
895
+ /**
896
+ * Ends the current session for all participants.
897
+ * This will terminate the conference and disconnect everyone.
898
+ */
899
+ static endSessionForAll(): void;
863
900
  /**
864
901
  * Raises the user's virtual hand in the call.
865
902
  */
@@ -1116,6 +1153,7 @@ declare function removeScreenShareParticipant(participantId: string): void;
1116
1153
  declare function startSession(): void;
1117
1154
  declare function leaveSession(options?: {
1118
1155
  forceLeave?: boolean;
1156
+ shouldEndSession?: boolean;
1119
1157
  }): Promise<void>;
1120
1158
  declare function leaveSessionDueToIdleTimeout(): Promise<void>;
1121
1159
  declare function reconnectSession(): Promise<void>;
@@ -1264,7 +1302,7 @@ interface TranslationState {
1264
1302
  translations: Record<string, typeof __json_default_export>;
1265
1303
  currentLocale: CometChatSupportedLocale | Omit<string, CometChatSupportedLocale>;
1266
1304
  }
1267
- declare const useTranslationStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1305
+ declare const useTranslationStore: zustand3.UseBoundStore<Omit<zustand3.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1268
1306
  reset: () => void;
1269
1307
  setLocale: (locale: CometChatSupportedLocale) => void;
1270
1308
  }>, "subscribe"> & {
@@ -2651,6 +2689,10 @@ declare class MainVideoContainerSetting {
2651
2689
  //#region src/AppReactNativeSDK.d.ts
2652
2690
  interface AppProps extends Partial<ConfigStateMobile & ConfigStateBoth> {
2653
2691
  callToken: string;
2692
+ /**
2693
+ * @deprecated Use `sessionSettings` instead.
2694
+ */
2695
+ callSettings?: CallSettings | Partial<ConfigStateMobile & ConfigStateBoth>;
2654
2696
  sessionSettings?: CallSettings | Partial<ConfigStateMobile & ConfigStateBoth>;
2655
2697
  }
2656
2698
  declare function AppReactNativeSDK(props: AppProps): React.JSX.Element;
package/dist/index.js CHANGED
@@ -566,6 +566,13 @@ var SessionMethodsCore = class {
566
566
  leaveSession();
567
567
  }
568
568
  /**
569
+ * Ends the current session for all participants.
570
+ * This will terminate the conference and disconnect everyone.
571
+ */
572
+ static endSessionForAll() {
573
+ leaveSession({ shouldEndSession: true });
574
+ }
575
+ /**
569
576
  * Raises the user's virtual hand in the call.
570
577
  */
571
578
  static raiseHand() {
@@ -962,7 +969,7 @@ function sendParticipantListChangedEvent() {
962
969
 
963
970
  //#endregion
964
971
  //#region calls-sdk-core/store/config.ts
965
- const initialState$7 = {
972
+ const initialState$8 = {
966
973
  sessionType: "VIDEO",
967
974
  autoStartRecording: false,
968
975
  layout: LAYOUT.TILE,
@@ -1000,7 +1007,7 @@ const initialState$7 = {
1000
1007
  enableCompanionMode: false,
1001
1008
  isPeerCall: false
1002
1009
  };
1003
- const useConfigStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$7, (set) => ({ reset: () => set(initialState$7) }))));
1010
+ const useConfigStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$8, (set) => ({ reset: () => set(initialState$8) }))));
1004
1011
  const setConfig = (config) => {
1005
1012
  useConfigStore.setState(config);
1006
1013
  };
@@ -1018,13 +1025,13 @@ const initialLocalParticipant = {
1018
1025
  type: "human",
1019
1026
  uid: "unknown"
1020
1027
  };
1021
- const initialState$6 = {
1028
+ const initialState$7 = {
1022
1029
  dominantSpeakers: [],
1023
1030
  localParticipant: initialLocalParticipant,
1024
1031
  participants: [],
1025
1032
  virtualParticipants: []
1026
1033
  };
1027
- const useParticipantStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$6, (set, get$1) => ({
1034
+ const useParticipantStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$7, (set, get$1) => ({
1028
1035
  addParticipant: (participant) => {
1029
1036
  set((state) => ({ participants: state.participants.some((p) => p.pid === participant.pid) ? state.participants.map((p) => p.pid === participant.pid ? {
1030
1037
  ...p,
@@ -1105,7 +1112,7 @@ const useParticipantStore = (0, zustand.create)()((0, zustand_middleware.subscri
1105
1112
  }
1106
1113
  return get$1().participants.find((p) => p.pid === pid);
1107
1114
  },
1108
- reset: () => set(initialState$6)
1115
+ reset: () => set(initialState$7)
1109
1116
  }))));
1110
1117
  function useAllParticipants() {
1111
1118
  const localParticipant = useParticipantStore((state) => state.localParticipant);
@@ -1239,7 +1246,7 @@ useParticipantStore.subscribe((state) => state.participants.filter((p) => p.uid)
1239
1246
 
1240
1247
  //#endregion
1241
1248
  //#region calls-sdk-core/store/conference.ts
1242
- const initialState$5 = {
1249
+ const initialState$6 = {
1243
1250
  conference: null,
1244
1251
  conferenceJoined: false,
1245
1252
  conferenceJoinedAt: null,
@@ -1254,7 +1261,7 @@ const initialState$5 = {
1254
1261
  },
1255
1262
  isRecording: false
1256
1263
  };
1257
- const useConferenceStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$5, (set) => ({
1264
+ const useConferenceStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$6, (set) => ({
1258
1265
  conferenceWillJoin: (conference) => {
1259
1266
  if (typeof window?.APP !== "undefined") {
1260
1267
  window.APP.conference._room = conference;
@@ -1265,7 +1272,7 @@ const useConferenceStore = (0, zustand.create)()((0, zustand_middleware.subscrib
1265
1272
  });
1266
1273
  },
1267
1274
  reset: () => {
1268
- set(initialState$5);
1275
+ set(initialState$6);
1269
1276
  },
1270
1277
  raiseHand: (participantId, timestamp) => {
1271
1278
  set((state) => ({ raiseHandMap: new Map(state.raiseHandMap).set(participantId, timestamp) }));
@@ -1439,7 +1446,7 @@ useConferenceStore.subscribe((state) => state.conference, (conference) => {
1439
1446
 
1440
1447
  //#endregion
1441
1448
  //#region calls-sdk-core/store/tracks.ts
1442
- const initialState$4 = {
1449
+ const initialState$5 = {
1443
1450
  tracks: [],
1444
1451
  permissions: {
1445
1452
  audio: false,
@@ -1447,9 +1454,9 @@ const initialState$4 = {
1447
1454
  initialized: false
1448
1455
  }
1449
1456
  };
1450
- const useTracksStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$4, (set, get$1) => ({
1457
+ const useTracksStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$5, (set, get$1) => ({
1451
1458
  reset: () => set({
1452
- ...initialState$4,
1459
+ ...initialState$5,
1453
1460
  permissions: get$1().permissions
1454
1461
  }),
1455
1462
  addTrack: (originalTrack) => set((state) => {
@@ -1831,7 +1838,7 @@ function updateConfig(config) {
1831
1838
 
1832
1839
  //#endregion
1833
1840
  //#region calls-sdk-core/store/base.ts
1834
- const initialState$3 = {
1841
+ const initialState$4 = {
1835
1842
  audioModeMenuVisible: false,
1836
1843
  audioModes: [],
1837
1844
  audioInputDevices: [],
@@ -1878,12 +1885,12 @@ const initialState$3 = {
1878
1885
  endIndex: 0
1879
1886
  }
1880
1887
  };
1881
- const useBaseStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.persist)((0, zustand_middleware.combine)(initialState$3, (set, get$1) => ({
1888
+ const useBaseStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.persist)((0, zustand_middleware.combine)(initialState$4, (set, get$1) => ({
1882
1889
  addSubscriptions: (subscriptions) => {
1883
1890
  useBaseStore.setState((state) => ({ subscriptions: [...state.subscriptions, ...subscriptions] }));
1884
1891
  },
1885
1892
  reset: () => set((state) => ({
1886
- ...initialState$3,
1893
+ ...initialState$4,
1887
1894
  audioInputDevice: state.audioInputDevice,
1888
1895
  audioOutputDevice: state.audioOutputDevice,
1889
1896
  videoInputDevice: state.videoInputDevice,
@@ -2118,13 +2125,13 @@ initBaseStoreSubscriptions();
2118
2125
 
2119
2126
  //#endregion
2120
2127
  //#region calls-sdk-core/store/connection.ts
2121
- const initialState$2 = {
2128
+ const initialState$3 = {
2122
2129
  connection: undefined,
2123
2130
  connectionStatus: "initial",
2124
2131
  error: undefined,
2125
2132
  timeEstablished: undefined
2126
2133
  };
2127
- const useConnectionStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$2, (set) => ({
2134
+ const useConnectionStore = (0, zustand.create)()((0, zustand_middleware.subscribeWithSelector)((0, zustand_middleware.combine)(initialState$3, (set) => ({
2128
2135
  connectionEstablished: (connection) => set({
2129
2136
  connection,
2130
2137
  connectionStatus: "connected",
@@ -2157,10 +2164,10 @@ const useConnectionStore = (0, zustand.create)()((0, zustand_middleware.subscrib
2157
2164
  eventBus.stopEmitting();
2158
2165
  await tryCatch(connection.disconnect());
2159
2166
  eventBus.publish({ type: EVENT_LISTENER_METHODS.SessionStatusListener.onConnectionClosed }, true);
2160
- set(initialState$2);
2167
+ set(initialState$3);
2161
2168
  }
2162
2169
  },
2163
- reset: () => set(initialState$2)
2170
+ reset: () => set(initialState$3)
2164
2171
  }))));
2165
2172
  function waitForConnection() {
2166
2173
  const { connectionStatus } = useConnectionStore.getState();
@@ -2184,6 +2191,52 @@ function waitForConnection() {
2184
2191
  });
2185
2192
  }
2186
2193
 
2194
+ //#endregion
2195
+ //#region calls-sdk-core/store/toast.ts
2196
+ const MAX_TOASTS = 3;
2197
+ const initialState$2 = { toasts: [] };
2198
+ let counter = 0;
2199
+ const useToastStore = (0, zustand.create)((set) => ({
2200
+ ...initialState$2,
2201
+ addToast: (toast) => {
2202
+ if (!getIsConferenceJoined()) {
2203
+ return "";
2204
+ }
2205
+ const id = `toast-${++counter}-${Date.now()}`;
2206
+ const newToast = {
2207
+ ...toast,
2208
+ id,
2209
+ createdAt: Date.now()
2210
+ };
2211
+ set((state) => {
2212
+ const updated = [...state.toasts, newToast];
2213
+ if (updated.length > MAX_TOASTS) {
2214
+ return { toasts: updated.slice(-MAX_TOASTS) };
2215
+ }
2216
+ return { toasts: updated };
2217
+ });
2218
+ return id;
2219
+ },
2220
+ removeToast: (id) => {
2221
+ set((state) => ({ toasts: state.toasts.filter((t) => t.id !== id) }));
2222
+ },
2223
+ clearAll: () => {
2224
+ set(initialState$2);
2225
+ },
2226
+ reset: () => {
2227
+ set(initialState$2);
2228
+ }
2229
+ }));
2230
+ function showToast(params) {
2231
+ return useToastStore.getState().addToast({
2232
+ message: params.message,
2233
+ type: params.type ?? "info",
2234
+ duration: params.duration ?? 3e3,
2235
+ position: params.position ?? "bottom",
2236
+ action: params.action
2237
+ });
2238
+ }
2239
+
2187
2240
  //#endregion
2188
2241
  //#region calls-sdk-core/store/utils/hooks.ts
2189
2242
  const useHideMuteAudioButton = () => {
@@ -2531,7 +2584,6 @@ var ConferenceListener = class {
2531
2584
  }
2532
2585
  onConferenceJoinInProgress() {}
2533
2586
  onConferenceFailed(errorName, error, message) {
2534
- console.log();
2535
2587
  if (errorName === lib_jitsi_meet.default.errors.conference.CONFERENCE_DESTROYED) {
2536
2588
  leaveSession({ forceLeave: true });
2537
2589
  return;
@@ -3003,6 +3055,7 @@ function resetAllStores() {
3003
3055
  useConfigStore.getState().reset();
3004
3056
  useConnectionStore.getState().reset();
3005
3057
  useParticipantStore.getState().reset();
3058
+ useToastStore.getState().reset();
3006
3059
  useTracksStore.getState().reset();
3007
3060
  }
3008
3061
 
@@ -3082,7 +3135,7 @@ const sessionMutex = new Mutex();
3082
3135
  function leaveSession(options = {}) {
3083
3136
  return sessionMutex.run(async () => {
3084
3137
  const isPeerCall = useConfigStore.getState().isPeerCall;
3085
- const shouldEnd = isPeerCall && !options.forceLeave;
3138
+ const shouldEnd = options.shouldEndSession || isPeerCall && !options.forceLeave;
3086
3139
  if (shouldEnd) {
3087
3140
  useConferenceStore.getState().endConference();
3088
3141
  return;
@@ -3994,6 +4047,13 @@ const commonStyles = react_native.StyleSheet.create({
3994
4047
  borderDefault: { borderColor: colors.border.default },
3995
4048
  borderDark: { borderColor: colors.border.dark },
3996
4049
  borderHighlight: { borderColor: colors.border.highlight },
4050
+ absoluteFill: {
4051
+ position: "absolute",
4052
+ top: 0,
4053
+ bottom: 0,
4054
+ left: 0,
4055
+ right: 0
4056
+ },
3997
4057
  flex1: { flex: 1 },
3998
4058
  flexRow: { flexDirection: "row" },
3999
4059
  flexColumn: { flexDirection: "column" },
@@ -4515,7 +4575,11 @@ const VideoNative = ({ videoTrack, style, objectFit = "cover", mirror = false, m
4515
4575
  return null;
4516
4576
  }
4517
4577
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Animated.View, {
4518
- style: [styles$25.videoContainer, { opacity: fadeAnim }],
4578
+ style: [
4579
+ commonStyles.absoluteFill,
4580
+ styles$25.videoContainer,
4581
+ { opacity: fadeAnim }
4582
+ ],
4519
4583
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_webrtc.RTCView, {
4520
4584
  streamURL: streamURL.toURL(),
4521
4585
  style: [styles$25.video, style],
@@ -4528,8 +4592,7 @@ const VideoNative = ({ videoTrack, style, objectFit = "cover", mirror = false, m
4528
4592
  const styles$25 = react_native.StyleSheet.create({
4529
4593
  videoContainer: {
4530
4594
  height: "100%",
4531
- width: "100%",
4532
- ...react_native.StyleSheet.absoluteFillObject
4595
+ width: "100%"
4533
4596
  },
4534
4597
  video: {
4535
4598
  width: "100%",
@@ -5003,7 +5066,11 @@ function ProcessingOverlay({ message, visible = true, animated = false }) {
5003
5066
  return null;
5004
5067
  }
5005
5068
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Animated.View, {
5006
- style: [styles$18.overlay, { opacity }],
5069
+ style: [
5070
+ commonStyles.absoluteFill,
5071
+ styles$18.overlay,
5072
+ { opacity }
5073
+ ],
5007
5074
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ActivityIndicator, {
5008
5075
  size: "large",
5009
5076
  color: "#fff"
@@ -5015,7 +5082,6 @@ function ProcessingOverlay({ message, visible = true, animated = false }) {
5015
5082
  }
5016
5083
  const styles$18 = react_native.StyleSheet.create({
5017
5084
  overlay: {
5018
- ...react_native.StyleSheet.absoluteFillObject,
5019
5085
  justifyContent: "center",
5020
5086
  alignItems: "center",
5021
5087
  backgroundColor: "#1A1A1A",
@@ -5193,7 +5259,6 @@ function showConfirmationDialog(title, description, confirmText, cancelText, onC
5193
5259
  const { width } = react_native.Dimensions.get("window");
5194
5260
  const styles$15 = react_native.StyleSheet.create({
5195
5261
  backdrop: {
5196
- ...react_native.StyleSheet.absoluteFillObject,
5197
5262
  backgroundColor: "rgba(0, 0, 0, 0.8)",
5198
5263
  justifyContent: "center",
5199
5264
  alignItems: "center",
@@ -5292,7 +5357,7 @@ function ConfirmationDialog() {
5292
5357
  ],
5293
5358
  onRequestClose: handleBackdropPress,
5294
5359
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
5295
- style: styles$15.backdrop,
5360
+ style: [commonStyles.absoluteFill, styles$15.backdrop],
5296
5361
  onPress: handleBackdropPress,
5297
5362
  testID: "cometchat-confirmation-dialog-backdrop",
5298
5363
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
@@ -5364,7 +5429,7 @@ const BottomSheet = ({ children, isVisible, onClose, maxHeight = SCREEN_HEIGHT *
5364
5429
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [isVisible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.TouchableWithoutFeedback, {
5365
5430
  onPress: onClose,
5366
5431
  testID: "cometchat-bottom-sheet-backdrop",
5367
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: styles$14.backdrop })
5432
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [commonStyles.absoluteFill, styles$14.backdrop] })
5368
5433
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Animated.View, {
5369
5434
  testID,
5370
5435
  style: [
@@ -5380,7 +5445,6 @@ const BottomSheet = ({ children, isVisible, onClose, maxHeight = SCREEN_HEIGHT *
5380
5445
  };
5381
5446
  const styles$14 = react_native.StyleSheet.create({
5382
5447
  backdrop: {
5383
- ...react_native.StyleSheet.absoluteFillObject,
5384
5448
  backgroundColor: "rgba(0,0,0,0.5)",
5385
5449
  zIndex: 1
5386
5450
  },
@@ -5773,14 +5837,15 @@ const FullScreenDialog = ({ children, visible = false }) => {
5773
5837
  return null;
5774
5838
  }
5775
5839
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Animated.View, {
5776
- style: [styles$10.container, { opacity: fadeAnim }],
5840
+ style: [
5841
+ commonStyles.absoluteFill,
5842
+ styles$10.container,
5843
+ { opacity: fadeAnim }
5844
+ ],
5777
5845
  children
5778
5846
  });
5779
5847
  };
5780
- const styles$10 = react_native.StyleSheet.create({ container: {
5781
- ...react_native.StyleSheet.absoluteFillObject,
5782
- zIndex: 1e3
5783
- } });
5848
+ const styles$10 = react_native.StyleSheet.create({ container: { zIndex: 1e3 } });
5784
5849
  var FullScreenDialog_native_default = FullScreenDialog;
5785
5850
 
5786
5851
  //#endregion
@@ -6585,45 +6650,6 @@ const styles$2 = react_native.StyleSheet.create({
6585
6650
  }
6586
6651
  });
6587
6652
 
6588
- //#endregion
6589
- //#region src/ui/toast/toast-state.ts
6590
- const MAX_TOASTS = 3;
6591
- let counter = 0;
6592
- const useToastStore = (0, zustand.create)((set) => ({
6593
- toasts: [],
6594
- addToast: (toast) => {
6595
- const id = `toast-${++counter}-${Date.now()}`;
6596
- const newToast = {
6597
- ...toast,
6598
- id,
6599
- createdAt: Date.now()
6600
- };
6601
- set((state) => {
6602
- const updated = [...state.toasts, newToast];
6603
- if (updated.length > MAX_TOASTS) {
6604
- return { toasts: updated.slice(-MAX_TOASTS) };
6605
- }
6606
- return { toasts: updated };
6607
- });
6608
- return id;
6609
- },
6610
- removeToast: (id) => {
6611
- set((state) => ({ toasts: state.toasts.filter((t) => t.id !== id) }));
6612
- },
6613
- clearAll: () => {
6614
- set({ toasts: [] });
6615
- }
6616
- }));
6617
- function showToast(params) {
6618
- return useToastStore.getState().addToast({
6619
- message: params.message,
6620
- type: params.type ?? "info",
6621
- duration: params.duration ?? 3e3,
6622
- position: params.position ?? "bottom",
6623
- action: params.action
6624
- });
6625
- }
6626
-
6627
6653
  //#endregion
6628
6654
  //#region src/ui/toast/Toast.native.tsx
6629
6655
  const SLIDE_IN_DURATION = 300;
@@ -6829,13 +6855,6 @@ const styles$1 = react_native.StyleSheet.create({
6829
6855
  alignItems: "center",
6830
6856
  gap: GRID_GAP,
6831
6857
  paddingHorizontal: 20
6832
- },
6833
- loadingContainer: {
6834
- ...react_native.StyleSheet.absoluteFillObject,
6835
- justifyContent: "center",
6836
- alignItems: "center",
6837
- backgroundColor: "#000",
6838
- zIndex: 1e3
6839
6858
  }
6840
6859
  });
6841
6860
  var index_native_default = CallUI;
@@ -7078,6 +7097,7 @@ async function callVerifyTokenAPI({ appId, region, calltoken, baseURL }) {
7078
7097
  function AppReactNativeSDK(props) {
7079
7098
  const [internalSettings, setInternalSettings] = react.default.useState(null);
7080
7099
  const [infoMessage, setInfoMessage] = react.default.useState(null);
7100
+ const sessionSettings = props.sessionSettings ?? props.callSettings ?? {};
7081
7101
  (0, react.useEffect)(() => {
7082
7102
  return eventBus.subscribe("onConnectionClosed", () => {
7083
7103
  setTimeout(() => {
@@ -7087,7 +7107,7 @@ function AppReactNativeSDK(props) {
7087
7107
  }, []);
7088
7108
  (0, react.useEffect)(() => {
7089
7109
  const listeners = [];
7090
- const cs = props.sessionSettings ?? {};
7110
+ const cs = sessionSettings ?? {};
7091
7111
  if (cs.listener?.onUserJoined) {
7092
7112
  listeners.push(CometChatCalls.addEventListener("onParticipantJoined", cs.listener.onUserJoined));
7093
7113
  }
@@ -7125,7 +7145,7 @@ function AppReactNativeSDK(props) {
7125
7145
  listener();
7126
7146
  });
7127
7147
  };
7128
- }, [props.sessionSettings]);
7148
+ }, [sessionSettings]);
7129
7149
  (0, react.useEffect)(() => {
7130
7150
  callVerifyTokenAPI({
7131
7151
  appId: CometChatCalls.appSettings?.appId || "",
@@ -7155,8 +7175,8 @@ function AppReactNativeSDK(props) {
7155
7175
  });
7156
7176
  }
7157
7177
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(index_native_default, { sessionSettings: {
7158
- ...props.sessionSettings,
7159
- ...convertLegacyCallSettingsToV5Props(props?.sessionSettings ?? {}),
7178
+ ...sessionSettings,
7179
+ ...convertLegacyCallSettingsToV5Props(sessionSettings ?? {}),
7160
7180
  internalSettings
7161
7181
  } });
7162
7182
  }
package/dist/index.mjs CHANGED
@@ -534,6 +534,13 @@ var SessionMethodsCore = class {
534
534
  leaveSession();
535
535
  }
536
536
  /**
537
+ * Ends the current session for all participants.
538
+ * This will terminate the conference and disconnect everyone.
539
+ */
540
+ static endSessionForAll() {
541
+ leaveSession({ shouldEndSession: true });
542
+ }
543
+ /**
537
544
  * Raises the user's virtual hand in the call.
538
545
  */
539
546
  static raiseHand() {
@@ -930,7 +937,7 @@ function sendParticipantListChangedEvent() {
930
937
 
931
938
  //#endregion
932
939
  //#region calls-sdk-core/store/config.ts
933
- const initialState$7 = {
940
+ const initialState$8 = {
934
941
  sessionType: "VIDEO",
935
942
  autoStartRecording: false,
936
943
  layout: LAYOUT.TILE,
@@ -968,7 +975,7 @@ const initialState$7 = {
968
975
  enableCompanionMode: false,
969
976
  isPeerCall: false
970
977
  };
971
- const useConfigStore = create()(subscribeWithSelector(combine(initialState$7, (set) => ({ reset: () => set(initialState$7) }))));
978
+ const useConfigStore = create()(subscribeWithSelector(combine(initialState$8, (set) => ({ reset: () => set(initialState$8) }))));
972
979
  const setConfig = (config) => {
973
980
  useConfigStore.setState(config);
974
981
  };
@@ -986,13 +993,13 @@ const initialLocalParticipant = {
986
993
  type: "human",
987
994
  uid: "unknown"
988
995
  };
989
- const initialState$6 = {
996
+ const initialState$7 = {
990
997
  dominantSpeakers: [],
991
998
  localParticipant: initialLocalParticipant,
992
999
  participants: [],
993
1000
  virtualParticipants: []
994
1001
  };
995
- const useParticipantStore = create()(subscribeWithSelector(combine(initialState$6, (set, get$1) => ({
1002
+ const useParticipantStore = create()(subscribeWithSelector(combine(initialState$7, (set, get$1) => ({
996
1003
  addParticipant: (participant) => {
997
1004
  set((state) => ({ participants: state.participants.some((p) => p.pid === participant.pid) ? state.participants.map((p) => p.pid === participant.pid ? {
998
1005
  ...p,
@@ -1073,7 +1080,7 @@ const useParticipantStore = create()(subscribeWithSelector(combine(initialState$
1073
1080
  }
1074
1081
  return get$1().participants.find((p) => p.pid === pid);
1075
1082
  },
1076
- reset: () => set(initialState$6)
1083
+ reset: () => set(initialState$7)
1077
1084
  }))));
1078
1085
  function useAllParticipants() {
1079
1086
  const localParticipant = useParticipantStore((state) => state.localParticipant);
@@ -1207,7 +1214,7 @@ useParticipantStore.subscribe((state) => state.participants.filter((p) => p.uid)
1207
1214
 
1208
1215
  //#endregion
1209
1216
  //#region calls-sdk-core/store/conference.ts
1210
- const initialState$5 = {
1217
+ const initialState$6 = {
1211
1218
  conference: null,
1212
1219
  conferenceJoined: false,
1213
1220
  conferenceJoinedAt: null,
@@ -1222,7 +1229,7 @@ const initialState$5 = {
1222
1229
  },
1223
1230
  isRecording: false
1224
1231
  };
1225
- const useConferenceStore = create()(subscribeWithSelector(combine(initialState$5, (set) => ({
1232
+ const useConferenceStore = create()(subscribeWithSelector(combine(initialState$6, (set) => ({
1226
1233
  conferenceWillJoin: (conference) => {
1227
1234
  if (typeof window?.APP !== "undefined") {
1228
1235
  window.APP.conference._room = conference;
@@ -1233,7 +1240,7 @@ const useConferenceStore = create()(subscribeWithSelector(combine(initialState$5
1233
1240
  });
1234
1241
  },
1235
1242
  reset: () => {
1236
- set(initialState$5);
1243
+ set(initialState$6);
1237
1244
  },
1238
1245
  raiseHand: (participantId, timestamp) => {
1239
1246
  set((state) => ({ raiseHandMap: new Map(state.raiseHandMap).set(participantId, timestamp) }));
@@ -1407,7 +1414,7 @@ useConferenceStore.subscribe((state) => state.conference, (conference) => {
1407
1414
 
1408
1415
  //#endregion
1409
1416
  //#region calls-sdk-core/store/tracks.ts
1410
- const initialState$4 = {
1417
+ const initialState$5 = {
1411
1418
  tracks: [],
1412
1419
  permissions: {
1413
1420
  audio: false,
@@ -1415,9 +1422,9 @@ const initialState$4 = {
1415
1422
  initialized: false
1416
1423
  }
1417
1424
  };
1418
- const useTracksStore = create()(subscribeWithSelector(combine(initialState$4, (set, get$1) => ({
1425
+ const useTracksStore = create()(subscribeWithSelector(combine(initialState$5, (set, get$1) => ({
1419
1426
  reset: () => set({
1420
- ...initialState$4,
1427
+ ...initialState$5,
1421
1428
  permissions: get$1().permissions
1422
1429
  }),
1423
1430
  addTrack: (originalTrack) => set((state) => {
@@ -1799,7 +1806,7 @@ function updateConfig(config) {
1799
1806
 
1800
1807
  //#endregion
1801
1808
  //#region calls-sdk-core/store/base.ts
1802
- const initialState$3 = {
1809
+ const initialState$4 = {
1803
1810
  audioModeMenuVisible: false,
1804
1811
  audioModes: [],
1805
1812
  audioInputDevices: [],
@@ -1846,12 +1853,12 @@ const initialState$3 = {
1846
1853
  endIndex: 0
1847
1854
  }
1848
1855
  };
1849
- const useBaseStore = create()(subscribeWithSelector(persist(combine(initialState$3, (set, get$1) => ({
1856
+ const useBaseStore = create()(subscribeWithSelector(persist(combine(initialState$4, (set, get$1) => ({
1850
1857
  addSubscriptions: (subscriptions) => {
1851
1858
  useBaseStore.setState((state) => ({ subscriptions: [...state.subscriptions, ...subscriptions] }));
1852
1859
  },
1853
1860
  reset: () => set((state) => ({
1854
- ...initialState$3,
1861
+ ...initialState$4,
1855
1862
  audioInputDevice: state.audioInputDevice,
1856
1863
  audioOutputDevice: state.audioOutputDevice,
1857
1864
  videoInputDevice: state.videoInputDevice,
@@ -2086,13 +2093,13 @@ initBaseStoreSubscriptions();
2086
2093
 
2087
2094
  //#endregion
2088
2095
  //#region calls-sdk-core/store/connection.ts
2089
- const initialState$2 = {
2096
+ const initialState$3 = {
2090
2097
  connection: undefined,
2091
2098
  connectionStatus: "initial",
2092
2099
  error: undefined,
2093
2100
  timeEstablished: undefined
2094
2101
  };
2095
- const useConnectionStore = create()(subscribeWithSelector(combine(initialState$2, (set) => ({
2102
+ const useConnectionStore = create()(subscribeWithSelector(combine(initialState$3, (set) => ({
2096
2103
  connectionEstablished: (connection) => set({
2097
2104
  connection,
2098
2105
  connectionStatus: "connected",
@@ -2125,10 +2132,10 @@ const useConnectionStore = create()(subscribeWithSelector(combine(initialState$2
2125
2132
  eventBus.stopEmitting();
2126
2133
  await tryCatch(connection.disconnect());
2127
2134
  eventBus.publish({ type: EVENT_LISTENER_METHODS.SessionStatusListener.onConnectionClosed }, true);
2128
- set(initialState$2);
2135
+ set(initialState$3);
2129
2136
  }
2130
2137
  },
2131
- reset: () => set(initialState$2)
2138
+ reset: () => set(initialState$3)
2132
2139
  }))));
2133
2140
  function waitForConnection() {
2134
2141
  const { connectionStatus } = useConnectionStore.getState();
@@ -2152,6 +2159,52 @@ function waitForConnection() {
2152
2159
  });
2153
2160
  }
2154
2161
 
2162
+ //#endregion
2163
+ //#region calls-sdk-core/store/toast.ts
2164
+ const MAX_TOASTS = 3;
2165
+ const initialState$2 = { toasts: [] };
2166
+ let counter = 0;
2167
+ const useToastStore = create((set) => ({
2168
+ ...initialState$2,
2169
+ addToast: (toast) => {
2170
+ if (!getIsConferenceJoined()) {
2171
+ return "";
2172
+ }
2173
+ const id = `toast-${++counter}-${Date.now()}`;
2174
+ const newToast = {
2175
+ ...toast,
2176
+ id,
2177
+ createdAt: Date.now()
2178
+ };
2179
+ set((state) => {
2180
+ const updated = [...state.toasts, newToast];
2181
+ if (updated.length > MAX_TOASTS) {
2182
+ return { toasts: updated.slice(-MAX_TOASTS) };
2183
+ }
2184
+ return { toasts: updated };
2185
+ });
2186
+ return id;
2187
+ },
2188
+ removeToast: (id) => {
2189
+ set((state) => ({ toasts: state.toasts.filter((t) => t.id !== id) }));
2190
+ },
2191
+ clearAll: () => {
2192
+ set(initialState$2);
2193
+ },
2194
+ reset: () => {
2195
+ set(initialState$2);
2196
+ }
2197
+ }));
2198
+ function showToast(params) {
2199
+ return useToastStore.getState().addToast({
2200
+ message: params.message,
2201
+ type: params.type ?? "info",
2202
+ duration: params.duration ?? 3e3,
2203
+ position: params.position ?? "bottom",
2204
+ action: params.action
2205
+ });
2206
+ }
2207
+
2155
2208
  //#endregion
2156
2209
  //#region calls-sdk-core/store/utils/hooks.ts
2157
2210
  const useHideMuteAudioButton = () => {
@@ -2499,7 +2552,6 @@ var ConferenceListener = class {
2499
2552
  }
2500
2553
  onConferenceJoinInProgress() {}
2501
2554
  onConferenceFailed(errorName, error, message) {
2502
- console.log();
2503
2555
  if (errorName === JitsiMeetJS.errors.conference.CONFERENCE_DESTROYED) {
2504
2556
  leaveSession({ forceLeave: true });
2505
2557
  return;
@@ -2971,6 +3023,7 @@ function resetAllStores() {
2971
3023
  useConfigStore.getState().reset();
2972
3024
  useConnectionStore.getState().reset();
2973
3025
  useParticipantStore.getState().reset();
3026
+ useToastStore.getState().reset();
2974
3027
  useTracksStore.getState().reset();
2975
3028
  }
2976
3029
 
@@ -3050,7 +3103,7 @@ const sessionMutex = new Mutex();
3050
3103
  function leaveSession(options = {}) {
3051
3104
  return sessionMutex.run(async () => {
3052
3105
  const isPeerCall = useConfigStore.getState().isPeerCall;
3053
- const shouldEnd = isPeerCall && !options.forceLeave;
3106
+ const shouldEnd = options.shouldEndSession || isPeerCall && !options.forceLeave;
3054
3107
  if (shouldEnd) {
3055
3108
  useConferenceStore.getState().endConference();
3056
3109
  return;
@@ -3962,6 +4015,13 @@ const commonStyles = StyleSheet.create({
3962
4015
  borderDefault: { borderColor: colors.border.default },
3963
4016
  borderDark: { borderColor: colors.border.dark },
3964
4017
  borderHighlight: { borderColor: colors.border.highlight },
4018
+ absoluteFill: {
4019
+ position: "absolute",
4020
+ top: 0,
4021
+ bottom: 0,
4022
+ left: 0,
4023
+ right: 0
4024
+ },
3965
4025
  flex1: { flex: 1 },
3966
4026
  flexRow: { flexDirection: "row" },
3967
4027
  flexColumn: { flexDirection: "column" },
@@ -4483,7 +4543,11 @@ const VideoNative = ({ videoTrack, style, objectFit = "cover", mirror = false, m
4483
4543
  return null;
4484
4544
  }
4485
4545
  return /* @__PURE__ */ jsx(Animated.View, {
4486
- style: [styles$25.videoContainer, { opacity: fadeAnim }],
4546
+ style: [
4547
+ commonStyles.absoluteFill,
4548
+ styles$25.videoContainer,
4549
+ { opacity: fadeAnim }
4550
+ ],
4487
4551
  children: /* @__PURE__ */ jsx(RTCView, {
4488
4552
  streamURL: streamURL.toURL(),
4489
4553
  style: [styles$25.video, style],
@@ -4496,8 +4560,7 @@ const VideoNative = ({ videoTrack, style, objectFit = "cover", mirror = false, m
4496
4560
  const styles$25 = StyleSheet.create({
4497
4561
  videoContainer: {
4498
4562
  height: "100%",
4499
- width: "100%",
4500
- ...StyleSheet.absoluteFillObject
4563
+ width: "100%"
4501
4564
  },
4502
4565
  video: {
4503
4566
  width: "100%",
@@ -4971,7 +5034,11 @@ function ProcessingOverlay({ message, visible = true, animated = false }) {
4971
5034
  return null;
4972
5035
  }
4973
5036
  return /* @__PURE__ */ jsxs(Animated.View, {
4974
- style: [styles$18.overlay, { opacity }],
5037
+ style: [
5038
+ commonStyles.absoluteFill,
5039
+ styles$18.overlay,
5040
+ { opacity }
5041
+ ],
4975
5042
  children: [/* @__PURE__ */ jsx(ActivityIndicator, {
4976
5043
  size: "large",
4977
5044
  color: "#fff"
@@ -4983,7 +5050,6 @@ function ProcessingOverlay({ message, visible = true, animated = false }) {
4983
5050
  }
4984
5051
  const styles$18 = StyleSheet.create({
4985
5052
  overlay: {
4986
- ...StyleSheet.absoluteFillObject,
4987
5053
  justifyContent: "center",
4988
5054
  alignItems: "center",
4989
5055
  backgroundColor: "#1A1A1A",
@@ -5161,7 +5227,6 @@ function showConfirmationDialog(title, description, confirmText, cancelText, onC
5161
5227
  const { width } = Dimensions.get("window");
5162
5228
  const styles$15 = StyleSheet.create({
5163
5229
  backdrop: {
5164
- ...StyleSheet.absoluteFillObject,
5165
5230
  backgroundColor: "rgba(0, 0, 0, 0.8)",
5166
5231
  justifyContent: "center",
5167
5232
  alignItems: "center",
@@ -5260,7 +5325,7 @@ function ConfirmationDialog() {
5260
5325
  ],
5261
5326
  onRequestClose: handleBackdropPress,
5262
5327
  children: /* @__PURE__ */ jsx(Pressable, {
5263
- style: styles$15.backdrop,
5328
+ style: [commonStyles.absoluteFill, styles$15.backdrop],
5264
5329
  onPress: handleBackdropPress,
5265
5330
  testID: "cometchat-confirmation-dialog-backdrop",
5266
5331
  children: /* @__PURE__ */ jsx(View, {
@@ -5332,7 +5397,7 @@ const BottomSheet = ({ children, isVisible, onClose, maxHeight = SCREEN_HEIGHT *
5332
5397
  return /* @__PURE__ */ jsxs(Fragment, { children: [isVisible && /* @__PURE__ */ jsx(TouchableWithoutFeedback, {
5333
5398
  onPress: onClose,
5334
5399
  testID: "cometchat-bottom-sheet-backdrop",
5335
- children: /* @__PURE__ */ jsx(View, { style: styles$14.backdrop })
5400
+ children: /* @__PURE__ */ jsx(View, { style: [commonStyles.absoluteFill, styles$14.backdrop] })
5336
5401
  }), /* @__PURE__ */ jsxs(Animated.View, {
5337
5402
  testID,
5338
5403
  style: [
@@ -5348,7 +5413,6 @@ const BottomSheet = ({ children, isVisible, onClose, maxHeight = SCREEN_HEIGHT *
5348
5413
  };
5349
5414
  const styles$14 = StyleSheet.create({
5350
5415
  backdrop: {
5351
- ...StyleSheet.absoluteFillObject,
5352
5416
  backgroundColor: "rgba(0,0,0,0.5)",
5353
5417
  zIndex: 1
5354
5418
  },
@@ -5741,14 +5805,15 @@ const FullScreenDialog = ({ children, visible = false }) => {
5741
5805
  return null;
5742
5806
  }
5743
5807
  return /* @__PURE__ */ jsx(Animated.View, {
5744
- style: [styles$10.container, { opacity: fadeAnim }],
5808
+ style: [
5809
+ commonStyles.absoluteFill,
5810
+ styles$10.container,
5811
+ { opacity: fadeAnim }
5812
+ ],
5745
5813
  children
5746
5814
  });
5747
5815
  };
5748
- const styles$10 = StyleSheet.create({ container: {
5749
- ...StyleSheet.absoluteFillObject,
5750
- zIndex: 1e3
5751
- } });
5816
+ const styles$10 = StyleSheet.create({ container: { zIndex: 1e3 } });
5752
5817
  var FullScreenDialog_native_default = FullScreenDialog;
5753
5818
 
5754
5819
  //#endregion
@@ -6553,45 +6618,6 @@ const styles$2 = StyleSheet.create({
6553
6618
  }
6554
6619
  });
6555
6620
 
6556
- //#endregion
6557
- //#region src/ui/toast/toast-state.ts
6558
- const MAX_TOASTS = 3;
6559
- let counter = 0;
6560
- const useToastStore = create((set) => ({
6561
- toasts: [],
6562
- addToast: (toast) => {
6563
- const id = `toast-${++counter}-${Date.now()}`;
6564
- const newToast = {
6565
- ...toast,
6566
- id,
6567
- createdAt: Date.now()
6568
- };
6569
- set((state) => {
6570
- const updated = [...state.toasts, newToast];
6571
- if (updated.length > MAX_TOASTS) {
6572
- return { toasts: updated.slice(-MAX_TOASTS) };
6573
- }
6574
- return { toasts: updated };
6575
- });
6576
- return id;
6577
- },
6578
- removeToast: (id) => {
6579
- set((state) => ({ toasts: state.toasts.filter((t) => t.id !== id) }));
6580
- },
6581
- clearAll: () => {
6582
- set({ toasts: [] });
6583
- }
6584
- }));
6585
- function showToast(params) {
6586
- return useToastStore.getState().addToast({
6587
- message: params.message,
6588
- type: params.type ?? "info",
6589
- duration: params.duration ?? 3e3,
6590
- position: params.position ?? "bottom",
6591
- action: params.action
6592
- });
6593
- }
6594
-
6595
6621
  //#endregion
6596
6622
  //#region src/ui/toast/Toast.native.tsx
6597
6623
  const SLIDE_IN_DURATION = 300;
@@ -6797,13 +6823,6 @@ const styles$1 = StyleSheet.create({
6797
6823
  alignItems: "center",
6798
6824
  gap: GRID_GAP,
6799
6825
  paddingHorizontal: 20
6800
- },
6801
- loadingContainer: {
6802
- ...StyleSheet.absoluteFillObject,
6803
- justifyContent: "center",
6804
- alignItems: "center",
6805
- backgroundColor: "#000",
6806
- zIndex: 1e3
6807
6826
  }
6808
6827
  });
6809
6828
  var index_native_default = CallUI;
@@ -7046,6 +7065,7 @@ async function callVerifyTokenAPI({ appId, region, calltoken, baseURL }) {
7046
7065
  function AppReactNativeSDK(props) {
7047
7066
  const [internalSettings, setInternalSettings] = React.useState(null);
7048
7067
  const [infoMessage, setInfoMessage] = React.useState(null);
7068
+ const sessionSettings = props.sessionSettings ?? props.callSettings ?? {};
7049
7069
  useEffect(() => {
7050
7070
  return eventBus.subscribe("onConnectionClosed", () => {
7051
7071
  setTimeout(() => {
@@ -7055,7 +7075,7 @@ function AppReactNativeSDK(props) {
7055
7075
  }, []);
7056
7076
  useEffect(() => {
7057
7077
  const listeners = [];
7058
- const cs = props.sessionSettings ?? {};
7078
+ const cs = sessionSettings ?? {};
7059
7079
  if (cs.listener?.onUserJoined) {
7060
7080
  listeners.push(CometChatCalls.addEventListener("onParticipantJoined", cs.listener.onUserJoined));
7061
7081
  }
@@ -7093,7 +7113,7 @@ function AppReactNativeSDK(props) {
7093
7113
  listener();
7094
7114
  });
7095
7115
  };
7096
- }, [props.sessionSettings]);
7116
+ }, [sessionSettings]);
7097
7117
  useEffect(() => {
7098
7118
  callVerifyTokenAPI({
7099
7119
  appId: CometChatCalls.appSettings?.appId || "",
@@ -7123,8 +7143,8 @@ function AppReactNativeSDK(props) {
7123
7143
  });
7124
7144
  }
7125
7145
  return /* @__PURE__ */ jsx(index_native_default, { sessionSettings: {
7126
- ...props.sessionSettings,
7127
- ...convertLegacyCallSettingsToV5Props(props?.sessionSettings ?? {}),
7146
+ ...sessionSettings,
7147
+ ...convertLegacyCallSettingsToV5Props(sessionSettings ?? {}),
7128
7148
  internalSettings
7129
7149
  } });
7130
7150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/calls-sdk-react-native",
3
- "version": "5.0.0-beta.6",
3
+ "version": "5.0.0-beta.8",
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",