{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/shared/unblu-api-error.ts","webpack:///./src/shared/internal/module/module.ts","webpack:///./src/shared/internal/util/event-emitter.ts","webpack:///./src/shared/internal/unblu-util.ts","webpack:///./src/shared/conversation.ts","webpack:///./src/shared/internal/api-bridge.ts","webpack:///./src/shared/internal/java-error-codes.ts","webpack:///./src/shared/internal/module/conversation-module.ts","webpack:///./src/shared/internal/module/agent-availability-module.ts","webpack:///./src/shared/internal/module/base-general-module.ts","webpack:///./src/shared/model/call-state.ts","webpack:///./src/shared/model/connection-state.ts","webpack:///./src/shared/model/conversation-type.ts","webpack:///./src/shared/model/agent-availability-state.ts","webpack:///./src/shared/model/invitation-status.ts","webpack:///./src/visitor-js/unblu-api.ts","webpack:///./src/visitor-js/unblu-api-ui.ts","webpack:///./src/visitor-js/index.ts","webpack:///./src/visitor-js/unblu-static-api.ts","webpack:///./src/visitor-js/internal/internal-api.ts","webpack:///./src/visitor-js/internal/module/meta-module.ts","webpack:///./src/visitor-js/internal/module/general-lazy-module.ts","webpack:///./src/visitor-js/internal/module/general-module.ts","webpack:///./src/shared/model/conversation-state.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","UnbluErrorType","UnbluApiError","Error","[object Object]","type","detail","super","this","InternalModule","bridge","moduleName","functionName","args","callApiFunction","eventName","listener","on","off","EventEmitter","listeners","event","indexOf","push","index","splice","length","events","data","forEach","e","console","warn","IntegrationType","EntryPoint","UnbluUtil","uri","timeout","timeoutTime","script","document","createElement","setAttribute","toString","src","Promise","resolve","reject","timeoutId","cleanup","onerror","onload","window","clearTimeout","onError","error","setTimeout","getElementsByTagName","appendChild","namedArea","existingMetaTag","querySelector","originalContent","getAttribute","metaTag","parentElement","head","remove","locale","getUnbluObject","integrationType","APIKEY","entryPointMatches","embedded","entryPoint","siteEmbeddedMain","floating","siteIntegrationGreedyMain","siteIntegrationLazyMain","unblu","isUnbluLoaded","apiState","api","getApiState","unbluApi","initialize","deinitialize","excludedAppElement","unbluAppElements","appElement","log","param","trim","unblu_api_error_1","event_emitter_1","Conversation","conversationModule","conversationId","eventEmitter","internalListeners","destroyed","CLOSE","destroy","checkNotDestroyed","needsInternalSubscription","hasListeners","onInternal","removed","offInternal","internalListener","CONNECTION_STATE_CHANGE","emit","connectionState","CONVERSATION_STATE_CHANGE","conversationState","CALL_STATE_CHANGE","callState","INVITATIONS_CHANGE","invitations","catch","getConnectionState","getConversationState","getCallState","createAnonymousPinInvitation","email","createAnonymousEmailInvitation","invitationId","revokeInvitation","renewInvitationPin","visitorData","setVisitorData","getInvitations","startAudioCall","startVideoCall","endConversation","leaveConversation","closeConversation","ILLEGAL_STATE","reset","END","java_error_codes_1","SUPPORTED_MAJOR_VERSION","ApiBridge","mountPoint","mountName","promise","timeoutTimestamp","Date","now","waitForLoaded","checkLoaded","INITIALIZATION_TIMEOUT","internal","INCOMPATIBLE_UNBLU_VERSION","getApiVersion","version","execute","CATEGORY_INVALID_FUNCTION_CALL","INVALID_FUNCTION_CALL","message","CATEGORY_INVALID_FUNCTION_ARGUMENTS","INVALID_FUNCTION_ARGUMENTS","CATEGORY_ACTION_NOT_GRANTED","ACTION_NOT_GRANTED","CATEGORY_EXECUTION_EXCEPTION","EXECUTION_EXCEPTION","callback","registerEventListener","removeEventListener","module_1","ConversationModule","AgentAvailabilityModule","BaseGeneralFunction","BaseGeneralModule","visitorName","startConversation","setNewConversationInterceptor","pin","joinConversation","openConversation","getActiveConversation","getConversations","getNotificationCount","getPersonInfo","nickname","setPersonNickname","CallState","ConnectionState","ConversationType","AgentAvailabilityState","InvitationStatus","conversation_1","unblu_api_ui_1","UnbluApi","internalApi","meta","onUpgraded","ui","UnbluUiApi","assertNotDeinitialized","internalModule","needsUpgrade","AGENT_AVAILABLE_CHANGE","AGENT_AVAILABILITY_CHANGE","agentAvailability","ACTIVE_CONVERSATION_CHANGE","conversation","general","CONVERSATIONS_CHANGE","NOTIFICATION_COUNT_CHANGE","PERSON_CHANGE","DEINITIALIZING","DEINITIALIZED","isUpgraded","requireUpgrade","generalLazy","isAgentAvailable","getAgentAvailabilityState","upgrade","getEventsWithListeners","isDeinitialized","UI_STATE_CHANGE","toggleIndividualUi","openPinEntryUi","openOverviewUi","popoutIndividualUi","popinIndividualUi","maximizeIndividualUi","minimizeIndividualUi","openIndividualUi","collapseIndividualUi","getIndividualUiState","unblu_api_1","unblu_static_api_1","UnbluStaticApi","unblu_util_1","call_state_1","connection_state_1","conversation_type_1","agent_availability_state_1","conversation_state_1","ConversationState","invitation_status_1","createUnbluObject","api_bridge_1","internal_api_1","state","ERROR","handleError","initializeApi","READY","initializedApi","config","configuration","deinitializeEmbeddedIfNeeded","CONFIGURATION_MISSING","setNamedArea","setLocale","injectUnblu","apiBridge","waitUntilLoaded","initTimeout","InternalApi","checkCompatibility","waitUntilInitialized","onDeinitializing","onDeinitialized","STATE","serverUrl","apiKey","unbluUrl","entryPath","loadScript","ERROR_LOADING_UNBLU","UNSUPPORTED_BROWSER","removeNamedArea","meta_module_1","general_lazy_module_1","conversation_module_1","agent_availability_module_1","general_module_1","MetaModule","GeneralModule","GeneralLazyModule","openUi","base_general_module_1"],"mappings":"aACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,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H,OAAOI,KAAKM,gBAAe,iBAAiC,IAGzDV,qBACH,OAAOI,KAAKM,gBAAe,qBAAqC,IAG7DV,oBACH,OAAOI,KAAKM,gBAAe,oBAAoC,IAG5DV,uBACH,OAAOI,KAAKM,gBAAe,uBAAuC,IAG/DV,uBACH,OAAOI,KAAKM,gBAAe,uBAAuC,IAG/DV,mBACH,OAAOI,KAAKM,gBAAe,mBAAmC,IAG3DV,uBACH,OAAOI,KAAKM,gBAAe,uBAAuC,IAG/DV,uBACH,OAAOI,KAAKM,gBAAe,uBAAuC,gHC/D1E,SAAYmO,GAIRA,EAAA,kBAMAA,EAAA,wBAMAA,EAAA,wBAKAA,EAAA,gBAKAA,EAAA,gBAMAA,EAAA,wBAKAA,EAAA,0BAKAA,EAAA,cA1CJ,CAAYlR,EAAAkR,oBAAAlR,EAAAkR,kBAAiB","file":"visitor-js-api.min.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 = 19);\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 //iterate over a copy of the array as otherwise if listeners unregister themself,\r\n //it will change the array and iteration will skip them\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}","// Typedef Helpers\r\n/**\r\n * @hidden\r\n */\r\nimport {ApiState} from \"../api-state\"\r\nimport {UnbluApiFactory} from \"./unblu-api-factory\"\r\nimport {InitializedUnbluApi} from \"./initialized-unblu-api\"\r\nimport {InitializedUnbluElement} from \"./initialized-unblu-element\"\r\n\r\nexport enum IntegrationType {\r\n embedded = 'embedded',\r\n floating = 'floating'\r\n}\r\n\r\nenum EntryPoint {\r\n siteIntegrationGreedyMain = 'SiteIntegrationGreedyMain',\r\n siteIntegrationLazyMain = 'SiteIntegrationLazyMain',\r\n siteEmbeddedMain = 'SiteEmbeddedMain'\r\n}\r\n\r\n/**\r\n * Internal type definition of the unblu object.\r\n */\r\nexport interface UnbluObject {\r\n api?: UnbluApiFactory,\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 * internal unblu field\r\n * @hidden\r\n */\r\n entryPoint?: EntryPoint\r\n}\r\n\r\nclass NamedAreaMetaTag extends Element {\r\n originalContent: string\r\n}\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 existingMetaTag: NamedAreaMetaTag = window.document.querySelector('meta[name=\"unblu:named-area\"]')\r\n if (existingMetaTag && !existingMetaTag.originalContent) {\r\n existingMetaTag.originalContent = existingMetaTag.getAttribute('content')\r\n }\r\n const metaTag = existingMetaTag || 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 removeNamedArea(): void {\r\n const metaTag: NamedAreaMetaTag = window.document.querySelector('meta[name=\"unblu:named-area\"]')\r\n\r\n if (metaTag?.originalContent) {\r\n metaTag.setAttribute('content', metaTag.originalContent)\r\n metaTag.originalContent = null\r\n } else if (metaTag) {\r\n metaTag.remove()\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(integrationType: IntegrationType): boolean {\r\n return UnbluUtil.getUnbluObject() && !!UnbluUtil.getUnbluObject().APIKEY && UnbluUtil.entryPointMatches(integrationType)\r\n }\r\n\r\n private static entryPointMatches(integrationType: IntegrationType): boolean {\r\n if (integrationType === IntegrationType.embedded) {\r\n return UnbluUtil.getUnbluObject().entryPoint === EntryPoint.siteEmbeddedMain\r\n } else if (integrationType === IntegrationType.floating) {\r\n return UnbluUtil.getUnbluObject().entryPoint === EntryPoint.siteIntegrationGreedyMain || UnbluUtil.getUnbluObject().entryPoint === EntryPoint.siteIntegrationLazyMain\r\n } else {\r\n return false\r\n }\r\n }\r\n\r\n static getUnbluObject(): UnbluObject {\r\n return window.unblu as unknown as UnbluObject\r\n }\r\n\r\n static createUnbluObject(): UnbluObject {\r\n return window.unblu = {}\r\n }\r\n\r\n static async deinitializeFloatingIfNeeded() {\r\n if (!UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {\r\n return\r\n }\r\n const apiState = UnbluUtil.getUnbluObject().api.getApiState()\r\n let unbluApi: InitializedUnbluApi\r\n if (apiState == ApiState.INITIALIZING || apiState == ApiState.INITIALIZED) {\r\n unbluApi = await UnbluUtil.getUnbluObject().api.initialize()\r\n await unbluApi.deinitialize()\r\n }\r\n }\r\n\r\n static async deinitializeEmbeddedIfNeeded(excludedAppElement?: InitializedUnbluElement) {\r\n const unbluAppElements = document.getElementsByTagName('unblu-embedded-app')\r\n for (let i = 0; i < unbluAppElements.length; i++) {\r\n const appElement = unbluAppElements[i] as InitializedUnbluElement\r\n if (appElement === excludedAppElement) {\r\n continue\r\n }\r\n console.log(\"Deinitializing existing embedded integration:\", appElement)\r\n await appElement.deinitialize()\r\n }\r\n }\r\n\r\n static sanitizeParameter(param: string): string {\r\n if (!param || !param.trim()) {\r\n return null\r\n }\r\n return param\r\n }\r\n}","import {CallState} from './model/call-state'\r\nimport {Event, EventCallback} from './internal/event'\r\nimport {\r\n ConversationCallState,\r\n ConversationConnectionState,\r\n ConversationEventType,\r\n ConversationInvitations,\r\n ConversationModule,\r\n 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 conversationModule: ConversationModule, 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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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.conversationModule.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}","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, private mountName: string) {\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 const error = this.mountPoint['loadError']\r\n if (error) {\r\n throw new UnbluApiError(error.type, error.detail)\r\n }\r\n this.internal = this.mountPoint[this.mountName]\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 {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 =\r\n 'availableChange'\r\n | '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}","import {ApiBridge} from \"../api-bridge\"\r\nimport {InternalModule} from \"./module\"\r\nimport {NewConversationInterceptor} from \"../../new-conversation-interceptor\"\r\nimport {ConversationType} from \"../../model/conversation-type\"\r\nimport {PersonInfo} from \"../../model/person-info\"\r\nimport {ConversationInfo} from \"../../model/conversation-info\"\r\n\r\nexport type BaseGeneralEventType =\r\n 'activeConversationChange' |\r\n 'conversationsChange' |\r\n 'notificationCountChange' |\r\n 'personChange'\r\n\r\nexport enum BaseGeneralFunction {\r\n startConversation = 'startConversation',\r\n setNewConversationInterceptor = 'setNewConversationInterceptor',\r\n joinConversation = 'joinConversation',\r\n openConversation = 'openConversation',\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 BaseGeneralModule 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(BaseGeneralFunction.startConversation, [type, visitorName, visitorData])\r\n }\r\n\r\n public setNewConversationInterceptor(callback: NewConversationInterceptor): Promise {\r\n return this.callApiFunction(BaseGeneralFunction.setNewConversationInterceptor, [callback])\r\n }\r\n\r\n public joinConversation(pin: string, visitorName?: string): Promise {\r\n return this.callApiFunction(BaseGeneralFunction.joinConversation, [pin, visitorName])\r\n }\r\n\r\n public openConversation(conversationId: string): Promise {\r\n return this.callApiFunction(BaseGeneralFunction.openConversation, [conversationId])\r\n }\r\n\r\n public getActiveConversation(): Promise {\r\n return this.callApiFunction(BaseGeneralFunction.getActiveConversation, [])\r\n }\r\n\r\n public getConversations(): Promise {\r\n return this.callApiFunction(BaseGeneralFunction.getConversations, [])\r\n }\r\n\r\n public getNotificationCount(): Promise {\r\n return this.callApiFunction(BaseGeneralFunction.getNotificationCount, [])\r\n }\r\n\r\n public getPersonInfo(): Promise {\r\n return this.callApiFunction(BaseGeneralFunction.getPersonInfo, [])\r\n }\r\n\r\n public setPersonNickname(nickname: string): Promise {\r\n return this.callApiFunction(BaseGeneralFunction.setPersonNickname, [nickname])\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\t * There is at least one agent available for the specified named area and locale.\r\n\t */\r\n AVAILABLE = 'AVAILABLE',\r\n\t/**\r\n\t * There is at least one agent watching the inbound queue for the specified named area and locale but the max capacity of parallel conversations is reached.\r\n\t *\r\n\t * It is very likely, that an agent will be available in a short time.\r\n\t */\r\n BUSY = 'BUSY',\r\n /**\r\n\t * There is currently no agent handling any inbound queue items.\r\n\t *\r\n\t * It is very unlikely, that an agent will be available in a short time.\r\n\t */\r\n UNAVAILABLE = 'UNAVAILABLE'\r\n}","export enum InvitationStatus {\r\n /**\r\n * Invitation is open however it may have expired.\r\n */\r\n OPEN = 'OPEN',\r\n /**\r\n * Invitation is redeemed.\r\n */\r\n REDEEMED = 'REDEEMED',\r\n /**\r\n * Invitation is revoked.\r\n */\r\n REVOKED = 'REVOKED'\r\n}","import {InternalApi} from './internal/internal-api'\r\nimport {Conversation} from './shared/conversation'\r\nimport {PersonInfo} from './shared/model/person-info'\r\nimport {Event, EventCallback} from './shared/internal/event'\r\nimport {EventEmitter, Listener} from './shared/internal/util/event-emitter'\r\nimport {ConversationType} from './shared/model/conversation-type'\r\nimport {AgentAvailabilityState} from './shared/model/agent-availability-state'\r\nimport {AgentAvailabilityEventType} from './shared/internal/module/agent-availability-module'\r\nimport {InternalModule} from './shared/internal/module/module'\r\nimport {UnbluApiError, UnbluErrorType} from './shared/unblu-api-error'\r\nimport {UnbluUiApi} from './unblu-api-ui'\r\nimport {MetaEventType} from \"./internal/module/meta-module\"\r\nimport {ConversationInfo} from \"./shared/model/conversation-info\"\r\nimport {NewConversationInterceptor} from \"./shared/new-conversation-interceptor\"\r\nimport {GeneralEventType} from \"./internal/module/general-module\"\r\nimport {InitializedUnbluApi} from \"./shared/internal/initialized-unblu-api\"\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 isAvailable A boolean that indicates if an agent is available.\r\n */\r\nexport type AgentAvailableChangeListener = (isAvailable: boolean) => void\r\n/**\r\n * Listener called whenever the agent availability state changes.\r\n * @param availability The new availability state.\r\n */\r\nexport type AgentAvailabilityChangeListener = (availability: AgentAvailabilityState) => void\r\n/**\r\n * Listener called whenever the UnbluApi gets de-initialized.\r\n */\r\nexport type DeinitializationListener = () => void\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 implements InitializedUnbluApi {\r\n\r\n /**\r\n * Event emitted every time the active conversation changes.\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 one of the conversations accessible to the current user changes or one is 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 availableChange\r\n * @see [[on]] for listener registration\r\n * @see [[AgentAvailableChangeListener]]\r\n */\r\n public static readonly AGENT_AVAILABLE_CHANGE: 'availableChange' = 'availableChange'\r\n\r\n /**\r\n * Event emitted every time the agent availability state 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 * Event emitted when this instance gets de-initialized and is not usable at the time until it fully got de-initialized.\r\n *\r\n * @event deinitializing\r\n * @see [[on]] for listener registration\r\n * @see [[DeinitializationListener]]\r\n */\r\n public static readonly DEINITIALIZING: 'deinitializing' = 'deinitializing'\r\n\r\n /**\r\n * Event emitted when this instance got de-initialized and has to be initialized again.\r\n *\r\n * @event deinitialized\r\n * @see [[on]] for listener registration\r\n * @see [[DeinitializationListener]]\r\n */\r\n public static readonly DEINITIALIZED: 'deinitialized' = 'deinitialized'\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 agentAvailableChange event.\r\n * @param listener The listener to be called.\r\n * @see [[AGENT_AVAILABLE_CHANGE]]\r\n */\r\n public on(event: typeof UnbluApi.AGENT_AVAILABLE_CHANGE, listener: AgentAvailableChangeListener): void\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The agentAvailabilityChange event.\r\n * @param listener The listener to be called.\r\n * @see [[AGENT_AVAILABILITY_CHANGE]]\r\n */\r\n public on(event: typeof UnbluApi.AGENT_AVAILABILITY_CHANGE, listener: AgentAvailabilityChangeListener): void\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The deinitializing event.\r\n * @param listener The listener to be called.\r\n * @see [[DEINITIALIZED]]\r\n */\r\n public on(event: typeof UnbluApi.DEINITIALIZING, listener: DeinitializationListener): void\r\n /**\r\n * Registers an event listener for the given event.\r\n * @param event The deinitialized event.\r\n * @param listener The listener to be called.\r\n * @see [[DEINITIALIZED]]\r\n */\r\n public on(event: typeof UnbluApi.DEINITIALIZED, listener: DeinitializationListener): void\r\n\r\n public on(event: GeneralEventType | AgentAvailabilityEventType | MetaEventType, listener: Listener): void {\r\n this.assertNotDeinitialized()\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 | MetaEventType, listener: Listener): boolean {\r\n this.assertNotDeinitialized()\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 | MetaEventType) {\r\n let internalListener: EventCallback\r\n let internalModule: InternalModule\r\n let needsUpgrade: boolean\r\n switch (eventName) {\r\n case UnbluApi.AGENT_AVAILABLE_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.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.conversation, 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 case UnbluApi.DEINITIALIZING:\r\n case UnbluApi.DEINITIALIZED:\r\n internalListener = (event: Event) => {\r\n this.eventEmitter.emit(event.name, event.data)\r\n }\r\n internalModule = this.internalApi.meta\r\n needsUpgrade = false\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 | MetaEventType) {\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 case UnbluApi.DEINITIALIZING:\r\n case UnbluApi.DEINITIALIZED:\r\n internalModule = this.internalApi.meta\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 this.assertNotDeinitialized()\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 this.assertNotDeinitialized()\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 this.assertNotDeinitialized()\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 * Starting a new conversation involves an agent availability check.\r\n * For [[ConversationType.OFFLINE_CHAT_REQUEST]] conversations, the check proceeds as follows:\r\n * * If an agent is available, the conversation type will be changed to [[ConversationType.CHAT_REQUEST]].\r\n * * If no agents are available, it will start an offline conversation provided offline chat requests are enabled in the Unblu server's configuration.\r\n * * if offline chat requests aren't enabled, the request will be rejected.\r\n *\r\n * For all `online` conversation types, the check works as follows:\r\n * * If an agent is available, the conversation will be started.\r\n * * If no agents are available, the request will be rejected.\r\n *\r\n * You should therefore always check agent availability before starting a new conversation.\r\n * If no agents are available, only start conversations of the type [[ConversationType.OFFLINE_CHAT_REQUEST]].\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 this.assertNotDeinitialized()\r\n await this.requireUpgrade()\r\n const conversationId = await this.internalApi.general.startConversation(type, visitorName, visitorData)\r\n return new Conversation(this.internalApi.conversation, 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 this.assertNotDeinitialized()\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 this.assertNotDeinitialized()\r\n await this.requireUpgrade()\r\n const conversationId = await this.internalApi.general.joinConversation(pin, visitorName)\r\n return new Conversation(this.internalApi.conversation, 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 this.assertNotDeinitialized()\r\n await this.requireUpgrade()\r\n await this.internalApi.general.openConversation(conversationId)\r\n return new Conversation(this.internalApi.conversation, 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 this.assertNotDeinitialized()\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.conversation, 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 this.assertNotDeinitialized()\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 this.assertNotDeinitialized()\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 private assertNotDeinitialized() {\r\n if (this.isDeinitialized()) {\r\n throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Error: trying to execute method on deinitialized UnbluApi instance.')\r\n }\r\n }\r\n\r\n public isDeinitialized(): Boolean {\r\n return this.internalApi == null\r\n }\r\n\r\n /**\r\n * De-initializes the API. It will destroy the UI, all connections and will release all resources (as far as it is technically possible).\r\n *\r\n * Afterwards the API can be initialized again via [window.unblu.api.initialize()]{@link UnbluStaticApi.initialize}\r\n */\r\n public async deinitialize(): Promise {\r\n if (this.isDeinitialized()) {\r\n return\r\n }\r\n await this.internalApi.meta.deinitialize()\r\n this.internalApi = null\r\n this.ui = null\r\n this.internalListeners = null\r\n this.eventEmitter = null\r\n }\r\n\r\n}","import {InternalApi} from './internal/internal-api'\r\nimport {Event, EventCallback} from './shared/internal/event'\r\nimport {EventEmitter, Listener} from './shared/internal/util/event-emitter'\r\nimport {UnbluApiError, UnbluErrorType} from './shared/unblu-api-error'\r\nimport {IndividualUiState} from './model/individualui_state'\r\nimport {GeneralEventType} from \"./internal/module/general-module\"\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 * Navigates the individual UI to the overview UI.\r\n *\r\n *

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

\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 openOverviewUi(): Promise {\r\n console.log(\"openOverviewUi called\");\r\n await this.requireUpgrade();\r\n await this.internalApi.general.openOverviewUi();\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}\r\n","import {\r\n AgentAvailabilityChangeListener,\r\n AgentAvailableChangeListener,\r\n ConversationChangeListener,\r\n ConversationsChangeListener,\r\n NotificationCountChangeListener,\r\n PersonChangeListener,\r\n UnbluApi\r\n} from './unblu-api'\r\nimport {\r\n CallStateListener,\r\n ConnectionStateListener,\r\n Conversation,\r\n ConversationStateListener,\r\n InvitationsListener\r\n} from './shared/conversation'\r\nimport {NewConversationInterceptor} from \"./shared/new-conversation-interceptor\"\r\nimport {ApiState} from \"./shared/api-state\"\r\nimport {Configuration, ErrorListener, ReadyListener, UnbluStaticApi} from './unblu-static-api'\r\nimport {UnbluUtil} from './shared/internal/unblu-util'\r\nimport {CallState} from './shared/model/call-state'\r\nimport {ConnectionState} from './shared/model/connection-state'\r\nimport {ConversationType} from './shared/model/conversation-type'\r\nimport {AgentAvailabilityState} from './shared/model/agent-availability-state'\r\nimport {ConversationState} from './shared/model/conversation-state'\r\nimport {UnbluApiError, UnbluErrorType} from './shared/unblu-api-error'\r\nimport {IndividualUiState} from \"./model/individualui_state\"\r\nimport {InvitationStatus} from \"./shared/model/invitation-status\"\r\nimport {UiStateChangeListener, UnbluUiApi} from \"./unblu-api-ui\"\r\nimport {ConversationInfo} from \"./shared/model/conversation-info\"\r\nimport {Invitation} from \"./shared/model/invitation\"\r\nimport {PersonInfo} from \"./shared/model/person-info\"\r\n\r\nexport {AgentAvailabilityState}\r\nexport {ApiState, UnbluStaticApi, Configuration, ErrorListener, ReadyListener}\r\nexport {CallState}\r\nexport {ConnectionState}\r\nexport {ConversationState}\r\nexport {ConversationType}\r\nexport {IndividualUiState}\r\nexport {InvitationStatus}\r\nexport {UnbluErrorType}\r\nexport {Conversation, CallStateListener, ConnectionStateListener, ConversationStateListener, InvitationsListener}\r\nexport {\r\n UnbluApi,\r\n AgentAvailableChangeListener,\r\n AgentAvailabilityChangeListener,\r\n ConversationChangeListener,\r\n ConversationsChangeListener,\r\n NewConversationInterceptor,\r\n NotificationCountChangeListener,\r\n PersonChangeListener\r\n}\r\nexport {UnbluApiError}\r\nexport {UnbluUiApi, UiStateChangeListener}\r\nexport {ConversationInfo}\r\nexport {Invitation}\r\nexport {PersonInfo}\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\nexport const 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\ndeclare global {\r\n interface Window {\r\n unblu: Unblu\r\n }\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 * @noInheritDoc\r\n */\r\n//this is only for documentation as typedoc does not support global objects any more\r\nexport declare interface Globals extends Window {\r\n /**\r\n * The main unblu namespace\r\n */\r\n unblu: Unblu\r\n}\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 './shared/internal/util/event-emitter';\r\nimport {IntegrationType, UnbluUtil} from './shared/internal/unblu-util';\r\nimport {UnbluApiError, UnbluErrorType} from './shared/unblu-api-error';\r\nimport {ApiBridge} from './shared/internal/api-bridge';\r\nimport {InternalApi} from './internal/internal-api';\r\nimport {ApiState} from \"./shared/api-state\";\r\nimport {InitializedUnbluElement} from \"./shared/internal/initialized-unblu-element\";\r\nimport {UnbluApiFactory} from \"./shared/internal/unblu-api-factory\";\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 type ReadyListener = (api: UnbluApi) => void;\r\nexport type ErrorListener = (e: Error) => void;\r\nexport type DeinitializingListener = () => void;\r\nexport type DeinitializedListener = () => void;\r\nexport type StateListener = (state: ApiState) => 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 implements UnbluApiFactory{\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 * Note: that this event will be triggered again after each initialization.\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 /**\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 * Event emitted as soon as the API is going to get de-initialized.\r\n *\r\n * It usually makes sense to use this event to clean up resources and/or unregistering of listeners to no try to use the API again until it is initialized again.\r\n *\r\n * @event deinitializing\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly DEINITIALIZING: 'deinitializing' = 'deinitializing';\r\n\r\n /**\r\n * Event emitted as soon as the API is completely de-initialized.\r\n *\r\n * It usually makes sense to use this event to clean up resources and/or unregistering of listeners to no try to use the API again until it is initialized again.\r\n *\r\n * @event deinitialized\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly DEINITIALIZED: 'deinitialized' = 'deinitialized';\r\n\r\n /**\r\n * Event emitted whenever the API state changes\r\n *\r\n * @event state\r\n * @see [[on]] for listener registration\r\n */\r\n public static readonly STATE: 'state' = 'state';\r\n\r\n /**\r\n * @hidden\r\n */\r\n constructor() {\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(IntegrationType.floating)) {\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 /**\r\n * Registers an event listener for the given event.\r\n *\r\n * **Note** If the API is already deinitializing, this listener will be called directly.\r\n * @param event The deinitializing event\r\n * @param listener The listener to be called.\r\n * @see [[DEINITIALIZING]]\r\n */\r\n on(event: typeof UnbluStaticApi.DEINITIALIZING, listener: DeinitializingListener): void;\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n *\r\n * **Note** If the API is already deinitialized, this listener will be called directly.\r\n * @param event The deinitialized event\r\n * @param listener The listener to be called.\r\n * @see [[DEINITIALIZED]]\r\n */\r\n on(event: typeof UnbluStaticApi.DEINITIALIZED, listener: DeinitializedListener): void;\r\n\r\n /**\r\n * Registers an event listener for the given event.\r\n *\r\n * @param event The state event\r\n * @param listener The listener to be called.\r\n * @see [[STATE]]\r\n */\r\n on(event: typeof UnbluStaticApi.STATE, listener: StateListener): 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 if (event == UnbluStaticApi.DEINITIALIZING && this.state == ApiState.DEINITIALIZING)\r\n listener();\r\n else if (event == UnbluStaticApi.DEINITIALIZED && this.state == ApiState.DEINITIALIZED)\r\n listener();\r\n\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 * 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 * - If the API state is in [DEINITIALIZED]{@link ApiState.DEINITIALIZED}\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 || this.state === ApiState.DEINITIALIZED) && !UnbluUtil.isUnbluLoaded(IntegrationType.floating);\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(IntegrationType.floating)) {\r\n throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Configure called when Unblu was already loaded.')\r\n } else if (this.state !== ApiState.INITIAL && this.state !== ApiState.DEINITIALIZED) {\r\n throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Error configure called after API was already initialized or is not fully deinitialized yet.');\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 if(this.state === ApiState.DEINITIALIZING) {\r\n return Promise.reject('Cannot initialize while de-initializing is ongoing! Please wait for the deinitialized event')\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 await UnbluUtil.deinitializeEmbeddedIfNeeded();\r\n try {\r\n if (!UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {\r\n if (!this.configuration) {\r\n // noinspection ExceptionCaughtLocallyJS\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 UnbluStaticApi.injectUnblu(this.configuration);\r\n }\r\n let apiBridge = new ApiBridge(UnbluUtil.getUnbluObject(), 'internal');\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.initializedApi.on(UnbluApi.DEINITIALIZING, () => this.onDeinitializing());\r\n this.initializedApi.on(UnbluApi.DEINITIALIZED, () => this.onDeinitialized());\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 this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);\r\n\r\n return this.initializedApi;\r\n }\r\n\r\n private static 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 this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);\r\n if (UnbluErrorType.UNSUPPORTED_BROWSER != error.type) { \r\n \tconsole.error(error);\r\n }\r\n throw error;\r\n }\r\n\r\n private onDeinitializing() {\r\n this.initializedApi = null;\r\n this.state = ApiState.DEINITIALIZING;\r\n this.eventEmitter.emit(UnbluStaticApi.DEINITIALIZING);\r\n this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);\r\n }\r\n\r\n private onDeinitialized() {\r\n this.state = ApiState.DEINITIALIZED;\r\n this.eventEmitter.emit(UnbluStaticApi.DEINITIALIZED);\r\n this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);\r\n if (this.configuration.namedArea) {\r\n UnbluUtil.removeNamedArea()\r\n }\r\n }\r\n}","import {ApiBridge} from '../shared/internal/api-bridge';\r\nimport {MetaModule} from './module/meta-module';\r\nimport {GeneralLazyModule} from './module/general-lazy-module';\r\nimport {ConversationModule} from '../shared/internal/module/conversation-module';\r\nimport {AgentAvailabilityModule} from '../shared/internal/module/agent-availability-module';\r\nimport {GeneralModule} from \"./module/general-module\";\r\n\r\nexport class InternalApi {\r\n public readonly meta: MetaModule;\r\n public readonly general: GeneralModule;\r\n public readonly generalLazy: GeneralLazyModule;\r\n public readonly conversation: ConversationModule;\r\n public readonly agentAvailability: AgentAvailabilityModule;\r\n\r\n constructor(private readonly 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 '../../shared/internal/module/module'\r\nimport {ApiBridge} from '../../shared/internal/api-bridge'\r\n\r\nexport type MetaEventType =\r\n 'upgraded' |\r\n 'deinitializing' |\r\n 'deinitialized'\r\n\r\n\r\nconst enum MetaFunction {\r\n isUpgraded = 'isUpgraded',\r\n upgrade = 'upgrade',\r\n waitUntilInitialized = 'waitUntilInitialized',\r\n deinitialize = 'deinitialize'\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\r\n public deinitialize(): Promise {\r\n return this.callApiFunction(MetaFunction.deinitialize, [])\r\n }\r\n}","import {InternalModule} from '../../shared/internal/module/module';\r\nimport {ApiBridge} from '../../shared/internal/api-bridge';\r\nimport {PersonInfo} from '../../shared/model/person-info';\r\nimport {NewConversationInterceptor} from \"../../shared/new-conversation-interceptor\";\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 {IndividualUiState} from \"../../model/individualui_state\";\r\nimport {\r\n BaseGeneralEventType,\r\n BaseGeneralFunction,\r\n BaseGeneralModule\r\n} from \"../../shared/internal/module/base-general-module\";\r\n\r\nexport type GeneralEventType =\r\n BaseGeneralEventType |\r\n 'uiStateChange';\r\n\r\nconst enum GeneralFunction {\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 openOverviewUi = 'openOverviewUi',\r\n collapseIndividualUi = 'collapseIndividualUi',\r\n getIndividualUiState = 'getIndividualUiState'\r\n}\r\n\r\nexport class GeneralModule extends BaseGeneralModule {\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 openOverviewUi(): Promise {\r\n return this.callApiFunction(GeneralFunction.openOverviewUi, []);\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","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":""}