TimeTrex/interface/html5/dist/live-chat.bundle.js

1 line
10 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["live-chat"],{155:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"LHCChatOptions\": () => (/* binding */ LHCChatOptions),\n/* harmony export */ \"openSupportChat\": () => (/* binding */ openSupportChat)\n/* harmony export */ });\nvar current_company = LocalCacheData.getLocalCache( 'current_company', 'JSON' ); //Can't use LocalCacheData.getCurrentCompany(); as that uses getRequiredLocalCache() and if the user logs in, then logs out before this can load, it will cause a JS exception.\nvar current_user = LocalCacheData.getLoginUser();\nvar chat_email_address = ( current_user.work_email != '' ? current_user.work_email : ( current_user.home_email != '' ? current_user.home_email : 'EmailNotSpecified@NoDomain.com' ) ); //Fall back to a bogus email address otherwise the live chat will be rejected, and some people have complained about that.\nvar LHCChatOptions = {};\nvar openSupportChat;\n\nif ( current_company && current_user ) {\n\n\tLHCChatOptions.attr = new Array();\n\tLHCChatOptions.attr.push( {\n\t\t'name': 'email',\n\t\t'value': chat_email_address,\n\t\t'type': 'hidden',\n\t\t'size': 0\n\t} );\n\tLHCChatOptions.attr.push( {\n\t\t'name': 'phone',\n\t\t'value': ( current_user.work_phone != '' ? current_user.work_phone : current_user.home_phone ),\n\t\t'type': 'hidden',\n\t\t'size': 0\n\t} );\n\tLHCChatOptions.attr.push( {\n\t\t'name': 'registration_key',\n\t\t'value': LocalCacheData.getLoginData().registration_key,\n\t\t'type': 'hidden',\n\t\t'size': 0\n\t} );\n\n\tLHCChatOptions.attr_online = new Array(); //Online Chat List info.\n\tLHCChatOptions.attr_online.push( {\n\t\t'name': 'username',\n\t\t'value': current_user.first_name + ' ' + current_user.last_name,\n\t\t'hidden': true\n\t} );\n\tLHCChatOptions.attr_online.push( {\n\t\t'name': 'email',\n\t\t'value': chat_email_address,\n\t\t'hidden': true\n\t} );\n\tLHCChatOptions.attr_online.push( { 'name': 'company', 'value': current_company.name, 'hidden': true } );\n\n\tLHCChatOptions.attr_prefill = new Array(); //Chat Form info.\n\tLHCChatOptions.attr_prefill.push( {\n\t\t'name': 'username',\n\t\t'value': current_user.first_name + ' ' + current_user.last_name,\n\t\t'hidden': true\n\t} );\n\tLHCChatOptions.attr_prefill.push( {\n\t\t'name': 'email',\n\t\t'value': chat_email_address,\n\t\t'hidden': true\n\t} );\n\tLHCChatOptions.attr_prefill.push( {\n\t\t'name': 'phone',\n\t\t'value': ( current_user.work_phone != '' ? current_user.work_phone : current_user.home_phone ),\n\t\t'hidden': true\n\t} );\n\tLHCChatOptions.attr_prefill.push( { 'name': 'company', 'value': current_company.name, 'hidden': true } );\n\n\tLHCChatOptions.attr_prefill_admin = new Array();\n\tLHCChatOptions.attr_prefill_admin.push( { 'index': '0', 'value': current_company.name, 'hidden': true } );\n\n\tLHCChatOptions.opt = {\n\t\twidget_height: 340,\n\t\twidget_width: 300,\n\t\tpopup_height: 520,\n\t\tpopup_width: 500,\n\t\tdomain: 'timetrex.com'\n\t};\n\n\t//Only make a call to load the chat service JS when the chat button is actually clicked. This should help reduce the chance of JS errors occurring for users who never use the chat.\n\topenSupportChat = function openSupportChat() {\n\t\t( function() {\n\t\t\tvar po = document.createElement( 'script' );\n\t\t\tpo.type = 'text/javascript';\n\t\t\tpo.async = true;\n\t\t\tvar refferer = ( document.referrer ) ? encodeURIComponent( document.referrer.substr( document.referrer.indexOf( '://' ) + 1 ) ) : '';\n\t\t\tvar location = ( document.location ) ? encodeURIComponent( window.location.href.substring( window.location.protocol.length ) ) : '';\n\t\t\tpo.src = 'https://chat.timetrex.com/index.php/chat/getstatus/(click)/internal/(position)/api/(ma)/br/(dot)/true/(units)/pixels/(leaveamessage)/true/(department)/2/(disable_pro_active)/true?r=' + refferer + '&l=' + location + '&ttr=' + new Date().getTime();\n\t\t\tpo.crossOrigin