type ObjectKey = string | number | symbol; type EmptyObject = Record; 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 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 global { interface Navigator { getBattery?: () => Promise; } } interface BatteryManager extends EventTarget { level: number; charging: boolean; chargingTime: number; dischargingTime: number; } /** * @folder Events * @event */ export declare enum SmartQueueEvent { /** * Triggered when the contact center agent's call status changes via the SDK or within the contact center. * @cast SmartQueue.Events.CallStatusUpdatedPayload */ CallStatusUpdated = "CallStatusUpdated", /** * Triggered when the contact center agent's messaging status changes via the SDK or via * the SmartQueue messaging service inner logic. * @cast SmartQueue.Events.MessagingStatusUpdatedPayload */ MessagingStatusUpdated = "MessagingStatusUpdated", /** * Triggered when a contact center agent's call status update has failed. * @cast SmartQueue.Events.CallStatusUpdateFailedPayload */ CallStatusUpdateFailed = "CallStatusUpdateFailed", /** * Triggered when a contact center agent's messaging status update has failed. * @cast SmartQueue.Events.MessagingStatusUpdateFailedPayload */ MessagingStatusUpdateFailed = "MessagingStatusUpdateFailed" } /** * @hidden */ export interface BaseSmartQueueEvent extends BaseBusEvent { name: Name; payload: Payload; } /** * @folder Events */ export interface CallStatusUpdatedPayload { /** * Current call status of the contact center agent. */ status: SmartQueueStatus; /** * Additional information. */ description?: string; } /** * @folder Events */ export interface CallStatusUpdated extends BaseSmartQueueEvent { } /** * @folder Events */ export interface MessagingStatusUpdatedPayload { /** * Current messaging status of the contact center agent. */ status: SmartQueueStatus; /** * Additional information. */ description?: string; } /** * @folder Events */ export interface MessagingStatusUpdated extends BaseSmartQueueEvent { } /** * @folder Events */ export interface CallStatusUpdateFailedPayload { /** * Reason why the call status update of a contact center agent has failed. */ description: string; } /** * @folder Events */ export interface CallStatusUpdateFailed extends BaseSmartQueueEvent { } /** * @folder Events */ export interface MessagingStatusUpdateFailedPayload { /** * Reason why the messaging status update of a contact center agent has failed. */ description: string; } /** * @folder Events */ export interface MessagingStatusUpdateFailed extends BaseSmartQueueEvent { } /** * @folder Events */ export type AnySmartQueueEvent = CallStatusUpdated | MessagingStatusUpdated | CallStatusUpdateFailed | MessagingStatusUpdateFailed; /** * Enum that represents SmartQueue statuses that can be set by an agent. * * Use the [SmartQueue.SmartQueue.setCallStatus] method to set the status for calls and * the [SmartQueue.SmartQueue.setMessagingStatus] method to set the status for messaging. */ export declare enum SmartQueueAgentStatus { /** * Agent is offline. */ Offline = "OFFLINE", /** * Agent is logged in, but not ready to handle incoming calls and chats yet. */ Online = "ONLINE", /** * Agent is ready to handle incoming calls and chats. */ Ready = "READY", /** * Agent is in Do Not Disturb state and not ready to handle incoming calls or chats (e.g., working on another call). */ DND = "DND" } /** * Enum that represents custom SmartQueue statuses that can be set by an agent. * * Use the [SmartQueue.SmartQueue.setCallStatus] method to set the status for calls and * the [SmartQueue.SmartQueue.setMessagingStatus] method to set the status for messaging. * * Refer to the [SmartQueue](/docs/guides/contact-center/voice) article to learn more about custom statuses. */ export declare enum SmartQueueCustomStatus { CustomStatus_1 = "CUSTOM_1", CustomStatus_2 = "CUSTOM_2", CustomStatus_3 = "CUSTOM_3", CustomStatus_4 = "CUSTOM_4", CustomStatus_5 = "CUSTOM_5", CustomStatus_6 = "CUSTOM_6", CustomStatus_7 = "CUSTOM_7", CustomStatus_8 = "CUSTOM_8", CustomStatus_9 = "CUSTOM_9", CustomStatus_10 = "CUSTOM_10" } /** * Enum that represents SmartQueue statuses that are automatically assigned * and cannot be manually selected. */ export declare enum SmartQueueSystemStatus { /** * Agent has intentionally declined or ignored an incoming call from a queue within the specified timeout. * * You may implement your own logic on how to return to the Online status. */ Banned = "BANNED", /** * Agent currently has an incoming call, which he has not yet answered or declined. */ Dialing = "DIALING", /** * Incoming call is in service. */ InService = "IN_SERVICE", /** * Incoming call has ended and now an agent is processing after service work. */ AfterService = "AFTER_SERVICE" } /** * Type that represents the union of all SmartQueue statuses. */ export type SmartQueueStatus = SmartQueueAgentStatus | SmartQueueCustomStatus | SmartQueueSystemStatus; /** * @interface * @internal * * Registers a handler for the specified event. * * One event can have more than one handler; handlers are executed in order of their registration. */ export type DocSmartQueueAddEventListener = ( /** * Event name */ eventName: SmartQueueEvent, /** * Handler function that is triggered when an event of the specified type occurs */ listener: (event: AnySmartQueueEvent) => void | Promise, /** * Object that specifies characteristics about the event listener */ options: ListenerOptions) => void; /** * @interface * @internal */ export type DocSmartQueueRemoveEventListener = ( /** * Event name */ eventName: SmartQueueEvent, /** * Handler function to remove from the event target */ listener: (event: AnySmartQueueEvent) => void | Promise) => void; export interface SmartQueue extends BaseModule { /** * Watchable property that allows getting the current SmartQueue call status and observing its changes. */ callStatus: ReadonlyWatchable; /** * Watchable property that allows getting the current SmartQueue messaging status and observing its changes. */ messagingStatus: ReadonlyWatchable; /** * Sets the agent's status for SmartQueue contact center. */ setCallStatus: ( /** * SmartQueue call status */ nextStatus: SmartQueueAgentStatus | SmartQueueCustomStatus, /** * Options for setting a status * @since 5.2.0 */ options?: SetSmartQueueStatusOptions) => void; /** * Sets the SmartQueue messaging status. * @param nextStatus SmartQueue messaging status */ setMessagingStatus: ( /** * SmartQueue messaging status */ nextStatus: SmartQueueAgentStatus | SmartQueueCustomStatus, /** * Options for setting a status * @since 5.2.0 */ options?: SetSmartQueueStatusOptions) => void; /** * @reinterpret SmartQueue.DocSmartQueueAddEventListener */ addEventListener: AddEventListener; /** * @reinterpret SmartQueue.DocSmartQueueRemoveEventListener */ removeEventListener: RemoveEventListener; } /** * Options for setting a SmartQueue call and messaging status. * @since 5.2.0 */ export interface SetSmartQueueStatusOptions { /** * Whether to set the status permanently. The default value is false. */ permanent?: boolean; } /** * @hidden */ export declare class SmartQueueImpl extends BaseModuleImpl implements SmartQueue { private readonly logger?; private readonly connection; private readonly loginModule; callStatus: ReadonlyWatchable; messagingStatus: ReadonlyWatchable; private readonly requestIdToStatusType; addEventListener: AddEventListener; removeEventListener: RemoveEventListener; private readonly dispatchEvent; constructor(initModuleOptions: InitModuleOptions); private initStatesWatchers; private delayedRemoveRequest; private initEventsListeners; setCallStatus(nextStatus: SmartQueueAgentStatus | SmartQueueCustomStatus, options?: SetSmartQueueStatusOptions): void; setMessagingStatus(nextStatus: SmartQueueAgentStatus | SmartQueueCustomStatus, options?: SetSmartQueueStatusOptions): void; private syncStatuses; private getCallStatus; private getMessagingStatus; } /** * @function * * SmartQueue module loader. * * Use this function to register the module via the [Core.Core.registerModules] method. */ export declare const SmartQueueLoader: ModuleFactory; /** * SmartQueue module token. * * Use this token to obtain the module via the [Core.Core.getModule] or [Core.Core.getModuleAsync] method. */ export declare const smartQueueToken: Token; export {};