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

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.
@@ -0,0 +1,20 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'cometchat-calls-sdk-react-native'
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+ s.platforms = { :ios => '13.0' }
13
+ s.source = { :git => 'https://github.com/cometchat/calls-sdk-react-native.git', :tag => s.version }
14
+
15
+ s.source_files = 'ios/**/*.{h,m}'
16
+
17
+ s.dependency 'React-Core'
18
+ s.dependency 'react-native-webrtc'
19
+ s.frameworks = 'AVFoundation', 'UIKit'
20
+ end
package/dist/index.d.mts CHANGED
@@ -804,25 +804,91 @@ declare const switchCamera: () => void;
804
804
  //#endregion
805
805
  //#region calls-sdk-core/utils/session-methods-core.d.ts
806
806
  declare class SessionMethodsCore {
807
+ /**
808
+ * Mutes the local user's audio during the call.
809
+ */
807
810
  static muteAudio(): void;
811
+ /**
812
+ * Unmutes the local user's audio during the call.
813
+ */
808
814
  static unmuteAudio(): void;
815
+ /**
816
+ * Pauses the local user's video stream.
817
+ */
809
818
  static pauseVideo(): void;
819
+ /**
820
+ * Resumes the local user's video stream.
821
+ */
810
822
  static resumeVideo(): void;
823
+ /**
824
+ * Local user leaves the current session.
825
+ */
811
826
  static leaveSession(): void;
827
+ /**
828
+ * Starts sharing the user's screen with other participants.
829
+ */
812
830
  static startScreenSharing(): void;
831
+ /**
832
+ * Stops the ongoing screen sharing session.
833
+ */
813
834
  static stopScreenSharing(): void;
835
+ /**
836
+ * Raises the user's virtual hand in the call.
837
+ */
814
838
  static raiseHand(): void;
839
+ /**
840
+ * Lowers the user's virtual hand in the call.
841
+ */
815
842
  static lowerHand(): void;
843
+ /**
844
+ * Switches between the front and rear camera.
845
+ */
816
846
  static switchCamera(): void;
847
+ /**
848
+ * Sets the layout type for the call.
849
+ * @param layout - The type of layout to set (tile, sidebar or spotlight).
850
+ */
817
851
  static setLayout(layout: Layout): void;
852
+ /**
853
+ * Starts recording the call.
854
+ */
818
855
  static startRecording(): void;
856
+ /**
857
+ * Stops the ongoing call recording.
858
+ */
819
859
  static stopRecording(): void;
860
+ /**
861
+ * Enables Picture-in-Picture (PIP) layout during the call.
862
+ */
820
863
  static enablePictureInPictureLayout(): void;
864
+ /**
865
+ * Disables Picture-in-Picture (PIP) layout.
866
+ */
821
867
  static disablePictureInPictureLayout(): void;
868
+ /**
869
+ * Pins a participant's video to focus on them.
870
+ * @param participantId - The ID of the participant to pin.
871
+ * @param type - The type of the participant.
872
+ */
822
873
  static pinParticipant(participantId: string, type: Participant$2['type']): void;
874
+ /**
875
+ * Unpins a participant's video.
876
+ */
823
877
  static unpinParticipant(): void;
878
+ /**
879
+ * Mutes the audio of a specific participant.
880
+ * @param participantId - The ID of the participant to mute.
881
+ */
824
882
  static muteParticipant(participantId: string): void;
883
+ /**
884
+ * Pauses the video stream of a specific participant.
885
+ * @param participantId - The ID of the participant whose video to pause.
886
+ */
825
887
  static pauseParticipantVideo(participantId: string): void;
888
+ /**
889
+ * Sets the unread message count displayed on the chat button.
890
+ * @param count - The number of unread messages.
891
+ */
826
892
  static setChatButtonUnreadCount(count: number): void;
827
893
  /**
828
894
  * @deprecated use startScreenSharing() instead
@@ -833,7 +899,7 @@ declare class SessionMethodsCore {
833
899
  */
834
900
  static stopScreenShare(): void;
835
901
  /**
836
- * @deprecated switchToVideoCall is deprecated and not supported
902
+ * @deprecated switchToVideoCall is deprecated and not supported.
837
903
  */
838
904
  static switchToVideoCall(): void;
839
905
  /**
@@ -3896,6 +3962,12 @@ declare class CometChatCalls extends SessionMethodsCore {
3896
3962
  static CallSettingsBuilder: typeof CallSettingsBuilder;
3897
3963
  static CallAppSettingsBuilder: typeof CallAppSettingsBuilder;
3898
3964
  static Component: typeof App;
3965
+ /**
3966
+ * Initializes the CometChat Calls SDK with the provided app settings.
3967
+ * Must be called before any other SDK methods.
3968
+ * @param appSettings - The application settings for configuring the SDK.
3969
+ * @returns An object indicating success or failure with error details.
3970
+ */
3899
3971
  static init(appSettings: CallAppSettings | CallAppSettings$1): Promise<{
3900
3972
  readonly success: false;
3901
3973
  readonly error: {
@@ -3907,14 +3979,62 @@ declare class CometChatCalls extends SessionMethodsCore {
3907
3979
  readonly success: true;
3908
3980
  readonly error: null;
3909
3981
  }>;
3982
+ /**
3983
+ * Logs in a user with their UID and an optional auth key.
3984
+ * If no auth key is provided, the one from app settings is used.
3985
+ * @param uid - The unique identifier of the user.
3986
+ * @param authKey - The authentication key. Falls back to the key provided in app settings.
3987
+ * @returns A Promise that resolves to the logged-in User object.
3988
+ * @throws {CometChatException} If login fails or validation errors occur.
3989
+ */
3910
3990
  static login(uid: string, authKey?: string): Promise<User>;
3991
+ /**
3992
+ * Logs in a user directly with an auth token.
3993
+ * @param authToken - The authentication token for the user.
3994
+ * @returns A Promise that resolves to the logged-in User object.
3995
+ * @throws {CometChatException} If login fails or the token is invalid.
3996
+ */
3911
3997
  static loginWithAuthToken(authToken: string): Promise<User>;
3998
+ /**
3999
+ * Logs out the currently logged-in user and clears local session data.
4000
+ * @returns A Promise that resolves to a success message string.
4001
+ * @throws {CometChatException} If no user is logged in or logout fails.
4002
+ */
3912
4003
  static logout(): Promise<string>;
4004
+ /**
4005
+ * Retrieves the currently logged-in user.
4006
+ * @returns The logged-in User object, or null if no user is logged in.
4007
+ */
3913
4008
  static getLoggedInUser(): User | null;
4009
+ /**
4010
+ * Retrieves the auth token of the currently logged-in user.
4011
+ * @returns The auth token string, or null if no user is logged in.
4012
+ */
3914
4013
  static getUserAuthToken(): string | null;
4014
+ /**
4015
+ * Checks whether a user is currently logged in.
4016
+ * @returns True if a user is logged in with a valid auth token, false otherwise.
4017
+ */
3915
4018
  static isUserLoggedIn(): boolean;
4019
+ /**
4020
+ * Registers a login listener to receive login/logout lifecycle callbacks.
4021
+ * @param listenerId - A unique identifier for the listener.
4022
+ * @param listener - The listener object with callback methods.
4023
+ */
3916
4024
  static addLoginListener(listenerId: string, listener: LoginListener): void;
4025
+ /**
4026
+ * Removes a previously registered login listener.
4027
+ * @param listenerId - The unique identifier of the listener to remove.
4028
+ */
3917
4029
  static removeLoginListener(listenerId: string): void;
4030
+ /**
4031
+ * Generates a call token for the given session.
4032
+ * Uses the provided auth token or falls back to the logged-in user's token.
4033
+ * @param sessionId - The session ID to generate a token for.
4034
+ * @param authToken - Optional auth token. If omitted, the logged-in user's token is used.
4035
+ * @returns A Promise that resolves to an object containing the generated token.
4036
+ * @throws {CometChatException} If the session ID is missing, no auth token is available, or the SDK is not initialized.
4037
+ */
3918
4038
  static generateToken(sessionId: string, authToken?: string): Promise<{
3919
4039
  token: string;
3920
4040
  }>;
@@ -3933,7 +4053,13 @@ declare class CometChatCalls extends SessionMethodsCore {
3933
4053
  private static notifyLoginFailure;
3934
4054
  private static notifyLogoutSuccess;
3935
4055
  private static notifyLogoutFailure;
3936
- static addEventListener<K$1 extends keyof WebSDKEvents>(eventType: K$1, listener: WebSDKEvents[K$1]): () => void;
4056
+ /**
4057
+ * Adds an event listener for SDK events.
4058
+ * @param eventType - The type of event to listen for.
4059
+ * @param listener - The callback function to invoke when the event fires.
4060
+ * @returns An unsubscribe function to remove the listener.
4061
+ */
4062
+ static addEventListener<K$1 extends keyof MobileSDKEvents>(eventType: K$1, listener: MobileSDKEvents[K$1]): () => void;
3937
4063
  }
3938
4064
  //#endregion
3939
4065
  export { CometChatCalls };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as zustand0 from "zustand";
1
+ import * as zustand1 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";
@@ -354,7 +354,7 @@ type Actions$5 = {
354
354
  isMobileSDK: () => boolean;
355
355
  isMobile: () => boolean;
356
356
  };
357
- declare const useBaseStore: zustand0.UseBoundStore<Omit<Omit<zustand0.StoreApi<BaseState & Actions$5>, "subscribe"> & {
357
+ declare const useBaseStore: zustand1.UseBoundStore<Omit<Omit<zustand1.StoreApi<BaseState & Actions$5>, "subscribe"> & {
358
358
  subscribe: {
359
359
  (listener: (selectedState: BaseState & Actions$5, previousSelectedState: BaseState & Actions$5) => void): () => void;
360
360
  <U>(selector: (state: BaseState & Actions$5) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -431,7 +431,7 @@ type Actions$4 = {
431
431
  leaveConference: () => Promise<void>;
432
432
  stopRecording: () => Promise<void>;
433
433
  };
434
- declare const useConferenceStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
434
+ declare const useConferenceStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<ConferenceState & Actions$4>, "subscribe"> & {
435
435
  subscribe: {
436
436
  (listener: (selectedState: ConferenceState & Actions$4, previousSelectedState: ConferenceState & Actions$4) => void): () => void;
437
437
  <U>(selector: (state: ConferenceState & Actions$4) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -505,7 +505,7 @@ type ConfigState = ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & Co
505
505
  type Actions$3 = {
506
506
  reset: () => void;
507
507
  };
508
- declare const useConfigStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
508
+ declare const useConfigStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3>, "subscribe"> & {
509
509
  subscribe: {
510
510
  (listener: (selectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3, previousSelectedState: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => void): () => void;
511
511
  <U>(selector: (state: ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth & Actions$3) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -657,7 +657,7 @@ type Actions$2 = {
657
657
  disconnect: () => Promise<void>;
658
658
  reset: () => void;
659
659
  };
660
- declare const useConnectionStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
660
+ declare const useConnectionStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<ConnectionState & Actions$2>, "subscribe"> & {
661
661
  subscribe: {
662
662
  (listener: (selectedState: ConnectionState & Actions$2, previousSelectedState: ConnectionState & Actions$2) => void): () => void;
663
663
  <U>(selector: (state: ConnectionState & Actions$2) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -707,7 +707,7 @@ type Actions$1 = {
707
707
  getParticipantById: (pid: string) => HumanParticipant | undefined;
708
708
  reset: () => void;
709
709
  };
710
- declare const useParticipantStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
710
+ declare const useParticipantStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<ParticipantsState & Actions$1>, "subscribe"> & {
711
711
  subscribe: {
712
712
  (listener: (selectedState: ParticipantsState & Actions$1, previousSelectedState: ParticipantsState & Actions$1) => void): () => void;
713
713
  <U>(selector: (state: ParticipantsState & Actions$1) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -753,7 +753,7 @@ type Actions = {
753
753
  updateTrack: (originalTrack: any, updatedTrack: Partial<Track>) => void;
754
754
  updateLocalTrack: (mediaType: MediaType, updatedTrack: Partial<Track>) => void;
755
755
  };
756
- declare const useTracksStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<TracksState & Actions>, "subscribe"> & {
756
+ declare const useTracksStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<TracksState & Actions>, "subscribe"> & {
757
757
  subscribe: {
758
758
  (listener: (selectedState: TracksState & Actions, previousSelectedState: TracksState & Actions) => void): () => void;
759
759
  <U>(selector: (state: TracksState & Actions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -804,25 +804,91 @@ declare const switchCamera: () => void;
804
804
  //#endregion
805
805
  //#region calls-sdk-core/utils/session-methods-core.d.ts
806
806
  declare class SessionMethodsCore {
807
+ /**
808
+ * Mutes the local user's audio during the call.
809
+ */
807
810
  static muteAudio(): void;
811
+ /**
812
+ * Unmutes the local user's audio during the call.
813
+ */
808
814
  static unmuteAudio(): void;
815
+ /**
816
+ * Pauses the local user's video stream.
817
+ */
809
818
  static pauseVideo(): void;
819
+ /**
820
+ * Resumes the local user's video stream.
821
+ */
810
822
  static resumeVideo(): void;
823
+ /**
824
+ * Local user leaves the current session.
825
+ */
811
826
  static leaveSession(): void;
827
+ /**
828
+ * Starts sharing the user's screen with other participants.
829
+ */
812
830
  static startScreenSharing(): void;
831
+ /**
832
+ * Stops the ongoing screen sharing session.
833
+ */
813
834
  static stopScreenSharing(): void;
835
+ /**
836
+ * Raises the user's virtual hand in the call.
837
+ */
814
838
  static raiseHand(): void;
839
+ /**
840
+ * Lowers the user's virtual hand in the call.
841
+ */
815
842
  static lowerHand(): void;
843
+ /**
844
+ * Switches between the front and rear camera.
845
+ */
816
846
  static switchCamera(): void;
847
+ /**
848
+ * Sets the layout type for the call.
849
+ * @param layout - The type of layout to set (tile, sidebar or spotlight).
850
+ */
817
851
  static setLayout(layout: Layout): void;
852
+ /**
853
+ * Starts recording the call.
854
+ */
818
855
  static startRecording(): void;
856
+ /**
857
+ * Stops the ongoing call recording.
858
+ */
819
859
  static stopRecording(): void;
860
+ /**
861
+ * Enables Picture-in-Picture (PIP) layout during the call.
862
+ */
820
863
  static enablePictureInPictureLayout(): void;
864
+ /**
865
+ * Disables Picture-in-Picture (PIP) layout.
866
+ */
821
867
  static disablePictureInPictureLayout(): void;
868
+ /**
869
+ * Pins a participant's video to focus on them.
870
+ * @param participantId - The ID of the participant to pin.
871
+ * @param type - The type of the participant.
872
+ */
822
873
  static pinParticipant(participantId: string, type: Participant$2['type']): void;
874
+ /**
875
+ * Unpins a participant's video.
876
+ */
823
877
  static unpinParticipant(): void;
878
+ /**
879
+ * Mutes the audio of a specific participant.
880
+ * @param participantId - The ID of the participant to mute.
881
+ */
824
882
  static muteParticipant(participantId: string): void;
883
+ /**
884
+ * Pauses the video stream of a specific participant.
885
+ * @param participantId - The ID of the participant whose video to pause.
886
+ */
825
887
  static pauseParticipantVideo(participantId: string): void;
888
+ /**
889
+ * Sets the unread message count displayed on the chat button.
890
+ * @param count - The number of unread messages.
891
+ */
826
892
  static setChatButtonUnreadCount(count: number): void;
827
893
  /**
828
894
  * @deprecated use startScreenSharing() instead
@@ -833,7 +899,7 @@ declare class SessionMethodsCore {
833
899
  */
834
900
  static stopScreenShare(): void;
835
901
  /**
836
- * @deprecated switchToVideoCall is deprecated and not supported
902
+ * @deprecated switchToVideoCall is deprecated and not supported.
837
903
  */
838
904
  static switchToVideoCall(): void;
839
905
  /**
@@ -1158,7 +1224,7 @@ interface TranslationState {
1158
1224
  translations: Record<string, typeof __json_default_export>;
1159
1225
  currentLocale: CometChatSupportedLocale | Omit<string, CometChatSupportedLocale>;
1160
1226
  }
1161
- declare const useTranslationStore: zustand0.UseBoundStore<Omit<zustand0.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1227
+ declare const useTranslationStore: zustand1.UseBoundStore<Omit<zustand1.StoreApi<Omit<TranslationState, "reset" | "setLocale"> & {
1162
1228
  reset: () => void;
1163
1229
  setLocale: (locale: CometChatSupportedLocale) => void;
1164
1230
  }>, "subscribe"> & {
@@ -3896,6 +3962,12 @@ declare class CometChatCalls extends SessionMethodsCore {
3896
3962
  static CallSettingsBuilder: typeof CallSettingsBuilder;
3897
3963
  static CallAppSettingsBuilder: typeof CallAppSettingsBuilder;
3898
3964
  static Component: typeof App;
3965
+ /**
3966
+ * Initializes the CometChat Calls SDK with the provided app settings.
3967
+ * Must be called before any other SDK methods.
3968
+ * @param appSettings - The application settings for configuring the SDK.
3969
+ * @returns An object indicating success or failure with error details.
3970
+ */
3899
3971
  static init(appSettings: CallAppSettings | CallAppSettings$1): Promise<{
3900
3972
  readonly success: false;
3901
3973
  readonly error: {
@@ -3907,14 +3979,62 @@ declare class CometChatCalls extends SessionMethodsCore {
3907
3979
  readonly success: true;
3908
3980
  readonly error: null;
3909
3981
  }>;
3982
+ /**
3983
+ * Logs in a user with their UID and an optional auth key.
3984
+ * If no auth key is provided, the one from app settings is used.
3985
+ * @param uid - The unique identifier of the user.
3986
+ * @param authKey - The authentication key. Falls back to the key provided in app settings.
3987
+ * @returns A Promise that resolves to the logged-in User object.
3988
+ * @throws {CometChatException} If login fails or validation errors occur.
3989
+ */
3910
3990
  static login(uid: string, authKey?: string): Promise<User>;
3991
+ /**
3992
+ * Logs in a user directly with an auth token.
3993
+ * @param authToken - The authentication token for the user.
3994
+ * @returns A Promise that resolves to the logged-in User object.
3995
+ * @throws {CometChatException} If login fails or the token is invalid.
3996
+ */
3911
3997
  static loginWithAuthToken(authToken: string): Promise<User>;
3998
+ /**
3999
+ * Logs out the currently logged-in user and clears local session data.
4000
+ * @returns A Promise that resolves to a success message string.
4001
+ * @throws {CometChatException} If no user is logged in or logout fails.
4002
+ */
3912
4003
  static logout(): Promise<string>;
4004
+ /**
4005
+ * Retrieves the currently logged-in user.
4006
+ * @returns The logged-in User object, or null if no user is logged in.
4007
+ */
3913
4008
  static getLoggedInUser(): User | null;
4009
+ /**
4010
+ * Retrieves the auth token of the currently logged-in user.
4011
+ * @returns The auth token string, or null if no user is logged in.
4012
+ */
3914
4013
  static getUserAuthToken(): string | null;
4014
+ /**
4015
+ * Checks whether a user is currently logged in.
4016
+ * @returns True if a user is logged in with a valid auth token, false otherwise.
4017
+ */
3915
4018
  static isUserLoggedIn(): boolean;
4019
+ /**
4020
+ * Registers a login listener to receive login/logout lifecycle callbacks.
4021
+ * @param listenerId - A unique identifier for the listener.
4022
+ * @param listener - The listener object with callback methods.
4023
+ */
3916
4024
  static addLoginListener(listenerId: string, listener: LoginListener): void;
4025
+ /**
4026
+ * Removes a previously registered login listener.
4027
+ * @param listenerId - The unique identifier of the listener to remove.
4028
+ */
3917
4029
  static removeLoginListener(listenerId: string): void;
4030
+ /**
4031
+ * Generates a call token for the given session.
4032
+ * Uses the provided auth token or falls back to the logged-in user's token.
4033
+ * @param sessionId - The session ID to generate a token for.
4034
+ * @param authToken - Optional auth token. If omitted, the logged-in user's token is used.
4035
+ * @returns A Promise that resolves to an object containing the generated token.
4036
+ * @throws {CometChatException} If the session ID is missing, no auth token is available, or the SDK is not initialized.
4037
+ */
3918
4038
  static generateToken(sessionId: string, authToken?: string): Promise<{
3919
4039
  token: string;
3920
4040
  }>;
@@ -3933,7 +4053,13 @@ declare class CometChatCalls extends SessionMethodsCore {
3933
4053
  private static notifyLoginFailure;
3934
4054
  private static notifyLogoutSuccess;
3935
4055
  private static notifyLogoutFailure;
3936
- static addEventListener<K$1 extends keyof WebSDKEvents>(eventType: K$1, listener: WebSDKEvents[K$1]): () => void;
4056
+ /**
4057
+ * Adds an event listener for SDK events.
4058
+ * @param eventType - The type of event to listen for.
4059
+ * @param listener - The callback function to invoke when the event fires.
4060
+ * @returns An unsubscribe function to remove the listener.
4061
+ */
4062
+ static addEventListener<K$1 extends keyof MobileSDKEvents>(eventType: K$1, listener: MobileSDKEvents[K$1]): () => void;
3937
4063
  }
3938
4064
  //#endregion
3939
4065
  export { CometChatCalls };