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AS,CAAC,GAOX,OAHAC,EAAoBH,GAAUhG,EAAQA,EAAOkG,QAASH,GAG/C/F,EAAOkG,OACf,C,uBCtBA,eAUA,eAQA,eACA,eACA,eACA,eACA,eACA,SACA,eACA,cACA,eACA,eACA,aACA,eACA,eACA,eACA,cACA,eACA,eACA,eACA,eACA,eACA,eAkFA,MAAM7M,EAAS,EAAA7B,UAAU8B,kBAAoB,EAAA9B,UAAUyM,oBACvD5K,EAAMiM,uBAAyB,EAAAA,uBAC/BjM,EAAMkM,UAAY,EAAAA,UAClBlM,EAAMmM,gBAAkB,EAAAA,gBACxBnM,EAAMqM,kBAAoB,EAAAA,kBAC1BrM,EAAMsM,iBAAmB,EAAAA,iBACzBtM,EAAMvD,eAAiB,EAAAA,eAEvB,UAAe,CAMXyD,IAAK,IAAI,EAAAR,eAETuM,uBAAwB,EAAAA,uBAExBC,UAAW,EAAAA,UAEXC,gBAAiB,EAAAA,gBAEjBE,kBAAmB,EAAAA,kBAEnBC,iBAAkB,EAAAA,iBAElB7P,eAAgB,EAAAA,e","sources":["webpack://unblu.floating/./src/internal/internal-api.ts","webpack://unblu.floating/./src/internal/module/general-lazy-module.ts","webpack://unblu.floating/./src/internal/module/general-module.ts","webpack://unblu.floating/./src/internal/module/meta-module.ts","webpack://unblu.floating/./src/model/individualui_component.ts","webpack://unblu.floating/./src/model/individualui_state.ts","webpack://unblu.floating/./src/unblu-api-ui.ts","webpack://unblu.floating/./src/unblu-api.ts","webpack://unblu.floating/./src/unblu-static-api.ts","webpack://unblu.floating/../shared/src/api-state.ts","webpack://unblu.floating/../shared/src/conversation.ts","webpack://unblu.floating/../shared/src/internal/api-bridge.ts","webpack://unblu.floating/../shared/src/internal/java-error-codes.ts","webpack://unblu.floating/../shared/src/internal/module/agent-availability-module.ts","webpack://unblu.floating/../shared/src/internal/module/base-general-module.ts","webpack://unblu.floating/../shared/src/internal/module/conversation-module.ts","webpack://unblu.floating/../shared/src/internal/module/module.ts","webpack://unblu.floating/../shared/src/internal/unblu-util.ts","webpack://unblu.floating/../shared/src/internal/util/event-emitter.ts","webpack://unblu.floating/../shared/src/model/agent-availability-state.ts","webpack://unblu.floating/../shared/src/model/call-state.ts","webpack://unblu.floating/../shared/src/model/connection-state.ts","webpack://unblu.floating/../shared/src/model/conversation-recipient-type.ts","webpack://unblu.floating/../shared/src/model/conversation-state.ts","webpack://unblu.floating/../shared/src/model/conversation-type.ts","webpack://unblu.floating/../shared/src/model/invitation-status.ts","webpack://unblu.floating/../shared/src/unblu-api-error.ts","webpack://unblu.floating/webpack/bootstrap","webpack://unblu.floating/./src/index.ts"],"sourcesContent":["import {ApiBridge} from '../shared/internal/api-bridge';\nimport {MetaModule} from './module/meta-module';\nimport {GeneralLazyModule} from './module/general-lazy-module';\nimport {ConversationModule} from '../shared/internal/module/conversation-module';\nimport {AgentAvailabilityModule} from '../shared/internal/module/agent-availability-module';\nimport {GeneralModule} from \"./module/general-module\";\nimport {Configuration} from \"../unblu-static-api\";\n\nexport class InternalApi {\n public readonly meta: MetaModule;\n public readonly general: GeneralModule;\n public readonly generalLazy: GeneralLazyModule;\n public readonly conversation: ConversationModule;\n public readonly agentAvailability: AgentAvailabilityModule;\n\n constructor(private readonly bridge: ApiBridge, public readonly configuration: Configuration) {\n this.meta = new MetaModule(bridge);\n this.general = new GeneralModule(bridge);\n this.generalLazy = new GeneralLazyModule(bridge);\n this.conversation = new ConversationModule(bridge);\n this.agentAvailability = new AgentAvailabilityModule(bridge);\n }\n\n public checkCompatibility(): void {\n this.bridge.checkCompatibility();\n }\n}","import {InternalModule} from '../../shared/internal/module/module';\nimport {ApiBridge} from '../../shared/internal/api-bridge';\nimport {PersonInfo} from '../../shared/model/person-info';\nimport {NewConversationInterceptor} from \"../../shared/new-conversation-interceptor\";\n\n\nexport type GeneralLazyEventType = '';\n\nconst enum GeneralLazyFunction {\n getNotificationCount = 'getNotificationCount',\n getPersonInfo = 'getPersonInfo',\n setNewConversationInterceptor = 'setNewConversationInterceptor',\n}\n\nexport class GeneralLazyModule extends InternalModule {\n constructor(bridge: ApiBridge) {\n super(bridge, 'generallazy');\n }\n\n public getNotificationCount(): Promise {\n return this.callApiFunction(GeneralLazyFunction.getNotificationCount, []);\n }\n\n public getPersonInfo(): Promise {\n return this.callApiFunction(GeneralLazyFunction.getPersonInfo, []);\n }\n\n public setNewConversationInterceptor(callback: NewConversationInterceptor): Promise {\n return this.callApiFunction(GeneralLazyFunction.setNewConversationInterceptor, [callback]);\n }\n}","import {IndividualUiState} from \"../../model/individualui_state\";\nimport {\n BaseGeneralEventType,\n BaseGeneralFunction,\n BaseGeneralModule\n} from \"../../shared/internal/module/base-general-module\";\nimport {ActiveIndividualUiView} from \"../../model/individualui_component\";\n\nexport type GeneralEventType =\n BaseGeneralEventType |\n 'uiStateChange' |\n 'uiActiveIndividualUiViewChange';\n\nconst enum GeneralFunction {\n toggleIndividualUi = 'toggleIndividualUi',\n popoutIndividualUi = 'popoutIndividualUi',\n popinIndividualUi = 'popinIndividualUi',\n maximizeIndividualUi = 'maximizeIndividualUi',\n minimizeIndividualUi = 'minimizeIndividualUi',\n openIndividualUi = 'openIndividualUi',\n openPinEntryUi = 'openPinEntryUi',\n openOverviewUi = 'openOverviewUi',\n collapseIndividualUi = 'collapseIndividualUi',\n getIndividualUiState = 'getIndividualUiState',\n getActiveIndividualUiView = 'getActiveIndividualUiView'\n}\n\nexport class GeneralModule extends BaseGeneralModule {\n\n public toggleIndividualUi(): Promise {\n return this.callApiFunction(GeneralFunction.toggleIndividualUi, []);\n }\n\n public openPinEntryUi(): Promise {\n return this.callApiFunction(GeneralFunction.openPinEntryUi, []);\n }\n\n public openOverviewUi(): Promise {\n return this.callApiFunction(GeneralFunction.openOverviewUi, []);\n }\n\n public popoutIndividualUi(): Promise {\n return this.callApiFunction(GeneralFunction.popoutIndividualUi, []);\n }\n\n public popinIndividualUi(): Promise {\n return this.callApiFunction(GeneralFunction.popinIndividualUi, []);\n }\n\n public maximizeIndividualUi(): Promise {\n return this.callApiFunction(GeneralFunction.maximizeIndividualUi, []);\n }\n\n public minimizeIndividualUi(): Promise {\n return this.callApiFunction(GeneralFunction.minimizeIndividualUi, []);\n }\n\n public openIndividualUi(): Promise {\n return this.callApiFunction(GeneralFunction.openIndividualUi, []);\n }\n\n public collapseIndividualUi(): Promise {\n return this.callApiFunction(GeneralFunction.collapseIndividualUi, []);\n }\n\n public getIndividualUiState(): Promise {\n return this.callApiFunction(GeneralFunction.getIndividualUiState, []);\n }\n\n public getActiveIndividualUiView(): Promise {\n return this.callApiFunction(GeneralFunction.getActiveIndividualUiView, []);\n }\n}\n","import {InternalModule} from '../../shared/internal/module/module'\nimport {ApiBridge} from '../../shared/internal/api-bridge'\n\nexport type MetaEventType =\n 'upgraded' |\n 'deinitializing' |\n 'deinitialized'\n\n\nconst enum MetaFunction {\n isUpgraded = 'isUpgraded',\n upgrade = 'upgrade',\n waitUntilInitialized = 'waitUntilInitialized',\n deinitialize = 'deinitialize'\n}\n\nexport class MetaModule extends InternalModule {\n constructor(bridge: ApiBridge) {\n super(bridge, 'meta')\n }\n\n public isUpgraded(): Promise {\n return this.callApiFunction(MetaFunction.isUpgraded, [])\n }\n\n public upgrade(openUi?: boolean): Promise {\n return this.callApiFunction(MetaFunction.upgrade, [openUi])\n }\n\n public waitUntilInitialized(): Promise {\n return this.callApiFunction(MetaFunction.waitUntilInitialized, [])\n }\n\n public deinitialize(): Promise {\n return this.callApiFunction(MetaFunction.deinitialize, [])\n }\n}","export const enum ActiveIndividualUiView {\n /**\n * The individual UI is showing the overview.\n */\n OVERVIEW = 'OVERVIEW',\n /**\n * The individual UI is showing the pin entry screen.\n */\n PIN_ENTRY = 'PIN_ENTRY',\n /**\n * The individual UI is showing messages in a conversation.\n */\n CONVERSATION_MESSAGING = 'CONVERSATION_MESSAGING',\n /**\n * The individual UI is showing the shared media view.\n */\n CONVERSATION_SHARED_MEDIA = 'CONVERSATION_SHARED_MEDIA',\n /**\n * The individual UI is showing messages in a conversation.\n */\n CONVERSATION_CALL = 'CONVERSATION_CALL',\n /**\n * The Floating Visitor UI hasn't fully initialized or active view is unknown.\n *\n * NOTE: You shouldn't rely on this option for specific views. New views added to the Unblu individual UI will show\n * as {@link UNKNOWN} at first but may be added to the enum as a specific view at some point in the future.\n */\n UNKNOWN = 'UNKNOWN'\n}\n","export const enum IndividualUiState {\n /**\n * The individual ui is open.\n */\n OPEN = 'OPEN',\n /**\n * The individual ui is collapsed.\n */\n COLLAPSED = 'COLLAPSED',\n /**\n * The individual ui is popped out.\n */\n POPPED_OUT = 'POPPED_OUT'\n}","import {InternalApi} from './internal/internal-api'\nimport {Event, EventCallback} from './shared/internal/event'\nimport {EventEmitter, Listener} from './shared/internal/util/event-emitter'\nimport {UnbluApiError, UnbluErrorType} from './shared/unblu-api-error'\nimport {IndividualUiState} from './model/individualui_state'\nimport {GeneralEventType} from \"./internal/module/general-module\"\nimport {ActiveIndividualUiView} from \"./model/individualui_component\";\n\n/**\n * Listener called whenever the UI state changes.\n * @param uistate The new UI state.\n */\nexport type UiStateChangeListener = (uistate: IndividualUiState) => void\n\n/**\n * Listener called whenever the active individual UI view changes.\n *\n * NOTE: This listener is also triggered when the view in individual UI changes, but the UI isn't\n * visible, for example, because it's collapsed.\n *\n * @param uicomponent The new individual UI component.\n */\nexport type UiActiveIndividualUiViewChangeListener = (uicomponent: ActiveIndividualUiView) => void\n\n/**\n * This class allows you to control the UI state and the Unblu individual UI.\n */\nexport class UnbluUiApi {\n\n private internalListeners: { [key: string]: EventCallback } = {}\n private eventEmitter = new EventEmitter()\n\n /**\n * Event emitted every time the state of the individual UI is changed.\n *\n * @event uiStateChange\n * @see {@link on} for listener registration\n * @see {@link UiStateChangeListener}\n */\n public static readonly UI_STATE_CHANGE: 'uiStateChange' = 'uiStateChange'\n\n /**\n * Event emitted every time individual UI view changes.\n *\n * NOTE: This event is also triggered when an individual UI view change happens, but the UI isn't\n * visible, for example, because it's collapsed.\n *\n * @event uiActiveIndividualUiViewChange\n * @see {@link on} for listener registration\n * @see {@link UiActiveIndividualUiViewChangeListener}\n */\n public static readonly UI_ACTIVE_INDIVIDUAL_UI_VIEW_CHANGE: 'uiActiveIndividualUiViewChange' = 'uiActiveIndividualUiViewChange';\n\n\n /**\n * @hidden\n */\n constructor(private internalApi: InternalApi) {\n internalApi.meta.on('upgraded', () => this.onUpgraded())\n }\n\n /**\n * Registers an event listener for the given event.\n * @param event The uistateChange event.\n * @param listener The listener to be called.\n * @see {@link UI_STATE_CHANGE}\n */\n public on(event: typeof UnbluUiApi.UI_STATE_CHANGE, listener: UiStateChangeListener): void\n\n /**\n * Registers an event listener for the given event.\n * @param event The uiOverviewOpen event.\n * @param listener The listener to be called.\n * @see {@link UI_ACTIVE_INDIVIDUAL_UI_VIEW_CHANGE}\n */\n public on(event: typeof UnbluUiApi.UI_ACTIVE_INDIVIDUAL_UI_VIEW_CHANGE, listener: UiActiveIndividualUiViewChangeListener): void\n\n public on(event: GeneralEventType, listener: Listener): void {\n const needsInternalSubscription = !this.eventEmitter.hasListeners(event)\n this.eventEmitter.on(event, listener)\n if (needsInternalSubscription)\n this.onInternal(event).catch(e => console.warn('Error registering internal listener for event:', event, 'error:' + e, e))\n }\n\n /**\n * Removes a previously registered listener\n * @param event The event to unregister from.\n * @param listener The listener to remove.\n */\n public off(event: GeneralEventType, listener: Listener): boolean {\n const removed = this.eventEmitter.off(event, listener)\n if (!this.eventEmitter.hasListeners(event))\n this.offInternal(event).catch(e => console.warn('Error removing internal listener for event:', event, 'error:' + e, e))\n return removed\n }\n\n\n private async onInternal(eventName: GeneralEventType) {\n let internalListener: EventCallback\n switch (eventName) {\n case UnbluUiApi.UI_STATE_CHANGE:\n internalListener = (event: Event) => {\n this.eventEmitter.emit(event.name, event.data)\n }\n break\n case UnbluUiApi.UI_ACTIVE_INDIVIDUAL_UI_VIEW_CHANGE:\n internalListener = (event: Event) => {\n this.eventEmitter.emit(event.name, event.data)\n }\n break\n default:\n throw new UnbluApiError(UnbluErrorType.INVALID_FUNCTION_ARGUMENTS, 'Registration to unknown event:' + eventName)\n }\n\n if (await this.internalApi.meta.isUpgraded()) {\n this.internalListeners[eventName] = internalListener\n try {\n await this.internalApi.general.on(eventName, internalListener)\n } catch (e) {\n delete this.internalListeners[eventName]\n throw e\n }\n }\n }\n\n private async offInternal(eventName: GeneralEventType) {\n const listener = this.internalListeners[eventName]\n if (listener == null) {\n return\n }\n delete this.internalListeners[eventName]\n await this.internalApi.general.off(eventName, listener)\n }\n\n\n /**\n * Opens the individual UI if it is collapsed and collapses it if it is open.\n */\n public async toggleIndividualUi(): Promise {\n await this.requireUpgrade()\n await this.internalApi.general.toggleIndividualUi()\n }\n\n /**\n * Navigates the individual UI to the PIN entry UI.\n *\n * **NOTE:** calling this method will NOT automatically open the Unblu UI if it is collapsed. Use {@link openIndividualUi} if this is needed.\n */\n public async openPinEntryUi(): Promise {\n await this.requireUpgrade()\n await this.internalApi.general.openPinEntryUi()\n }\n\n /**\n * Navigates the individual UI to the overview UI.\n *\n *

