UNPKG

@cometchat/calls-sdk-javascript

Version:

<p align="center"> <img alt="CometChat" src="https://assets.cometchat.io/website/images/logos/banner.png"> </p>

1,435 lines (1,403 loc) 83.5 kB
import * as v from 'valibot'; declare interface AnyProperties { [prop: string]: any; } export declare type APIErrorResponse = { message: string; devMessage: string; source: string; code: string; }; export declare type AudioInputDevice = MediaDeviceInfo & { kind: Extract<MediaDeviceKind, 'audioinput'>; }; declare type AudioMode = { type: AudioModeType; selected: boolean; uid?: string; }; declare type AudioModeType = 'BLUETOOTH' | 'EARPIECE' | 'HEADPHONES' | 'SPEAKER'; export declare type AudioOutputDevice = MediaDeviceInfo & { kind: Extract<MediaDeviceKind, 'audiooutput'>; }; declare class CallAppSettings { private appId; private region; private host?; constructor(builder?: CallAppSettingsBuilder); setAppId(appId: string): this; setRegion(region: Region): this; setHost(host: Host): this; getAppId(): string; getRegion(): Region; getHost(): Host | undefined; } declare type CallAppSettings_2 = v.InferOutput<typeof CallAppSettingsSchema>; declare class CallAppSettingsBuilder { appId: string; region: Region; host?: Host; /** * Method to set appId of the app. * @param {string} appId appId of the app * @returns */ setAppId(appId: string): this; /** * Method to set region of the app. * @param {Region} region region of the app. * @returns {void} */ setRegion(region: Region): this; /** * Method to set host/domain of the app. * @param {string} host host/domain of the app. * @returns {void} */ setHost(host: Host): this; /** * This method will return an object of the CallsAppSettings class. * @returns {CallAppSettings} Returns the CallsAppSettings instance */ build(): CallAppSettings; } declare const CallAppSettingsSchema: v.ObjectSchema<{ readonly appId: v.StringSchema<undefined>; readonly region: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, string>, v.UnionSchema<[v.LiteralSchema<"eu", undefined>, v.LiteralSchema<"us", undefined>, v.LiteralSchema<"in", undefined>, v.LiteralSchema<"EU", undefined>, v.LiteralSchema<"US", undefined>, v.LiteralSchema<"IN", undefined>], undefined>]>; readonly authKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>; readonly adminHost: v.OptionalSchema<v.StringSchema<undefined>, undefined>; readonly clientHost: v.OptionalSchema<v.StringSchema<undefined>, undefined>; readonly host: v.OptionalSchema<v.StringSchema<undefined>, undefined>; }, undefined>; declare const CallConstants: { readonly MODE: { readonly DEFAULT: "DEFAULT"; readonly SPOTLIGHT: "SPOTLIGHT"; readonly GRID: "TILE"; }; readonly CALL_TYPE: { readonly AUDIO: "audio"; readonly VIDEO: "video"; }; readonly RECEIVER_TYPE_GROUP: "group"; readonly RECEIVER_TYPE_USER: "user"; readonly CALL_KEYS: { readonly CALL_DATA: "data"; readonly CALL_ID: "id"; readonly CALL_SESSION_ID: "sessionid"; readonly CALL_RECEIVER: "receiver"; readonly CALL_INITIATOR: "initiator"; readonly CALL_SENDER: "sender"; readonly CALL_RECEIVER_TYPE: "receiverType"; readonly CALL_STATUS: "status"; readonly CALL_TYPE: "type"; readonly CALL_INITIATED_AT: "initiatedAt"; readonly CALL_JOINED_AT: "joinedAt"; readonly CALL_LEFT_AT: "leftAt"; readonly CALL_METADATA: "metadata"; readonly CALL_ENTITIES: "entities"; readonly CALL_ENTITY_TYPE: "entityType"; readonly CALL_ENTITY: "entity"; readonly CALL_ENTITY_USER: "user"; readonly CALL_ENTITY_GROUP: "group"; }; readonly CALL_STATUS: { readonly INITIATED: "initiated"; readonly ONGOING: "ongoing"; readonly UNANSWERED: "unanswered"; readonly REJECTED: "rejected"; readonly BUSY: "busy"; readonly CANCELLED: "cancelled"; readonly ENDED: "ended"; }; readonly AUDIO_INPUT_DEVICES: "audioInputDevices"; readonly AUDIO_OUTPUT_DEVICES: "audioOutputDevices"; readonly VIDEO_INPUT_DEVICES: "videoInputDevices"; readonly POST_MESSAGES: { readonly TYPES: { readonly ACTION_MESSAGE: "cometchat_action_message"; readonly HANGUP: "hangup"; readonly COMETCHAT_RTC_SETTINGS: "cometchat_rtc_settings"; }; readonly ACTIONS: { readonly USER_JOINED: "onUserJoined"; readonly USER_LEFT: "onUserLeft"; readonly USER_LIST_CHANGED: "onUserListChanged"; readonly INITIAL_DEVICE_LIST: "initialDeviceList"; readonly DEVICE_CHANGE: "onDeviceChange"; readonly LOAD: "LOAD"; readonly CHANGE_AUDIO_INPUT: "changeAudioInput"; readonly CHANGE_AUDIO_OUTPUT: "changeAudioOutput"; readonly CHANGE_VIDEO_INPUT: "changeVideoInput"; readonly MUTE_AUDIO: "muteAudio"; readonly UNMUTE_AUDIO: "unmuteAudio"; readonly PAUSE_VIDEO: "pauseVideo"; readonly UNPAUSE_VIDEO: "unPauseVideo"; readonly SWITCH_MODE: "switchMode"; readonly START_SCREENSHARE: "startScreenShare"; readonly STOP_SCREENSHARE: "stopScreenShare"; readonly END_CALL: "endCall"; readonly START_RECORDING: "startRecording"; readonly STOP_RECORDING: "stopRecording"; readonly RECORDING_TOGGLED: "onRecordingToggled"; readonly USER_MUTED: "onUserMuted"; readonly ON_USER_UNMUTED: "onUserUnMuted"; readonly SCREEN_SHARE_STARTED: "SCREEN_SHARE_STARTED"; readonly SCREEN_SHARE_STOPPED: "SCREEN_SHARE_ENDED"; readonly SWITCH_TO_VIDEO_CALL: "switchedToVideo"; readonly SWITCHED_TO_VIDEO_CALL: "onCallSwitchedToVideo"; readonly OPEN_VIRTUAL_BACKGROUND: "openVirtualBackgroundMenu"; readonly SET_BACKGROUND_BLUR: "setBackgroundBlur"; readonly SET_BACKGROUND_IMAGE: "setBackgroundImage"; }; }; readonly MEDIA_DEVICE: { readonly ID: "id"; readonly NAME: "name"; readonly ACTIVE: "active"; }; readonly ZOOM_BUTTON_DEFAULT_PARAMS: { readonly position: "bottom-right"; readonly visible: true; }; readonly NAME_LABEL_DEFAULT_PARAMS: { readonly position: "bottom-left"; readonly visible: true; readonly color: "rgba(27, 27, 27, 0.4)"; }; readonly NETWORK_LABEL_DEFAULT_PARAMS: { readonly position: "bottom-right"; readonly visible: true; }; readonly MAIN_VIDEO_CONTAINER_SETTINGS: { readonly KEYS: { readonly POSITION: "position"; readonly VISIBILITY: "visible"; readonly LEGACY_VISIBILITY: "visibility"; readonly COLOR: "color"; }; }; }; declare class CallGroup { protected guid: string; protected name: string; protected icon: string; constructor(object: any); getGuid(): string; setGuid(guid: string): void; getName(): string; setName(name: string): void; getIcon(): string; setIcon(icon: string): void; toString(): string; static getGroupFromJson(object: any): CallGroup; } /** * Represents a call log. */ export declare class CallLog { /** * The session ID of the call log. */ private sessionId; /** * The total audio minutes of the call log. */ private totalAudioMinutes; /** * The total video minutes of the call log. */ private totalVideoMinutes; /** * The total duration of the call log. */ private totalDuration; /** * Whether the call log has a recording. */ private hasRecording; /** * The time the call was initiated at. */ private initiatedAt; /** * The call category of the call log. */ private callCategory; /** * @type {CallUser} * The initiator of the call log. */ private initiator; /** * @type {CallUser | CallGroup} * The receiver of the call log. */ private receiver; /** * The receiver type of the call log. */ private receiverType; /** * The status of the call log. */ private status; /** * The total duration in minutes of the call log. */ private totalDurationInMinutes; /** * The total number of participants in the call log. */ private totalParticipants; /** * The type of the call log. */ private type; /** * The message ID of the call log. */ private mid; /** * The time the call ended at. */ private endedAt; /** * @type {Participant[]} * The participants of the call log. */ private participants; /** * @type {Recording[]} * The recordings of the call log. */ private recordings; /** * Creates a new instance of CallLog. * @param data - The data to initialize the call log with. */ constructor(data: any); /** * Gets the session ID of the call log. * @returns The session ID of the call log. */ getSessionID(): string; /** * Sets the session ID of the call log. * @param value - The session ID to set. */ setSessionID(value: string): void; /** * Gets the total audio minutes of the call log. * @returns The total audio minutes of the call log. */ getTotalAudioMinutes(): number; /** * Sets the total audio minutes of the call log. * @param value - The total audio minutes to set. */ setTotalAudioMinutes(value: number): void; /** * Gets the total video minutes of the call log. * @returns The total video minutes of the call log. */ getTotalVideoMinutes(): number; /** * Sets the total video minutes of the call log. * @param value - The total video minutes to set. */ setTotalVideoMinutes(value: number): void; /** * Gets the total duration of the call log. * @returns The total duration of the call log. */ getTotalDuration(): string; /** * Sets the total duration of the call log. * @param value - The total duration to set. */ setTotalDuration(value: string): void; /** * Gets whether the call log has a recording. * @returns Whether the call log has a recording. */ getHasRecording(): boolean; /** * Sets whether the call log has a recording. * @param value - Whether the call log has a recording. */ setHasRecording(value: boolean): void; /** * Gets the time the call was initiated at. * @returns The time the call was initiated at. */ getInitiatedAt(): number; /** * Sets the time the call was initiated at. * @param value - The time the call was initiated at. */ setInitiatedAt(value: number): void; /** * Gets the call category of the call log. * @returns The call category of the call log. */ getCallCategory(): string; /** * Sets the call category of the call log. * @param value - The call category to set. */ setCallCategory(value: string): void; /** * Gets the initiator of the call log. * @returns The initiator of the call log. */ getInitiator(): CallUser; /** * Sets the initiator of the call log. * @param value - The initiator to set. */ setInitiator(value: CallUser): void; /** * Gets the receiver of the call log. * @returns The receiver of the call log. */ getReceiver(): CallUser | CallGroup; /** * Sets the receiver of the call log. * @param value - The receiver to set. */ setReceiver(value: CallUser | CallGroup): void; /** * Gets the receiver type of the call log. * @returns The receiver type of the call log. */ getReceiverType(): string; /** * Sets the receiver type of the call log. * @param value - The receiver type to set. */ setReceiverType(value: string): void; /** * Gets the status of the call log. * @returns The status of the call log. */ getStatus(): string; /** * Sets the status of the call log. * @param value - The status to set. */ setStatus(value: string): void; /** * Gets the total duration in minutes of the call log. * @returns The total duration in minutes of the call log. */ getTotalDurationInMinutes(): number; /** * Sets the total duration in minutes of the call log. * @param value - The total duration in minutes to set. */ setTotalDurationInMinutes(value: number): void; /** * Gets the total number of participants in the call log. * @returns The total number of participants in the call log. */ getTotalParticipants(): number; /** * Sets the total number of participants in the call log. * @param value - The total number of participants to set. */ setTotalParticipants(value: number): void; /** * Gets the type of the call log. * @returns The type of the call log. */ getType(): string; /** * Sets the type of the call log. * @param value - The type to set. */ setType(value: string): void; /** * Gets the message ID of the call log. * @returns The message ID of the call log. */ getMid(): string; /** * Sets the message ID of the call log. * @param value - The message ID to set. */ setMid(value: string): void; /** * Gets the time the call ended at. * @returns The time the call ended at. */ getEndedAt(): number; /** * Sets the time the call ended at. * @param value - The time the call ended at. */ setEndedAt(value: number): void; /** * Gets the participants of the call log. * @returns The participants of the call log. */ getParticipants(): Participant_2[]; /** * Sets the participants of the call log. * @param value - The participants to set. */ setParticipants(value: Participant_2[]): void; /** * Gets the recordings of the call log. * @returns The recordings of the call log. */ getRecordings(): Recording[]; /** * Sets the recordings of the call log. * @param value - The recordings to set. */ setRecordings(value: Recording[]): void; /** * Creates a new instance of CallLog from JSON data. * @param data - The JSON data to create the call log from. * @returns A new instance of CallLog created from the JSON data. */ static callLogFromJson(data: any): CallLog; } /** * Represents a request to fetch call logs. */ declare class CallLogRequest { /** * The maximum number of call logs to fetch. */ private limit; /** * The total number of pages of call logs. */ private totalPages; /** * The current page of call logs. */ private currentPage; /** * The type of call to filter by. */ private callType; /** * The status of call to filter by. */ private callStatus; /** * Whether the call has a recording or not. */ private hasRecording; /** * The category of call to filter by. */ private callCategory; /** * The direction of call to filter by. */ private callDirection; /** * The user ID to filter by. */ private uid; /** * The group ID to filter by. */ private guid; /** * The authentication token to use for the API call. */ private authToken; /** * Whether an API call is currently in progress. */ private inProgress; /** * Creates a new CallLogRequest instance. * @param builder The builder object to use for constructing the request. */ constructor(builder: CallLogRequestBuilder); /** * Fetches the next page of call logs. * @returns A promise that resolves to an array of CallLog objects, or rejects with a CometChatCallsException if there was an error. */ fetchNext(): Promise<CallLog[]>; /** * Fetches the previous page of call logs. * @returns A promise that resolves to an array of CallLog objects, or an empty array if there are no previous pages, or rejects with a CometChatCallsException if there was an error.. */ fetchPrevious(): Promise<CallLog[] | []>; /** * Makes an API call to fetch call logs. * @param isFetchNext Whether to fetch the next page of call logs. * @returns A promise that resolves to an array of CallLog objects, or rejects with a CometChatCallsException if there was an error. */ private makeAPICall; /** * Gets the filter parameters for the API call. * @param isNext Whether to fetch the next page of call logs. * @returns The filter parameters object. */ private getParams; /** * Parses the API response and returns an array of CallLog objects. * @param response The API response string. * @returns An array of CallLog objects. */ private getCallLogList; } /** * A builder class for creating a request to fetch call logs. */ declare class CallLogRequestBuilder { /** @private */ limit: number; /** @private */ callType: string; /** @private */ callStatus: string; /** @private */ hasRecording: boolean; /** @private */ callCategory: string; /** @private */ callDirection: string; /** @private */ uid: string; /** @private */ guid: string; /** @private */ authToken: string; /** * Sets the limit of call logs to be fetched. * @param limit - The number of call logs to be fetched. * @returns The CallLogRequestBuilder object. */ setLimit(limit: number): this; /** * Sets the type of call to be fetched. * @param callType - The type of call to be fetched. Can be either 'video' or 'audio'. * @returns The CallLogRequestBuilder object. */ setCallType(callType: 'video' | 'audio'): this; /** * Sets the status of call to be fetched. * @param callStatus - The status of call to be fetched. Can be either 'ongoing', 'busy', 'rejected', 'cancelled', 'ended' or 'missed'. * @returns The CallLogRequestBuilder object. */ setCallStatus(callStatus: 'ongoing' | 'busy' | 'rejected' | 'cancelled' | 'ended' | 'missed'): this; /** * Sets whether the call has recording or not. * @param hasRecording - Whether the call has recording or not. * @returns The CallLogRequestBuilder object. */ setHasRecording(hasRecording: boolean): this; /** * Sets the category of call to be fetched. * @param callCategory - The category of call to be fetched. Can be either 'call' or 'meet'. * @returns The CallLogRequestBuilder object. */ setCallCategory(callCategory: 'call' | 'meet'): this; /** * Sets the direction of call to be fetched. * @param callDirection - The direction of call to be fetched. Can be either 'incoming' or 'outgoing'. * @returns The CallLogRequestBuilder object. */ setCallDirection(callDirection: 'incoming' | 'outgoing'): this; /** * Sets the user ID of the call logs to be fetched. * @param uid - The user ID of the call logs to be fetched. * @returns The CallLogRequestBuilder object. */ setUid(uid: string): this; /** * Sets the group ID of the call logs to be fetched. * @param guid - The group ID of the call logs to be fetched. * @returns The CallLogRequestBuilder object. */ setGuid(guid: string): this; /** * Sets the authorization token for the request. * @param authToken - The authorization token for the request. * @returns The CallLogRequestBuilder object. */ setAuthToken(authToken: string): this; /** * Builds and returns the CallLogRequest object. * @returns The CallLogRequest object. */ build(): CallLogRequest; } export declare class CallSession { addEventListener<T extends keyof MobileSDKEvents>(event: T, callback: MobileSDKEvents[T]): { remove: () => void; }; getInstance(): CallSession; } declare class CallSettings { static POSITION_TOP_LEFT: string; static POSITION_TOP_RIGHT: string; static POSITION_BOTTOM_LEFT: string; static POSITION_BOTTOM_RIGHT: string; static POSITION: { readonly TOP_LEFT: "top-left"; readonly TOP_RIGHT: "top-right"; readonly BOTTOM_LEFT: "bottom-left"; readonly BOTTOM_RIGHT: "bottom-right"; }; static ASPECT_RATIO_DEFAULT: string; static ASPECT_RATIO_CONTAIN: string; static ASPECT_RATIO_COVER: string; static ASPECT_RATIO: { readonly DEFAULT: "default"; readonly CONTAIN: "contain"; readonly COVER: "cover"; }; private defaultLayout; private isAudioOnly; private mode; private ShowEndCallButton; private ShowMuteAudioButton; private ShowPauseVideoButton; private ShowScreenShareButton; private ShowSwitchModeButton; private StartAudioMuted; private StartVideoMuted; private localizedObject; private ShowRecordingButton; private idleTimeoutPeriod; private StartRecordingOnCallStart; private callListener; private ShowSwitchToVideoCallButton; private VirtualBackground; private ShowVirtualBackgroundSetting; constructor(builder?: CallSettingsBuilder); getCallListener(): OngoingCallListener; isRecordingButtonEnabled(): boolean; getIdleTimeoutPeriod(): number; shouldStartRecordingOnCallStart(): boolean; isAudioOnlyCall(): boolean; isDefaultLayoutEnabled(): boolean; getMode(): "TILE" | "SPOTLIGHT" | "DEFAULT" | undefined; getStartWithAudioMuted(): boolean; getStartWithVideoMuted(): boolean; isEndCallButtonEnabled(): boolean; isMuteAudioButtonEnabled(): boolean; isPauseVideoButtonEnabled(): boolean; isScreenShareButtonEnabled(): boolean; isModeButtonEnabled(): boolean; getLocalizedStringObject(): Object; isAudioToVideoButtonEnabled(): boolean; getVirtualBackground(): VirtualBackground; isVirtualBackgroundSettingEnabled(): boolean; } declare class CallSettingsBuilder { /** @private */ defaultLayout: boolean; /** @private */ isAudioOnly: boolean; /** @private */ mode: ICallsettings['mode']; /** @private */ ShowEndCallButton: boolean; /** @private */ ShowMuteAudioButton: boolean; /** @private */ ShowPauseVideoButton: boolean; /** @private */ ShowScreenShareButton: boolean; /** @private */ ShowSwitchModeButton: boolean; /** @private */ StartAudioMuted: boolean; /** @private */ StartVideoMuted: boolean; /** @private */ localizedObject: Object; /** @private */ ShowRecordingButton: boolean; /** @private */ idleTimeoutPeriod: number; /** @private */ StartRecordingOnCallStart: boolean; /** @private */ ShowSwitchToVideoCallButton: boolean; /** @private */ virtualBackground: VirtualBackground; /** @private */ ShowVirtualBackgroundSetting: boolean; /** @private */ callListener: OngoingCallListener; /** * * @param {boolean} defaultLayout * This methods shows/hides the default button layout. * If set to true the default button layout will be shown. * If set to false the default button layout will be hidden. * Default value is true * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ enableDefaultLayout(defaultLayout: boolean): this; /** * * @param {boolean} isAudioOnly * This methods sets the type(audio/video) of the call. * If set to true, the call will be strictly an audio call. * If set to false, the call will be an audio-video call. * Default value is false * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ setIsAudioOnlyCall(isAudioOnly: boolean): this; /** * * @param {string} mode * This method sets the mode of the call. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ setMode(mode: ICallsettings['mode']): this; /** * * @param {boolean} showEndCallButton * This method shows/hides the end call button. * If set to true it will display the end call button. * If set to false it will hide the end call button. * Default value is true. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ showEndCallButton(showEndCallButton: boolean): this; /** * * @param {boolean} showMuteAudioButton * This method shows/hides the mute audio button. * If set to true it will display the mute audio button. * If set to false it will hide the mute audio button. * Default value is true. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ showMuteAudioButton(showMuteAudioButton: boolean): this; /** * * @param {boolean} showPauseVideoButton * This method shows/hides the pause video button. * If set to true it will display the pause video button. * If set to false it will hide the pause video button. * Default value is true. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ showPauseVideoButton(showPauseVideoButton: boolean): this; /** * * @param {boolean} showScreenShareButton * This method shows/hides the screen share button. * If set to true it will display the screen share button. * If set to false it will hide the screen share button. * Default value is true. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ showScreenShareButton(showScreenShareButton: boolean): this; /** * * @param {boolean} showModeButton * This method shows/hides the switch mode button. * If set to true it will display the switch mode button. * If set to false it will hide the switch mode button. * Default value is true. * @returns */ showModeButton(showModeButton: boolean): this; /** * * @param {Object} localizedStringObject * This method will set the localized text in the call screen. * @returns */ setLocalizedStringObject(localizedStringObject: Object): this; /** * * @param {boolean} audioMuted * This method allows the call to be started with audio muted. * If set to true, the call will start with audio muted. * Default value is false. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ startWithAudioMuted(audioMuted: boolean): this; /** * * @param {boolean} videoMuted * This method allows the call to be started with video muted. * If set to true, the call will start with video muted. * Default value is false. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ startWithVideoMuted(videoMuted: boolean): this; /** * * @param {boolean} customCSS * This method will set the custom CSS of the call screen. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ setCustomCSS(_: string): this; /** * * @param {boolean} showRecordingButton * This method shows/hides the recording button. * If set to true it will display the recording button. * If set to false it will hide the recording button. * Default value is false. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ showRecordingButton(showRecordingButton: boolean): this; /** * * @param {number} idleTimeoutPeriod * This method sets the idle timeout period for the call. * If set and you are the only one in call, the call will end * after the idle timeout period, giving you the option to * extend the call 60 seconds before the call ends. * Default value is 180 seconds. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ setIdleTimeoutPeriod(idleTimeoutPeriod: number): this; /** * * @param {boolean} startRecordingOnCallStart * This method starts the recording as soon as the call start. * If set to true it will start the recording as soon as the call start. * Default value is false. * @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance */ startRecordingOnCallStart(startRecordingOnCallStart: boolean): this; /** * * @param {boolean} _showAudioToVideoSwitchButton * This method shows/hides the switch to video call button. * If set to true it will display the switch to video call button. * If set to false it will hide the switch to video call button. * Default value is true. * @returns */ showSwitchToVideoCallButton(_showAudioToVideoSwitchButton: boolean): this; /** * * @param {VirtualBackground} virtualBackground * This method will set the virtual background setting. * This methods takes an Object of VirtualBackground Class. * @deprecated Virtual background feature is deprecated and it has no effect. * @returns */ setVirtualBackground(virtualBackground: VirtualBackground): this; /** * * @param {MainVideoContainerSetting} mainVideoContainerSetting * This method can be used to customize the main video container. * @deprecated This method is deprecated and not supported. * @returns */ setMainVideoContainerSetting(_mainVideoContainerSetting: MainVideoContainerSetting): this; /** * * @param {boolean} showVirtualBackgroundSetting * This method shows/hides the virtual background setting button. * If set to true it will display the virtual background setting button. * If set to false it will hide the virtual background setting button. * Default value is true. * @returns */ showVirtualBackgroundSetting(showVirtualBackgroundSetting: boolean): this; /** * * @param {OngoingCallListener} callListener * This method can be used to subscribe to available callings events * @returns */ setCallListener(callListener: OngoingCallListener): this; /** * This method will return an object of the CallSettings class. * @returns {CallSettings} Returns the CallSettings instance */ build(): CallSettings; } declare class CallUser { protected uid: string; protected name: string; protected avatar: string; constructor(object: any); getUid(): string; setUid(uid: string): void; getName(): string; setName(name: string): void; getAvatar(): string; setAvatar(avatar: string): void; toString(): string; static getUserFromJson(object: any): CallUser; } declare const CAMERA_FACING: { readonly FRONT: "FRONT"; readonly REAR: "REAR"; }; declare type CameraFacing = ValueOf<typeof CAMERA_FACING>; declare interface CometChatAPIException extends Error { readonly name: 'COMET_CHAT_API_ERROR' | 'NETWORK_ERROR' | 'VALIDATION_ERROR' | 'BAD_RESPONSE' | 'UNKNOWN_ERROR'; readonly details?: unknown; readonly timestamp: number; } export declare class CometChatCalls extends SessionMethods { private static loggedInUser; private static isInitialized; private static loginInProgress; private static appSettings; private static loginListeners; static constants: { LAYOUT: { readonly TILE: "TILE"; readonly SIDEBAR: "SIDEBAR"; readonly SPOTLIGHT: "SPOTLIGHT"; }; TYPE: { readonly VOICE: "VOICE"; readonly VIDEO: "VIDEO"; }; CAMERA_FACING: { readonly FRONT: "FRONT"; readonly REAR: "REAR"; }; }; static CallLogRequestBuilder: typeof CallLogRequestBuilder; static CallLog: typeof CallLog; /** @deprecated */ static MainVideoContainerSetting: typeof MainVideoContainerSetting; /** @deprecated */ static CallSettings: typeof CallSettings; /** * @deprecated Use CometChatCalls.init passing object directly. */ static CallAppSettingsBuilder: typeof CallAppSettingsBuilder; /** * @deprecated Use CometChatCalls.joinSession passing object directly. */ static CallSettingsBuilder: typeof CallSettingsBuilder; /** * @deprecated Use CometChatCalls.addEventListener */ static OngoingCallListener: typeof OngoingCallListener; static init(appSettings: CallAppSettings_2 | CallAppSettings): Promise<{ readonly success: false; readonly error: { readonly name: "VALIDATION_ERROR"; readonly message: `Invalid app settings: ${string}`; readonly timestamp: number; }; } | { readonly success: true; readonly error: null; }>; /** * Shared tail of {@link init} / {@link initFromSettings}. Both entry points validate */ private static finalizeInit; /** * Initializes the CometChat Calls SDK from a `cometchat-settings.json` object. * Parallels the Chat SDK's `initFromSettings` (file-based init for skills-driven * integrations): it maps the shared settings shape onto the Calls SDK's own * `CallAppSettings` and then performs exactly the same work as {@link init}. * @param settings - Parsed `cometchat-settings.json` object. * @returns An object indicating success or failure with error details. */ static initFromSettings(settings: CometChatSettings): Promise<{ readonly success: false; readonly error: { readonly name: "VALIDATION_ERROR"; readonly message: `Invalid app settings: ${string}`; readonly timestamp: number; }; } | { readonly success: true; readonly error: null; }>; static login(uid: string, authKey?: string): Promise<User_2>; static loginWithAuthToken(authToken: string): Promise<User_2>; static logout(): Promise<string>; static getLoggedInUser(): User_2 | null; static getUserAuthToken(): string | null; static isUserLoggedIn(): boolean; static addLoginListener(listenerId: string, listener: LoginListener): void; static removeLoginListener(listenerId: string): void; static generateToken(sessionId: string, authToken?: string): Promise<{ token: string; }>; private static getBaseURL; /** * SDK-identification telemetry chokepoint. Fire-and-forget, deduped, non-fatal. * Called from login success AND init()-session-restore. Sends `/user_sessions` * ONLY when the Chat SDK is absent (it otherwise handles this telemetry itself). * Never awaited on the happy path; never throws. */ private static reportSdkIdentification; private static loginWithUID; private static authenticateWithToken; private static logoutInternal; private static callGenerateTokenAPI; private static callVerifyTokenAPI; private static saveUser; private static getSavedUser; private static clearSavedUser; private static generateDeviceId; private static createError; private static notifyLoginSuccess; private static notifyLoginFailure; private static notifyLogoutSuccess; private static notifyLogoutFailure; static addEventListener<K extends keyof WebSDKEvents>(eventType: K, listener: WebSDKEvents[K], options?: { signal?: AbortSignal; }): () => void; /** * @deprecated Use CometChatCalls.joinSession instead. */ static startSession(callToken: string, callSettings: CallSettings, container: HTMLElement): Promise<Result<void, VerifyTokenException>>; private static _connectToRoom; private static connectToRoom; static joinSession(callToken: string, sessionSettings: SessionSettings, container: HTMLElement): Promise<Result<void, VerifyTokenException>>; static getAudioInputDevices(): AudioInputDevice[]; static getVideoInputDevices(): VideoInputDevice[]; static getAudioOutputDevices(): AudioOutputDevice[]; static getCurrentAudioInputDevice(): AudioInputDevice | undefined; static getCurrentVideoInputDevice(): VideoInputDevice | undefined; static getCurrentAudioOutputDevice(): AudioOutputDevice | undefined; } declare namespace CometChatCallsDefault { export { SessionSettings, CometChatCalls } } export default CometChatCallsDefault; declare class CometChatCallsException { code?: ErrorModel['code']; name?: ErrorModel['name']; message?: ErrorModel['message']; details?: ErrorModel['details']; constructor(errorModel: ErrorModel); } declare interface CometChatException { errorCode: string; errorDescription: string; message?: string; } declare interface CometChatSettings { appId: string; region: string; credentials?: { authKey?: string; }; callsSDK?: { adminHost?: string | null; clientHost?: string | null; host?: string | null; }; chatSDK?: Record<string, unknown>; uiKit?: Record<string, unknown>; } /** * Configuration that applies on both web and mobile platforms. */ declare type ConfigStateBoth = { /** * Whether the call starts as an audio-only (`'VOICE'`) call or a video * (`'VIDEO'`) call. In a voice call no camera is acquired and no video * tiles are shown. * * @default 'VIDEO' */ sessionType: SessionType; /** * The arrangement used to display participant video tiles: * - `'TILE'` — an equal grid of all participants. * - `'SIDEBAR'` — one main participant with the rest in a side strip. * - `'SPOTLIGHT'` — a single full-screen participant with the local user * shown in a small picture-in-picture tile. * * @default 'TILE' */ layout: Layout; /** * Which camera to use when the call starts: `'FRONT'` (selfie) or `'REAR'` * (back). Primarily relevant on mobile devices with multiple cameras; the * user can still switch afterwards. * * @default undefined — uses the SDK's current camera (front by default) */ initialCameraFacing?: CameraFacing; /** * Automatically starts recording the session as soon as the call begins, * without the user pressing the record button. Recording must be enabled * for your app for this to take effect. * * @default false */ autoStartRecording: boolean; /** * Hides the recording button from the call controls, preventing the user * from manually starting or stopping recording from within the SDK UI. * * @default true */ hideRecordingButton: boolean; /** * Hides the entire bottom control bar (mic, camera, leave, and every other * call control). Useful when the host app provides its own controls. * * @default false */ hideControlPanel: boolean; /** * Hides the "leave call" button from the call controls. The host app is * then responsible for providing its own way to leave the session. * * @default false */ hideLeaveSessionButton: boolean; /** * Hides the top header bar of the call UI (which shows the call title, * session timer, and similar information). * * @default false */ hideHeaderPanel: boolean; /** * Hides the "raise hand" button from the call controls. * * @default false */ hideRaiseHandButton: boolean; /** * Hides the "share / invite" button that lets the user invite others to * join the call. * * @default true */ hideShareInviteButton: boolean; /** * Hides the layout-switcher button, preventing the user from changing * between the tile, sidebar, and spotlight layouts at runtime. * * @default false */ hideChangeLayoutButton: boolean; /** * Hides the microphone mute/unmute button from the call controls. * * @default false */ hideToggleAudioButton: boolean; /** * Hides the camera on/off button from the call controls. * * @default false */ hideToggleVideoButton: boolean; /** * Hides the button that opens the participant list panel. * * @default false */ hideParticipantListButton: boolean; /** * Hides the in-call chat button. * * @default true */ hideChatButton: boolean; /** * Hides the elapsed-time timer that shows how long the call has been * running. * * @default false */ hideSessionTimer: boolean; /** * Hides the network-quality indicator that reflects each participant's * connection strength. * * @default true */ hideNetworkIndicator: boolean; /** * Hides the "recording in progress" badge shown while the session is being * recorded. The recording itself is unaffected. * * @default false */ hideRecordingStatusIndicator: boolean; /** * Hides the button that switches between the front and rear cameras. * Mainly relevant on mobile devices with more than one camera. * * @default false */ hideSwitchCameraButton: boolean; /** * Enables the per-participant context menu — opened by right-clicking (web) * or long-pressing (mobile) a participant's tile — that exposes actions such * as pinning a participant. * * Note: this menu is automatically unavailable in the `'SPOTLIGHT'` and * picture-in-picture layouts regardless of this setting. * * @default true */ enableParticipantContextMenu: boolean; /** * The display name to show for the local user in the call (participant * tiles, participant list, etc.). When left empty, the name associated with * the logged-in user is used. * * @default '' — falls back to the logged-in user's name */ displayName: string; /** * Joins the call with the microphone muted. The user can unmute manually * afterwards (unless the toggle-audio button is hidden). * * @default false */ startAudioMuted: boolean; /** * Joins the call with the camera off. The user can turn the camera on * manually afterwards (unless the toggle-video button is hidden). * * @default false */ startVideoPaused: boolean; /** * Title text shown in the call's header panel (for example, the meeting or * room name). * * @default '' — no title shown */ title: string; /** * How long, in milliseconds, the local user may remain alone in the call * (no other participants) before an "are you still there?" idle prompt is * shown. The countdown only runs while you are the only participant. * * @default 60000 — 60 seconds */ idleTimeoutPeriodBeforePrompt: number; /** * How long, in milliseconds, the idle prompt stays on screen waiting for a * response before the SDK automatically leaves the call on the user's behalf. * * @default 180000 — 3 minutes */ idleTimeoutPeriodAfterPrompt: number; /** * Allows the user to drag the local picture-in-picture tile to reposition * it. Only applies when `layout` is `'SPOTLIGHT'`. * * @default true */ enableSpotlightDrag: boolean; /** * Marks this as a one-to-one (peer) call. In a peer call, when one * participant leaves the session ends for everyone rather than continuing * without them (unless `forceLeave` is passed when leaving). The remote * peer's connectivity is also watched: if no remote stats arrive for 10 * seconds onRemoteConnectionLost is published, and * onRemoteConnectionRestored once they resume. * * @default false */ isPeerCall: boolean; /** * Enables the in-call toast notifications surfaced by the SDK (for example * "X joined the call" or error messages). Set to `false` to suppress all * SDK toasts. * * @default true */ enableNotifications: boolean; /** * @unstable This API may change or be removed in a future release. * When enabled in a voice call (`sessionType: 'VOICE'`), the SDK renders * no visible UI at all — no controls, header, modals, or toast * notifications — while the call connection, media, and events continue * to work normally. Remote participants' audio keeps playing. The host * app is responsible for providing its own UI, including reacting to * session end (the SDK's "session has ended" view and the idle-timeout * prompt/auto-leave are not shown in this mode). * * Only supported in voice calls: for video calls (`sessionType: * 'VIDEO'`) the flag is ignored with a console warning and the default * UI is rendered. * * @default false */ unstable_headlessMode: boolean; }; /** * Configuration that only applies on the web platform. * These options are ignored on mobile. */ declare type ConfigStateWeb = { /** * Applies background-noise suppression to the local microphone so that * keyboard clicks, fans, and other ambient sounds are filtered out before * your audio is sent to other participants. * * @default false */ enableNoiseReduction: boolean; /** * The `deviceId` of the microphone to capture audio from when the call * starts. Use this to pre-select a specific input device instead of the * system default. Device IDs come from the browser's * `navigator.mediaDevices.enumerateDevices()`. * * @default undefined — uses the system default microphone */ audioInputDeviceId?: string; /** * The `deviceId` of the speaker / output device used to play remote * participants' audio. Use this to pre-select a specific output device * instead of the system default. * * @default undefined — uses the system default speaker */ audioOutputDeviceId?: string; /** * The `deviceId` of the camera to capture video from when the call starts. * Use this to pre-select a specific camera instead of the system default. * * @default undefined — uses the system default camera */ videoInputDeviceId?: string; /** * Hides the screen-sharing button from the call controls, preventing the * user from starting a screen share from within the SDK UI. * * @default false */ hideScreenSharingButton: boolean; /** * Hides the virtual-background button from the call controls, preventing the * user from blurring or replacing their camera background from within the * SDK UI. * * @default false */ hideVirtualBackgroundButton: boolean; }; declare type ConnectionError = { name: string; message?: string; details?: Record<string, unknown>; recoverable?: boolean; }; /** * * * @export * @interface ErrorModel */ declare interface ErrorModel { code?: string | number; name?: string; message?: string; details?: string; } declare const EVENT_LISTENER_METHODS: { readonly SessionStatusListener: { readonly onSessionJoined: "onSessionJoined"; readonly onSessionLeft: "onSessionLeft"; readonly onConnectionLost: "onConnectionLost"; readonly onConnectionRestored: "onConnectionRestored"; readonly onRemoteConnectionLost: "onRemoteConnectionLost"; readonly onRemoteConnectionRestored: "onRemoteConnectionRestored"; readonly onConnectionClosed: "onConnectionClosed"; readonly onConnectionFailed: "onConnectionFailed"; readonly onSessionTimedOut: "onSessionTimedOut"; }; readonly MediaEventsListener: { readonly onAudioMuted: "onAudioMuted"; readonly onAudioUnMuted: "onAudioUnMuted"; readonly onVideoPaused: "onVideoPaused"; readonly onVideoResumed: "onVideoResumed"; readonly onRecordingStarted: "onRecordingStarted"; readonly onR