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AO8P,QAAU,SAASC,KAC1BA,MAAQA,IAAM,CAAC,GACf,IAAIC,IAAKC,IAAM,GACf,KAAMF,IACNE,KAAO,mjIAGP,OAAOA,GACP,C","sources":["webpack://apexchatwidgets/./widgets/core/hooks/RunAfter.js","webpack://apexchatwidgets/./widgets/prechat/MessageHandler.js","webpack://apexchatwidgets/./widgets/prechat/PreChatMessageHandler.js","webpack://apexchatwidgets/./widgets/prechat/PreChatInvitation.js","webpack://apexchatwidgets/./widgets/templates/invitations/prechat/prechat_template.ejs"],"sourcesContent":["const RunAfter = function (func, timeout) {\r\n setTimeout(() => {\r\n func();\r\n }, timeout);\r\n};\r\nexport default RunAfter;\r\n","import BaseClass from '../core/BaseClass';\r\nimport WidgetTypes from '../core/enums/WidgetTypes';\r\nimport TempCache from '../core/enums/TempCache';\r\nimport { PreChatMessageAnimation } from '../core/enums/Enum';\r\nimport getHeightOfElement from '../core/hooks/getHeightOfElement';\r\nimport MessageStatus from '../core/hooks/MessageStatus';\r\nimport MessageVisibility from '../core/hooks/MessageVisibility';\r\nimport PreChatMessageAnimations from '../core/hooks/PreChatMessageAnimations';\r\n\r\nexport default class MessageHandler extends BaseClass {\r\n // inheriting with BaseClass\r\n constructor(options) {\r\n super(options);\r\n this.options = Object.assign(options, {\r\n objectType: WidgetTypes.MessageHandler,\r\n ADAHandler: options.ADAHandler,\r\n context: options.context,\r\n prechatModel: options.prechatModel\r\n });\r\n\r\n this.messages = [];\r\n }\r\n\r\n /* @param {any} model\r\n summary: push actually does few tasks like; renders, animates previous and upcoming msgs. */\r\n push(model) {\r\n // push is not array push, its taking model as argument and doing several tasks.\r\n const self = this;\r\n const msg = new ApexChat.MessageView({\r\n context: this.options.context,\r\n wrap: this.options.wrap,\r\n targetElementSelector: this.options.targetElementSelector,\r\n renderOninit: this.options.renderOninit,\r\n model,\r\n template: model.template,\r\n index: this.messages.length,\r\n status: MessageStatus.Unread,\r\n visibility: MessageVisibility.Visible\r\n });\r\n const last = this.getLastMessage();\r\n\r\n if (this.messages.length > 0) {\r\n msg.isFirstMessage = false;\r\n this.messages[this.messages.length - 1].isLastMessage = false;\r\n }\r\n this.messages.push(msg);\r\n msg.view.removeClass('apexchat_prechat_show_message_fade_out');\r\n // getting lastMsg's duration of being on screen.\r\n const lastMsgModel = self.options.prechatModel.preChatMessages.filter((prechatMsgArray) => {\r\n if (last) {\r\n return prechatMsgArray.id === last.view.model.id;\r\n }\r\n });\r\n const duration = lastMsgModel[0] || { duration: 1 }; // Default:1//getting lastMsg's duration of being on screen.\r\n const animationConfig = {};\r\n // we are defining some configs for animations as we have similar animations Stacking & Mobile-Stacking\r\n // both are similar just few differences, like; faddingout timing, effect, close button difference, etc.\r\n if (this.options.preChatMessageAnimation == PreChatMessageAnimation.Stacking) {\r\n // defining config for Stacking\r\n animationConfig.StartFaddingOutAfter = 1000; // msg fadeout time\r\n animationConfig.HideMessageAfter = animationConfig.StartFaddingOutAfter; // hide the msg (which will resize iframe too)\r\n animationConfig.IFrameResizeAfterFaddingOut = animationConfig.StartFaddingOutAfter + 20; // adding 20ms in timeout for iframe resizing\r\n animationConfig.closeButtonSupported = 'No'; // close button is not supported in Stacking\r\n } else if (\r\n this.options.preChatMessageAnimation == PreChatMessageAnimation.MobileStacking\r\n ) {\r\n // defining config for MobileStacking\r\n animationConfig.HideMessageAfter = duration.duration * 1000; // msg fadeout time\r\n animationConfig.StartFaddingOutAfter = 0.4 * 1000; // hide the msg (which will resize iframe too)\r\n animationConfig.closeButtonHeight = 30; // close button Height\r\n animationConfig.IFrameResizeAfterFaddingOut = 1000 + 20; // 20ms more // hide the msg (which will resize iframe too)\r\n animationConfig.closeButtonSupported = 'Yes'; // close button is supported in Mobile-Stacking\r\n }\r\n const heightCalculation = new this.heightCalculation({\r\n me: this,\r\n currentMsgView: msg.view,\r\n lastMsg: last,\r\n animationConfig,\r\n model\r\n });\r\n if (msg.isFirstMessage) {\r\n // FIRST Message\r\n // encapsulated the whole logic to make the clean implementation..\r\n heightCalculation.fixFirstElement();\r\n // Adding Animation to First/current msg.\r\n msg.animate(PreChatMessageAnimations.First, 0);\r\n } else {\r\n // NORMAL Messaging\r\n\r\n if (model.isFromHistory && me.isPageRefreshed()) {\r\n // encapsulated the whole logic to make the clean implementation..\r\n heightCalculation.fixFirstElement(duration);\r\n } else {\r\n // encapsulated the whole logic to make the clean implementation..\r\n heightCalculation.fixUpComingElement(duration);\r\n // Adding Animation to previous msgs and fading them after user's defined time.\r\n // duration of being on screen.\r\n if (last.animate) {\r\n last.animate(PreChatMessageAnimations.Previous, 0);\r\n last.animate(\r\n PreChatMessageAnimations.FadeOut,\r\n animationConfig.StartFaddingOutAfter || 0\r\n );\r\n }\r\n }\r\n // Adding Animation to current msg.\r\n msg.animate(PreChatMessageAnimations.Upcoming, 0);\r\n }\r\n }\r\n\r\n heightCalculation(options) {\r\n const self = this;\r\n self.elementObj = options;\r\n const { animationConfig } = options;\r\n const { me } = options;\r\n const extraHeight = 5;\r\n const msgPopupElementFirst = function () {\r\n // we need this timeout as DOM takes time to render, without timeout.\r\n // ApexChat.getStyle giving wrong values without timeout.\r\n setTimeout(() => {\r\n const { currentMsgView } = self.elementObj;\r\n const ele = me.$(`#${currentMsgView.identifier}`, currentMsgView.context);\r\n if (ele[0]) {\r\n // jquery selector element[0] returns default DOM html ele obj.\r\n // we need calculations here for placing msg popup with animation one over the other.\r\n me.postMessage({\r\n event: 'prechat-auto-resizing',\r\n data: {\r\n currentMsgHeight: getHeightOfElement(ele[0]),\r\n isSingleMsg: true\r\n }\r\n });\r\n const calcCurrentMsgHeight =\r\n TempCache.PRECHAT_Rounded_Message_Popup_Current_Height -\r\n getHeightOfElement(ele[0]) +\r\n extraHeight;\r\n ele.css(\r\n 'top',\r\n `${calcCurrentMsgHeight + (animationConfig.closeButtonHeight || 0)}px`\r\n );\r\n }\r\n }, 50);\r\n };\r\n const msgPopupElementUpcoming = function (duration) {\r\n const { currentMsgView } = self.elementObj;\r\n const last = self.elementObj.lastMsg;\r\n // Its obvious that UpComing msg scenario, FirstMsg or Prev has already been executed.\r\n // removing classes of first and upcoming msg from previous popup\r\n if (last.view.removeClass) {\r\n last.view.removeClass('apexchat_prechat_show_message_fade_out');\r\n last.view.removeClass(PreChatMessageAnimations.First);\r\n last.view.removeClass(PreChatMessageAnimations.Upcoming);\r\n }\r\n // duration timeout to keep them in vision according to user defined time.\r\n setTimeout(() => {\r\n me.$(`#${last.view.identifier}`, last.view.context).hide();\r\n }, animationConfig.HideMessageAfter);\r\n const elementlast = me.$(`#${last.view.identifier}`, last.view.context);\r\n const elementmsg = me.$(`#${currentMsgView.identifier}`, currentMsgView.context);\r\n // we need this timeout as DOM takes time to render, without timeout.\r\n // ApexChat.getStyle giving wrong values without timeout.\r\n setTimeout(() => {\r\n if (elementlast[0]) {\r\n // we need calculations here for placing msg popup with animation one over the other.\r\n // Resizing IFrame incase of Stack Msgs and making IFrame Wide enough to show the Stacked Msgs.\r\n me.postMessage({\r\n event: 'prechat-auto-resizing',\r\n data: {\r\n currentMsgHeight: getHeightOfElement(elementmsg[0]),\r\n prevMsgHeight: getHeightOfElement(elementlast[0]),\r\n dontAnimateClosebutton: true\r\n }\r\n });\r\n const calcLastMsgHeight =\r\n TempCache.PRECHAT_Rounded_Message_Popup_Last_Height -\r\n getHeightOfElement(elementmsg[0]) -\r\n getHeightOfElement(elementlast[0]); //\r\n const calcCurrentMsgHeight =\r\n TempCache.PRECHAT_Rounded_Message_Popup_Current_Height -\r\n getHeightOfElement(elementmsg[0]) -\r\n 20; //\r\n elementlast.animate({ top: calcLastMsgHeight }, 300);\r\n elementmsg.css(\r\n 'top',\r\n calcCurrentMsgHeight + (animationConfig.closeButtonHeight || 0)\r\n );\r\n }\r\n }, 50);\r\n // After fadding out of msg we need to decrease the IFrame size again.\r\n iFrameResizeOnFadeOut(elementmsg);\r\n };\r\n const lastMsgOnPageRefresh = function () {\r\n const { currentMsgView } = self.elementObj;\r\n const elementmsg = me.$(`#${currentMsgView.identifier}`, currentMsgView.context);\r\n const elementlast = me.$(`#${last.view.identifier}`, last.view.context);\r\n // we need this timeout as DOM takes time to render, without timeout.\r\n // ApexChat.getStyle giving wrong values without timeout.\r\n setTimeout(() => {\r\n // Resizing IFrame incase of Stack Msgs and making IFrame Wide enough to show the Stacked Msgs.\r\n me.postMessage({\r\n event: 'prechat-auto-resizing',\r\n data: {\r\n currentMsgHeight: getHeightOfElement(elementmsg[0]),\r\n prevMsgHeight: getHeightOfElement(elementlast[0])\r\n }\r\n });\r\n if (elementmsg[0]) {\r\n // we need calculations here for placing msg popup with animation one over the other.\r\n const calcCurrentHeight =\r\n TempCache.PRECHAT_Rounded_Message_Popup_Current_Height -\r\n getHeightOfElement(elementmsg[0]);\r\n elementmsg.css('top', calcCurrentHeight, 'height');\r\n }\r\n }, 50);\r\n // After fadding out of msg we need to decrease the IFrame size again.\r\n // _iFrameResize(elementmsg[0]);\r\n };\r\n let iFrameResizeOnFadeOut = function (ele) {\r\n let { IFrameResizeAfterFaddingOut } = animationConfig;\r\n if (me.isPageRefreshed() && !me.noLastMessageOnRefresh) {\r\n me.noLastMessageOnRefresh = true;\r\n IFrameResizeAfterFaddingOut = 1;\r\n }\r\n setTimeout(() => {\r\n me.postMessage({\r\n event: 'prechat-auto-resizing',\r\n data: {\r\n currentMsgHeight: getHeightOfElement(ele[0]),\r\n isSingleMsg: true,\r\n closeButtonSupported: animationConfig.closeButtonSupported\r\n }\r\n });\r\n ele.animate({ top: 15 + (animationConfig.closeButtonHeight || 0) }, 1);\r\n }, IFrameResizeAfterFaddingOut); // for Iframe resizing (animating msg and iframe was causing a glitch).\r\n };\r\n return {\r\n fixFirstElement: msgPopupElementFirst,\r\n fixUpComingElement: msgPopupElementUpcoming,\r\n fixLastMsgOnPageRefresh: lastMsgOnPageRefresh\r\n };\r\n }\r\n\r\n getMessageCount() {\r\n return this.messages ? this.messages.length : 0;\r\n }\r\n}\r\n","/*\r\n The class used to encapsulate PreChat specific logic to show and hide messages and hanlde state management \r\n */\r\nimport MessageHandler from './MessageHandler';\r\nimport WidgetTypes from '../core/enums/WidgetTypes';\r\nimport { ScriptsQuestionType } from '../core/enums/Enum';\r\nimport WebStorage from '../core/hooks/WebStorage';\r\n\r\nexport default class PreChatMessageHandler extends MessageHandler {\r\n constructor(options) {\r\n super(options);\r\n this.options = Object.assign(options, {\r\n objectType: WidgetTypes.PreChatMessageHandler\r\n });\r\n\r\n this.options.wrap = true; // create a wrapper div; use targetElement instead queried through targetElementSelector\r\n this.options.targetElementSelector = '#apexchat_prechat_message_popup_container'; // '#apexchat_prechat_message';//this will be the placeholder for all messages to render\r\n this.options.renderOninit = false; /* with this we stop auto-rendering and give the control to the caller(i.e. PreChatMessageHandler) to take care of rendering: in this case QuestionTypeRenderer */\r\n // reset storageAPI to use sessionStorage\r\n this.storageAPI = WebStorage({ type: 'session' });\r\n ApexChat.sessionAPI = this.storageAPI;\r\n\r\n this.loadAll(); // this will fetch the cashed messages from sessionStorage and parse them back and put them in this.messages; also render them\r\n }\r\n\r\n /* @param {any} model\r\n * used to show and save new messages\r\n summary: push actually takes model and call its parent push function which does whole job.. */\r\n push(model) {\r\n // push is not array push, its taking model as argument and doing several tasks.\r\n const template = this.getTemplate(model.messageType); // for now it does not matter for QR types\r\n this.options.renderOninit = model.questionType == ScriptsQuestionType.None; // render plain text messages or else let something else render it; e.g. questionTypeRenderer\r\n\r\n super.push(\r\n Object.assign(model, {\r\n template: this.messageTemplate || model.template,\r\n userId: model.userId || 0,\r\n participantDisplayName: model.participantDisplayName || '',\r\n createdOn: new Date()\r\n })\r\n );\r\n this.saveAll();\r\n }\r\n\r\n // a must-call method before push()\r\n setMessageTemplate(template) {\r\n this.messageTemplate = template;\r\n }\r\n\r\n // currently this is void; we are using this.messageTemplate already\r\n getTemplate(messageType) {\r\n const template = null;\r\n return template;\r\n }\r\n\r\n /* summary: returns the last msg view object frequently used for\r\n * taking previous msg in prechat to animate its html in unique style.\r\n */\r\n getLastMessage() {\r\n // returns view of LastMsg\r\n for (let i = 0; i < this.messages.length; i++) {\r\n if (this.messages[i].isLastMessage) {\r\n return this.messages[i];\r\n }\r\n }\r\n }\r\n\r\n getFirstMessage() {\r\n for (let i = 0; i < this.messages.length; i++) {\r\n if (this.messages[i].isFirstMessage) {\r\n return this.messages[i];\r\n }\r\n }\r\n }\r\n\r\n saveAll() {\r\n this.storageAPI.Store('livechat_prechat_messages_store', JSON.stringify(this.messages));\r\n }\r\n\r\n // makes sense only in reload scenarios\r\n loadAll() {\r\n const self = this;\r\n const cache = this.storageAPI.Get('livechat_prechat_messages_store');\r\n this.messages = cache ? JSON.parse(cache) : this.messages;\r\n const _render = function (messageObj) {\r\n messageObj.isFromHistory = true;\r\n self.push(messageObj);\r\n };\r\n\r\n for (let i = 0; i < self.messages.length; i++) {\r\n if (self.isChatActive() && self.isPageRefreshed()) {\r\n if (i == self.messages.length - 1) {\r\n // TODO: When Chat is started and is in progress, If the Prechat message is appeared doesnt remain appeared.\r\n // _render(this.messages[i]);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","//import QuestionTypeRendererExtentions from '../questiontypes/QuestionTypeRendererExtension';\r\n// import '../styles/v3/v3-iframes.css';\r\n// import '../styles/prechat/base_prechat_template.css'\r\n// import '../styles/prechat/prechat_responsive.css'\r\n// import '../styles/prechat/prechat_template.css'\r\n// import '../styles/questiontype.css'\r\n\r\nimport preChatTemplate from '../templates/invitations/prechat/prechat_template.ejs';\r\n\r\nimport PreChatMessageHandler from './PreChatMessageHandler';\r\nimport WidgetTypes from '../core/enums/WidgetTypes';\r\nimport WidgetView from '../core/WidgetView';\r\nimport TempCache from '../core/enums/TempCache';\r\nimport PubSub from '../core/events/PubSub';\r\nimport { BaseWidget } from '../core/BaseWidget';;\r\nimport SourceType from '../core/enums/SourceTypes';\r\nimport BrandingWidget from '../core/enums/BrandingWidget';\r\nimport ParticipantIds from '../core/enums/ParticipantIds';\r\nimport GlobalVariables from '../core/GlobalVariables';\r\nimport cleanInvalidHtml from '../core/hooks/cleanInvalidHtml';\r\nimport ChatMode from '../core/hooks/ChatMode';\r\nimport PipedMessageHandler from '../core/hooks/PipedMessageHandler';\r\nimport addStyleTextInIframe from '../core/hooks/addStyleTextInIframe';\r\nimport { Position, PreChatMessageAnimation, PreChatMessageType, ScriptVisitorResponseStatus, ScriptsQuestionType } from '../core/enums/Enum';\r\nimport parseTemplate from '../core/hooks/parseTemplate';\r\nimport Branding from '../core/hooks/Branding';\r\nimport getStyle from '../core/hooks/getStyle';\r\nimport removeMultipleCSSClasses from '../core/hooks/removeMultipleCSSClasses';\r\nimport encodeHTML from '../core/hooks/encodeHTML';\r\nimport decodeHTML from '../core/hooks/decodeHTML';\r\nimport removeTextFollowedByColon from '../core/hooks/removeTextFollowedByColon';\r\nimport stringify from '../core/hooks/stringify';\r\nimport addOptionProperty from '../core/hooks/addOptionProperty';\r\nimport getHeightOfElement from '../core/hooks/getHeightOfElement';\r\nimport AgentImageHandler from '../core/hooks/AgentImageHandler';\r\nimport setPrechatStyles from '../core/hooks/setPrechatStyles';\r\nimport RunAfter from '../core/hooks/RunAfter';\r\nimport Cookies from '../core/hooks/Cookies';\r\nimport ChatEvents from '../core/hooks/ChatEvents';\r\nimport WidgetStates from '../core/hooks/WidgetStates';\r\nimport getCookieValue from '../core/hooks/getCookieValue';\r\nimport getStorageAPIValue from '../core/hooks/getStorageAPIValue';\r\nimport storageAPIExists from '../core/hooks/storageAPIExists';\r\nimport showElement from '../core/hooks/showElement';\r\nimport hideElement from '../core/hooks/hideElement';\r\nimport removeClass from '../core/hooks/removeClass';\r\nimport addClass from '../core/hooks/addClass';\r\nimport localstorageAPIExists from '../core/hooks/localstorageAPIExists';\r\nimport logIt from '../../logIt';\r\nimport localStorageAPIGet from '../core/hooks/localStorageAPIGet';\r\n\r\nexport default class PreChatInvitation extends BaseWidget {\r\n constructor(options) {\r\n options.widget = WidgetTypes.PreChat;\r\n options.styleName = 'prechat'\r\n super(options);\r\n this.templateRenderer = null;\r\n if (!options.preChat) {\r\n console.log('pre chat not enabled');\r\n return;\r\n }\r\n const me = this;\r\n me.options = options;\r\n me.pipeMessageHandler = new PipedMessageHandler(options);\r\n me.DEFAULT_PRECHAT_CONFIG = {\r\n general: { template: 'Simple Style' },\r\n outerObject: {\r\n hideOuterObject: false,\r\n showImage: false,\r\n backgroundImage: '',\r\n background1Color: '#5FADD1',\r\n background2Color: '#5FADD1',\r\n borderColor: '#FFFFFF',\r\n borderWidth: '0px',\r\n borderRadius: '60px',\r\n padding: '20px 20px 20px 20px'\r\n },\r\n innerObject: {\r\n hideInnerObject: false,\r\n showImage: true,\r\n defaultImage: 'chat-icon-simple.png',\r\n backgroundImage: '',\r\n background1Color: '',\r\n background2Color: '',\r\n borderColor: '#FFFFFF',\r\n borderWidth: '0px',\r\n borderRadius: '0px',\r\n padding: '5px 5px 5px 5px'\r\n },\r\n messagePopup: {\r\n font: {\r\n italic: false,\r\n bold: false,\r\n underline: false,\r\n family: 'inherit',\r\n size: '18px',\r\n color: '#202024'\r\n },\r\n backgroundColor: '#feffe0',\r\n padding: '11.2px 11.2px 11.2px 11.2px',\r\n borderColor: '#e5e6c8',\r\n closeIcon: '/contents/themes/skinnable/invitation/close.png',\r\n closeIconSize: { width: '12px', height: '12px' },\r\n shadowDepth: '0px',\r\n borderRadius: '6px',\r\n borderWidth: '1px'\r\n },\r\n messageCounter: {\r\n font: {\r\n italic: false,\r\n bold: false,\r\n underline: false,\r\n family: 'inherit',\r\n size: '10px',\r\n color: '#FFFFFF'\r\n },\r\n backgroundColor: '#823710',\r\n counterTop: '7px',\r\n counterRight: '3px'\r\n }\r\n };\r\n const TemplateRenderer = function () {\r\n const self = this;\r\n self.heightPosition = 20;\r\n self.notificationContainer = 'apexchat_prechat_typing_div';\r\n self.typingIndicator = 'apexchat_rd_prechat_invitation_typing_dots';\r\n self.showAgentName = function () {\r\n // no need to implement this function for default templetes\r\n };\r\n self.animateMessagePopup = function (el, position) {\r\n removeClass(el, 'apexchat_prechat_show_message_fade_out');\r\n addClass(el, 'apexchat_prechat_show_message_fade_in');\r\n };\r\n self.showTypingIndicator = function () {\r\n const containerElement = me.DOM.getElementById(self.notificationContainer);\r\n if (containerElement) {\r\n showElement(containerElement);\r\n }\r\n };\r\n self.hideTypingIndicator = function () {\r\n const containerElement = me.DOM.getElementById(self.notificationContainer);\r\n if (containerElement) {\r\n hideElement(containerElement);\r\n }\r\n };\r\n self.displayMessageCounter = function () {\r\n const messageCounter = me.getMessageCounterCache();\r\n me.DOM.getElementById('apexchat_prechat_message_count').innerHTML = messageCounter;\r\n me.DOM.getElementById('apexchat_prechat_message_count').style.display = 'block';\r\n if (messageCounter === 0) {\r\n self.hideMessageCounter();\r\n }\r\n };\r\n self.hideTalkBubbleIcon = function () {\r\n // no need to implement this function for default templetes\r\n };\r\n self.hideMessagePopup = function () {\r\n // me.DOM.getElementById('apexchat_prechat_message_popup').style.display = 'none';\r\n removeMultipleCSSClasses(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'prechat_zoom_in_animation_left prechat_zoom_in_animation_right'\r\n );\r\n removeMultipleCSSClasses(\r\n me.DOM.getElementById('apexchat_prechat_typing_div'),\r\n 'prechat_zoom_in_animation_left prechat_zoom_in_animation_right'\r\n );\r\n const roundedMessagePopup =\r\n me.DOM.getElementsByClassName('apexchat_prechat_message_bubble')\r\n // me.$(me.DOM.getElementById('apexchat_prechat_message_popup_container'))\r\n // .find('.apexchat_prechat_message_bubble');\r\n if (roundedMessagePopup.length > 0) {\r\n hideElement(roundedMessagePopup[roundedMessagePopup.length - 1]);\r\n } else {\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'apexchat_prechat_show_message_fade_out'\r\n );\r\n }\r\n me.displayMessageCounter();\r\n // resize iframe\r\n // me.postMessage({ event: 'prechat-size', data: { width: me.iconWidth, height: me.iconHeight } });\r\n };\r\n self.hideMessageCounter = function () {\r\n me.DOM.getElementById('apexchat_prechat_message_count').style.display = 'none';\r\n };\r\n self.widgetWidth = 295;\r\n self.renderOnLeftPosition = function () {\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'apexchat_prechat_tri_left apexchat_prechat_left_bottom'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_main_container'),\r\n 'apexchat_prechat_bottom'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_main_bg'),\r\n 'apexchat_prechat_bottom'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_close_message_popup'),\r\n 'apexchat_prechat_x_right'\r\n );\r\n // Mobile responsive\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'apexchat_prechat_talk_bubbleMsg_left'\r\n );\r\n };\r\n self.renderOnRightPosition = function () {\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'apexchat_prechat_tri_right apexchat_prechat_right_bottom'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_main_bg'),\r\n 'apexchat_prechat_right'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_main_container'),\r\n 'apexchat_prechat_bottom'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_main_bg'),\r\n 'apexchat_prechat_bottom'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_close_message_popup'),\r\n 'apexchat_prechat_x_left'\r\n );\r\n // Mobile responsive\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'apexchat_prechat_talk_bubbleMsg_right'\r\n );\r\n };\r\n self.showOnlineAgentTag = function () {\r\n const agentName = me.DOM.getElementsByClassName('online-agent-tag');\r\n agentName[0].innerHTML = me.options.preChat.preChatAgentStatusText;\r\n agentName[0].style.display = 'block';\r\n // hide online tag and glow invitation aftr 45 seconds\r\n setTimeout(() => {\r\n // hide tag\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_chat_icon'),\r\n 'glow_pre_chat_icon'\r\n );\r\n }, 45000);\r\n };\r\n self.popupUI = function () {\r\n const _render = function (message) {\r\n if (!message.message && message.text) {\r\n message.message = message.text;\r\n }\r\n me.DOM.getElementById('apexchat_prechat_message').innerHTML = message.message;\r\n };\r\n const _clearContent = function () {\r\n me.DOM.getElementById('apexchat_prechat_message').innerHTML = '';\r\n };\r\n const _doNothing = function () {\r\n // do nothing..\r\n };\r\n const _questionTypeUIConfiguration = function (questionType) {\r\n me.setAllowBackgroundClick(questionType);\r\n me.$('.apexchat_question_type_close_button', me.DOM).attr(\r\n 'style',\r\n 'display:none !important'\r\n );\r\n me.$('#apexchat_click_instruction', me.DOM).attr(\r\n 'style',\r\n 'display: none !important'\r\n );\r\n me.DOM.querySelector('#apexchat_participant_display_name').setAttribute(\r\n 'style',\r\n 'display: none !important'\r\n );\r\n me.$('#apexchat_participant_display_col', me.DOM).attr(\r\n 'style',\r\n 'display: none !important'\r\n );\r\n };\r\n return {\r\n render: _render,\r\n clear: _clearContent,\r\n setMessageTemplate: _doNothing,\r\n questionTypeUIConfiguration: _questionTypeUIConfiguration\r\n };\r\n };\r\n };\r\n const RoundedTemplateRenderer = function (renderer, heightPosition) {\r\n const self = this;\r\n self.agentNameImageId = 'agent_name_prechat_rounded_theme';\r\n self.heightPosition = heightPosition;\r\n self.renderer = renderer;\r\n self.animateMessagePopup = function (el, position) { };\r\n self.showAgentName = function () {\r\n // me.$(`#${self.agentNameImageId}`, me.DOM).html(me.options.agentName);\r\n me.DOM.getElementById(self.agentNameImageId)?.innerHTML = me.options.agentName;\r\n };\r\n self.showTypingIndicatorInnerGlider = function () {\r\n me.DOM.getElementsByClassName(self.renderer.typingIndicator)[0].style.display =\r\n 'inline-block';\r\n const elem = me.DOM.getElementsByClassName(renderer.typingIndicator);\r\n for (let i = 0; i < elem.length; i++) {\r\n elem[i].style.display = 'inline-block';\r\n }\r\n };\r\n self.hideMessagePopup = function () {\r\n self.renderer.hideMessagePopup();\r\n };\r\n self.showTypingIndicator = function () {\r\n const containerElement = me.DOM.getElementById(renderer.notificationContainer);\r\n if (containerElement) {\r\n showElement(containerElement);\r\n self.showTypingIndicatorInnerGlider();\r\n me.DOM.getElementById('apexchat_prechat_message_count').style.display = 'none';\r\n containerElement.classList.remove('disabled');\r\n //me.$(containerElement, me.context).removeClass('disabled');\r\n }\r\n };\r\n self.widgetWidth = 98;\r\n self.hideTypingIndicatorInnerGlider = function () {\r\n me.DOM.getElementsByClassName(self.renderer.typingIndicator)[0].style.display =\r\n 'none';\r\n const elem = me.DOM.getElementsByClassName(renderer.typingIndicator);\r\n for (let i = 0; i < elem.length; i++) {\r\n hideElement(elem[i]);\r\n }\r\n };\r\n self.hideTypingIndicator = function () {\r\n // self.hideTypingIndicatorInnerGlider();\r\n const messageCounter = me.getMessageCounterCache();\r\n if (messageCounter > 0) {\r\n self.displayMessageCounter();\r\n return;\r\n }\r\n const containerElement = me.DOM.getElementById(renderer.notificationContainer);\r\n if (containerElement) {\r\n // hideElement(containerElement);\r\n //me.$(containerElement, me.context).addClass('disabled');\r\n containerElement.classList.add('disabled')\r\n }\r\n };\r\n self.displayMessageCounter = function () {\r\n const messageCounter = me.getMessageCounterCache();\r\n if (messageCounter > 0) {\r\n me.DOM.getElementById('apexchat_prechat_message_count').innerHTML =\r\n messageCounter;\r\n me.DOM.getElementById('apexchat_prechat_typing_div').style.display = 'block';\r\n me.DOM.getElementById('apexchat_prechat_message_count').style.display = 'block';\r\n self.hideTypingIndicatorInnerGlider();\r\n } else {\r\n self.hideMessageCounter();\r\n self.hideTalkBubbleIcon();\r\n }\r\n //me.$('#apexchat_prechat_typing_div', me.DOM).removeClass('disabled');\r\n me.DOM.getElementById('apexchat_prechat_typing_div').classList.remove('disabled');\r\n };\r\n self.hideMessageCounter = function () {\r\n me.DOM.getElementById('apexchat_prechat_message_count').style.display = 'none'\r\n //me.$('#apexchat_prechat_message_count', me.DOM).hide();\r\n };\r\n self.hideTalkBubbleIcon = function () {\r\n //me.$('#apexchat_prechat_typing_div', me.DOM).hide();\r\n me.DOM.getElementById('apexchat_prechat_typing_div').style.display = 'none'\r\n };\r\n self.renderOnLeftPosition = function () {\r\n renderer.renderOnLeftPosition();\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup_container'),\r\n 'apexchat_prechat_rounded_theme_left'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_typing_div'),\r\n 'talk_bubble_left'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_main_container'),\r\n 'apexchat_prechat_left'\r\n );\r\n removeClass(\r\n me.DOM.getElementById('apexchat_prechat_typing_div'),\r\n 'talk_bubble_right'\r\n );\r\n };\r\n self.renderOnRightPosition = function () {\r\n renderer.renderOnRightPosition();\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup_container'),\r\n 'apexchat_prechat_rounded_theme_right'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_typing_div'),\r\n 'talk_bubble_right'\r\n );\r\n removeClass(\r\n me.DOM.getElementById('apexchat_prechat_typing_div'),\r\n 'talk_bubble_left'\r\n );\r\n };\r\n self.popupUI = function (isPreChatRoundedTheme) {\r\n const _container = me.DOM.getElementById('apexchat_prechat_message');// me.$('#apexchat_prechat_message', me.DOM);\r\n const _setMessageTemplate = function () {\r\n if (!isPreChatRoundedTheme) {\r\n return;\r\n }\r\n if (!ApexChat.preChatMsgTemplate) {\r\n // we need to replace Close button according to animationType\r\n switch (me.options.preChatMessageAnimation) {\r\n case PreChatMessageAnimation.Default:\r\n case PreChatMessageAnimation.Stacking:\r\n _hideCloseButton();\r\n break;\r\n case PreChatMessageAnimation.MobileStacking:\r\n _hideCloseCrossSymbol();\r\n break;\r\n }\r\n const message = document.createTextNode('##message##'); // Create a text node\r\n me.DOM.getElementById('apexchat_prechat_message').innerHTML = message;\r\n //me.$('#apexchat_prechat_message', me.DOM).html(message);\r\n\r\n const participants = ApexChat.localStorageAPI.Get(\r\n 'livechat_chat_participants'\r\n );\r\n let participantInfo = JSON.parse(participants || '{}');\r\n participantInfo = participantInfo[participantInfo.length - 1];\r\n // if participants found then we need to update the image and agent name of the next pre-chat pop-up message\r\n if (\r\n participants &&\r\n participantInfo &&\r\n participantInfo.userId !== ParticipantIds.visitor\r\n ) {\r\n // Dont run for visitor case\r\n if (participantInfo.handlerImageUrl) {\r\n // me.$(\r\n // '.agent_image_prechat_rounded_theme .apexchat_prechat_chat_icon',\r\n // me.DOM\r\n // ).css(\r\n // 'background-image',\r\n // `url(${participantInfo.handlerImageUrl})`\r\n // );\r\n me.DOM.querySelector('.apexchat_prechat_chat_icon')?.style.backgroundImage =\r\n `url(${participantInfo.handlerImageUrl})`\r\n }\r\n me.DOM.querySelector('.agent_name_prechat_rounded_theme')?.innerHTML = participantInfo.displayName\r\n } else {\r\n me.DOM.querySelector('.agent_name_prechat_rounded_theme')?.innerHTML = me.options.agentName\r\n }\r\n ApexChat.preChatMsgTemplate = '
' + me.DOM.querySelector('#apexchat_prechat_message_popup').cloneNode(true).innerHTML + '
';\r\n me.DOM.getElementById('apexchat_prechat_message_popup_container').classList.add('apexchat_prechat_default_animation')\r\n ApexChat.sessionAPI.Store(\r\n 'livechat_prechat_msg_template',\r\n ApexChat.preChatMsgTemplate\r\n );\r\n me.messenger.setMessageTemplate(ApexChat.preChatMsgTemplate);\r\n }\r\n };\r\n var _hideCloseButton = function () {\r\n me.DOM.getElementById('apexchat_prechat_rd_close_btn_icon').style.display = 'none';\r\n };\r\n var _hideCloseCrossSymbol = function () {\r\n me.DOM.getElementById('apexchat_prechat_close_message_popup').style.display = 'none';\r\n me.DOM.getElementById('apexchat_prechat_rd_close_btn_icon').style.display = 'block';\r\n\r\n };\r\n const _push = function (message) {\r\n if (!isPreChatRoundedTheme) {\r\n return;\r\n }\r\n if (!message.message && message.text) {\r\n message.message = message.text;\r\n }\r\n message.message = decodeHTML(\r\n cleanInvalidHtml(\r\n removeTextFollowedByColon(message.message)\r\n )\r\n );\r\n // message.message = removeTextFollowedByColon(message.message);\r\n // on this switch we will take decision.\r\n switch (me.options.preChatMessageAnimation) {\r\n case PreChatMessageAnimation.Default:\r\n _renderDefault(message);\r\n break;\r\n case PreChatMessageAnimation.Stacking:\r\n case PreChatMessageAnimation.MobileStacking:\r\n _renderStacking(message);\r\n break;\r\n }\r\n // check chatMsg variable is exists and ApexChat.preChatElement is not undefined livechat_participant_display_text\r\n if (message.questionType == ScriptsQuestionType.None) {\r\n _setTabIndex();\r\n } else {\r\n _removeTabIndex();\r\n }\r\n };\r\n var _setTabIndex = function () {\r\n _container.setAttribute('tabindex', 0);\r\n };\r\n var _removeTabIndex = function () {\r\n _container.setAttribute('tabindex', -1);\r\n };\r\n var _renderDefault = function (message) {\r\n // IFrame resizing on Clicking Action of QuestionType\r\n me.postMessage({\r\n // no need to send 0 currentMsgHeight\r\n event: 'prechat-auto-resizing',\r\n data: {\r\n isSingleMsg: true\r\n }\r\n });\r\n if (!message.dontAppendExisitngContent) {\r\n //me.$('#apexchat_prechat_message', me.DOM).html(message.message);\r\n me.DOM.getElementById('apexchat_prechat_message').innerHTML = message.message;\r\n } else {\r\n me.DOM.getElementById('apexchat_prechat_message').innerHTML = ''\r\n }\r\n // we are showing with opacity 0; because we cant calculate dynamic height differences If element is Hidden,\r\n // Initially, we were adding CSS Class for making Opacity 0 & 1 but adding and removing class was making a jerk we needed the animation effect between 0 to 1, in decimal manner like 0.1, 0.2, 0.3... to 0.9, 1\r\n //me.$('#apexchat_prechat_message_popup', me.DOM).show().css({ opacity: 0 });\r\n const ele = me.DOM.getElementById('apexchat_prechat_message_popup');\r\n ele.style.display = 'block';\r\n ele.style.opacity = 0;\r\n // we need this timeout as DOM takes time to render, without timeout.\r\n // ApexChat.getStyle giving wrong values without timeout.\r\n };\r\n var _renderStacking = function (message) {\r\n me.messenger.push(message);\r\n };\r\n const _doNothing = function () { };\r\n const _questionTypeUIConfiguration = function (questionType) {\r\n me.setAllowBackgroundClick(questionType);\r\n me.DOM.querySelector('.apexchat_question_type_close_button')?.style.setProperty('display', 'none', 'important');\r\n me.DOM.querySelector('.apexchat_participant_display_text#apexchat_participant_display_name')?.style.setProperty('display', 'none', 'important');\r\n me.DOM.querySelector('.apexchat_participant_display_text#apexchat_participant_display_col')?.style.setProperty('display', 'none', 'important');\r\n console.log('Rounded Template renderer _questionTypeUIConfiguration');\r\n };\r\n return {\r\n setMessageTemplate: _setMessageTemplate,\r\n render: _push,\r\n clear: _doNothing,\r\n questionTypeUIConfiguration: _questionTypeUIConfiguration\r\n };\r\n };\r\n };\r\n let renderer = new TemplateRenderer();\r\n if (me.options.preChat.preChatThemeSetting) {\r\n if (\r\n JSON.parse(options.preChat.preChatThemeSetting).general.template === GlobalVariables.preChatRoundedThemeName\r\n ) {\r\n me.options.isPreChatRoundedTheme = true;\r\n renderer = new RoundedTemplateRenderer(renderer, 130);\r\n }\r\n }\r\n\r\n me.templateRenderer = renderer;\r\n\r\n if (me.options.chatMode == ChatMode.Windowed) {\r\n this.mode = WidgetTypes.Windowed;\r\n } else if (me.options.chatMode == ChatMode.DOM) {\r\n this.mode = WidgetTypes.DOM;\r\n }\r\n this.lastMessageStoreName = 'livechat_prechat_lastmessage';\r\n this.messageCounterStoreName = 'livechat_prechat_messagecounter';\r\n // super(\r\n // Object.assign(me.options, {\r\n // widget: WidgetTypes.PreChat\r\n // })\r\n // );\r\n this.subscribe(\r\n WidgetTypes.VideoGreetInvitation + WidgetStates.ShownMaximized,\r\n (args) => {\r\n if (me.options && me.options.videoGreetEnabled) {\r\n me.hide();\r\n }\r\n }\r\n );\r\n this.subscribe('videogreet-init', () => {\r\n const lastVGState = me.state.getStateValue(WidgetTypes.VideoGreetInvitation); // get video greet state\r\n me.isVideoGreet = true;\r\n if (lastVGState != WidgetStates.Hidden) {\r\n // check video greet maximize\r\n me.isVideoGreetMax = true;\r\n }\r\n });\r\n if (me.isPageRefreshed()) {\r\n me.ready();\r\n if (me.options && me.options.videoGreetEnabled) {\r\n me.postMessage({\r\n event: 'videogreet-gif-file-loaded',\r\n data: {\r\n imageUrl: me.options.videoGreet.animatedImageUrl\r\n }\r\n });\r\n }\r\n } else {\r\n const preChatDuration =\r\n me.options && me.options.videoGreetEnabled\r\n ? 1000\r\n : me.options.preChat.preChatLoadTimeout * 1000;\r\n //setTimeout(() => {\r\n me.ready();\r\n //}, preChatDuration);\r\n }\r\n me.messageArray = [];\r\n }\r\n\r\n ready() {\r\n super.ready();\r\n const me = this;\r\n me.create();\r\n me.templateRenderer.hideTypingIndicator();\r\n me.subscribe('new-pre-chat-message-arriving', (args) => {\r\n me.templateRenderer.showTypingIndicator();\r\n });\r\n me.subscribe(WidgetTypes.DOM + WidgetStates.ShownMinimized, (args) => {\r\n me.templateRenderer.hideTypingIndicator();\r\n });\r\n me.subscribe(WidgetTypes.ChatRoom + ChatEvents.OnChatJoined, (args) => {\r\n // CHAT-6280-Handle PreChat hits, subscribed onChatJoined method from chatroom-v3.js\r\n });\r\n me.subscribe('videogreet-gif-file-loaded', (data) => {\r\n if (data.imageUrl) {\r\n const image = me.DOM.getElementById('apexchat_prechat_chat_icon');\r\n image.classList.add('video_greet_animated_gif');\r\n image.style.backgroundImage = `url('${data.imageUrl}')`;\r\n }\r\n });\r\n me.subscribe(WidgetTypes.DOM + WidgetStates.ShownMinimized, (args) => {\r\n me.templateRenderer.hideTypingIndicator();\r\n });\r\n me.subscribe(WidgetTypes.ChatRoom + ChatEvents.OnChatJoined, (args) => {\r\n // CHAT-6280-Handle PreChat hits, subscribed onChatJoined method from chatroom-v3.js\r\n });\r\n\r\n /* messenger is taking instance of PreChatMessageHandler with few important arguments\r\n * */\r\n me.messenger = new PreChatMessageHandler( // encapsulated message handler for PreChat\r\n Object.assign(me.options, {\r\n context: me.DOM,\r\n prechatTemplate: preChatTemplate({\r\n\r\n }),\r\n prechatModel: me.options.preChat\r\n })\r\n );\r\n }\r\n\r\n create() {\r\n super.create();\r\n const me = this;\r\n me.view = new WidgetView({\r\n dom: this.DOM,\r\n identifier: WidgetTypes.PreChat,\r\n templates: [\r\n {\r\n key: WidgetStates.ShownMaximized,\r\n tpl: preChatTemplate({\r\n title: 'My Webpage',\r\n }),\r\n model: me.options.preChat,\r\n async afterRender(tpl) {\r\n me.messagesContainer = me.DOM.getElementById('apexchat_prechat_message');\r\n\r\n me.templateRenderer.showAgentName();\r\n const handleQuestionTypeResponse = async (res) => {\r\n const module = await import(/* webpackChunkName: \"handlePrechatQuestionType\" */ './handlePrechatQuestionType')\r\n const handlePrechatQuestionType = module.default;\r\n handlePrechatQuestionType(me, res.res || res);\r\n };\r\n var message = me.options.preChat.preChatMessages[0];\r\n if (!me.QTRendererExt) {\r\n const module = await import(/* webpackChunkName: \"questionTypeRendererExtension\" */ '../questiontypes/QuestionTypeRendererExtension')\r\n const QuestionTypeRendererExtentions = module.default;\r\n me.QTRendererExt = new QuestionTypeRendererExtentions();\r\n await me.QTRendererExt.initComponent(\r\n Object.assign(me.options.preChat, {\r\n isUpdateSupported: false,\r\n context: me.DOM,\r\n messagesContainer: me.messagesContainer,\r\n responseCallback: handleQuestionTypeResponse,\r\n enableFullTextLogic: true,\r\n widgetType: WidgetTypes.PreChat,\r\n countryCode: me.options.countryCode\r\n })\r\n );\r\n }\r\n\r\n const isPreChatMaximized =\r\n me.state.getStateValue(WidgetTypes.PreChat) ===\r\n WidgetStates.ShownMaximized;\r\n // JIRA_7493 & 7477 ChatId Null issue\r\n me.options.chatId = me.options.chatId || me.getChatId();\r\n if (\r\n me.isChatActive() &&\r\n me.isPageRefreshed() &&\r\n isPreChatMaximized &&\r\n me.options.chatId\r\n ) {\r\n import(/* webpackChunkName: \"liveChatRoom\" */ '../core/LiveChatRoom').then((module) => {\r\n const LiveChatRoom = module.default;\r\n // Creating ChatRoom object for sending the prechat Agent Script's replies to dashboard via websync.\r\n me.prechatRoom = new LiveChatRoom(\r\n Object.assign(me.options, me.options.model)\r\n );\r\n\r\n // We don't need to subscribe this channel if exit-popup is in maximize state and user refresh the page,\r\n // if we do that the last message of the user will show as a duplicate message on exit-popup\r\n me.prechatRoom.subscribeToChatChannel(me.options.chatId);\r\n let participants = ApexChat.localStorageAPI.Get(\r\n 'livechat_chat_participants'\r\n );\r\n if (participants) {\r\n participants = JSON.parse(participants);\r\n me.onParticipantsChanged(participants);\r\n }\r\n });\r\n }\r\n // pasre/apply pre chat theme setting\r\n me.skin = JSON.parse(me.options.preChat.preChatThemeSetting);\r\n if (!me.skin) {\r\n me.skin = me.DEFAULT_PRECHAT_CONFIG;\r\n }\r\n me.handleADA(\r\n me.DOM.querySelector('#apexchat_prechat_close_message_popup'),\r\n async (e) => {\r\n await me.preChatCloseMessagePopup(me, e);\r\n }\r\n );\r\n me.handleADA(\r\n me.DOM.querySelector('#apexchat_prechat_rd_close_btn_icon'),\r\n async (e) => {\r\n await me.preChatCloseMessagePopup(me, e);\r\n }\r\n );\r\n // me.handleADA(\r\n // me.$('#apexchat_prechat_rd_close_btn_icon', me.DOM)[0],\r\n // (e) => {\r\n // me.closeMessagePopup(e);\r\n // }\r\n // );\r\n\r\n\r\n me.options.handlerImageUrl = AgentImageHandler(me.options.handlerImageUrl)\r\n\r\n // if the user name has a space then we need to enclose the image URL in single quote.\r\n me.skin.handlerImageUrl = `${AgentImageHandler(me.options.handlerImageUrl)}`;\r\n const rdThemeSettings =\r\n me.options && me.options.rdThemeSettings\r\n ? ApexChat.TryParse(me.options.rdThemeSettings)\r\n : null;\r\n let skinJson = {\r\n container: '',\r\n preChat: me.skin\r\n };\r\n skinJson.rdThemeSettings = rdThemeSettings;\r\n /* Branding - PreChat */\r\n const brandingInfo = skinJson.rdThemeSettings.branding || {};\r\n if (brandingInfo.brandingIsEnabled) {\r\n var branding = new Branding()\r\n skinJson.global = { branding: brandingInfo };\r\n branding.init({\r\n widget: BrandingWidget.RD_PreChat,\r\n brandConfig: skinJson\r\n })\r\n skinJson = branding.getBrandedConfig();\r\n }\r\n setPrechatStyles(me.DOM, skinJson);\r\n addStyleTextInIframe(\r\n me.options.invitationWidgetStyleCustom,\r\n 'apexchat_custom_fontAwesome',\r\n undefined,\r\n me.DOM\r\n );\r\n\r\n // // set UI configuration\r\n // Utils.fontsLoaded({\r\n // fontName: 'Avenir',\r\n // context: me.DOM,\r\n // window: me.iFrameWindow,\r\n // onSuccess() {\r\n // me.UIConfiguration();\r\n // }\r\n // });\r\n\r\n me.UIConfiguration().then(() => {\r\n if (me.DOM && me.DOM.getElementById('apexchat_prechat_chat_icon')) {\r\n let backgroundImage = getStyle(\r\n me.DOM.getElementById('apexchat_prechat_chat_icon'),\r\n 'background-image'\r\n );\r\n if (backgroundImage && backgroundImage.indexOf('.png') === -1) {\r\n me.DOM.querySelector('#apexchat_prechat_main_bg').classList.add(\r\n 'apexchat_css_background_transparent'\r\n );\r\n }\r\n }\r\n });\r\n //await me.UIConfiguration();\r\n\r\n\r\n // hideElement(\r\n // me.DOM.getElementById('apexchat_prechat_message_popup')\r\n // ); // Hide the initial popup\r\n\r\n // CHAT_8288 - Remove white background for all image extension and added for .png only\r\n\r\n }\r\n }\r\n ],\r\n initialState: WidgetStates.ShownMaximized\r\n });\r\n }\r\n\r\n postPreChatMessages(res) {\r\n const me = this;\r\n // We need to prevent multiple posting of same ChatLogID, created an array and saving the chatlogId\r\n me.postedPreChatMessagesArray = me.postedPreChatMessagesArray || [];\r\n // if the chatlogId is already being posted, preventing it to repost which was making text appear twice in dashboard\r\n if (\r\n res.chatLogId &&\r\n me.postedPreChatMessagesArray.indexOf(res.chatLogId) !== -1 &&\r\n !(res.questionType != ScriptsQuestionType.Text)\r\n ) {\r\n return false;\r\n }\r\n // saving chatlogId is array\r\n // check checklogid exists or not\r\n if (res.chatLogId && me.postedPreChatMessagesArray.indexOf(res.chatLogId) !== -1) {\r\n me.postedPreChatMessagesArray.push(res.chatLogId);\r\n }\r\n me.postMessage({\r\n event: WidgetTypes.PreChat + WidgetStates.MessageSent,\r\n data: res\r\n });\r\n const pubSub = new PubSub();\r\n const domRendered = pubSub.allSubscriptions()[WidgetTypes.DOMUIController]; // DOM has not opened?\r\n // We only need to send the PreChat Agent Script's replies to dashboard via 'prechatRoom' object until DOM appeared.\r\n me.startChatFromPreChat(); /* <--CHAT-6961 - Open Chat window, no need to continue mapping on prechat */\r\n if (!domRendered) {\r\n me.prechatRoom.setWebSyncClient();\r\n me.prechatRoom.publishQuestionTypeResponse(res);\r\n // Set the visitor selection of question type\r\n res.visitorSelectedOptions = res.answers;\r\n res.questionType = me.QTRendererExt.questionTypeRenderer.renderer.model.questionType;\r\n res.questionTypeDisplayListForVisitor =\r\n me.QTRendererExt.questionTypeRenderer.renderer.model.questionTypeDisplayListForVisitor;\r\n res.id = res.chatLogId;\r\n\r\n res.visitorScriptAnswer = res.answers;\r\n res.visitorResponseStatus = res.isSkipped\r\n ? ScriptVisitorResponseStatus.Skipped\r\n : ScriptVisitorResponseStatus.Answered;\r\n me.QTRendererExt.questionTypeRenderer.setVisitorSelection(res);\r\n me.prechatRoom.sendMessage({\r\n chatMsg: res.msgText,\r\n questionTypeChatLogIdToBeUpdated: res.questionTypeChatLogIdToBeUpdated\r\n });\r\n }\r\n }\r\n\r\n isChatAlreadyStartedFromPreChat() {\r\n // ref. CHAT-4589\r\n const lastDOMState = this.state.getStateValue(WidgetTypes.DOM);\r\n const currentPreChatState = this.getCurrentState();\r\n // the following condition ensures that:\r\n return (\r\n this.isChatInProgress() && // 1. Chat was started on PreChat or PreChatMessage Click\r\n lastDOMState == WidgetStates.ShownMinimized && // 2. Then DOM was minimized\r\n currentPreChatState == WidgetStates.ShownMaximized\r\n ); // 3. and PreChat has appeared back in Max/default state\r\n }\r\n\r\n startChatFromPreChat(e, config) {\r\n const me = this;\r\n\r\n // is there a srcElement passed and it has a data attribute named shouldStartChat with value = false? return.\r\n if (\r\n (config && !config.srcElement) ||\r\n (config && config.srcElement && !config.srcElement.getAttribute('data-should-start-chat'))\r\n ) {\r\n return false;\r\n }\r\n // me.postMessage({ event: WidgetTypes.PreChat + WidgetStates.Clicked, data: {} });\r\n // me.initiatedBy = 'PreChat';\r\n me.state.changeState({\r\n toState: WidgetStates.Clicked,\r\n value: { initiatedBy: 'PreChat' }\r\n });\r\n if (me.isWindowedStarted() || me.options.chatMode == ChatMode.Windowed) {\r\n me.options.chatInitiatedBy = 'PreChat';\r\n me.startWindowedChat(\r\n Object.assign(me.options, {\r\n shouldContinueMapping: ApexChat.shouldContinueMapping,\r\n FullTextVisitorResponse: ApexChat.FullTextVisitorResponse\r\n })\r\n ); // pass parameter as a querystring\r\n }\r\n me.closePreChatUI();\r\n }\r\n\r\n closePreChatUI() {\r\n const me = this;\r\n ApexChat.preChatElement = null;\r\n // when closing prechat msg IFrame should resize.\r\n me.postMessage({\r\n event: 'prechat-auto-resizing',\r\n data: {\r\n isResetIframe: true,\r\n isSingleMsg: true,\r\n hideCloseButton: true // we need to hide close button\r\n }\r\n });\r\n }\r\n\r\n async UIConfiguration() {\r\n const me = this;\r\n const position = me.options.preChat.preChatPosition;\r\n // get width/height of prechat object without popup message\r\n const el = me.DOM.getElementById('apexchat_prechat_chat_icon');\r\n if (el) {\r\n me.iconWidth = (el.offsetWidth ? el.offsetWidth : 80) + 30;\r\n me.iconHeight =\r\n (el.offsetHeight ? el.offsetHeight : 80) +\r\n (me.skin.outerObject.hideOuterObject ? 0 : 20);\r\n ApexChat.PreChatIconDimensions = {\r\n Width: me.iconWidth,\r\n Height: me.iconHeight\r\n };\r\n }\r\n\r\n me.templateRenderer.hideMessagePopup();\r\n // apply css class to prechat object base on position\r\n me.applyCssClass(position);\r\n if (!me.isVideoGreetMax) {\r\n // check video greet maximize\r\n // notify iframe for resize\r\n me.postMessage({\r\n event: 'prechat-size',\r\n data: {\r\n width: me.iconWidth,\r\n height: me.iconHeight,\r\n onCreateSizing: true,\r\n addValue: me.templateRenderer.heightPosition\r\n }\r\n });\r\n }\r\n if (!me.isChatInProgress()) {\r\n // ref. CHAT-4589: we should stop pre-chat message popups on susequent page reloads\r\n if (me.options && !me.options.preChat.disablePrechatPopup) {\r\n await me.queueAutoMessaging();\r\n }\r\n }\r\n const popupSelector = me.DOM.querySelector('#apexchat_prechat_close_message_popup')\r\n // bind close button\r\n if (me.options.isMobile) {\r\n //me.$(popupSelector, me.DOM).show();\r\n popupSelector.style.display = 'block';\r\n }\r\n popupSelector.addEventListener('click', async (e) => {\r\n await me.preChatCloseMessagePopup(me, e);\r\n })\r\n me.DOM.querySelector('#apexchat_prechat_rd_close_btn_icon').addEventListener('click', async (e) => {\r\n await me.preChatCloseMessagePopup(me, e);\r\n });\r\n //binding event on DOM because elements are not generated the time when this code runs\r\n me.DOM.addEventListener('click', function (e) {\r\n if (e.target.closest('.apexchat_mc_ata_list') || e.target.closest('.live_chat_scheduler_bg')) {\r\n me.startChatFromPreChat(); // click on option DOM window open\r\n }\r\n });\r\n me.eventSubscription();\r\n // get icon object for start chat event binding default use inner object but if inner object is hide then use outer object\r\n let startChatDiv = 'apexchat_prechat_chat_icon';\r\n if (me.skin.innerObject.hideInnerObject) {\r\n startChatDiv = 'apexchat_prechat_main_bg';\r\n }\r\n this.options.containerId = startChatDiv;\r\n\r\n me.setClickCallToAction(startChatDiv, 'PreChat', {\r\n shouldContinueMapping: ApexChat.shouldContinueMapping,\r\n FullTextVisitorResponse: ApexChat.FullTextVisitorResponse\r\n }); // pass parameter to send via query string\r\n const domState = me.state.getStateValue(WidgetTypes.DOM);\r\n const videGreetState = me.state.getStateValue(WidgetTypes.VideoGreetInvitation)\r\n if ((domState == WidgetStates.ShownMinimized || domState == WidgetStates.Closed) && !me.isChatActive()) {\r\n // when dom is minimized/closed and chat is inactive we need to show prechat widget\r\n me.show();\r\n } else if ((me.options && me.options.videoGreetEnabled && videGreetState === undefined) || (me.getCurrentState() == WidgetStates.Hidden && me.isChatActive())) {\r\n me.hide();\r\n } else {\r\n // Stop to show the prechat initial messages and hide the widget when chat started already.\r\n if (domState == WidgetStates.ShownMaximized) {\r\n me.resetMessageCounterCache();\r\n me.options.preChat.preChatMessages = [];\r\n me.hide();\r\n } else {\r\n me.show();\r\n }\r\n }\r\n }\r\n\r\n async preChatCloseMessagePopup(me, e) {\r\n const module = await import(/* webpackChunkName: \"preChatCloseMessagePopup\" */ './preChatCloseMessagePopup')\r\n const preChatCloseMessagePopup = module.default;\r\n preChatCloseMessagePopup(me, e);\r\n }\r\n\r\n eventSubscription() {\r\n const me = this;\r\n const hideIt = function () {\r\n me.isChatStartedFromPreChat = true; // CHAT-7681 Iphone prechat double greeting Issue\r\n if (me.options.chatMode == ChatMode.DOM) {\r\n // do not hide for iphone.\r\n // in case of hiding, the dom is not reading some defined values\r\n // CHAT-6151\r\n if (me.options.isMobile && /iPad|iPhone|iPod/.test(navigator.userAgent)) {\r\n // reset message counter\r\n // this is a hack for the release\r\n // mahad will come up with better solution for this later.\r\n me.pipeMessageHandler.reset(); // stop all processing of pipe messages if its running for iphone\r\n me.resetMessageCounterCache();\r\n me.templateRenderer.hideMessagePopup();\r\n me.hide();\r\n return;\r\n }\r\n me.hide();\r\n me.closePreChatUI(); // CHAT-7155 - Closing PreChat UI When opening DOM for context resolving issues.\r\n } else {\r\n window.clearTimeout(me.messageTimeout);\r\n me.resetMessageCounterCache();\r\n me.templateRenderer.hideMessagePopup();\r\n }\r\n };\r\n const chatStartedFromExitPopup = function () {\r\n me.hide();\r\n };\r\n const chatStartedFromPrechat = function () {\r\n me.isChatStartedFromPreChat = true; // CHAT-7681 Iphone prechat double greeting Issue\r\n // CHAT-6794 // need to remove the last stored mapped question because another parent question has appeared.\r\n ApexChat.storageAPI.Remove(TempCache.APEXCHAT_PRECHAT_MAPPED_QUESTION_COOKIE);\r\n // Show Windowed Widget instead DOM, when Windowed chat already started\r\n if (me.options.chatMode === ChatMode.DOM) {\r\n me.closePreChatUI();\r\n hideIt();\r\n }\r\n };\r\n const cleanUp = function () {\r\n // JIRA_6472 - Greeting was not appearing on reinitializing\r\n // summary: Removing the PreChat Message Sent helped the greeting to appear it again.\r\n ApexChat.storageAPI.Remove(TempCache.PreChat_Message_Sent);\r\n };\r\n const showIt = function () {\r\n const domState = me.state.getStateValue(WidgetTypes.DOM);\r\n if (domState == WidgetStates.ShownMaximized) {\r\n return;\r\n }\r\n me.show();\r\n };\r\n // subscribe for chat Message and typing indicator when chat mode has set to dom\r\n if (me.options.chatMode == ChatMode.DOM) {\r\n me.subscribe(WidgetTypes.ChatRoom + ChatEvents.OnMessageArrived, (args) => {\r\n if (\r\n me.state.getStateValue(WidgetTypes.PreChat) ===\r\n WidgetStates.ShownMaximized &&\r\n me.options.preChatMessageAnimation !== PreChatMessageAnimation.Default\r\n ) {\r\n // specifically for Stacking and Mobile Stacking Animation, we dont need runAfter for that animation\r\n me.onMessageArrived(args.m, args.initialLoad, args.index); // BUG-CHAT-7457 Minimize PreChat for Stacking not working properly\r\n } else {\r\n RunAfter(\r\n () => {\r\n me.onMessageArrived(args.m, args.initialLoad, args.index);\r\n },\r\n me.state.getStateValue(WidgetTypes.PreChat) ===\r\n WidgetStates.ShownMaximized\r\n ? 0\r\n : 1000\r\n );\r\n }\r\n });\r\n me.subscribe(WidgetTypes.ChatRoom + ChatEvents.OnTypingArrived, (args) => {\r\n me.onTypingArrived(args);\r\n });\r\n\r\n me.subscribe(WidgetTypes.DOM + WidgetStates.Closed, showIt);\r\n me.subscribe(WidgetTypes.DOM + WidgetStates.ShownMinimized, showIt);\r\n }\r\n // subscribe for start chat event from any invitation\r\n me.subscribe(\r\n WidgetTypes.ExitPopup + WidgetStates.ShownMaximized,\r\n chatStartedFromExitPopup\r\n );\r\n me.subscribe(WidgetTypes.ExitPopup + WidgetStates.Closed, showIt);\r\n me.subscribe(WidgetTypes.DropDown + WidgetStates.Clicked, hideIt);\r\n me.subscribe(WidgetTypes.Bar + WidgetStates.Clicked, hideIt);\r\n me.subscribe(WidgetTypes.Tab + WidgetStates.Clicked, hideIt);\r\n me.subscribe(WidgetTypes.PreChat + WidgetStates.Clicked, chatStartedFromPrechat);\r\n me.subscribe(\r\n WidgetTypes.ChatRoom + ChatEvents.OnParticipantsChanged,\r\n (participants) => {\r\n me.onParticipantsChanged(participants);\r\n }\r\n );\r\n me.subscribe(WidgetTypes.VideoGreetInvitation + WidgetStates.Closed, async () => {\r\n me.postMessage({\r\n event: 'videogreet-gif-file-loaded',\r\n data: {\r\n imageUrl: me.options.videoGreet.animatedImageUrl\r\n }\r\n });\r\n me.isVideoGreetMax = false;\r\n me.isVideoGreet = true;\r\n showIt();\r\n await me.preChatCloseMessagePopup(me);\r\n });\r\n // When Chat Session Ends, On very next message from Visitor, an overlay mask for starting new chat appears,\r\n // & visitor starts the chat at this point we need to delete few cookies for PreChat.\r\n me.subscribe(WidgetTypes.ChatRoom + ChatEvents.OnSendMessageFailure, cleanUp);\r\n }\r\n\r\n onParticipantsChanged(participants) {\r\n const me = this;\r\n ApexChat.localStorageAPI.Store('livechat_chat_participants', JSON.stringify(participants));\r\n ApexChat.preChatMsgTemplate = null;\r\n const image = me.DOM.getElementById('apexchat_prechat_chat_icon');\r\n // get old url for comparison\r\n const prevUrl = image.style.backgroundImage;\r\n for (let i = 0; i < participants.length; i++) {\r\n // change image if operator joins for the first time\r\n if (\r\n participants[i].userId > 0 &&\r\n prevUrl != participants[i].handlerImageUrl &&\r\n participants[i].handlerImageUrl\r\n ) {\r\n const imageUrl = AgentImageHandler(participants[i].handlerImageUrl);\r\n image.style.backgroundImage = `url('${imageUrl}')`;\r\n }\r\n }\r\n }\r\n\r\n applyCssClass(position) {\r\n // apply css classes base on pre chat position\r\n const me = this;\r\n // remove default classes\r\n removeClass(\r\n me.DOM.getElementById('apexchat_prechat_main_container'),\r\n 'apexchat_prechat_theme_margin'\r\n );\r\n removeClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'apexchat_prechat_tri_left'\r\n );\r\n removeClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'apexchat_prechat_left_top'\r\n );\r\n removeClass(\r\n me.DOM.getElementById('apexchat_prechat_close_message_popup'),\r\n 'apexchat_prechat_x_right'\r\n );\r\n removeClass(\r\n me.DOM.getElementById('apexchat_prechat_message_popup'),\r\n 'apexchat_prechat_tri_left_theme'\r\n );\r\n addClass(\r\n me.DOM.getElementById('apexchat_prechat_close_message_popup'),\r\n 'apexchat_prechat_x'\r\n );\r\n\r\n me.DOM.getElementById('apexchat_prechat_main_container').style.position = 'relative';\r\n me.DOM.getElementById('apexchat_prechat_main_bg').style.position = 'fixed';\r\n switch (position) {\r\n case Position.Left:\r\n me.templateRenderer.renderOnLeftPosition();\r\n break;\r\n case Position.Right:\r\n me.templateRenderer.renderOnRightPosition();\r\n break;\r\n }\r\n }\r\n showMessagePopupAndPublishAutoResize() {\r\n const me = this;\r\n const ele = me.DOM.getElementById('apexchat_prechat_message_popup');\r\n const padding = 15; // increased 15px// CHAT-5979 [V3] Pre - chat with default animation is cutting of shadow on top.\r\n ele.style.transition = 'opacity 0.3s, top 0.3s';\r\n ele.style.opacity = 1\r\n ele.style.display = \"block\"\r\n ele.style.top = padding + 'px'\r\n if (ele) {\r\n // we need calculations here for placing msg popup with animation one over the other.\r\n setTimeout(() => {\r\n const calcCurrentMsgHeight = getHeightOfElement(ele);\r\n console.log('popUpUI calcCurrentMsgHeight' + calcCurrentMsgHeight)\r\n me.postMessage({\r\n event: 'prechat-auto-resizing',\r\n data: {\r\n currentMsgHeight: calcCurrentMsgHeight,\r\n isSingleMsg: true\r\n }\r\n });\r\n }, 50)\r\n }\r\n }\r\n async autoMessageRendering(options) {\r\n const me = this;\r\n const { message } = options;\r\n const { chatMsg } = options;\r\n // as we are making Mock JSON for Pipe messaging, In case of Default Animation, we need to prevent the appending of content\r\n if (me.options.preChatMessageAnimation === PreChatMessageAnimation.Default) {\r\n if (message && message.messageType !== PreChatMessageType.plain_Text) {\r\n message.dontAppendExisitngContent = true;\r\n }\r\n if (chatMsg && chatMsg.messageType !== PreChatMessageType.plain_Text) {\r\n chatMsg.dontAppendExisitngContent = true;\r\n }\r\n }\r\n const { index } = options;\r\n // check message type is script message or plain message\r\n if (\r\n (index == -1 && chatMsg) ||\r\n (message &&\r\n message.messageType == PreChatMessageType.agent_Script &&\r\n message.agentScript)\r\n ) {\r\n const questionType = chatMsg ? chatMsg.questionType : message.questionType;\r\n me.messagePopupUI.render(chatMsg || message);\r\n me.messagePopupUI.clear();\r\n await me.renderScriptMessage(chatMsg || message.agentScript);\r\n me.messagePopupUI.questionTypeUIConfiguration(questionType);\r\n } else {\r\n // create model for message logging\r\n const messageLog = {};\r\n messageLog.visitorId =\r\n me.options.visitorId || getCookieValue('livechat_visitor_id') || 0;\r\n messageLog.visitorId |= 0;\r\n messageLog.text = message.message;\r\n messageLog.sourceType = SourceType.PreChat;\r\n await me.logMessageOnServer(messageLog);\r\n // render plain text message\r\n me.messagePopupUI.render(message);\r\n }\r\n me.showMessagePopupAndPublishAutoResize();\r\n // check message is prechat or chat flow\r\n if (\r\n !options.isPipedMessage &&\r\n message &&\r\n message.questionType == ScriptsQuestionType.None\r\n ) {\r\n await me.queueNextMessage(index + 1, message.duration * 1000);\r\n }\r\n if (options.cb) {\r\n options.cb();\r\n }\r\n }\r\n\r\n async displayMessagePopup(index, isPreChatMessage, chatMsg) {\r\n const me = this;\r\n logIt('displayMessagePopup')\r\n if (me.isWindowedStarted()) {\r\n return; // no pop message if Windowed has started\r\n }\r\n // if chat started from prechat and chatmsg is undefined and isPreChatMessage true appears thats means its a prechat messages appearing so we dont need it to show because chat has already been started\r\n // Also, on windowed mode if chat started then we dont need to show popup while windowed mode is on.\r\n if (!chatMsg && me.isChatStartedFromPreChat && isPreChatMessage) {\r\n me.templateRenderer.hideTypingIndicator();\r\n return;\r\n }\r\n const isFromHistory = chatMsg && chatMsg.isFromHistory;\r\n const preChatMsg = me.options.preChat.preChatMessages[index];\r\n // CHAT-7226 Next Mapped Question Logic Change\r\n // as option property removed from backend now we explicity add option property to our msg.options object,\r\n // because all QT UI depend upon that property.\r\n if (\r\n preChatMsg &&\r\n preChatMsg.questionType != ScriptsQuestionType.None &&\r\n preChatMsg.agentScript &&\r\n preChatMsg.agentScript.options\r\n ) {\r\n preChatMsg.agentScript.options = addOptionProperty(\r\n preChatMsg.agentScript.options\r\n );\r\n }\r\n // increase and display message counter\r\n // JIRA_4241 - in case of Last PreChatMessage no need to add counter!\r\n if (\r\n me.options.preChat.preChatMessages[index] &&\r\n !me.options.preChat.preChatMessages[index].isLastPreChatMessage &&\r\n !isFromHistory\r\n ) {\r\n const questionTypeId = ApexChat.storageAPI.Get('questionTypeId'); // check if question exists\r\n questionTypeId &&\r\n questionTypeId == me.options.preChat.preChatMessages[index].agentScriptAnswerId\r\n ? me.setMessageCounterCache(0)\r\n : me.setMessageCounterCache(1);\r\n }\r\n me.messagePopupUI = me.templateRenderer.popupUI(me.options.isPreChatRoundedTheme);\r\n me.messagePopupUI.setMessageTemplate();\r\n me.displayMessageCounter();\r\n me.isPreChatMessage = isPreChatMessage;\r\n me.agentScriptAnswerId = 0;\r\n me.allowBackgroundClick = true;\r\n /// Wait for the flag/setting called “re-show after” which wipes the cookies after X amount of minutes and will treat them as a new visitor\r\n me.prechatStartedTimeout = window.setTimeout(() => {\r\n ApexChat.storageAPI.StoreTemp('livechat_prechat_started', false);\r\n }, me.options.reShowIntervalMinutes * 60 * 1000);\r\n // checking message type is prechat message or chat message\r\n if (isPreChatMessage && !me.isChatStartedFromPreChat) {\r\n // get prechat message\r\n var message = me.options.preChat.preChatMessages[index];\r\n if (message) {\r\n message.message = parseTemplate(\r\n removeTextFollowedByColon(message.message),\r\n me.options\r\n );\r\n }\r\n message.text = message.text || message.message;\r\n const msgObject = {\r\n m: message.agentScript || message\r\n };\r\n\r\n if (me.pipeMessageHandler.isValidPipedMessage(msgObject)) {\r\n me.hideMessageCounter(); // Hide counter in case of Pipe messages\r\n msgObject.isSplitMessage = true; // if message is piped define isSplitMessage to true\r\n // CHAT-7351- Split Message send as a one message on server.\r\n // in below logic we just send a pipe message as one message to server\r\n const messageLog = {};\r\n // create model for message logging\r\n messageLog.visitorId =\r\n me.options.visitorId || getCookieValue('livechat_visitor_id') || 0;\r\n messageLog.text = removeTextFollowedByColon(msgObject.m.text);\r\n messageLog.scriptAnswerId = msgObject.m.id;\r\n messageLog.questionType = msgObject.m.questionType;\r\n messageLog.isNextQuestionMapped = msgObject.m.isNextQuestionMapped;\r\n messageLog.visitorResponseType = msgObject.m.visitorResponseType;\r\n messageLog.options = msgObject.m.options;\r\n messageLog.visitorResponseStatus = ScriptVisitorResponseStatus.UnAnswered;\r\n messageLog.questionTypeDisplayListForVisitor = msgObject.m.displayListForVisitor;\r\n messageLog.sourceType = SourceType.PreChat;\r\n messageLog.agentScriptDocuments = msgObject.m.isDocument && msgObject.m.agentScriptDocuments ? JSON.stringify(msgObject.m.agentScriptDocuments) : '';\r\n messageLog.isDocument = msgObject.m.isDocument;\r\n messageLog.isSmsTransfer = msgObject.m.isSmsTransfer || message.isSmsTransfer;\r\n await me.logMessageOnServer(messageLog); // logging message to server\r\n me.pipeMessageHandler.startPolling({\r\n messageDisplayDuration:\r\n message.duration > 100 ? message.duration : message.duration * 1000, // detecting either Its Seconds or Milliseconds\r\n init() {\r\n me.onTypingArrived({ indicator: true });\r\n },\r\n async startPollingCallback(m) {\r\n m.message = m.text;\r\n await me.autoMessageRendering({\r\n chatMsg: m,\r\n index: -1,\r\n isPipedMessage: true\r\n });\r\n // In Piped messages the message can be QT we need QT to not to start chat IF user clicks on their DIV HTML Element\r\n const shouldStartChat = m.questionType == ScriptsQuestionType.None;\r\n me.bindPopupForStartingChat({\r\n popupSelector: me.DOM.querySelector('.apexchat_prechat_message_bubble'),\r\n shouldStartChat\r\n });\r\n },\r\n async lastPollingCallback(args) {\r\n me.onTypingArrived({ indicator: false });\r\n const { m } = args;\r\n m.message = m.text;\r\n await me.autoMessageRendering({\r\n chatMsg: m,\r\n index: -1,\r\n isPipedMessage: true,\r\n cb: args.cb\r\n });\r\n // In Piped messages the last message can be QT we need QT to not to start chat IF user clicks on their DIV HTML Element\r\n const shouldStartChat = m.questionType == ScriptsQuestionType.None;\r\n me.bindPopupForStartingChat({\r\n popupSelector: me.DOM.querySelector('.apexchat_prechat_message_bubble'),\r\n shouldStartChat\r\n });\r\n }\r\n });\r\n return;\r\n } else {\r\n me.autoMessageRendering({\r\n message,\r\n chatMsg,\r\n index\r\n });\r\n }\r\n // checking chatroom msg is script message aur text message\r\n } else if (\r\n chatMsg.scriptAnswerId > 0 &&\r\n chatMsg.questionType != ScriptsQuestionType.None &&\r\n chatMsg.visitorResponseStatus == ScriptVisitorResponseStatus.UnAnswered\r\n ) {\r\n logIt(chatMsg);\r\n me.agentScriptAnswerId = -1;\r\n chatMsg.dontAppendExisitngContent = true; // we need detection here for QT is from Dashboard to handle animation.\r\n me.messagePopupUI.clear();\r\n me.messagePopupUI.render(chatMsg);\r\n await me.QTRendererExt.questionTypeRenderer.renderMessage(\r\n chatMsg,\r\n me.QTRendererExt.afterRenderMessage.bind2(me.QTRendererExt)\r\n );\r\n me.messagePopupUI.questionTypeUIConfiguration(chatMsg.questionType);\r\n } else {\r\n me.messagePopupUI.render(chatMsg);\r\n }\r\n // me.setAllowBackgroundClick();\r\n\r\n me.showMessagePopup(!me.options.isPreChatRoundedTheme, chatMsg || message);\r\n }\r\n\r\n endChat(m) {\r\n const me = this;\r\n me.resetMessageCounterCache();\r\n }\r\n\r\n async queueAutoMessaging() {\r\n const me = this;\r\n if (me.options.preChat.preChatMessages.length > 0) {\r\n let lastPreChatPopoutMessage = me.getLastMessageCache();\r\n if (!lastPreChatPopoutMessage) {\r\n // It means the next message is first to be display\r\n lastPreChatPopoutMessage = {\r\n index: 0,\r\n duration: me.options.preChat.preChatFirstMessageTimeout\r\n ? 1000 * me.options.preChat.preChatFirstMessageTimeout\r\n : 1000\r\n };\r\n } else {\r\n me.setMessageCounterCache(-1);\r\n }\r\n // set online agent always\r\n const roundedMessagePopup = me.DOM.getElementsByClassName('apexchat_prechat_message_bubble');\r\n // .$(me.DOM.getElementById('apexchat_prechat_message_popup_container'))\r\n // .find('.apexchat_prechat_message_bubble');\r\n if (roundedMessagePopup.length > 0) {\r\n me.templateRenderer.renderer.showOnlineAgentTag();\r\n }\r\n // CHAT-6794 [PreChat] - Mapped Question on Page Refresh not appearing\r\n // summary: if mapped question has appeared, in case of refresh it should appear again instead of parent question\r\n const hasMappedQuestionAppeared = storageAPIExists(\r\n TempCache.APEXCHAT_PRECHAT_MAPPED_QUESTION_COOKIE\r\n );\r\n let lastMappedQuestion;\r\n if (hasMappedQuestionAppeared) {\r\n lastMappedQuestion = JSON.parse(\r\n getStorageAPIValue(TempCache.APEXCHAT_PRECHAT_MAPPED_QUESTION_COOKIE)\r\n );\r\n }\r\n await me.queueNextMessage(\r\n lastPreChatPopoutMessage.index,\r\n lastPreChatPopoutMessage.duration,\r\n lastMappedQuestion\r\n );\r\n }\r\n }\r\n\r\n async queueNextMessage(index, duration, lastMappedQuestion) {\r\n // show next message if available\r\n const me = this;\r\n if (me.options.preChat.preChatMessages.length == index) {\r\n return;\r\n }\r\n if (index < 0) {\r\n // Do not show the next message if somebody close the message and then refresh the page\r\n // In message close event we are setting the index of the last message = -1\r\n return;\r\n }\r\n me.postMessage({ event: 'new-pre-chat-message-arriving' });\r\n if (me.options.preChat.preChatMessages.length > index) {\r\n // CHAT-6794 [PreChat] - Mapped Question on Page Refresh not appearing\r\n // summary: Once a mapped question appears and the visitor decides to refresh the page, rather than the parent question appearing, the visitor will now see the mapped question.\r\n // lastMappedQuestion: Its only for Predefined messages.\r\n // it will be always 'NULL' in case of running Chat session,\r\n // It could be 'Object' only if the last prechat msg was not Parent Question.\r\n //me.messageTimeout = window.setTimeout(() => {\r\n await me.displayMessagePopup(index, true, lastMappedQuestion);\r\n // }, duration);\r\n }\r\n // summary: isPlainText is the plain text when user adds plain text from edit profile not agent scripted plain text.\r\n const isPlainText =\r\n me.options.preChat.preChatMessages[index - 1] &&\r\n me.options.preChat.preChatMessages[index - 1].messageType ==\r\n PreChatMessageType.plain_Text;\r\n // isAgentScript means its agent script.\r\n const isAgentScript =\r\n me.options.preChat.preChatMessages[index - 1] &&\r\n me.options.preChat.preChatMessages[index - 1].messageType ==\r\n PreChatMessageType.agent_Script;\r\n // isQuestionType and None means Plain Text.\r\n const isQTNone =\r\n me.options.preChat.preChatMessages[index - 1] &&\r\n me.options.preChat.preChatMessages[index - 1].questionType ==\r\n ScriptsQuestionType.None;\r\n // JIRA_4241 - Checking that Prechat message is Last, Plain Text and prevent multi-rendering.\r\n if (\r\n me.options.preChat.preChatMessages.length == index && // To Make sure Last PreChat Msg\r\n (isPlainText || (isAgentScript && isQTNone)) &&\r\n !me.options.preChat.preChatMessages[index - 1].isLastPreChatMessage\r\n ) {\r\n // prevent multi-rendering\r\n me.options.preChat.preChatMessages[index - 1].isLastPreChatMessage = true;\r\n //me.messageTimeout = window.setTimeout(() => {\r\n await me.displayMessagePopup(index - 1, true);\r\n me.showMessagePopupAndPublishAutoResize()\r\n //}, duration);\r\n return;\r\n }\r\n me.setLastMessageCache(index, duration);\r\n }\r\n\r\n bindPopupForStartingChat(options) {\r\n const me = this;\r\n const { popupSelector } = options;\r\n const { message } = options;\r\n var popupSelectorElement = popupSelector;\r\n if (popupSelectorElement) {\r\n popupSelectorElement.setAttribute('data-should-start-chat', options.shouldStartChat);\r\n //me.$(popupSelector, me.DOM).data('shouldStartChat', options.shouldStartChat);\r\n popupSelectorElement.addEventListener('click', function (e) {\r\n // if (e.target.matches('.startchat')) {\r\n me.startChatFromPreChat(e, {\r\n srcElement: this,\r\n message\r\n });\r\n //}\r\n });\r\n me.handleADA(\r\n popupSelectorElement,\r\n me.startChatFromPreChat.bind2(this, {\r\n srcElement: popupSelectorElement,\r\n message\r\n })\r\n );\r\n }\r\n\r\n }\r\n\r\n // As we have Rounded Prechat Theme, so the old prechat theme we are calling Classical PreChat\r\n showMessagePopup(isPreChatForClassicalTheme, message) {\r\n // Default OR Classical\r\n const me = this;\r\n // we need different popupSelector for both Classical and Rounded Theme\r\n const popupSelector = isPreChatForClassicalTheme\r\n ? '#apexchat_prechat_message_popup'\r\n : '.apexchat_prechat_message_bubble';\r\n // if question type is none then it return true and store in data attribute\r\n const isQTText =\r\n (message && message.questionType === ScriptsQuestionType.None) ||\r\n message.questionType === ScriptsQuestionType.Time ||\r\n message.questionType === ScriptsQuestionType.TimeCalendar ||\r\n message.questionType === ScriptsQuestionType.CalendarDate;\r\n const popupMessageElement = me.DOM.querySelector(popupSelector);\r\n popupMessageElement.setAttribute('data-should-start-chat', isQTText);\r\n me.setAllowBackgroundClick(message.questionType)\r\n if (me.allowBackgroundClick) {\r\n me.bindPopupForStartingChat({\r\n shouldStartChat: isQTText,\r\n popupSelector: popupMessageElement,\r\n message\r\n });\r\n } else {\r\n // var clonedElement = popupMessageElement.cloneNode(true);\r\n // popupMessageElement.parentNode.replaceChild(clonedElement, popupMessageElement);\r\n //me.$(popupSelector, me.DOM).unbind('click');\r\n }\r\n // me.DOM.getElementById('apexchat_prechat_typing_div').style.display = 'none';\r\n me.DOM.getElementById('apexchat_prechat_main_container').style.width = `${me.iconWidth + 265\r\n }px`;\r\n // update UI object\r\n const el = me.DOM.getElementById('apexchat_prechat_message_popup');\r\n const position = me.options.preChat.preChatPosition;\r\n el.style.display = 'inline-block';\r\n me.templateRenderer.animateMessagePopup(el, position);\r\n // el.style.width = messagePopupWidth;\r\n me.DOM.getElementById('apexchat_prechat_message_div').style.display = 'block';\r\n // me.DOM.getElementById('apexchat_prechat_typing_div').style.display = 'none';\r\n // resize iframe\r\n me.postMessage({\r\n event: 'prechat-size',\r\n data: {\r\n width: me.iconWidth + me.templateRenderer.widgetWidth,\r\n height: me.iconHeight > el.offsetHeight ? me.iconHeight + 10 : el.offsetHeight + 20,\r\n addValue: me.templateRenderer.heightPosition\r\n }\r\n });\r\n me.templateRenderer.hideTypingIndicator();\r\n\r\n }\r\n\r\n async renderScriptMessage(message) {\r\n const me = this;\r\n logIt('renderScriptMessage' + message.text)\r\n me.options.preChat.language = me.options.language || 'eng';\r\n const messageLog = {};\r\n message.text = removeTextFollowedByColon(message.text);\r\n me.agentScriptAnswerId = message.id;\r\n // create model for message logging\r\n messageLog.visitorId =\r\n me.options.visitorId || getCookieValue('livechat_visitor_id') || 0;\r\n messageLog.text = message.text;\r\n messageLog.scriptAnswerId = message.id;\r\n messageLog.questionType = message.questionType;\r\n messageLog.isNextQuestionMapped = message.isNextQuestionMapped;\r\n messageLog.options = message.options;\r\n messageLog.agentScriptDocuments = message.isDocument && message.agentScriptDocuments ? JSON.stringify(message.agentScriptDocuments) : '';\r\n messageLog.isDocument = message.isDocument;\r\n messageLog.visitorResponseStatus = ScriptVisitorResponseStatus.UnAnswered;\r\n messageLog.visitorResponseType = message.visitorResponseType;\r\n messageLog.questionTypeDisplayListForVisitor = message.displayListForVisitor;\r\n messageLog.isSplitMessage = message.isSplitMessage;\r\n messageLog.sourceType = SourceType.PreChat;\r\n messageLog.isSmsTransfer = message.isSmsTransfer;\r\n await me.logMessageOnServer(messageLog);\r\n if (message.questionType == ScriptsQuestionType.FullText) {\r\n message.userId = message.userId || 0;\r\n message.participantDisplayName = message.participantDisplayName || '';\r\n message.createdOn = new Date();\r\n await me.QTRendererExt.questionTypeRenderer.renderMessage(\r\n message,\r\n me.QTRendererExt.afterRenderMessage.bind2(me.QTRendererExt)\r\n );\r\n } else if (message.questionType == ScriptsQuestionType.None && !message.agentScriptDocuments) {\r\n me.DOM.getElementById('apexchat_prechat_message').innerHTML = message.text;\r\n } else {\r\n // render agent script message\r\n me.DOM.getElementById('apexchat_prechat_message').innerHTML = '';\r\n message.userId = message.userId || 0;\r\n message.participantDisplayName = message.participantDisplayName || '';\r\n message.createdOn = new Date();\r\n message.questionTypeDisplayListForVisitor = message.displayListForVisitor;\r\n await me.QTRendererExt.questionTypeRenderer.renderMessage(message);\r\n me.questionTypeUIConfiguration();\r\n }\r\n // here, we make sure we grab the messages which have been shown\r\n // while prechat is displayed/not hidden\r\n const m = message;\r\n const currentPreChatState = me.getCurrentState();\r\n m.isShown = currentPreChatState === WidgetStates.ShownMaximized;\r\n ApexChat.prechatMessagesDisplayed = ApexChat.prechatMessagesDisplayed || [];\r\n if (m.isShown) {\r\n ApexChat.prechatMessagesDisplayed.push(m);\r\n }\r\n }\r\n\r\n setAllowBackgroundClick(questionType) {\r\n const me = this;\r\n if (\r\n questionType >= 0 &&\r\n questionType != ScriptsQuestionType.None &&\r\n questionType != ScriptsQuestionType.Text &&\r\n questionType != ScriptsQuestionType.Time &&\r\n questionType != ScriptsQuestionType.TimeCalendar &&\r\n questionType != ScriptsQuestionType.CalendarDate\r\n ) {\r\n me.allowBackgroundClick = false;\r\n }\r\n }\r\n\r\n questionTypeUIConfiguration(questionType) {\r\n const me = this;\r\n me.setAllowBackgroundClick(questionType);\r\n //TODO\r\n // ADACompliant.push(me.$('.apexchat_ada_compliance', me.DOM)).apply();\r\n me.DOM.querySelector('.apexchat_question_type_close_button')?.style.setProperty('display', 'none', 'important');\r\n me.DOM.querySelector('#apexchat_click_instruction')?.style.setProperty('display', 'none', 'important');\r\n me.DOM.querySelector('#apexchat_participant_display_name')?.style.setProperty('display', 'none', 'important');\r\n me.DOM.querySelector('#apexchat_participant_display_col')?.style.setProperty('display', 'none', 'important');\r\n }\r\n\r\n async logMessageOnServer(log) {\r\n const me = this;\r\n if (me.options.videoGreetEnabled) {\r\n return;\r\n }\r\n if (localstorageAPIExists('livechat_prechat_msg_array')) {\r\n me.messageArray = JSON.parse(localStorageAPIGet('livechat_prechat_msg_array'));\r\n }\r\n if (log.isSplitMessage) {\r\n // if message is splitted message then we dont need to log on server because we already did it\r\n return;\r\n }\r\n const preChatMsgObj = me.getDuplicatedObjectFromArray(me.messageArray, log.text, 'text');\r\n if (preChatMsgObj) {\r\n me.preChatMessageId = preChatMsgObj.id;\r\n return; // duplicated message.\r\n }\r\n const url = `${GlobalVariables.ApexChatBaseUrl}api/prechat/messages`;\r\n // encode just in case there are any HTML tags to avoid request failure due to CSRF\r\n const encodedLog = encodeHTML(JSON.stringify(log));\r\n const response = await fetch(url, {\r\n headers: {\r\n 'Accept': 'application/json',\r\n 'Content-Type': 'application/json; charset=utf-8'\r\n },\r\n method: \"POST\",\r\n body: encodedLog\r\n })\r\n const res = await response.json();\r\n me.preChatMessageId = res.id;\r\n me.messageArray.push({\r\n id: me.preChatMessageId,\r\n text: log.text\r\n });\r\n ApexChat.localStorageAPI.Store(\r\n 'livechat_prechat_msg_array',\r\n JSON.stringify(me.messageArray)\r\n );\r\n me.setPreChatMessageIdsCache(me.preChatMessageId);\r\n }\r\n\r\n getDuplicatedObjectFromArray(array, msg, property) {\r\n let i = array.length;\r\n while (i--) {\r\n if (array[i][property] === msg) {\r\n return array[i];\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n setLastMessageCache(index, duration) {\r\n const me = this;\r\n const message = { index, duration };\r\n Cookies.set(me.lastMessageStoreName, JSON.stringify(message));\r\n }\r\n\r\n getLastMessageCache() {\r\n const me = this;\r\n const message = Cookies.get(me.lastMessageStoreName);\r\n return message ? JSON.parse(message) : null;\r\n }\r\n\r\n /**\r\n * Set the message counter\r\n * @param {value} counter value\r\n */\r\n setMessageCounterCache(value) {\r\n const me = this;\r\n const oldValue = me.getMessageCounterCache();\r\n let newValue = oldValue + value;\r\n if (newValue < 0) {\r\n newValue = 0;\r\n }\r\n Cookies.set(me.messageCounterStoreName, newValue);\r\n }\r\n\r\n getMessageCounterCache() {\r\n const me = this;\r\n const counter = Cookies.get(me.messageCounterStoreName) || 0;\r\n return parseInt(counter);\r\n }\r\n\r\n resetMessageCounterCache() {\r\n const me = this;\r\n Cookies.del(me.messageCounterStoreName);\r\n }\r\n\r\n setPreChatMessageCache(message) {\r\n // store pre chat message data in local storage\r\n const storeName = 'livechat_prechat_messages';\r\n const storeData = Cookies.get(storeName);\r\n let storeJson = JSON.parse(storeData);\r\n if (!storeJson) {\r\n storeJson = [];\r\n }\r\n storeJson.push(message);\r\n Cookies.set(storeName, JSON.stringify(storeJson));\r\n }\r\n\r\n setPreChatMessageIdsCache(id) {\r\n // store pre chat message data in local storage\r\n const storeData = getCookieValue(TempCache.APEXCHAT_PRECHAT_MESSAGE_IDS_COOKIE);\r\n if (storeData) {\r\n var storeJson = JSON.parse(storeData);\r\n }\r\n if (!storeJson) {\r\n storeJson = [];\r\n }\r\n storeJson.push(id);\r\n Cookies.set(\r\n TempCache.APEXCHAT_PRECHAT_MESSAGE_IDS_COOKIE,\r\n stringify(storeJson)\r\n );\r\n }\r\n\r\n displayMessageCounter() {\r\n const me = this;\r\n const messageCounter = me.getMessageCounterCache();\r\n me.templateRenderer.displayMessageCounter(messageCounter);\r\n }\r\n\r\n hideMessageCounter() {\r\n const me = this;\r\n me.templateRenderer.hideMessageCounter();\r\n me.templateRenderer.hideTalkBubbleIcon();\r\n }\r\n\r\n show() {\r\n const me = this;\r\n if (!me.isVideoGreetMax) {\r\n // check video greet maximize\r\n super.show();\r\n this.maximize();\r\n }\r\n me.isVideoGreetMax = false;\r\n // we dont need anymore to show last message from history because now we use delay on MessageArrived\r\n // this.displayLastMessageFromHistory(); //when preChat widget appear after dom minimize,show last message on popup from cookie\r\n }\r\n\r\n // CHAT-7300 - Message not appearing when minimizing the preChat\r\n // To Display Last Message from chat history\r\n // async displayLastMessageFromHistory() {\r\n // const me = this;\r\n // const lastMessage = ApexChat.TryParse(Cookies.get('livechat_chat_lastmessage')); // get last message of chat from cookies\r\n // if (\r\n // lastMessage &&\r\n // lastMessage.questionType !== ScriptsQuestionType.None &&\r\n // (!me.lastMessageDisplayed ||\r\n // (me.lastMessageDisplayed && me.lastMessageDisplayed.id != lastMessage.id))\r\n // ) {\r\n // // check if message is question type and message is not appear before so show it\r\n // if (lastMessage.text.indexOf('||') > -1) {\r\n // // we are not handling pipe message here, as this is perfectly render by onMessageArrived\r\n // return;\r\n // }\r\n // if (lastMessage.options) {\r\n // lastMessage.options = addOptionProperty(lastMessage.options);\r\n // }\r\n // me.lastMessageDisplayed = lastMessage;\r\n // me.templateRenderer.showTypingIndicator();\r\n // //window.setTimeout(() => {\r\n // await me.displayMessagePopup(0, false, lastMessage);\r\n // //}, lastMessage.questionTypeDelaySeconds * 1000);\r\n // }\r\n // }\r\n\r\n hide() {\r\n super.hide();\r\n // resize iframe\r\n this.postMessage(\r\n {\r\n event: WidgetTypes.PreChat + WidgetStates.Hidden,\r\n data: {}\r\n },\r\n '*'\r\n );\r\n window.clearTimeout(this.messageTimeout);\r\n this.pipeMessageHandler.reset(); // stop all processing of pipe messages if its running\r\n // reset message counter\r\n this.resetMessageCounterCache();\r\n this.templateRenderer.hideMessagePopup();\r\n }\r\n\r\n maximize() {\r\n super.maximize();\r\n }\r\n\r\n onMessageArrived(m, initialLoad, index) {\r\n\r\n const me = this;\r\n m.isFromHistory = initialLoad;\r\n // CHAT-7226 Next Mapped Question Logic Change\r\n // as option property removed from backend now we explicity add option property to our msg.options object,\r\n // because all QT UI depend upon that property.\r\n if (m.questionType != ScriptsQuestionType.None && m.options) {\r\n m.options = addOptionProperty(m.options);\r\n }\r\n // summary: If msg is from History & the previous message was CLOSED by user no need to show it again on Page Refresh.\r\n const isPreviousMessageClosed =\r\n m.isFromHistory && !me.getMessageCounterCache() && me.isPageRefreshed();\r\n // System messages always less than 0 & when visitor sends message visitor userId always 0\r\n // For preChat messages we dont need to return,in CHAT-7300 all preChat message and all mapped questions associated with it has preChat userId\r\n // CHAT-7325 Poke Message should not return\r\n // Stop showing \"The visitor has returned to the chat\" message\r\n if (\r\n (m.userId <= 0 &&\r\n !me.isPreChatMessage &&\r\n m.userId !== ParticipantIds.prechat &&\r\n m.userId !== ParticipantIds.pokeMessage) ||\r\n isPreviousMessageClosed ||\r\n m.shouldShowChatEndedMessage ||\r\n m.userId === ParticipantIds.bot || // \"All visitors have left the chat\" message\r\n m.userId === ParticipantIds.nonVisitorSystem // shelve chat message\r\n ) {\r\n // Avoid showing system/visitor messages\r\n return false;\r\n }\r\n // 0.001 second PIPE_QUESTION_TYPE_DELAY_SECOND is no more needed..commenting it for now.\r\n // if (m.questionTypeDelay === ApexChat.PIPE_QUESTION_TYPE_DELAY_SECOND) { //for pipe message we have mentioned 0.001 second but we need that only for DOM for prechat we define 3 seconds\r\n // m.questionTypeDelay = me.options.questionTypeDelay * 1000; // set delay as per profile settings\r\n // }\r\n if (\r\n me.state.getStateValue(WidgetTypes.DOM) === WidgetStates.ShownMinimized ||\r\n me.state.getStateValue(WidgetTypes.ExitPopup) === WidgetStates.Closed\r\n ) {\r\n // todo close/hide event\r\n if (m.isChatEnded) {\r\n me.endChat(m);\r\n } else {\r\n if (m.questionType === ScriptsQuestionType.VideoGreet) {\r\n return;\r\n }\r\n m.isFromPreChat = true;\r\n me.displayMessagePopup(0, false, m);\r\n me.showMessagePopupAndPublishAutoResize()\r\n // TODO:The below code is not needed for now commenting let QA test then I'll remove this. (Mahad)\r\n // m.isLastSplitMessage: No typing indicator and delay required.\r\n // if (m.isLastSplitMessage || !me.options.questionTypeDelay) {\r\n // me.displayMessagePopup(0, false, m);\r\n // } else {\r\n // me.templateRenderer.showTypingIndicator();\r\n // window.setTimeout(function () {\r\n // me.displayMessagePopup(0, false, m);\r\n // }, me.options.questionTypeDelay * 1000);\r\n // }\r\n }\r\n }\r\n }\r\n\r\n onTypingArrived(args, self) {\r\n const me = this;\r\n // if (me.state.getStateValue(WidgetTypes.DOM) == WidgetStates.ShownMinimized) { // todo close/hide event\r\n if (args.indicator) {\r\n // me.DOM.getElementById('apexchat_prechat_typing_div').style.display = 'block';\r\n me.templateRenderer.showTypingIndicator();\r\n // me.templateRenderer.displayMessageCounter();\r\n } else {\r\n // me.DOM.getElementById('apexchat_prechat_typing_div').style.display = 'none';\r\n me.templateRenderer.hideTypingIndicator();\r\n }\r\n // }\r\n }\r\n}\r\n","module.exports = function(obj) {\nobj || (obj = {});\nvar __t, __p = '';\nwith (obj) {\n__p += '\\r\\n
\\r\\n \\r\\n \\r\\n
\\r\\n \\r\\n
\\r\\n
\\r\\n
\\r\\n
\\r\\n \\r\\n
\\r\\n
\\r\\n \\r\\n
\\r\\n \\r\\n
\\r\\n Online Agent\\r\\n
\\r\\n \\r\\n \\r\\n
\\r\\n Close\\r\\n
\\r\\n \\r\\n
\\r\\n
\\r\\n \\r\\n \\r\\n
\\r\\n \\r\\n
\\r\\n \\r\\n

