{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/unblu-api-error.ts","webpack:///./src/internal/module/module.ts","webpack:///./src/internal/util/event-emitter.ts","webpack:///./src/unblu-api.ts","webpack:///./src/conversation.ts","webpack:///./src/unblu-util.ts","webpack:///./src/index.ts","webpack:///./src/unblu-static-api.ts","webpack:///./src/unblu-api-ui.ts","webpack:///./src/internal/api-bridge.ts","webpack:///./src/internal/java-error-codes.ts","webpack:///./src/internal/internal-api.ts","webpack:///./src/internal/module/meta-module.ts","webpack:///./src/internal/module/general-module.ts","webpack:///./src/internal/module/general-lazy-module.ts","webpack:///./src/internal/module/conversation-module.ts","webpack:///./src/internal/module/agent-availability-module.ts","webpack:///./src/model/call-state.ts","webpack:///./src/model/connection-state.ts","webpack:///./src/model/conversation-type.ts","webpack:///./src/model/agent-availability-state.ts","webpack:///./src/model/conversation-state.ts"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;;;;;;;;;;;AClFA;;GAEG;AACH,IAAY,cA2CX;AA3CD,WAAY,cAAc;IACtB;;OAEG;IACH,6DAA2C;IAC3C;;OAEG;IACH,mEAAiD;IACjD;;OAEG;IACH,iEAA+C;IA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G;IACH,4CAAyB;IAEzB;;OAEG;IACH,0CAAuB;IAEvB;;OAEG;IACH,gDAA6B;IAE7B;;;OAGG;IACH,oCAAiB;IAEjB;;OAEG;IACH,kCAAe;AACnB,CAAC,EA/BW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QA+B1B;;;;;;;;;;AC/BD,IAAY,gBAsCX;AAtCD,WAAY,gBAAgB;IACxB;;OAEG;IACH,iDAA6B;IAC7B;;OAEG;IACH,iEAA6C;IAC7C;;OAEG;IACH,mDAA+B;IAC/B;;OAEG;IACH,mDAA+B;IAC/B;;OAEG;IACH,yEAAqD;IACrD;;OAEG;IACH,qEAAiD;IACjD;;OAEG;IACH,2EAAuD;IACvD;;OAEG;IACH,qEAAiD;IACpD;;;OAGG;IACH,6DAAyC;AAC1C,CAAC,EAtCW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAsC3B;;;;;;;;;;ACtCD,IAAY,sBAuBX;AAvBD,WAAY,sBAAsB;IAC9B;;OAEG;IACH,iDAAuB;IACvB;;;;OAIG;IACH,uCAAa;IACb;;;;OAIG;IACH,qDAA2B;IAC3B;;;;OAIG;IACH,6CAAmB;AACvB,CAAC,EAvBW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAuBjC;;;;;;;;;;ACvBD,IAAY,iBA2CX;AA3CD,WAAY,iBAAiB;IACzB;;OAEG;IACH,wCAAmB;IAEnB;;;OAGG;IACH,8CAAyB;IAEzB;;;OAGG;IACH,8CAAyB;IAEzB;;OAEG;IACH,sCAAiB;IAEjB;;OAEG;IACH,sCAAiB;IAEjB;;;OAGG;IACH,8CAAyB;IAEzB;;OAEG;IACH,gDAA2B;IAE3B;;OAEG;IACH,oCAAe;AACnB,CAAC,EA3CW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QA2C5B","file":"visitor-api.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n","/**\r\n * Type of an unblu error. This can be used to check what kind of error occurred.\r\n */\r\nexport enum UnbluErrorType {\r\n /**\r\n * Thrown if the browser is not supported by unblu.\r\n */\r\n UNSUPPORTED_BROWSER = 'UNSUPPORTED_BROWSER',\r\n /**\r\n * Thrown if the initialization of the unblu API failed due to a timeout.\r\n */\r\n INITIALIZATION_TIMEOUT = 'INITIALIZATION_TIMEOUT',\r\n /**\r\n * Thrown if the initialization is called with no existing snippet and no configuration.\r\n */\r\n CONFIGURATION_MISSING = 'CONFIGURATION_MISSING',\r\n /**\r\n * Thrown during initialization if the snippet can't be loaded or unblu can't be initialized from the snippet.\r\n */\r\n ERROR_LOADING_UNBLU = 'ERROR_LOADING_UNBLU',\r\n /**\r\n * Thrown if the unblu JS API is not compatible with the unblu collaboration server.\r\n */\r\n INCOMPATIBLE_UNBLU_VERSION = 'INCOMPATIBLE_UNBLU_VERSION',\r\n /**\r\n * Thrown if a function call was invalid.\r\n * This is usually do to an incompatibility between the unblu JS API and the unblu collaboration server.\r\n */\r\n INVALID_FUNCTION_CALL = 'INVALID_FUNCTION_CALL',\r\n /**\r\n * Thrown if the arguments passed to a function where invalid.\r\n */\r\n INVALID_FUNCTION_ARGUMENTS = 'INVALID_FUNCTION_ARGUMENTS',\r\n /**\r\n * Thrown if a called action is not permitted for the local person.\r\n * The details message usually has more information about the required permissions.\r\n */\r\n ACTION_NOT_GRANTED = 'ACTION_NOT_GRANTED',\r\n /**\r\n * Thrown if an unexpected exception occurrs during a function execution.\r\n */\r\n EXECUTION_EXCEPTION = 'EXECUTION_EXCEPTION',\r\n /**\r\n * Thrown if a method is called in an invalid context. E.g. if the Object called upon was already destroyed.\r\n */\r\n ILLEGAL_STATE = 'ILLEGAL_STATE'\r\n}\r\n\r\n/**\r\n * General unblu JS API error class that will be thrown whenever something goes wrong.\r\n *\r\n * - Use the [[UnbluApiError.type]] to check what kind of error occurred.\r\n * - Use the [[UnbluApiError.detail]] for human readable details.\r\n *\r\n * Check the documentation of [[UnbluErrorType]] for more details on the different error types.\r\n *\r\n * Example:\r\n * ```ts\r\n * unblu.api.initialize().then(api => {\r\n * // use the api\r\n * }).catch(e => {\r\n * if(e.type === 'INITIALIZATION_TIMEOUT') {\r\n * //retry\r\n * } else if(e.type === 'UNSUPPORTED_BROWSER') {\r\n * // display unsupported browser dialog\r\n * } else {\r\n * // show generic error message\r\n * }\r\n * });\r\n * ```\r\n *\r\n * or using async / await:\r\n *\r\n * ```ts\r\n * try {\r\n * const api = await unblu.api.initialize();\r\n * // use the api\r\n * } catch(e) {\r\n * if(e.type === 'INITIALIZATION_TIMEOUT') {\r\n * //retry\r\n * } else if(e.type === 'UNSUPPORTED_BROWSER') {\r\n * // display unsupported browser dialog\r\n * } else {\r\n * // show generic error message\r\n * }\r\n * }\r\n * ```\r\n *\r\n *\r\n * The error types may either be checked via their constant string values or via the UnbluErrorType enum:\r\n *\r\n * ```ts\r\n * // using string constant\r\n * function isTimeout(e: UnbluApiError) {\r\n * return e.type === 'INITIALIZATION_TIMEOUT';\r\n * }\r\n * ```\r\n * ```ts\r\n * // using the enum\r\n * function isTimeout(e: UnbluApiError) {\r\n * return e.type === window.unblu.UnbluErrorType.INITIALIZATION_TIMEOUT;\r\n * }\r\n * ```\r\n *\r\n */\r\nexport class UnbluApiError extends Error {\r\n\r\n constructor(public type: UnbluErrorType, public detail: string) {\r\n super(`type: ${type}, detail: ${detail}`);\r\n this.name = 'UnbluApiError';\r\n }\r\n\r\n}","import {ApiBridge} from '../api-bridge';\r\nimport {EventCallback} from '../event';\r\n\r\nexport class InternalModule {\r\n constructor(private bridge: ApiBridge, public moduleName: string) {\r\n\r\n }\r\n\r\n protected callApiFunction(functionName: T, args: any[]): Promise {\r\n return this.bridge.callApiFunction(this.moduleName, functionName, args);\r\n }\r\n\r\n public on(eventName: E, listener: EventCallback): Promise {\r\n return this.bridge.on(this.moduleName, eventName, listener);\r\n }\r\n\r\n public off(eventName: E, listener: EventCallback): Promise {\r\n return this.bridge.off(this.moduleName, eventName, listener);\r\n }\r\n\r\n}","export type Listener = (data?: any) => void;\r\n\r\nexport class EventEmitter {\r\n private listeners: { [key: string]: EventListener[] } = {};\r\n\r\n /**\r\n * Resets the emitter by removing all registered listeners.\r\n */\r\n public reset(): void {\r\n this.listeners = {};\r\n }\r\n\r\n /**\r\n * Adds an event listeners\r\n * @param event the event to listen to\r\n * @param listener the listener to be called.\r\n */\r\n public on(event: string, listener: Listener) {\r\n this.listeners[event] = this.listeners[event] || [];\r\n if (this.listeners[event].indexOf(listener) === -1)\r\n this.listeners[event].push(listener);\r\n }\r\n\r\n /**\r\n * removes a previously registered listener\r\n * @param event the event\r\n * @param listener the listener that should be removed.\r\n * @return `true` if the listener was removed, `false` otherwise.\r\n */\r\n off(event: string, listener: any): boolean {\r\n const listeners = this.listeners[event] || [];\r\n const index = listeners.indexOf(listener);\r\n if (index > -1) {\r\n listeners.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * removes all listeners for the given event.\r\n * @param event the event for which all listeners will be removed.\r\n */\r\n offAll(event: string) {\r\n delete this.listeners[event];\r\n }\r\n\r\n /**\r\n * Checks weather at least one listener exists for a given event.\r\n * @param event the event to check for\r\n * @return weather or not any listeners for the given event are registered.\r\n */\r\n hasListeners(event: string): boolean {\r\n return this.listeners[event] != null && this.listeners[event].length > 0;\r\n }\r\n\r\n /**\r\n * Returns all events that have at least one listeners registered to them.\r\n * @return An array containing all events that have at least one listener.\r\n * If no listeners are registered at all, an empty array will be returned.\r\n */\r\n getEventsWithListeners(): string[] {\r\n const events: string[] = [];\r\n for (let event in this.listeners) {\r\n if (this.listeners[event].length)\r\n events.push(event);\r\n }\r\n return events;\r\n }\r\n\r\n /**\r\n * Emits an event dispatching it to all listeners registered for it.\r\n * @param event the event name.\r\n * @param data the event data.\r\n */\r\n emit(event: string, data?: any) {\r\n const listeners = this.listeners[event];\r\n if (listeners) {\r\n listeners.forEach(l => {\r\n try {\r\n l(data);\r\n } catch (e) {\r\n console.warn('Error dispatching event:', event, 'in listener:', l, e);\r\n }\r\n });\r\n }\r\n }\r\n\r\n}","import {InternalApi} from './internal/internal-api';\r\nimport {GeneralEventType} from './internal/module/general-module';\r\nimport {Conversation} from './conversation';\r\nimport {PersonInfo} from './model/person-info';\r\nimport {Event, EventCallback} from './internal/event';\r\nimport {EventEmitter, Listener} from './internal/util/event-emitter';\r\nimport {ConversationType} from './model/conversation-type';\r\nimport {AgentAvailabilityState} from './model/agent-availability-state';\r\nimport {AgentAvailabilityEventType} from './internal/module/agent-availability-module';\r\nimport {InternalModule} from './internal/module/module';\r\nimport {UnbluApiError, UnbluErrorType} from './unblu-api-error';\r\nimport {UnbluUiApi} from './unblu-api-ui';\r\nimport {ConversationInfo} from \"./model/conversation-info\";\r\n\r\n/**\r\n * Listener called whenever the active conversation changes.\r\n *\r\n * **Note:** If no conversation is currently active the passed conversation object will be `null`\r\n * @param conversation API object for the active conversation or `null` if no conversation is active.\r\n */\r\nexport type ConversationChangeListener = (conversation?: Conversation) => void;\r\n\r\n/**\r\n * Listener called whenever a conversation changed, added or removed from all conversations.\r\n * @param conversations All conversations of the current visitor.\r\n */\r\nexport type ConversationsChangeListener = (conversations: ConversationInfo[]) => void;\r\n\r\n/**\r\n * Listener called whenever the notification count of a person (i.e. unread messages) changes.\r\n * @param count The number of unseen notifications.\r\n */\r\nexport type NotificationCountChangeListener = (count: number) => void;\r\n/**\r\n * Listener called whenever the local person changes.\r\n * @param person Info about the person.\r\n */\r\nexport type PersonChangeListener = (person: PersonInfo) => void;\r\n/**\r\n * Listener called whenever the agent availability changes.\r\n * @param availability The new availability.\r\n */\r\nexport type AgentAvailabilityChangeListener = (availability: AgentAvailabilityState) => void;\r\n/**\r\n * Interceptor function which is called every time a new conversation is started from the UI or JS API.\r\n *\r\n * The starting of the conversation will be deferred until the Promis returned by this interceptor resolves:\r\n * If the interceptor rejects the Promise, the starting of the conversation will be canceled.\r\n * If the interceptor resolves the Promise with a String, its value will be used and set as \"visitorData\" for the created conversation.\r\n * If the interceptor resolves the Promise without any value or something else then a String the conversation will be started without any visitorData.\r\n * If visitorData was passed to the [startConversation]{@link startConversation} it will be passed to this callback as second argument.\r\n @param conversationType The type of the conversation being started.\r\n @param visitorData Optional visitorData, only present if passed to the [startConversation]{@link startConversation} method\r\n @return A Promise deferring the start of the conversation until it resolves.\r\n */\r\nexport type NewConversationInterceptor = (conversationType: ConversationType, visitorData?: String, ) => Promise;\r\n\r\n/**\r\n * #### This class represents the initialized Unblu Visitor JS API.\r\n *\r\n * There is only ever one instance of this api which can be retrieved via `unblu.api.initialize()`,\r\n * see [[UnbluStaticApi]] for more details on configuring and initializing the UnbluApi.\r\n *\r\n * The API connects to the integrated version of Unblu. All actions performed via the UnbluApi are executed in\r\n * the name of and with the rights of current visitor and may have direct effect on the displayed Unblu UI.\r\n *\r\n * For example if a conversation is started from the UnbluApi, the Unblu UI will navigate to it.\r\n * If a conversation is closed via the API, it will also be closed on the Unblu UI of the visitor.\r\n * For more information on UI side effects please check the documentation for each method call.\r\n *\r\n * For programmatic administrator access and configuration of Unblu please use the Unblu WebAPI.\r\n */\r\nexport class UnbluApi {\r\n\r\n /**\r\n * Event emitted every time the active conversation changed.\r\n *\r\n * This may happen due to a UI-navigation or an API-call.\r\n *\r\n * @event activeConversationChange\r\n * @see [[on]] for listener registration\r\n * @see [[ConversationChangeListener]]\r\n */\r\n public static readonly ACTIVE_CONVERSATION_CHANGE: 'activeConversationChange' = 'activeConversationChange';\r\n\r\n /**\r\n * Event emitted every time when a conversation is changed, added or removed.\r\n *\r\n * @event conversationsChanged\r\n * @see [[on]] for listener registration\r\n * @see [[ConversationsChangeListener]]\r\n */\r\n public static readonly CONVERSATIONS_CHANGE: 'conversationsChange' = 'conversationsChange';\r\n\r\n /**\r\n * Event emitted every time the notification count (unread messages) changes.\r\n *\r\n * @event notificationCountChange\r\n * @see [[on]] for listener registration\r\n * @see [[NotificationCountChangeListener]]\r\n */\r\n public static readonly NOTIFICATION_COUNT_CHANGE: 'notificationCountChange' = 'notificationCountChange';\r\n\r\n /**\r\n * Event emitted every time the local person changes. This may be i.e. due to the person setting its name.\r\n *\r\n * @event personChange\r\n * @see [[on]] for listener registration\r\n * @see [[PersonChangeListener]]\r\n */\r\n public static readonly PERSON_CHANGE: 'personChange' = 'personChange';\r\n\r\n /**\r\n * Event emitted every time the agent availability changes for the current named area and locale.\r\n *\r\n * @event availabilityChange\r\n * @see [[on]] for listener registration\r\n * @see [[AgentAvailabilityChangeListener]]\r\n */\r\n public static readonly AGENT_AVAILABILITY_CHANGE: 'availabilityChange' = 'availabilityChange';\r\n\r\n\r\n /**\r\n * Access the UI functionality over the UI property.\r\n */\r\n public ui: UnbluUiApi;\r\n\r\n private internalListeners: { [key: string]: EventCallback } = {};\r\n private eventEmitter = new EventEmitter();\r\n\r\n /**\r\n * @hidden\r\n */\r\n constructor(private internalApi: InternalApi) {\r\n internalApi.meta.on('upgraded', () => this.onUpgraded());\r\n // All UI functionality is provided with the ui namespace\r\n this.ui = new UnbluUiApi(internalApi);\r\n }\r\n\r\n // Event\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The activeConversationChange event.\r\n * @param listener The listener to be called.\r\n * @see [[ACTIVE_CONVERSATION_CHANGE]]\r\n */\r\n public on(event: typeof UnbluApi.ACTIVE_CONVERSATION_CHANGE, listener: ConversationChangeListener): void;\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The notificationCountChange event.\r\n * @param listener The listener to be called.\r\n * @see [[NOTIFICATION_COUNT_CHANGE]]\r\n */\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The conversationsChanged event.\r\n * @param listener The listener to be called.\r\n * @see [[CONVERSATIONS_CHANGE]]\r\n */\r\n public on(event: typeof UnbluApi.CONVERSATIONS_CHANGE, listener: ConversationsChangeListener): void;\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The notificationCountChanged event.\r\n * @param listener The listener to be called.\r\n * @see [[NOTIFICATION_COUNT_CHANGE]]\r\n */\r\n public on(event: typeof UnbluApi.NOTIFICATION_COUNT_CHANGE, listener: NotificationCountChangeListener): void;\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The personChange event.\r\n * @param listener The listener to be called.\r\n * @see [[PERSON_CHANGE]]\r\n */\r\n public on(event: typeof UnbluApi.PERSON_CHANGE, listener: PersonChangeListener): void;\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The personChange event.\r\n * @param listener The listener to be called.\r\n * @see [[PERSON_CHANGE]]\r\n */\r\n public on(event: typeof UnbluApi.AGENT_AVAILABILITY_CHANGE, listener: AgentAvailabilityChangeListener): void;\r\n\r\n public on(event: GeneralEventType | AgentAvailabilityEventType, listener: Listener): void {\r\n const needsInternalSubscription = !this.eventEmitter.hasListeners(event);\r\n this.eventEmitter.on(event, listener);\r\n if (needsInternalSubscription)\r\n this.onInternal(event).catch(e => console.warn('Error registering internal listener for event:', event, 'error:' + e, e));\r\n }\r\n\r\n /**\r\n * Removes a previously registered listener\r\n * @param event The event to unregister from.\r\n * @param listener The listener to remove.\r\n */\r\n public off(event: GeneralEventType | AgentAvailabilityEventType, listener: Listener): boolean {\r\n const removed = this.eventEmitter.off(event, listener);\r\n if (!this.eventEmitter.hasListeners(event))\r\n this.offInternal(event).catch(e => console.warn('Error removing internal listener for event:', event, 'error:' + e, e));\r\n return removed;\r\n }\r\n\r\n private async onInternal(eventName: GeneralEventType | AgentAvailabilityEventType) {\r\n let internalListener: EventCallback;\r\n let internalModule: InternalModule;\r\n let needsUpgrade: boolean;\r\n switch (eventName) {\r\n case UnbluApi.AGENT_AVAILABILITY_CHANGE:\r\n internalListener = (event: Event) => {\r\n this.eventEmitter.emit(event.name, event.data);\r\n };\r\n internalModule = this.internalApi.agentAvailability;\r\n needsUpgrade = false;\r\n break;\r\n case UnbluApi.ACTIVE_CONVERSATION_CHANGE:\r\n internalListener = (event: Event) => {\r\n this.eventEmitter.emit(event.name, event.data ? new Conversation(this.internalApi, event.data) : null);\r\n };\r\n internalModule = this.internalApi.general;\r\n needsUpgrade = true;\r\n break;\r\n case UnbluApi.CONVERSATIONS_CHANGE:\r\n internalListener = (event: Event) => {\r\n this.eventEmitter.emit(event.name, event.data);\r\n };\r\n internalModule = this.internalApi.general;\r\n needsUpgrade = true;\r\n break;\r\n case UnbluApi.NOTIFICATION_COUNT_CHANGE:\r\n case UnbluApi.PERSON_CHANGE:\r\n internalListener = (event: Event) => {\r\n this.eventEmitter.emit(event.name, event.data);\r\n };\r\n internalModule = this.internalApi.general;\r\n needsUpgrade = true;\r\n break;\r\n default:\r\n throw new UnbluApiError(UnbluErrorType.INVALID_FUNCTION_ARGUMENTS, 'Registration to unknown event:' + eventName);\r\n }\r\n\r\n if (!needsUpgrade || await this.internalApi.meta.isUpgraded()) {\r\n this.internalListeners[eventName] = internalListener;\r\n try {\r\n await internalModule.on(eventName, internalListener);\r\n } catch (e) {\r\n delete this.internalListeners[eventName];\r\n throw e;\r\n }\r\n }\r\n }\r\n\r\n private async offInternal(eventName: GeneralEventType | AgentAvailabilityEventType) {\r\n const listener = this.internalListeners[eventName];\r\n if (listener == null) {\r\n return;\r\n }\r\n delete this.internalListeners[eventName];\r\n\r\n let internalModule: InternalModule;\r\n switch (eventName) {\r\n case UnbluApi.AGENT_AVAILABILITY_CHANGE:\r\n internalModule = this.internalApi.agentAvailability;\r\n break;\r\n default:\r\n internalModule = this.internalApi.general;\r\n break;\r\n }\r\n await internalModule.off(eventName, listener);\r\n }\r\n\r\n // General\r\n\r\n /**\r\n * Returns information about the visitor.\r\n * @return A promise that resolves to the current visitors person info.\r\n */\r\n public async getPersonInfo(): Promise {\r\n await this.requireUpgrade();\r\n return this.internalApi.general.getPersonInfo();\r\n }\r\n\r\n /**\r\n * Set the nickname of the current visitor.\r\n * This could be set before or during a conversation.\r\n * @return A empty promise when operation is done.\r\n */\r\n public async setPersonNickname(nickname: string): Promise {\r\n await this.requireUpgrade();\r\n return this.internalApi.general.setPersonNickname(nickname);\r\n }\r\n\r\n /**\r\n * Returns the number of unread messages.\r\n * @return A promise that resolves to the current number of unread messages.\r\n */\r\n public async getNotificationCount(): Promise {\r\n if (await this.internalApi.meta.isUpgraded()) {\r\n return this.internalApi.general.getNotificationCount();\r\n } else {\r\n return this.internalApi.generalLazy.getNotificationCount();\r\n }\r\n }\r\n\r\n // Conversation\r\n\r\n\r\n /**\r\n * Starts a new Conversation and places it into the inbound conversation queue.\r\n *\r\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.\r\n *\r\n * @param type The conversation type that shall be started.\r\n * @param visitorName The name the local visitor should have. This is only taken into account if the visitor is not already authenticated.\r\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}\r\n * @return A promise that resolves to the conversation object giving API access to the started conversation.\r\n */\r\n public async startConversation(type: ConversationType, visitorName?: string, visitorData?: string): Promise {\r\n await this.requireUpgrade();\r\n const conversationId = await this.internalApi.general.startConversation(type, visitorName, visitorData);\r\n return new Conversation(this.internalApi, conversationId);\r\n }\r\n\r\n /**\r\n * Set a custom interceptor which will be triggered when a new conversation is started (initiated from UI or JavaScript).\r\n * @param callback The interceptor which is called before a new conversation is started. The Callback is of type [NewConversationCallback]{@link NewConversationInterceptor}\r\n * @return A promise that resolves when the interceptor is successfully applied and active.\r\n */\r\n public async setNewConversationInterceptor(callback: NewConversationInterceptor): Promise {\r\n if (!await this.internalApi.meta.isUpgraded()) {\r\n return await this.internalApi.generalLazy.setNewConversationInterceptor(callback);\r\n } else {\r\n return await this.internalApi.general.setNewConversationInterceptor(callback);\r\n }\r\n }\r\n\r\n /**\r\n * Joins an existing conversation with a given PIN.\r\n *\r\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.\r\n *\r\n * @param pin The PIN retrieved from the Unblu Agent Desk.\r\n * @param visitorName The name the local visitor should have. This is only taken into account if the visitor is not already authenticated.\r\n * @return A promise that resolves to the conversation object giving API access to the joined conversation.\r\n */\r\n public async joinConversation(pin: string, visitorName?: string): Promise {\r\n await this.requireUpgrade();\r\n const conversationId = await this.internalApi.general.joinConversation(pin, visitorName);\r\n return new Conversation(this.internalApi, conversationId);\r\n }\r\n\r\n /**\r\n * Opens the existing conversation with the given conversation ID.\r\n *\r\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.\r\n *\r\n * @param conversationId The id of the conversation to be opened.\r\n * @return A promise that resolves to the conversation object giving API access to the opened conversation.\r\n */\r\n public async openConversation(conversationId: string): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.openConversation(conversationId);\r\n return new Conversation(this.internalApi, conversationId);\r\n }\r\n\r\n /**\r\n * Returns the currently active conversation or `null` if no conversation is active.\r\n *\r\n * **NOTE:** calling this method twice while the same conversation is active, will result in two individual conversation API instances being returned.\r\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.\r\n *\r\n * @return A promise that either resolves to the currently active conversation or `null` if no conversation is open.\r\n * @see [[ACTIVE_CONVERSATION_CHANGE]]\r\n */\r\n public async getActiveConversation(): Promise {\r\n if (await this.internalApi.meta.isUpgraded()) {\r\n const conversationId = await this.internalApi.general.getActiveConversation();\r\n return conversationId != null ? new Conversation(this.internalApi, conversationId) : null;\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Returns all conversations of the current visitor. If no conversation is present, an empty array is returned.\r\n *\r\n * @return A promise that resolves to an array of [ConversationInfo]{@link ConversationInfo}.\r\n */\r\n public async getConversations(): Promise {\r\n if (await this.internalApi.meta.isUpgraded()) {\r\n const conversations = await this.internalApi.general.getConversations();\r\n return conversations\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Checks if an agent is available for the current named area and language.\r\n *\r\n * @return Promise that resolves to `true` if the availability state is [AVAILABLE]{@link AgentAvailabilityState.AVAILABLE} or [BUSY]{@link AgentAvailabilityState.BUSY}, `false` otherwise.\r\n * @see [[getAgentAvailabilityState]] for a more detailed check.\r\n */\r\n public async isAgentAvailable(): Promise {\r\n return this.internalApi.agentAvailability.isAgentAvailable();\r\n }\r\n\r\n /**\r\n * Returns the current availability state for the current named area and language.\r\n * @return Promise that resolves to the current availability state.\r\n * @see [[isAgentAvailable]] for a simpler check.\r\n */\r\n public async getAgentAvailabilityState(): Promise {\r\n return this.internalApi.agentAvailability.getAgentAvailabilityState();\r\n }\r\n\r\n private async requireUpgrade(): Promise {\r\n await this.internalApi.meta.upgrade(false);\r\n }\r\n\r\n private onUpgraded() {\r\n for (let event of this.eventEmitter.getEventsWithListeners()) {\r\n // register internal listeners for all events that need upgrade.\r\n if (!this.internalListeners[event])\r\n this.onInternal(event as GeneralEventType);\r\n }\r\n }\r\n\r\n}","import {InternalApi} from './internal/internal-api';\r\nimport {CallState} from './model/call-state';\r\nimport {Event, EventCallback} from './internal/event';\r\nimport {\r\n ConversationCallState,\r\n ConversationConnectionState,\r\n ConversationEventType, ConversationInvitations, ConversationWithState\r\n} from './internal/module/conversation-module';\r\nimport {UnbluApiError, UnbluErrorType} from './unblu-api-error';\r\nimport {EventEmitter, Listener} from './internal/util/event-emitter';\r\nimport {ConversationState} from './model/conversation-state';\r\nimport {ConnectionState} from './model/connection-state';\r\nimport {Invitation} from \"./model/invitation\";\r\n\r\nexport type ConnectionStateListener = (connectionState: ConnectionState) => void;\r\nexport type ConversationStateListener = (conversationState: ConversationState) => void;\r\nexport type CallStateListener = (callState: CallState) => void;\r\nexport type InvitationsListener = (invitations: Invitation[]) => void;\r\n\r\n/**\r\n * #### This class gives API access to the currently active conversation.\r\n *\r\n * As long as a conversation is active one can register and receive the events provided by this class and call the methods.\r\n * Once the conversation is closed this API object will be destroyed and no more event callbacks will be called.\r\n * Any subsequent calls will fail.\r\n *\r\n * Use the [[CLOSE]] event to de-init any code connected to this conversation.\r\n */\r\nexport class Conversation {\r\n\r\n /**\r\n * Event emitted when the [[ConnectionState]] of this conversation changes.\r\n * @event connectionStateChange\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly CONNECTION_STATE_CHANGE: 'connectionStateChange' = 'connectionStateChange';\r\n\r\n /**\r\n * Event emitted when the [[ConversationState]] of this conversation changes.\r\n * @event conversationStateChange\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly CONVERSATION_STATE_CHANGE: 'conversationStateChange' = 'conversationStateChange';\r\n\r\n /**\r\n * Event emitted when the [[CallState]] of this conversation changes.\r\n * @event callStateChange\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly CALL_STATE_CHANGE: 'callStateChange' = 'callStateChange';\r\n\r\n /**\r\n * Event emitted when the conversation ends.\r\n * @deprecated The end event is not always available, depending on the configuration. Use instead [[CONVERSATION_STATE_CHANGE]] event.\r\n * @event end\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly END: 'end' = 'end';\r\n\r\n /**\r\n * Event emitted when the conversation is closed.\r\n *\r\n * This may happen due to a UI-navigation or an API-call.\r\n *\r\n * @event close\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly CLOSE: 'close' = 'close';\r\n\r\n /**\r\n * Event emitted when an [[Invitation]] is added to or removed from this conversation or if an existing one changes.\r\n * The event emits an array of all visitor invitations created by the local person, all other invitations will not be present.\r\n * @event invitationsChange\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly INVITATIONS_CHANGE: 'invitationsChange' = 'invitationsChange';\r\n\r\n private eventEmitter = new EventEmitter();\r\n private internalListeners: { [key: string]: EventCallback } = {};\r\n private destroyed = false;\r\n\r\n /**\r\n * @hidden\r\n */\r\n constructor(private internalApi: InternalApi, private conversationId: string) {\r\n // clean up all listeners when the conversation disconnects.\r\n this.on(Conversation.CLOSE, () => this.destroy());\r\n }\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The call state change event.\r\n * @param listener The listener to be called.\r\n * @see [[CONNECTION_STATE_CHANGE]]\r\n */\r\n public on(event: typeof Conversation.CONNECTION_STATE_CHANGE, listener: ConnectionStateListener): void ;\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The conversation state change event.\r\n * @param listener The listener to be called.\r\n * @see [[CONVERSATION_STATE_CHANGE]]\r\n */\r\n public on(event: typeof Conversation.CONVERSATION_STATE_CHANGE, listener: ConversationStateListener): void ;\r\n\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The call state change event.\r\n * @param listener The listener to be called.\r\n * @see [[CALL_STATE_CHANGE]]\r\n */\r\n public on(event: typeof Conversation.CALL_STATE_CHANGE, listener: CallStateListener): void ;\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @deprecated The end event is not always available, depending on the configuration. Use instead [[CONVERSATION_STATE_CHANGE]] event.\r\n * @param event The end event.\r\n * @param listener The listener to be called.\r\n * @see [[END]]\r\n */\r\n public on(event: typeof Conversation.END, listener: () => void): void ;\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The close event.\r\n * @param listener The listener to be called.\r\n * @see [[CLOSE]]\r\n */\r\n public on(event: typeof Conversation.CLOSE, listener: () => void): void;\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The invitations change event.\r\n * @param listener The listener to be called.\r\n * @see [[INVITATIONS_CHANGE]]\r\n */\r\n public on(event: typeof Conversation.INVITATIONS_CHANGE, listener: InvitationsListener): void ;\r\n\r\n /**\r\n * Adds a listener.\r\n * @param event The event to register.\r\n * @param listener The listener to register.\r\n */\r\n public on(event: ConversationEventType, listener: Listener): void {\r\n this.checkNotDestroyed();\r\n const needsInternalSubscription = !this.eventEmitter.hasListeners(event);\r\n this.eventEmitter.on(event, listener);\r\n if (needsInternalSubscription)\r\n this.onInternal(event);\r\n }\r\n\r\n /**\r\n * Removes a previously registered listener.\r\n * @param event The event to unregister from.\r\n * @param listener The listener to remove.\r\n */\r\n public off(event: ConversationEventType, listener: Listener): boolean {\r\n this.checkNotDestroyed();\r\n const removed = this.eventEmitter.off(event, listener);\r\n if (!this.eventEmitter.hasListeners(event))\r\n this.offInternal(event);\r\n return removed;\r\n }\r\n\r\n private onInternal(eventName: ConversationEventType) {\r\n let internalListener: EventCallback;\r\n switch (eventName) {\r\n case Conversation.CONNECTION_STATE_CHANGE:\r\n internalListener = (event: Event) => {\r\n if (event.data.conversationId == this.conversationId)\r\n this.eventEmitter.emit(event.name, event.data.connectionState);\r\n };\r\n break;\r\n case Conversation.CONVERSATION_STATE_CHANGE:\r\n internalListener = (event: Event) => {\r\n if (event.data.conversationId == this.conversationId)\r\n this.eventEmitter.emit(event.name, event.data.conversationState);\r\n };\r\n break;\r\n case Conversation.CALL_STATE_CHANGE:\r\n internalListener = (event: Event) => {\r\n if (event.data.conversationId == this.conversationId)\r\n this.eventEmitter.emit(event.name, event.data.callState);\r\n };\r\n break;\r\n case Conversation.INVITATIONS_CHANGE:\r\n internalListener = (event: Event) => {\r\n if (event.data.conversationId == this.conversationId)\r\n this.eventEmitter.emit(event.name, event.data.invitations);\r\n };\r\n break;\r\n default:\r\n internalListener = (event: Event) => {\r\n if (event.data == this.conversationId) {\r\n this.eventEmitter.emit(event.name);\r\n }\r\n };\r\n break;\r\n }\r\n this.internalListeners[eventName] = internalListener;\r\n this.internalApi.conversation.on(eventName, internalListener).catch(e => console.warn('Error registering internal listener for event:', eventName, 'error:' + e, e));\r\n }\r\n\r\n private offInternal(eventName: ConversationEventType) {\r\n const listener = this.internalListeners[eventName];\r\n if (listener == null)\r\n return;\r\n delete this.internalListeners[eventName];\r\n this.internalApi.conversation.off(eventName, listener).catch(e => console.warn('Error removing internal listener for event:', eventName, 'error:' + e, e));\r\n }\r\n\r\n /**\r\n * Returns the ID of this conversation.\r\n */\r\n public getConversationId(): string {\r\n return this.conversationId;\r\n }\r\n\r\n /**\r\n * Returns the current connection state the conversation is in.\r\n *\r\n * If the connection is lost, the conversation will automatically try to reconnect using an exponential back-off strategy.\r\n * If a fatal error is detected, the state will change to [[ConnectionState.ERROR]].\r\n *\r\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.\r\n * The conversation is not automatically closed in this case.\r\n * It may either be closed through a manual action by the visitor (confirming the error) or via the API.\r\n *\r\n * @see [[CONNECTION_STATE_CHANGE]] If you need to listen to changes.\r\n * @return A promise that resolves to the current connection state of the conversation\r\n * or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async getConnectionState(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.getConnectionState(this.conversationId);\r\n }\r\n\r\n /**\r\n * Returns the current state the conversation is in.\r\n * @return A promise that resolves to the current state of the conversation\r\n * or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async getConversationState(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.getConversationState(this.conversationId);\r\n }\r\n\r\n /**\r\n * @see [[CALL_STATE_CHANGE]] If you need to listen to changes.\r\n * @return A promise that resolves to the current call state of the local user\r\n * or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async getCallState(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.getCallState(this.conversationId);\r\n }\r\n\r\n /**\r\n * Creates a new PIN invitation for this conversation.\r\n *\r\n * - If the local person doesn't have the right to invite a visitor,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.ACTION_NOT_GRANTED]].\r\n * @see [[INVITATIONS_CHANGE]] If you need to listen to changes for new invitations on this conversation.\r\n * @return A promise that resolves to a new [[Invitation]] object with all relevant metadata.\r\n * or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async createAnonymousPinInvitation(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.createAnonymousPinInvitation(this.conversationId);\r\n }\r\n\r\n /**\r\n * Creates a new EMail invitation for this conversation.\r\n *\r\n * - If the local person doesn't have the right to invite a visitor,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.ACTION_NOT_GRANTED]].\r\n * - If a non valid email address is provided,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.INVALID_FUNCTION_ARGUMENTS]].\r\n * @param email The email which the invitation should be send. It must be a valid email address.\r\n * @see [[INVITATIONS_CHANGE]] If you need to listen to changes for new invitations on this conversation.\r\n * @return A promise that resolves to a new [[Invitation]] object with all relevant metadata.\r\n * or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async createAnonymousEmailInvitation(email: String) : Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.createAnonymousEmailInvitation(this.conversationId, email);\r\n }\r\n\r\n /**\r\n * Revoke an invitation.\r\n *\r\n * - If the local person doesn't have the right to invite a visitor,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.ACTION_NOT_GRANTED]].\r\n * @param invitationId The invitation id.\r\n * @return A Promise that resolves to null or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async revokeInvitation(invitationId: String) : Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.revokeInvitation(this.conversationId, invitationId);\r\n }\r\n\r\n /**\r\n * Renews an invitation PIN if the invitation is expired.\r\n *\r\n * - If the local person doesn't have the right to invite a visitor,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.ACTION_NOT_GRANTED]].\r\n * @param invitationId The invitation id.\r\n * @return A promise that resolves to a new [[Invitation]] object with all relevant metadata.\r\n */\r\n public async renewInvitationPin(invitationId: String) : Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.renewInvitationPin(this.conversationId, invitationId);\r\n }\r\n\r\n /**\r\n * Set custom visitor data on the conversation.\r\n *\r\n * @param visitorData Custom data for the visitor in any format.\r\n */\r\n public async setVisitorData(visitorData: String) : Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.setVisitorData(visitorData);\r\n }\r\n\r\n /**\r\n * Get all visitor invitations created by the local person for this conversation.\r\n * @return A promise that resolves to a new [[Invitation]] array with all relevant metadata.\r\n * or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async getInvitations(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.getInvitations(this.conversationId);\r\n }\r\n\r\n /**\r\n * Starts a voice call in this conversation.\r\n *\r\n * - If a call is already active, this call will be ignored.\r\n * - If the local person doesn't have the right to start a voice call,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.ACTION_NOT_GRANTED]].\r\n * @see [[CALL_STATE_CHANGE]] If you need to listen to changes.\r\n * @return A Promise that resolves to null or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async startAudioCall(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.startAudioCall(this.conversationId);\r\n }\r\n\r\n /**\r\n * Starts a video call in this conversation.\r\n *\r\n * - If a call is already active, this call will be ignored.\r\n * - If the local person doesn't have the right to start a video call,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.ACTION_NOT_GRANTED]].\r\n * @see [[CALL_STATE_CHANGE]] If you need to listen to changes.\r\n * @return A Promise that resolves to null or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async startVideoCall(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.startVideoCall(this.conversationId);\r\n }\r\n\r\n /**\r\n * Ends and closes this conversation.\r\n *\r\n * If the local person doesn't have the right to end the conversation,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.ACTION_NOT_GRANTED]].\r\n * @see [[END]] fired after this call.\r\n * @see [[closeConversation]] for details on closing a conversation.\r\n * @return A Promise that resolves to null or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async endConversation(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.endConversation(this.conversationId);\r\n }\r\n\r\n /**\r\n * Leaves and closes this conversation.\r\n *\r\n * By leaving, the visitor is removed from the active participant list of the conversation.\r\n * Once a conversation is left, the visitor can not re-open it. It will not be visible in the conversation history either.\r\n *\r\n * If the local person doesn't have the right to leave the conversation,\r\n * the returned promise will be rejected with the unblu error type [[UnbluErrorType.ACTION_NOT_GRANTED]].\r\n * @see [[CLOSE]] fired after this call.\r\n * @see [[closeConversation]] for details on closing a conversation without leaving.\r\n * @return A Promise that resolves to null or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async leaveConversation(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.leaveConversation(this.conversationId);\r\n }\r\n\r\n /**\r\n * Closes this conversation locally.\r\n *\r\n * When called, the connection to this conversation is closed and the overview is displayed.\r\n *\r\n * **Note that:**\r\n * - Closing does NOT end the conversation.\r\n * - The person does NOT leave the conversation.\r\n * - All Conversation api instances for this conversation will be destroyed.\r\n *\r\n * The conversation can be joined again either via the UI or using [[UnbluApi.openConversation]].\r\n * @see [[CLOSE]] fired after this call.\r\n * @see [[endConversation]] for details on ending a conversation.\r\n * @see [[leavingConversation]] for details on leaving a conversation.\r\n * @see [[destroy]] for details on destroying a conversation.\r\n * @return A Promise that resolves to null or is rejected with a [[UnbluApiError]] if the call fails.\r\n */\r\n public async closeConversation(): Promise {\r\n this.checkNotDestroyed();\r\n return this.internalApi.conversation.closeConversation(this.conversationId);\r\n }\r\n\r\n private checkNotDestroyed(): void {\r\n if (this.destroyed) throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Error: trying to execute method on destroyed conversation object.')\r\n }\r\n\r\n /**\r\n * Returns weather this conversation is destroyed or not.\r\n *\r\n * Conversations are either destroyed if [[destroy]] is called or the conversation is closed.\r\n * This usually happens when the user navigates back to an overview or into an other conversation.\r\n * @see [[destroy]]\r\n * @see [[CLOSE]]\r\n * @return Weather this conversation is destroyed or not.\r\n */\r\n public isDestroyed(): boolean {\r\n return this.destroyed;\r\n }\r\n\r\n /**\r\n * Destroys this conversation API instance.\r\n *\r\n * Calling destroy will unregister all event listeners and prohibit any further calls to this object.\r\n * Once the conversation is destroyed, any subsequent calls will reject the returned promise with [[UnbluErrorType.ILLEGAL_STATE]] as reason.\r\n *\r\n * **Note that:**\r\n * - Destroying does NOT close the conversation .\r\n * - Destroying does NOT end the conversation.\r\n * - Destroying does NOT leave the conversation.\r\n * - Other instances of the same Conversation will NOT be destroyed.\r\n *\r\n * This call simply destroys this local API instance to the conversation.\r\n *\r\n * A destroyed but still open conversation can be accessed again using [[UnbluApi.getActiveConversation]].\r\n *\r\n * @see [[isDestroyed]]\r\n * @see [[closeConversation]] for details on how to close a conversation\r\n * @see [[endConversation]] for details on how to end a conversation\r\n */\r\n public destroy(): void {\r\n if (this.destroyed) return;\r\n this.destroyed = true;\r\n this.eventEmitter.reset();\r\n for (let event in this.internalListeners) {\r\n this.offInternal(event as ConversationEventType);\r\n }\r\n }\r\n}","// Typedef Helpers\r\n\r\n\r\n/**\r\n * Internal type definition of the unblu object.\r\n * @hidden\r\n */\r\nexport interface UnbluObject {\r\n api?: any,\r\n\r\n /**\r\n * internal unblu field\r\n * @hidden\r\n */\r\n APIKEY?: string,\r\n /**\r\n * internal unblu field\r\n * @hidden\r\n */\r\n SERVER?: string,\r\n /**\r\n * internal unblu field\r\n * @hidden\r\n */\r\n l?: string\r\n}\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class UnbluUtil {\r\n static async loadScript(uri: string, timeout: number): Promise {\r\n const timeoutTime = timeout || 30000;\r\n const script = document.createElement('script');\r\n script.setAttribute('charset', 'UTF-8');\r\n script.setAttribute('type', 'text/javascript');\r\n script.setAttribute('async', 'true');\r\n script.setAttribute('timeout', timeoutTime.toString());\r\n script.src = uri;\r\n\r\n return new Promise(function (resolve, reject) {\r\n let timeoutId: number;\r\n\r\n const cleanup = () => {\r\n // avoid mem leaks in IE.\r\n script.onerror = script.onload = null;\r\n window.clearTimeout(timeoutId);\r\n };\r\n\r\n const onError = (error: string | Event) => {\r\n cleanup();\r\n console.error('Failed to load script! Uri:', uri, 'Error:', error);\r\n reject(error);\r\n };\r\n\r\n script.onload = () => {\r\n cleanup();\r\n resolve();\r\n };\r\n script.onerror = onError;\r\n timeoutId = window.setTimeout(() => onError('Timeout'), timeoutTime);\r\n\r\n const head = document.getElementsByTagName('HEAD')[0];\r\n head.appendChild(script);\r\n });\r\n }\r\n\r\n static setNamedArea(namedArea: string): void {\r\n const metaTag = window.document.querySelector('meta[name=\"unblu:named-area\"]') || window.document.createElement('meta');\r\n metaTag.setAttribute('name', 'unblu:named-area');\r\n metaTag.setAttribute('content', namedArea);\r\n if (!metaTag.parentElement) {\r\n window.document.head.appendChild(metaTag);\r\n }\r\n }\r\n\r\n static setLocale(locale: string): void {\r\n // unblu.l will be read in user-locale-util.js\r\n UnbluUtil.getUnbluObject().l = locale;\r\n }\r\n\r\n static isUnbluLoaded(): boolean {\r\n return UnbluUtil.getUnbluObject() && !!UnbluUtil.getUnbluObject().APIKEY;\r\n }\r\n\r\n static getUnbluObject(): UnbluObject {\r\n return window.unblu;\r\n }\r\n\r\n static createUnbluObject(): UnbluObject {\r\n return window.unblu = {};\r\n }\r\n\r\n}","import {UnbluApi} from './unblu-api';\r\nimport {Conversation} from './conversation';\r\nimport {UnbluStaticApi} from './unblu-static-api';\r\nimport {UnbluUtil} from './unblu-util';\r\nimport {CallState} from './model/call-state';\r\nimport {ConnectionState} from './model/connection-state';\r\nimport {ConversationType} from './model/conversation-type';\r\nimport {AgentAvailabilityState} from './model/agent-availability-state';\r\nimport {ConversationState} from './model/conversation-state';\r\nimport {UnbluErrorType} from './unblu-api-error';\r\n\r\nexport {UnbluApi} from './unblu-api';\r\nexport {Conversation} from './conversation';\r\n\r\n\r\n/**\r\n * The main unblu namespace which gives access to the unblu api.\r\n *\r\n * Access:\r\n * ```javascript\r\n * window.unblu.api;\r\n * ```\r\n *\r\n * **Note:** all fields inside the unblu namespace except for the [[api]] are not public and may change without any notice.\r\n */\r\nexport interface Unblu {\r\n /**\r\n * Access to the unblu API.\r\n *\r\n * This field will be available as soon as the unblu API has been loaded.\r\n */\r\n api?: UnbluStaticApi,\r\n\r\n AgentAvailabilityState?: typeof AgentAvailabilityState,\r\n\r\n CallState?: typeof CallState,\r\n\r\n ConnectionState?: typeof ConnectionState,\r\n\r\n ConversationState?: typeof ConversationState,\r\n\r\n ConversationType?: typeof ConversationType,\r\n\r\n UnbluErrorType?: typeof UnbluErrorType\r\n}\r\n\r\n/**\r\n * Global window scope definition of the unblu namespace on the window.\r\n * Access:\r\n * ```javascript\r\n * window.unblu.api;\r\n * ```\r\n */\r\ndeclare global {\r\n interface Window {\r\n /**\r\n * The main unblu namespace\r\n */\r\n unblu: Unblu;\r\n }\r\n}\r\n\r\nconst unblu = (UnbluUtil.getUnbluObject() || UnbluUtil.createUnbluObject()) as Unblu;\r\nunblu.AgentAvailabilityState = AgentAvailabilityState;\r\nunblu.CallState = CallState;\r\nunblu.ConnectionState = ConnectionState;\r\nunblu.ConversationState = ConversationState;\r\nunblu.ConversationType = ConversationType;\r\nunblu.UnbluErrorType = UnbluErrorType;\r\n\r\n\r\n/**\r\n * The central access point to the unblu JS API.\r\n * This api object gives static access to configure and initialize the full unblu `UnbluApi`.\r\n * When loaded in the global space use `Unblu.Api` to access it.\r\n * @hidden\r\n */\r\nexport const api = new UnbluStaticApi();\r\n\r\n","import {UnbluApi} from './unblu-api';\r\nimport {EventEmitter, Listener} from './internal/util/event-emitter';\r\nimport {UnbluUtil} from './unblu-util';\r\nimport {UnbluApiError, UnbluErrorType} from './unblu-api-error';\r\nimport {ApiBridge} from './internal/api-bridge';\r\nimport {InternalApi} from './internal/internal-api';\r\n\r\nexport interface Configuration {\r\n /**\r\n * An API-Key of the account to be used.\r\n * This is a mandatory configuration.\r\n *\r\n * API keys can be retrieved from the Unblu Agent Desk in the settings section.\r\n * Keep in mind, that an Admin role is needed.\r\n */\r\n apiKey: string,\r\n\r\n /**\r\n * The url of the Unblu server to connect to.\r\n *\r\n * @default If not set, the domain of the current page will be used.\r\n */\r\n serverUrl?: string,\r\n\r\n /**\r\n * The public path to Unblu which will be used in combination with [[serverUrl]] to connect to Unblu.\r\n *\r\n * @default If not set, '/unblu' will be used.\r\n */\r\n entryPath?: string,\r\n\r\n /**\r\n * The locale to be used for all Unblu translation texts.\r\n *\r\n * @default If not set, the browsers locale will be used.\r\n */\r\n locale?: string\r\n\r\n /**\r\n * The named area to be used. The named area determines the agent availability, the queue that conversation requests go to, and the configuration.\r\n *\r\n * @default If not set, if the `\"/>` will be used if present and if not, the domain will be used.\r\n */\r\n namedArea?: string\r\n\r\n /**\r\n * The timeout im milliseconds that should be waited for the Unblu integration to load.\r\n *\r\n * @default 30'000 (30 seconds).\r\n */\r\n initTimeout?: number\r\n}\r\n\r\nexport const enum ApiState {\r\n INITIAL = 'INITIAL',\r\n INITIALIZING = 'INITIALIZING',\r\n INITIALIZED = 'INITIALIZED',\r\n ERROR = 'ERROR'\r\n}\r\n\r\nexport type ReadyListener = (api: UnbluApi) => void;\r\nexport type ErrorListener = (e: Error) => void;\r\n\r\n\r\n/**\r\n * #### The central entry point that allows to configure an initialize the Unblu Visitor JS API.\r\n * The static Unblu API works without actually loading the rest of Unblu.\r\n * It can do some general checks and load Unblu or connect the API to a loaded version of Unblu.\r\n * The JS API is an optional add-on to the Unblu visitor site integration.\r\n *\r\n * Depending on how Unblu is integrated into the local website the API has to be initialized differently.\r\n *\r\n * **a.) API-only integration**\r\n * If no unblu-snippet is loaded into the page, Unblu can be fully initialized with the API.\r\n * In this case, both the `configure` and the `initialize` methods have to be called.\r\n * Example:\r\n * ```ts\r\n * const api = await unblu.api\r\n * // configure the unblu server\r\n * .configure({\r\n * apiKey: \"\",\r\n * serverUrl: \"\"\r\n * })\r\n * // initialize the api.\r\n * .initialize();\r\n * ```\r\n * This implementation will load the Unblu snippet and initialize both Unblu and the JS API.\r\n *\r\n * **b.) Snippet and JS API integration**\r\n * If the Unblu snippet is already present in the local website, Unblu doesn't have to be loaded\r\n * and only the API has to be initialized.\r\n * Example:\r\n * ```ts\r\n * // directly initialize the api without configuring.\r\n * const api = await unblu.api.initialize();\r\n *\r\n * ```\r\n */\r\nexport class UnbluStaticApi {\r\n private state: ApiState = ApiState.INITIAL;\r\n private error: UnbluApiError;\r\n private eventEmitter = new EventEmitter();\r\n\r\n private configuration: Configuration;\r\n private initializedApi: UnbluApi;\r\n\r\n /**\r\n * Event emitted as soon as the API is initialized.\r\n *\r\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,\r\n * but there are several places in the integration code that may trigger the initialization.\r\n *\r\n * In most cases however, it is better to use\r\n * ```ts\r\n * unblu.api.initialize().then(api => { //use api here });\r\n * ```\r\n * or\r\n * ```ts\r\n * let api = await unblu.api.initialize();\r\n * // use api here\r\n * ```\r\n *\r\n * @event ready\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly READY: 'ready' = 'ready';\r\n /**\r\n * Event emitted if the API initialization fails.\r\n *\r\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,\r\n * but there are several places in the integration code that may trigger the initialization.\r\n *\r\n * In most cases however, it is better to use\r\n * ```ts\r\n * unblu.api.initialize().catch(error=> { //handle error here });\r\n * ```\r\n * or\r\n * ```ts\r\n * try{\r\n * let api = await unblu.api.initialize();\r\n * }catch(e){\r\n * // handle error here\r\n * }\r\n *\r\n * ```\r\n *\r\n * @event error\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly ERROR: 'error' = 'error';\r\n\r\n /**\r\n * @hidden\r\n */\r\n constructor() {\r\n //TODO: detect browser support;\r\n\r\n // store the error\r\n this.eventEmitter.on(UnbluStaticApi.ERROR, e => this.error = e);\r\n\r\n // install globally\r\n const unblu = UnbluUtil.getUnbluObject();\r\n if (unblu.api) {\r\n this.handleError(new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Unblu API has already been loaded.'));\r\n } else {\r\n unblu.api = this;\r\n }\r\n if (UnbluUtil.isUnbluLoaded()) {\r\n // Auto init if snippet is already loaded.\r\n this.initializeApi().catch(e => console.warn('Error during auto initialization', e));\r\n }\r\n }\r\n\r\n //TODO: Add version\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n *\r\n * **Note** If the API is already initialized, this listener will be called directly.\r\n * @param event The ready event\r\n * @param listener The listener to be called.\r\n * @see [[READY]]\r\n */\r\n on(event: typeof UnbluStaticApi.READY, listener: ReadyListener): void;\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n *\r\n * **Note** If the API has already failed, this listener will be called directly.\r\n * @param event The error event\r\n * @param listener The listener to be called.\r\n * @see [[ERROR]]\r\n */\r\n on(event: typeof UnbluStaticApi.ERROR, listener: ErrorListener): void;\r\n\r\n on(event: string, listener: Listener): void {\r\n if (event == UnbluStaticApi.READY && this.state == ApiState.INITIALIZED)\r\n listener(this.initializedApi);\r\n else if (event == UnbluStaticApi.ERROR && this.state == ApiState.ERROR)\r\n listener(this.error);\r\n else\r\n this.eventEmitter.on(event, listener)\r\n }\r\n\r\n /**\r\n * Removes a previously registered listener.\r\n * @param event The event unregister.\r\n * @param listener The listener to be removed.\r\n * @return `true` if the listener was removed, `false` otherwise.\r\n */\r\n off(event: string, listener: Listener): boolean {\r\n return this.eventEmitter.off(event, listener);\r\n }\r\n\r\n\r\n /**\r\n * Checks whether the API has to be configured or not.\r\n *\r\n * - If no snippet is present and the API state is still [INITIAL]{@link ApiState.INITIAL} a configuration is necessary.\r\n * - If a snippet is present or the API is already loaded, configuration is not necessary.\r\n *\r\n * @return `true` if a configuration is needed to initialize the API, `false` otherwise.\r\n * @see [[configure]] to configure the API\r\n * @see [[initialize]] to initialize the API\r\n */\r\n public isConfigurationNeeded(): boolean {\r\n return this.state === ApiState.INITIAL && !UnbluUtil.isUnbluLoaded();\r\n }\r\n\r\n\r\n /**\r\n * Returns the current state of the API\r\n * @return the current API state.\r\n * @see [[isInitialized]] for a simpler check\r\n */\r\n public getApiState(): ApiState {\r\n return this.state;\r\n }\r\n\r\n /**\r\n * Checks whether the API is initialized or not.\r\n * @return `true` if the API is initialized, `false` for any other state.\r\n * @see [[getApiState]] for the full state\r\n */\r\n public isInitialized(): boolean {\r\n return this.state === ApiState.INITIALIZED;\r\n }\r\n\r\n /**\r\n * Configures the way that Unblu should be initialized.\r\n *\r\n * The configuration of the Unblu API is needed when, and only when no Unblu snippet is already present in the website.\r\n *\r\n * **Note:**\r\n * - Calling this method when there already is an unblu-snippet will result in an [[UnbluApiError]].\r\n * - This method must be called BEFORE [[initialize]]. If it is called afterwards an [[UnbluApiError]] will be thrown.\r\n *\r\n * @param config The configuration to be set.\r\n * @return an instance of `this` allowing chaining like `unblu.api.configure({...}).initialize();`\r\n * @see [[isConfigurationNeeded]] to check if configuration is needed or not.\r\n */\r\n configure(config: Configuration): UnbluStaticApi {\r\n if (UnbluUtil.isUnbluLoaded()) {\r\n throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Configure called when Unblu was already loaded.')\r\n } else if (this.state !== ApiState.INITIAL) {\r\n throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Error configure called after API was already initialized.');\r\n }\r\n this.configuration = config;\r\n return this;\r\n }\r\n\r\n /**\r\n * Initializes the API and resolves to the fully initialized API.\r\n *\r\n * If the API has already been initialized or is already in the initializing process, the existing API will be returned.\r\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.\r\n *\r\n * *The initialization may fail with a [[UnbluApiError]] for the following reasons*\r\n * - A configuration is needed but none was provided: [CONFIGURATION_MISSING]{@link UnbluErrorType.CONFIGURATION_MISSING}\r\n * - Loading Unblu encounters a problem: [ERROR_LOADING_UNBLU]{@link UnbluErrorType.ERROR_LOADING_UNBLU}\r\n * - The initialization timed out: [INITIALIZATION_TIMEOUT]{@link UnbluErrorType.INITIALIZATION_TIMEOUT}\r\n * - The Unblu API is incompatible with the Unblu server: [INCOMPATIBLE_UNBLU_VERSION]{@link UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION}\r\n * - The browser is unsupported: [UNSUPPORTED_BROWSER]{@link UnbluErrorType.UNSUPPORTED_BROWSER}\r\n */\r\n public async initialize(): Promise {\r\n if (this.state === ApiState.INITIALIZED) {\r\n return this.initializedApi;\r\n } else if (this.state === ApiState.INITIALIZING) {\r\n return new Promise((resolve, reject) => {\r\n this.on(UnbluStaticApi.READY, resolve);\r\n this.on(UnbluStaticApi.ERROR, reject);\r\n });\r\n } else {\r\n return this.initializeApi();\r\n }\r\n }\r\n\r\n private async initializeApi(): Promise {\r\n this.state = ApiState.INITIALIZING;\r\n try {\r\n if (!UnbluUtil.isUnbluLoaded()) {\r\n if (!this.configuration) {\r\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.')\r\n }\r\n if (this.configuration.namedArea) {\r\n UnbluUtil.setNamedArea(this.configuration.namedArea);\r\n }\r\n if (this.configuration.locale) {\r\n UnbluUtil.setLocale(this.configuration.locale);\r\n }\r\n await this.injectUnblu(this.configuration);\r\n }\r\n let apiBridge = new ApiBridge(UnbluUtil.getUnbluObject());\r\n await apiBridge.waitUntilLoaded(this.configuration ? this.configuration.initTimeout || 30000 : 30000);\r\n\r\n let internalApi = new InternalApi(apiBridge);\r\n internalApi.checkCompatibility();\r\n\r\n // Check internalApi waitUntilInitialized\r\n await internalApi.meta.waitUntilInitialized();\r\n\r\n this.initializedApi = new UnbluApi(internalApi);\r\n this.state = ApiState.INITIALIZED;\r\n } catch (e) {\r\n this.handleError(e);\r\n }\r\n\r\n this.eventEmitter.emit(UnbluStaticApi.READY, this.initializedApi);\r\n\r\n return this.initializedApi;\r\n }\r\n\r\n private async injectUnblu(config: Configuration): Promise {\r\n const serverUrl = config.serverUrl || '';\r\n const apiKey = config.apiKey || '';\r\n const unbluPath = config.entryPath || '/unblu';\r\n let unbluUrl = `${serverUrl}${unbluPath}/visitor.js?x-unblu-apikey=${apiKey}`;\r\n try {\r\n await UnbluUtil.loadScript(unbluUrl, config.initTimeout);\r\n } catch (e) {\r\n throw new UnbluApiError(UnbluErrorType.ERROR_LOADING_UNBLU, 'Error loading unblu snippet: ' + e + ' check the configuration: ' + config);\r\n }\r\n }\r\n\r\n private handleError(error: UnbluApiError) {\r\n this.state = ApiState.ERROR;\r\n this.eventEmitter.emit(UnbluStaticApi.ERROR, error);\r\n console.error(error);\r\n throw error;\r\n }\r\n\r\n\r\n}","import {InternalApi} from './internal/internal-api';\r\nimport {GeneralEventType} from './internal/module/general-module';\r\nimport {Event, EventCallback} from './internal/event';\r\nimport {EventEmitter, Listener} from './internal/util/event-emitter';\r\nimport {UnbluApiError, UnbluErrorType} from './unblu-api-error';\r\nimport {IndividualUiState} from './model/individualui_state';\r\n\r\n/**\r\n * Listener called whenever the UI state changes.\r\n * @param uistate The new UI state.\r\n */\r\nexport type UiStateChangeListener = (uistate: IndividualUiState) => void;\r\n\r\n/**\r\n * This class allows controlling of the UI state and the Unblu individual UI.\r\n */\r\nexport class UnbluUiApi {\r\n\r\n private internalListeners: { [key: string]: EventCallback } = {};\r\n private eventEmitter = new EventEmitter();\r\n\r\n /**\r\n * Event emitted every time the state of the individual UI is changed.\r\n *\r\n * @event uiStateChange\r\n * @see [[on]] for listener registration\r\n * @see [[UiStateChangeListener]]\r\n */\r\n public static readonly UI_STATE_CHANGE: 'uiStateChange' = 'uiStateChange';\r\n\r\n\r\n /**\r\n * @hidden\r\n */\r\n constructor(private internalApi: InternalApi) {\r\n internalApi.meta.on('upgraded', () => this.onUpgraded());\r\n }\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The uistateChange event.\r\n * @param listener The listener to be called.\r\n * @see [[UI_STATE_CHANGE]]\r\n */\r\n public on(event: typeof UnbluUiApi.UI_STATE_CHANGE, listener: UiStateChangeListener): void;\r\n\r\n public on(event: GeneralEventType, listener: Listener): void {\r\n const needsInternalSubscription = !this.eventEmitter.hasListeners(event);\r\n this.eventEmitter.on(event, listener);\r\n if (needsInternalSubscription)\r\n this.onInternal(event).catch(e => console.warn('Error registering internal listener for event:', event, 'error:' + e, e));\r\n }\r\n\r\n /**\r\n * Removes a previously registered listener\r\n * @param event The event to unregister from.\r\n * @param listener The listener to remove.\r\n */\r\n public off(event: GeneralEventType, listener: Listener): boolean {\r\n const removed = this.eventEmitter.off(event, listener);\r\n if (!this.eventEmitter.hasListeners(event))\r\n this.offInternal(event).catch(e => console.warn('Error removing internal listener for event:', event, 'error:' + e, e));\r\n return removed;\r\n }\r\n\r\n\r\n private async onInternal(eventName: GeneralEventType) {\r\n let internalListener: EventCallback;\r\n switch (eventName) {\r\n case UnbluUiApi.UI_STATE_CHANGE:\r\n internalListener = (event: Event) => {\r\n this.eventEmitter.emit(event.name, event.data);\r\n };\r\n break;\r\n default:\r\n throw new UnbluApiError(UnbluErrorType.INVALID_FUNCTION_ARGUMENTS, 'Registration to unknown event:' + eventName);\r\n }\r\n\r\n if (await this.internalApi.meta.isUpgraded()) {\r\n this.internalListeners[eventName] = internalListener;\r\n try {\r\n await this.internalApi.general.on(eventName, internalListener);\r\n } catch (e) {\r\n delete this.internalListeners[eventName];\r\n throw e;\r\n }\r\n }\r\n }\r\n\r\n private async offInternal(eventName: GeneralEventType) {\r\n const listener = this.internalListeners[eventName];\r\n if (listener == null) {\r\n return;\r\n }\r\n delete this.internalListeners[eventName];\r\n await this.internalApi.general.off(eventName, listener);\r\n }\r\n\r\n\r\n /**\r\n * Opens the individual UI if it is collapsed and collapses it if it is open.\r\n */\r\n public async toggleIndividualUi(): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.toggleIndividualUi();\r\n }\r\n\r\n /**\r\n * Navigates the individual UI to the PIN entry UI.\r\n *\r\n * **NOTE:** calling this method will NOT automatically open the Unblu UI if it is collapsed. Use [[openIndividualUi]] if this is needed.\r\n */\r\n public async openPinEntryUi(): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.openPinEntryUi();\r\n }\r\n\r\n\r\n /**\r\n * Pop-out the individual UI into a separate window.\r\n *\r\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!\r\n */\r\n public async popoutIndividualUi(): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.popoutIndividualUi();\r\n }\r\n\r\n /**\r\n * Pop-in the individual UI when it is in [POPPED_OUT]{@link IndividualUiState.POPPED_OUT} state.\r\n *\r\n * The pop-out window will automatically close and the individual UI will be displayed in the original window again.\r\n */\r\n public async popinIndividualUi(): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.popinIndividualUi();\r\n }\r\n\r\n /**\r\n * Maximize the individual UI - Does nothing if it is already maximized or popped out.\r\n */\r\n public async maximizeIndividualUi(): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.maximizeIndividualUi();\r\n }\r\n\r\n /**\r\n * Minimize the individual UI - Does nothing if it is already minimized.\r\n */\r\n public async minimizeIndividualUi(): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.minimizeIndividualUi();\r\n }\r\n\r\n /**\r\n * Opens the individual UI if it was collapsed. - Does nothing if it was already open.\r\n */\r\n public async openIndividualUi(): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.openIndividualUi();\r\n }\r\n\r\n /**\r\n * Collapses the individual UI if it was open. - Does nothing if it was already collapsed.\r\n */\r\n public async collapseIndividualUi(): Promise {\r\n await this.requireUpgrade();\r\n await this.internalApi.general.collapseIndividualUi();\r\n }\r\n\r\n /**\r\n * Get the state of the individual UI.\r\n * @return A promise that resolves to the [[IndividualUiState]] of the individual UI.\r\n */\r\n public async getIndividualUiState(): Promise {\r\n if (!await this.internalApi.meta.isUpgraded()) {\r\n return IndividualUiState.COLLAPSED;\r\n }\r\n return await this.internalApi.general.getIndividualUiState();\r\n }\r\n\r\n private async requireUpgrade(): Promise {\r\n await this.internalApi.meta.upgrade(false);\r\n }\r\n\r\n private onUpgraded() {\r\n for (let event of this.eventEmitter.getEventsWithListeners()) {\r\n // register internal listeners for all events that need upgrade.\r\n if (!this.internalListeners[event])\r\n this.onInternal(event as GeneralEventType);\r\n }\r\n }\r\n}","import {EventCallback} from './event';\r\nimport {UnbluApiError, UnbluErrorType} from '../unblu-api-error';\r\nimport {\r\n CATEGORY_ACTION_NOT_GRANTED,\r\n CATEGORY_EXECUTION_EXCEPTION,\r\n CATEGORY_INVALID_FUNCTION_ARGUMENTS,\r\n CATEGORY_INVALID_FUNCTION_CALL\r\n} from './java-error-codes';\r\n\r\n\r\nconst SUPPORTED_MAJOR_VERSION = 2;\r\n\r\ninterface ApiConsumer {\r\n onUnbluEvent(event: Event): Promise;\r\n}\r\n\r\ninterface CollabServerInternalApi {\r\n getApiVersion(): string;\r\n\r\n execute(moduleName: string, functionName: string, args: any[]): Promise;\r\n\r\n registerEventListener(moduleName: string, eventName: string, listener: EventCallback): Promise;\r\n\r\n removeEventListener(moduleName: string, eventName: string, listener: EventCallback): Promise;\r\n}\r\n\r\nexport class ApiBridge {\r\n private internal: CollabServerInternalApi;\r\n private readonly eventHandler: ApiConsumer;\r\n\r\n /**\r\n * instantiates the bridge that links the UNBLU internal API provided by the collaboration server with the UNBLU JS-API\r\n * @param mountPoint the global unblu object under which the internal API is registered.\r\n */\r\n constructor(private mountPoint: any) {\r\n }\r\n\r\n public async waitUntilLoaded(timeout: number, promise?: Promise): Promise {\r\n const timeoutTimestamp = Date.now() + timeout;\r\n return new Promise((resolve, reject) => {\r\n const waitForLoaded = () => {\r\n if (timeoutTimestamp - Date.now() > 0) {\r\n if (this.checkLoaded()) return resolve();\r\n setTimeout(waitForLoaded, 50);\r\n } else {\r\n reject(new UnbluApiError(UnbluErrorType.INITIALIZATION_TIMEOUT, 'Timeout while waiting for collaboration server API to be loaded.'));\r\n }\r\n };\r\n waitForLoaded();\r\n });\r\n }\r\n\r\n private checkLoaded(): boolean {\r\n this.internal = this.mountPoint['internal'];\r\n return this.internal != null;\r\n }\r\n\r\n\r\n public checkCompatibility(): void {\r\n if (!this.internal) {\r\n throw new UnbluApiError(UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION, 'Incompatible unblu collaboration server, no API bridge provided.');\r\n } else if (typeof this.internal.getApiVersion !== 'function') {\r\n throw new UnbluApiError(UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION, 'Incompatible unblu collaboration server, incompatible API bridge.');\r\n }\r\n const version = this.internal.getApiVersion();\r\n if (+version[0] != SUPPORTED_MAJOR_VERSION) {\r\n throw new UnbluApiError(UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION, `Incompatible collaboration server version. \r\n Supported API version: ${SUPPORTED_MAJOR_VERSION}.x.x.\r\n collaboration server API version: ${version}.`);\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Calls an API function of the internal unblu collaboration server API.\r\n * @param moduleName The module to which the function belongs.\r\n * @param functionName The function to call.\r\n * @param args The arguments to pass to the function.\r\n */\r\n public async callApiFunction(moduleName: string, functionName: string, args: any[]): Promise {\r\n try {\r\n return await this.internal.execute(moduleName, functionName, args);\r\n } catch (e) {\r\n switch (e.type) {\r\n case CATEGORY_INVALID_FUNCTION_CALL:\r\n throw new UnbluApiError(UnbluErrorType.INVALID_FUNCTION_CALL, e.message);\r\n case CATEGORY_INVALID_FUNCTION_ARGUMENTS:\r\n throw new UnbluApiError(UnbluErrorType.INVALID_FUNCTION_ARGUMENTS, e.message);\r\n case CATEGORY_ACTION_NOT_GRANTED:\r\n throw new UnbluApiError(UnbluErrorType.ACTION_NOT_GRANTED, e.message);\r\n case CATEGORY_EXECUTION_EXCEPTION:\r\n throw new UnbluApiError(UnbluErrorType.EXECUTION_EXCEPTION, e.message);\r\n default:\r\n throw new UnbluApiError(UnbluErrorType.EXECUTION_EXCEPTION, '' + e);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Registers a callback for an event emitted by the internal unblu collaboration server API.\r\n * @param module The module that emits the event.\r\n * @param event The event name.\r\n * @param callback The callback which will be called every time the event is emitted.\r\n */\r\n public on(module: string, event: string, callback: EventCallback): Promise {\r\n return this.internal.registerEventListener(module, event, callback);\r\n }\r\n\r\n /**\r\n * Unregisters a callback for an event emitted by the internal unblu collaboration server API.\r\n * @param module The module that emits the event.\r\n * @param event The event name.\r\n * @param callback Optionally callback which will be removed, if none is provided all listeners of the event will be removed.\r\n */\r\n public off(module: string, event: string, callback?: EventCallback): Promise {\r\n return this.internal.removeEventListener(module, event, callback);\r\n }\r\n\r\n}","export const CATEGORY_INVALID_FUNCTION_CALL = 1;\r\nexport const CATEGORY_INVALID_FUNCTION_ARGUMENTS = 2;\r\nexport const CATEGORY_EXECUTION_EXCEPTION = 3;\r\nexport const CATEGORY_ACTION_NOT_GRANTED = 4;","import {ApiBridge} from './api-bridge';\r\nimport {MetaModule} from './module/meta-module';\r\nimport {GeneralModule} from './module/general-module';\r\nimport {GeneralLazyModule} from './module/general-lazy-module';\r\nimport {ConversationModule} from './module/conversation-module';\r\nimport {AgentAvailabilityModule} from './module/agent-availability-module';\r\n\r\nexport class InternalApi {\r\n public meta: MetaModule;\r\n public general: GeneralModule;\r\n public generalLazy: GeneralLazyModule;\r\n public conversation: ConversationModule;\r\n public agentAvailability: AgentAvailabilityModule;\r\n\r\n constructor(private bridge: ApiBridge) {\r\n this.meta = new MetaModule(bridge);\r\n this.general = new GeneralModule(bridge);\r\n this.generalLazy = new GeneralLazyModule(bridge);\r\n this.conversation = new ConversationModule(bridge);\r\n this.agentAvailability = new AgentAvailabilityModule(bridge);\r\n }\r\n\r\n public checkCompatibility(): void {\r\n this.bridge.checkCompatibility();\r\n }\r\n}","import {InternalModule} from './module';\r\nimport {ApiBridge} from '../api-bridge';\r\n\r\nexport type MetaEventType = 'upgraded';\r\n\r\nconst enum MetaFunction {\r\n isUpgraded = 'isUpgraded',\r\n upgrade = 'upgrade',\r\n waitUntilInitialized = 'waitUntilInitialized'\r\n}\r\n\r\nexport class MetaModule extends InternalModule {\r\n constructor(bridge: ApiBridge) {\r\n super(bridge, 'meta');\r\n }\r\n\r\n public isUpgraded(): Promise {\r\n return this.callApiFunction(MetaFunction.isUpgraded, []);\r\n }\r\n\r\n public upgrade(openUi?: boolean): Promise {\r\n return this.callApiFunction(MetaFunction.upgrade, [openUi]);\r\n }\r\n\r\n public waitUntilInitialized(): Promise {\r\n return this.callApiFunction(MetaFunction.waitUntilInitialized, []);\r\n }\r\n}","import {InternalModule} from './module';\r\nimport {ApiBridge} from '../api-bridge';\r\nimport {PersonInfo} from '../../model/person-info';\r\nimport {ConversationType} from '../../model/conversation-type';\r\nimport {IndividualUiState} from '../../model/individualui_state';\r\nimport {NewConversationInterceptor} from \"../../unblu-api\";\r\nimport {ConversationInfo} from \"../../model/conversation-info\";\r\n\r\nexport type GeneralEventType =\r\n 'activeConversationChange' |\r\n 'conversationsChange' |\r\n 'notificationCountChange' |\r\n 'personChange' |\r\n 'uiStateChange';\r\n\r\nconst enum GeneralFunction {\r\n startConversation = 'startConversation',\r\n setNewConversationInterceptor = 'setNewConversationInterceptor',\r\n joinConversation = 'joinConversation',\r\n openConversation = 'openConversation',\r\n toggleIndividualUi = 'toggleIndividualUi',\r\n popoutIndividualUi = 'popoutIndividualUi',\r\n popinIndividualUi = 'popinIndividualUi',\r\n maximizeIndividualUi = 'maximizeIndividualUi',\r\n minimizeIndividualUi = 'minimizeIndividualUi',\r\n openIndividualUi = 'openIndividualUi',\r\n openPinEntryUi = 'openPinEntryUi',\r\n collapseIndividualUi = 'collapseIndividualUi',\r\n getIndividualUiState = 'getIndividualUiState',\r\n getActiveConversation = 'getActiveConversation',\r\n getConversations = 'getConversations',\r\n getNotificationCount = 'getNotificationCount',\r\n getPersonInfo = 'getPersonInfo',\r\n setPersonNickname = 'setPersonNickname'\r\n}\r\n\r\nexport class GeneralModule extends InternalModule {\r\n constructor(bridge: ApiBridge) {\r\n super(bridge, 'general');\r\n }\r\n\r\n public startConversation(type: ConversationType, visitorName?: string, visitorData?: string): Promise {\r\n return this.callApiFunction(GeneralFunction.startConversation, [type, visitorName, visitorData]);\r\n }\r\n\r\n public setNewConversationInterceptor(callback: NewConversationInterceptor): Promise {\r\n return this.callApiFunction(GeneralFunction.setNewConversationInterceptor, [callback]);\r\n }\r\n\r\n public joinConversation(pin: string, visitorName?: string): Promise {\r\n return this.callApiFunction(GeneralFunction.joinConversation, [pin, visitorName]);\r\n }\r\n\r\n public openConversation(conversationId: string): Promise {\r\n return this.callApiFunction(GeneralFunction.openConversation, [conversationId]);\r\n }\r\n\r\n public toggleIndividualUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.toggleIndividualUi, []);\r\n }\r\n\r\n public openPinEntryUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.openPinEntryUi, []);\r\n }\r\n\r\n public popoutIndividualUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.popoutIndividualUi, []);\r\n }\r\n\r\n public popinIndividualUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.popinIndividualUi, []);\r\n }\r\n\r\n public maximizeIndividualUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.maximizeIndividualUi, []);\r\n }\r\n\r\n public minimizeIndividualUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.minimizeIndividualUi, []);\r\n }\r\n\r\n public openIndividualUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.openIndividualUi, []);\r\n }\r\n\r\n public collapseIndividualUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.collapseIndividualUi, []);\r\n }\r\n\r\n public getIndividualUiState(): Promise {\r\n return this.callApiFunction(GeneralFunction.getIndividualUiState, []); \r\n }\r\n\r\n public getActiveConversation(): Promise {\r\n return this.callApiFunction(GeneralFunction.getActiveConversation, []);\r\n }\r\n\r\n public getConversations(): Promise {\r\n return this.callApiFunction(GeneralFunction.getConversations, []);\r\n }\r\n\r\n public getNotificationCount(): Promise {\r\n return this.callApiFunction(GeneralFunction.getNotificationCount, []);\r\n }\r\n\r\n public getPersonInfo(): Promise {\r\n return this.callApiFunction(GeneralFunction.getPersonInfo, []);\r\n }\r\n\r\n public setPersonNickname(nickname: string): Promise {\r\n return this.callApiFunction(GeneralFunction.setPersonNickname, [nickname]);\r\n }\r\n}","import {InternalModule} from './module';\r\nimport {ApiBridge} from '../api-bridge';\r\nimport {PersonInfo} from '../../model/person-info';\r\nimport {NewConversationInterceptor} from \"../../unblu-api\";\r\n\r\n\r\nexport type GeneralLazyEventType = '';\r\n\r\nconst enum GeneralLazyFunction {\r\n getNotificationCount = 'getNotificationCount',\r\n getPersonInfo = 'getPersonInfo',\r\n setNewConversationInterceptor = 'setNewConversationInterceptor',\r\n}\r\n\r\nexport class GeneralLazyModule extends InternalModule {\r\n constructor(bridge: ApiBridge) {\r\n super(bridge, 'generallazy');\r\n }\r\n\r\n public getNotificationCount(): Promise {\r\n return this.callApiFunction(GeneralLazyFunction.getNotificationCount, []);\r\n }\r\n\r\n public getPersonInfo(): Promise {\r\n return this.callApiFunction(GeneralLazyFunction.getPersonInfo, []);\r\n }\r\n\r\n public setNewConversationInterceptor(callback: NewConversationInterceptor): Promise {\r\n return this.callApiFunction(GeneralLazyFunction.setNewConversationInterceptor, [callback]);\r\n }\r\n}","import {InternalModule} from './module';\r\nimport {ApiBridge} from '../api-bridge';\r\nimport {CallState} from '../../model/call-state';\r\nimport {ConversationState} from '../../model/conversation-state';\r\nimport {ConnectionState} from '../../model/connection-state';\r\nimport {Invitation} from \"../../model/invitation\";\r\n\r\n\r\nexport interface ConversationCallState {\r\n conversationId: string\r\n callState: CallState\r\n}\r\n\r\nexport interface ConversationConnectionState {\r\n conversationId: string\r\n connectionState: ConnectionState\r\n}\r\n\r\nexport interface ConversationWithState {\r\n conversationId: string\r\n conversationState: ConversationState\r\n}\r\n\r\nexport interface ConversationInvitations {\r\n conversationId: string\r\n invitations: Invitation[]\r\n}\r\n\r\nexport type ConversationEventType =\r\n 'connectionStateChange' |\r\n 'conversationStateChange' |\r\n 'end' |\r\n 'close' |\r\n 'personChange' |\r\n 'callStateChange' |\r\n 'invitationsChange'\r\n\r\nconst enum ConversationFunction {\r\n getConnectionState = 'getConnectionState',\r\n getConversationState = 'getConversationState',\r\n getCallState = 'getCallState',\r\n startAudioCall = 'startAudioCall',\r\n startVideoCall = 'startVideoCall',\r\n endConversation = 'endConversation',\r\n leaveConversation = 'leaveConversation',\r\n closeConversation = 'closeConversation',\r\n createAnonymousPinInvitation = 'createAnonymousPinInvitation',\r\n createAnonymousEmailInvitation = 'createAnonymousEmailInvitation',\r\n getInvitations = 'getInvitations',\r\n revokeInvitation = 'revokeInvitation',\r\n renewInvitationPin = 'renewInvitationPin',\r\n setVisitorData = 'setVisitorData'\r\n}\r\n\r\nexport class ConversationModule extends InternalModule {\r\n constructor(bridge: ApiBridge) {\r\n super(bridge, 'conversation');\r\n }\r\n\r\n public getConnectionState(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.getConnectionState, [conversationId]);\r\n }\r\n\r\n public getConversationState(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.getConversationState, [conversationId]);\r\n }\r\n\r\n public getCallState(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.getCallState, [conversationId]);\r\n }\r\n\r\n public startAudioCall(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.startAudioCall, [conversationId]);\r\n }\r\n\r\n public startVideoCall(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.startVideoCall, [conversationId]);\r\n }\r\n\r\n public endConversation(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.endConversation, [conversationId]);\r\n }\r\n\r\n public leaveConversation(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.leaveConversation, [conversationId]);\r\n }\r\n\r\n public closeConversation(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.closeConversation, [conversationId]);\r\n }\r\n\r\n public createAnonymousPinInvitation(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.createAnonymousPinInvitation, [conversationId]);\r\n }\r\n\r\n public createAnonymousEmailInvitation(conversationId: string, email: String) : Promise {\r\n return this.callApiFunction(ConversationFunction.createAnonymousEmailInvitation, [conversationId, email]);\r\n }\r\n\r\n public async getInvitations(conversationId: string): Promise {\r\n return this.callApiFunction(ConversationFunction.getInvitations, [conversationId]);\r\n }\r\n\r\n public async revokeInvitation(conversationId: string, invitationId: String) : Promise {\r\n return this.callApiFunction(ConversationFunction.revokeInvitation, [conversationId, invitationId]);\r\n }\r\n\r\n public async renewInvitationPin(conversationId: string, invitationId: String) : Promise {\r\n return this.callApiFunction(ConversationFunction.renewInvitationPin, [conversationId, invitationId]);\r\n }\r\n\r\n public async setVisitorData(visitorData: String) : Promise {\r\n return this.callApiFunction(ConversationFunction.setVisitorData, [visitorData]);\r\n }\r\n}","import {InternalModule} from './module';\r\nimport {ApiBridge} from '../api-bridge';\r\nimport {AgentAvailabilityState} from '../../model/agent-availability-state';\r\n\r\n\r\nexport type AgentAvailabilityEventType = 'availabilityChange';\r\n\r\nconst enum AgentAvailabilityFunction {\r\n isAgentAvailable = 'isAgentAvailable',\r\n getAgentAvailabilityState = 'getAgentAvailabilityState'\r\n}\r\n\r\nexport class AgentAvailabilityModule extends InternalModule {\r\n constructor(bridge: ApiBridge) {\r\n super(bridge, 'agentavailability');\r\n }\r\n\r\n public isAgentAvailable(): Promise {\r\n return this.callApiFunction(AgentAvailabilityFunction.isAgentAvailable, []);\r\n }\r\n\r\n public getAgentAvailabilityState(): Promise {\r\n return this.callApiFunction(AgentAvailabilityFunction.getAgentAvailabilityState, []);\r\n }\r\n}","export enum CallState {\r\n /**\r\n * A some one is trying to call, the phone is ringing\r\n */\r\n INBOUND = 'INBOUND',\r\n /**\r\n * You are trying to call someone\r\n */\r\n OUTBOUND = 'OUTBOUND',\r\n /**\r\n * A call is active and the local tab is connected to the call.\r\n */\r\n ACTIVE_JOINED = 'ACTIVE_JOINED',\r\n /**\r\n * A call is active but the local person has declined it.\r\n */\r\n ACTIVE_NOT_JOINED = 'ACTIVE_NOT_JOINED',\r\n /**\r\n * A call is active and the local person has joined it on an other device.\r\n */\r\n ACTIVE_JOINED_ELSEWHERE = 'ACTIVE_JOINED_ELSEWHERE',\r\n /**\r\n * No inbound, outgoing or active call.\r\n */\r\n NONE = 'NONE'\r\n}\r\n\r\n","export enum ConnectionState {\r\n /**\r\n * Initial state before connection establishment has started\r\n */\r\n INITIAL = 'INITIAL',\r\n\r\n /**\r\n * State during the first connection to the server\r\n */\r\n CONNECTING = 'CONNECTING',\r\n\r\n /**\r\n * The connection has been successfully established.\r\n */\r\n CONNECTED = 'CONNECTED',\r\n\r\n /**\r\n * The connection has been lost, reconnect is active.\r\n */\r\n RECONNECTING = 'RECONNECTING',\r\n\r\n /**\r\n * The connection has been successfully closed.\r\n *\r\n */\r\n CLOSED = 'CLOSED',\r\n\r\n /**\r\n * A fatal error has occurred. The connection has been permanently lost. No reconnect will be be possible.\r\n */\r\n ERROR = 'ERROR'\r\n}\r\n\r\n","export enum ConversationType {\r\n /**\r\n * (Visitor initiated, visitor centered) A visitor creates an incoming chat conversation.\r\n */\r\n CHAT_REQUEST = 'CHAT_REQUEST',\r\n /**\r\n * (Visitor initiated, visitor centered) A visitor creates an incoming chat conversation while all agents are offline.\r\n */\r\n OFFLINE_CHAT_REQUEST = 'OFFLINE_CHAT_REQUEST',\r\n /**\r\n * (Visitor initiated, visitor centered) A visitor creates an incoming video conversation.\r\n */\r\n VIDEO_REQUEST = 'VIDEO_REQUEST',\r\n /**\r\n * (Visitor initiated, visitor centered) A visitor creates an incoming audio conversation.\r\n */\r\n AUDIO_REQUEST = 'AUDIO_REQUEST',\r\n /**\r\n * (Visitor initiated, visitor centered) A visitor creates an incoming universal co-browsing conversation.\r\n */\r\n HEADLESS_BROWSER_REQUEST = 'HEADLESS_BROWSER_REQUEST',\r\n /**\r\n * (Visitor initiated, visitor centered) A visitor creates an incoming embedded co-browsing conversation.\r\n */\r\n DOMCAP_BROWSER_REQUEST = 'DOMCAP_BROWSER_REQUEST',\r\n /**\r\n * (Visitor initiated, visitor centered) A visitor creates an incoming mobile co-browsing conversation.\r\n */\r\n MOBILE_COBROWSING_REQUEST = 'MOBILE_COBROWSING_REQUEST',\r\n /**\r\n * (Visitor initiated, visitor centered) A visitor creates an incoming screen sharing conversation.\r\n */\r\n SCREEN_SHARING_REQUEST = 'SCREEN_SHARING_REQUEST',\r\n\t/**\r\n\t * (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\r\n\t * embedded\r\n\t */\r\n\tVISITOR_COBROWSING = 'VISITOR_COBROWSING'\r\n}","export enum AgentAvailabilityState {\r\n /**\r\n * There is at least one agent available for the specified named area and language.\r\n */\r\n AVAILABLE = 'AVAILABLE',\r\n /**\r\n * There is at least one agent watching the inbound queue for the specified named area and language but the max capacity of parallel conversations is reached.\r\n *\r\n * It is very likely, that an agent will be available in a short time.\r\n */\r\n BUSY = 'BUSY',\r\n /**\r\n * There is no agent watching the inbound queue for the specified named area and language.\r\n *\r\n * It is unlikely, that an agent will be available in a short time.\r\n */\r\n UNAVAILABLE = 'UNAVAILABLE',\r\n /**\r\n * There is currently no agent handling any inbound queue items.\r\n *\r\n * It is very unlikely, that an agent will be available in a short time.\r\n */\r\n OFFLINE = 'OFFLINE'\r\n}","export enum ConversationState {\r\n /**\r\n * Initial state of a conversation\r\n */\r\n CREATED = 'CREATED',\r\n\r\n /**\r\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\r\n * is doing his onboarding\r\n */\r\n ONBOARDING = 'ONBOARDING',\r\n\r\n /**\r\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\r\n * conversation is doing the reboarding.\r\n */\r\n REBOARDING = 'REBOARDING',\r\n\r\n /**\r\n * Depending of the engagement type of the conversation, the conversation is put in the queued state when it is inside the queue.\r\n */\r\n QUEUED = 'QUEUED',\r\n\r\n /**\r\n * Conversation is active\r\n */\r\n ACTIVE = 'ACTIVE',\r\n\r\n /**\r\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\r\n * again.\r\n */\r\n UNASSIGNED = 'UNASSIGNED',\r\n\r\n /**\r\n * Conversation is being ended\r\n */\r\n OFFBOARDING = 'OFFBOARDING',\r\n\r\n /**\r\n * Conversation is ended\r\n */\r\n ENDED = 'ENDED'\r\n}"],"sourceRoot":""}