@cometchat/calls-sdk-react-native 5.0.0-beta.6 → 5.0.0-beta.7
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 +18 -8
- package/dist/index.d.ts +10 -0
- package/dist/index.js +13 -6
- package/dist/index.mjs +13 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import * as
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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?: {
|
|
@@ -778,7 +778,7 @@ type Actions = {
|
|
|
778
778
|
updateTrack: (originalTrack: any, updatedTrack: Partial<Track>) => void;
|
|
779
779
|
updateLocalTrack: (mediaType: MediaType, updatedTrack: Partial<Track>) => void;
|
|
780
780
|
};
|
|
781
|
-
declare const useTracksStore:
|
|
781
|
+
declare const useTracksStore: zustand7.UseBoundStore<Omit<zustand7.StoreApi<TracksState & Actions>, "subscribe"> & {
|
|
782
782
|
subscribe: {
|
|
783
783
|
(listener: (selectedState: TracksState & Actions, previousSelectedState: TracksState & Actions) => void): () => void;
|
|
784
784
|
<U>(selector: (state: TracksState & Actions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
@@ -860,6 +860,11 @@ declare class SessionMethodsCore {
|
|
|
860
860
|
* Local user leaves the current session.
|
|
861
861
|
*/
|
|
862
862
|
static leaveSession(): void;
|
|
863
|
+
/**
|
|
864
|
+
* Ends the current session for all participants.
|
|
865
|
+
* This will terminate the conference and disconnect everyone.
|
|
866
|
+
*/
|
|
867
|
+
static endSessionForAll(): void;
|
|
863
868
|
/**
|
|
864
869
|
* Raises the user's virtual hand in the call.
|
|
865
870
|
*/
|
|
@@ -1116,6 +1121,7 @@ declare function removeScreenShareParticipant(participantId: string): void;
|
|
|
1116
1121
|
declare function startSession(): void;
|
|
1117
1122
|
declare function leaveSession(options?: {
|
|
1118
1123
|
forceLeave?: boolean;
|
|
1124
|
+
shouldEndSession?: boolean;
|
|
1119
1125
|
}): Promise<void>;
|
|
1120
1126
|
declare function leaveSessionDueToIdleTimeout(): Promise<void>;
|
|
1121
1127
|
declare function reconnectSession(): Promise<void>;
|
|
@@ -1264,7 +1270,7 @@ interface TranslationState {
|
|
|
1264
1270
|
translations: Record<string, typeof __json_default_export>;
|
|
1265
1271
|
currentLocale: CometChatSupportedLocale | Omit<string, CometChatSupportedLocale>;
|
|
1266
1272
|
}
|
|
1267
|
-
declare const useTranslationStore:
|
|
1273
|
+
declare const useTranslationStore: zustand7.UseBoundStore<Omit<zustand7.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
|
|
1268
1274
|
reset: () => void;
|
|
1269
1275
|
setLocale: (locale: CometChatSupportedLocale) => void;
|
|
1270
1276
|
}>, "subscribe"> & {
|
|
@@ -2651,6 +2657,10 @@ declare class MainVideoContainerSetting {
|
|
|
2651
2657
|
//#region src/AppReactNativeSDK.d.ts
|
|
2652
2658
|
interface AppProps extends Partial<ConfigStateMobile & ConfigStateBoth> {
|
|
2653
2659
|
callToken: string;
|
|
2660
|
+
/**
|
|
2661
|
+
* @deprecated Use `sessionSettings` instead.
|
|
2662
|
+
*/
|
|
2663
|
+
callSettings: CallSettings | Partial<ConfigStateMobile & ConfigStateBoth>;
|
|
2654
2664
|
sessionSettings?: CallSettings | Partial<ConfigStateMobile & ConfigStateBoth>;
|
|
2655
2665
|
}
|
|
2656
2666
|
declare function AppReactNativeSDK(props: AppProps): React.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -860,6 +860,11 @@ declare class SessionMethodsCore {
|
|
|
860
860
|
* Local user leaves the current session.
|
|
861
861
|
*/
|
|
862
862
|
static leaveSession(): void;
|
|
863
|
+
/**
|
|
864
|
+
* Ends the current session for all participants.
|
|
865
|
+
* This will terminate the conference and disconnect everyone.
|
|
866
|
+
*/
|
|
867
|
+
static endSessionForAll(): void;
|
|
863
868
|
/**
|
|
864
869
|
* Raises the user's virtual hand in the call.
|
|
865
870
|
*/
|
|
@@ -1116,6 +1121,7 @@ declare function removeScreenShareParticipant(participantId: string): void;
|
|
|
1116
1121
|
declare function startSession(): void;
|
|
1117
1122
|
declare function leaveSession(options?: {
|
|
1118
1123
|
forceLeave?: boolean;
|
|
1124
|
+
shouldEndSession?: boolean;
|
|
1119
1125
|
}): Promise<void>;
|
|
1120
1126
|
declare function leaveSessionDueToIdleTimeout(): Promise<void>;
|
|
1121
1127
|
declare function reconnectSession(): Promise<void>;
|
|
@@ -2651,6 +2657,10 @@ declare class MainVideoContainerSetting {
|
|
|
2651
2657
|
//#region src/AppReactNativeSDK.d.ts
|
|
2652
2658
|
interface AppProps extends Partial<ConfigStateMobile & ConfigStateBoth> {
|
|
2653
2659
|
callToken: string;
|
|
2660
|
+
/**
|
|
2661
|
+
* @deprecated Use `sessionSettings` instead.
|
|
2662
|
+
*/
|
|
2663
|
+
callSettings: CallSettings | Partial<ConfigStateMobile & ConfigStateBoth>;
|
|
2654
2664
|
sessionSettings?: CallSettings | Partial<ConfigStateMobile & ConfigStateBoth>;
|
|
2655
2665
|
}
|
|
2656
2666
|
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() {
|
|
@@ -2531,7 +2538,6 @@ var ConferenceListener = class {
|
|
|
2531
2538
|
}
|
|
2532
2539
|
onConferenceJoinInProgress() {}
|
|
2533
2540
|
onConferenceFailed(errorName, error, message) {
|
|
2534
|
-
console.log();
|
|
2535
2541
|
if (errorName === lib_jitsi_meet.default.errors.conference.CONFERENCE_DESTROYED) {
|
|
2536
2542
|
leaveSession({ forceLeave: true });
|
|
2537
2543
|
return;
|
|
@@ -3082,7 +3088,7 @@ const sessionMutex = new Mutex();
|
|
|
3082
3088
|
function leaveSession(options = {}) {
|
|
3083
3089
|
return sessionMutex.run(async () => {
|
|
3084
3090
|
const isPeerCall = useConfigStore.getState().isPeerCall;
|
|
3085
|
-
const shouldEnd = isPeerCall && !options.forceLeave;
|
|
3091
|
+
const shouldEnd = options.shouldEndSession || isPeerCall && !options.forceLeave;
|
|
3086
3092
|
if (shouldEnd) {
|
|
3087
3093
|
useConferenceStore.getState().endConference();
|
|
3088
3094
|
return;
|
|
@@ -7078,6 +7084,7 @@ async function callVerifyTokenAPI({ appId, region, calltoken, baseURL }) {
|
|
|
7078
7084
|
function AppReactNativeSDK(props) {
|
|
7079
7085
|
const [internalSettings, setInternalSettings] = react.default.useState(null);
|
|
7080
7086
|
const [infoMessage, setInfoMessage] = react.default.useState(null);
|
|
7087
|
+
const sessionSettings = props.sessionSettings ?? props.callSettings ?? {};
|
|
7081
7088
|
(0, react.useEffect)(() => {
|
|
7082
7089
|
return eventBus.subscribe("onConnectionClosed", () => {
|
|
7083
7090
|
setTimeout(() => {
|
|
@@ -7087,7 +7094,7 @@ function AppReactNativeSDK(props) {
|
|
|
7087
7094
|
}, []);
|
|
7088
7095
|
(0, react.useEffect)(() => {
|
|
7089
7096
|
const listeners = [];
|
|
7090
|
-
const cs =
|
|
7097
|
+
const cs = sessionSettings ?? {};
|
|
7091
7098
|
if (cs.listener?.onUserJoined) {
|
|
7092
7099
|
listeners.push(CometChatCalls.addEventListener("onParticipantJoined", cs.listener.onUserJoined));
|
|
7093
7100
|
}
|
|
@@ -7125,7 +7132,7 @@ function AppReactNativeSDK(props) {
|
|
|
7125
7132
|
listener();
|
|
7126
7133
|
});
|
|
7127
7134
|
};
|
|
7128
|
-
}, [
|
|
7135
|
+
}, [sessionSettings]);
|
|
7129
7136
|
(0, react.useEffect)(() => {
|
|
7130
7137
|
callVerifyTokenAPI({
|
|
7131
7138
|
appId: CometChatCalls.appSettings?.appId || "",
|
|
@@ -7155,8 +7162,8 @@ function AppReactNativeSDK(props) {
|
|
|
7155
7162
|
});
|
|
7156
7163
|
}
|
|
7157
7164
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(index_native_default, { sessionSettings: {
|
|
7158
|
-
...
|
|
7159
|
-
...convertLegacyCallSettingsToV5Props(
|
|
7165
|
+
...sessionSettings,
|
|
7166
|
+
...convertLegacyCallSettingsToV5Props(sessionSettings ?? {}),
|
|
7160
7167
|
internalSettings
|
|
7161
7168
|
} });
|
|
7162
7169
|
}
|
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() {
|
|
@@ -2499,7 +2506,6 @@ var ConferenceListener = class {
|
|
|
2499
2506
|
}
|
|
2500
2507
|
onConferenceJoinInProgress() {}
|
|
2501
2508
|
onConferenceFailed(errorName, error, message) {
|
|
2502
|
-
console.log();
|
|
2503
2509
|
if (errorName === JitsiMeetJS.errors.conference.CONFERENCE_DESTROYED) {
|
|
2504
2510
|
leaveSession({ forceLeave: true });
|
|
2505
2511
|
return;
|
|
@@ -3050,7 +3056,7 @@ const sessionMutex = new Mutex();
|
|
|
3050
3056
|
function leaveSession(options = {}) {
|
|
3051
3057
|
return sessionMutex.run(async () => {
|
|
3052
3058
|
const isPeerCall = useConfigStore.getState().isPeerCall;
|
|
3053
|
-
const shouldEnd = isPeerCall && !options.forceLeave;
|
|
3059
|
+
const shouldEnd = options.shouldEndSession || isPeerCall && !options.forceLeave;
|
|
3054
3060
|
if (shouldEnd) {
|
|
3055
3061
|
useConferenceStore.getState().endConference();
|
|
3056
3062
|
return;
|
|
@@ -7046,6 +7052,7 @@ async function callVerifyTokenAPI({ appId, region, calltoken, baseURL }) {
|
|
|
7046
7052
|
function AppReactNativeSDK(props) {
|
|
7047
7053
|
const [internalSettings, setInternalSettings] = React.useState(null);
|
|
7048
7054
|
const [infoMessage, setInfoMessage] = React.useState(null);
|
|
7055
|
+
const sessionSettings = props.sessionSettings ?? props.callSettings ?? {};
|
|
7049
7056
|
useEffect(() => {
|
|
7050
7057
|
return eventBus.subscribe("onConnectionClosed", () => {
|
|
7051
7058
|
setTimeout(() => {
|
|
@@ -7055,7 +7062,7 @@ function AppReactNativeSDK(props) {
|
|
|
7055
7062
|
}, []);
|
|
7056
7063
|
useEffect(() => {
|
|
7057
7064
|
const listeners = [];
|
|
7058
|
-
const cs =
|
|
7065
|
+
const cs = sessionSettings ?? {};
|
|
7059
7066
|
if (cs.listener?.onUserJoined) {
|
|
7060
7067
|
listeners.push(CometChatCalls.addEventListener("onParticipantJoined", cs.listener.onUserJoined));
|
|
7061
7068
|
}
|
|
@@ -7093,7 +7100,7 @@ function AppReactNativeSDK(props) {
|
|
|
7093
7100
|
listener();
|
|
7094
7101
|
});
|
|
7095
7102
|
};
|
|
7096
|
-
}, [
|
|
7103
|
+
}, [sessionSettings]);
|
|
7097
7104
|
useEffect(() => {
|
|
7098
7105
|
callVerifyTokenAPI({
|
|
7099
7106
|
appId: CometChatCalls.appSettings?.appId || "",
|
|
@@ -7123,8 +7130,8 @@ function AppReactNativeSDK(props) {
|
|
|
7123
7130
|
});
|
|
7124
7131
|
}
|
|
7125
7132
|
return /* @__PURE__ */ jsx(index_native_default, { sessionSettings: {
|
|
7126
|
-
...
|
|
7127
|
-
...convertLegacyCallSettingsToV5Props(
|
|
7133
|
+
...sessionSettings,
|
|
7134
|
+
...convertLegacyCallSettingsToV5Props(sessionSettings ?? {}),
|
|
7128
7135
|
internalSettings
|
|
7129
7136
|
} });
|
|
7130
7137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cometchat/calls-sdk-react-native",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.7",
|
|
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",
|