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,IAAJ5b,EAAI4b,EAAA,GAAA5d,UAAA4d,GAAA,MAAK,CAAC,MAADjY,OAAO4F,GAAG,UAAA5F,OAAcwW,EAAW,2BAA2Bna,EAAK,EACjG6b,QAAS,SAACtS,GAAG,QAAAuS,EAAA9d,UAAAmC,OAAKH,EAAI,IAAAnD,MAAAif,EAAA,EAAAA,EAAA,KAAAC,EAAA,EAAAA,EAAAD,EAAAC,IAAJ/b,EAAI+b,EAAA,GAAA/d,UAAA+d,GAAA,MAAK,CAAC,MAADpY,OAAO4F,GAAG,UAAA5F,OAAcwW,EAAY,2BAA2Bna,EAAK,GAGpF3I,EAAMrE,EAAAA,GAAS2nB,EAASF,EAExBrL,EAAmB,SAAChY,GAC/B,MAAM,SAAEuQ,EAAQ,QAAEmB,GAAY1R,EAE1BuQ,GAEFtQ,EAAI2d,KAAK,qCACT3d,EAAID,MAAM,GAADuM,OAAIgE,EAASqU,WAAU,KAAArY,OAAIgE,EAAS2N,SAC7Cje,EAAID,MAAM,UAAWuQ,EAAShU,MAC9B0D,EAAID,MAAM,SAAUuQ,EAASqB,QAC7B3R,EAAID,MAAM,UAAWuQ,EAASoC,UAEvBjB,GAEPzR,EAAI2d,KAAK,qDACT3d,EAAID,MAAM,UAAW0R,IAKrBzR,EAAID,MAAMA,EAOd,C","sources":["webpack:///./Onlia/Scripts/onlia/chatbot/components/chatbot-button.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chatbot-dialog.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/FeatureDetect.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chat-container.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chatbot-header.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chatbot-input-field.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/AnimationQueue.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/ChatbotTransitionsHandler.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chat-answer.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/CxMarkdownToHtml.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chat-message-loader.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chat-feedback.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chat-question.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/api.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/digital-cx-helper.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/ChatbotAPIUtils.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/ChatbotAPIController.js","webpack:///./Onlia/Scripts/onlia/chatbot/mixins/user-personalization.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/chatbot.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/ZendeskWidget.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/zendesk-widget-settings.js","webpack:///./Onlia/Scripts/onlia/chatbot/components/zendesk-live-chat.js","webpack:///./Onlia/Scripts/onlia/chatbot/index.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/ChatbotSession.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/TransferSessionStorage.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/ZendeskSession.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/event-names.js","webpack:///./Onlia/Scripts/onlia/chatbot/utils/logging.js"],"sourcesContent":["export default {\r\n name: 'chatbot-button',\r\n // functional: true,\r\n template: `\r\n <onlia-button tag=\"button\" variant=\"none\" class=\"a-chatbotButton\" aria-label=\"chatbotButton\" @click.stop=\"$emit('click')\">\r\n <span class=\"icon-chatbot\"></span>\r\n </onlia-button>\r\n `\r\n};\r\n","export default {\r\n name: 'chatbot-dialog',\r\n props: {\r\n dialogTitle: {\r\n type: String\r\n },\r\n dialogText: {\r\n type: String\r\n },\r\n },\r\n\r\n methods: {\r\n close() {\r\n this.$eventBus.$emit('dialog-close');\r\n }\r\n },\r\n template: ` \r\n <transition name=\"dialog\" appear>\r\n <div class=\"a-chatbotDialog\">\r\n \r\n <div class=\"a-chatbotDialog__Container\"> \r\n <div class=\"a-chatbotDialog__leftContainer\"> \r\n <h3 class=\"a-chatbotDialog__title\">{{dialogTitle}}</h3>\r\n </div>\r\n\r\n <div class=\"a-chatbotDialog__rightContainer\" @click.stop=\"\">\r\n <onlia-button class=\"a-chatbotDialog__closeButton\" tag=\"button\" variant=\"none\" @click=\"close\" aria-label=\"close\">\r\n <span class=\"icon-close\"></span>\r\n </onlia-button> \r\n </div>\r\n </div>\r\n\r\n <div class=\"a-chatbotDialog__textContainer\">\r\n <p class=\"a-chatbotDialog__text\">{{dialogText}}</p>\r\n </div>\r\n </div>\r\n </transition>\r\n `\r\n}","import { IS_DEV } from '@Shared/settings';\r\n\r\nconst checkPassiveSupport = () => {\r\n let supportsPassive = false;\r\n \r\n try {\r\n const opts = Object.defineProperty({}, 'passive', {\r\n // eslint-disable-next-line getter-return\r\n get() {\r\n supportsPassive = true;\r\n }\r\n });\r\n \r\n window.addEventListener('testPassive', null, opts);\r\n window.removeEventListener('testPassive', null, opts);\r\n }\r\n catch (e) {\r\n (IS_DEV && console.error(e));\r\n }\r\n finally {\r\n // eslint-disable-next-line no-unsafe-finally\r\n return supportsPassive;\r\n }\r\n};\r\n\r\nexport default class FeatureDetect {\r\n static set isPassiveSupported(val) {\r\n this._isPassiveSupported = val;\r\n }\r\n static get isPassiveSupported() {\r\n if (typeof this._isPassiveSupported === 'undefined') {\r\n this.isPassiveSupported = checkPassiveSupport();\r\n }\r\n return this._isPassiveSupported;\r\n }\r\n}\r\n","import _throttle from 'lodash/throttle';\r\nimport slotUtils from '@Shared/mixins/slot-utils';\r\nimport { wait } from '@Shared/utils/basic-functions';\r\nimport { log } from '../utils/logging';\r\nimport { CHATBOT_EVENTS, ZENDESK_EVENTS } from '../utils/event-names';\r\nimport ChatbotButton from './chatbot-button';\r\nimport ChatbotDialog from './chatbot-dialog';\r\nimport FeatureDetect from '../utils/FeatureDetect';\r\nimport { ChatbotSession } from '../utils/ChatbotSession';\r\nimport { TransferSessionStorage, TRANSFER_EVENTS } from \"../utils/TransferSessionStorage\";\r\n\r\nconst ACTIVE_CHAT_TYPES = {\r\n chatbot: 'chatbot',\r\n zendeskLiveChat: 'zendesk',\r\n chatbotDialog:'chatbot-dialog'\r\n};\r\n\r\nconst INTERACTION_EVENTS = ['touchstart', 'click'];\r\n\r\nexport default {\r\n name: 'chat-container',\r\n props: {\r\n timeoutDuration: {\r\n type: Number,\r\n default: null\r\n },\r\n dialogTitle: {\r\n type: String,\r\n default: \"Hi!\"\r\n },\r\n dialogText: {\r\n type: String,\r\n default: \"If you have any questions, I am here for you\"\r\n }\r\n },\r\n mixins: [slotUtils],\r\n components: {\r\n ChatbotButton, \r\n ChatbotDialog\r\n },\r\n data() {\r\n return {\r\n // Types<chatbot|zendesk|''>\r\n activeChatType: '',\r\n hasActivatedChatbot: false\r\n };\r\n },\r\n computed: {\r\n isChatbotActive() {\r\n return this.activeChatType === ACTIVE_CHAT_TYPES.chatbot;\r\n },\r\n isChatbotDialogActive() {\r\n return this.activeChatType === ACTIVE_CHAT_TYPES.chatbotDialog;\r\n },\r\n isZendeskActive() {\r\n return this.activeChatType === ACTIVE_CHAT_TYPES.zendeskLiveChat;\r\n },\r\n isProactiveChatbotEnabled() {\r\n return typeof this.timeoutDuration === 'number';\r\n },\r\n isPhone() {\r\n return this.$store.getters.breakpointPhone;\r\n }\r\n },\r\n watch: {\r\n isPhone(newValue) {\r\n (newValue ? this.handlePageScrollLock() : this.handlePageScrollUnlock());\r\n },\r\n },\r\n beforeCreate() {\r\n import(/* webpackChunkName: 'styles.chatbot' */ '@Styles/chatbot');\r\n },\r\n created() {\r\n TransferSessionStorage.init();\r\n this._timeout = null;\r\n this._mutationObserver = null;\r\n this._throttledInteractionHandler = _throttle(\r\n this.handleInteraction,\r\n this.isProactiveChatbotEnabled ?\r\n this.timeoutDuration * 0.1 :\r\n 100,\r\n { trailing: true }\r\n );\r\n\r\n this._domEventListenerOptions = FeatureDetect.isPassiveSupported ? { passive: true } : false;\r\n\r\n this.addChatbotEventListeners();\r\n this.addZendeskEventListeners();\r\n this.addChatbotDialogEventListeners();\r\n\r\n TransferSessionStorage.liveChatOpened().then(tabId => {\r\n TransferSessionStorage.triggerEvent(TRANSFER_EVENTS.transferLiveChat, { id: tabId });\r\n TransferSessionStorage.on(TRANSFER_EVENTS.openLiveChat, () => {\r\n this.$eventBus.$emit(CHATBOT_EVENTS.openLiveChat);\r\n })\r\n })\r\n\r\n \r\n this.$eventBus.$on('chatBot:search', async (keyword) => {\r\n this.$eventBus.$emit('chatBot:loading', true);\r\n if (!this.hasActivatedChatbot) {\r\n this.activateChatbot();\r\n await wait(3500);\r\n } else {\r\n this.handleChatbotOpen();\r\n await wait(1000);\r\n }\r\n this.$nextTick(async ()=> {\r\n this.$eventBus.$emit('chatBot:searchInput', keyword);\r\n await wait(100);\r\n this.$eventBus.$emit('chatBot:loading', false);\r\n }) \r\n });\r\n },\r\n mounted() {\r\n try {\r\n if (ChatbotSession.isOpenEmpty) {\r\n TransferSessionStorage.transferAll().then(() => {\r\n if (ChatbotSession.isOpenFromStore) {\r\n this.activateChatbot();\r\n return;\r\n }\r\n\r\n if (ChatbotSession.prototype.hasOpened) {\r\n this.$eventBus.$emit(CHATBOT_EVENTS.openLiveChat);\r\n }\r\n })\r\n }\r\n \r\n this.initContainer();\r\n this.checkCustomLoaderFinishedLoading();\r\n }\r\n catch (error) {\r\n log.error('mounted error:', error);\r\n }\r\n },\r\n beforeDestroy() {\r\n TransferSessionStorage.destroy();\r\n this.removeChatbotEventListeners();\r\n this.removeZendeskEventListeners();\r\n this.removeChatbotDialogEventListeners();\r\n this.destroyMutationObserver();\r\n this.removeInteractionEvents();\r\n \r\n this.$eventBus.$off('chatBot:search');\r\n this.clearTimeout();\r\n },\r\n methods: {\r\n //Start Proactive chatbot timeout when custom loader has finished loading\r\n checkCustomLoaderFinishedLoading() {\r\n const interval = setInterval(() => {\r\n const customLoader = document.querySelector('.loader-style');\r\n if (!this.activeChatType && customLoader && customLoader.style.display === 'none') {\r\n clearInterval(interval); // Stop checking\r\n this.startTimeout();\r\n }\r\n }, 100);\r\n },\r\n initContainer() {\r\n document.body.appendChild(this.$el);\r\n\r\n if (this.isProactiveChatbotEnabled) {\r\n this.addInteractionEvents();\r\n }\r\n\r\n TransferSessionStorage.on(TRANSFER_EVENTS.openOther, () => {\r\n this.activateChatbot();\r\n })\r\n // TransferSessionStorage.on(TRANSFER_EVENTS.openOtherDialog, () => {\r\n // this.activateChatbotDialog();\r\n // })\r\n\r\n if (ChatbotSession.isOpen) {\r\n this.activateChatbot();\r\n return;\r\n }\r\n\r\n this.$nextTick(this.createMutationObserver());\r\n },\r\n\r\n addChatbotEventListeners() {\r\n this.$eventBus.$on(CHATBOT_EVENTS.open, this.handleChatbotOpen);\r\n this.$eventBus.$on(CHATBOT_EVENTS.close, this.handleChatbotCloseWithTabEvent);\r\n },\r\n removeChatbotEventListeners() {\r\n this.$eventBus.$off(CHATBOT_EVENTS.open, this.handleChatbotOpen);\r\n this.$eventBus.$off(CHATBOT_EVENTS.close, this.handleChatbotCloseWithTabEvent);\r\n },\r\n\r\n addChatbotDialogEventListeners() {\r\n this.$eventBus.$on('dialog-close', this.handleChatbotDialogCloseWithTabEvent);\r\n },\r\n removeChatbotDialogEventListeners() {\r\n this.$eventBus.$off('dialog-close', this.handleChatbotDialogCloseWithTabEvent);\r\n },\r\n\r\n addInteractionEvents() {\r\n INTERACTION_EVENTS.map((event) => {\r\n document.addEventListener(event, this._throttledInteractionHandler, this._domEventListenerOptions);\r\n });\r\n },\r\n removeInteractionEvents() {\r\n INTERACTION_EVENTS.map((event) => {\r\n document.removeEventListener(event, this._throttledInteractionHandler, this._domEventListenerOptions);\r\n });\r\n },\r\n startTimeout() {\r\n this.clearTimeout();\r\n\r\n if (this.isProactiveChatbotEnabled) {\r\n this._timeout = setTimeout(this.handleTimeoutCompleted, this.timeoutDuration);\r\n }\r\n },\r\n clearTimeout() {\r\n if (this._timeout) {\r\n clearTimeout(this._timeout);\r\n this._timeout = null;\r\n }\r\n },\r\n handleInteraction() {\r\n if (this.activeChatType) return;\r\n\r\n this.startTimeout();\r\n },\r\n handleTimeoutCompleted() {\r\n this.clearTimeout();\r\n this.activateChatbotDialog();\r\n },\r\n\r\n createMutationObserver() {\r\n const chatContainer = document.querySelector(\".o-chatContainer\");\r\n this._mutationObserver = new MutationObserver(this.handlePageScrollLock);\r\n\r\n this._mutationObserver.observe(chatContainer, {\r\n attributes: true,\r\n childList: true,\r\n subtree: true\r\n })\r\n },\r\n destroyMutationObserver() {\r\n if (this._mutationObserver) {\r\n this._mutationObserver.disconnect();\r\n this._mutationObserver = null;\r\n }\r\n },\r\n handlePageScrollLock() {\r\n if (this.isPhone) {\r\n if (this.activeChatType !== \"\" && this.activeChatType !== \"chatbot-dialog\") {\r\n document.body.classList.add('-noScroll');\r\n } else {\r\n document.body.classList.remove('-noScroll');\r\n }\r\n } else {\r\n document.body.classList.remove('-noScroll');\r\n }\r\n },\r\n handlePageScrollUnlock() {\r\n document.body.classList.remove('-noScroll');\r\n },\r\n\r\n handleChatbotOpen() {\r\n this.activeChatType = ACTIVE_CHAT_TYPES.chatbot;\r\n ChatbotSession.isOpen = true;\r\n this.clearTimeout();\r\n\r\n TransferSessionStorage.on(TRANSFER_EVENTS.closeOther, () => this.handleChatbotClose());\r\n },\r\n handleChatbotDialogOpen() {\r\n this.activeChatType = ACTIVE_CHAT_TYPES.chatbotDialog;\r\n this.clearTimeout();\r\n this.handlePageScrollUnlock();\r\n \r\n TransferSessionStorage.on(TRANSFER_EVENTS.closeOtherDialog, () => this.handleChatbotDialogClose());\r\n },\r\n handleChatbotDialogClose() {\r\n this.activeChatType = '';\r\n },\r\n handleChatbotDialogCloseWithTabEvent() {\r\n this.handleChatbotDialogClose()\r\n TransferSessionStorage.triggerEvent(TRANSFER_EVENTS.closeOtherDialog);\r\n },\r\n handleChatbotCloseWithTabEvent() {\r\n this.handleChatbotClose();\r\n TransferSessionStorage.triggerEvent(TRANSFER_EVENTS.closeOther);\r\n },\r\n handleChatbotClose() {\r\n this.activeChatType = '';\r\n ChatbotSession.isOpen = false;\r\n },\r\n activateChatbot() {\r\n this.hasActivatedChatbot = true;\r\n\r\n if (ChatbotSession.prototype.hasActivated) {\r\n this.$eventBus.$emit(CHATBOT_EVENTS.openLiveChat);\r\n } else {\r\n this.handleChatbotOpen();\r\n }\r\n },\r\n activateChatbotDialog() {\r\n this.handleChatbotDialogOpen();\r\n },\r\n renderChatbot(createElement) {\r\n const chatbotButton = createElement('ChatbotButton', {\r\n on: {\r\n click: () => {\r\n this.activateChatbot();\r\n\r\n TransferSessionStorage.triggerEvent(TRANSFER_EVENTS.openOther);\r\n }\r\n },\r\n directives: [\r\n {\r\n name: 'show',\r\n value: this.activeChatType !== ACTIVE_CHAT_TYPES.zendeskLiveChat\r\n }\r\n ]\r\n });\r\n\r\n const chatbotButtonWithTransition = createElement('transition', {\r\n props: {\r\n name: 'fade',\r\n appear: true\r\n }\r\n }, [chatbotButton]);\r\n\r\n const chatbot = this.hasActivatedChatbot ?\r\n this.getSlot('chatbot', { \r\n isActive: this.isChatbotActive\r\n }) :\r\n null;\r\n\r\n return createElement('div', {\r\n class: 'o-chatContainer__chatbotContainer'\r\n }, [chatbotButtonWithTransition, chatbot]);\r\n },\r\n\r\n addZendeskEventListeners() {\r\n this.$eventBus.$on(ZENDESK_EVENTS.closed, this.handleZendeskClose);\r\n this.$eventBus.$on(ZENDESK_EVENTS.open, this.handleZendeskOpen);\r\n },\r\n removeZendeskEventListeners() {\r\n this.$eventBus.$off(ZENDESK_EVENTS.closed, this.handleZendeskClose);\r\n this.$eventBus.$off(ZENDESK_EVENTS.open, this.handleZendeskOpen);\r\n },\r\n handleZendeskOpen() {\r\n this.activeChatType = ACTIVE_CHAT_TYPES.zendeskLiveChat;\r\n ChatbotSession.isOpen = false;\r\n this.clearTimeout();\r\n },\r\n handleZendeskClose() {\r\n TransferSessionStorage.triggerEvent(TRANSFER_EVENTS.liveChatClose);\r\n this.handleChatbotClose();\r\n },\r\n renderZendesk() {\r\n return this.getSlot('zendesk', {\r\n isActive: this.isZendeskActive\r\n });\r\n },\r\n renderPopUp(createElement) {\r\n const popUp = createElement('ChatbotDialog', \r\n {\r\n props: {\r\n dialogTitle: this.dialogTitle,\r\n dialogText: this.dialogText\r\n },\r\n directives: [\r\n {\r\n name: 'show',\r\n value: this.isChatbotDialogActive\r\n }\r\n ]})\r\n \r\n return createElement('div', {\r\n class: 'o-chatContainer__chatbotPopUp',\r\n on: {\r\n click: () => {\r\n this.activateChatbot();\r\n\r\n TransferSessionStorage.triggerEvent(TRANSFER_EVENTS.openOther);\r\n }\r\n }\r\n }, [popUp]);\r\n },\r\n },\r\n render(createElement) {\r\n return createElement('div', { class: 'o-chatContainer' }, [\r\n this.renderChatbot(createElement),\r\n this.renderZendesk(),\r\n this.renderPopUp(createElement)\r\n ]);\r\n }\r\n};\r\n","export default {\r\n name: 'chatbot-header',\r\n methods: {\r\n close() {\r\n this.$emit('close');\r\n }\r\n },\r\n template: `\r\n <header class=\"m-chatbotHeader\">\r\n <div class=\"m-chatbotHeader__leftContainer\">\r\n \r\n <svg class=\"m-chatbotHeader__icon\" viewBox=\"0 0 72 72\" preserveAspectRatio=\"xMidYMid meet\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n <rect x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" rx=\"36\" fill=\"#F0F\"/> \r\n <g fill=\"#FFFFFF\" fill-rule=\"nonzero\" stroke=\"#FFFFFF\">\r\n <g transform=\"translate(16.00000, 16.00000)\"> \r\n <path d=\"M20.0007545,41.8804347 C18.3248759,41.8804347 16.9616945,40.5173334 16.9616945,38.8414547 C16.9616945,37.165576 18.3248759,35.8022081 20.0007545,35.8022081 C21.2207462,35.8022081 22.3209332,36.540288 22.8016451,37.6828719 L23.0032572,38.1591041 L23.5190332,38.1284397 C26.0934601,37.9748508 28.2528504,37.2810343 29.7636744,36.1237848 C30.7484031,35.3699727 31.4219543,34.4596386 31.7653962,33.4178474 L32.0824399,32.4579168 L29.8937983,32.4579168 C29.5562228,32.4579168 29.2114477,32.1131418 29.2114477,31.7755662 L29.2114477,18.5980936 C29.2231802,18.3730965 29.5519564,17.9070236 29.9039309,17.9026239 L32.0387097,17.9026239 L32.0387097,13.4024964 C32.0387097,10.1661973 30.7923999,7.13737662 28.5290971,4.87418046 C26.2658476,2.61095231 23.2370269,1.36465054 20.0007545,1.36465054 C16.7644555,1.36465054 13.7356348,2.61095231 11.4724119,4.87418046 C9.20918913,7.13737662 7.96290602,10.1661973 7.96290602,13.4024964 L7.96290602,17.9026239 L10.1062975,17.9026239 C10.4438197,17.9026239 10.7886214,18.2474523 10.7886214,18.5849479 L10.7886214,31.7755662 C10.7886214,32.1131418 10.4438197,32.4579168 10.1062975,32.4579168 L7.27911552,32.4579168 C3.26551276,32.4579168 1.05764216e-15,29.1922866 1.05764216e-15,25.1788172 C1.05764216e-15,21.6561389 2.52036404,18.6463301 5.9948085,18.0224286 L6.59679159,17.9143297 L6.59679159,13.4024964 C6.59679159,6.01233806 12.6091297,0 19.999288,0 C27.3894463,0 33.401811,6.01380463 33.4031443,13.4024964 L33.4031443,17.9143297 L34.005234,18.0224286 C37.4783159,18.6463301 40,21.6561389 40,25.1802837 C40,28.7043219 37.3772565,31.7944982 33.8985751,32.3643236 L33.3916784,32.4477842 L33.2980852,32.9533476 C32.992774,34.6041615 32.0328435,36.1179185 30.598014,37.2167723 C28.8520071,38.5550754 26.385679,39.3424851 23.4664236,39.496074 L22.9988841,39.5208722 L22.82647,39.9563073 C22.3691697,41.107424 21.2338919,41.8804347 20.0021944,41.8804347 L20.0007545,41.8804347 Z M20.0007545,37.1698424 C19.0627424,37.1698424 18.327809,37.9047225 18.327809,38.8427879 C18.327809,39.7808534 19.0627424,40.5157335 20.0007545,40.5157335 C20.9387666,40.5157335 21.6736734,39.7808534 21.6736734,38.8427879 C21.6736734,37.9047225 20.9387666,37.1698424 20.0007545,37.1698424 Z M30.5774822,31.0932156 L32.7207937,31.0932156 C36.0360203,31.0932156 38.6339656,28.495537 38.6339656,25.1802837 C38.6339656,21.8650837 36.0360203,19.2672718 32.7207937,19.2672718 L30.5774822,19.2672718 L30.5774822,31.0932156 Z M7.27911552,19.2672718 C3.96391553,19.2672718 1.3661116,21.8650837 1.3661116,25.1802837 C1.3661116,28.495537 3.96391553,31.0932156 7.27911552,31.0932156 L9.42250702,31.0932156 L9.42250702,19.2672718 L7.27911552,19.2672718 Z\"></path>\r\n </g>\r\n </g>\r\n </svg>\r\n \r\n \r\n <div class=\"m-chatbotHeader__title\">\r\n Digital Assistant\r\n </div>\r\n\r\n </div>\r\n \r\n <div class=\"m-chatbotHeader__rightContainer\">\r\n <onlia-button class=\"m-chatbotHeader__closeButton\" tag=\"button\" variant=\"none\" @click.stop=\"close\" aria-label=\"close\">\r\n <span class=\"icon-close\"></span>\r\n </onlia-button> \r\n </div>\r\n </header>\r\n `\r\n};\r\n","export default {\r\n name: 'chatbot-input-field',\r\n props: {\r\n value: {\r\n type: String,\r\n required: true\r\n },\r\n maxInputLength: {\r\n type: Number,\r\n default: 150\r\n }\r\n },\r\n data() {\r\n return {};\r\n },\r\n methods: {\r\n handleInput(event) {\r\n this.$emit('input', event.target.value.trim());\r\n }\r\n },\r\n template: `\r\n <form class=\"m-chatbotInputField\">\r\n <div class=\"m-chatbotInputField__contentWrapper\">\r\n <textarea\r\n class=\"m-chatbotInputField__textarea\"\r\n type=\"text\"\r\n :value=\"value\"\r\n :maxlength=\"maxInputLength\"\r\n placeholder=\"Ask me something\"\r\n spellcheck=\"true\"\r\n @keydown.enter.prevent=\"$emit('field-submit')\"\r\n @input=\"handleInput\"\r\n />\r\n \r\n <transition name=\"fade\">\r\n <onlia-button\r\n v-show=\"value\"\r\n tag=\"button\"\r\n type=\"submit\"\r\n class=\"m-chatbotInputField__submitButton\"\r\n variant=\"none\"\r\n aria-label=\"submit question\"\r\n >\r\n <svg width=\"43px\" height=\"43px\" viewBox=\"0 0 43 43\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\r\n <g transform=\"translate(-1343.000000, -696.000000)\">\r\n <g transform=\"translate(1011.000000, 164.000000)\">\r\n <g transform=\"translate(332.000000, 532.000000)\">\r\n <circle fill=\"#FF00FF\" cx=\"21.5\" cy=\"21.5\" r=\"21.5\"></circle>\r\n <g transform=\"translate(11.820969, 9.480035)\" fill=\"#FFFFFF\" fill-rule=\"nonzero\">\r\n <path d=\"M9.97858796,23.8266782 C11.0610532,23.8266782 11.7826968,23.0801505 11.7826968,21.9603588 L11.7826968,8.14959491 L11.6707176,5.44965278 L14.1715856,8.33622685 L16.9710648,11.1232639 C17.3070023,11.4592014 17.7300347,11.6831597 18.2650463,11.6831597 C19.2355324,11.6831597 19.9696181,10.9615162 19.9696181,9.94126157 C19.9696181,9.46846065 19.7829861,9.03298611 19.4097222,8.64728009 L11.3098958,0.547453704 C10.9739583,0.199074074 10.4762731,0 9.97858796,0 C9.49334491,0 8.98321759,0.199074074 8.64728009,0.547453704 L0.559895833,8.64728009 C0.186631944,9.03298611 0,9.46846065 0,9.94126157 C0,10.9615162 0.734085648,11.6831597 1.70457176,11.6831597 C2.25202546,11.6831597 2.67505787,11.4592014 2.99855324,11.1232639 L5.79803241,8.33622685 L8.29890046,5.44965278 L8.17447917,8.14959491 L8.17447917,21.9603588 C8.17447917,23.0801505 8.90856481,23.8266782 9.97858796,23.8266782 Z\" id=\"Path\"></path>\r\n </g>\r\n </g>\r\n </g>\r\n </g>\r\n </g>\r\n </svg>\r\n </onlia-button>\r\n </transition>\r\n </div>\r\n </form>\r\n `\r\n};\r\n","/**\r\n * @typedef Animation\r\n * @type {object}\r\n * @property {string|number} position - Position of animation in timeline\r\n * @property {Object|Array} animation - GSAP Tween | Timeline | Array\r\n */\r\n\r\nclass AnimationQueue {\r\n constructor() {\r\n this.queue = [];\r\n this.isRunning = false;\r\n }\r\n \r\n add(animation) {\r\n this.queue.push(animation);\r\n this.runQueue();\r\n }\r\n \r\n runQueue() {\r\n if (this.isRunning) return;\r\n\r\n this.isRunning = true;\r\n \r\n const animation = this.queue.shift();\r\n \r\n if (!animation) {\r\n this.isRunning = false;\r\n return;\r\n }\r\n\r\n const timeline = new gsap.timeline({\r\n onComplete: () => {\r\n timeline\r\n .clear()\r\n .kill();\r\n \r\n this.isRunning = false;\r\n \r\n this.runQueue();\r\n },\r\n paused: true\r\n });\r\n \r\n if (Array.isArray(animation)) {\r\n animation.map(({ animation, position = 0 }) => {\r\n timeline.add(animation, position);\r\n });\r\n }\r\n else {\r\n const { animation: tween, position = 0 } = animation;\r\n timeline.add(tween, position);\r\n }\r\n \r\n timeline.play();\r\n }\r\n}\r\n\r\nexport default new AnimationQueue();\r\n","import AnimationQueue from './AnimationQueue';\r\nimport { noop } from '@Shared/utils/basic-functions';\r\n\r\nconst ANIMATION_ENTER = {\r\n from: {\r\n autoAlpha: 0\r\n },\r\n to: {\r\n autoAlpha: 1,\r\n duration: 0.5,\r\n ease: 'sine.out',\r\n clearProps: 'all'\r\n }\r\n};\r\nconst ANIMATION_LEAVE = {\r\n from: {\r\n autoAlpha: 1\r\n },\r\n to: {\r\n autoAlpha: 0,\r\n duration: 0.5,\r\n ease: 'sine.in',\r\n clearProps: 'all'\r\n }\r\n};\r\n\r\nexport class ChatbotTransitionsHandler {\r\n static get intersectionObserver() {\r\n if (!this._intersectionObserver) {\r\n const rootEl = document.getElementsByClassName('o-chatbot__conversationContainer')[0];\r\n \r\n const handleIntersection = (...args) => {\r\n this.handleIntersection(...args);\r\n };\r\n \r\n this._intersectionObserver = new IntersectionObserver(handleIntersection, {\r\n threshold: [ 0, 0.5 ],\r\n rootMargin: '0px 0px 0px 0px',\r\n root: rootEl || document\r\n });\r\n }\r\n return this._intersectionObserver;\r\n }\r\n \r\n static handleIntersection(entries, observer) {\r\n let parentHeight = null;\r\n \r\n for (const entry of entries) {\r\n const { isIntersecting, intersectionRatio, target: { offsetHeight, offsetParent } } = entry;\r\n \r\n if (!isIntersecting) continue;\r\n\r\n if (!parentHeight) {\r\n parentHeight = offsetParent.offsetHeight;\r\n }\r\n\r\n const isEnoughVisible = offsetHeight < parentHeight ?\r\n (intersectionRatio >= 0.5) :\r\n true; // Tall elements will never meet the threshold of 0.5\r\n \r\n if (isEnoughVisible) {\r\n this.fadeInElements(entry.target);\r\n observer.unobserve(entry.target);\r\n }\r\n }\r\n }\r\n \r\n static hideElements(elements) {\r\n gsap.set(elements, { autoAlpha: 0 });\r\n }\r\n \r\n static fadeInElements(elements) {\r\n gsap.to(elements, {\r\n autoAlpha: 1,\r\n duration: 0.75,\r\n ease: 'sine.out'\r\n });\r\n }\r\n \r\n static onQuestionEnter({ el, onStart = noop, onComplete = noop }) {\r\n const targetEl = el.childElementCount ? el.children : el;\r\n\r\n this.hideElements(targetEl);\r\n\r\n const animation = gsap.fromTo(targetEl, ANIMATION_ENTER.from, {\r\n onStart,\r\n onComplete,\r\n ...ANIMATION_ENTER.to,\r\n ...(el.childElementCount && {\r\n stagger: 0.5\r\n })\r\n });\r\n\r\n AnimationQueue.add({ animation, position: 0 });\r\n }\r\n \r\n static onAnswerEnter({ elements = [], onComplete = noop, ...rest }) {\r\n const timeline = new gsap.timeline({\r\n ...rest,\r\n onComplete\r\n // onStart: () => {\r\n // console.log('ON ANSWER ENTER START');\r\n // }\r\n });\r\n \r\n if (elements.length === 1) {\r\n const [ element ] = elements;\r\n const { el, onStart = noop, onComplete = noop } = element;\r\n \r\n this.hideElements(el);\r\n\r\n timeline.fromTo(el, ANIMATION_ENTER.from, {\r\n ...ANIMATION_ENTER.to,\r\n onStart,\r\n onComplete\r\n });\r\n }\r\n else {\r\n elements.map(({ el, onStart = noop, onComplete = noop, offset = 0 }) => {\r\n this.hideElements(el);\r\n\r\n timeline.fromTo(el, ANIMATION_ENTER.from, {\r\n ...ANIMATION_ENTER.to,\r\n onStart,\r\n onComplete\r\n }, offset);\r\n });\r\n }\r\n\r\n AnimationQueue.add({ animation: timeline, position: 0 });\r\n }\r\n\r\n static onFeedbackEnter({ el, onStart = noop, onComplete = noop }) {\r\n this.hideElements(el);\r\n\r\n const animation = gsap.fromTo(el, ANIMATION_ENTER.from, {\r\n ...ANIMATION_ENTER.to,\r\n delay: 1,\r\n onStart,\r\n onComplete,\r\n stagger: 0.3\r\n });\r\n\r\n AnimationQueue.add({ animation });\r\n }\r\n \r\n static onFeedbackLeave({ el, onStart = noop, onComplete = noop }) {\r\n gsap.set(el, { position: 'absolute' });\r\n \r\n const animation = gsap.fromTo(el, ANIMATION_LEAVE.from, {\r\n ...ANIMATION_LEAVE.to,\r\n onStart,\r\n onComplete,\r\n duration: 0\r\n });\r\n\r\n AnimationQueue.add({ animation });\r\n }\r\n\r\n static onLoaderEnter({ el, onStart = noop, onComplete = noop }) {\r\n this.hideElements(el);\r\n\r\n const animation = gsap.fromTo(el, ANIMATION_ENTER.from, {\r\n ...ANIMATION_ENTER.to,\r\n onStart,\r\n onComplete\r\n });\r\n\r\n AnimationQueue.add({ animation, position: 0 });\r\n }\r\n\r\n static onLoaderLeave({ el, onStart = noop, onComplete = noop }) {\r\n const animation = gsap.fromTo(el, ANIMATION_LEAVE.from, {\r\n ...ANIMATION_LEAVE.to,\r\n onStart,\r\n onComplete,\r\n duration: 0\r\n });\r\n\r\n AnimationQueue.add({ animation });\r\n }\r\n}\r\n","import { ChatbotTransitionsHandler } from '../utils/ChatbotTransitionsHandler';\r\n\r\nexport default {\r\n name: 'chat-answer',\r\n props: {\r\n answer: {\r\n type: String, // HTML string\r\n required: true\r\n },\r\n dialogOptions: {\r\n type: Array,\r\n default: () => []\r\n },\r\n metadata: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n disableTransition: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n data() {\r\n return {\r\n answeredQuestions: []\r\n };\r\n },\r\n computed: {\r\n unansweredQuestions() {\r\n return this.dialogOptions.filter(question => !this.answeredQuestions.includes(question));\r\n }\r\n },\r\n mounted() {\r\n this.checkForLiveChat();\r\n this.checkForScrollToField();\r\n\r\n if (!this.disableTransition) {\r\n const { answer, options = [] } = this.$refs;\r\n\r\n [answer, ...options].map((el) => {\r\n const targetEl = el instanceof HTMLElement ? el : el.$el;\r\n ChatbotTransitionsHandler.hideElements(targetEl);\r\n ChatbotTransitionsHandler.intersectionObserver.observe(targetEl);\r\n });\r\n }\r\n },\r\n methods: {\r\n checkForLiveChat() {\r\n const liveChatButtons = [...this.$el.querySelectorAll('[data-live-chat]')];\r\n liveChatButtons.map((button) => {\r\n button.addEventListener('click', this.openLiveChat);\r\n });\r\n },\r\n openLiveChat() {\r\n this.$emit('open-live-chat');\r\n },\r\n\r\n checkForScrollToField() {\r\n const liveChatButtons = [...this.$el.querySelectorAll('[data-scroll-to-field]')];\r\n liveChatButtons.map((button) => {\r\n button.addEventListener('click', this.scrollToField);\r\n });\r\n },\r\n scrollToField(event) {\r\n this.$emit('scroll-to-field', event);\r\n },\r\n\r\n /* Render dialog options as separate bubbles/buttons */\r\n createDialogOptions(createElement) {\r\n const questions = this.unansweredQuestions.map((question) => {\r\n const buttonEl = createElement('onlia-button', {\r\n class: ['m-chatMessage -link'],\r\n props: {\r\n label: question,\r\n tag: 'button',\r\n variant: 'none',\r\n labelWrap: true\r\n },\r\n on: {\r\n click: () => {\r\n this.answeredQuestions.push(question);\r\n this.$emit('ask-question', question);\r\n }\r\n },\r\n key: question,\r\n ref: 'options',\r\n refInFor: true\r\n });\r\n\r\n return createElement('li', {}, [buttonEl]);\r\n });\r\n\r\n return questions.length ? createElement('ul', { class: 'o-chatOptionsList' }, questions) : null;\r\n }\r\n },\r\n render(createElement) {\r\n return createElement('div', {}, [\r\n createElement('div', {\r\n class: 'm-chatMessage -bot',\r\n domProps: {\r\n innerHTML: this.answer\r\n },\r\n ref: 'answer'\r\n }),\r\n this.createDialogOptions(createElement)\r\n ]);\r\n }\r\n};\r\n","import { loadScript } from '@Shared/utils/load-script';\r\nimport { log } from './logging';\r\n\r\nclass CxMarkdownToHtml {\r\n set markdownParser(val) {\r\n this._markdownParser = val;\r\n }\r\n get markdownParser() {\r\n return this._markdownParser;\r\n }\r\n\r\n set lexer(val) {\r\n this._lexer = val;\r\n }\r\n get lexer() {\r\n return this._lexer;\r\n }\r\n\r\n static clearDialogOptions(answer) {\r\n return answer.replace(/\\* %{DialogOption(.*)}(\\r\\n|\\r|\\n)?/gmi, '');\r\n }\r\n\r\n static unescapeMarkdown(answer) {\r\n return answer.replace(/^\\\\#/gm, '#').replace(/^\\\\>/gm, '>'); // unescape markdown;\r\n }\r\n\r\n static createLiveChatButton(text = '') {\r\n // If text == 'chat with us' render as button\r\n // Else render as link\r\n const showAsButton = /(chat\\s*with\\s*us\\s*)/i.test(text);\r\n const style = showAsButton ? 'height: auto; padding: 10px 15px' : 'text-decoration: underline !important';\r\n\r\n return `\r\n <button type=\"button\" class=\"OnliaButton OnliaButton--${showAsButton ? 'primary' : 'hyperlink'}\" style=\"${style}\" data-live-chat>\r\n <span tabindex=\"-1\" class=\"OnliaButton__outline\"></span>\r\n <span tabindex=\"-1\" class=\"OnliaButton__label ${showAsButton ? '-textWrap' : ''}\">${text}</span>\r\n </button>\r\n `;\r\n }\r\n\r\n static createScrollToLink(url, text = '') {\r\n // Extract the label elements for attribute value from the url\r\n // ex. scrollToField(Car.FullName)\r\n const re = /(?:scrollToField\\((.+)\\))$/;\r\n const result = re.exec(url);\r\n\r\n return `\r\n <button type=\"button\" class=\"OnliaButton OnliaButton--hyperlink\" data-scroll-to-field=\"${result ? result[1] : ''}\">\r\n <span tabindex=\"-1\" class=\"OnliaButton__outline\"></span>\r\n <span tabindex=\"-1\" class=\"OnliaButton__label\">${text}</span>\r\n </button>\r\n `;\r\n }\r\n\r\n async loadMarkdownParser() {\r\n try {\r\n /**\r\n * NOTE 2022-12-14 AndrewKim: This is version 0.8.0. Old version is used on purpose, to match the CX front-end.\r\n */\r\n await loadScript({ id: 'marked', url: '/onlia/vendor/marked/marked.min.js', scriptAttributes: { async: '' } });\r\n\r\n this.markdownParser = window.marked.parser;\r\n\r\n this.lexer = new window.marked.Lexer();\r\n this.lexer.rules.html = /^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:<\\/\\1>[^\\n]*\\n+|$)|<!--(?!-?>)[\\s\\S]*?-->[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|<\\/?(address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul|img)(?: +|\\n|\\/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?: +[a-zA-Z:_][\\w.:-]*(?: *= *\"[^\"\\n]*\"| *= *'[^'\\n]*'| *= *[^\\s\"'=<>`]+)?)*? *\\/?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|<\\/(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))/i;\r\n\r\n // Ignore code blocks if there are html tags. This resolves issues with having spaces inside of backticks '`'.\r\n // Solves issues with mark up returned from createLiveChatButton rendering as a code block.\r\n this.lexer.rules.code = /^( {4}[^\\n]+\\n*)+(?:<\\[a-z]+.*)/;\r\n }\r\n catch (error) {\r\n // handleAxiosError(error, 'loadMarkdownParser');\r\n // throw new Error('Error loading markdown parser.', { cause: error });\r\n\r\n log.error('Error loading markdown parser.', error);\r\n }\r\n }\r\n\r\n replaceHyperlinks(answer, links) {\r\n if (!links.length) return answer;\r\n\r\n return links.reduce((answerWithLinks, { id, target, url, text }) => {\r\n const re = new RegExp('%\\\\{Link\\\\(' + id + '\\\\)\\\\}', 'gi');\r\n const isLinkLiveChat = /(openLiveChat\\(\\))$/.test(url);\r\n const isScrollToField = /(scrollToField\\(.+\\))$/.test(url);\r\n\r\n if (isLinkLiveChat) {\r\n // const buttonTag = `<button data-live-chat>${text}</button>`;\r\n return answerWithLinks.replace(re, CxMarkdownToHtml.createLiveChatButton(text));\r\n }\r\n\r\n // Scroll to Form Field\r\n if (isScrollToField) {\r\n return answerWithLinks.replace(re, CxMarkdownToHtml.createScrollToLink(url, text));\r\n }\r\n\r\n const aTag = `<a href=\"${url}\" target=\"${target}\" >${text}</a>`;\r\n return answerWithLinks.replace(re, aTag);\r\n }, answer);\r\n }\r\n\r\n async parseMarkdown({ answer, links = [] }) {\r\n if (!this.markdownParser) {\r\n await this.loadMarkdownParser();\r\n }\r\n\r\n const answerNoDialog = CxMarkdownToHtml.clearDialogOptions(answer);\r\n\r\n const unescaped = CxMarkdownToHtml.unescapeMarkdown(answerNoDialog);\r\n const withLinks = this.replaceHyperlinks(unescaped, links);\r\n\r\n return this.markdownParser(this.lexer.lex(withLinks));\r\n }\r\n}\r\n\r\nexport default new CxMarkdownToHtml();\r\n","const DOTS = new Array(3).fill(0);\r\n\r\nexport default {\r\n name: 'chat-message-loader',\r\n functional: true,\r\n render(createElement, context) {\r\n const dots = DOTS.map(() => createElement('div', { class: 'a-chatMessageLoader__dot' }));\r\n return createElement('div', {\r\n ...context.data,\r\n class: 'a-chatMessageLoader m-chatMessage -bot'\r\n }, dots);\r\n }\r\n};\r\n","import { ChatbotTransitionsHandler } from '../utils/ChatbotTransitionsHandler';\r\n\r\nexport default {\r\n name: 'chat-feedback',\r\n props: {\r\n answer: {\r\n type: String, // HTML string\r\n required: true\r\n },\r\n dialogOptions: {\r\n type: Array,\r\n default: () => []\r\n },\r\n disableTransition: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n mounted() {\r\n if (!this.disableTransition) {\r\n const { answer, options = [] } = this.$refs;\r\n\r\n [ answer, ...options ].map((el) => {\r\n const targetEl = el instanceof HTMLElement ? el : el.$el;\r\n ChatbotTransitionsHandler.hideElements(targetEl);\r\n ChatbotTransitionsHandler.intersectionObserver.observe(targetEl);\r\n });\r\n }\r\n },\r\n methods: {\r\n createFeedbackButtons(createElement) {\r\n const buttons = this.dialogOptions.map((buttonLabel) => {\r\n const buttonEl = createElement('onlia-button', {\r\n class: [ 'm-chatMessage -link -feedback' ],\r\n props: {\r\n label: buttonLabel,\r\n tag: 'button',\r\n variant: 'none',\r\n labelWrap: true\r\n },\r\n on: {\r\n click: () => {\r\n this.$emit('send-feedback', buttonLabel);\r\n }\r\n },\r\n key: buttonLabel,\r\n ref: 'options',\r\n refInFor: true\r\n });\r\n\r\n return createElement('li', {}, [ buttonEl ]);\r\n });\r\n\r\n return buttons.length ? createElement('ul', { class: 'o-chatOptionsList' }, buttons) : null;\r\n }\r\n },\r\n render(createElement) {\r\n return createElement('div', {}, [\r\n createElement('div', {\r\n class: 'm-chatMessage -bot -feedback',\r\n domProps: {\r\n innerHTML: this.answer\r\n },\r\n ref: 'answer'\r\n }),\r\n this.createFeedbackButtons(createElement)\r\n ]);\r\n }\r\n};\r\n","import { ChatbotTransitionsHandler } from '../utils/ChatbotTransitionsHandler';\r\n\r\nexport default {\r\n name: 'chat-question',\r\n props: {\r\n text: {\r\n type: String,\r\n required: true\r\n },\r\n disableTransition: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n mounted() {\r\n if (!this.disableTransition) {\r\n ChatbotTransitionsHandler.hideElements(this.$el);\r\n ChatbotTransitionsHandler.intersectionObserver.observe(this.$el);\r\n }\r\n },\r\n render(createElement) {\r\n return createElement('div', {\r\n class: 'm-chatMessage -user'\r\n }, this.text);\r\n }\r\n};\r\n","export const API_KEY = 'e342629b-2cf2-4e21-823c-820c73d66178';\r\nexport const PROJECT_KEY = 'ONLIA';\r\nexport const CUSTOMER_KEY = 'Onlia';\r\nexport const CULTURE = 'en';\r\n// export const BASE_URL = `https://onlia-onlia.staging.digitalcx.com/${CUSTOMER_KEY}/projects/${PROJECT_KEY}`;\r\n// export const BASE_URL = `https://dev.digitalcx.com/${CUSTOMER_KEY}/projects/${PROJECT_KEY}`;\r\nexport const BASE_URL = `https://api-staging.digitalcx.com/${CUSTOMER_KEY}/projects/${PROJECT_KEY}`;\r\nexport const BASE_URL_ONLIA_API = '/api/onlia/chatbot';\r\nexport const BASE_URL_ONLIA_API_LIVECHAT = '/api/onlia/livechat';\r\n\r\nexport const COMMON_CONFIG = {\r\n apiKey: API_KEY,\r\n customerKey: CUSTOMER_KEY,\r\n projectKey: PROJECT_KEY,\r\n culture: CULTURE\r\n};\r\nexport const EVENT_BASE_CONFIG = {\r\n // ...COMMON_CONFIG,\r\n maxFaqs: 4\r\n};\r\n\r\nexport const EVENT_NAMES = {\r\n escalation1NoAnswer: 'escalation_1x_noanswer',\r\n escalation2NoAnswer: 'escalation_2x_noanswer',\r\n exception150Characters: 'Exception_150_Characters',\r\n exceptionGreeting: 'Exception_Greeting',\r\n exceptionOther: 'Exception_Other',\r\n exceptionThanks: 'Exception_Thanks',\r\n messenger__OnLoad: 'messenger__onLoad',\r\n onLoad: 'onLoad',\r\n onLoadSense: 'onLoad_Sense',\r\n onSessionExpired: 'OnSessionExpired',\r\n openEmailForm: 'open_email_form',\r\n openLiveChat: 'open_live_chat',\r\n showFeedback: 'show_feedback'\r\n};\r\n\r\n/**\r\n * Digital CX Endpoints\r\n */\r\nexport const EVENT_URLS = {\r\n onLoad: `${BASE_URL}/event/${EVENT_NAMES.onLoad}`,\r\n characterLimit: `${BASE_URL}/event/${EVENT_NAMES.exception150Characters}`,\r\n openLiveChat: `${BASE_URL}/event/${EVENT_NAMES.openLiveChat}`,\r\n showFeedback: `${BASE_URL}/event/${EVENT_NAMES.showFeedback}`\r\n};\r\nexport const SEND_FEEDBACK_URL = `${BASE_URL}/feedback`;\r\n\r\n/**\r\n * Onlia Internal Endpoints\r\n * For more information on endpoints, see AchmeaDI.Web.Core\\Controllers\\API\\ChatbotController.cs\r\n */\r\nexport const ONLIA_API_ENDPOINTS = {\r\n onLoad: `${BASE_URL_ONLIA_API}/onload`,\r\n ask: `${BASE_URL_ONLIA_API}/ask`,\r\n characterLimit: `${BASE_URL_ONLIA_API}/getcharacterlimit`,\r\n sendFeedback: `${BASE_URL_ONLIA_API}/feedback`,\r\n showFeedback: `${BASE_URL_ONLIA_API}/showfeedback`,\r\n getPersonalizationData: `${BASE_URL_ONLIA_API}/getpersonalizationdata`,\r\n getOpeningHours: `${BASE_URL_ONLIA_API}/getopeninghours`,\r\n getConversationHistory: `${BASE_URL_ONLIA_API}/getconversationhistory`,\r\n updateConversationHistory: `${BASE_URL_ONLIA_API}/updateconversationhistory`,\r\n stepBackInaDialog: `${BASE_URL_ONLIA_API}/StepBackInaDialog`,\r\n};\r\n\r\n\r\nexport const ONLIA_API_ENDPOINTS_LIVECHAT = {\r\n addZendestTicket: `${BASE_URL_ONLIA_API_LIVECHAT}/addticket`\r\n}\r\n","import _get from 'lodash/get';\r\n\r\nexport const getOutput = (response) => {\r\n const outputPart = _get(response, 'outputs[0].outputParts');\r\n return Array.isArray(outputPart) ? outputPart[0] : outputPart;\r\n};\r\n\r\nexport const getDialogPath = (response) => {\r\n const dialogPath = _get(response, 'outputs[0].dialogPath', '');\r\n const regex = /^[0-9]+\\:[0-9]+/;\r\n const result = regex.exec(dialogPath);\r\n \r\n return result ? result[0] : '';\r\n};\r\n\r\nexport const parseResponse = response => ({\r\n output: getOutput(response),\r\n sessionID: _get(response, 'sessionId', ''),\r\n interactionID: _get(response, 'interactionId', ''),\r\n dialogPath: getDialogPath(response)\r\n});\r\n\r\nexport const parseOutput = (output) => {\r\n const re = /\\*\\s?%{DialogOption\\((.*)\\)}/gm;\r\n\r\n // Replace {Dialog(...)} with element\r\n // Split by paragraph\r\n return output\r\n .replace(re, (dialogOptionMatch, question) => `<p>${question}</p>`)\r\n .split(/(?:[\\n\\r]+|\\s{2,})/g);\r\n};\r\n","import { parseResponse } from './digital-cx-helper';\r\nimport { ChatbotSession } from './ChatbotSession';\r\n\r\nexport class ChatbotAPIUtils {\r\n setResponseProperties({ sessionID, interactionID, dialogPath }) {\r\n ChatbotSession.sessionID = sessionID;\r\n ChatbotSession.sessionDialogPath = dialogPath;\r\n ChatbotSession.interactionID = interactionID;\r\n }\r\n \r\n handleAPIResponse(response) {\r\n const { output: answer, ...sessionProperties } = parseResponse(response);\r\n \r\n this.setResponseProperties(sessionProperties);\r\n\r\n return answer;\r\n }\r\n}\r\n","import axios from 'axios';\r\nimport { toBase64Input } from '@Shared/utils/basic-functions';\r\nimport { BASE_URL, COMMON_CONFIG, EVENT_BASE_CONFIG, EVENT_URLS, ONLIA_API_ENDPOINTS, SEND_FEEDBACK_URL, ONLIA_API_ENDPOINTS_LIVECHAT } from './api';\r\nimport { ChatbotAPIUtils } from './ChatbotAPIUtils';\r\n\r\nconst axiosInstanceOnlia = axios.create();\r\nconst capitalize = word => word.replace(/^[a-z]/, match => match.toUpperCase());\r\n\r\nconst camelize = (str) => {\r\n const words = str.split(/[\\._-]+/g);\r\n\r\n return words.reduce((combined, word, index) => {\r\n if (index === 0) {\r\n return combined += word;\r\n }\r\n return combined += capitalize(word);\r\n }, '');\r\n};\r\naxiosInstanceOnlia.interceptors.request.use((config) => {\r\n // Base64 encode payload\r\n if (config.method === 'get' || config.method === 'post') {\r\n const payload = config.params || config.data;\r\n\r\n if (payload) {\r\n const keys = Object.keys(payload);\r\n keys.map((key) => {\r\n // Skip base64 encoding for numbers\r\n if (key === 'maxFaqs' || key === 'minFaqs' || key === 'score') return;\r\n \r\n const encdodedValue = toBase64Input(payload[key]);\r\n \r\n // Parameter names with any non word character must be removed, and camel cased. This is required to pass the firewall.\r\n if (/[\\._-]+/g.test(key)) {\r\n delete payload[key];\r\n payload[camelize(key)] = encdodedValue;\r\n }\r\n else {\r\n payload[key] = encdodedValue;\r\n }\r\n });\r\n }\r\n }\r\n\r\n // Add x-api-key header\r\n config.headers = {\r\n \"x-api-key\": COMMON_CONFIG.apiKey\r\n }\r\n\r\n return config;\r\n}, error => Promise.reject(error));\r\n\r\n// axiosInstanceOnlia.interceptors.response.use(response =>\r\n// // Any status code that lie within the range of 2xx cause this function to trigger\r\n// // Do something with response data\r\n// response\r\n// , error =>\r\n// // Any status codes that falls outside the range of 2xx cause this function to trigger\r\n// // Do something with response error\r\n// Promise.reject(error)\r\n// );\r\n\r\nconst axiosInstanceCX = axios.create();\r\naxiosInstanceCX.interceptors.request.use((config) => {\r\n config.params = {\r\n ...COMMON_CONFIG,\r\n ...config.params || {}\r\n };\r\n return config;\r\n}, error => Promise.reject(error));\r\n\r\nexport class ChatbotAPIController extends ChatbotAPIUtils {\r\n constructor() {\r\n super();\r\n this.useCX = false;\r\n }\r\n \r\n async onLoad(params = {}) {\r\n return this.useCX ?\r\n axiosInstanceCX.get(EVENT_URLS.onLoad, {\r\n params: EVENT_BASE_CONFIG\r\n }) :\r\n axiosInstanceOnlia.get(ONLIA_API_ENDPOINTS.onLoad, { params });\r\n }\r\n \r\n characterLimitExceeded(params = {}) {\r\n return this.useCX ?\r\n axiosInstanceCX.get(EVENT_URLS.characterLimit, params) :\r\n axiosInstanceOnlia.get(ONLIA_API_ENDPOINTS.characterLimit, params);\r\n }\r\n \r\n ask(params = {}) {\r\n return this.useCX ?\r\n axiosInstanceCX.get(`${BASE_URL}/ask`, params) :\r\n axiosInstanceOnlia.get(ONLIA_API_ENDPOINTS.ask, params);\r\n }\r\n stepBack(params = {}) {\r\n return this.useCX ?\r\n axiosInstanceCX.get(`${BASE_URL}/dialogStep`, params) :\r\n axiosInstanceOnlia.get(ONLIA_API_ENDPOINTS.stepBackInaDialog, params);\r\n }\r\n showFeedback(params = {}) {\r\n return this.useCX ?\r\n axiosInstanceCX.get(EVENT_URLS.showFeedback, params) :\r\n axiosInstanceOnlia.get(ONLIA_API_ENDPOINTS.showFeedback, params);\r\n }\r\n \r\n sendFeedback(params = {}) {\r\n return this.useCX ?\r\n axiosInstanceCX.get(SEND_FEEDBACK_URL, { params }) :\r\n axiosInstanceOnlia.post(ONLIA_API_ENDPOINTS.sendFeedback, params);\r\n }\r\n\r\n /**\r\n * This endpoint has no CX equivalent.\r\n */\r\n getUserData(params = {}) {\r\n return axiosInstanceOnlia.get(ONLIA_API_ENDPOINTS.getPersonalizationData, params);\r\n }\r\n\r\n getOpeningHours(params = {}) {\r\n return axiosInstanceOnlia.get(ONLIA_API_ENDPOINTS.getOpeningHours, params);\r\n }\r\n\r\n getConversationHistory() {\r\n return axiosInstanceOnlia.get(ONLIA_API_ENDPOINTS.getConversationHistory);\r\n }\r\n\r\n updateConversationHistory(sessionId, conversation) {\r\n const data = {\r\n sessionId,\r\n conversation: JSON.stringify(conversation)\r\n }\r\n\r\n return axiosInstanceOnlia.post(ONLIA_API_ENDPOINTS.updateConversationHistory, data);\r\n }\r\n\r\n addZendestTicket(subject, conversation) {\r\n const data = {\r\n subject,\r\n body: JSON.stringify(conversation)\r\n }\r\n\r\n return axiosInstanceOnlia.post(ONLIA_API_ENDPOINTS_LIVECHAT.addZendestTicket, data);\r\n }\r\n}\r\n\r\n// export default new ChatbotAPIController();\r\n","const userPersonalization = {\r\n data() {\r\n return {\r\n userName: null,\r\n policyType: null,\r\n numberOfCurrentPolicies: null,\r\n numberOfFuturePolicies: null,\r\n numberOfRenewalPolicies: null,\r\n totalPremium: null,\r\n billAmount: null\r\n };\r\n },\r\n computed: {\r\n personalizationOptions() {\r\n return [\r\n {\r\n // NOTE 2022-12-14 AndrewKim: CX adds one or more \\ before each underscore.\r\n regex: /(\\{CURRENT\\\\*_USER})/,\r\n clearVariableRegex: /(\\s*\\{CURRENT\\\\*_USER})/, // used to remove variable when no corresponding value is available\r\n value: this.userName\r\n },\r\n {\r\n regex: /(\\{POLICY\\\\*_TYPE})/,\r\n clearVariableRegex: /(\\s*\\{POLICY\\\\*_TYPE})/,\r\n value: this.policyType\r\n },\r\n {\r\n regex: /(\\{NUMBER\\\\*_OF\\\\*_CURRENT\\\\*_POLICIES})/,\r\n clearVariableRegex: /(\\s*\\{NUMBER\\\\*_OF\\\\*_CURRENT\\\\*_POLICIES})/,\r\n value: this.numberOfCurrentPolices\r\n },\r\n {\r\n regex: /(\\{NUMBER\\\\*_OF\\\\*_FUTURE\\\\*_POLICIES})/,\r\n clearVariableRegex: /(\\s*\\{NUMBER\\\\*_OF\\\\*_FUTURE\\\\*_POLICIES})/,\r\n value: this.numberOfFuturePolices\r\n },\r\n {\r\n regex: /(\\{NUMBER\\\\*_OF\\\\*_RENEWAL\\\\*_POLICIES})/,\r\n clearVariableRegex: /(\\s*\\{NUMBER\\\\*_OF\\\\*_RENEWAL\\\\*_POLICIES})/,\r\n value: this.numberOfRenewalPolicies\r\n },\r\n {\r\n regex: /(\\{TOTAL\\\\*_PREMIUM})/,\r\n clearVariableRegex: /(\\s*\\{TOTAL\\\\*_PREMIUM})/,\r\n value: this.totalPremium\r\n },\r\n {\r\n regex: /(\\{BILL\\\\*_AMOUNT})/,\r\n clearVariableRegex: /(\\s*\\{BILL\\\\*_AMOUNT})/,\r\n value: this.billAmount\r\n }\r\n ];\r\n }\r\n },\r\n methods: {\r\n async getUserData() {\r\n const {\r\n data: {\r\n CurrentUser,\r\n BillAmount,\r\n NumberOfCurrentPolicies,\r\n NumberOfFuturePolicies,\r\n NumberOfRenewalPolicies,\r\n PolicyType,\r\n TotalPremium\r\n }\r\n } = await this._chatbotAPI.getUserData();\r\n\r\n this.userName = CurrentUser;\r\n this.numberOfCurrentPolices = NumberOfCurrentPolicies;\r\n this.numberOfFuturePolices = NumberOfFuturePolicies;\r\n this.numberOfRenewalPolicies = NumberOfRenewalPolicies;\r\n \r\n // NOTE 2023-01-06 AndrewKim: `${hasHomePolicy ? 'Home' : ''}${hasHomePolicy && hasAutoPolicy ? ' and ' : ''}${hasAutoPolicy ? 'Auto' : ''}`;\r\n this.policyType = PolicyType;\r\n \r\n // NOTE 2023-01-06 AndrewKim: For any dollar values, we need to add the dollar sign ourselves.\r\n this.billAmount = BillAmount !== null ? `$${BillAmount}` : null;\r\n this.totalPremium = TotalPremium !== null ? `$${TotalPremium}` : null;\r\n },\r\n\r\n addUserCustomizations(text) {\r\n return this.personalizationOptions.reduce((finalText, option) => {\r\n const { regex, clearVariableRegex, value } = option;\r\n\r\n const hasVariable = regex.test(finalText);\r\n \r\n if (!hasVariable) return finalText;\r\n\r\n if (typeof value !== 'undefined' && value !== null) {\r\n return finalText.replace(regex, value);\r\n }\r\n\r\n // If no value is available, remove variable, and trailing whitespace\r\n return finalText.replace(clearVariableRegex, '');\r\n }, text);\r\n }\r\n }\r\n};\r\n\r\nexport default userPersonalization;\r\n","import _get from 'lodash/get';\r\n\r\n/* Components */\r\nimport ChatbotHeader from './chatbot-header';\r\nimport ChatbotInputField from './chatbot-input-field';\r\nimport ChatAnswer from './chat-answer';\r\nimport CxMarkdownToHtml from '../utils/CxMarkdownToHtml';\r\nimport ChatMessageLoader from './chat-message-loader';\r\nimport ChatFeedback from './chat-feedback';\r\nimport ChatQuestion from './chat-question';\r\n\r\nimport { CHATBOT_EVENTS, ZENDESK_EVENTS } from '../utils/event-names';\r\nimport { EVENT_BASE_CONFIG } from '../utils/api';\r\nimport { ChatbotTransitionsHandler } from '../utils/ChatbotTransitionsHandler';\r\nimport { getOutput, getDialogPath } from '../utils/digital-cx-helper';\r\nimport { log, handleAxiosError } from '../utils/logging';\r\nimport { ChatbotAPIController } from '../utils/ChatbotAPIController';\r\nimport { ChatbotSession } from '../utils/ChatbotSession';\r\nimport { wait } from '@Shared/utils/basic-functions';\r\nimport userPersonalization from '../mixins/user-personalization';\r\nimport { HEADER_NAV } from '@Shared/settings';\r\nimport { getElementTop } from '@Shared/utils/get-element-top';\r\nimport { loadGSAP } from '@Shared/utils/gsap-utils';\r\nimport { getDay } from 'date-fns';\r\n\r\nimport { TransferSessionStorage, TRANSFER_EVENTS } from \"../utils/TransferSessionStorage\";\r\n\r\nexport default {\r\n name: 'chat-bot',\r\n mixins: [userPersonalization],\r\n props: {\r\n isActive: {\r\n type: Boolean,\r\n default: false\r\n },\r\n sitecoreItemID: {\r\n type: String,\r\n required: true\r\n },\r\n isLoggedIn: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n components: {\r\n ChatbotHeader,\r\n ChatbotInputField,\r\n ChatAnswer,\r\n ChatMessageLoader,\r\n ChatFeedback,\r\n ChatQuestion\r\n },\r\n data() {\r\n return {\r\n conversation: [],\r\n userInput: '',\r\n characterLimitMessage: '',\r\n isLoading: false,\r\n isLoadingSession: true,\r\n showFeedback: false,\r\n sendFeedbackHTML: '',\r\n sendFeedbackDialogOptions: []\r\n };\r\n },\r\n computed: {\r\n maxInputLength() {\r\n return 150;\r\n },\r\n hasInputReachedLimit() {\r\n return this.userInput.length >= this.maxInputLength;\r\n },\r\n sendFeedbackProps() {\r\n return {\r\n answer: this.sendFeedbackHTML,\r\n dialogOptions: this.sendFeedbackDialogOptions\r\n };\r\n },\r\n\r\n isPhone() {\r\n return this.$store.getters.breakpointPhone;\r\n },\r\n isMobile() {\r\n return this.$store.getters.breakpointMobile;\r\n },\r\n navHeaderHeight() {\r\n const headerHeight = this.$store.getters['currentHeaderHeight'];\r\n\r\n if (!this.isMobile && this.$store.state.globalNav.isHidden) {\r\n return headerHeight + HEADER_NAV.topNavHeight;\r\n }\r\n\r\n return headerHeight;\r\n }\r\n },\r\n created() {\r\n this.addEventListeners();\r\n ChatbotSession.loggedIn = this.isLoggedIn;\r\n this.isLoadingSession = ChatbotSession.isSessionActive;\r\n\r\n this._chatbotAPI = new ChatbotAPIController();\r\n this._chatbotAPI.useCX = false;\r\n this._preventUpdateChatHistory = false;\r\n \r\n this.$eventBus.$on('chatBot:searchInput', this.handleDialogAskQuestion);\r\n },\r\n async mounted() {\r\n try {\r\n // Only required when not used with chat-container Vue component\r\n // const ir = document.getElementById(APP_EL_ID);\r\n // ir.appendChild(this.$el);\r\n\r\n (!window.gsap && await loadGSAP());\r\n\r\n if (this.isLoggedIn) {\r\n await this.getUserData();\r\n await this.checkForBESession();\r\n }\r\n\r\n if (ChatbotSession.isSessionActive) {\r\n await this.loadSession();\r\n }\r\n else {\r\n await this.init();\r\n this.$watch('conversation', this.saveConversation, { immediate: true });\r\n }\r\n\r\n TransferSessionStorage.on(TRANSFER_EVENTS.transferConversation, this.handleTransferConverstion)\r\n }\r\n catch (error) {\r\n log.error('mounted error:', error);\r\n }\r\n },\r\n updated() {\r\n this.scrollTo({ duration: 1 });\r\n },\r\n beforeDestroy() {\r\n this.removeEventListeners();\r\n this.$eventBus.$off('chatBot:searchInput', this.handleDialogAskQuestion);\r\n },\r\n methods: {\r\n async checkForBESession() {\r\n try {\r\n const { data: conversationHistoryResponse } = await this._chatbotAPI.getConversationHistory();\r\n if (conversationHistoryResponse.SessionId) {\r\n ChatbotSession.sessionID = conversationHistoryResponse.SessionId;\r\n ChatbotSession.conversation = JSON.parse(conversationHistoryResponse.Conversation);\r\n }\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'conversationHistory error');\r\n }\r\n },\r\n\r\n saveConversation(conversation) {\r\n // To save storage space, don't save html or keys. Front-end can regenerate it.\r\n // eslint-disable-next-line no-unused-vars\r\n ChatbotSession.conversation = conversation.map(({ textHTML, key, ...rest }) => rest);\r\n\r\n if (this.isLoggedIn && !this._preventUpdateChatHistory) {\r\n this.updateChatHistory();\r\n }\r\n\r\n if (this._preventUpdateChatHistory) {\r\n this._preventUpdateChatHistory = false;\r\n } else {\r\n TransferSessionStorage.triggerEvent(TRANSFER_EVENTS.transferConversation, ChatbotSession.conversation);\r\n }\r\n },\r\n async parseSavedConversation(conversation) {\r\n const parsedConversation = [];\r\n const conversationLength = conversation.length;\r\n\r\n for (let i = 0; i < conversationLength; i++) {\r\n try {\r\n const message = conversation[i];\r\n\r\n if (!message) continue;\r\n\r\n message.disableTransition = true;\r\n message.key = message.isFeedback ? 'feedback' : this.generateGuid();\r\n\r\n if (message.type === 'answer') {\r\n const { links, text } = message;\r\n\r\n message.text = this.addUserCustomizations(text);\r\n message.textHTML = await CxMarkdownToHtml.parseMarkdown({ links, answer: message.text });\r\n }\r\n\r\n parsedConversation.push(message);\r\n }\r\n catch (error) {\r\n log.error('parseSavedConversation error:', error);\r\n }\r\n }\r\n\r\n return parsedConversation;\r\n },\r\n\r\n async loadSession() {\r\n try {\r\n const { container } = this.$refs;\r\n\r\n // We need to hide the conversation as the user will see the conversation scroll down on load\r\n gsap.set(container, { autoAlpha: 0 });\r\n\r\n await CxMarkdownToHtml.loadMarkdownParser();\r\n\r\n await this.getCharacterLimitMessage();\r\n\r\n const conversation = ChatbotSession.conversation || [];\r\n const openingHours = ChatbotSession.openingHours || {};\r\n\r\n const hasFeedback = conversation.some(message => message.isFeedback);\r\n\r\n if (hasFeedback) {\r\n await this.getFeedback();\r\n }\r\n\r\n // if (this.isLoggedIn) {\r\n // await this.getUserData();\r\n // }\r\n\r\n this.conversation = await this.parseSavedConversation(conversation);\r\n this.setLiveChatState(openingHours);\r\n\r\n if (Object.keys(openingHours).length !== 0) {\r\n this.setLiveChatState(openingHours);\r\n } else {\r\n await this.inOpeningHours();\r\n }\r\n\r\n this.scrollTo({ duration: 0 });\r\n\r\n await this.$nextTick();\r\n\r\n // Show the conversation once the chatbot has finished scrolling down\r\n gsap.to(container, { autoAlpha: 1, duration: 0.5, ease: 'sine.out', delay: 1 });\r\n\r\n this.$watch('conversation', this.saveConversation);\r\n\r\n this.isLoadingSession = false;\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'loadSession error:');\r\n }\r\n },\r\n async init() {\r\n try {\r\n if (this.conversation.length) return;\r\n\r\n this.isLoading = true;\r\n\r\n // load markdown parser library\r\n await CxMarkdownToHtml.loadMarkdownParser();\r\n\r\n // Initial Event\r\n const { data: initialResponse } = await this._chatbotAPI.onLoad({ sitecoreItemId: this.sitecoreItemID });\r\n\r\n // if (this.isLoggedIn) {\r\n // await this.getUserData();\r\n // }\r\n\r\n this.isLoading = false;\r\n\r\n const answer = this._chatbotAPI.handleAPIResponse(initialResponse);\r\n\r\n // Only for initial event will we check for CURRENT_USER.\r\n // answer.text = this.insertUserName(answer.text);\r\n\r\n await this.getCharacterLimitMessage();\r\n await this.handleAnswer(answer);\r\n await this.inOpeningHours();\r\n }\r\n catch (error) {\r\n // console.error('init error:', error.message);\r\n handleAxiosError(error, 'init error:');\r\n }\r\n },\r\n updateChatHistory() {\r\n if (this._timeout) {\r\n clearTimeout(this._timeout);\r\n this._timeout = undefined;\r\n }\r\n\r\n this._timeout = setTimeout(async () => {\r\n this._timeout = undefined;\r\n try {\r\n await this._chatbotAPI.updateConversationHistory(\r\n ChatbotSession.sessionID,\r\n ChatbotSession.conversation\r\n )\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'updateConversationHistory error');\r\n }\r\n }, 1000);\r\n },\r\n addEventListeners() {\r\n this.$eventBus.$on('open-live-chat', this.openLiveChat);\r\n this.$eventBus.$on(ZENDESK_EVENTS.open, this.handleZendeskOpen);\r\n },\r\n removeEventListeners() {\r\n this.$eventBus.$off('open-live-chat', this.openLiveChat);\r\n this.$eventBus.$off(ZENDESK_EVENTS.open, this.handleZendeskOpen);\r\n },\r\n handleZendeskOpen() {\r\n this.isLoading = false;\r\n },\r\n handleZendeskUnreadMessages() {\r\n TransferSessionStorage.triggerEvent(TRANSFER_EVENTS.liveChatOpened);\r\n this.$eventBus.$off(ZENDESK_EVENTS.unreadMessages, this.handleZendeskUnreadMessages);\r\n },\r\n async openLiveChat() {\r\n try {\r\n this.isLoading = true;\r\n \r\n this.$eventBus.$emit(CHATBOT_EVENTS.openLiveChat);\r\n this.$eventBus.$on(ZENDESK_EVENTS.unreadMessages, this.handleZendeskUnreadMessages);\r\n\r\n await this._chatbotAPI.addZendestTicket(this.userName || '', ChatbotSession.conversation);\r\n }\r\n catch (error) {\r\n handleAxiosError('openLiveChat error:', error);\r\n }\r\n },\r\n\r\n async getCharacterLimitMessage() {\r\n const { data: characterLimitResponse } = await this._chatbotAPI.characterLimitExceeded({\r\n params: {\r\n ...EVENT_BASE_CONFIG,\r\n 'session.id': ChatbotSession.sessionID\r\n }\r\n });\r\n\r\n if (characterLimitResponse.sessionId !== ChatbotSession.sessionID) {\r\n ChatbotSession.sessionID = characterLimitResponse.sessionId;\r\n }\r\n\r\n const output = getOutput(characterLimitResponse);\r\n this.characterLimitMessage = output.text;\r\n },\r\n async handleTransferConverstion(data) {\r\n this._preventUpdateChatHistory = true;\r\n this.conversation = await this.parseSavedConversation(data);\r\n\r\n const hasFeedback = this.conversation.some(message => message.isFeedback);\r\n\r\n if (hasFeedback) {\r\n await this.getFeedback();\r\n }\r\n \r\n this.scrollTo({ duration: 0 });\r\n },\r\n handleCharacterLimitExceeded() {\r\n this.conversation.push({\r\n textHTML: this.characterLimitMessage,\r\n text: this.characterLimitMessage,\r\n isUserInput: false,\r\n key: this.generateGuid()\r\n });\r\n },\r\n\r\n async handleDialogAskQuestion(question) {\r\n try {\r\n // log.info('QUESTION:', question);\r\n\r\n this.pushUserInput(question);\r\n\r\n const { answer } = await this.askQuestion(question);\r\n\r\n await this.handleAnswer(answer);\r\n\r\n await this.checkShowFeedback(answer);\r\n \r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'handleDialogAskQuestion error');\r\n }\r\n },\r\n async askQuestion(question, additionalParams = {}) {\r\n // log.info('Question:', question/*, '\\nAdditional Params', additionalParams*/);\r\n try {\r\n this.isLoading = true;\r\n const askApiParams = {\r\n ...EVENT_BASE_CONFIG,\r\n q: question,\r\n 'session.id': ChatbotSession.sessionID,\r\n 'dim.opening_hours': this._liveChatState,\r\n ...additionalParams\r\n }\r\n\r\n let data = null;\r\n const response = await this._chatbotAPI.ask({\r\n params: askApiParams\r\n });\r\n\r\n //if dialogPath from askApi response is null call stepBackApi\r\n //call stepBackApi when ChatbotSession dialogpath is not undefined.\r\n if (response.data.outputs[0].dialogPath == undefined && ChatbotSession._sessionDialogPath !== undefined) {\r\n await this._chatbotAPI.stepBack({\r\n params: {\r\n 'dialogPath': ChatbotSession.sessionDialogPath,\r\n 'session.id': ChatbotSession.sessionID,\r\n }\r\n });\r\n\r\n //recall askApi to update it's response\r\n const updatedResponse = await this._chatbotAPI.ask({\r\n params: askApiParams\r\n });\r\n data = updatedResponse.data;\r\n } else {\r\n data = response.data;\r\n }\r\n const answer = this._chatbotAPI.handleAPIResponse(data);\r\n\r\n if (!answer) {\r\n // window.alert(`No answer returned from API.\\nResponse:\\n${JSON.stringify(data, null, 2)}`);\r\n return {\r\n answer: {\r\n text: 'Sorry, something has gone wrong',\r\n metadata: {\r\n hideFeedback: 'true'\r\n }\r\n }\r\n };\r\n }\r\n\r\n // await this.checkShowFeedback(answer);\r\n\r\n return { answer, response: response };\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'askQuestion error');\r\n }\r\n finally {\r\n this.isLoading = false;\r\n }\r\n },\r\n async handleAnswer({ text, links = [], type, dialogOptions = [], metadata = {} }) {\r\n // const parsedAnswer = this.addUserCustomizations('Hi {CURRENT_USER}.\\n You have {POLICY_TYPE} insurance,\\n ' + text);\r\n const parsedAnswer = this.addUserCustomizations(text);\r\n\r\n const textHTML = await CxMarkdownToHtml.parseMarkdown({ links, answer: parsedAnswer });\r\n\r\n this.conversation.push({\r\n text,\r\n links,\r\n type,\r\n dialogOptions,\r\n textHTML,\r\n metadata,\r\n isUserInput: false,\r\n key: this.generateGuid()\r\n });\r\n },\r\n async inOpeningHours() {\r\n try {\r\n const response = await this._chatbotAPI.getOpeningHours();\r\n const openingHours = response.data;\r\n ChatbotSession.openingHours = openingHours;\r\n this.setLiveChatState(openingHours);\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'inOpeningHours error');\r\n }\r\n },\r\n setLiveChatState({ StartOfWeek, EndOfWeek, OpeningTime, ClosingTime }) {\r\n const currentDate = new Date();\r\n const dayOfWeak = getDay(currentDate);\r\n let state = dayOfWeak >= StartOfWeek && dayOfWeak <= EndOfWeek;\r\n\r\n if (state) {\r\n state = false;\r\n\r\n const parsedHours = [\r\n ...new Intl.DateTimeFormat('en-GB', { hour: 'numeric', minute: 'numeric', timeZone: 'America/Toronto' }).format(currentDate).split(\":\"),\r\n ...OpeningTime.split(\":\"),\r\n ...ClosingTime.split(\":\")]\r\n .map(value => parseInt(value));\r\n\r\n const [\r\n hours,\r\n minutes,\r\n openingHours,\r\n openingMinutes,\r\n closingHours,\r\n closingMinutes\r\n ] = parsedHours;\r\n\r\n switch (true) {\r\n case hours > openingHours && closingHours > hours:\r\n state = true;\r\n break;\r\n case hours === openingHours && hours === closingHours && minutes > openingMinutes && minutes < closingMinutes:\r\n state = true;\r\n break;\r\n case hours === openingHours && hours !== closingHours && minutes > openingMinutes:\r\n state = true;\r\n break;\r\n case hours === closingHours && hours !== openingHours && minutes < closingMinutes:\r\n state = true;\r\n break;\r\n }\r\n }\r\n\r\n this._liveChatState = state ? \"open\" : \"closed\";\r\n },\r\n pushUserInput(text) {\r\n this.conversation.push({\r\n text,\r\n isUserInput: true,\r\n key: this.generateGuid(),\r\n type: 'question'\r\n });\r\n },\r\n\r\n async checkShowFeedback(output) {\r\n const isArray = Array.isArray(output);\r\n const dialogOptionsPath = isArray ? '[0].dialogOptions' : 'dialogOptions';\r\n const dialogOptions = _get(output, dialogOptionsPath, []);\r\n\r\n // console.log(output, 'DIALOG_OPTIONS:', dialogOptions);\r\n\r\n // NOTE 2022-12-02 AndrewKim: When the answer contains dialog options, do not ask for feedback\r\n if (dialogOptions.length) {\r\n this.hideFeedback();\r\n return;\r\n }\r\n\r\n const metadataPath = isArray ? '[0].metadata' : 'metadata';\r\n const metadata = _get(output, metadataPath, {});\r\n const showFeedback = 'hideFeedback' in metadata ?\r\n metadata.hideFeedback !== 'true' :\r\n true;\r\n\r\n if (showFeedback) {\r\n this._interactionID = ChatbotSession.interactionID;\r\n await this.getFeedback();\r\n await this.pushFeedback();\r\n }\r\n else {\r\n this.hideFeedback();\r\n }\r\n },\r\n async pushFeedback() {\r\n this.hideFeedback();\r\n\r\n // Delay showing of feedback so that user has time to read answer\r\n await wait(2000);\r\n\r\n this.conversation.push({\r\n isFeedback: true,\r\n key: 'feedback',\r\n type: 'feedback'\r\n });\r\n },\r\n hideFeedback() {\r\n this.conversation = this.conversation.filter(({ isFeedback }) => !isFeedback);\r\n },\r\n async getFeedback() {\r\n try {\r\n const { data } = await this._chatbotAPI.showFeedback({\r\n params: {\r\n ...EVENT_BASE_CONFIG,\r\n 'session.id': ChatbotSession.sessionID\r\n }\r\n });\r\n\r\n const feedback = getOutput(data);\r\n\r\n // const dialogPath = getDialogPath(data);\r\n // this._sessionDialogPath = dialogPath ? dialogPath : this._sessionDialogPath; // if there is no dialogpath, keep previous value\r\n //ChatbotSession.sessionDialogPath = getDialogPath(data);\r\n\r\n this.sendFeedbackHTML = await CxMarkdownToHtml.parseMarkdown({ answer: feedback.text });\r\n this.sendFeedbackDialogOptions = feedback.dialogOptions;\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'getFeedback error:');\r\n }\r\n },\r\n\r\n /* Sending feedback\r\n Yes - score = 5, label = yes, comment = Yes\r\n 1. send answer to ask endpoint, render response (feedback score is inside of metadata)\r\n 2. send feedback to feedback endpoint\r\n N0 - score = -1, label = no, comment = No, connect me with an agent\r\n 1. send answer (content of button) to ask endpoint, render response (feedback score is inside of metadata)\r\n 2. send feedback to feedback endpoint\r\n */\r\n async sendFeedback(selectedFeedbackText) {\r\n try {\r\n this.hideFeedback();\r\n\r\n // 1. set selected feedback as user input\r\n this.pushUserInput(selectedFeedbackText);\r\n\r\n //Retrieve FeedbackDialog Path if feedback is \"yes\" or \"no\"\r\n const { data } = await this._chatbotAPI.showFeedback({\r\n params: {\r\n ...EVENT_BASE_CONFIG,\r\n 'session.id': ChatbotSession.sessionID\r\n }\r\n });\r\n const feedbackDialogPath = getDialogPath(data);\r\n ChatbotSession.sessionDialogPath = feedbackDialogPath;\r\n \r\n \r\n // 2. Ask question using button label content for feedback.\r\n // response from API will have metadata object, with 'feedbackScore'.\r\n const { answer } = await this.askQuestion(\r\n selectedFeedbackText,\r\n { 'session.dialogPath': ChatbotSession.sessionDialogPath }\r\n );\r\n\r\n const metadata = _get(answer, 'metadata', { feedbackScore: 0 });\r\n const score = Number(metadata.feedbackScore || 0);\r\n\r\n // console.log('SCORE:', score);\r\n\r\n await this.handleAnswer(answer);\r\n\r\n await this.checkShowFeedback(answer);\r\n\r\n // 3. Send the feedback\r\n await this._chatbotAPI.sendFeedback({\r\n originInteractionId: this._interactionID,\r\n score: score,\r\n label: score <= 0 ? 'no' : 'yes',\r\n comment: selectedFeedbackText,\r\n 'session.id': ChatbotSession.sessionID\r\n });\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'sendFeedback error');\r\n }\r\n },\r\n\r\n async handleSubmit() {\r\n try {\r\n if (!this.userInput.length) return;\r\n\r\n this.pushUserInput(this.userInput);\r\n\r\n if (this.hasInputReachedLimit) {\r\n this.handleCharacterLimitExceeded();\r\n }\r\n else {\r\n const { answer } = await this.askQuestion(this.userInput);\r\n\r\n await this.handleAnswer(answer);\r\n\r\n await this.checkShowFeedback(answer);\r\n }\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'handleSubmit error:');\r\n }\r\n finally {\r\n this.userInput = '';\r\n }\r\n },\r\n\r\n scrollTo({ scrollTop, duration = 0.5 } = {}) {\r\n const { container } = this.$refs;\r\n const { scrollHeight, offsetHeight } = container;\r\n\r\n if (typeof scrollTop === 'number' && scrollTop > container.scrollTop) return;\r\n\r\n if (scrollHeight > offsetHeight) {\r\n gsap.to(container, {\r\n duration,\r\n scrollTop: typeof scrollTop === 'number' ?\r\n scrollTop :\r\n scrollHeight - offsetHeight,\r\n ease: 'sine.out'\r\n });\r\n }\r\n },\r\n\r\n async onLoaderEnter(el, done) {\r\n ChatbotTransitionsHandler.onLoaderEnter({\r\n el,\r\n onStart: () => {\r\n this.scrollTo();\r\n },\r\n onComplete: () => {\r\n done();\r\n }\r\n });\r\n },\r\n\r\n onLoaderLeave(el, done) {\r\n ChatbotTransitionsHandler.onLoaderLeave({\r\n el,\r\n onComplete: () => {\r\n this.scrollTo();\r\n done();\r\n }\r\n });\r\n },\r\n\r\n open() {\r\n this.$eventBus.$emit(CHATBOT_EVENTS.open);\r\n },\r\n close() {\r\n this.$eventBus.$emit(CHATBOT_EVENTS.close);\r\n },\r\n\r\n scrollToField(event) {\r\n const labelFor = event.currentTarget.dataset.scrollToField;\r\n const labelEl = document.querySelector(`[for=\"${labelFor}\"]`);\r\n\r\n if (!labelEl) return;\r\n\r\n // On phone we need to close the chatbot, as the user won't be able to see the field.\r\n if (this.isPhone) this.close();\r\n\r\n const top = getElementTop(labelEl) - this.navHeaderHeight;\r\n\r\n gsap.to(document.scrollingElement, {\r\n scrollTop: top,\r\n duration: 0.6,\r\n ease: 'power3.out'\r\n });\r\n }\r\n },\r\n template: `\r\n <transition name=\"chatbot\" appear>\r\n <!-- NOTE 2022-11-17 AndrewKim: stop propagation of events for proactive chatbot listeners -->\r\n <div class=\"o-chatbot\" v-show=\"isActive && !isLoadingSession\" @click.stop=\"\" @touchstart.stop=\"\">\r\n <div class=\"o-chatbot__contentContainer\">\r\n \r\n <chatbot-header class=\"o-chatbot__header\" @close=\"close\" />\r\n \r\n <div class=\"o-chatbot__conversationContainer\" ref=\"container\">\r\n \r\n <template v-if=\"conversation.length\">\r\n \r\n <div\r\n v-for=\"(message) of conversation\"\r\n :key=\"message.key\"\r\n :class=\"[ 'o-chatbot__messageContainer', { '-right' : message.isUserInput, '-feedback': message.isFeedback }]\"\r\n >\r\n <chat-question\r\n v-if=\"message.isUserInput\"\r\n :text=\"message.text\"\r\n :disable-transition=\"message.disableTransition\"\r\n />\r\n\r\n <chat-feedback\r\n v-else-if=\"message.isFeedback\"\r\n v-bind=\"sendFeedbackProps\"\r\n :disable-transition=\"message.disableTransition\"\r\n @send-feedback=\"sendFeedback\"\r\n />\r\n\r\n <chat-answer\r\n v-else\r\n :answer=\"message.textHTML\"\r\n :dialog-options=\"message.dialogOptions\"\r\n :disable-transition=\"message.disableTransition\"\r\n @ask-question=\"handleDialogAskQuestion\"\r\n @open-live-chat=\"openLiveChat\"\r\n @scroll-to-field=\"scrollToField\"\r\n />\r\n </div>\r\n\r\n <transition :css=\"false\" @enter=\"onLoaderEnter\" @leave=\"onLoaderLeave\" name=\"\" appear>\r\n <chat-message-loader v-if=\"isLoading\" />\r\n </transition>\r\n </template>\r\n </div>\r\n \r\n <chatbot-input-field\r\n v-model=\"userInput\"\r\n @submit.native.prevent=\"handleSubmit\"\r\n @field-submit=\"handleSubmit\"\r\n :max-input-length=\"maxInputLength\"\r\n class=\"o-chatbot__inputContainer\"\r\n />\r\n </div>\r\n </div>\r\n </transition>`\r\n};\r\n","import { log } from './logging';\r\nimport EventBus from '@Shared/utils/event-bus';\r\nimport { ZENDESK_EVENTS } from './event-names';\r\nimport { ZendeskSession } from './ZendeskSession';\r\n\r\nconst noop = () => {};\r\n\r\n// This utility class is used to interact with Zendesk's Web Widget (Classic).\r\n// I've added only the core commands for what is required.\r\n// Documentation on all commands is available here: https://developer.zendesk.com/api-reference/widget/core/\r\n\r\n// NOTE 2023-01-03 AndrewKim: Migrating to Zendesk Messenger has broken functionality.\r\n// Messenger API is far more limited than the WebWidget API. Features like prefilling, custom settings, and many events\r\n// are no longer available.\r\n// Any features still available in Messenger have been refactored to use 'messenger' instead of 'webWidget'.\r\n// Any features not available in Messenger have been left as is, and usages have been commented out.\r\n// IMPORTANT: Messenger only works on TEST, ACC, and PROD. WebWidget only works on DEV, and local DEV.\r\n\r\nclass ZendeskWidget extends ZendeskSession {\r\n // set widget(val) {\r\n // this._widget = val;\r\n // }\r\n get zE() {\r\n if (!window.zE) {\r\n console.log(...log.redBold('zE not loaded'));\r\n }\r\n\r\n return window.zE || noop;\r\n }\r\n\r\n get isHidden() {\r\n return this.zE('messenger:get', 'display') === 'hidden';\r\n }\r\n \r\n set isConnected(val) {\r\n this._isConnected = val;\r\n }\r\n get isConnected() {\r\n return this._isConnected;\r\n }\r\n \r\n /**\r\n * NOTE 2022-12-16 AndrewKim: Current z index has to be tracked to not set it multiple times.\r\n * There is a bug with Zendesk's Web Widget (Sunshine/Conversations) API, where setting z index triggers onOpen or onClose event, resulting in an infinite loop.\r\n */\r\n set currentZIndex(val) {\r\n this._currentZIndex = val;\r\n }\r\n get currentZIndex() {\r\n return this._currentZIndex;\r\n }\r\n init() {\r\n this\r\n .onChatConnected(async () => {\r\n log.success('ZE connected');\r\n EventBus.$emit(ZENDESK_EVENTS.connected);\r\n })\r\n // .onChatStatus((status) => {\r\n // log.info('ZE status', status);\r\n // })\r\n .onOpen(() => {\r\n // log.info('ZE opened');\r\n EventBus.$emit(ZENDESK_EVENTS.open);\r\n // this.showMessengerButton();\r\n \r\n // NOTE 2022-12-16 AndrewKim: There is a bug with Zendesk's Web Widget (Sunshine/Conversations) API, where\r\n // setting z index 100 triggers onOpen event, resulting in an infinite loop.\r\n if (this.currentZIndex !== 100) {\r\n this.currentZIndex = 100;\r\n this.zE('messenger:set', 'zIndex', this.currentZIndex);\r\n }\r\n })\r\n .onClose(async () => {\r\n \r\n log.info('ZE closed');\r\n \r\n // if (this.isSettingZIndex) return;\r\n \r\n EventBus.$emit(ZENDESK_EVENTS.closed);\r\n\r\n // this.isSettingZIndex = true;\r\n \r\n // NOTE 2022-12-16 AndrewKim: There is a bug with Zendesk's Web Widget (Sunshine/Conversations) API, where\r\n // setting z index -1 triggers onClose event, resulting in an infinite loop.\r\n if (this.currentZIndex !== -1) {\r\n this.currentZIndex = -1;\r\n this.zE('messenger:set', 'zIndex', this.currentZIndex);\r\n }\r\n })\r\n .onUnreadMessages((count) => {\r\n if (count === 1) {\r\n EventBus.$emit(ZENDESK_EVENTS.unreadMessages);\r\n }\r\n });\r\n // .onChatEnd(() => {\r\n // log.info('ZE ended');\r\n // EventBus.$emit(ZENDESK_EVENTS.disconnected);\r\n // });\r\n\r\n this.hasActivated = true;\r\n }\r\n\r\n /**\r\n * This event will only work with Zendesk Web Widget (Classic)\r\n */\r\n onChatConnected(callback = noop) {\r\n // this.zE('webWidget:on', 'chat:connected', () => {\r\n // // log.success('chat:connected');\r\n // callback();\r\n // });\r\n if (this.isConnected) {\r\n callback();\r\n }\r\n else {\r\n EventBus.$on('messenger:connected', () => {\r\n log.success('chat:connected');\r\n \r\n this.isConnected = true;\r\n \r\n callback();\r\n });\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * This event will only work with Zendesk Web Widget (Classic)\r\n */\r\n onChatEnd(callback = noop) {\r\n this.zE('webWidget:on', 'chat:end', () => {\r\n // console.log('chat:end');\r\n callback();\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * This event will only work with Zendesk Web Widget (Classic)\r\n */\r\n onChatStatus(callback = noop) {\r\n this.zE('webWidget:on', 'chat:status', (status) => {\r\n // console.log('STATUS:', status);\r\n callback(status);\r\n });\r\n return this;\r\n }\r\n\r\n onOpen(callback = noop) {\r\n this.zE('webWidget:on', 'open', () => {\r\n this.hasOpened = true;\r\n callback();\r\n });\r\n return this;\r\n }\r\n\r\n onClose(callback = noop) {\r\n this.zE('webWidget:on', 'close', () => {\r\n this.hasOpened = false;\r\n callback();\r\n });\r\n return this;\r\n }\r\n\r\n onUnreadMessages(callback = noop) {\r\n this.zE('webWidget:on', 'unreadMessages', (count) => {\r\n callback(count);\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * This event will only work with Zendesk Web Widget (Classic)\r\n */\r\n onUserEvent(callback = noop) {\r\n this.zE('webWidget:on', 'userEvent', (event) => {\r\n // console.group('ZE: UserEvent');\r\n // log.info('Category: ', event.category);\r\n // log.info('Action: ', event.action);\r\n // log.info('Properties:', event.properties);\r\n // console.groupEnd();\r\n callback(event);\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * This method will only work with Zendesk Web Widget (Classic)\r\n */\r\n hide() {\r\n // Hides all parts of the widget from the page. You can invoke it before or after page load.\r\n this.zE('webWidget', 'hide');\r\n return this;\r\n }\r\n\r\n /**\r\n * This method will only work with Zendesk Web Widget (Classic)\r\n */\r\n show() {\r\n // Displays the widget on the host page in the state it was in before it was hidden.\r\n //\r\n // The widget is displayed by default on page load. You don't need to call show to display the widget unless you\r\n // use hide.\r\n this.zE('webWidget', 'show');\r\n return this;\r\n }\r\n\r\n close() {\r\n // If the widget is opened, this command closes the widget and shows the launcher.\r\n this.zE('webWidget', 'close');\r\n return this;\r\n }\r\n\r\n open() {\r\n // Forces the widget to open.\r\n this.zE('webWidget', 'open');\r\n return this;\r\n }\r\n\r\n /**\r\n * This method will only work with Zendesk Web Widget (Classic)\r\n */\r\n updateSettings(settings = {}) {\r\n this.zE('webWidget', 'updateSettings', settings);\r\n return this;\r\n }\r\n\r\n /**\r\n * This method will only work with Zendesk Web Widget (Classic)\r\n */\r\n prefill(details = {}) {\r\n // Pre-fills an end-user's details on forms inside the Web Widget.\r\n this.zE('webWidget', 'prefill', details);\r\n return this;\r\n }\r\n}\r\n\r\nexport default new ZendeskWidget();\r\n","const magenta = '#930093';\r\nconst fuchsia = '#ff00ff';\r\nconst textColor = '#555555';\r\n\r\nexport const ZENDESK_WIDGET_SETTINGS = {\r\n webWidget: {\r\n position: {\r\n horizontal: 'right',\r\n vertical: 'bottom'\r\n },\r\n offset: {\r\n horizontal: '30px',\r\n vertical: '30px',\r\n mobile: {\r\n horizontal: '0px',\r\n vertical: '0px'\r\n }\r\n },\r\n navigation: {\r\n popoutButton: {\r\n enabled: false\r\n }\r\n },\r\n contactOptions: {\r\n enabled: true,\r\n contactFormLabel: {\r\n '*': 'Leave us a message'\r\n },\r\n chatLabelOffline: {\r\n '*': 'Chat is unavailable'\r\n }\r\n },\r\n \r\n // contactForm: {\r\n // title: { '*': 'Leave us a message' }\r\n // },\r\n \r\n zIndex: 6\r\n \r\n // NOTE 2022-11-08 AndrewKim: Only customize size and positioning. Anouk will customize colours/styling on Web portal\r\n // color: {\r\n // theme: '#fff',\r\n // themeText: textColor,\r\n // launcher: magenta, // This will also update the badge\r\n // launcherText: '#000',\r\n // button: fuchsia,\r\n // resultLists: magenta,\r\n // header: '#fff',\r\n // articleLinks: magenta\r\n // }\r\n }\r\n};\r\n","import axios from 'axios';\r\nimport api from '@Shared/mixins/api';\r\nimport { ZENDESK_CONFIG } from '@Shared/settings';\r\nimport { loadScript } from '@Shared/utils/load-script';\r\nimport { CHATBOT_EVENTS } from '../utils/event-names';\r\nimport ZendeskWidget from '../utils/ZendeskWidget';\r\nimport { ZENDESK_WIDGET_SETTINGS } from '../utils/zendesk-widget-settings';\r\nimport { handleAxiosError, log } from '../utils/logging';\r\n\r\nimport { TransferSessionStorage, TRANSFER_EVENTS } from \"../utils/TransferSessionStorage\";\r\n\r\nexport default {\r\n name: 'zendesk-live-chat',\r\n mixins: [ api ],\r\n props: {\r\n chatUrl: {\r\n type: String,\r\n default: ''\r\n }\r\n },\r\n\r\n created() {\r\n this._hasLoadedZendesk = false;\r\n\r\n window.zESettings = ZENDESK_WIDGET_SETTINGS;\r\n\r\n this.$eventBus.$on(CHATBOT_EVENTS.openLiveChat, this.handleLiveChatOpenEvent);\r\n },\r\n mounted() {\r\n this.init();\r\n },\r\n beforeDestroy() {\r\n this.$eventBus.$off(CHATBOT_EVENTS.openLiveChat, this.handleLiveChatOpenEvent);\r\n },\r\n\r\n methods: {\r\n init() {\r\n // const isActiveZD = zendeskSessionUtils.checkUserHasActivatedZendesk();\r\n // if (ZendeskWidget.hasActivated) {\r\n if (ZendeskWidget.hasOpened) {\r\n this.openZenChat();\r\n }\r\n },\r\n\r\n open() {\r\n ZendeskWidget.open();\r\n },\r\n\r\n hide() {\r\n // Close Zendesk\r\n // zE('webWidget', 'hide');\r\n ZendeskWidget.hide();\r\n\r\n // this.setUserHasActivatedZD(false);\r\n // ZendeskWidget.hasActivated = false;\r\n },\r\n async initZenChat() {\r\n await loadScript({ id: ZENDESK_CONFIG.scriptId, url: this.chatUrl });\r\n \r\n ZendeskWidget.init();\r\n\r\n this.$eventBus.$emit('messenger:connected');\r\n\r\n this._hasLoadedZendesk = true;\r\n\r\n this.$emit('loaded');\r\n },\r\n\r\n /**\r\n * This method will only work with Zendesk Web Widget (Classic)\r\n */\r\n async prefillUserData() {\r\n try {\r\n const { data } = await axios.post(this.api.getUserInfo);\r\n\r\n const { FirstName = '', LastName = '', EmailAddress = '', Phone = '' } = data;\r\n\r\n // Prefill user details\r\n // Fields will only be readonly of corresponding user data is available\r\n ZendeskWidget.prefill({\r\n name: {\r\n value: `${FirstName} ${LastName}`,\r\n readOnly: Boolean(FirstName && LastName)\r\n },\r\n email: {\r\n value: EmailAddress,\r\n readOnly: Boolean(EmailAddress)\r\n },\r\n phone: {\r\n value: Phone,\r\n readOnly: Boolean(Phone)\r\n }\r\n });\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'prefillUserData error:');\r\n }\r\n },\r\n async setZenChat() {\r\n try {\r\n // await this.prefillUserData();\r\n\r\n if (ZendeskWidget.hasOpened) {\r\n ZendeskWidget.open();\r\n }\r\n\r\n // ZendeskWidget.hasActivated = true;\r\n }\r\n catch (error) {\r\n log.error('Zendesk prefill user data error:', error);\r\n }\r\n },\r\n\r\n setEventListeners() {\r\n ZendeskWidget.onChatConnected(() => {\r\n // console.log('setEventListeners: onChatConnected');\r\n ZendeskWidget.open();\r\n });\r\n\r\n // ZendeskWidget.onChatEnd(this.hide);\r\n\r\n // ZendeskWidget.onClose(() => {\r\n // ZendeskWidget.hide();\r\n // });\r\n\r\n // NOTE 2022-12-16 AndrewKim: Only Zendesk Widget (Classic) supports this.\r\n // ZendeskWidget.onUserEvent(this.handleUserEvent);\r\n },\r\n\r\n handleUserEvent(event) {\r\n switch (event.action) {\r\n case 'Contact Form Submitted':\r\n this.hide();\r\n break;\r\n case 'Web Widget Opened':\r\n ZendeskWidget.hasOpened = true;\r\n break;\r\n case 'Web Widget Minimised':\r\n ZendeskWidget.hasOpened = false;\r\n break;\r\n default:\r\n // console.log('Not handling action: ', event.action);\r\n break;\r\n }\r\n },\r\n\r\n // Event emitted from Chatbot to activate livechat\r\n async handleLiveChatOpenEvent(callback) {\r\n // if (ZendeskWidget.hasActivated) {\r\n if (this._hasLoadedZendesk) {\r\n ZendeskWidget.open();\r\n\r\n // console.log('Show and Open');\r\n\r\n (typeof callback === 'function' && callback());\r\n return;\r\n }\r\n\r\n await this.openZenChat(callback);\r\n },\r\n\r\n async openZenChat() {\r\n try {\r\n // ZendeskWidget.onChatConnected(() => {\r\n // console.log('setEventListeners: onChatConnected');\r\n // ZendeskWidget.open();\r\n // });\r\n \r\n await this.initZenChat();\r\n\r\n this.setEventListeners();\r\n\r\n // ZendeskWidget.onClose(() => {\r\n // ZendeskWidget.hide();\r\n // });\r\n\r\n await this.setZenChat();\r\n\r\n TransferSessionStorage.on(TRANSFER_EVENTS.liveChatClose, () => {\r\n ZendeskWidget.close();\r\n })\r\n }\r\n catch (error) {\r\n handleAxiosError(error, 'openZenChat error:');\r\n }\r\n }\r\n\r\n },\r\n render() {\r\n return null;\r\n }\r\n};\r\n","import Vue from 'vue';\r\n\r\nVue.component('chat-bot', () => import(/* webpackChunkName: 'components.chat-bot' */ './components/chatbot'));\r\nVue.component('zendesk-live-chat', () => import(/* webpackChunkName: 'components.zendesk-live-chat' */ './components/zendesk-live-chat'));\r\nVue.component('chat-container', () => import(/* webpackChunkName: 'components.chat-container' */ './components/chat-container'));\r\n","import { ZendeskSession } from './ZendeskSession';\r\n\r\nconst SESSION_HAS_OPENED_KEY = 'CHATBOT_OPENED';\r\nconst SESSION_CONVERSATION_KEY = 'CHATBOT_CONVERSATION';\r\nconst SESSION_ID_KEY = 'CHATBOT_SESSION_ID';\r\nconst OPENING_HOURS = 'OPENING_HOURS';\r\n\r\nexport class ChatbotSession extends ZendeskSession {\r\n static get isOpenEmpty() {\r\n return !sessionStorage.getItem(SESSION_HAS_OPENED_KEY);\r\n }\r\n static get isOpenFromStore() {\r\n return sessionStorage.getItem(SESSION_HAS_OPENED_KEY) === 'true';\r\n }\r\n static set isOpen(isOpen) {\r\n sessionStorage.setItem(SESSION_HAS_OPENED_KEY, isOpen);\r\n this._isOpen = isOpen;\r\n }\r\n static get isOpen() {\r\n if (typeof this._isOpen !== 'boolean') {\r\n this._isOpen = sessionStorage.getItem(SESSION_HAS_OPENED_KEY) === 'true';\r\n }\r\n return this._isOpen;\r\n }\r\n \r\n static set conversation(val) {\r\n if (!this._loggedIn) {\r\n sessionStorage.setItem(SESSION_CONVERSATION_KEY, JSON.stringify(val));\r\n }\r\n \r\n this._conversation = val;\r\n }\r\n static get conversation() {\r\n if (typeof this._conversation !== 'object' && !this._loggedIn) {\r\n this._conversation = JSON.parse(sessionStorage.getItem(SESSION_CONVERSATION_KEY));\r\n }\r\n return this._conversation;\r\n }\r\n\r\n static set openingHours(val) {\r\n sessionStorage.setItem(OPENING_HOURS, JSON.stringify(val));\r\n this._openingHours = val;\r\n }\r\n\r\n static get openingHours() {\r\n if (typeof this._openingHours !== 'object') {\r\n this._openingHours = JSON.parse(sessionStorage.getItem(OPENING_HOURS));\r\n }\r\n return this._openingHours;\r\n }\r\n\r\n static set sessionID(val) {\r\n this._sessionID = val;\r\n\r\n if (!this._loggedIn) {\r\n sessionStorage.setItem(SESSION_ID_KEY, val);\r\n }\r\n }\r\n static get sessionID() {\r\n if (!this._sessionID && !this._loggedIn) {\r\n this._sessionID = sessionStorage.getItem(SESSION_ID_KEY) || '';\r\n }\r\n return this._sessionID;\r\n }\r\n\r\n static get isSessionActive() {\r\n return Boolean(this.sessionID);\r\n }\r\n\r\n static set sessionDialogPath(val) {\r\n if (val) {\r\n this._sessionDialogPath = val;\r\n }\r\n }\r\n static get sessionDialogPath() {\r\n return this._sessionDialogPath;\r\n }\r\n \r\n static set interactionID(val) {\r\n if (val) {\r\n this._interactionID = val;\r\n }\r\n }\r\n static get interactionID() {\r\n return this._interactionID;\r\n }\r\n\r\n static set loggedIn(val) {\r\n this._loggedIn = val;\r\n }\r\n}\r\n","\r\nexport const TRANSFER_EVENTS = {\r\n transferAll: 'transferEvent:transferAll',\r\n receiveAll: 'transferEvent:receiveAll',\r\n closeOther: 'transferEvent:closeOther',\r\n openOther: 'transferEvent:openOther',\r\n closeOtherDialog: 'transferEvent:closeOtherDialog',\r\n openOtherDialog: 'transferEvent:openOtherDialog',\r\n transferConversation: 'transferEvent:conversation',\r\n transferLiveChat: 'transferEvent:liveChat',\r\n openLiveChat: 'transferEvent:openLiveChat',\r\n liveChatOpened: 'transferEvent:liveChatOpened',\r\n liveChatClose: 'transferEvent:liveChatClose'\r\n};\r\n\r\n\r\nconst getTabId = () => {\r\n if (window.crypto && window.crypto.randomUUID) {\r\n return window.crypto.randomUUID();\r\n } else {\r\n return Math.random();\r\n }\r\n}\r\n\r\nconst events = {};\r\nconst tabId = getTabId();\r\nlet resolveInstance;\r\nlet liveChatResolveInstance;\r\n\r\nconst saveInSessingStorage = (data) => {\r\n for (const key in data) {\r\n if (!sessionStorage.getItem(key)) {\r\n sessionStorage.setItem(key, data[key]);\r\n }\r\n }\r\n}\r\n\r\nconst transferSession = (event) => {\r\n //Adding try-catch to capture parse exceptions for utils like Usabilla\r\n let eventData;\r\n try {\r\n eventData = JSON.parse(event.newValue);\r\n } catch (error) {\r\n return;\r\n }\r\n\r\n if ((!eventData || !eventData.tabId || eventData.tabId === tabId)) {\r\n return;\r\n }\r\n\r\n switch (event.key) {\r\n case TRANSFER_EVENTS.transferAll:\r\n transferSessionStoregeAllKeys(TRANSFER_EVENTS.receiveAll);\r\n break;\r\n case TRANSFER_EVENTS.receiveAll:\r\n saveInSessingStorage(eventData.data);\r\n if (resolveInstance) {\r\n resolveInstance(\"success\");\r\n }\r\n\r\n break;\r\n case TRANSFER_EVENTS.closeOther:\r\n case TRANSFER_EVENTS.openOther:\r\n case TRANSFER_EVENTS.closeOtherDialog:\r\n case TRANSFER_EVENTS.openOtherDialog:\r\n case TRANSFER_EVENTS.transferConversation:\r\n case TRANSFER_EVENTS.liveChatClose:\r\n if (events[event.key]) {\r\n events[event.key](eventData.data);\r\n }\r\n\r\n break;\r\n case TRANSFER_EVENTS.liveChatOpened:\r\n if (liveChatResolveInstance) {\r\n liveChatResolveInstance(eventData.tabId);\r\n }\r\n\r\n break;\r\n case TRANSFER_EVENTS.transferLiveChat:\r\n if (eventData.data.id === tabId) {\r\n transferSessionStoregeAllKeys(TRANSFER_EVENTS.openLiveChat);\r\n }\r\n break;\r\n case TRANSFER_EVENTS.openLiveChat:\r\n saveInSessingStorage(eventData.data);\r\n\r\n if (events[event.key]) {\r\n events[event.key]();\r\n }\r\n\r\n break;\r\n }\r\n}\r\n\r\nconst eventHandler = (event) => transferSession(event);\r\n\r\nconst eventData = (data) => {\r\n return JSON.stringify({\r\n tabId,\r\n data\r\n });\r\n}\r\n\r\nconst transferSessionStoregeAllKeys = (event) => {\r\n localStorage.setItem(event, eventData(sessionStorage));\r\n localStorage.removeItem(event);\r\n}\r\n\r\nexport class TransferSessionStorage {\r\n\r\n static init() {\r\n window.addEventListener(\"storage\", eventHandler);\r\n }\r\n\r\n static destroy() {\r\n window.removeEventListener(\"storage\", eventHandler);\r\n }\r\n\r\n static transferAll() {\r\n return new Promise((resolve) => {\r\n resolveInstance = resolve;\r\n localStorage.setItem(TRANSFER_EVENTS.transferAll, eventData());\r\n localStorage.removeItem(TRANSFER_EVENTS.transferAll);\r\n })\r\n }\r\n\r\n static liveChatOpened() {\r\n return new Promise((resolve) => {\r\n liveChatResolveInstance = resolve;\r\n })\r\n }\r\n\r\n static on(event, callback) {\r\n events[event] = callback;\r\n }\r\n\r\n static triggerEvent(key, data) {\r\n localStorage.setItem(key, eventData(data));\r\n localStorage.removeItem(key);\r\n }\r\n}","import { ZENDESK_CONFIG } from '@Shared/settings';\r\n\r\nexport class ZendeskSession {\r\n set hasActivated(isActive) {\r\n sessionStorage.setItem(ZENDESK_CONFIG.sessionStorageActiveKey, isActive.toString());\r\n }\r\n get hasActivated() {\r\n const isActive = sessionStorage.getItem(ZENDESK_CONFIG.sessionStorageActiveKey);\r\n return isActive === 'true';\r\n }\r\n \r\n set hasOpened(isOpen) {\r\n sessionStorage.setItem(ZENDESK_CONFIG.sessionStorageOpenKey, isOpen.toString());\r\n }\r\n get hasOpened() {\r\n const isOpen = sessionStorage.getItem(ZENDESK_CONFIG.sessionStorageOpenKey);\r\n return isOpen === 'true';\r\n }\r\n}\r\n","/**\r\n * Event names used with $eventBus\r\n */\r\n\r\nexport const ZENDESK_EVENTS = {\r\n loaded: 'zendesk:loaded',\r\n open: 'zendesk:open',\r\n closed: 'zendesk:closed',\r\n connected: 'zendesk:connected',\r\n disconnected: 'zendesk:disconnected',\r\n unreadMessages: 'zendesk:unreadMessages',\r\n};\r\n\r\nexport const CHATBOT_EVENTS = {\r\n open: 'chatbot:open',\r\n close: 'chatbot:close',\r\n openLiveChat: 'chatbot:open-live-chat'\r\n};\r\n","/* eslint no-console: off */\r\nimport { IS_DEV } from '@Shared/settings';\r\n\r\nconst noop = () => {};\r\n\r\nconst colors = {\r\n info: '#40c4ff',\r\n success: '#69f0ae',\r\n error: '#ff6e40',\r\n warn: '#ffde03'\r\n};\r\n\r\nconst consoleLog = (type, label, ...args) => {\r\n if (!args || !args.length) {\r\n return console.log(`%c ${label}`, `color: ${colors[ type ]}; font-weight: bold;`);\r\n }\r\n\r\n console.group(`%c ${label}`, `color: ${colors[ type ]}; font-weight: bold;`);\r\n\r\n for (const arg of args) {\r\n if (typeof arg === 'string' || typeof arg === 'number') {\r\n console.log(arg);\r\n }\r\n else if (arg instanceof HTMLElement) {\r\n console.dir(arg);\r\n }\r\n // else if (Array.isArray(arg)) {\r\n // console.table(arg);\r\n // }\r\n else if (typeof arg === 'object') {\r\n console.table(arg);\r\n }\r\n else {\r\n console.log(arg);\r\n }\r\n }\r\n\r\n console.groupEnd();\r\n};\r\n\r\nconst loggerProd = {\r\n error: noop,\r\n warn: noop,\r\n info: noop,\r\n success: noop\r\n};\r\n\r\nconst logger = {\r\n // error : (...args) => console.log(chalk.redBright.bold(...args)),\r\n // error: (label, ...args) => console.log(`%c ${label}:\\n`, 'color: #FF6E40; font-weight: bold;', ...args),\r\n // warn: (label, ...args) => console.log(`%c ${label}:\\n`, 'color: #EEFF41; font-weight: bold;', ...args),\r\n // info: (label, ...args) => console.log(`%c ${label}:\\n`, 'color: #40C4FF; font-weight: bold;', ...args),\r\n // success: (label, ...args) => console.log(`%c ${label}:\\n`, 'color: #69F0AE; font-weight: bold;', ...args)\r\n error: (...args) => consoleLog('error', ...args),\r\n warn: (...args) => consoleLog('warn', ...args),\r\n info: (...args) => consoleLog('info', ...args),\r\n success: (...args) => consoleLog('success', ...args),\r\n\r\n blueBold: (str, ...rest) => [`%c ${str}`, `color: ${colors.info}; font-weight: bold;`, ...rest],\r\n greenBold: (str, ...rest) => [`%c ${str}`, `color: ${colors.success}; font-weight: bold;`, ...rest],\r\n yellowBold: (str, ...rest) => [`%c ${str}`, `color: ${colors.warn}; font-weight: bold;`, ...rest],\r\n redBold: (str, ...rest) => [`%c ${str}`, `color: ${colors.error}; font-weight: bold;`, ...rest]\r\n};\r\n\r\nexport const log = IS_DEV ? logger : loggerProd;\r\n\r\nexport const handleAxiosError = (error, label = '') => {\r\n const { response, request } = error;\r\n\r\n if (response) {\r\n console.group(...log.redBold(`Axios Error at ${label}`));\r\n log.info('Request made and server responded');\r\n log.error(`${response.statusText} ${response.status}`);\r\n log.error('Message', response.data);\r\n log.error('Config', response.config);\r\n log.error('Headers', response.headers);\r\n }\r\n else if (request) {\r\n console.group(...log.redBold(`Axios Error at ${label}`));\r\n log.info('The request was made but no response was received');\r\n log.error('Request', request);\r\n }\r\n else {\r\n console.group(...log.redBold(`Error at ${label}`));\r\n // log.info('Something happened in setting up the request that triggered an Error');\r\n log.error(error);\r\n console.trace();\r\n }\r\n\r\n console.groupEnd();\r\n\r\n // throw error; // Have parent catch error\r\n};\r\n"],"names":["name","props","dialogTitle","type","String","dialogText","methods","close","this","$eventBus","$emit","template","FeatureDetect","isPassiveSupported","val","_isPassiveSupported","checkPassiveSupport","supportsPassive","opts","Object","defineProperty","get","window","addEventListener","removeEventListener","e","IS_DEV","ACTIVE_CHAT_TYPES","INTERACTION_EVENTS","timeoutDuration","Number","default","mixins","slotUtils","components","ChatbotButton","ChatbotDialog","data","activeChatType","hasActivatedChatbot","computed","isChatbotActive","isChatbotDialogActive","isZendeskActive","isProactiveChatbotEnabled","isPhone","$store","getters","breakpointPhone","watch","newValue","handlePageScrollLock","handlePageScrollUnlock","beforeCreate","created","TransferSessionStorage","init","_timeout","_mutationObserver","_throttledInteractionHandler","_throttle","handleInteraction","trailing","_domEventListenerOptions","passive","addChatbotEventListeners","addZendeskEventListeners","addChatbotDialogEventListeners","liveChatOpened","then","tabId","triggerEvent","TRANSFER_EVENTS","transferLiveChat","id","on","openLiveChat","CHATBOT_EVENTS","$on","async","handleChatbotOpen","wait","activateChatbot","$nextTick","keyword","mounted","ChatbotSession","isOpenEmpty","transferAll","isOpenFromStore","prototype","hasOpened","initContainer","checkCustomLoaderFinishedLoading","error","log","beforeDestroy","destroy","removeChatbotEventListeners","removeZendeskEventListeners","removeChatbotDialogEventListeners","destroyMutationObserver","removeInteractionEvents","$off","clearTimeout","interval","setInterval","customLoader","document","querySelector","style","display","clearInterval","startTimeout","body","appendChild","$el","addInteractionEvents","openOther","isOpen","createMutationObserver","open","handleChatbotCloseWithTabEvent","handleChatbotDialogCloseWithTabEvent","map","event","setTimeout","handleTimeoutCompleted","activateChatbotDialog","chatContainer","MutationObserver","observe","attributes","childList","subtree","disconnect","classList","add","remove","closeOther","handleChatbotClose","handleChatbotDialogOpen","closeOtherDialog","handleChatbotDialogClose","hasActivated","renderChatbot","createElement","chatbotButton","click","directives","value","chatbotButtonWithTransition","appear","class","getSlot","isActive","ZENDESK_EVENTS","closed","handleZendeskClose","handleZendeskOpen","liveChatClose","renderZendesk","renderPopUp","popUp","render","required","maxInputLength","handleInput","target","trim","constructor","queue","isRunning","animation","push","runQueue","shift","timeline","gsap","onComplete","clear","kill","paused","Array","isArray","_ref","position","tween","play","ANIMATION_ENTER","autoAlpha","duration","ease","clearProps","ANIMATION_LEAVE","ChatbotTransitionsHandler","intersectionObserver","_this","_intersectionObserver","rootEl","getElementsByClassName","handleIntersection","arguments","IntersectionObserver","threshold","rootMargin","root","entries","observer","parentHeight","entry","isIntersecting","intersectionRatio","offsetHeight","offsetParent","fadeInElements","unobserve","hideElements","elements","set","to","onQuestionEnter","el","onStart","noop","targetEl","childElementCount","children","fromTo","_objectSpread","stagger","AnimationQueue","onAnswerEnter","_ref2","rest","_objectWithoutProperties","_excluded","length","element","_ref3","offset","onFeedbackEnter","_ref4","delay","onFeedbackLeave","_ref5","onLoaderEnter","_ref6","onLoaderLeave","_ref7","answer","dialogOptions","metadata","disableTransition","Boolean","answeredQuestions","unansweredQuestions","filter","question","includes","checkForLiveChat","checkForScrollToField","options","$refs","HTMLElement","querySelectorAll","button","scrollToField","createDialogOptions","questions","buttonEl","label","tag","variant","labelWrap","key","ref","refInFor","domProps","innerHTML","CxMarkdownToHtml","markdownParser","_markdownParser","lexer","_lexer","clearDialogOptions","replace","unescapeMarkdown","createLiveChatButton","text","undefined","showAsButton","test","concat","createScrollToLink","url","result","exec","loadMarkdownParser","loadScript","scriptAttributes","marked","parser","Lexer","rules","html","code","replaceHyperlinks","links","reduce","answerWithLinks","re","RegExp","isLinkLiveChat","isScrollToField","aTag","parseMarkdown","answerNoDialog","unescaped","withLinks","lex","DOTS","fill","functional","context","dots","createFeedbackButtons","buttons","buttonLabel","PROJECT_KEY","CUSTOMER_KEY","BASE_URL","BASE_URL_ONLIA_API","COMMON_CONFIG","apiKey","customerKey","projectKey","culture","EVENT_BASE_CONFIG","maxFaqs","EVENT_NAMES","EVENT_URLS","onLoad","characterLimit","showFeedback","SEND_FEEDBACK_URL","ONLIA_API_ENDPOINTS","ask","sendFeedback","getPersonalizationData","getOpeningHours","getConversationHistory","updateConversationHistory","stepBackInaDialog","ONLIA_API_ENDPOINTS_LIVECHAT","addZendestTicket","getOutput","response","outputPart","_get","getDialogPath","dialogPath","ChatbotAPIUtils","setResponseProperties","sessionID","interactionID","sessionDialogPath","handleAPIResponse","_parseResponse","output","parseResponse","sessionProperties","axiosInstanceOnlia","axios","create","interceptors","request","use","config","method","payload","params","keys","encdodedValue","toBase64Input","str","split","combined","word","index","match","toUpperCase","capitalize","headers","Promise","reject","axiosInstanceCX","ChatbotAPIController","super","useCX","characterLimitExceeded","stepBack","post","getUserData","sessionId","conversation","JSON","stringify","subject","userName","policyType","numberOfCurrentPolicies","numberOfFuturePolicies","numberOfRenewalPolicies","totalPremium","billAmount","personalizationOptions","regex","clearVariableRegex","numberOfCurrentPolices","numberOfFuturePolices","CurrentUser","BillAmount","NumberOfCurrentPolicies","NumberOfFuturePolicies","NumberOfRenewalPolicies","PolicyType","TotalPremium","_chatbotAPI","addUserCustomizations","finalText","option","userPersonalization","sitecoreItemID","isLoggedIn","ChatbotHeader","ChatbotInputField","ChatAnswer","ChatMessageLoader","ChatFeedback","ChatQuestion","userInput","characterLimitMessage","isLoading","isLoadingSession","sendFeedbackHTML","sendFeedbackDialogOptions","hasInputReachedLimit","sendFeedbackProps","isMobile","breakpointMobile","navHeaderHeight","headerHeight","state","globalNav","isHidden","HEADER_NAV","topNavHeight","addEventListeners","loggedIn","isSessionActive","_preventUpdateChatHistory","handleDialogAskQuestion","loadGSAP","checkForBESession","loadSession","$watch","saveConversation","immediate","transferConversation","handleTransferConverstion","updated","scrollTo","removeEventListeners","conversationHistoryResponse","SessionId","parse","Conversation","handleAxiosError","textHTML","updateChatHistory","parseSavedConversation","parsedConversation","conversationLength","i","message","isFeedback","generateGuid","container","getCharacterLimitMessage","openingHours","some","getFeedback","setLiveChatState","inOpeningHours","initialResponse","sitecoreItemId","handleAnswer","handleZendeskUnreadMessages","unreadMessages","characterLimitResponse","handleCharacterLimitExceeded","isUserInput","pushUserInput","askQuestion","checkShowFeedback","additionalParams","askApiParams","q","_liveChatState","outputs","_sessionDialogPath","hideFeedback","parsedAnswer","StartOfWeek","EndOfWeek","OpeningTime","ClosingTime","currentDate","Date","dayOfWeak","getDay","parsedHours","Intl","DateTimeFormat","hour","minute","timeZone","format","parseInt","hours","minutes","openingMinutes","closingHours","closingMinutes","dialogOptionsPath","metadataPath","_interactionID","pushFeedback","feedback","selectedFeedbackText","feedbackDialogPath","feedbackScore","score","originInteractionId","comment","handleSubmit","scrollTop","scrollHeight","done","labelFor","currentTarget","dataset","labelEl","top","getElementTop","scrollingElement","ZendeskWidget","ZendeskSession","zE","isConnected","_isConnected","currentZIndex","_currentZIndex","onChatConnected","success","EventBus","connected","onOpen","onClose","info","onUnreadMessages","count","callback","onChatEnd","onChatStatus","status","onUserEvent","hide","show","updateSettings","settings","prefill","details","ZENDESK_WIDGET_SETTINGS","webWidget","horizontal","vertical","mobile","navigation","popoutButton","enabled","contactOptions","contactFormLabel","chatLabelOffline","zIndex","api","chatUrl","_hasLoadedZendesk","zESettings","handleLiveChatOpenEvent","openZenChat","initZenChat","ZENDESK_CONFIG","scriptId","prefillUserData","getUserInfo","FirstName","LastName","EmailAddress","Phone","readOnly","email","phone","setZenChat","setEventListeners","handleUserEvent","action","Vue","SESSION_HAS_OPENED_KEY","SESSION_CONVERSATION_KEY","SESSION_ID_KEY","OPENING_HOURS","sessionStorage","getItem","setItem","_isOpen","_loggedIn","_conversation","_openingHours","_sessionID","receiveAll","openOtherDialog","events","crypto","randomUUID","Math","random","resolveInstance","liveChatResolveInstance","saveInSessingStorage","eventHandler","eventData","transferSessionStoregeAllKeys","transferSession","localStorage","removeItem","resolve","sessionStorageActiveKey","toString","sessionStorageOpenKey","loaded","disconnected","colors","consoleLog","_len","args","_key","arg","loggerProd","warn","logger","_len2","_key2","_len3","_key3","_len4","_key4","_len5","_key5","blueBold","_len6","_key6","greenBold","_len7","_key7","yellowBold","_len8","_key8","redBold","_len9","_key9","statusText"],"sourceRoot":""}