\n * Be aware that this method will force to close any currently open conversation. Depending on the conversation's configuration and the activity in it a prompt may be displayed that has to be accepted by the visitor before the navigation to the overview can happen.\n *

\n *\n * **NOTE:** calling this method will NOT automatically open the Unblu UI if it is collapsed. Use {@link openIndividualUi} if this is needed.\n */\n public async openOverviewUi(): Promise {\n console.log(\"openOverviewUi called\");\n await this.requireUpgrade();\n await this.internalApi.general.openOverviewUi();\n }\n\n\n /**\n * Pop-out the individual UI into a separate window.\n *\n * **NOTE:** this has to be called in a click-event in order to be able to open the pop-up window without being blocked by the browser!\n */\n public async popoutIndividualUi(): Promise {\n await this.requireUpgrade()\n await this.internalApi.general.popoutIndividualUi()\n }\n\n /**\n * Pop-in the individual UI when it is in [POPPED_OUT]{@link IndividualUiState.POPPED_OUT} state.\n *\n * The pop-out window will automatically close and the individual UI will be displayed in the original window again.\n */\n public async popinIndividualUi(): Promise {\n await this.requireUpgrade()\n await this.internalApi.general.popinIndividualUi()\n }\n\n /**\n * Maximize the individual UI - Does nothing if it is already maximized or popped out.\n */\n public async maximizeIndividualUi(): Promise {\n await this.requireUpgrade()\n await this.internalApi.general.maximizeIndividualUi()\n }\n\n /**\n * Minimize the individual UI - Does nothing if it is already minimized.\n */\n public async minimizeIndividualUi(): Promise {\n await this.requireUpgrade()\n await this.internalApi.general.minimizeIndividualUi()\n }\n\n /**\n * Opens the individual UI if it was collapsed. - Does nothing if it was already open.\n */\n public async openIndividualUi(): Promise {\n await this.requireUpgrade()\n await this.internalApi.general.openIndividualUi()\n }\n\n /**\n * Collapses the individual UI if it was open. - Does nothing if it was already collapsed.\n */\n public async collapseIndividualUi(): Promise {\n await this.requireUpgrade()\n await this.internalApi.general.collapseIndividualUi()\n }\n\n /**\n * Get the state of the individual UI.\n * @return A promise that resolves to the {@link IndividualUiState} of the individual UI.\n */\n public async getIndividualUiState(): Promise {\n if (!await this.internalApi.meta.isUpgraded()) {\n return IndividualUiState.COLLAPSED\n }\n return await this.internalApi.general.getIndividualUiState()\n }\n\n /**\n * Get the active individual UI view.\n *\n * NOTE: The view being active doesn't necessarily mean it's visible to the user. The UI as a whole may be\n * collapsed, for instance.\n *\n * @return A promise that resolves to the {@link ActiveIndividualUiView} of the individual UI.\n * @see {@link getIndividualUiState}\n */\n public async getActiveIndividualUiView(): Promise {\n if (!await this.internalApi.meta.isUpgraded()) {\n return ActiveIndividualUiView.UNKNOWN\n }\n return await this.internalApi.general.getActiveIndividualUiView()\n }\n\n private async requireUpgrade(): Promise {\n await this.internalApi.meta.upgrade(false)\n }\n\n private onUpgraded() {\n for (let event of this.eventEmitter.getEventsWithListeners()) {\n // register internal listeners for all events that need upgrade.\n if (!this.internalListeners[event])\n this.onInternal(event as GeneralEventType)\n }\n }\n}\n","import {InternalApi} from './internal/internal-api'\nimport {Conversation} from './shared/conversation'\nimport {PersonInfo} from './shared/model/person-info'\nimport {Event, EventCallback} from './shared/internal/event'\nimport {EventEmitter, Listener} from './shared/internal/util/event-emitter'\nimport {ConversationType} from './shared/model/conversation-type'\nimport {AgentAvailabilityState} from './shared/model/agent-availability-state'\nimport {AgentAvailabilityEventType} from './shared/internal/module/agent-availability-module'\nimport {InternalModule} from './shared/internal/module/module'\nimport {UnbluApiError, UnbluErrorType} from './shared/unblu-api-error'\nimport {UnbluUiApi} from './unblu-api-ui'\nimport {MetaEventType} from \"./internal/module/meta-module\"\nimport {ConversationInfo} from \"./shared/model/conversation-info\"\nimport {NewConversationInterceptor} from \"./shared/new-conversation-interceptor\"\nimport {GeneralEventType} from \"./internal/module/general-module\"\nimport {InitializedUnbluApi} from \"./shared/internal/initialized-unblu-api\"\nimport {ConversationRecipient} from \"./shared/model/conversation-recipient\";\nimport {UnbluUtil} from \"./shared/internal/unblu-util\";\n\n/**\n * Listener called whenever the active conversation changes.\n *\n * **Note:** If no conversation is currently active the passed conversation object will be `null`\n * @param conversation API object for the active conversation or `null` if no conversation is active.\n */\nexport type ConversationChangeListener = (conversation?: Conversation) => void\n\n/**\n * Listener called whenever a conversation changed, added or removed from all conversations.\n * @param conversations All conversations of the current visitor.\n */\nexport type ConversationsChangeListener = (conversations: ConversationInfo[]) => void\n\n/**\n * Listener called whenever the notification count of a person (i.e. unread messages) changes.\n * @param count The number of unseen notifications.\n */\nexport type NotificationCountChangeListener = (count: number) => void\n/**\n * Listener called whenever the local person changes.\n * @param person Info about the person.\n */\nexport type PersonChangeListener = (person: PersonInfo) => void\n/**\n * Listener called whenever there is activity by the person.\n * @param lastActivity A UTC timestamp when the last activity happened.\n */\nexport type PersonActivityListener = (lastActivity: Number) => void\n/**\n * Listener called whenever the agent availability changes.\n * @param isAvailable A boolean that indicates if an agent is available.\n */\nexport type AgentAvailableChangeListener = (isAvailable: boolean) => void\n/**\n * Listener called whenever the agent availability state changes.\n * @param availability The new availability state.\n */\nexport type AgentAvailabilityChangeListener = (availability: AgentAvailabilityState) => void\n/**\n * Listener called whenever the UnbluApi gets de-initialized.\n */\nexport type DeinitializationListener = () => void\n\n/**\n * #### This class represents the initialized Unblu Visitor JS API.\n *\n * There is only ever one instance of this api which can be retrieved via `unblu.api.initialize()`.\n * See {@link UnbluStaticApi} for more details on configuring and initializing the UnbluApi.\n *\n * The API connects to the integrated version of Unblu. All actions performed via the UnbluApi are executed in\n * the name of and with the rights of current visitor and may have direct effect on the displayed Unblu UI.\n *\n * For example if a conversation is started from the UnbluApi, the Unblu UI will navigate to it.\n * If a conversation is closed via the API, it will also be closed on the Unblu UI of the visitor.\n * For more information on UI side effects please check the documentation for each method call.\n *\n * For programmatic administrator access and configuration of Unblu please use the Unblu WebAPI.\n */\nexport class UnbluApi implements InitializedUnbluApi {\n\n /**\n * Event emitted every time the active conversation changes.\n *\n * This may happen due to a UI-navigation or an API-call.\n *\n * @event activeConversationChange\n * @see {@link on} for listener registration\n * @see {@link ConversationChangeListener}\n */\n public static readonly ACTIVE_CONVERSATION_CHANGE: 'activeConversationChange' = 'activeConversationChange'\n\n /**\n * Event emitted every time one of the conversations accessible to the current user changes or one is added or removed.\n *\n * @event conversationsChanged\n * @see {@link on} for listener registration\n * @see {@link ConversationsChangeListener}\n */\n public static readonly CONVERSATIONS_CHANGE: 'conversationsChange' = 'conversationsChange'\n\n /**\n * Event emitted every time the notification count (unread messages) changes.\n *\n * @event notificationCountChange\n * @see {@link on} for listener registration\n * @see {@link NotificationCountChangeListener}\n */\n public static readonly NOTIFICATION_COUNT_CHANGE: 'notificationCountChange' = 'notificationCountChange'\n\n /**\n * Event emitted every time the local person changes. This may be i.e. due to the person setting its name.\n *\n * @event personChange\n * @see {@link on} for listener registration\n * @see {@link PersonChangeListener}\n */\n public static readonly PERSON_CHANGE: 'personChange' = 'personChange'\n\n /**\n * Event emitted every time the local person has some activity inside Unblu.\n * This may be i.e. an interaction with the chat, a call, opening a conversation or interacting\n * with a co-browsing layer.\n *\n * The event can be used to reset the logout timer inside an authenticated area, for example.\n *\n * The configuration property com.unblu.conversation.activity.activityCategoriesToTrack specifies which categories of activity trigger the event.\n *\n * @event personActivity\n * @see {@link on} for listener registration\n * @see {@link PersonActivityListener}\n */\n public static readonly PERSON_ACTIVITY: 'personActivity' = 'personActivity'\n\n /**\n * Event emitted every time the agent availability changes for the current named area and locale.\n *\n * @event availableChange\n * @see {@link on} for listener registration\n * @see {@link AgentAvailableChangeListener}\n */\n public static readonly AGENT_AVAILABLE_CHANGE: 'availableChange' = 'availableChange'\n\n /**\n * Event emitted every time the agent availability state changes for the current named area and locale.\n *\n * @event availabilityChange\n * @see {@link on} for listener registration\n * @see {@link AgentAvailabilityChangeListener}\n */\n public static readonly AGENT_AVAILABILITY_CHANGE: 'availabilityChange' = 'availabilityChange'\n\n /**\n * Event emitted when this instance gets de-initialized and is not usable at the time until it fully got de-initialized.\n *\n * @event deinitializing\n * @see {@link on} for listener registration\n * @see {@link DeinitializationListener}\n */\n public static readonly DEINITIALIZING: 'deinitializing' = 'deinitializing'\n\n /**\n * Event emitted when this instance got de-initialized and has to be initialized again.\n *\n * @event deinitialized\n * @see {@link on} for listener registration\n * @see {@link DeinitializationListener}\n */\n public static readonly DEINITIALIZED: 'deinitialized' = 'deinitialized' \n\n /**\n * Access the UI functionality over the UI property.\n */\n public ui: UnbluUiApi\n\n private internalListeners: { [key: string]: EventCallback } = {}\n private eventEmitter = new EventEmitter()\n\n /**\n * @hidden\n */\n constructor(private internalApi: InternalApi) {\n internalApi.meta.on('upgraded', () => this.onUpgraded())\n // All UI functionality is provided with the ui namespace\n this.ui = new UnbluUiApi(internalApi)\n }\n\n // Event\n /**\n * Registers an event listener for the given event.\n * @param event The activeConversationChange event.\n * @param listener The listener to be called.\n * @see {@link ACTIVE_CONVERSATION_CHANGE}\n */\n public on(event: typeof UnbluApi.ACTIVE_CONVERSATION_CHANGE, listener: ConversationChangeListener): void\n /**\n * Registers an event listener for the given event.\n * @param event The notificationCountChange event.\n * @param listener The listener to be called.\n * @see {@link NOTIFICATION_COUNT_CHANGE}\n */\n\n /**\n * Registers an event listener for the given event.\n * @param event The conversationsChanged event.\n * @param listener The listener to be called.\n * @see {@link CONVERSATIONS_CHANGE}\n */\n public on(event: typeof UnbluApi.CONVERSATIONS_CHANGE, listener: ConversationsChangeListener): void\n\n /**\n * Registers an event listener for the given event.\n * @param event The notificationCountChanged event.\n * @param listener The listener to be called.\n * @see {@link NOTIFICATION_COUNT_CHANGE}\n */\n public on(event: typeof UnbluApi.NOTIFICATION_COUNT_CHANGE, listener: NotificationCountChangeListener): void\n /**\n * Registers an event listener for the given event.\n * @param event The personChange event.\n * @param listener The listener to be called.\n * @see {@link PERSON_CHANGE}\n */\n public on(event: typeof UnbluApi.PERSON_CHANGE, listener: PersonChangeListener): void\n /**\n * Registers an event listener for the given event.\n * @param event The personActivity event.\n * @param listener The listener to be called.\n * @see {@link PERSON_ACTIVITY}\n */\n public on(event: typeof UnbluApi.PERSON_ACTIVITY, listener: PersonActivityListener): void\n /**\n * Registers an event listener for the given event.\n * @param event The agentAvailableChange event.\n * @param listener The listener to be called.\n * @see {@link AGENT_AVAILABLE_CHANGE}\n */\n public on(event: typeof UnbluApi.AGENT_AVAILABLE_CHANGE, listener: AgentAvailableChangeListener): void\n /**\n * Registers an event listener for the given event.\n * @param event The agentAvailabilityChange event.\n * @param listener The listener to be called.\n * @see {@link AGENT_AVAILABILITY_CHANGE}\n */\n public on(event: typeof UnbluApi.AGENT_AVAILABILITY_CHANGE, listener: AgentAvailabilityChangeListener): void\n /**\n * Registers an event listener for the given event.\n * @param event The deinitializing event.\n * @param listener The listener to be called.\n * @see {@link DEINITIALIZING}\n */\n public on(event: typeof UnbluApi.DEINITIALIZING, listener: DeinitializationListener): void\n /**\n * Registers an event listener for the given event.\n * @param event The deinitialized event.\n * @param listener The listener to be called.\n * @see {@link DEINITIALIZED}\n */\n public on(event: typeof UnbluApi.DEINITIALIZED, listener: DeinitializationListener): void\n\n public on(event: GeneralEventType | AgentAvailabilityEventType | MetaEventType, listener: Listener): void {\n this.assertNotDeinitialized()\n const needsInternalSubscription = !this.eventEmitter.hasListeners(event)\n this.eventEmitter.on(event, listener)\n if (needsInternalSubscription)\n this.onInternal(event).catch(e => console.warn('Error registering internal listener for event:', event, 'error:' + e, e))\n }\n\n /**\n * Removes a previously registered listener\n * @param event The event to unregister from.\n * @param listener The listener to remove.\n */\n public off(event: GeneralEventType | AgentAvailabilityEventType | MetaEventType, listener: Listener): boolean {\n this.assertNotDeinitialized()\n const removed = this.eventEmitter.off(event, listener)\n if (!this.eventEmitter.hasListeners(event))\n this.offInternal(event).catch(e => console.warn('Error removing internal listener for event:', event, 'error:' + e, e))\n return removed\n }\n\n private async onInternal(eventName: GeneralEventType | AgentAvailabilityEventType | MetaEventType) {\n let internalListener: EventCallback\n let internalModule: InternalModule\n let needsUpgrade: boolean\n switch (eventName) {\n case UnbluApi.AGENT_AVAILABLE_CHANGE:\n internalListener = (event: Event) => {\n this.eventEmitter.emit(event.name, event.data)\n }\n internalModule = this.internalApi.agentAvailability\n needsUpgrade = false\n break\n case UnbluApi.AGENT_AVAILABILITY_CHANGE:\n internalListener = (event: Event) => {\n this.eventEmitter.emit(event.name, event.data)\n }\n internalModule = this.internalApi.agentAvailability\n needsUpgrade = false\n break\n case UnbluApi.ACTIVE_CONVERSATION_CHANGE:\n internalListener = (event: Event) => {\n this.eventEmitter.emit(event.name, event.data ? new Conversation(this.internalApi.conversation, event.data) : null)\n }\n internalModule = this.internalApi.general\n needsUpgrade = true\n break\n case UnbluApi.CONVERSATIONS_CHANGE:\n internalListener = (event: Event) => {\n this.eventEmitter.emit(event.name, event.data)\n }\n internalModule = this.internalApi.general\n needsUpgrade = true\n break\n case UnbluApi.NOTIFICATION_COUNT_CHANGE:\n case UnbluApi.PERSON_CHANGE:\n case UnbluApi.PERSON_ACTIVITY: \n internalListener = (event: Event) => {\n this.eventEmitter.emit(event.name, event.data)\n }\n internalModule = this.internalApi.general\n needsUpgrade = true\n break\n case UnbluApi.DEINITIALIZING:\n case UnbluApi.DEINITIALIZED:\n internalListener = (event: Event) => {\n this.eventEmitter.emit(event.name, event.data)\n }\n internalModule = this.internalApi.meta\n needsUpgrade = false\n break\n default:\n throw new UnbluApiError(UnbluErrorType.INVALID_FUNCTION_ARGUMENTS, 'Registration to unknown event:' + eventName)\n }\n\n if (!needsUpgrade || await this.internalApi.meta.isUpgraded()) {\n this.internalListeners[eventName] = internalListener\n try {\n await internalModule.on(eventName, internalListener)\n } catch (e) {\n delete this.internalListeners[eventName]\n throw e\n }\n }\n }\n\n private async offInternal(eventName: GeneralEventType | AgentAvailabilityEventType | MetaEventType) {\n const listener = this.internalListeners[eventName]\n if (listener == null) {\n return\n }\n delete this.internalListeners[eventName]\n\n let internalModule: InternalModule\n switch (eventName) {\n case UnbluApi.AGENT_AVAILABILITY_CHANGE:\n internalModule = this.internalApi.agentAvailability\n break\n case UnbluApi.DEINITIALIZING:\n case UnbluApi.DEINITIALIZED:\n internalModule = this.internalApi.meta\n break\n default:\n internalModule = this.internalApi.general\n break\n }\n await internalModule.off(eventName, listener)\n }\n\n // General\n\n /**\n * Returns information about the visitor.\n * @return A promise that resolves to the current visitors person info.\n */\n public async getPersonInfo(): Promise {\n this.assertNotDeinitialized()\n await this.requireUpgrade()\n return this.internalApi.general.getPersonInfo()\n }\n\n /**\n * Sets the current visitor's nickname.\n * This could be set before or during a conversation.\n * @return A promise that resolves empty when the operation is done\n */\n public async setPersonNickname(nickname: string): Promise {\n this.assertNotDeinitialized()\n await this.requireUpgrade()\n return this.internalApi.general.setPersonNickname(nickname)\n }\n\n /**\n * Logs the current visitor in using the `authenticator/loginWithSecureToken` web API endpoint.\n * Depending on the configuration, existing conversation may will be transferred to the authenticated user.\n * @param accessToken The access token (JWT) to authenticate the visitor with\n * @return A promise that resolves empty if the login succeeds or is rejected if it fails\n */\n public async login(accessToken: string): Promise {\n this.assertNotDeinitialized()\n return UnbluUtil.loginWithSecureToken(this.internalApi.configuration.serverUrl || '', this.internalApi.configuration.apiKey, this.internalApi.configuration.entryPath || '/unblu', accessToken)\n }\n\n /**\n * Checks if the current visitor is authenticated.\n * @return A promise that resolves to a boolean if the visitor is authenticated\n */\n public async isAuthenticated(): Promise {\n this.assertNotDeinitialized()\n return UnbluUtil.isAuthenticated(this.internalApi.configuration.serverUrl || '', this.internalApi.configuration.entryPath || '/unblu')\n }\n\n /**\n * Logs the visitor out.\n * The user will not have access to conversations from the authenticated visitor he was before anymore. He needs to be authenticated again for that.\n * @return A promise that resolves empty when the logout succeeds or is rejected if it fails\n */\n public async logout(): Promise {\n this.assertNotDeinitialized()\n return UnbluUtil.logout(this.internalApi.configuration.serverUrl || '', this.internalApi.configuration.entryPath || '/unblu')\n }\n\n /**\n * Returns the number of unread messages.\n * @return A promise that resolves to the current number of unread messages.\n */\n public async getNotificationCount(): Promise {\n this.assertNotDeinitialized()\n if (await this.internalApi.meta.isUpgraded()) {\n return this.internalApi.general.getNotificationCount()\n } else {\n return this.internalApi.generalLazy.getNotificationCount()\n }\n }\n\n // Conversation\n\n\n /**\n * Starts a new Conversation and places it into the inbound conversation queue.\n *\n * Starting a new conversation involves an agent availability check.\n * For {@link ConversationType.OFFLINE_CHAT_REQUEST} conversations, the check proceeds as follows:\n * * If an agent is available, the conversation type will be changed to {@link ConversationType.CHAT_REQUEST}.\n * * If no agents are available, it will start an offline conversation provided offline chat requests are enabled in the Unblu server's configuration.\n * * if offline chat requests aren't enabled, the request will be rejected.\n *\n * For all `online` conversation types, the check works as follows:\n * * If an agent is available, the conversation will be started.\n * * If no agents are available, the request will be rejected.\n *\n * You should therefore always check agent availability before starting a new conversation.\n * If no agents are available, only start conversations of the type {@link ConversationType.OFFLINE_CHAT_REQUEST}.\n *\n * **NOTE:** calling this method will NOT automatically open the Unblu UI if it is collapsed. Use [ui.openIndividualUi()]{@link UnbluUiApi.openIndividualUi} if this is needed.\n *\n * @param type The conversation type that shall be started.\n * @param visitorName The name the local visitor should have. This is only taken into account if the visitor is not already authenticated.\n * @param visitorData Custom data for the visitor in any format. **NOTE:** The data which is passed here could be used in [NewConversationCallback]{@link NewConversationInterceptor}\n * @param recipient The team or agent recipient of the conversation. This will overwrite any named area that might be set for this web page. **NOTE:** The data which is passed here could be used in [NewConversationCallback]{@link NewConversationInterceptor}\n * @return A promise that resolves to the conversation object giving API access to the started conversation.\n */\n public async startConversation(type: ConversationType, visitorName?: string, visitorData?: string, recipient?: ConversationRecipient): Promise {\n this.assertNotDeinitialized()\n await this.requireUpgrade()\n const conversationId = await this.internalApi.general.startConversation(type, visitorName, visitorData, recipient)\n return new Conversation(this.internalApi.conversation, conversationId)\n }\n\n /**\n * Set a custom interceptor which will be triggered when a new conversation is started (initiated from UI or JavaScript).\n * @param callback The interceptor which is called before a new conversation is started. The Callback is of type [NewConversationCallback]{@link NewConversationInterceptor}\n * @return A promise that resolves when the interceptor is successfully applied and active.\n */\n public async setNewConversationInterceptor(callback: NewConversationInterceptor): Promise {\n this.assertNotDeinitialized()\n if (!await this.internalApi.meta.isUpgraded()) {\n return await this.internalApi.generalLazy.setNewConversationInterceptor(callback)\n } else {\n return await this.internalApi.general.setNewConversationInterceptor(callback)\n }\n }\n\n /**\n * Joins an existing conversation with a given PIN.\n *\n * **NOTE:** calling this method will NOT automatically open the Unblu UI if it is collapsed. Use [ui.openIndividualUi()]{@link UnbluUiApi.openIndividualUi} if this is needed.\n *\n * @param pin The PIN retrieved from the Unblu Agent Desk.\n * @param visitorName The name the local visitor should have. This is only taken into account if the visitor is not already authenticated.\n * @return A promise that resolves to the conversation object giving API access to the joined conversation.\n */\n public async joinConversation(pin: string, visitorName?: string): Promise {\n this.assertNotDeinitialized()\n await this.requireUpgrade()\n const conversationId = await this.internalApi.general.joinConversation(pin, visitorName)\n return new Conversation(this.internalApi.conversation, conversationId)\n }\n\n /**\n * Opens the existing conversation with the given conversation ID.\n *\n * **NOTE:** calling this method will NOT automatically open the Unblu UI if it is collapsed. Use [ui.openIndividualUi()]{@link UnbluUiApi.openIndividualUi} if this is needed.\n *\n * @param conversationId The id of the conversation to be opened.\n * @return A promise that resolves to the conversation object giving API access to the opened conversation.\n */\n public async openConversation(conversationId: string): Promise {\n this.assertNotDeinitialized()\n await this.requireUpgrade()\n await this.internalApi.general.openConversation(conversationId)\n return new Conversation(this.internalApi.conversation, conversationId)\n }\n\n /**\n * Returns the currently active conversation or `null` if no conversation is active.\n *\n * **NOTE:** calling this method twice while the same conversation is active, will result in two individual conversation API instances being returned.\n * destroying one of them will not cause the other one to also be destroyed. If however the active conversation is closed, all returned Conversation instances will be destroyed.\n *\n * @return A promise that either resolves to the currently active conversation or `null` if no conversation is open.\n * @see {@link ACTIVE_CONVERSATION_CHANGE}\n */\n public async getActiveConversation(): Promise {\n this.assertNotDeinitialized()\n if (await this.internalApi.meta.isUpgraded()) {\n const conversationId = await this.internalApi.general.getActiveConversation()\n return conversationId != null ? new Conversation(this.internalApi.conversation, conversationId) : null\n } else {\n return null\n }\n }\n\n /**\n * Returns all conversations of the current visitor. If no conversation is present, an empty array is returned.\n *\n * @return A promise that resolves to an array of [ConversationInfo]{@link ConversationInfo}.\n */\n public async getConversations(): Promise {\n\t\tthis.assertNotDeinitialized()\n await this.requireUpgrade()\n return await this.internalApi.general.getConversations()\n }\n\n /**\n * Checks if an agent is available for the current named area and language.\n *\n * @return Promise that resolves to `true` if the availability state is [AVAILABLE]{@link AgentAvailabilityState.AVAILABLE} or [BUSY]{@link AgentAvailabilityState.BUSY}, `false` otherwise.\n * @see {@link getAgentAvailabilityState} for a more detailed check.\n */\n public async isAgentAvailable(): Promise {\n this.assertNotDeinitialized()\n return this.internalApi.agentAvailability.isAgentAvailable()\n }\n\n /**\n * Returns the current availability state for the current named area and language.\n * @return Promise that resolves to the current availability state.\n * @see {@link isAgentAvailable} for a simpler check.\n */\n public async getAgentAvailabilityState(): Promise {\n this.assertNotDeinitialized()\n return this.internalApi.agentAvailability.getAgentAvailabilityState()\n }\n\n private async requireUpgrade(): Promise {\n await this.internalApi.meta.upgrade(false)\n }\n\n private onUpgraded() {\n for (let event of this.eventEmitter.getEventsWithListeners()) {\n // register internal listeners for all events that need upgrade.\n if (!this.internalListeners[event])\n this.onInternal(event as GeneralEventType)\n }\n }\n\n private assertNotDeinitialized() {\n if (this.isDeinitialized()) {\n throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Error: trying to execute method on deinitialized UnbluApi instance.')\n }\n }\n\n public isDeinitialized(): Boolean {\n return this.internalApi == null\n }\n\n /**\n * De-initializes the API. It will destroy the UI, all connections and will release all resources (as far as it is technically possible).\n *\n * Afterwards the API can be initialized again via [window.unblu.api.initialize()]{@link UnbluStaticApi.initialize}\n */\n public async deinitialize(): Promise {\n if (this.isDeinitialized()) {\n return\n }\n await this.internalApi.meta.deinitialize()\n this.internalApi = null\n this.ui = null\n this.internalListeners = null\n this.eventEmitter = null\n }\n\n}","import {UnbluApi} from './unblu-api';\nimport {EventEmitter, Listener} from './shared/internal/util/event-emitter';\nimport {IntegrationType, UnbluUtil} from './shared/internal/unblu-util';\nimport {UnbluApiError, UnbluErrorType} from './shared/unblu-api-error';\nimport {ApiBridge} from './shared/internal/api-bridge';\nimport {InternalApi} from './internal/internal-api';\nimport {ApiState} from \"./shared/api-state\";\nimport {Configuration} from \"./shared/model/configuration\";\nimport {UnbluApiFactory} from \"./shared/internal/unblu-api-factory\";\n\nexport {Configuration};\n\nexport type ReadyListener = (api: UnbluApi) => void;\nexport type ErrorListener = (e: Error) => void;\nexport type DeinitializingListener = () => void;\nexport type DeinitializedListener = () => void;\nexport type StateListener = (state: ApiState) => void;\n\n\n/**\n * #### The central entry point that allows to configure an initialize the Unblu Visitor JS API.\n * The static Unblu API works without actually loading the rest of Unblu.\n * It can do some general checks and load Unblu or connect the API to a loaded version of Unblu.\n * The JS API is an optional add-on to the Unblu visitor site integration.\n *\n * Depending on how Unblu is integrated into the local website the API has to be initialized differently.\n *\n * **a.) API-only integration**\n * If no unblu-snippet is loaded into the page, Unblu can be fully initialized with the API.\n * In this case, both the `configure` and the `initialize` methods have to be called.\n * Example:\n * ```ts\n * const api = await unblu.api\n * // configure the unblu server\n * .configure({\n * apiKey: \"\",\n * serverUrl: \"\"\n * })\n * // initialize the api.\n * .initialize();\n * ```\n * This implementation will load the Unblu snippet and initialize both Unblu and the JS API.\n *\n * **b.) Snippet and JS API integration**\n * If the Unblu snippet is already present in the local website, Unblu doesn't have to be loaded\n * and only the API has to be initialized.\n * Example:\n * ```ts\n * // directly initialize the api without configuring.\n * const api = await unblu.api.initialize();\n *\n * ```\n */\nexport class UnbluStaticApi implements UnbluApiFactory{\n private state: ApiState = ApiState.INITIAL;\n private error: UnbluApiError;\n private eventEmitter = new EventEmitter();\n\n private configuration: Configuration;\n private initializedApi: UnbluApi;\n\n /**\n * Event emitted as soon as the API is initialized.\n *\n * It usually makes sense to use this event if there is some general action that has to be triggered when the API is initialized,\n * but there are several places in the integration code that may trigger the initialization.\n *\n * In most cases however, it is better to use\n * ```ts\n * unblu.api.initialize().then(api => { //use api here });\n * ```\n * or\n * ```ts\n * let api = await unblu.api.initialize();\n * // use api here\n * ```\n *\n * Note: that this event will be triggered again after each initialization.\n *\n * @event ready\n * @see {@link on} for listener registration\n */\n public static readonly READY: 'ready' = 'ready';\n\n /**\n * Event emitted if the API initialization fails.\n *\n * It usually makes sense to use this event if there is some general action that has to be triggered when the API initialization fails,\n * but there are several places in the integration code that may trigger the initialization.\n *\n * In most cases however, it is better to use\n * ```ts\n * unblu.api.initialize().catch(error=> { //handle error here });\n * ```\n * or\n * ```ts\n * try{\n * let api = await unblu.api.initialize();\n * }catch(e){\n * // handle error here\n * }\n *\n * ```\n *\n * @event error\n * @see {@link on} for listener registration\n */\n public static readonly ERROR: 'error' = 'error';\n\n /**\n * Event emitted as soon as the API is going to get de-initialized.\n *\n * It usually makes sense to use this event to clean up resources and/or unregistering of listeners to no try to use the API again until it is initialized again.\n *\n * @event deinitializing\n * @see {@link on} for listener registration\n */\n public static readonly DEINITIALIZING: 'deinitializing' = 'deinitializing';\n\n /**\n * Event emitted as soon as the API is completely de-initialized.\n *\n * It usually makes sense to use this event to clean up resources and/or unregistering of listeners to no try to use the API again until it is initialized again.\n *\n * @event deinitialized\n * @see {@link on} for listener registration\n */\n public static readonly DEINITIALIZED: 'deinitialized' = 'deinitialized';\n\n /**\n * Event emitted whenever the API state changes\n *\n * @event state\n * @see {@link on} for listener registration\n */\n public static readonly STATE: 'state' = 'state';\n\n /**\n * @hidden\n */\n constructor() {\n // store the error\n this.eventEmitter.on(UnbluStaticApi.ERROR, e => this.error = e);\n\n // install globally if needed so the embedded API as a reference it can use to de-init\n const unblu = UnbluUtil.getUnbluObject();\n if (unblu.api) {\n this.handleError(new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Unblu API has already been loaded.'));\n } else {\n unblu.api = this;\n }\n\n if (UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {\n // Auto init if snippet is already loaded.\n this.initializeApi().catch(e => console.warn('Error during auto initialization', e));\n }\n }\n\n //TODO: Add version\n\n /**\n * Registers an event listener for the given event.\n *\n * **Note** If the API is already initialized, this listener will be called directly.\n * @param event The ready event\n * @param listener The listener to be called.\n * @see {@link READY}\n */\n on(event: typeof UnbluStaticApi.READY, listener: ReadyListener): void;\n\n /**\n * Registers an event listener for the given event.\n *\n * **Note** If the API has already failed, this listener will be called directly.\n * @param event The error event\n * @param listener The listener to be called.\n * @see {@link ERROR}\n */\n on(event: typeof UnbluStaticApi.ERROR, listener: ErrorListener): void;\n\n /**\n * Registers an event listener for the given event.\n *\n * **Note** If the API is already deinitializing, this listener will be called directly.\n * @param event The deinitializing event\n * @param listener The listener to be called.\n * @see {@link DEINITIALIZING}\n */\n on(event: typeof UnbluStaticApi.DEINITIALIZING, listener: DeinitializingListener): void;\n\n /**\n * Registers an event listener for the given event.\n *\n * **Note** If the API is already deinitialized, this listener will be called directly.\n * @param event The deinitialized event\n * @param listener The listener to be called.\n * @see {@link DEINITIALIZED}\n */\n on(event: typeof UnbluStaticApi.DEINITIALIZED, listener: DeinitializedListener): void;\n\n /**\n * Registers an event listener for the given event.\n *\n * @param event The state event\n * @param listener The listener to be called.\n * @see {@link STATE}\n */\n on(event: typeof UnbluStaticApi.STATE, listener: StateListener): void;\n\n on(event: string, listener: Listener): void {\n if (event == UnbluStaticApi.READY && this.state == ApiState.INITIALIZED)\n listener(this.initializedApi);\n else if (event == UnbluStaticApi.ERROR && this.state == ApiState.ERROR)\n listener(this.error);\n else if (event == UnbluStaticApi.DEINITIALIZING && this.state == ApiState.DEINITIALIZING)\n listener();\n else if (event == UnbluStaticApi.DEINITIALIZED && this.state == ApiState.DEINITIALIZED)\n listener();\n\n this.eventEmitter.on(event, listener)\n }\n\n /**\n * Removes a previously registered listener.\n * @param event The event unregister.\n * @param listener The listener to be removed.\n * @return `true` if the listener was removed, `false` otherwise.\n */\n off(event: string, listener: Listener): boolean {\n return this.eventEmitter.off(event, listener);\n }\n\n /**\n * Checks whether the API has to be configured or not.\n *\n * - If no snippet is present and the API state is still [INITIAL]{@link ApiState.INITIAL} a configuration is necessary.\n * - If a snippet is present or the API is already loaded, configuration is not necessary.\n * - If the API state is in [DEINITIALIZED]{@link ApiState.DEINITIALIZED}\n *\n * @return `true` if a configuration is needed to initialize the API, `false` otherwise.\n * @see {@link configure} to configure the API\n * @see {@link initialize} to initialize the API\n */\n public isConfigurationNeeded(): boolean {\n return (this.state === ApiState.INITIAL || this.state === ApiState.DEINITIALIZED) && !UnbluUtil.isUnbluLoaded(IntegrationType.floating);\n }\n\n /**\n * Returns the current state of the API\n * @return the current API state.\n * @see {@link isInitialized} for a simpler check\n */\n public getApiState(): ApiState {\n return this.state;\n }\n\n /**\n * Checks whether the API is initialized or not.\n * @return `true` if the API is initialized, `false` for any other state.\n * @see {@link getApiState} for the full state\n */\n public isInitialized(): boolean {\n return this.state === ApiState.INITIALIZED;\n }\n\n /**\n * Configures the way that Unblu should be initialized.\n *\n * The configuration of the Unblu API is needed when, and only when no Unblu snippet is already present in the website.\n *\n * **Note:**\n * - Calling this method when there's already an Unblu snippet will result in an {@link UnbluApiError}.\n * - This method must be called BEFORE {@link initialize}.\n * If it is called afterwards an {@link UnbluApiError} will be thrown.\n *\n * @param config The configuration to be set.\n * @return an instance of `this` allowing chaining like `unblu.api.configure({...}).initialize();`\n * @see {@link isConfigurationNeeded} to check if configuration is needed or not.\n */\n configure(config: Configuration): UnbluStaticApi {\n if (UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {\n throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Configure called when Unblu was already loaded.')\n } else if (this.state !== ApiState.INITIAL && this.state !== ApiState.DEINITIALIZED) {\n throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Error configure called after API was already initialized or is not fully deinitialized yet.');\n }\n this.configuration = {...config};\n return this;\n }\n\n /**\n * Initializes the API and resolves to the fully initialized API.\n *\n * If the API has already been initialized or is already in the initializing process, the existing API will be returned.\n * There is only ever one instance of the API which will be returned by any call of this method which makes it safe to call this multiple times.\n *\n * *The initialization may fail with a {@link UnbluApiError} for the following reasons*\n * - A configuration is needed but none was provided: [CONFIGURATION_MISSING]{@link UnbluErrorType.CONFIGURATION_MISSING}\n * - Loading Unblu encounters a problem: [ERROR_LOADING_UNBLU]{@link UnbluErrorType.ERROR_LOADING_UNBLU}\n * - The initialization timed out: [INITIALIZATION_TIMEOUT]{@link UnbluErrorType.INITIALIZATION_TIMEOUT}\n * - The Unblu API is incompatible with the Unblu server: [INCOMPATIBLE_UNBLU_VERSION]{@link UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION}\n * - The browser is unsupported: [UNSUPPORTED_BROWSER]{@link UnbluErrorType.UNSUPPORTED_BROWSER}\n * - The provided access token is invalid: [AUTHENTICATION_FAILED]{@link UnbluErrorType.AUTHENTICATION_FAILED}\n */\n public async initialize(): Promise {\n if (this.state === ApiState.INITIALIZED) {\n return this.initializedApi;\n } else if (this.state === ApiState.INITIALIZING) {\n return new Promise((resolve, reject) => {\n this.on(UnbluStaticApi.READY, resolve);\n this.on(UnbluStaticApi.ERROR, reject);\n });\n } else if(this.state === ApiState.DEINITIALIZING) {\n return Promise.reject('Cannot initialize while de-initializing is ongoing! Please wait for the deinitialized event')\n } else {\n return this.initializeApi();\n }\n }\n\n private async initializeApi(): Promise {\n this.state = ApiState.INITIALIZING;\n await UnbluUtil.deinitializeEmbeddedIfNeeded();\n try {\n if (!UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {\n if (!this.configuration) {\n // noinspection ExceptionCaughtLocallyJS\n throw new UnbluApiError(UnbluErrorType.CONFIGURATION_MISSING, 'No Unblu snippet present and no configuration provided. Use configure if you want to initialize Unblu without having the Unblu snippet loaded.')\n }\n if (this.configuration.namedArea) {\n UnbluUtil.setNamedArea(this.configuration.namedArea);\n }\n if (this.configuration.locale) {\n UnbluUtil.setLocale(this.configuration.locale);\n }\n if(this.configuration.accessToken) {\n await UnbluUtil.loginWithSecureToken(this.configuration.serverUrl || '', this.configuration.apiKey, this.configuration.entryPath || '/unblu', this.configuration.accessToken);\n }\n await UnbluStaticApi.injectUnblu(this.configuration);\n } else if(!this.configuration) {\n //Unblu already loaded (potentially via snippet) with no explicit configuration of the API. Generated configuration based on the loaded instance\n this.configuration = UnbluUtil.generateConfigurationFromLoadedUnblu();\n }\n let apiBridge = new ApiBridge(UnbluUtil.getUnbluObject(), 'internal');\n await apiBridge.waitUntilLoaded(this.configuration.initTimeout || 30000);\n\n let internalApi = new InternalApi(apiBridge, this.configuration);\n internalApi.checkCompatibility();\n\n // Check internalApi waitUntilInitialized\n await internalApi.meta.waitUntilInitialized();\n\n this.initializedApi = new UnbluApi(internalApi);\n this.initializedApi.on(UnbluApi.DEINITIALIZING, () => this.onDeinitializing());\n this.initializedApi.on(UnbluApi.DEINITIALIZED, () => this.onDeinitialized());\n this.state = ApiState.INITIALIZED;\n } catch (e) {\n this.handleError(e);\n }\n\n this.eventEmitter.emit(UnbluStaticApi.READY, this.initializedApi);\n this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);\n\n return this.initializedApi;\n }\n\n private static async injectUnblu(config: Configuration): Promise {\n const serverUrl = config.serverUrl || '';\n const apiKey = config.apiKey || '';\n const unbluPath = config.entryPath || '/unblu';\n let unbluUrl = `${serverUrl}${unbluPath}/visitor.js?x-unblu-apikey=${apiKey}`;\n try {\n await UnbluUtil.loadScript(unbluUrl, config.initTimeout);\n } catch (e) {\n throw new UnbluApiError(UnbluErrorType.ERROR_LOADING_UNBLU, 'Error loading unblu snippet: ' + e + ' check the configuration: ' + config);\n }\n }\n\n private handleError(error: UnbluApiError) {\n this.state = ApiState.ERROR;\n this.eventEmitter.emit(UnbluStaticApi.ERROR, error);\n this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);\n if (UnbluErrorType.UNSUPPORTED_BROWSER != error.type) { \n \tconsole.error(error);\n }\n throw error;\n }\n\n private onDeinitializing() {\n this.initializedApi = null;\n this.state = ApiState.DEINITIALIZING;\n this.eventEmitter.emit(UnbluStaticApi.DEINITIALIZING);\n this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);\n }\n\n private onDeinitialized() {\n this.state = ApiState.DEINITIALIZED;\n this.eventEmitter.emit(UnbluStaticApi.DEINITIALIZED);\n this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);\n if (this.configuration.namedArea) {\n UnbluUtil.removeNamedArea()\n }\n }\n}","export enum ApiState {\n INITIAL = 'INITIAL',\n INITIALIZING = 'INITIALIZING',\n INITIALIZED = 'INITIALIZED',\n ERROR = 'ERROR',\n DEINITIALIZING = 'DEINITIALIZING',\n DEINITIALIZED = 'DEINITIALIZED'\n}","import {CallState} from './model/call-state'\nimport {Event, EventCallback} from './internal/event'\nimport {\n ConversationCallState,\n ConversationConnectionState,\n ConversationEventType,\n ConversationInvitations,\n ConversationModule,\n ConversationWithState\n} from './internal/module/conversation-module'\nimport {UnbluApiError, UnbluErrorType} from './unblu-api-error'\nimport {EventEmitter, Listener} from './internal/util/event-emitter'\nimport {ConversationState} from './model/conversation-state'\nimport {ConnectionState} from './model/connection-state'\nimport {Invitation} from \"./model/invitation\"\nimport {CustomActionInvocation} from './model/customaction/custom-action-invocation'\n\nexport type ConnectionStateListener = (connectionState: ConnectionState) => void\nexport type ConversationStateListener = (conversationState: ConversationState) => void\nexport type CallStateListener = (callState: CallState) => void\nexport type InvitationsListener = (invitations: Invitation[]) => void\n/**\n * Listener called whenever a custom action invocation triggers an API event for the client\n * @param customActionInvocation The details of the custom action invocation\n */\nexport type CustomActionInvocationListener = (customActionInvocation: CustomActionInvocation) => void\n\n/**\n * #### This class gives API access to the currently active conversation.\n *\n * As long as a conversation is active one can register and receive the events provided by this class and call the methods.\n * Once the conversation is closed this API object will be destroyed and no more event callbacks will be called.\n * Any subsequent calls will fail.\n *\n * Use the {@link CLOSE} event to de-init any code connected to this conversation.\n */\nexport class Conversation {\n\n /**\n * Event emitted when the {@link ConnectionState} of this conversation changes.\n * @event connectionStateChange\n * @see {@link on} for listener registration\n */\n public static readonly CONNECTION_STATE_CHANGE: 'connectionStateChange' = 'connectionStateChange'\n\n /**\n * Event emitted when the {@link ConversationState} of this conversation changes.\n * @event conversationStateChange\n * @see {@link on} for listener registration\n */\n public static readonly CONVERSATION_STATE_CHANGE: 'conversationStateChange' = 'conversationStateChange'\n\n /**\n * Event emitted when the {@link CallState} of this conversation changes.\n * @event callStateChange\n * @see {@link on} for listener registration\n */\n public static readonly CALL_STATE_CHANGE: 'callStateChange' = 'callStateChange'\n\n /**\n * Event emitted when the conversation ends.\n * @deprecated The end event is not always available, depending on the configuration. Use the {@link CONVERSATION_STATE_CHANGE} event instead.\n * @event end\n * @see {@link on} for listener registration\n */\n public static readonly END: 'end' = 'end'\n\n /**\n * Event emitted when the conversation is closed.\n *\n * This may happen due to a UI-navigation or an API-call.\n *\n * @event close\n * @see {@link on} for listener registration\n */\n public static readonly CLOSE: 'close' = 'close'\n\n /**\n * Event emitted when an {@link Invitation} is added to or removed from this conversation, or if an existing invitation changes.\n * The event emits an array of all visitor invitations created by the local person, all other invitations will not be present.\n * @event invitationsChange\n * @see {@link on} for listener registration\n */\n public static readonly INVITATIONS_CHANGE: 'invitationsChange' = 'invitationsChange'\n \n /**\n * Event emitted every time a custom action is configured to trigger a JS API event for the current client when a custom action is invoked \n *\n * @event customActionInvocation\n * @see {@link CustomActionInvocationListener}\n * @see {@link on} for listener registration \n */\n public static readonly CUSTOM_ACTION_INVOCATION: 'customActionInvocation' = 'customActionInvocation'\n\n private eventEmitter = new EventEmitter()\n private internalListeners: { [key: string]: EventCallback } = {}\n private destroyed = false\n\n /**\n * @hidden\n */\n constructor(private conversationModule: ConversationModule, private conversationId: string) {\n // clean up all listeners when the conversation disconnects.\n this.on(Conversation.CLOSE, () => this.destroy())\n }\n\n /**\n * Registers an event listener for the given event.\n * @param event The call state change event.\n * @param listener The listener to be called.\n * @see {@link CONNECTION_STATE_CHANGE}\n */\n public on(event: typeof Conversation.CONNECTION_STATE_CHANGE, listener: ConnectionStateListener): void\n\n /**\n * Registers an event listener for the given event.\n * @param event The conversation state change event.\n * @param listener The listener to be called.\n * @see {@link CONVERSATION_STATE_CHANGE}\n */\n public on(event: typeof Conversation.CONVERSATION_STATE_CHANGE, listener: ConversationStateListener): void\n\n\n /**\n * Registers an event listener for the given event.\n * @param event The call state change event.\n * @param listener The listener to be called.\n * @see {@link CALL_STATE_CHANGE}\n */\n public on(event: typeof Conversation.CALL_STATE_CHANGE, listener: CallStateListener): void\n\n /**\n * Registers an event listener for the given event.\n * @deprecated The end event is not always available, depending on the configuration. Use instead {@link CONVERSATION_STATE_CHANGE} event.\n * @param event The end event.\n * @param listener The listener to be called.\n * @see {@link END}\n */\n public on(event: typeof Conversation.END, listener: () => void): void\n\n /**\n * Registers an event listener for the given event.\n * @param event The close event.\n * @param listener The listener to be called.\n * @see {@link CLOSE}\n */\n public on(event: typeof Conversation.CLOSE, listener: () => void): void\n\n /**\n * Registers an event listener for the given event.\n * @param event The invitations change event.\n * @param listener The listener to be called.\n * @see {@link INVITATIONS_CHANGE}\n */\n public on(event: typeof Conversation.INVITATIONS_CHANGE, listener: InvitationsListener): void\n \n /**\n * Registers an event listener for the given event.\n * @param event The customActionInvocation event.\n * @param listener The listener to be called.\n * @see {@link CUSTOM_ACTION_INVOCATION}\n */\n public on(event: typeof Conversation.CUSTOM_ACTION_INVOCATION, listener: CustomActionInvocationListener): void\n\n /**\n * Adds a listener.\n * @param event The event to register.\n * @param listener The listener to register.\n */\n public on(event: ConversationEventType, listener: Listener): void {\n this.checkNotDestroyed()\n const needsInternalSubscription = !this.eventEmitter.hasListeners(event)\n this.eventEmitter.on(event, listener)\n if (needsInternalSubscription)\n this.onInternal(event)\n }\n\n /**\n * Removes a previously registered listener.\n * @param event The event to unregister from.\n * @param listener The listener to remove.\n */\n public off(event: ConversationEventType, listener: Listener): boolean {\n this.checkNotDestroyed()\n const removed = this.eventEmitter.off(event, listener)\n if (!this.eventEmitter.hasListeners(event))\n this.offInternal(event)\n return removed\n }\n\n private onInternal(eventName: ConversationEventType) {\n let internalListener: EventCallback\n switch (eventName) {\n case Conversation.CONNECTION_STATE_CHANGE:\n internalListener = (event: Event) => {\n if (event.data.conversationId == this.conversationId)\n this.eventEmitter.emit(event.name, event.data.connectionState)\n }\n break\n case Conversation.CONVERSATION_STATE_CHANGE:\n internalListener = (event: Event) => {\n if (event.data.conversationId == this.conversationId)\n this.eventEmitter.emit(event.name, event.data.conversationState)\n }\n break\n case Conversation.CALL_STATE_CHANGE:\n internalListener = (event: Event) => {\n if (event.data.conversationId == this.conversationId)\n this.eventEmitter.emit(event.name, event.data.callState)\n }\n break\n case Conversation.INVITATIONS_CHANGE:\n internalListener = (event: Event) => {\n if (event.data.conversationId == this.conversationId)\n this.eventEmitter.emit(event.name, event.data.invitations)\n }\n break\n case Conversation.CUSTOM_ACTION_INVOCATION:\n \tinternalListener = (event: Event) => {\n if (event.data.conversation.id == this.conversationId)\n this.eventEmitter.emit(event.name, event.data)\n }\n break\n default:\n internalListener = (event: Event) => {\n if (event.data == this.conversationId) {\n this.eventEmitter.emit(event.name)\n }\n }\n break\n }\n this.internalListeners[eventName] = internalListener\n this.conversationModule.on(eventName, internalListener).catch(e => console.warn('Error registering internal listener for event:', eventName, 'error:' + e, e))\n }\n\n private offInternal(eventName: ConversationEventType) {\n const listener = this.internalListeners[eventName]\n if (listener == null)\n return\n delete this.internalListeners[eventName]\n this.conversationModule.off(eventName, listener).catch(e => console.warn('Error removing internal listener for event:', eventName, 'error:' + e, e))\n }\n\n /**\n * Returns the ID of this conversation.\n */\n public getConversationId(): string {\n return this.conversationId\n }\n\n /**\n * Returns the current connection state the conversation is in.\n *\n * If the connection is lost, the conversation will automatically try to reconnect using an exponential back-off strategy.\n * If a fatal error is detected, the state will change to {@link ConnectionState.ERROR}.\n *\n * If this happens, the conversation is in it's terminal state. A dialog or other UI will be displayed to the user with details on the failure.\n * The conversation is not automatically closed in this case.\n * It may either be closed through a manual action by the visitor (confirming the error) or via the API.\n *\n * @see {@link CONNECTION_STATE_CHANGE} if you need to listen to changes.\n * @return A promise that resolves to the current connection state of the conversation\n * or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async getConnectionState(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.getConnectionState(this.conversationId)\n }\n\n /**\n * Returns the current state the conversation is in.\n * @return A promise that resolves to the current state of the conversation\n * or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async getConversationState(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.getConversationState(this.conversationId)\n }\n\n /**\n * @see {@link CALL_STATE_CHANGE} if you need to listen to changes.\n * @return A promise that resolves to the current call state of the local user\n * or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async getCallState(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.getCallState(this.conversationId)\n }\n\n /**\n * Creates a new PIN invitation for this conversation.\n *\n * - If the local person doesn't have the right to invite a visitor,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.\n * @see {@link INVITATIONS_CHANGE} if you need to listen to changes for new invitations on this conversation.\n * @return A promise that resolves to a new {@link Invitation} object with all relevant metadata.\n * or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async createAnonymousPinInvitation(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.createAnonymousPinInvitation(this.conversationId)\n }\n\n /**\n * Creates a new EMail invitation for this conversation.\n *\n * - If the local person doesn't have the right to invite a visitor,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.\n * - If a non valid email address is provided,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.INVALID_FUNCTION_ARGUMENTS}.\n * @param email The email which the invitation should be send. It must be a valid email address.\n * @see {@link INVITATIONS_CHANGE} If you need to listen to changes for new invitations on this conversation.\n * @return A promise that resolves to a new {@link Invitation} object with all relevant metadata.\n * or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async createAnonymousEmailInvitation(email: String): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.createAnonymousEmailInvitation(this.conversationId, email)\n }\n\n /**\n * Revoke an invitation.\n *\n * - If the local person doesn't have the right to invite a visitor,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.\n * @param invitationId The invitation id.\n * @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async revokeInvitation(invitationId: String): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.revokeInvitation(this.conversationId, invitationId)\n }\n\n /**\n * Renews an invitation PIN if the invitation is expired.\n *\n * - If the local person doesn't have the right to invite a visitor,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.\n * @param invitationId The invitation id.\n * @return A promise that resolves to a new {@link Invitation} object with all relevant metadata.\n */\n public async renewInvitationPin(invitationId: String): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.renewInvitationPin(this.conversationId, invitationId)\n }\n\n /**\n * Set custom visitor data on the conversation.\n *\n * @param visitorData Custom data for the visitor in any format.\n */\n public async setVisitorData(visitorData: String) : Promise {\n this.checkNotDestroyed();\n return this.conversationModule.setVisitorData(visitorData);\n }\n\n /**\n * Get all visitor invitations created by the local person for this conversation.\n * @return A promise that resolves to a new {@link Invitation} array with all relevant metadata.\n * or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async getInvitations(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.getInvitations(this.conversationId)\n }\n\n /**\n * Starts a voice call in this conversation.\n *\n * - If a call is already active, this call will be ignored.\n * - If the local person doesn't have the right to start a voice call,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.\n * @see {@link CALL_STATE_CHANGE} If you need to listen to changes.\n * @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async startAudioCall(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.startAudioCall(this.conversationId)\n }\n\n /**\n * Starts a video call in this conversation.\n *\n * - If a call is already active, this call will be ignored.\n * - If the local person doesn't have the right to start a video call,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.\n * @see {@link CALL_STATE_CHANGE} If you need to listen to changes.\n * @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async startVideoCall(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.startVideoCall(this.conversationId)\n }\n\n /**\n * Ends and closes this conversation.\n *\n * If the local person doesn't have the right to end the conversation,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.\n * @see {@link END} fired after this call.\n * @see {@link closeConversation} for details on closing a conversation.\n * @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async endConversation(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.endConversation(this.conversationId)\n }\n\n /**\n * Leaves and closes this conversation.\n *\n * By leaving, the visitor is removed from the active participant list of the conversation.\n * Once a conversation is left, the visitor can not re-open it. It will not be visible in the conversation history either.\n *\n * If the local person doesn't have the right to leave the conversation,\n * the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.\n * @see {@link CLOSE} fired after this call.\n * @see {@link closeConversation} for details on closing a conversation without leaving.\n * @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async leaveConversation(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.leaveConversation(this.conversationId)\n }\n\n /**\n * Closes this conversation locally.\n *\n * When called, the connection to this conversation is closed and the overview is displayed.\n *\n * **Note that:**\n * - Closing does NOT end the conversation.\n * - The person does NOT leave the conversation.\n * - All Conversation api instances for this conversation will be destroyed.\n *\n * The conversation can be joined again either via the UI or using {@link UnbluApi.openConversation}.\n * @see {@link CLOSE} fired after this call.\n * @see {@link endConversation} for details on ending a conversation.\n * @see {@link leavingConversation} for details on leaving a conversation.\n * @see {@link destroy} for details on destroying a conversation.\n * @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.\n */\n public async closeConversation(): Promise {\n this.checkNotDestroyed()\n return this.conversationModule.closeConversation(this.conversationId)\n }\n\n private checkNotDestroyed(): void {\n if (this.destroyed) throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Error: trying to execute method on destroyed conversation object.')\n }\n\n /**\n * Returns weather this conversation is destroyed or not.\n *\n * Conversations are destroyed if {@link destroy} is called or the conversation is closed.\n * This usually happens when the user navigates back to an overview or into an other conversation.\n * @see {@link destroy}\n * @see {@link CLOSE}\n * @return Weather this conversation is destroyed or not.\n */\n public isDestroyed(): boolean {\n return this.destroyed\n }\n\n /**\n * Destroys this conversation API instance.\n *\n * Calling destroy will unregister all event listeners and prohibit any further calls to this object.\n * Once the conversation is destroyed, any subsequent calls will reject the returned promise with {@link UnbluErrorType.ILLEGAL_STATE} as the reason.\n *\n * **Note that:**\n * - Destroying does NOT close the conversation .\n * - Destroying does NOT end the conversation.\n * - Destroying does NOT leave the conversation.\n * - Other instances of the same Conversation will NOT be destroyed.\n *\n * This call simply destroys this local API instance to the conversation.\n *\n * A destroyed but still open conversation can be accessed again using {@link UnbluApi.getActiveConversation}.\n *\n * @see {@link isDestroyed}\n * @see {@link closeConversation} for details on how to close a conversation\n * @see {@link endConversation} for details on how to end a conversation\n */\n public destroy(): void {\n if (this.destroyed) return\n this.destroyed = true\n this.eventEmitter.reset()\n for (let event in this.internalListeners) {\n this.offInternal(event as ConversationEventType)\n }\n }\n}","import {EventCallback} from './event'\nimport {UnbluApiError, UnbluErrorType} from '../unblu-api-error'\nimport {\n CATEGORY_ACTION_NOT_GRANTED,\n CATEGORY_EXECUTION_EXCEPTION,\n CATEGORY_INVALID_FUNCTION_ARGUMENTS,\n CATEGORY_INVALID_FUNCTION_CALL,\n CATEGORY_TIMEOUT\n} from './java-error-codes'\n\n\nconst SUPPORTED_MAJOR_VERSION = 2\n\ninterface ApiConsumer {\n onUnbluEvent(event: Event): Promise\n}\n\ninterface CollabServerInternalApi {\n getApiVersion(): string\n\n execute(moduleName: string, functionName: string, args: any[]): Promise\n\n registerEventListener(moduleName: string, eventName: string, listener: EventCallback): Promise\n\n removeEventListener(moduleName: string, eventName: string, listener: EventCallback): Promise\n}\n\nexport class ApiBridge {\n private internal: CollabServerInternalApi\n private readonly eventHandler: ApiConsumer\n\n /**\n * instantiates the bridge that links the UNBLU internal API provided by the collaboration server with the UNBLU JS-API\n * @param mountPoint the global unblu object under which the internal API is registered.\n */\n constructor(private mountPoint: any, private mountName: string) {\n }\n\n public async waitUntilLoaded(timeout: number, promise?: Promise): Promise {\n const timeoutTimestamp = Date.now() + timeout\n return new Promise((resolve, reject) => {\n const waitForLoaded = () => {\n if (timeoutTimestamp - Date.now() > 0) {\n if (this.checkLoaded()) return resolve()\n setTimeout(waitForLoaded, 50)\n } else {\n reject(new UnbluApiError(UnbluErrorType.INITIALIZATION_TIMEOUT, 'Timeout while waiting for collaboration server API to be loaded.'))\n }\n }\n waitForLoaded()\n })\n }\n\n private checkLoaded(): boolean {\n const error = this.mountPoint['loadError']\n if (error) {\n throw new UnbluApiError(error.type, error.detail)\n }\n this.internal = this.mountPoint[this.mountName]\n return this.internal != null\n }\n\n\n public checkCompatibility(): void {\n if (!this.internal) {\n throw new UnbluApiError(UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION, 'Incompatible unblu collaboration server, no API bridge provided.')\n } else if (typeof this.internal.getApiVersion !== 'function') {\n throw new UnbluApiError(UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION, 'Incompatible unblu collaboration server, incompatible API bridge.')\n }\n const version = this.internal.getApiVersion()\n if (+version[0] != SUPPORTED_MAJOR_VERSION) {\n throw new UnbluApiError(UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION, `Incompatible collaboration server version. \n Supported API version: ${SUPPORTED_MAJOR_VERSION}.x.x.\n collaboration server API version: ${version}.`)\n }\n }\n\n\n /**\n * Calls an API function of the internal unblu collaboration server API.\n * @param moduleName The module to which the function belongs.\n * @param functionName The function to call.\n * @param args The arguments to pass to the function.\n */\n public async callApiFunction(moduleName: string, functionName: string, args: any[]): Promise {\n try {\n return await this.internal.execute(moduleName, functionName, args)\n } catch (e) {\n switch (e.type) {\n case CATEGORY_INVALID_FUNCTION_CALL:\n throw new UnbluApiError(UnbluErrorType.INVALID_FUNCTION_CALL, e.message)\n case CATEGORY_INVALID_FUNCTION_ARGUMENTS:\n throw new UnbluApiError(UnbluErrorType.INVALID_FUNCTION_ARGUMENTS, e.message)\n case CATEGORY_ACTION_NOT_GRANTED:\n throw new UnbluApiError(UnbluErrorType.ACTION_NOT_GRANTED, e.message)\n case CATEGORY_EXECUTION_EXCEPTION:\n throw new UnbluApiError(UnbluErrorType.EXECUTION_EXCEPTION, e.message)\n case CATEGORY_TIMEOUT:\n throw new UnbluApiError(UnbluErrorType.TIMEOUT, e.message)\n default:\n throw new UnbluApiError(UnbluErrorType.EXECUTION_EXCEPTION, '' + e)\n }\n }\n }\n\n /**\n * Registers a callback for an event emitted by the internal unblu collaboration server API.\n * @param module The module that emits the event.\n * @param event The event name.\n * @param callback The callback which will be called every time the event is emitted.\n */\n public on(module: string, event: string, callback: EventCallback): Promise {\n return this.internal.registerEventListener(module, event, callback)\n }\n\n /**\n * Unregisters a callback for an event emitted by the internal unblu collaboration server API.\n * @param module The module that emits the event.\n * @param event The event name.\n * @param callback Optionally callback which will be removed, if none is provided all listeners of the event will be removed.\n */\n public off(module: string, event: string, callback?: EventCallback): Promise {\n return this.internal.removeEventListener(module, event, callback)\n }\n\n}","export const CATEGORY_INVALID_FUNCTION_CALL = 1\nexport const CATEGORY_INVALID_FUNCTION_ARGUMENTS = 2\nexport const CATEGORY_EXECUTION_EXCEPTION = 3\nexport const CATEGORY_ACTION_NOT_GRANTED = 4\nexport const CATEGORY_TIMEOUT= 5","import {InternalModule} from './module'\nimport {ApiBridge} from '../api-bridge'\nimport {AgentAvailabilityState} from '../../model/agent-availability-state'\n\n\nexport type AgentAvailabilityEventType =\n 'availableChange'\n | 'availabilityChange'\n\nconst enum AgentAvailabilityFunction {\n isAgentAvailable = 'isAgentAvailable',\n getAgentAvailabilityState = 'getAgentAvailabilityState'\n}\n\nexport class AgentAvailabilityModule extends InternalModule {\n constructor(bridge: ApiBridge) {\n super(bridge, 'agentavailability')\n }\n\n public isAgentAvailable(): Promise {\n return this.callApiFunction(AgentAvailabilityFunction.isAgentAvailable, [])\n }\n\n public getAgentAvailabilityState(): Promise {\n return this.callApiFunction(AgentAvailabilityFunction.getAgentAvailabilityState, [])\n }\n}","import {ApiBridge} from \"../api-bridge\"\nimport {InternalModule} from \"./module\"\nimport {NewConversationInterceptor} from \"../../new-conversation-interceptor\"\nimport {ConversationType} from \"../../model/conversation-type\"\nimport {PersonInfo} from \"../../model/person-info\"\nimport {ConversationInfo} from \"../../model/conversation-info\"\nimport {ConversationRecipient} from \"../../model/conversation-recipient\";\n\nexport type BaseGeneralEventType =\n 'activeConversationChange' |\n 'conversationsChange' |\n 'notificationCountChange' |\n 'personChange' |\n 'personActivity'\n\nexport enum BaseGeneralFunction {\n startConversation = 'startConversation',\n setNewConversationInterceptor = 'setNewConversationInterceptor',\n joinConversation = 'joinConversation',\n openConversation = 'openConversation',\n getActiveConversation = 'getActiveConversation',\n getConversations = 'getConversations',\n getNotificationCount = 'getNotificationCount',\n getPersonInfo = 'getPersonInfo',\n setPersonNickname = 'setPersonNickname'\n}\n\nexport class BaseGeneralModule extends InternalModule {\n constructor(bridge: ApiBridge) {\n super(bridge, 'general')\n }\n\n public startConversation(type: ConversationType, visitorName?: string, visitorData?: string, recipient?: ConversationRecipient): Promise {\n return this.callApiFunction(BaseGeneralFunction.startConversation, [type, visitorName, visitorData, recipient])\n }\n\n public setNewConversationInterceptor(callback: NewConversationInterceptor): Promise {\n return this.callApiFunction(BaseGeneralFunction.setNewConversationInterceptor, [callback])\n }\n\n public joinConversation(pin: string, visitorName?: string): Promise {\n return this.callApiFunction(BaseGeneralFunction.joinConversation, [pin, visitorName])\n }\n\n public openConversation(conversationId: string): Promise {\n return this.callApiFunction(BaseGeneralFunction.openConversation, [conversationId])\n }\n\n public getActiveConversation(): Promise {\n return this.callApiFunction(BaseGeneralFunction.getActiveConversation, [])\n }\n\n public getConversations(): Promise {\n return this.callApiFunction(BaseGeneralFunction.getConversations, [])\n }\n\n public getNotificationCount(): Promise {\n return this.callApiFunction(BaseGeneralFunction.getNotificationCount, [])\n }\n\n public getPersonInfo(): Promise {\n return this.callApiFunction(BaseGeneralFunction.getPersonInfo, [])\n }\n\n public setPersonNickname(nickname: string): Promise {\n return this.callApiFunction(BaseGeneralFunction.setPersonNickname, [nickname])\n }\n}","import {InternalModule} from './module'\nimport {ApiBridge} from '../api-bridge'\nimport {CallState} from '../../model/call-state'\nimport {ConversationState} from '../../model/conversation-state'\nimport {ConnectionState} from '../../model/connection-state'\nimport {Invitation} from \"../../model/invitation\"\n\n\nexport interface ConversationCallState {\n conversationId: string\n callState: CallState\n}\n\nexport interface ConversationConnectionState {\n conversationId: string\n connectionState: ConnectionState\n}\n\nexport interface ConversationWithState {\n conversationId: string\n conversationState: ConversationState\n}\n\nexport interface ConversationInvitations {\n conversationId: string\n invitations: Invitation[]\n}\n\nexport type ConversationEventType =\n 'connectionStateChange' |\n 'conversationStateChange' |\n 'end' |\n 'close' |\n 'personChange' |\n 'callStateChange' |\n 'invitationsChange' |\n 'customActionInvocation'\n\nconst enum ConversationFunction {\n getConnectionState = 'getConnectionState',\n getConversationState = 'getConversationState',\n getCallState = 'getCallState',\n startAudioCall = 'startAudioCall',\n startVideoCall = 'startVideoCall',\n endConversation = 'endConversation',\n leaveConversation = 'leaveConversation',\n closeConversation = 'closeConversation',\n createAnonymousPinInvitation = 'createAnonymousPinInvitation',\n createAnonymousEmailInvitation = 'createAnonymousEmailInvitation',\n getInvitations = 'getInvitations',\n revokeInvitation = 'revokeInvitation',\n renewInvitationPin = 'renewInvitationPin',\n setVisitorData = 'setVisitorData'\n}\n\nexport class ConversationModule extends InternalModule {\n constructor(bridge: ApiBridge) {\n super(bridge, 'conversation')\n }\n\n public getConnectionState(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.getConnectionState, [conversationId])\n }\n\n public getConversationState(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.getConversationState, [conversationId])\n }\n\n public getCallState(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.getCallState, [conversationId])\n }\n\n public startAudioCall(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.startAudioCall, [conversationId])\n }\n\n public startVideoCall(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.startVideoCall, [conversationId])\n }\n\n public endConversation(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.endConversation, [conversationId])\n }\n\n public leaveConversation(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.leaveConversation, [conversationId])\n }\n\n public closeConversation(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.closeConversation, [conversationId])\n }\n\n public createAnonymousPinInvitation(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.createAnonymousPinInvitation, [conversationId])\n }\n\n public createAnonymousEmailInvitation(conversationId: string, email: String): Promise {\n return this.callApiFunction(ConversationFunction.createAnonymousEmailInvitation, [conversationId, email])\n }\n\n public async getInvitations(conversationId: string): Promise {\n return this.callApiFunction(ConversationFunction.getInvitations, [conversationId])\n }\n\n public async revokeInvitation(conversationId: string, invitationId: String): Promise {\n return this.callApiFunction(ConversationFunction.revokeInvitation, [conversationId, invitationId])\n }\n\n public async renewInvitationPin(conversationId: string, invitationId: String): Promise {\n return this.callApiFunction(ConversationFunction.renewInvitationPin, [conversationId, invitationId])\n }\n\n public async setVisitorData(visitorData: String) : Promise {\n return this.callApiFunction(ConversationFunction.setVisitorData, [visitorData]);\n }\n}","import {ApiBridge} from '../api-bridge'\nimport {EventCallback} from '../event'\n\nexport class InternalModule {\n constructor(private bridge: ApiBridge, public moduleName: string) {\n\n }\n\n protected callApiFunction(functionName: T, args: any[]): Promise {\n return this.bridge.callApiFunction(this.moduleName, functionName, args)\n }\n\n public on(eventName: E, listener: EventCallback): Promise {\n return this.bridge.on(this.moduleName, eventName, listener)\n }\n\n public off(eventName: E, listener: EventCallback): Promise {\n return this.bridge.off(this.moduleName, eventName, listener)\n }\n\n}","// Typedef Helpers\n/**\n * @hidden\n */\nimport {ApiState} from \"../api-state\"\nimport {UnbluApiFactory} from \"./unblu-api-factory\"\nimport {InitializedUnbluApi} from \"./initialized-unblu-api\"\nimport {InitializedUnbluElement} from \"./initialized-unblu-element\"\nimport {UnbluApiError, UnbluErrorType} from \"../unblu-api-error\";\nimport {Configuration} from \"../model/configuration\";\n\nexport enum IntegrationType {\n embedded = 'embedded',\n floating = 'floating'\n}\n\nenum EntryPoint {\n siteIntegrationGreedyMain = 'SiteIntegrationGreedyMain',\n siteIntegrationLazyMain = 'SiteIntegrationLazyMain',\n siteEmbeddedMain = 'SiteEmbeddedMain'\n}\n\n/**\n * Internal type definition of the unblu object.\n */\nexport interface UnbluObject {\n api?: UnbluApiFactory,\n\n /**\n * internal unblu field\n * @hidden\n */\n APIKEY?: string,\n /**\n * internal unblu field\n * @hidden\n */\n SERVER?: string,\n /**\n * internal unblu field\n * @hidden\n */\n l?: string,\n /**\n * internal unblu field\n * @hidden\n */\n entryPoint?: EntryPoint\n /**\n * internal unblu field\n * @hidden\n */\n globalPrefix?: string\n}\n\nclass NamedAreaMetaTag extends Element {\n originalContent: string\n}\n\ninterface UnbluInternal {\n $_baseCfg: BaseConfig\n}\n\ninterface BaseConfig {\n entryPath?: string\n}\n\nexport class UnbluUtil {\n static async loadScript(uri: string, timeout: number): Promise {\n const timeoutTime = timeout || 30000\n const script = document.createElement('script')\n script.setAttribute('charset', 'UTF-8')\n script.setAttribute('type', 'text/javascript')\n script.setAttribute('async', 'true')\n script.setAttribute('timeout', timeoutTime.toString())\n script.src = uri\n\n return new Promise(function (resolve, reject) {\n let timeoutId: number\n\n const cleanup = () => {\n // avoid mem leaks in IE.\n script.onerror = script.onload = null\n window.clearTimeout(timeoutId)\n }\n\n const onError = (error: string | Event) => {\n cleanup()\n console.error('Failed to load script! Uri:', uri, 'Error:', error)\n reject(error)\n }\n\n script.onload = () => {\n cleanup()\n resolve()\n }\n script.onerror = onError\n timeoutId = window.setTimeout(() => onError('Timeout'), timeoutTime)\n\n const head = document.getElementsByTagName('HEAD')[0]\n head.appendChild(script)\n })\n }\n\n static getNamedArea(): string | undefined {\n const existingMetaTag: NamedAreaMetaTag = window.document.querySelector('meta[name=\"unblu:named-area\"]')\n return existingMetaTag ? existingMetaTag.getAttribute('content') : undefined\n }\n\n static setNamedArea(namedArea: string): void {\n const existingMetaTag: NamedAreaMetaTag = window.document.querySelector('meta[name=\"unblu:named-area\"]')\n if (existingMetaTag && !existingMetaTag.originalContent) {\n existingMetaTag.originalContent = existingMetaTag.getAttribute('content')\n }\n const metaTag = existingMetaTag || window.document.createElement('meta')\n metaTag.setAttribute('name', 'unblu:named-area')\n metaTag.setAttribute('content', namedArea)\n if (!metaTag.parentElement) {\n window.document.head.appendChild(metaTag)\n }\n }\n\n static removeNamedArea(): void {\n const metaTag: NamedAreaMetaTag = window.document.querySelector('meta[name=\"unblu:named-area\"]')\n\n if (metaTag?.originalContent) {\n metaTag.setAttribute('content', metaTag.originalContent)\n metaTag.originalContent = null\n } else if (metaTag) {\n metaTag.remove()\n }\n }\n\n static setLocale(locale: string): void {\n // unblu.l will be read in user-locale-util.js\n UnbluUtil.getUnbluObject().l = locale\n }\n\n static async loginWithSecureToken(serverUrl: string, apiKey: string, entryPath: string, accessToken: string): Promise {\n const url = `${serverUrl}${entryPath}/rest/v3/authenticator/loginWithSecureToken?x-unblu-apikey=${apiKey}`;\n let response;\n try {\n response = await fetch(url, {\n method: 'POST',\n mode: 'cors',\n cache: 'no-cache',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n redirect: 'follow',\n body: JSON.stringify({\n token: accessToken,\n type: 'JWT'\n })\n });\n } catch (e) {\n throw new UnbluApiError(UnbluErrorType.AUTHENTICATION_FAILED, `Failed to authenticate with provided access token! Reason: ${e}`);\n }\n if(!response.ok) {\n throw new UnbluApiError(UnbluErrorType.AUTHENTICATION_FAILED, `Failed to authenticate with provided access token! Status: ${response.status}; StatusText: ${response.statusText}`);\n }\n }\n\n static async isAuthenticated(serverUrl: string, entryPath: string): Promise {\n const url = `${serverUrl}${entryPath}/rest/v3/authenticator/isAuthenticated`;\n let response;\n try {\n response = await fetch(url, {\n method: 'GET',\n mode: 'cors',\n cache: 'no-cache',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n redirect: 'follow',\n });\n } catch (e) {\n throw new UnbluApiError(UnbluErrorType.AUTHENTICATION_FAILED, `Failed to check if authenticated! Reason: ${e}`);\n }\n if(!response.ok) {\n throw new UnbluApiError(UnbluErrorType.AUTHENTICATION_FAILED, `Failed to check if authenticated! Status: ${response.status}; StatusText: ${response.statusText}`);\n }\n return true === await response.json();\n }\n\n static async logout(serverUrl: string, entryPath: string): Promise {\n const url = `${serverUrl}${entryPath}/rest/v3/authenticator/logout`;\n let response;\n try {\n response = await fetch(url, {\n method: 'POST',\n mode: 'cors',\n cache: 'no-cache',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n redirect: 'follow',\n body: ''\n });\n } catch (e) {\n throw new UnbluApiError(UnbluErrorType.AUTHENTICATION_FAILED, `Failed to logout! Reason: ${e}`);\n }\n if(!response.ok) {\n throw new UnbluApiError(UnbluErrorType.AUTHENTICATION_FAILED, `Failed to logout! Status: ${response.status}; StatusText: ${response.statusText}`);\n }\n }\n\n static isUnbluLoaded(integrationType: IntegrationType): boolean {\n return UnbluUtil.getUnbluObject() && !!UnbluUtil.getUnbluObject().APIKEY && UnbluUtil.entryPointMatches(integrationType)\n }\n\n static generateConfigurationFromLoadedUnblu(): Configuration {\n const unblu = UnbluUtil.getUnbluObject()\n // @ts-ignore\n const unbluInternal: UnbluInternal = window[unblu.globalPrefix];\n return {\n apiKey: unblu.APIKEY,\n serverUrl: unblu.SERVER,\n entryPath: unbluInternal?.$_baseCfg.entryPath,\n locale: unblu.l,\n namedArea: UnbluUtil.getNamedArea()\n }\n }\n\n private static entryPointMatches(integrationType: IntegrationType): boolean {\n if (integrationType === IntegrationType.embedded) {\n return UnbluUtil.getUnbluObject().entryPoint === EntryPoint.siteEmbeddedMain\n } else if (integrationType === IntegrationType.floating) {\n return UnbluUtil.getUnbluObject().entryPoint === EntryPoint.siteIntegrationGreedyMain || UnbluUtil.getUnbluObject().entryPoint === EntryPoint.siteIntegrationLazyMain\n } else {\n return false\n }\n }\n\n static getUnbluObject(): UnbluObject {\n // @ts-ignore\n return window.unblu as unknown as UnbluObject\n }\n\n static createUnbluObject(): UnbluObject {\n // @ts-ignore\n return window.unblu = {}\n }\n\n static getOrCreateUnbluObject(): UnbluObject {\n // @ts-ignore\n return window.unblu || (window.unblu = {})\n }\n\n static async deinitializeFloatingIfNeeded() {\n if (!UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {\n return\n }\n const apiState = UnbluUtil.getUnbluObject().api.getApiState()\n let unbluApi: InitializedUnbluApi\n if (apiState == ApiState.INITIALIZING || apiState == ApiState.INITIALIZED) {\n unbluApi = await UnbluUtil.getUnbluObject().api.initialize()\n await unbluApi.deinitialize()\n }\n }\n\n static async deinitializeEmbeddedIfNeeded(excludedAppElement?: InitializedUnbluElement) {\n const unbluAppElements = document.getElementsByTagName('unblu-embedded-app')\n for (let i = 0; i < unbluAppElements.length; i++) {\n const appElement = unbluAppElements[i] as InitializedUnbluElement\n if (appElement === excludedAppElement) {\n continue\n }\n console.log(\"Deinitializing existing embedded integration:\", appElement)\n await appElement.deinitialize()\n }\n }\n\n static sanitizeParameter(param: string): string {\n if (!param || !param.trim()) {\n return null\n }\n return param\n }\n}","export type Listener = (data?: any) => void;\n\nexport class EventEmitter {\n private listeners: { [key: string]: EventListener[] } = {};\n\n /**\n * Resets the emitter by removing all registered listeners.\n */\n public reset(): void {\n this.listeners = {};\n }\n\n /**\n * Adds an event listeners\n * @param event the event to listen to\n * @param listener the listener to be called.\n */\n public on(event: string, listener: Listener) {\n this.listeners[event] = this.listeners[event] || [];\n if (this.listeners[event].indexOf(listener) === -1)\n this.listeners[event].push(listener);\n }\n\n /**\n * removes a previously registered listener\n * @param event the event\n * @param listener the listener that should be removed.\n * @return `true` if the listener was removed, `false` otherwise.\n */\n off(event: string, listener: any): boolean {\n const listeners = this.listeners[event] || [];\n const index = listeners.indexOf(listener);\n if (index > -1) {\n listeners.splice(index, 1);\n return true;\n }\n return false;\n }\n\n /**\n * removes all listeners for the given event.\n * @param event the event for which all listeners will be removed.\n */\n offAll(event: string) {\n delete this.listeners[event];\n }\n\n /**\n * Checks weather at least one listener exists for a given event.\n * @param event the event to check for\n * @return weather or not any listeners for the given event are registered.\n */\n hasListeners(event: string): boolean {\n return this.listeners[event] != null && this.listeners[event].length > 0;\n }\n\n /**\n * Returns all events that have at least one listeners registered to them.\n * @return An array containing all events that have at least one listener.\n * If no listeners are registered at all, an empty array will be returned.\n */\n getEventsWithListeners(): string[] {\n const events: string[] = [];\n for (let event in this.listeners) {\n if (this.listeners[event].length)\n events.push(event);\n }\n return events;\n }\n\n /**\n * Emits an event dispatching it to all listeners registered for it.\n * @param event the event name.\n * @param data the event data.\n */\n emit(event: string, data?: any) {\n const listeners = this.listeners[event];\n if (listeners) {\n //iterate over a copy of the array as otherwise if listeners unregister themself,\n //it will change the array and iteration will skip them\n [...listeners].forEach(l => {\n try {\n l(data);\n } catch (e) {\n console.warn('Error dispatching event:', event, 'in listener:', l, e);\n }\n });\n }\n }\n\n}","export enum AgentAvailabilityState {\n /**\n\t * There is at least one agent available for the specified named area and locale.\n\t */\n AVAILABLE = 'AVAILABLE',\n\t/**\n\t * There is at least one agent watching the inbound queue for the specified named area and locale but the max capacity of parallel conversations is reached.\n\t *\n\t * It is very likely, that an agent will be available in a short time.\n\t */\n BUSY = 'BUSY',\n /**\n\t * There is currently no agent handling any inbound queue items.\n\t *\n\t * It is very unlikely, that an agent will be available in a short time.\n\t */\n UNAVAILABLE = 'UNAVAILABLE'\n}","export enum CallState {\n /**\n * A some one is trying to call, the phone is ringing\n */\n INBOUND = 'INBOUND',\n /**\n * You are trying to call someone\n */\n OUTBOUND = 'OUTBOUND',\n /**\n * A call is active and the local tab is connected to the call.\n */\n ACTIVE_JOINED = 'ACTIVE_JOINED',\n /**\n * A call is active but the local person has declined it.\n */\n ACTIVE_NOT_JOINED = 'ACTIVE_NOT_JOINED',\n /**\n * A call is active and the local person has joined it on an other device.\n */\n ACTIVE_JOINED_ELSEWHERE = 'ACTIVE_JOINED_ELSEWHERE',\n /**\n * No inbound, outgoing or active call.\n */\n NONE = 'NONE'\n}\n\n","export enum ConnectionState {\n /**\n * Initial state before connection establishment has started\n */\n INITIAL = 'INITIAL',\n\n /**\n * State during the first connection to the server\n */\n CONNECTING = 'CONNECTING',\n\n /**\n * The connection has been successfully established.\n */\n CONNECTED = 'CONNECTED',\n\n /**\n * The connection has been lost, reconnect is active.\n */\n RECONNECTING = 'RECONNECTING',\n\n /**\n * The connection has been successfully closed.\n *\n */\n CLOSED = 'CLOSED',\n\n /**\n * A fatal error has occurred. The connection has been permanently lost. No reconnect will be be possible.\n */\n ERROR = 'ERROR'\n}\n\n","export enum ConversationRecipientType {\n /**\n * The recipient type for a conversation is an agent\n */\n AGENT = 'AGENT',\n /**\n * The recipient type for a conversation is a team\n */\n TEAM = 'TEAM'\n}","export enum ConversationState {\n /**\n * Initial state of a conversation\n */\n CREATED = 'CREATED',\n\n /**\n * Depending of the engagement type of the conversation, the conversation stays in the onboarding state as long as the person in the center of the conversation\n * is doing his onboarding\n */\n ONBOARDING = 'ONBOARDING',\n\n /**\n * When a message is send to an unassigned conversation, the conversation first is put into the reboarding state as long as the person in the center of the\n * conversation is doing the reboarding.\n */\n REBOARDING = 'REBOARDING',\n\n /**\n * Depending of the engagement type of the conversation, the conversation is put in the queued state when it is inside the queue.\n */\n QUEUED = 'QUEUED',\n\n /**\n * Conversation is active\n */\n ACTIVE = 'ACTIVE',\n\n /**\n * After there is no assignee of a conversation anymore, the conversation goes to unassigned state until a message from a visitor is written to start reboarding\n * again.\n */\n UNASSIGNED = 'UNASSIGNED',\n\n /**\n * Conversation is being ended\n */\n OFFBOARDING = 'OFFBOARDING',\n\n /**\n * Conversation is ended\n */\n ENDED = 'ENDED'\n}","export enum ConversationType {\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming chat conversation.\n */\n CHAT_REQUEST = 'CHAT_REQUEST',\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming chat conversation while all agents are offline.\n */\n OFFLINE_CHAT_REQUEST = 'OFFLINE_CHAT_REQUEST',\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming video conversation.\n */\n VIDEO_REQUEST = 'VIDEO_REQUEST',\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming audio conversation.\n */\n AUDIO_REQUEST = 'AUDIO_REQUEST',\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming universal co-browsing conversation.\n */\n HEADLESS_BROWSER_REQUEST = 'HEADLESS_BROWSER_REQUEST',\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming embedded co-browsing conversation.\n */\n DOMCAP_BROWSER_REQUEST = 'DOMCAP_BROWSER_REQUEST',\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming mobile co-browsing conversation.\n */\n MOBILE_COBROWSING_REQUEST = 'MOBILE_COBROWSING_REQUEST',\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming whiteboard conversation.\n */\n WHITEBOARD_REQUEST = 'WHITEBOARD_REQUEST',\n /**\n * (Visitor initiated, visitor centered) A visitor creates an incoming screen sharing conversation.\n */\n SCREEN_SHARING_REQUEST = 'SCREEN_SHARING_REQUEST',\n /**\n * (Api initiated, visitor centered) A visitor creates a conversation via API which is not added to the queue and where he can invite other visitor to do\n * embedded\n */\n VISITOR_COBROWSING = 'VISITOR_COBROWSING',\n}","export enum InvitationStatus {\n /**\n * Invitation is open however it may have expired.\n */\n OPEN = 'OPEN',\n /**\n * Invitation is redeemed.\n */\n REDEEMED = 'REDEEMED',\n /**\n * Invitation is revoked.\n */\n REVOKED = 'REVOKED'\n}","/**\n * Type of an unblu error. This can be used to check what kind of error occurred.\n */\nexport enum UnbluErrorType {\n /**\n * Thrown if the browser is not supported by unblu.\n */\n UNSUPPORTED_BROWSER = 'UNSUPPORTED_BROWSER',\n /**\n * Thrown if the initialization of the unblu API failed due to a timeout.\n */\n INITIALIZATION_TIMEOUT = 'INITIALIZATION_TIMEOUT',\n /**\n * Thrown if the initialization is called with no existing snippet and no configuration.\n */\n CONFIGURATION_MISSING = 'CONFIGURATION_MISSING',\n /**\n * Thrown if the login against the Unblu collaboration server failed.\n */\n AUTHENTICATION_FAILED = 'AUTHENTICATION_FAILED',\n /**\n * Thrown during initialization if the snippet can't be loaded or unblu can't be initialized from the snippet.\n */\n ERROR_LOADING_UNBLU = 'ERROR_LOADING_UNBLU',\n /**\n * Thrown if the unblu JS API is not compatible with the unblu collaboration server.\n */\n INCOMPATIBLE_UNBLU_VERSION = 'INCOMPATIBLE_UNBLU_VERSION',\n /**\n * Thrown if a function call was invalid.\n * This is usually do to an incompatibility between the unblu JS API and the unblu collaboration server.\n */\n INVALID_FUNCTION_CALL = 'INVALID_FUNCTION_CALL',\n /**\n * Thrown if the arguments passed to a function where invalid.\n */\n INVALID_FUNCTION_ARGUMENTS = 'INVALID_FUNCTION_ARGUMENTS',\n /**\n * Thrown if a called action is not permitted for the local person.\n * The details message usually has more information about the required permissions.\n */\n ACTION_NOT_GRANTED = 'ACTION_NOT_GRANTED',\n /**\n * Thrown if an unexpected exception occurrs during a function execution.\n */\n EXECUTION_EXCEPTION = 'EXECUTION_EXCEPTION',\n /**\n * Thrown if a method is called in an invalid context. E.g. if the Object called upon was already destroyed.\n */\n ILLEGAL_STATE = 'ILLEGAL_STATE',\n /**\n * Thrown if a timeout ocurrs.\n */\n TIMEOUT = 'TIMEOUT'\n}\n\n/**\n * General unblu JS API error class that will be thrown whenever something goes wrong.\n *\n * - Use the {@link UnbluApiError.type} to check what kind of error occurred.\n * - Use the {@link UnbluApiError.detail} for human readable details.\n *\n * Check the documentation of {@link UnbluErrorType} for more details on the different error types.\n *\n * Example:\n * ```ts\n * unblu.api.initialize().then(api => {\n * // use the api\n * }).catch(e => {\n * if(e.type === 'INITIALIZATION_TIMEOUT') {\n * //retry\n * } else if(e.type === 'UNSUPPORTED_BROWSER') {\n * // display unsupported browser dialog\n * } else {\n * // show generic error message\n * }\n * })\n * ```\n *\n * or using async / await:\n *\n * ```ts\n * try {\n * const api = await unblu.api.initialize()\n * // use the api\n * } catch(e) {\n * if(e.type === 'INITIALIZATION_TIMEOUT') {\n * //retry\n * } else if(e.type === 'UNSUPPORTED_BROWSER') {\n * // display unsupported browser dialog\n * } else {\n * // show generic error message\n * }\n * }\n * ```\n *\n *\n * The error types may either be checked via their constant string values or via the UnbluErrorType enum:\n *\n * ```ts\n * // using string constant\n * function isTimeout(e: UnbluApiError) {\n * return e.type === 'INITIALIZATION_TIMEOUT'\n * }\n * ```\n * ```ts\n * // using the enum\n * function isTimeout(e: UnbluApiError) {\n * return e.type === window.unblu.UnbluErrorType.INITIALIZATION_TIMEOUT\n * }\n * ```\n *\n */\nexport class UnbluApiError extends Error {\n\n constructor(public type: UnbluErrorType, public detail: string) {\n super(`type: ${type}, detail: ${detail}`)\n this.name = 'UnbluApiError'\n }\n\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","import {\n AgentAvailabilityChangeListener,\n AgentAvailableChangeListener,\n ConversationChangeListener,\n ConversationsChangeListener,\n NotificationCountChangeListener,\n PersonChangeListener,\n PersonActivityListener,\n UnbluApi\n} from './unblu-api'\nimport {\n CallStateListener,\n ConnectionStateListener,\n Conversation,\n ConversationStateListener,\n InvitationsListener,\n CustomActionInvocationListener\n} from './shared/conversation'\nimport {NewConversationInterceptor} from \"./shared/new-conversation-interceptor\"\nimport {NewConversationInterceptorResult} from \"./shared/model/new-conversation-interceptor-result\"\nimport {ApiState} from \"./shared/api-state\"\nimport {Configuration, ErrorListener, ReadyListener, UnbluStaticApi} from './unblu-static-api'\nimport {UnbluUtil} from './shared/internal/unblu-util'\nimport {CallState} from './shared/model/call-state'\nimport {ConnectionState} from './shared/model/connection-state'\nimport {ConversationType} from './shared/model/conversation-type'\nimport {ConversationRecipient} from \"./shared/model/conversation-recipient\"\nimport {ConversationRecipientType} from \"./shared/model/conversation-recipient-type\"\nimport {AgentAvailabilityState} from './shared/model/agent-availability-state'\nimport {ConversationState} from './shared/model/conversation-state'\nimport {UnbluApiError, UnbluErrorType} from './shared/unblu-api-error'\nimport {IndividualUiState} from \"./model/individualui_state\"\nimport {ActiveIndividualUiView} from \"./model/individualui_component\"\nimport {InvitationStatus} from \"./shared/model/invitation-status\"\nimport {UiActiveIndividualUiViewChangeListener,UiStateChangeListener, UnbluUiApi} from \"./unblu-api-ui\"\nimport {ConversationInfo} from \"./shared/model/conversation-info\"\nimport {Invitation} from \"./shared/model/invitation\"\nimport {PersonInfo} from \"./shared/model/person-info\"\nimport {CustomActionInvocation} from \"./shared/model/customaction/custom-action-invocation\"\n\nexport {AgentAvailabilityState}\nexport {ApiState, UnbluStaticApi, Configuration, ErrorListener, ReadyListener}\nexport {CallState}\nexport {ConnectionState}\nexport {ConversationState}\nexport {ConversationType}\nexport {IndividualUiState}\nexport {ActiveIndividualUiView}\nexport {InvitationStatus}\nexport {UnbluErrorType}\nexport {Conversation, CallStateListener, ConnectionStateListener, ConversationStateListener, InvitationsListener, CustomActionInvocationListener}\nexport {\n UnbluApi,\n AgentAvailableChangeListener,\n AgentAvailabilityChangeListener,\n ConversationChangeListener,\n ConversationsChangeListener,\n NewConversationInterceptor,\n NewConversationInterceptorResult,\n ConversationRecipient,\n ConversationRecipientType,\n NotificationCountChangeListener,\n PersonChangeListener,\n PersonActivityListener\n}\nexport {UnbluApiError}\nexport {UnbluUiApi, UiActiveIndividualUiViewChangeListener, UiStateChangeListener}\nexport {ConversationInfo}\nexport {Invitation}\nexport {PersonInfo}\nexport {CustomActionInvocation}\n\n/**\n * The main unblu namespace which gives access to the Unblu API.\n *\n * Access:\n * ```javascript\n * window.unblu.api\n * ```\n *\n * **Note:** all fields inside the unblu namespace except for the {@link api} are not public and may change without any notice.\n */\nexport interface Unblu {\n /**\n * Access to the Unblu API.\n *\n * This field will be available as soon as the Unblu API has been loaded.\n */\n api?: UnbluStaticApi,\n\n AgentAvailabilityState?: typeof AgentAvailabilityState,\n\n CallState?: typeof CallState,\n\n ConnectionState?: typeof ConnectionState,\n\n ConversationState?: typeof ConversationState,\n\n ConversationType?: typeof ConversationType,\n\n UnbluErrorType?: typeof UnbluErrorType\n}\n\n/**\n * Global window scope definition of the unblu namespace on the window.\n * Access:\n * ```javascript\n * window.unblu.api\n * ```\n * @noInheritDoc\n */\n//this is only for documentation as typedoc does not support global objects any more\nexport declare interface Globals extends Window {\n /**\n * The main unblu namespace\n */\n unblu: Unblu\n}\n\n// TODO: remove in v8\nconst unblu = (UnbluUtil.getUnbluObject() || UnbluUtil.createUnbluObject()) as Unblu\nunblu.AgentAvailabilityState = AgentAvailabilityState\nunblu.CallState = CallState\nunblu.ConnectionState = ConnectionState\nunblu.ConversationState = ConversationState\nunblu.ConversationType = ConversationType\nunblu.UnbluErrorType = UnbluErrorType\n\nexport default {\n /**\n * Access to the Unblu API.\n *\n * This field will be available as soon as the Unblu API has been loaded.\n */\n api: new UnbluStaticApi(),\n\n AgentAvailabilityState: AgentAvailabilityState,\n\n CallState: CallState,\n\n ConnectionState: ConnectionState,\n\n ConversationState: ConversationState,\n\n ConversationType: ConversationType,\n\n UnbluErrorType: UnbluErrorType\n}\n\n\n\n"],"names":["constructor","bridge","configuration","this","meta","MetaModule","general","GeneralModule","generalLazy","GeneralLazyModule","conversation","ConversationModule","agentAvailability","AgentAvailabilityModule","checkCompatibility","GeneralLazyFunction","InternalModule","super","getNotificationCount","callApiFunction","getPersonInfo","setNewConversationInterceptor","callback","GeneralFunction","BaseGeneralModule","toggleIndividualUi","openPinEntryUi","openOverviewUi","popoutIndividualUi","popinIndividualUi","maximizeIndividualUi","minimizeIndividualUi","openIndividualUi","collapseIndividualUi","getIndividualUiState","getActiveIndividualUiView","MetaFunction","isUpgraded","upgrade","openUi","waitUntilInitialized","deinitialize","ActiveIndividualUiView","IndividualUiState","UnbluUiApi","internalApi","internalListeners","eventEmitter","EventEmitter","on","onUpgraded","event","listener","needsInternalSubscription","hasListeners","onInternal","catch","e","console","warn","off","removed","offInternal","eventName","internalListener","UI_STATE_CHANGE","UI_ACTIVE_INDIVIDUAL_UI_VIEW_CHANGE","emit","name","data","UnbluApiError","UnbluErrorType","INVALID_FUNCTION_ARGUMENTS","requireUpgrade","log","COLLAPSED","UNKNOWN","getEventsWithListeners","UnbluApi","ui","assertNotDeinitialized","internalModule","needsUpgrade","AGENT_AVAILABLE_CHANGE","AGENT_AVAILABILITY_CHANGE","ACTIVE_CONVERSATION_CHANGE","Conversation","CONVERSATIONS_CHANGE","NOTIFICATION_COUNT_CHANGE","PERSON_CHANGE","PERSON_ACTIVITY","DEINITIALIZING","DEINITIALIZED","setPersonNickname","nickname","login","accessToken","UnbluUtil","loginWithSecureToken","serverUrl","apiKey","entryPath","isAuthenticated","logout","startConversation","type","visitorName","visitorData","recipient","conversationId","joinConversation","pin","openConversation","getActiveConversation","getConversations","isAgentAvailable","getAgentAvailabilityState","isDeinitialized","ILLEGAL_STATE","Configuration","UnbluStaticApi","state","ApiState","INITIAL","ERROR","error","unblu","getUnbluObject","api","handleError","isUnbluLoaded","IntegrationType","floating","initializeApi","READY","INITIALIZED","initializedApi","isConfigurationNeeded","getApiState","isInitialized","configure","config","initialize","INITIALIZING","Promise","resolve","reject","deinitializeEmbeddedIfNeeded","generateConfigurationFromLoadedUnblu","CONFIGURATION_MISSING","namedArea","setNamedArea","locale","setLocale","injectUnblu","apiBridge","ApiBridge","waitUntilLoaded","initTimeout","InternalApi","onDeinitializing","onDeinitialized","STATE","unbluUrl","loadScript","ERROR_LOADING_UNBLU","UNSUPPORTED_BROWSER","removeNamedArea","conversationModule","destroyed","CLOSE","destroy","checkNotDestroyed","CONNECTION_STATE_CHANGE","connectionState","CONVERSATION_STATE_CHANGE","conversationState","CALL_STATE_CHANGE","callState","INVITATIONS_CHANGE","invitations","CUSTOM_ACTION_INVOCATION","id","getConversationId","getConnectionState","getConversationState","getCallState","createAnonymousPinInvitation","createAnonymousEmailInvitation","email","revokeInvitation","invitationId","renewInvitationPin","setVisitorData","getInvitations","startAudioCall","startVideoCall","endConversation","leaveConversation","closeConversation","isDestroyed","reset","END","mountPoint","mountName","timeout","promise","timeoutTimestamp","Date","now","waitForLoaded","checkLoaded","setTimeout","INITIALIZATION_TIMEOUT","detail","internal","INCOMPATIBLE_UNBLU_VERSION","getApiVersion","version","moduleName","functionName","args","execute","CATEGORY_INVALID_FUNCTION_CALL","INVALID_FUNCTION_CALL","message","CATEGORY_INVALID_FUNCTION_ARGUMENTS","CATEGORY_ACTION_NOT_GRANTED","ACTION_NOT_GRANTED","CATEGORY_EXECUTION_EXCEPTION","EXECUTION_EXCEPTION","CATEGORY_TIMEOUT","TIMEOUT","module","registerEventListener","removeEventListener","AgentAvailabilityFunction","BaseGeneralFunction","ConversationFunction","EntryPoint","uri","timeoutTime","script","document","createElement","setAttribute","toString","src","timeoutId","cleanup","onerror","onload","window","clearTimeout","onError","getElementsByTagName","appendChild","getNamedArea","existingMetaTag","querySelector","getAttribute","undefined","originalContent","metaTag","parentElement","head","remove","l","url","response","fetch","method","mode","cache","credentials","headers","redirect","body","JSON","stringify","token","AUTHENTICATION_FAILED","ok","status","statusText","json","integrationType","APIKEY","entryPointMatches","unbluInternal","globalPrefix","SERVER","$_baseCfg","embedded","entryPoint","siteEmbeddedMain","siteIntegrationGreedyMain","siteIntegrationLazyMain","createUnbluObject","getOrCreateUnbluObject","deinitializeFloatingIfNeeded","apiState","unbluApi","excludedAppElement","unbluAppElements","i","length","appElement","sanitizeParameter","param","trim","listeners","indexOf","push","index","splice","offAll","events","forEach","AgentAvailabilityState","CallState","ConnectionState","ConversationRecipientType","ConversationState","ConversationType","InvitationStatus","Error","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","__webpack_modules__"],"sourceRoot":""}