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E9B,MAAMC,GAAaC,EAAAA,EAAAA,GAAczH,EAAGL,QAAQ+H,uBAAwBJ,IAC9DK,GAAgB7H,EAAAA,EAAAA,GAAe,uCAC/B2F,EAAO,CACTmC,gBAAiB5H,EAAGL,QAAQkI,UAC5BC,UAAW9H,EAAGL,QAAQmI,UACtB7C,YAAakC,EAAQlC,YACrBpB,MAAOsD,EAAQtD,MACfkE,YAAaZ,EAAQa,MAAQ,GAC7BC,SAAUjI,EAAGL,QAAQsI,SACrBC,qBAAsBlI,EAAGmF,mBACzBqC,aACAG,cAAeA,GAAiB,GAChC9H,OAAQsH,EAAQtH,OAChBsI,UAAWhB,EAAQgB,WAEjB9C,EAAa8B,EAAQ9B,YAAc,+BAEzCrF,EAAGE,EAAEkI,QAAQtE,EAAAA,EAAgBuE,mBAAqBhD,EAAYI,GAAO6C,IACjEC,QAAQC,IAAI,gCACZpB,EAASkB,EAAO,GAExB,G,kCClSJ,IAN0B,SAAUG,GAChC,OAAiB,IAAbA,EAAEC,OAIV,C","sources":["webpack://apexchatwidgets/./widgets/templates/visitor_info/visitor_info.ejs","webpack://apexchatwidgets/./widgets/core/hooks/GetChatID.js","webpack://apexchatwidgets/./widgets/core/hooks/WebSmsFormValidator.js","webpack://apexchatwidgets/./widgets/core/hooks/isEnterKeyPressed.js"],"sourcesContent":["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
' +\n((__t = (visitorTitle)) == null ? '' : __t) +\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
\\r\\n
\\r\\n \\r\\n
\\r\\n
' +\n((__t = (visitorName)) == null ? '' : __t) +\n'
\\r\\n
\\r\\n * This field is required.\\r\\n
\\r\\n
\\r\\n
' +\n((__t = (visitorEmail)) == null ? '' : __t) +\n'
\\r\\n \\r\\n * Please provide a valid email address.\\r\\n
\\r\\n
\\r\\n
' +\n((__t = (visitorPhone)) == null ? '' : __t) +\n'
\\r\\n \\r\\n * Please provide a valid phone number.\\r\\n
\\r\\n
\\r\\n
' +\n((__t = (visitorMessage)) == null ? '' : __t) +\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
\\r\\n
\\r\\n';\n\n}\nreturn __p\n}","import getCookieValue from \"./getCookieValue\";\r\n\r\nconst GetChatID = function (options) {\r\n return (\r\n (options.msg != null && options.msg.chatId) ||\r\n options.chatId ||\r\n getCookieValue('livechat_chat_id')\r\n );\r\n};\r\nexport default GetChatID;\r\n","\r\nimport visitorInfoWidgetTemplate from '../../templates/visitor_info/visitor_info.ejs';\r\n\r\nimport CompanyLevelBlockValidator from './CompanyLevelBlockValidator';\r\nimport addStyleText from './addStyleText';\r\nimport parseTemplate from './parseTemplate';\r\nimport GlobalVariables from '../GlobalVariables';\r\nimport PhoneCountryData from '../validators/PhoneContryData';\r\nimport PhoneValidator from '../validators/PhoneValidator';\r\nimport googleAnalyticsObjectInit from './googleAnalyticsObjectInit';\r\nimport getGaClientId from './getGaClientId';\r\nimport GetChatID from './GetChatID';\r\nimport isEnterKeyPressed from './isEnterKeyPressed';\r\nimport Cookies from './Cookies';\r\nimport getCookieValue from './getCookieValue';\r\n\r\nconst WebSmsFormValidator = (options) => {\r\n const init = function () {\r\n const me = this;\r\n me.options = options;\r\n me.$ = ApexChat.ApexChatJquery;\r\n me.context = me.options.context;\r\n me.elements = {\r\n formContainerSelector: '#apexchat_visitorInfo_container_wrapper',\r\n phoneContainerSelector: '#apexchat_visitorInfo_container_wrapper .phone', // may or may not exist, defaults to the message container if not found\r\n phoneWarningSelector:\r\n me.options.phoneWarningSelector ||\r\n '#apexchat_visitorInfo_container_wrapper .phone span',\r\n phoneSelector: 'input[name=phone]',\r\n submitBtnSelector: '.submit-button',\r\n confirmationMessageSelector: '#apexchat_msg_sent',\r\n formVisitorSelector: '#apexchat_form_visitor',\r\n cancelBtnSelector: '.visitorinfo_close'\r\n };\r\n me.messages = {\r\n SENT: 'Thank You!',\r\n FAILED: 'Request submission failed',\r\n PLACEHOLDER_PHONE: 'Enter your mobile number'\r\n };\r\n me.styles = {\r\n SUBMIT_ENABLED: 'apexchat_enabled_submit',\r\n WARNING_ENABLED: 'apexchat_already_exist',\r\n ERROR_ENABLED: 'apexchat_error'\r\n };\r\n me.cookieTime = 60 * 60 * 3;\r\n };\r\n const reset = function () {\r\n const me = this;\r\n me.formSubmit = false;\r\n me.context.querySelector(me.elements.phoneContainerSelector)?.classList.remove(me.styles.WARNING_ENABLED);\r\n me.context.querySelector(me.elements.phoneWarningSelector)?.style.display = 'none'\r\n me.context.querySelector(me.elements.phoneSelector)?.value = '';\r\n me.context.querySelector(me.elements.submitBtnSelector)?.disabled = true;\r\n let confirmationMessageElement = me.context.querySelector(me.elements.confirmationMessageSelector);\r\n confirmationMessageElement?.parentNode.removeChild(confirmationMessageElement);\r\n me.context.querySelector(me.elements.submitBtnSelector)?.classList.remove(me.styles.SUBMIT_ENABLED);\r\n };\r\n const initialDisplay = function () {\r\n const me = this;\r\n const container = me.$(me.elements.formContainerSelector, me.context);\r\n if (container.length) {\r\n me.reset();\r\n me.show();\r\n } else {\r\n me.options.disclaimer = '';\r\n me.options.visitorTitle = parseTemplate(me.options.visitorTitle, me.options);\r\n const formHtml = visitorInfoWidgetTemplate(me.options);\r\n const form = me\r\n .$(\"
\", me.context)\r\n .append(formHtml);\r\n addStyleText(me.options.visitorInfoWidgetCss, 'apexchat_smspop_css');\r\n me.$(me.context.body).append(form);\r\n me.$(me.elements.phoneWarningSelector, me.context).hide();\r\n me.setPlaceHolder();\r\n me.bind();\r\n }\r\n };\r\n const bind = function () {\r\n const me = this;\r\n const buttonEl = me.context.querySelector(me.elements.submitBtnSelector);\r\n const epButtonEl = me.context.querySelector('.ep-submit-button');\r\n buttonEl.addEventListener('click', function () {\r\n me.$(this, me.context).prop('disabled', true);\r\n // var name = $('input[name=name]').val();\r\n const form = buttonEl.closest('form');\r\n const phone = form.querySelector(me.elements.phoneSelector)?.value;\r\n me.formSubmit = true;\r\n if (\r\n typeof GlobalVariables.CompanyLevelBlockedPages !== 'undefined' &&\r\n typeof GlobalVariables.CompanyContextRequest !== 'undefined'\r\n ) {\r\n me.companyLevelBlockValidator = new CompanyLevelBlockValidator(\r\n GlobalVariables.CompanyLevelBlockedPages,\r\n GlobalVariables.CompanyContextRequest,\r\n GlobalVariables.CompanyLevelSettings\r\n );\r\n }\r\n if (\r\n me.companyLevelBlockValidator &&\r\n me.companyLevelBlockValidator.isSMSNumberBlocked(phone)\r\n ) {\r\n // check if typed number is blocked.\r\n return;\r\n }\r\n if (getCookieValue('livechat_web_sms_number') != phone) {\r\n const validator = Object.create(PhoneValidator);\r\n validator.phoneCountryData =\r\n PhoneCountryData[ApexChat.options.countryCode || 'OTHER'];\r\n validator.phone = phone;\r\n const validate = validator.validate();\r\n if (validate) {\r\n if (epButtonEl) {\r\n epButtonEl.textContent = 'Sending...';\r\n epButtonEl.classList.add('pointer-event-none');\r\n }\r\n buttonEl.textContent = 'Sending...';\r\n buttonEl.classList.add('pointer-event-none');\r\n startWebToSms();\r\n function startWebToSms() {\r\n var chatId = GetChatID(me.options);\r\n me.getWebSmsService({ initiatedBy: me.options.chatInitiatedBy, phone: phone, interceptorResults: me.options.interceptorResult, chatId: chatId, serviceUrl: chatId ? '/Handlers/ConvertToSMSHandler.ashx' : '' }, function (res) {\r\n me.$(me.elements.formVisitorSelector, me.context).hide();\r\n let msgSent = me.messages.FAILED;// 'Request submission failed.'\r\n if (res.success && res.data) {\r\n msgSent = me.messages.SENT;\r\n Cookies.setShort('livechat_web_sms_number', phone, me.cookieTime);\r\n }\r\n me.showMessage(msgSent);\r\n buttonEl.textContent = 'Continue';\r\n buttonEl.classList.remove('pointer-event-none');\r\n if (epButtonEl) {\r\n epButtonEl.textContent = 'Continue';\r\n epButtonEl.classList.remove('pointer-event-none');\r\n }\r\n //toggle sms bottom sheet\r\n me.$('#livechat_bottom_sheet_sms_close', me.context).click();\r\n me.$('.apexchat_rd_transfer_to_sms', me.context).hide();\r\n });\r\n }\r\n } else {\r\n me.showError();\r\n if (epButtonEl) {\r\n epButtonEl.textContent = 'Continue';\r\n epButtonEl.classList.remove('pointer-event-none');\r\n }\r\n buttonEl.textContent = 'Continue';\r\n buttonEl.classList.remove('pointer-event-none');\r\n }\r\n } else {\r\n me.showWarning();\r\n }\r\n });\r\n\r\n me.context.querySelector(me.elements.submitBtnSelector)?.disabled = true;\r\n me.context.querySelector(me.elements.phoneSelector)?.addEventListener('keypress', function (event) {\r\n if (isEnterKeyPressed(event)) {\r\n event.preventDefault();\r\n const epButtonEl = me.$('.ep-submit-button', me.context);\r\n if (epButtonEl.length > 0) {\r\n epButtonEl.click();\r\n } else {\r\n me.$(me.elements.submitBtnSelector, me.context).click();\r\n }\r\n\r\n }\r\n const originalPhone = me.$(this, me.context).val();\r\n if (!originalPhone) {\r\n const phone = originalPhone.replace(/[^+\\d].+/, '');\r\n me.$(this, me.context).val(phone);\r\n }\r\n\r\n if (event.which < 48 || event.which > 57) {\r\n return false;\r\n }\r\n });\r\n me.context.querySelector(me.elements.cancelBtnSelector)?.addEventListener('click', (event) => {\r\n me.closeForm();\r\n });\r\n\r\n me.context.querySelector(me.elements.phoneSelector).addEventListener('keyup', (event) => {\r\n if (me.$(me.elements.phoneSelector, me.context).val() != '') {\r\n me.enableBtn();\r\n } else {\r\n me.disableBtn();\r\n }\r\n\r\n const form = buttonEl.closest('form');\r\n const phone = form.querySelector(me.elements.phoneSelector)?.value;\r\n const validator = Object.create(PhoneValidator);\r\n validator.phoneCountryData = PhoneCountryData[ApexChat.options.countryCode || 'OTHER'];\r\n validator.phone = phone;\r\n const validate = validator.validate();\r\n if (validate) {\r\n me.hideWarning();\r\n me.hideError();\r\n } else if (me.formSubmit) {\r\n me.hideWarning();\r\n me.showError();\r\n }\r\n });\r\n me.setPlaceHolder();\r\n };\r\n const show = function () {\r\n const me = this;\r\n me.$(me.elements.formVisitorSelector, me.context).show();\r\n me.$(me.elements.formContainerSelector, me.context).show();\r\n };\r\n\r\n const markDisable = function () {\r\n const me = this;\r\n me.context.querySelector(me.elements.submitBtnSelector,).disabled = true;\r\n };\r\n\r\n const disableBtn = function () {\r\n const me = this;\r\n me.markDisable();\r\n me.$(me.elements.submitBtnSelector, me.context).removeClass(me.styles.SUBMIT_ENABLED);\r\n };\r\n\r\n const enableBtn = function () {\r\n const me = this;\r\n me.$(me.elements.submitBtnSelector, me.context).prop('disabled', false);\r\n me.$(me.elements.submitBtnSelector, me.context).addClass(me.styles.SUBMIT_ENABLED);\r\n };\r\n const showError = function () {\r\n const me = this;\r\n me.$(me.elements.phoneWarningSelector, me.context).show();\r\n me.$(me.elements.phoneSelector, me.context).addClass(me.styles.ERROR_ENABLED);\r\n };\r\n\r\n const hideError = function () {\r\n const me = this;\r\n me.$(me.elements.phoneWarningSelector, me.context).hide();\r\n me.$(me.elements.phoneSelector, me.context).removeClass(me.styles.ERROR_ENABLED);\r\n };\r\n const showWarning = function () {\r\n const me = this;\r\n me.$(me.elements.phoneContainerSelector, me.context).addClass(me.styles.WARNING_ENABLED);\r\n me.$(me.elements.submitBtnSelector, me.context).removeClass(me.styles.SUBMIT_ENABLED);\r\n me.$(me.elements.phoneWarningSelector, me.context).show();\r\n me.$('.apexchat_error_message', me.context).hide();\r\n me.$('.apexchat_warning_message', me.context).show();\r\n };\r\n const hideWarning = function () {\r\n const me = this;\r\n me.$(me.elements.phoneContainerSelector, me.context).removeClass(me.styles.WARNING_ENABLED);\r\n me.$('.apexchat_warning_message', me.context).hide();\r\n };\r\n const showMessage = function (message) {\r\n const me = this;\r\n me.$(me.elements.formContainerSelector, me.context).append(\r\n `
${message}
`\r\n );\r\n setTimeout(() => {\r\n me.closeForm();\r\n }, 2000);\r\n };\r\n const closeForm = function () {\r\n const me = this;\r\n if (me.options.hide) {\r\n me.options.hide();\r\n } else {\r\n me.$(me.elements.formContainerSelector, me.context).fadeOut('slow');\r\n }\r\n };\r\n const setPlaceHolder = function () {\r\n const me = this;\r\n me.context.querySelector(me.elements.phoneSelector).placeholder =\r\n me.messages.PLACEHOLDER_PHONE\r\n\r\n };\r\n const getWebSmsService = function (payload, callback) {\r\n const me = this;\r\n if (!window.ga) {\r\n googleAnalyticsObjectInit('ga');\r\n }\r\n const gaClientId = getGaClientId(me.options.googleAnalyticsAccount, ga);\r\n const trafficCookie = getCookieValue('livechat_invitation_traffic_sources');\r\n const data = {\r\n visitationLogID: me.options.visitorId,\r\n companyId: me.options.companyId,\r\n initiatedBy: payload.initiatedBy,\r\n phone: payload.phone,\r\n visitorName: payload.name || '',\r\n language: me.options.language,\r\n chatInterceptorValue: me.interceptorResults,\r\n gaClientId,\r\n trafficCookie: trafficCookie || '',\r\n chatId: payload.chatId,\r\n chatLogId: payload.chatLogId\r\n };\r\n const serviceUrl = payload.serviceUrl || '/Handlers/SmsWebHandler.ashx';\r\n // ajax call to sms log call\r\n me.$.getJSON(GlobalVariables.LiveChatServiceUrl + serviceUrl, data, (result) => {\r\n console.log('sms webhandler requested....');\r\n callback(result);\r\n });\r\n };\r\n return {\r\n init,\r\n reset,\r\n initialDisplay,\r\n bind,\r\n show,\r\n markDisable,\r\n disableBtn,\r\n enableBtn,\r\n showError,\r\n hideError,\r\n showWarning,\r\n hideWarning,\r\n showMessage,\r\n closeForm,\r\n setPlaceHolder,\r\n getWebSmsService\r\n };\r\n};\r\nexport default WebSmsFormValidator;\r\n","// Enter KeyPress Event is required when in TextArea someone press 'Enter' means sending msg.\r\nconst isEnterKeyPressed = function (e) {\r\n if (e.keyCode == 13) {\r\n return true;\r\n }\r\n return false;\r\n};\r\nexport default isEnterKeyPressed;\r\n"],"names":["module","exports","obj","__t","__p","options","msg","chatId","getCookieValue","init","me","this","$","ApexChat","ApexChatJquery","context","elements","formContainerSelector","phoneContainerSelector","phoneWarningSelector","phoneSelector","submitBtnSelector","confirmationMessageSelector","formVisitorSelector","cancelBtnSelector","messages","SENT","FAILED","PLACEHOLDER_PHONE","styles","SUBMIT_ENABLED","WARNING_ENABLED","ERROR_ENABLED","cookieTime","reset","_me$context$querySele","_me$context$querySele2","_me$context$querySele3","formSubmit","querySelector","classList","remove","style","display","value","disabled","confirmationMessageElement","parentNode","removeChild","initialDisplay","length","show","disclaimer","visitorTitle","parseTemplate","formHtml","visitorInfoWidgetTemplate","form","append","addStyleText","visitorInfoWidgetCss","body","hide","setPlaceHolder","bind","_me$context$querySele4","buttonEl","epButtonEl","addEventListener","prop","closest","phone","GlobalVariables","CompanyLevelBlockedPages","CompanyContextRequest","companyLevelBlockValidator","CompanyLevelBlockValidator","CompanyLevelSettings","isSMSNumberBlocked","validator","Object","create","PhoneValidator","phoneCountryData","PhoneCountryData","countryCode","validate","textContent","add","GetChatID","getWebSmsService","initiatedBy","chatInitiatedBy","interceptorResults","interceptorResult","serviceUrl","res","msgSent","success","data","Cookies","setShort","showMessage","click","showError","showWarning","event","isEnterKeyPressed","preventDefault","originalPhone","val","replace","which","closeForm","enableBtn","disableBtn","hideWarning","hideError","markDisable","removeClass","addClass","message","setTimeout","fadeOut","placeholder","payload","callback","window","ga","googleAnalyticsObjectInit","gaClientId","getGaClientId","googleAnalyticsAccount","trafficCookie","visitationLogID","visitorId","companyId","visitorName","name","language","chatInterceptorValue","chatLogId","getJSON","LiveChatServiceUrl","result","console","log","e","keyCode"],"sourceRoot":""}