\\r\\n
\\r\\n
\\r\\n \\r\\n \\r\\n\\r\\n';\n\n}\nreturn __p\n}"],"names":["func","timeout","setTimeout","MessageHandler","BaseClass","constructor","options","super","this","Object","assign","objectType","WidgetTypes","ADAHandler","context","prechatModel","messages","push","model","msg","ApexChat","MessageView","wrap","targetElementSelector","renderOninit","template","index","length","status","MessageStatus","Unread","visibility","MessageVisibility","Visible","last","getLastMessage","isFirstMessage","isLastMessage","view","removeClass","duration","preChatMessages","filter","prechatMsgArray","id","animationConfig","preChatMessageAnimation","PreChatMessageAnimation","Stacking","StartFaddingOutAfter","HideMessageAfter","IFrameResizeAfterFaddingOut","closeButtonSupported","MobileStacking","closeButtonHeight","heightCalculation","me","currentMsgView","lastMsg","fixFirstElement","animate","PreChatMessageAnimations","First","isFromHistory","isPageRefreshed","fixUpComingElement","Previous","FadeOut","Upcoming","self","elementObj","ele","$","identifier","postMessage","event","data","currentMsgHeight","getHeightOfElement","isSingleMsg","calcCurrentMsgHeight","TempCache","PRECHAT_Rounded_Message_Popup_Current_Height","css","hide","elementlast","elementmsg","prevMsgHeight","dontAnimateClosebutton","calcLastMsgHeight","PRECHAT_Rounded_Message_Popup_Last_Height","top","noLastMessageOnRefresh","iFrameResizeOnFadeOut","fixLastMsgOnPageRefresh","calcCurrentHeight","getMessageCount","PreChatMessageHandler","storageAPI","WebStorage","type","sessionAPI","loadAll","getTemplate","messageType","questionType","ScriptsQuestionType","None","messageTemplate","userId","participantDisplayName","createdOn","Date","saveAll","setMessageTemplate","i","getFirstMessage","Store","JSON","stringify","cache","Get","parse","isChatActive","PreChatInvitation","BaseWidget","widget","PreChat","styleName","templateRenderer","preChat","console","log","pipeMessageHandler","PipedMessageHandler","DEFAULT_PRECHAT_CONFIG","general","outerObject","hideOuterObject","showImage","backgroundImage","background1Color","background2Color","borderColor","borderWidth","borderRadius","padding","innerObject","hideInnerObject","defaultImage","messagePopup","font","italic","bold","underline","family","size","color","backgroundColor","closeIcon","closeIconSize","width","height","shadowDepth","messageCounter","counterTop","counterRight","renderer","heightPosition","notificationContainer","typingIndicator","showAgentName","animateMessagePopup","el","position","addClass","showTypingIndicator","containerElement","DOM","getElementById","showElement","hideTypingIndicator","hideElement","displayMessageCounter","getMessageCounterCache","innerHTML","style","display","hideMessageCounter","hideTalkBubbleIcon","hideMessagePopup","removeMultipleCSSClasses","roundedMessagePopup","getElementsByClassName","widgetWidth","renderOnLeftPosition","renderOnRightPosition","showOnlineAgentTag","agentName","preChatAgentStatusText","popupUI","render","message","text","clear","questionTypeUIConfiguration","setAllowBackgroundClick","attr","querySelector","setAttribute","preChatThemeSetting","GlobalVariables","preChatRoundedThemeName","isPreChatRoundedTheme","agentNameImageId","_me$DOM$getElementByI","showTypingIndicatorInnerGlider","elem","classList","remove","hideTypingIndicatorInnerGlider","add","_container","preChatMsgTemplate","Default","document","createTextNode","participants","localStorageAPI","participantInfo","_me$DOM$querySelector2","_me$DOM$querySelector","_me$DOM$querySelector3","ParticipantIds","visitor","handlerImageUrl","displayName","cloneNode","messenger","decodeHTML","cleanInvalidHtml","removeTextFollowedByColon","dontAppendExisitngContent","opacity","_renderDefault","_renderStacking","setProperty","chatMode","ChatMode","Windowed","mode","lastMessageStoreName","messageCounterStoreName","subscribe","VideoGreetInvitation","WidgetStates","ShownMaximized","args","videoGreetEnabled","lastVGState","state","getStateValue","isVideoGreet","Hidden","isVideoGreetMax","ready","imageUrl","videoGreet","animatedImageUrl","preChatLoadTimeout","messageArray","create","ShownMinimized","ChatRoom","ChatEvents","OnChatJoined","image","prechatTemplate","preChatTemplate","WidgetView","dom","templates","key","tpl","title","afterRender","messagesContainer","handleQuestionTypeResponse","async","handlePrechatQuestionType","default","res","QTRendererExt","QuestionTypeRendererExtentions","initComponent","isUpdateSupported","responseCallback","enableFullTextLogic","widgetType","countryCode","isPreChatMaximized","chatId","getChatId","then","module","LiveChatRoom","prechatRoom","subscribeToChatChannel","onParticipantsChanged","skin","handleADA","preChatCloseMessagePopup","e","AgentImageHandler","rdThemeSettings","TryParse","skinJson","container","brandingInfo","branding","brandingIsEnabled","Branding","global","init","BrandingWidget","RD_PreChat","brandConfig","getBrandedConfig","setPrechatStyles","addStyleTextInIframe","invitationWidgetStyleCustom","undefined","UIConfiguration","getStyle","indexOf","initialState","postPreChatMessages","postedPreChatMessagesArray","chatLogId","Text","MessageSent","domRendered","PubSub","allSubscriptions","DOMUIController","startChatFromPreChat","setWebSyncClient","publishQuestionTypeResponse","visitorSelectedOptions","answers","questionTypeRenderer","questionTypeDisplayListForVisitor","visitorScriptAnswer","visitorResponseStatus","isSkipped","ScriptVisitorResponseStatus","Skipped","Answered","setVisitorSelection","sendMessage","chatMsg","msgText","questionTypeChatLogIdToBeUpdated","isChatAlreadyStartedFromPreChat","lastDOMState","currentPreChatState","getCurrentState","isChatInProgress","config","srcElement","getAttribute","changeState","toState","Clicked","value","initiatedBy","isWindowedStarted","chatInitiatedBy","startWindowedChat","shouldContinueMapping","FullTextVisitorResponse","closePreChatUI","preChatElement","isResetIframe","hideCloseButton","preChatPosition","iconWidth","offsetWidth","iconHeight","offsetHeight","PreChatIconDimensions","Width","Height","applyCssClass","onCreateSizing","addValue","disablePrechatPopup","queueAutoMessaging","popupSelector","isMobile","addEventListener","target","closest","eventSubscription","startChatDiv","containerId","setClickCallToAction","domState","videGreetState","Closed","resetMessageCounterCache","show","hideIt","isChatStartedFromPreChat","test","navigator","userAgent","reset","window","clearTimeout","messageTimeout","showIt","OnMessageArrived","onMessageArrived","m","initialLoad","RunAfter","OnTypingArrived","onTypingArrived","ExitPopup","DropDown","Bar","Tab","Remove","APEXCHAT_PRECHAT_MAPPED_QUESTION_COOKIE","OnParticipantsChanged","OnSendMessageFailure","PreChat_Message_Sent","prevUrl","Position","Left","Right","showMessagePopupAndPublishAutoResize","transition","autoMessageRendering","PreChatMessageType","plain_Text","agent_Script","agentScript","messagePopupUI","renderScriptMessage","messageLog","visitorId","getCookieValue","sourceType","SourceType","logMessageOnServer","isPipedMessage","queueNextMessage","cb","displayMessagePopup","isPreChatMessage","logIt","preChatMsg","addOptionProperty","isLastPreChatMessage","questionTypeId","agentScriptAnswerId","setMessageCounterCache","allowBackgroundClick","prechatStartedTimeout","StoreTemp","reShowIntervalMinutes","parseTemplate","msgObject","isValidPipedMessage","isSplitMessage","scriptAnswerId","isNextQuestionMapped","visitorResponseType","UnAnswered","displayListForVisitor","agentScriptDocuments","isDocument","isSmsTransfer","startPolling","messageDisplayDuration","indicator","startPollingCallback","shouldStartChat","bindPopupForStartingChat","lastPollingCallback","renderMessage","afterRenderMessage","bind2","showMessagePopup","endChat","lastMappedQuestion","lastPreChatPopoutMessage","getLastMessageCache","preChatFirstMessageTimeout","storageAPIExists","getStorageAPIValue","isPlainText","isAgentScript","isQTNone","setLastMessageCache","popupSelectorElement","isPreChatForClassicalTheme","isQTText","Time","TimeCalendar","CalendarDate","popupMessageElement","language","FullText","isShown","prechatMessagesDisplayed","localstorageAPIExists","localStorageAPIGet","preChatMsgObj","getDuplicatedObjectFromArray","preChatMessageId","url","ApexChatBaseUrl","encodedLog","encodeHTML","response","fetch","headers","method","body","json","setPreChatMessageIdsCache","array","property","Cookies","set","get","newValue","counter","parseInt","del","setPreChatMessageCache","storeName","storeData","storeJson","APEXCHAT_PRECHAT_MESSAGE_IDS_COOKIE","maximize","isPreviousMessageClosed","prechat","pokeMessage","shouldShowChatEndedMessage","bot","nonVisitorSystem","isChatEnded","VideoGreet","isFromPreChat","exports","obj","__t","__p"],"sourceRoot":""}