type ObjectKey = string | number | symbol; type EmptyObject = Record; type UUID = string; type Int64 = string; type MessagingUserId = Int64 | number; type UserName = string; type ApplicationName = string; type AccountName = string; type MessagingUserName = `${UserName}@${ApplicationName}.${AccountName}` | string; type EndpointId = string; type TrackId = string; type MediaId = string; type BaseMediaKind = "audio" | "video"; type SipHeaders = Record; type Type = string; type SubType = string; type CommonMIMEType = `${Type}/${SubType}`; type MIMEType = T; type OnValueChangeCallback = (newValue: T, oldValue: T) => unknown | Promise; type UnwatchFunction = () => void; interface WatchOptions { /** * Whether the callback should be called only once. The default value is false. */ once?: boolean; /** * A function that returns a boolean to determine if the callback should be called. * The guard not set by default. * * @since 5.1.0 */ guard?: (newValue: T, oldValue: T) => boolean; /** * Whether the callback should be removed after calling the clear method. The default value is true. */ clearable?: boolean; /** * An AbortSignal. The watch callback will be removed when the abort() method of the AbortController which owns the AbortSignal is called. * See [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) for details. * * @since 5.1.0 */ signal?: AbortSignal; /** * Whether the callback should be called immediately after being added. The default value is false. * * @since 5.1.0 */ immediate?: boolean; } interface Watchable { /** * Current value of the observable property. */ value: T; /** * Previous value of the observable property. */ get oldValue(): T; /** * Subscribes to the value changes. * * When the value is changed, the [Core.Watchable.OnValueChangeCallback] callback is triggered. * * Returns [Core.Watchable.UnwatchFunction], to unwatch observable value changes. * * @param onValueChangeCallback Observer to be triggered when the value is changed * @param options Options */ watch: (onValueChangeCallback: OnValueChangeCallback, options?: WatchOptions) => UnwatchFunction; /** * Stops triggering the specified callback on the value change. * * @param onValueChangeCallback Observer that should not be triggered anymore */ unwatch: (onValueChangeCallback: OnValueChangeCallback) => void; /** * Clears all observers for this watchable excluding the ones created with [Core.Watchable.WatchOptions.clearable]: false. */ clear: () => void; /** * Locks the watchable from mutations. The value becomes readonly. * @hidden */ lock: (key: string) => void; /** * Unlocks the watchable. The value becomes mutable again. * @hidden */ unlock: (key: string) => void; } interface ReadonlyWatchable extends Watchable { } interface BaseBusEvent { name: string; } interface ListenerOptions { /** * Whether a listener should be invoked at most once after being added. * The default value is false. */ once?: boolean; /** * A function that returns a boolean to determine if the listener should be called. * The guard not set by default. * * @since 5.1.0 */ guard?: (event: Extract) => boolean; /** * An AbortSignal. The listener will be removed when the abort() method of the AbortController which owns the AbortSignal is called. * See [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) for details. * * @since 5.1.0 */ signal?: AbortSignal; } type Listener = (event: Extract) => void | Promise; type AddEventListener = (event: EventName, listener: Listener, options?: ListenerOptions) => void; type RemoveEventListener = (event: EventName, listener: Listener) => void; declare enum StreamType { /** * Audio stream type. */ Audio = "audio", /** * Video stream type. */ Video = "video", /** * Screen sharing video stream type. */ ScreenVideo = "screen_video", /** * Screen sharing audio stream type. */ ScreenAudio = "screen_audio" } declare enum ContainerEvent { ModuleRegistered = "MODULE_REGISTERED" } interface ModuleRegisteredEvent extends BaseBusEvent { name: ContainerEvent.ModuleRegistered; token: Token; } type ContainerEvents = ModuleRegisteredEvent; interface Container { readonly key: string; registerModule: (module: ModuleLoader) => void; registerModules: (modules: ModuleLoader[]) => void; getModule(token: Token, required?: false): Module | undefined; getModule(token: Token, required: true): Module; getModuleAsync: (token: Token) => Promise; addEventListener: AddEventListener; removeEventListener: RemoveEventListener; } interface Token { name: string; module?: ModuleType; } interface InitModuleOptions { container: Container; key: string; } interface ModuleLoader { token: Token; options: Options; required: Token[]; setup: (initOptions: InitModuleOptions) => ModuleType; } type ModuleFactory = Options extends EmptyObject ? () => ModuleLoader : (options: Options) => ModuleLoader; interface BaseModule { /** * @hidden */ container: Container; } declare class BaseModuleImpl implements BaseModule { /** * @hidden */ container: Container; /** * @hidden */ constructor(initOptions: InitModuleOptions); } declare enum EventType { id = "id", lastReceivedMessage = "lastrx", acknowledge = "ack", message = "msg", close = "close", error = "error" } interface BaseEvent { type: EventType; seq?: number; } interface MsgCommand> extends BaseEvent { type: EventType.message; payload: Message; } type LoginIncomingMsgNames = "loginSuccessful" | "loginFailed" | "refreshOauthTokenSuccessful" | "refreshOauthTokenFailed"; type LoginOutgoingMsgNames = "login" | "loginUsingOneTimeKey" | "loginGenerateOneTimeKey" | "refreshOauthToken"; declare enum TransportCloseCodes { Normal = 1000, /** * Internal ws error code. Should be fired only by server or websocket */ CloseAbnormal = 1006, WrongSeq = 4001, ServerError = 4002, ClientError = 4003, Timeout = 4004, NotConnected = 4005 } type Mids = Record; declare global { interface Navigator { getBattery?: () => Promise; } } interface BatteryManager extends EventTarget { level: number; charging: boolean; chargingTime: number; dischargingTime: number; } type MediaEventIncomingMsgNames = "handleReInvite" | "handleSIPInfo" | "handleAcceptReinvite" | "handleRejectReinvite"; type MediaEventOutgoingMsgNames = "AcceptReInvite" | "sendSIPInfo" | "ReInvite"; type EndpointType = "call"; interface ReInviteCause { id: EndpointId; displayName: string; username: string; place: number; sipURI: string; event: MIMEType; } interface EndpointInfo { mids: Mids; tracks: Record; place: number; type: EndpointType; } interface ReInviteScheme { conferenceCall: boolean; politeIndex: number; endpoints: Record; reinviteCauses: ReInviteCause[]; } type ReInviteSchemeWithOptionalCauses = ReInviteScheme & { reinviteCauses?: ReInviteCause[]; }; type ConferenceIncomingMsgNames = "handleConnectionConnected" | "handleConnectionFailed" | "handleConnectionDisconnected"; type ConferenceOutgoingMsgName = "callConference" | "disconnectCall"; type CallIncomingMsgNames = "handleConnectionConnected" | "handleConnectionFailed" | "handleConnectionDisconnected" | "handleRingOut" | "startEarlyMedia" | "stopRinging" | "handleIncomingConnection" | "onICEConfig" | "handleTransferStarted" | "handleTransferComplete" | "handleTransferFailed"; type CallOutgoingMsgName = "createCall" | "disconnectCall" | "rejectCall" | "confirmIncomingConnection" | "acceptCall" | "transferCall"; type SmartQueueIncomingMsgNames = "onACDStatus" | "SQMessagingStatusUpdated" | "onSQStatusError"; type SmartQueueOutgoingMsgName = "getOperatorACDStatus" | "getOperatorMessagingStatus" | "setOperatorACDStatus" | "setOperatorMessagingStatus"; type PushServiceIncomingMsgNames = "registerPushTokenResult" | "unregisterPushTokenResult"; type PushServiceOutgoingMsgName = "registerPushToken" | "unregisterPushToken" | "pushFeedback"; type BaseInternalRPCMsg> = MsgCommand<{ kind: "rpc"; name: Name; params: Params; }>; type BaseIncomingRPCMsgNames = "__pong" | "__createConnection"; type BaseOutgoingRPCMsgNames = "__ping"; type AnyIncomingRPCMsgNames = BaseIncomingRPCMsgNames | LoginIncomingMsgNames | ConferenceIncomingMsgNames | CallIncomingMsgNames | MediaEventIncomingMsgNames | SmartQueueIncomingMsgNames | PushServiceIncomingMsgNames; type AnyOutgoingRPCMsgNames = BaseOutgoingRPCMsgNames | LoginOutgoingMsgNames | ConferenceOutgoingMsgName | CallOutgoingMsgName | MediaEventOutgoingMsgNames | SmartQueueOutgoingMsgName | PushServiceOutgoingMsgName; type AnyRPCMsgNames = AnyIncomingRPCMsgNames | AnyOutgoingRPCMsgNames; declare const WEB_SDK_ERROR_SYMBOL: unique symbol; declare class WebSDKError extends Error { /** * @hidden */ [WEB_SDK_ERROR_SYMBOL]?: boolean; /** * Because of using class in different modules (bundled js files) need to override instanceof operator - * different physical instances of the class in different modules should be treated as the same class * @hidden */ static [Symbol.hasInstance](instance: unknown): instance is WebSDKError; } declare enum EventType$1 { id = "id", lastReceivedMessage = "lastrx", acknowledge = "ack", message = "msg", close = "close", error = "error" } interface BaseEvent$1 { type: EventType$1; seq?: number; } interface MsgCommand$1> extends BaseEvent$1 { type: EventType$1.message; payload: Message; } interface LoginTokens { /** * Time in seconds for the access token to expire. */ accessExpire: number; /** * Access token that can be used before accessExpire. */ accessToken: string; /** * Time in seconds for the refresh token to expire. */ refreshExpire: number; /** * Refresh token that can be used one time before refreshExpire. */ refreshToken: string; } type LoginIncomingMsgNames$1 = "loginSuccessful" | "loginFailed" | "refreshOauthTokenSuccessful" | "refreshOauthTokenFailed"; type LoginOutgoingMsgNames$1 = "login" | "loginUsingOneTimeKey" | "loginGenerateOneTimeKey" | "refreshOauthToken"; interface LoginGenerateOneTimeKeyParams { username: string; } type LoginGenerateOneTimeKey = BaseInternalRPCMsg$1<"loginGenerateOneTimeKey", LoginGenerateOneTimeKeyParams>; interface LoginPasswordParams { username: string; password: string; options: { credentialType: "md5"; deviceToken?: string; }; } interface LoginOtkParams { username: string; hash: string; options: { deviceToken?: string; }; } type Login = BaseInternalRPCMsg$1<"login", LoginPasswordParams | LoginAccessTokenParams>; interface LoginAccessTokenParams { username: string; options: { accessToken: string; deviceToken?: string; }; } type loginUsingOneTimeKey = BaseInternalRPCMsg$1<"loginUsingOneTimeKey", LoginOtkParams>; interface LoginSuccessfulParams { displayName: string; params: { OAuth: LoginTokens; connectionId: string; iceConfig: RTCConfiguration; }; } type LoginSuccessful = BaseInternalRPCMsg$1<"loginSuccessful", LoginSuccessfulParams>; interface LoginFailedParams { code: number; extra: string; } type LoginFailed = BaseInternalRPCMsg$1<"loginFailed", LoginFailedParams>; interface RefreshOauthTokenParams { username: string; options: { refreshToken: string; deviceToken: string; }; } type RefreshOauthToken = BaseInternalRPCMsg$1<"refreshOauthToken", RefreshOauthTokenParams>; interface RefreshOauthTokenSuccessfulParams { OAuth: LoginTokens; } type RefreshOauthTokenSuccessful = BaseInternalRPCMsg$1<"refreshOauthTokenSuccessful", RefreshOauthTokenSuccessfulParams>; interface RefreshOauthTokenFailedParams { code: number; } type RefreshOauthTokenFailed = BaseInternalRPCMsg$1<"refreshOauthTokenFailed", RefreshOauthTokenFailedParams>; type AnyLoginIncomingMsg = LoginSuccessful | LoginFailed | RefreshOauthTokenSuccessful | RefreshOauthTokenFailed; type AnyLoginOutgoingMsg = Login | loginUsingOneTimeKey | LoginGenerateOneTimeKey | RefreshOauthToken; type MediaEventIncomingMsgNames$1 = "handleReInvite" | "handleSIPInfo" | "handleAcceptReinvite" | "handleRejectReinvite"; type MediaEventOutgoingMsgNames$1 = "AcceptReInvite" | "sendSIPInfo" | "ReInvite"; type EndpointType$1 = "call"; interface ReInviteCause$1 { id: EndpointId; displayName: string; username: string; place: number; sipURI: string; event: MIMEType; } interface EndpointInfo$1 { mids: Mids; tracks: Record; place: number; type: EndpointType$1; } interface ReInviteScheme$1 { conferenceCall: boolean; politeIndex: number; endpoints: Record; reinviteCauses: ReInviteCause$1[]; } interface HandleReInviteParams { id: string; headers: SipHeaders; sdp: string; scheme: ReInviteScheme$1; } type HandleReInvite = BaseInternalRPCMsg<"handleReInvite", HandleReInviteParams>; interface HandleAcceptReinviteParams { id: string; headers: SipHeaders; sdp: string; scheme: ReInviteScheme$1; } type HandleAcceptReinvite = BaseInternalRPCMsg<"handleAcceptReinvite", HandleAcceptReinviteParams>; interface HandleRejectReinviteParams { id: string; headers: SipHeaders; sdp: string; } type HandleRejectReinvite = BaseInternalRPCMsg<"handleRejectReinvite", HandleRejectReinviteParams>; interface AcceptReInviteParams { id: string; headers: SipHeaders; sdp: string; midData: { mids: Record; }; } type AcceptReInvite = BaseInternalRPCMsg<"AcceptReInvite", AcceptReInviteParams>; interface ReInviteParams { id: string; headers: SipHeaders; sdp: string; extraData: { mids: Record; iceRestart?: boolean; }; } type ReInvite = BaseInternalRPCMsg<"ReInvite", ReInviteParams>; interface SIPInfoParams { id: string; mimeType: MIMEType; body: string; headers: SipHeaders; } type SendSIPInfo = BaseInternalRPCMsg<"sendSIPInfo", SIPInfoParams>; type HandleSIPInfo = BaseInternalRPCMsg<"handleSIPInfo", SIPInfoParams>; type AnyMediaIncomingMsg = HandleReInvite | HandleSIPInfo | HandleAcceptReinvite | HandleRejectReinvite; type AnyMediaOutgoingMsg = AcceptReInvite | SendSIPInfo | ReInvite; type ConferenceIncomingMsgNames$1 = "handleConnectionConnected" | "handleConnectionFailed" | "handleConnectionDisconnected"; type ConferenceOutgoingMsgName$1 = "callConference" | "disconnectCall"; interface CallConferenceParams { id: string; number: string; headers: Record; sdp: string; midData: { mids: Record; }; isVideo: boolean; } interface ConnectionConnectedHeaders { "VI-Call-ID": string; "VI-Session-ID": string; [otherHeaderKey: string]: string; } interface HandleConnectionConnectedParams { id: string; headers: ConnectionConnectedHeaders; sdp: string; endpointName: string[]; scheme: Partial; } interface HandleConnectionDisconnectedParams { id: string; headers: Record; params: { answeredElsewhere: boolean; }; } interface HandleConnectionFailedParams { id: string; code: number; reason: string; headers: Record; } type HandleConnectionConnected = BaseInternalRPCMsg$1<"handleConnectionConnected", HandleConnectionConnectedParams>; type HandleConnectionDisconnected = BaseInternalRPCMsg$1<"handleConnectionDisconnected", HandleConnectionDisconnectedParams>; type HandleConnectionFailed = BaseInternalRPCMsg$1<"handleConnectionFailed", HandleConnectionFailedParams>; type CallConference = BaseInternalRPCMsg$1<"callConference", CallConferenceParams>; interface DisconnectCallParams { id: string; headers: Record; } type DisconnectCall = BaseInternalRPCMsg$1<"disconnectCall", DisconnectCallParams>; type AnyConferenceIncomingMsg = HandleConnectionConnected | HandleConnectionDisconnected | HandleConnectionFailed; type AnyConferenceOutgoingMsg = CallConference | DisconnectCall; type CallIncomingMsgNames$1 = "handleConnectionConnected" | "handleConnectionFailed" | "handleConnectionDisconnected" | "handleRingOut" | "startEarlyMedia" | "stopRinging" | "handleIncomingConnection" | "onICEConfig" | "handleTransferStarted" | "handleTransferComplete" | "handleTransferFailed"; type CallOutgoingMsgName$1 = "createCall" | "disconnectCall" | "rejectCall" | "confirmIncomingConnection" | "acceptCall" | "transferCall"; interface HandleRingOutParams { id: string; } type HandleRingOut = BaseInternalRPCMsg$1<"handleRingOut", HandleRingOutParams>; interface StartEarlyMediaParams { id: string; headers: SipHeaders; sdp: string; scheme: ReInviteSchemeWithOptionalCauses; } type StartEarlyMedia = BaseInternalRPCMsg$1<"startEarlyMedia", StartEarlyMediaParams>; interface StopRingingParams { id: string; } type StopRinging = BaseInternalRPCMsg$1<"stopRinging", StopRingingParams>; interface ReInviteDescription { mids: Record; } interface CreateCallParams { number: string; isVideo: boolean; id: string; headers: Record; sdp: string; reInviteDescription: ReInviteDescription; } type CreateCall = BaseInternalRPCMsg$1<"createCall", CreateCallParams>; interface ConfirmIncomingConnectionParams { id: string; } type ConfirmIncomingConnection = BaseInternalRPCMsg$1<"confirmIncomingConnection", ConfirmIncomingConnectionParams>; interface AcceptCallParams { id: string; headers: Record; sdp: string; reInviteDescription: ReInviteDescription; } type AcceptCall = BaseInternalRPCMsg$1<"acceptCall", AcceptCallParams>; interface RejectCallParams { id: string; considerForking: boolean; headers: Record; } type RejectCall = BaseInternalRPCMsg$1<"rejectCall", RejectCallParams>; interface TransferCallParams { call1Id: string; call2Id: string; } type TransferCall = BaseInternalRPCMsg$1<"transferCall", TransferCallParams>; type HandleTransferStarted = BaseInternalRPCMsg$1<"handleTransferStarted">; interface HandleTransferCompleteParams { id: string; } type HandleTransferComplete = BaseInternalRPCMsg$1<"handleTransferComplete", HandleTransferCompleteParams>; interface HandleTransferFailedParams { id: string; } type HandleTransferFailed = BaseInternalRPCMsg$1<"handleTransferFailed", HandleTransferFailedParams>; interface HandleIncomingConnectionParams { id: string; callerId: string; displayName: string; headers: Record; sdp: string; scheme: ReInviteSchemeWithOptionalCauses; } type HandleIncomingConnection = BaseInternalRPCMsg$1<"handleIncomingConnection", HandleIncomingConnectionParams>; interface OnICEConfigParams { id: string; config: RTCIceServer[]; } type OnICEConfig = BaseInternalRPCMsg$1<"onICEConfig", OnICEConfigParams>; type AnyCallIncomingMsg = HandleRingOut | HandleIncomingConnection | StartEarlyMedia | StopRinging | OnICEConfig | HandleTransferStarted | HandleTransferComplete | HandleTransferFailed; type AnyCallOutgoingMsg = CreateCall | RejectCall | ConfirmIncomingConnection | AcceptCall | TransferCall; type SmartQueueIncomingMsgNames$1 = "onACDStatus" | "SQMessagingStatusUpdated" | "onSQStatusError"; type SmartQueueOutgoingMsgName$1 = "getOperatorACDStatus" | "getOperatorMessagingStatus" | "setOperatorACDStatus" | "setOperatorMessagingStatus"; interface getOperatorACDStatusParams { requestId: string; } type getOperatorACDStatus = BaseInternalRPCMsg$1<"getOperatorACDStatus", getOperatorACDStatusParams>; interface getOperatorMessagingStatusParams { requestId: string; } type getOperatorMessagingStatus = BaseInternalRPCMsg$1<"getOperatorMessagingStatus", getOperatorMessagingStatusParams>; interface onACDStatusParams { connectionId: string; status: string; requestId: string; description: string; } type onACDStatus = BaseInternalRPCMsg$1<"onACDStatus", onACDStatusParams>; interface SQMessagingStatusUpdatedParams { connectionId: string; status: string; requestId: string; description: string; } type SQMessagingStatusUpdated = BaseInternalRPCMsg$1<"SQMessagingStatusUpdated", SQMessagingStatusUpdatedParams>; interface onSQStatusErrorParams { connectionId: string; requestId: string; code: number; description: string; } type onSQStatusError = BaseInternalRPCMsg$1<"onSQStatusError", onSQStatusErrorParams>; interface setOperatorACDStatusParams { status: string; requestId: string; permanent: boolean; } type setOperatorACDStatus = BaseInternalRPCMsg$1<"setOperatorACDStatus", setOperatorACDStatusParams>; interface setOperatorMessagingStatusParams { status: string; requestId: string; permanent: boolean; } type setOperatorMessagingStatus = BaseInternalRPCMsg$1<"setOperatorMessagingStatus", setOperatorMessagingStatusParams>; type AnySmartQueueIncomingMsg = onACDStatus | SQMessagingStatusUpdated | onSQStatusError; type AnySmartQueueOutgoingMsg = getOperatorACDStatus | getOperatorMessagingStatus | setOperatorACDStatus | setOperatorMessagingStatus; type PushServiceIncomingMsgNames$1 = "registerPushTokenResult" | "unregisterPushTokenResult"; type PushServiceOutgoingMsgName$1 = "registerPushToken" | "unregisterPushToken" | "pushFeedback"; interface RegisterPushTokenParams { token: string; bundle: string; requestId: string; } type RegisterPushToken = BaseInternalRPCMsg$1<"registerPushToken", RegisterPushTokenParams>; interface UnregisterPushTokenParams { token: string; bundle: string; requestId: string; } type UnregisterPushToken = BaseInternalRPCMsg$1<"unregisterPushToken", UnregisterPushTokenParams>; type PushFeedbackParams = Record; type PushFeedback = BaseInternalRPCMsg$1<"pushFeedback", PushFeedbackParams>; interface RegisterPushTokenResultParams { msg: string; params: string; status: "OK" | "ERROR"; token: string; } type RegisterPushTokenResult = BaseInternalRPCMsg$1<"registerPushTokenResult", RegisterPushTokenResultParams>; interface UnregisterPushTokenResultParams { msg: string; params: string; status: "OK" | "ERROR"; token: string; } type UnregisterPushTokenResult = BaseInternalRPCMsg$1<"unregisterPushTokenResult", UnregisterPushTokenResultParams>; type AnyPushServiceIncomingMsg = RegisterPushTokenResult | UnregisterPushTokenResult; type AnyPushServiceOutgoingMsg = RegisterPushToken | UnregisterPushToken | PushFeedback; type BaseInternalRPCMsg$1> = MsgCommand$1<{ kind: "rpc"; name: Name; params: Params; }>; type BaseIncomingRPCMsgNames$1 = "__pong" | "__createConnection"; type BaseOutgoingRPCMsgNames$1 = "__ping"; type AnyIncomingRPCMsgNames$1 = BaseIncomingRPCMsgNames$1 | LoginIncomingMsgNames$1 | ConferenceIncomingMsgNames$1 | CallIncomingMsgNames$1 | MediaEventIncomingMsgNames$1 | SmartQueueIncomingMsgNames$1 | PushServiceIncomingMsgNames$1; type AnyOutgoingRPCMsgNames$1 = BaseOutgoingRPCMsgNames$1 | LoginOutgoingMsgNames$1 | ConferenceOutgoingMsgName$1 | CallOutgoingMsgName$1 | MediaEventOutgoingMsgNames$1 | SmartQueueOutgoingMsgName$1 | PushServiceOutgoingMsgName$1; type AnyRPCMsgNames$1 = AnyIncomingRPCMsgNames$1 | AnyOutgoingRPCMsgNames$1; type Ping = BaseInternalRPCMsg$1<"__ping", EmptyObject>; type Pong = BaseInternalRPCMsg$1<"__pong", EmptyObject>; type CreateConnection = BaseInternalRPCMsg$1<"__createConnection", EmptyObject>; type AnyBaseIncomingRPC = Pong | CreateConnection; type AnyBaseOutgoingRPC = Ping; type BaseOutgoingMessagingAction = MsgCommand$1<{ kind: "messaging"; service: "chat"; event: ActionName; payload: Payload; request_uuid: UUID; }>; type BaseIncomingMessagingEvent = MsgCommand$1<{ kind?: "messaging"; service: "chat"; event: Name; payload: Payload; request_uuid: UUID; to: MessagingUserName; toId: MessagingUserId[]; version: string; connid?: string | null; }>; type UnknownOutgoingMessagingAction = BaseOutgoingMessagingAction; type UnknownIncomingMessagingEvent = BaseIncomingMessagingEvent; type AnyOutgoingRPCMsg = AnyBaseOutgoingRPC | AnyLoginOutgoingMsg | AnyConferenceOutgoingMsg | AnyCallOutgoingMsg | AnyMediaOutgoingMsg | AnySmartQueueOutgoingMsg | AnyPushServiceOutgoingMsg; type AnyOutgoingMessage = AnyOutgoingRPCMsg | UnknownOutgoingMessagingAction; type AnyOutgoingMessagePayload = AnyOutgoingMessage["payload"]; type AnyIncomingRPCMsg = AnyBaseIncomingRPC | AnyLoginIncomingMsg | AnyConferenceIncomingMsg | AnyCallIncomingMsg | AnyMediaIncomingMsg | AnySmartQueueIncomingMsg | AnyPushServiceIncomingMsg; type AnyIncomingMessage = AnyIncomingRPCMsg | UnknownIncomingMessagingEvent; type AnyMessage = AnyOutgoingMessage | AnyIncomingMessage; declare enum ConnectionState { Disconnecting = "DISCONNECTING", Disconnected = "DISCONNECTED", Connecting = "CONNECTING", Connected = "CONNECTED", Reconnecting = "RECONNECTING" } type RegisterMessageAwaiterScope = "rpc" | "messaging"; /** * Connection options. */ export interface ConnectionOptions { /** * * Array of the media gateway servers for connection. The default value is an empty array. */ servers?: string[]; /** * Whether the SDK should try to reconnect to the Voximplant Cloud if the connection has been lost for some reason. * The default value is true. */ autoReconnect?: boolean; /** * Node the Voximplant account belongs to. * * Find more information about [Core.ConnectionNode] in the [getting started guide](/docs/getting-started/platform/web). */ node: ConnectionNode; } /** * @hidden */ export interface ConnectionEventAwaiter { resolver: (value: unknown) => void; value: unknown; timeout: number; } /** * @hidden */ export interface Connection extends BaseModule { node: ConnectionNode; servers: string[]; autoReconnect: boolean; state: ReadonlyWatchable; iceConfig: Watchable; connect: (options: ConnectionOptions) => Promise; disconnect: (code?: TransportCloseCodes, reason?: string) => Promise; sendMessage: (message: AnyOutgoingMessagePayload) => void; subscribeMessage: (message: MessageName, callback: (message: Extract) => void | Promise) => void; unsubscribeMessage: (messageName: MessageName, subscriber: (message: Extract) => void | Promise) => void; registerMessageAwaiter: (messageName: MessageName, timeout: number, scope?: RegisterMessageAwaiterScope) => { promise: Promise | Error>; unregister: () => void; }; onIncomingMessagingEvent?: ((message: UnknownIncomingMessagingEvent) => void | Promise) | null; } /** * @hidden */ export declare const connectionToken: Token; /** * Enum that contains the nodes the Voximplant account may belong to. * * You can find more information about nodes in the [getting started](/docs/getting-started/platform/web) section. */ export declare enum ConnectionNode { NODE_1 = "NODE_1", NODE_2 = "NODE_2", NODE_3 = "NODE_3", NODE_4 = "NODE_4", NODE_5 = "NODE_5", NODE_6 = "NODE_6", NODE_7 = "NODE_7", NODE_8 = "NODE_8", NODE_9 = "NODE_9", NODE_10 = "NODE_10", NODE_11 = "NODE_11", /** * @since 5.1.0 */ NODE_12 = "NODE_12", /** * @since 5.2.0 */ NODE_13 = "NODE_13" } /** * @hidden */ export declare const ConnectionLoader: ModuleFactory; /** * @hidden */ export declare class ConnectionImpl extends BaseModuleImpl implements Connection { node: ConnectionNode; servers: string[]; autoReconnect: boolean; state: ReadonlyWatchable; iceConfig: Watchable; closeCode: TransportCloseCodes | null; onIncomingMessagingEvent?: ((message: UnknownIncomingMessagingEvent) => void | Promise) | null; private readonly logger; private currentTransportHost; private currentConnectionId; private localClock; private remoteClock; private readonly lastAcknoladgedByRemote; private transport; private readonly messagePool; private readonly awaiters; private readonly messageSubscribers; private reconnectingPromise; private connectionPromise; private readonly connectionPromiseStatus; private connectionPromiseRejector; private readonly pinger; private disconnectPromise; private disconnectPromiseResolver; private lastAckClockSend; constructor(initOptions: InitModuleOptions); connect(options: ConnectionOptions): Promise; disconnect(code?: TransportCloseCodes, reason?: string): Promise; resolveDisconnectRoutine(): Promise; disconnectRoutine(code?: TransportCloseCodes, reason?: string): Promise; sendMessage(message: AnyOutgoingMessagePayload): void; subscribeMessage(message: MessageName, callback: (message: Extract) => void | Promise): void; unsubscribeMessage(messageName: MessageName, subscriber: (message: Extract) => void | Promise): void; registerMessageAwaiter(messageName: MessageName, timeout: number, scope?: RegisterMessageAwaiterScope): { promise: Promise | Error>; unregister: () => void; }; private initStateWatcher; private lastConnectTraceId; private connectRoutine; private clearTransport; private sendCommand; private requestSocketFromBalancer; private logTransportMessage; private transportMessageHandler; private transportCloseHandler; private createTransport; /** * @description creates promise to await event with path and options.value on it. * Resolves with error on options.timeout. Never throw error/rejects due possible side effects with * unhandled exceptions routine * @param path path to value to watch. Leave options.value === undefined if no need value check, only key needed * @param options * @return Full event message or Error on timeout * @private * @hidden */ private registerAwaiter; private resolveAwaiters; private validateSeq; private checkConnectionId; private processError; /** * @description clear all unprocessed by remote messages * @param seq * @private */ private processAck; private validateConnectionId; private processLastRx; private sendACK; private forceSendAck; private sendACKRoutine; private processMsg; private notifySubscribers; private prepareIncomingMsg; private attemptReconnect; private untilAcknowledged; private reconnect; private resetConnectionState; } /** * Error object that is the base for all connection errors. * * @folder ConnectionErrors * @hideconstructor */ export declare class ConnectionError extends WebSDKError { } /** * Thrown if the connection to the Voximplant Cloud has not completed in time. * * @folder ConnectionErrors * @hideconstructor */ export declare class ConnectionTimeoutError extends ConnectionError { constructor(reason?: string); } /** * Thrown if an internal error has occurred. * * @folder ConnectionErrors * @hideconstructor */ export declare class ConnectionInternalError extends ConnectionError { constructor(reason?: string); } /** * Thrown if the connection to the Voximplant Cloud is closed due to network issues. * * @folder ConnectionErrors * @hideconstructor */ export declare class ConnectionNetworkError extends ConnectionError { constructor(reason?: string); } /** * Thrown if the connection to the Voximplant Cloud is closed because the [Core.Client.disconnect] API is called. * * @folder ConnectionErrors * @hideconstructor */ export declare class ConnectionInterruptedError extends ConnectionError { constructor(reason?: string); } export {};