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

1 line
10 KiB
JavaScript

"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 = 'anonymous';\n\t\t\tpo.onload = function() {\n\t\t\t\treturn lh_inst.lh_openchatWindow();\n\t\t\t}; //Wait for script to load before popping up chat box.\n\t\t\tvar s = document.getElementsByTagName( 'script' )[0];\n\t\t\ts.parentNode.insertBefore( po, s );\n\t\t} )();\n\t}\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTU1LmpzIiwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsaUZBQWlGLGdEQUFnRDtBQUNqSTtBQUNBLHdMQUF3TDtBQUN4TDtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLEdBQUc7QUFDSDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsR0FBRztBQUNIO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxHQUFHOztBQUVILDJDQUEyQztBQUMzQztBQUNBO0FBQ0E7QUFDQTtBQUNBLEdBQUc7QUFDSDtBQUNBO0FBQ0E7QUFDQTtBQUNBLEdBQUc7QUFDSCxvQ0FBb0MsbUVBQW1FOztBQUV2Ryw0Q0FBNEM7QUFDNUM7QUFDQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0g7QUFDQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0g7QUFDQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0gscUNBQXFDLG1FQUFtRTs7QUFFeEc7QUFDQSwyQ0FBMkMsOERBQThEOztBQUV6RztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFNO0FBQ047QUFDQTtBQUNBLElBQUk7QUFDSjtBQUNBOztBQUUyQyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL2ludGVyZmFjZS9od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