window.__lpEnvSite = "21991129";
window.__watchDogURL = "https://va-healthcheck-service.public.openaiplatform.telstra.com/codi_consumer_health";
window.__businessWatchDogURL = "https://va-healthcheck-service.public.openaiplatform.telstra.com/codi_business_health";
Object.defineProperty(window,"__loadLivePersonSrc",{value:function(){
window.lpTag=window.lpTag||{},'undefined'==typeof window.lpTag._tagCount?(window.lpTag={wl:lpTag.wl||null,scp:lpTag.scp||null,site:window.__lpEnvSite||'81478844',section:lpTag.section||'',tagletSection:lpTag.tagletSection||null,autoStart:lpTag.autoStart!==!1,ovr:lpTag.ovr||{},_v:'1.10.0',_tagCount:1,protocol:'https:',events:{bind:function(t,e,i){lpTag.defer(function(){lpTag.events.bind(t,e,i)},0)},trigger:function(t,e,i){lpTag.defer(function(){lpTag.events.trigger(t,e,i)},1)}},defer:function(t,e){0===e?(this._defB=this._defB||[],this._defB.push(t)):1===e?(this._defT=this._defT||[],this._defT.push(t)):(this._defL=this._defL||[],this._defL.push(t))},load:function(t,e,i){var n=this;setTimeout(function(){n._load(t,e,i)},0)},_load:function(t,e,i){var n=t;t||(n=this.protocol+'//'+(this.ovr&&this.ovr.domain?this.ovr.domain:'lptag.liveperson.net')+'/tag/tag.js?site='+this.site);var o=document.createElement('script');o.setAttribute('charset',e?e:'UTF-8'),i&&o.setAttribute('id',i),o.setAttribute('src',n),document.getElementsByTagName('head').item(0).appendChild(o)},init:function(){this._timing=this._timing||{},this._timing.start=(new Date).getTime();var t=this;window.attachEvent?window.attachEvent('onload',function(){t._domReady('domReady')}):(window.addEventListener('DOMContentLoaded',function(){t._domReady('contReady')},!1),window.addEventListener('load',function(){t._domReady('domReady')},!1)),'undefined'===typeof window._lptStop&&this.load()},start:function(){this.autoStart=!0},_domReady:function(t){this.isDom||(this.isDom=!0,this.events.trigger('LPT','DOM_READY',{t:t})),this._timing[t]=(new Date).getTime()},vars:lpTag.vars||[],dbs:lpTag.dbs||[],ctn:lpTag.ctn||[],sdes:lpTag.sdes||[],hooks:lpTag.hooks||[],identities:lpTag.identities||[],ev:lpTag.ev||[]},lpTag.init()):window.lpTag._tagCount+=1; }});
window.__disableVA = false;
window.__disableBusinessVA = false;
window.dtcDisabledPages = "https://www.telstra.com.au/chatnow/landing";
window.lpSettings = window.lpSettings || {
"heading": "Need help?",
"description": "Please tell us what you'd like to message us about",
"persistentChat": true,
"options": {"route0": {"label": "Mobile & Tablet Plans","isActive": "true","section": "telstra,service,aem,consumer","childs": {"route0": {"label": "Bill & Plan Enquiries","isActive": "true","section": "service-mobile,virtualassistant","lead": "MOB-bill-plan-addon","help": "Help & Support
I need to understand my bill
Report a payment or reconnect my service
Request a payment extension
Arrange or update direct debit
Check my upgrade and recontracting fees
"}, "route1": {"label": "Buy Online","isActive": "true","section": "sales-mobile","lead": "MOB-buy-online","help": "Help & Support
Order a new mobile
Get a SIM only plan
Check my upgrade date and fees
Track my order
Get help with a back order"}, "route2": {"label": "Existing Order","isActive": "true","section": "service-general,virtualassistant","lead": "MOB-existing-order","help": "Delays to some order deliveries
COVID-19 impacts are causing delays on some orders. Your order should arrive within 7 days in metro locations, while some regional orders may take longer. We're doing everything we can to get your order to you quickly and apologise for the inconvenience..
Help & Support
Track my order
Cancel or change my order
Confirm my plan details
Check my contract termination fees
Get help with a back order"}, "route3": {"label": "Fault","isActive": "true","section": "fault-mobile,virtualassistant","lead": "MOB-fault","help": "Help & Support
View our interactive mobile help guides
Check for outages"}, "route4": {"label": "SIM Replacement","isActive": "true","section": "mobile-sim-deflect","lead": "MOB-sim-rep"}, "route5": {"label": "Disconnection","isActive": "true","section": "saves","lead": "MOB-disconnection"}, "route6": {"label": "Other","isActive": "true","section": "service-general,mob-other,virtualassistant","lead": "MOB-other","help": "Help & Support
Check my contract termination fees
Track my order
I need to understand my bill
Try our online support articles"}}}, "route1": {"label": "Pre-Paid","isActive": "true","section": "telstra,service,aem,consumer","childs": {"route0": {"label": "Activate & Recharge","isActive": "true","section": "prepaid,virtualassistant","lead": "PPM-activate-recharge","help": "Help & Support
How to activate my Pre-Paid service
How to recharge my Pre-Paid service
Payment options
Check my activation status
Check out our Pre-Paid support articles"}, "route1": {"label": "Existing Order","isActive": "true","section": "prepaid,virtualassistant","lead": "PPM-existing-order","help": "Delays to some order deliveries
COVID-19 impacts are causing delays on some orders. Your order should arrive within 7 days in metro locations, while some regional orders may take longer. We're doing everything we can to get your order to you quickly and apologise for the inconvenience.
Help & Support
How to activate my Pre-Paid service
How to change my plan
Check my activation status
Check out our Pre-Paid support articles
Track my order"}, "route2": {"label": "Offers & Plans","isActive": "true","section": "prepaid,virtualassistant","lead": "PPM-my-offer-plan","help": "Help & Support
View or change my plan
Explore available plans
Pre-Paid Plus packs
Pre-Paid expiry period
International roaming"}, "route3": {"label": "Fault","isActive": "true","section": "fault-prepaid,virtualassistant","lead": "PPM-fault","help": "Help & Support
Check for outages
Unlock my Telstra mobile
Pre-Paid troubleshooting tips
Pre-Paid support articles"}, "route4": {"label": "SIM Replacement","isActive": "true","section": "prepaid-sim-deflect","lead": "PPM-sim-rep","help": "Help & Support
Unlock my Telstra mobile
Track my order
Cancel or change my order
Pre-Paid support articles"}, "route5": {"label": "Disconnection","isActive": "true","section": "saves","lead": "PPM-disconnection"}}}, "route2": {"label": "NBN & Bundles","isActive": "true","section": "telstra,service,aem,consumer","childs": {"route0": {"label": "Buy Online","isActive": "true","section": "sales-nbn","lead": "NBN-buy-online","help": "Help & Support
Order a new service
See latest offers
Check my upgrade date and fees
Track my order"}, "route1": {"label": "Bill & Plan Enquiries","isActive": "true","section": "service-nbn,virtualassistant","lead": "NBN-bill-plan-addon","help": "Help & Support
Request a payment extension
Report a payment or reconnect my service
I want to pay my bill
I need to understand my bill
Arrange or update direct debit"}, "route2": {"label": "Existing Order","isActive": "true","section": "nbn-orders,virtualassistant","lead": "NBN-existing-order","help": "Delays to some order deliveries
COVID-19 impacts are causing delays on some orders. Your order should arrive within 7 days in metro locations, while some regional orders may take longer. We're doing everything we can to get your order to you quickly and apologise for the inconvenience.
Help & Support
Track my order
Reschedule my appointment"}, "route3": {"label": "Moving Home","isActive": "true","section": "nbn-moves,virtualassistant","lead": "NBN-moving-home","help": "Help & Support
Move my service to another address
Track my order"}, "route4": {"label": "Fault","isActive": "true","section": "fault-nbn,virtualassistant","lead": "NBN-fault","help": "Help & Support
Connecting my new service
Check for outages
Troubleshooting and tech support
How to use my service
Connection speed"}, "route5": {"label": "Disconnection","isActive": "true","section": "saves","lead": "NBN-disconnection"}}}, "route3": {"label": "Broadband, Bundles & Home Phone","isActive": "true","section": "telstra,service,aem,consumer","childs": {"route0": {"label": "Buy Online","isActive": "true","section": "sales-home,virtualassistant","lead": "BBHP-buy-online","help": "Help & Support
Order a new service
See latest offers
Check my upgrade date and fees
Track my order"}, "route1": {"label": "Bill & Plan Enquiries","isActive": "true","section": "service-home,virtualassistant","lead": "BBHP-bill-plan-addon","help": "Help & Support
Request a payment extension
Report a payment or reconnect my service
I need to understand my bill
Arrange or update direct debit
I want to query a charge on my bill"}, "route2": {"label": "Existing Order","isActive": "true","section": "service-bundles-home,virtualassistant","lead": "BBHP-existing-order","help": "Delays to some order deliveries
COVID-19 impacts are causing delays on some orders. Your order should arrive within 7 days in metro locations, while some regional orders may take longer. We're doing everything we can to get your order to you quickly and apologise for the inconvenience.
Help & Support
Track my order
Reschedule my appointment"}, "route3": {"label": "Moving Home","isActive": "true","section": "copper-moves,virtualassistant","lead": "BBHP-moving-home","help": "Help & Support
Move my service to another address
Track my order"}, "route4": {"label": "Fault","isActive": "true","section": "fault-adsl,virtualassistant","lead": "BBHP-fault","help": "Help & Support
Connecting my new service
Check for outages
Troubleshooting and tech support
Mobile broadband tech support
Connection speed"}, "route5": {"label": "Disconnection","isActive": "true","section": "saves","lead": "BBHP-disconnection"}}}, "route4": {"label": "Entertainment & Apps","isActive": "true","section": "telstra,service,aem,consumer","childs": {"route0": {"label": "My Telstra","isActive": "true","section": "service-apps,virtualassistant","lead": "EAA-247-app","help": "Help & Support
Register for a Telstra ID
Retrieve my Telstra ID username
Retrieve my Telstra ID password"}, "route1": {"label": "Telstra Plus","isActive": "true","section": "telstra-plus,virtualassistant","lead": "EAA-telstraplus","help": "Help & Support
Join Telstra Plus
Find out more about Telstra Plus
View Telstra Plus FAQ
Register for a Telstra ID
Retrieve my Telstra ID username
Retrieve my Telstra ID password"}, "route2": {"label": "Email","isActive": "true","section": "fault-email,virtualassistant","lead": "EAA-email","help": "Help & Support
Troubleshoot email for PC
Troubleshoot email for mobile device
Forgot my username or password"}, "route3": {"label": "Foxtel","isActive": "true","section": "foxtel,virtualassistant","lead": "EAA-foxtel","help": "Help & Support
Foxtel FAQs
Foxtel from Telstra – Set up and configure
Foxtel Go"}, "route4": {"label": "Telstra TV & Telstra TV Box Office","isActive": "true","section": "service-apps,virtualassistant","lead": "EAA-telstra-tv-box-office","help": "Help & Support
Find out more about Telstra TV
Sign in to Telstra Box Office
Telstra Box Office FAQs
"}, "route5": {"label": "Telstra Air","isActive": "true","section": "service-apps,virtualassistant","lead": "EAA-telstra-air","help": "Help & Support
Telstra Air – all you need to know"}, "route6": {"label": "Platinum","isActive": "true","section": "platinum","lead": "EAA-platinum","help": "Help & Support
Telstra Platinum"}}}, "route5": {"label": "Business Accounts & Products","isActive": "true","section": "telstra,service,aem,consumer,business,businessva","lead": "BAAP-none","childs": {}}},
"enableDTC": true,
"enableBusinessDTC": false,
"dtcSection": "tcom,non-auth,telstra,service,aem,consumer,dtc,virtualassistant",
"dtcBusinessSection": "",
"chatEverywhereLabel": "Message us",
"dtcLabel": "Message us",
"abcEnabled": false,
"abcBusinessId": "5658cef3-b53e-11e7-847d-7b88b04daa8e",
"bizIntentId": "ios_general",
"bizGroupId": "",
"body": "",
"abcButtonDelay": "10000",
"contactUsABCEnabled": false,
"authEnabled": true,
"v2AuthEnabled": true,
"allowedPages": "www.myservices.telstra.com.au/*,fix.telstra.com/*,plus.telstra.com.au/*,checkout.telstra.com.au/*,www.telstra.com.au/*,www.my.telstra.com.au/myaccount/*,prepaid.activate.telstra.com.au/*,recharge.telstra.com.au/*,www.ordertracker.telstra.com.au/*,say.telstra.com.au/customer/forms/request-a-credit-form,shop.telstra.com.au/*",
"v2AllowedPages": "fix.telstra.com/*,www.myservices.telstra.com.au/*,www.telstra.com.au/*,plus.telstra.com.au/*",
"engCollectTimeout": "1500",
"ssoUrl": "https://chat-messaging.public.openaiplatform.telstra.com",
"retrieveUrl": "https://tapi.telstra.com/presentation/v1/va-chatservices/retrieve-lp-auth-objects",
"retrieveV2Url": "https://tapi.telstra.com/presentation/v1/va-chatservices/lp-auth-objects",
"ssoTimeout": "4500",
"retrieveTimeout": "5000",
"tacticalAbcEnabled": false,
"disableDragDropFileUpload": false,
"enableMTRedirection": false,
"minIOSAppVerForMTRedirect": "70.0",
"minAndroidAppVerForMTRedirect": "70.0",
"mtwIOSHostName": "https://www.myservices.telstra.com.au",
"mtwAndroidHostName": "https://www.myservices.telstra.com.au",
"tacticalTCOMAuthEnabled": false,
"tcomPrefix": "www",
"tcomLightBoxCssSelector": ""
};
try {
if (window.TelstraLivePerson) {
// prevent redeclaration of the class
throw new Error('Can not redefine this object');
}
Object.defineProperty(window, 'TelstraLivePerson', {
value: function (__config) {
const _config = JSON.parse(JSON.stringify(__config));
const _instance = this;
const _tcomPrefix = _config.tcomPrefix || 'www';
const _mtwIOSHostName = _config.mtwIOSHostName;
const _mtwAndroidHostName = _config.mtwAndroidHostName;
const disableDragDropFileUpload = _config.disableDragDropFileUpload;
let _dragDropOverridden = false;
let defaultSignInUrl = {
msg: "Looks like this session has timed out. Sign back in to continue your conversation, or go to My Telstra and select 'Message us' to reply.",
url: 'https://open.mytelstra.app/BJRB/804999cc',
label: 'Go to My Telstra',
action: 'navigate'
};
let defaultAuthDisabledUrl = {
msg: "This is a secure conversation which can only be continued on specific Telstra pages. If you wish to continue this conversation, please go to My Telstra and select 'Message us' to reply.",
action: 'navigate',
label: 'Go to My Telstra',
url: 'https://open.mytelstra.app/BJRB/804999cc'
};
const signInUrls = { '*': defaultSignInUrl };
signInUrls[document.location.origin] = defaultSignInUrl;
let _mySignInUrl = signInUrls['*'];
const siuXhr = new XMLHttpRequest();
siuXhr.onreadystatechange = function () {
if (siuXhr.readyState === siuXhr.DONE) {
if (siuXhr.status === 200) {
try {
Object.assign(signInUrls, JSON.parse(siuXhr.responseText));
_mySignInUrl = signInUrls[document.location.origin];
if (signInUrls['*']) {
defaultSignInUrl = signInUrls['*'];
}
if (signInUrls['defaultAuthDisabled']) {
defaultAuthDisabledUrl = signInUrls['defaultAuthDisabled'];
}
} catch (e) {}
}
}
};
siuXhr.open(
'GET',
'https://' +
_tcomPrefix +
'.telstra.com.au/content/dam/tcom/virtualassistant/config/t-lp-err-msg' +
(window.__lpEnvSite === '21991129' ? '-pr' : '-np') +
'.json'
);
siuXhr.send();
const checkPageAllowedForAuth = function (thisPage, allowedPages) {
let allowedList = allowedPages.split(',');
let allowed = false;
let listItem;
for (let i = 0; i < allowedList.length; i++) {
listItem = 'https://' + allowedList[i];
let lastChar = listItem.substr(listItem.length - 1, 1);
if (lastChar === '*') {
allowed =
thisPage.substr(0, listItem.length - 1) ===
listItem.substr(0, listItem.length - 1);
} else {
allowed = thisPage === listItem;
}
if (allowed) {
break;
}
}
return allowed;
};
const isAllowedOriginForAuth = checkPageAllowedForAuth(
document.location.origin + document.location.pathname,
_config.allowedPages
);
let authIsEnabled =
_config.authEnabled &&
isAllowedOriginForAuth &&
(typeof window.addEventListener === 'function' ||
window.attachEvent === 'function');
const isAllowedOriginForV2Auth = checkPageAllowedForAuth(
document.location.origin + document.location.pathname,
_config.v2AllowedPages
);
let authV2IsEnabled = _config.v2AuthEnabled && isAllowedOriginForV2Auth;
const ssoUrl = _config.ssoUrl;
let cid;
const retrieveUrl = _config.retrieveUrl;
const retrieveV2Url = _config.retrieveV2Url;
let engCollectTimeout = parseInt(_config.engCollectTimeout);
if (isNaN(engCollectTimeout)) {
engCollectTimeout = 500;
}
let ssoTimeout = parseInt(_config.ssoTimeout);
if (isNaN(ssoTimeout)) {
ssoTimeout = 5000;
}
let retrieveTimeout = parseInt(_config.retrieveTimeout);
if (isNaN(retrieveTimeout)) {
retrieveTimeout = 2000;
}
const minAndroidAppVerForMTRedirect =
_config.minAndroidAppVerForMTRedirect;
const minIOSAppVerForMTRedirect = _config.minIOSAppVerForMTRedirect;
let _globalMTRedirectEnabled;
//
const generateCorrelationId = function () {
let id = '';
try {
id = encodeURIComponent(
btoa(
window.crypto
.getRandomValues(new Uint8Array(32))
.reduce(function (prev, curr) {
return prev + String.fromCharCode(curr);
}, '')
)
);
} catch (e) {
for (let i = 0; i < 4; i++) {
id =
id +
parseInt(((1 + Math.random()) * 0x10000).toFixed(0))
.toString(32)
.substring(1);
}
}
return id;
};
const initConfig = JSON.parse(JSON.stringify(_config));
Object.defineProperty(_instance, 'data', { value: initConfig });
if (initConfig.abcButtonDelay) {
// convert to number
try {
initConfig.abcButtonDelay = parseInt(initConfig.abcButtonDelay);
} catch (e) {
initConfig.abcButtonDelay = 100;
}
}
let isChatEverywhereClick = false;
_instance.persistentChatContainer = false;
_instance.appleDeviceType = 'UNIDENTIFIED';
_instance.backMask = false;
_instance.container = false;
_instance.containerBox = false;
_instance.closeBT = false;
_instance.childElements = {};
_instance.siteId = false;
_instance.section = [];
_instance.sourceSection = [];
_instance.isDirect = false;
_instance.lead = false;
_instance.urlMap = window.__lpUrlMap || false;
_instance.callBack = false;
_instance.callBackInterval = 1; // in second
_instance.callBackTread = false;
_instance.chatWindowOpen = false;
// load jabuka.json using absolute url to ensure no errors if import.htm injected on page in any other domain
Object.defineProperty(_instance, 'jabukaUrl', {
value:
'https://' +
_tcomPrefix +
'.telstra.com.au/content/dam/tcom/virtualassistant/config/jabuka.json'
});
let initParams = {};
const _businessVaSection = 'businessvas';
let _initCalled = false;
let engagementName;
let proactiveSuppressionCheck = false;
let tacticalAbcEnabled = _config.tacticalAbcEnabled || false;
let onChatWindowMinimized = null;
let onChatWindowClosed = null;
let minimizedFocusQuerySelector = null;
let closedFocusQuerySelector = null;
let _defaultMinimizedCallback = null;
let _defaultClosedCallback = null;
let _defaultMinimizedSelector = null;
let _defaultClosedSelector = null;
let _appVersion = -1;
let _appPlatform = '';
let calculatedMTRedirect = false;
let preferMTRForMessageUs = false;
const chatEverywhereSelector = 'button.msg-us-btn';
const APP_VER_REGEX = /^\d+\.\d+(\.\d+)?$/;
const triggers = [];
let lpTagInitialized = false;
let proactiveAutoClick = false;
let trComponentInfo = null;
let reactiveTRComponentInfo = null;
let agentCtxInfo = [];
let reactiveAgentCtxInfo = [];
let processingTrigger = false;
let _proactiveButtonLoad;
// auth specific stuff
let authInProgress = false;
let ssoFrame = null;
let ssoFrameContentWindow = null;
let _token = null;
let _id = null;
let retrievalXHR = null;
let retrievalV2XHR = null;
let lpCallback = null;
let ssoTimeoutHandle = null;
let retrievalTimeoutHandle = null;
let authForClick = false;
let messageMonitorHandle = null;
let messageUpdated = false;
let cBlocking = false;
let statType = 'NOT_AVAILABLE';
let clicked = false;
let _inputBoxFocus = false;
let startStatSent = false;
let impressionStatSent = false;
let declinedStatSent = false;
let statConvoId = 'n/a';
let isProactive = false;
let isReactive = false;
var ignoreOffer = false;
let engagementId;
let stopCollectingEngagements = false;
window.engagementsOffered = [];
let impressionsTimeoutHandle = null;
let previousEngagementType = 0;
let convoStartedOnPage = false;
let convoTriggerStartTime = 0;
let monitorId = generateCorrelationId();
let windowOpenMonitorHandle = null;
let previousElement = null;
let loadingIndicator = null,
loadingSpinner,
loadingMessage,
loadingErrorIcon,
loadingErrorMessage,
loadingIndicatorCloseButton,
loadingSpacer;
let loadingIndicatorTimer = null;
let dontShowLoadingIndicator = false;
let loadingIndicatorAttached = false;
let v3CtaCollapsed = false;
let v3CtaTOHandle2, v3CtaTOHandle3;
const MESSAGING_ACTION = '__messaging';
const _businessWatchDogURL =
window.__businessWatchDogURL || 'virtual-assistant-status';
let _businessWatchDog = {
'virtual-assistant-status': {
orchestrator: false,
'watson-virtual-agent': false,
'liveperson-agent-api': false,
'watson-tone-analyzer': false
}
};
var loadedVA = [];
var totalVA = 1; // update this if more VA are added on the page
var postVALoadDone = false;
let abcConfigLoaded = false;
let _loadedAbcConfig = null;
let _intent_id, _group_id;
let abcUrlPrefix =
'https://bcrw.apple.com/urn:biz:' + _instance.data.abcBusinessId;
const _osExtractRegex =
/\((Macintosh|iPhone|iPad|(?:iPod(?:\stouch)?));.*\s((?:\d[_.]{0,1})+)[^)]*\)\s/i;
const _minSupportedMacOS = [10, 13, 4];
const _minSupportedIOS = [11, 3];
// calculate some of the dtc params here so that they are not re-calculated unnecessarily
// do not consider query params or anchor tags when checking for current page url
const _dtcDisabledPage = window.dtcDisabledPages.split(',');
const thisPage = window.location.href.split(/[?#]/)[0];
const isDTCDisabledPage = _dtcDisabledPage.indexOf(thisPage) != -1;
const smlBusIndx = thisPage.indexOf('/small-business');
const _isUnderSmallBusiness =
thisPage.indexOf('/small-business/') != -1 ||
(smlBusIndx != -1 &&
thisPage.substring(smlBusIndx) == '/small-business');
//
const injectCss = function () {
const messagingCss = document.createElement('link');
messagingCss.setAttribute('rel', 'stylesheet');
messagingCss.setAttribute(
'href',
'https://' +
_tcomPrefix +
'.telstra.com.au/content/dam/tcom/virtualassistant/css/lp-override-v2.css'
);
messagingCss.addEventListener('load', () => {
document
.querySelector('button#persistentChatBtnId')
?.removeAttribute('style');
});
document.head.appendChild(messagingCss);
};
try {
injectCss();
} catch (e) {
sendNRPageAction(MESSAGING_ACTION, {
err: e.message || 'css-inject-error',
stack: e.stack || 'N/A'
});
}
//
const compareVersion = function (a, b) {
let i, diff;
let _a = '' + a,
_b = '' + b;
const regExStrip0 = /(\.0+)+$/;
const v1Parts = _a.replace(regExStrip0, '').split('.');
const v2Parts = _b.replace(regExStrip0, '').split('.');
const minLength = Math.min(v1Parts.length, v2Parts.length);
for (i = 0; i < minLength; i++) {
diff = parseInt(v1Parts[i], 10) - parseInt(v2Parts[i], 10);
if (diff) {
return diff;
}
}
return v1Parts.length - v2Parts.length;
};
//
const sendNRPageAction = function (actionName, actionPayload) {
try {
if (newrelic && newrelic.addPageAction) {
newrelic.addPageAction(
actionName,
Object.assign(actionPayload, { _monitorId: monitorId })
);
}
} catch (e) {}
};
//
const doInputBoxFocus = function () {
if (_inputBoxFocus) {
return;
}
_inputBoxFocus = true;
setTimeout(function () {
try {
document
.querySelector('textarea.lpview_form_textarea')
.focus({ focusVisible: true });
} catch (e) {}
}, 2000);
};
//
const doAssetFocus = function (
op,
handlerFn,
querySelector,
isChatEverywhereClick
) {
setTimeout(function () {
let focusElement, defaultFocusElement;
let defaultSelector =
op === 'minimized'
? _defaultMinimizedSelector
: isChatEverywhereClick
? chatEverywhereSelector
: _defaultClosedSelector;
let defaultHandlerFn =
op === 'minimized'
? _defaultMinimizedCallback
: _defaultClosedCallback;
try {
defaultFocusElement = document.querySelector(defaultSelector);
} catch (e) {
defaultFocusElement = null;
}
try {
focusElement = document.querySelector(
isChatEverywhereClick && op === 'closed'
? chatEverywhereSelector
: querySelector
);
} catch (e) {
focusElement = null;
}
try {
if (typeof handlerFn === 'function') {
handlerFn();
} else if (
focusElement &&
typeof focusElement.focus === 'function'
) {
focusElement.focus({ focusVisible: true });
} else if (typeof defaultHandlerFn === 'function') {
defaultHandlerFn();
} else if (
defaultFocusElement &&
typeof defaultFocusElement.focus === 'function'
) {
defaultFocusElement.focus({ focusVisible: true });
} else if (
previousElement &&
typeof previousElement.focus === 'function'
) {
previousElement.focus({ focusVisible: true });
previousElement = null;
}
} catch (e) {
sendNRPageAction(
('__lp__' + handlerFn && handlerFn.name) ||
(defaultHandlerFn && defaultHandlerFn.name) ||
'generic_error',
{
err: e.message || JSON.stringify(e),
stack: e.stack || 'N/A',
selector: querySelector,
defaultSelector: defaultSelector
}
);
}
}, 1000);
};
// extract device type and os version
function _isMinSupportedVersion(referenceVersion, versionUnderTest) {
for (var i = 0; i < referenceVersion.length; i++) {
if (versionUnderTest[i] < referenceVersion[i]) {
// most significant version at this point is lower than reference so we can mark unsupported
return false;
}
if (versionUnderTest[i] > referenceVersion[i]) {
// most significant version at this point is greater than reference so we can mark supported
return true;
}
// most significant version at this point is equal to reference. continue loop to check next version element
}
// all version elements equal reference so we can mark supported
return true;
}
const checkABCCompatibleDevice = function () {
var isCompatibleDevice = false;
try {
var ua = (window.navigator && window.navigator.userAgent) || '';
var extracted = _osExtractRegex.exec(ua);
if (extracted) {
var deviceType = extracted[1].toLowerCase();
var extractedOSVersion = extracted[2]
.replace(/_/g, '.')
.split('.')
.map(function (ver) {
var intVer = 0;
try {
intVer = parseInt(ver);
} catch (e) {
// ignore parsing errors and just set it to 0
// that way, it will always be lesser than supported version
}
return intVer;
});
if (deviceType == 'macintosh') {
// this could be iPad since iPadOS returns same UA string as Mac
// as of Nov 2019, no touch enabled mac laptop/desktop exists. so if this browser has touch events available, it is iPad
// this is the only way at the moment to identify if this is iPad or not
if (window.navigator.maxTouchPoints > 1) {
// desktop/laptop won't have touch points. if touch points exists, it is a touch screen device, which at the moment implies iPadOS
// all iPadOS versions will support ABC so no further checks required
isCompatibleDevice = true;
_instance.appleDeviceType = 'tablet';
}
} else {
isCompatibleDevice = _isMinSupportedVersion(
_minSupportedIOS,
extractedOSVersion
);
_instance.appleDeviceType = 'mobile';
}
}
} catch (e) {
// wrapped in try catch so that if any of the expressions fail in older browser, it doesn't cause issues with rest of the script
}
return isCompatibleDevice;
};
Object.defineProperty(_instance, 'isABCCompatibleDevice', {
value: checkABCCompatibleDevice()
});
//
function convertChatButtonToMessaging() {
if (
!_instance.data.abcEnabled ||
!_instance.isABCCompatibleDevice ||
!_instance.data.contactUsABCEnabled
) {
// don't bother if abc disabled or not abc compatible device or contact us pages are not supposed to be converted to
return;
}
try {
var originalOnLoad = window.onload;
window.onload = function () {
var buttons = Array.from(document.getElementsByTagName('a'))
.filter(function (tag) {
return tag && /#lp:2way$/.test(tag.href);
})
.filter(function (tag) {
return (
tag &&
tag.classList &&
tag.innerText &&
tag.classList.contains('btn') &&
tag.classList.contains('primary') &&
tag.innerText == 'Chat now'
);
});
if (buttons && buttons.length > 0) {
buttons[0].href = abcUrlPrefix;
buttons[0].text = 'Message Us';
}
if (originalOnLoad && typeof originalOnLoad === 'function') {
originalOnLoad();
}
};
} catch (e) {
// wrapping in try catch so that no other functionality gets impacted
}
}
const isDTCApplicableOnPage = function () {
// not applicable if relevant DTC flag is off or if relevant VA is not active
if (
(_isUnderSmallBusiness &&
(!_config.enableBusinessDTC || !_instance.isBusinessVAActive())) ||
(!_isUnderSmallBusiness && !_config.enableDTC)
) {
return false;
}
// return false if this is a DTC disabled page
return !isDTCDisabledPage;
};
Object.defineProperty(_instance, 'isBusinessVAActive', {
value: function () {
return true;
}
});
/**
* All Function Definitions follow
*/
//
const sendUrlSDE = function () {
window.lpTag.sdes.push({
type: 'lead',
lead: {
topic: document.location.href,
leadId: 'siteUrl'
}
});
};
//
const sendAgentCtxInfo = function () {
let ctxInfo = null;
if (isProactive) {
if (!agentCtxInfo || agentCtxInfo.length === 0) {
return;
} else {
ctxInfo = agentCtxInfo;
}
} else if (isReactive) {
if (!reactiveAgentCtxInfo || reactiveAgentCtxInfo.length === 0) {
return;
} else {
ctxInfo = reactiveAgentCtxInfo;
}
}
if (ctxInfo === null) {
return;
}
try {
ctxInfo.map((info) => {
lpTag.sdes.push({
type: 'error',
error: { contextId: info.label, message: info.value }
});
});
} catch (e) {}
};
//
const _asyncLoad = setTimeout(function () {
if (document.getElementsByTagName('body').length != 0) {
_instance.backMask = document.createElement('DIV');
_instance.backMask.setAttribute(
'class',
'telstra_live_person_back hide'
);
_instance.container = document.createElement('DIV');
_instance.container.setAttribute(
'class',
'telstra_live_person_container modal-content'
);
_instance.containerBox = document.createElement('DIV');
_instance.containerBox.setAttribute(
'class',
'telstra_live_person_containerBox hide'
);
_instance.containerBox.appendChild(_instance.container);
_instance.closeBT = document.createElement('BUTTON');
_instance.closeBT.setAttribute('class', 'close');
_instance.closeBT.onclick = function () {
_instance.hide();
};
_instance.container.appendChild(_instance.closeBT);
document
.getElementsByTagName('body')[0]
.appendChild(_instance.backMask);
document
.getElementsByTagName('body')[0]
.appendChild(_instance.containerBox);
_instance.render();
clearTimeout(_asyncLoad);
}
}, 15000);
//
const getInitPersistentSection = function (_initSetting) {
return (
_instance.data.persistentSection ||
(_initSetting && _initSetting.persistentSection)
);
};
//
Object.defineProperty(_instance, 'getPersistentSection', {
value: function (_initSetting) {
return getInitPersistentSection(_initSetting);
}
});
//
const getInitPersistentChatLabel = function (_initSetting) {
return _instance.data.chatEverywhereLabel;
};
//
Object.defineProperty(_instance, 'getPersistentChatLabel', {
value: function (_initSetting) {
if (isDTCApplicableOnPage()) {
return _instance.data.dtcLabel;
} else {
return getInitPersistentChatLabel(_initSetting);
}
}
});
//
const stateMap = {
offered: 'chatImpression',
clicked: 'chatClicked',
declined: 'chatDeclined',
started: 'chatStarted',
ended: 'chatEnded',
suppressed: 'chatCampaignSuppression'
};
//
const setupStats = function () {
if (
window.omnitureData &&
window.omnitureData.dl &&
window.omnitureData.dl.trackingInfo
) {
if (
window.omnitureData.dl.trackingInfo.launchMigrationTrafficPercentage
) {
statType = 'STRATEGIC';
} else {
statType = 'LEGACY';
}
}
};
//
const sendLegacyStats = function (statParams) {
switch (statParams.provider) {
case 'abc':
omnitureData.dl.chatCoreInfo = {
intId: statParams['biz-intent-id'],
grpId: statParams['biz-group-id']
};
break;
default:
omnitureData.dl.chatCoreInfo = {
engName: statParams.engagementName,
convType: statParams.isProactive
? 'Proactive Web Messaging'
: /^(auth-)?web-msg/.test(statParams.engagementName)
? 'Web Messaging'
: 'Live Chat',
convId: statParams.conversationId
};
let state = stateMap[statParams.state];
window.analyticsToolkit.common.beacon('link', {
linkTrackEvents: state,
linkName: state
});
break;
}
};
//
const sendStrategicStats = function (statParams) {
switch (statParams.provider) {
case 'abc':
window.digitalData.event.push({
eventInfo: {
eventAction: stateMap[statParams.state],
eventType: 'chatCore',
eventCategory: '',
eventName: ''
},
attributes: {
intId: statParams['biz-intent-id'],
grpId: statParams['biz-group-id']
}
});
break;
default:
let event = {
eventInfo: {
eventAction: stateMap[statParams.state],
eventType:
cBlocking && statParams.state === 'clicked'
? 'chatCore - cookie blocked'
: 'chatCore',
eventCategory: '',
eventName: ''
},
attributes: {
engName: statParams.engagementName,
convType: statParams.isProactive
? 'Proactive Web Messaging'
: /^(auth-)?web-msg/.test(statParams.engagementName)
? 'Web Messaging'
: 'Live Chat',
convId: statParams.conversationId
}
};
if (statParams.isProactive && trComponentInfo) {
event.attributes.component = [
{
category: {
primaryCategory: 'proactive-messaging'
},
componentInfo: trComponentInfo
}
];
} else if (statParams.isReactive && reactiveTRComponentInfo) {
event.attributes.component = [
{
category: {
primaryCategory: 'reactive-messaging'
},
componentInfo: reactiveTRComponentInfo
}
];
}
window.digitalData.event.push(event);
}
};
//
const sendStats = function (statParams) {
try {
setupStats();
switch (statType) {
case 'STRATEGIC':
sendStrategicStats(statParams);
break;
case 'LEGACY':
sendLegacyStats(statParams);
break;
}
} catch (e) {
sendNRPageAction('__lp__stats', {
_err: e.message || JSON.stringify(e),
_stack: e.stack || 'N/A'
});
}
};
//
const getInitPersistentChatToggle = function (_initSetting) {
return (
_instance.data.persistentChat &&
_initSetting &&
_initSetting.persistentChat &&
_instance.data.persistentSection &&
_instance.data.persistentSection.length > 0
);
};
//
Object.defineProperty(_instance, 'isInitialized', {
value: function () {
return _initCalled;
}
});
//
const calculateMTRedirectFlag = function (preferAppLinks) {
if (!_globalMTRedirectEnabled) {
return false;
}
if (preferAppLinks === false) {
return false;
}
if (_appVersion) {
if (
_appPlatform === 'ios' &&
compareVersion(_appVersion, minIOSAppVerForMTRedirect) >= 0
) {
return true;
}
if (
_appPlatform === 'android' &&
compareVersion(_appVersion, minAndroidAppVerForMTRedirect) >= 0
) {
return true;
}
}
return false;
};
//
Object.defineProperty(_instance, 'setPreferAppLinks', {
value: function (flag) {
calculatedMTRedirect = calculateMTRedirectFlag(flag === true);
}
});
//
Object.defineProperty(_instance, 'setMinimizedFocusQuerySelector', {
value: function (querySelector) {
if (!_initCalled) {
return;
}
minimizedFocusQuerySelector = querySelector;
}
});
//
Object.defineProperty(_instance, 'setClosedFocusQuerySelector', {
value: function (querySelector) {
if (!_initCalled) {
return;
}
closedFocusQuerySelector = querySelector;
}
});
//
Object.defineProperty(_instance, 'setOnChatWindowClosed', {
value: function (handler) {
if (!_initCalled) {
return;
}
onChatWindowClosed = handler;
}
});
//
Object.defineProperty(_instance, 'setOnChatWindowMinimized', {
value: function (handler) {
if (!_initCalled) {
return;
}
onChatWindowMinimized = handler;
}
});
//
const getABCPageConfig = function (jabuka, defaultEnabled) {
let _abcConfig = { enabled: defaultEnabled };
if (jabuka.pageRules[thisPage]) {
_abcConfig = jabuka.pageRules[thisPage];
} else {
var patternList = Object.keys(jabuka.patternRules);
for (var i = 0; i < patternList.length; i++) {
var r = new RegExp(patternList[i]);
if (r.test(thisPage)) {
_abcConfig = jabuka.patternRules[patternList[i]];
break;
}
}
}
return _abcConfig;
};
//
const getABCConfig = function (callback) {
if (abcConfigLoaded) {
if (_loadedAbcConfig) {
callback(null, _loadedAbcConfig);
return;
}
}
var abcXHR = new XMLHttpRequest();
abcXHR.onreadystatechange = function () {
if (this.readyState == 4) {
abcConfigLoaded = true;
if (this.status == 200) {
try {
var _resp = JSON.parse(this.responseText);
_loadedAbcConfig = _resp;
callback(null, _resp);
} catch (e) {
callback(new Error('failed to parse jabuka response'));
}
} else {
callback(new Error('could not load ABC Config'));
}
}
};
abcXHR.open('GET', _instance.jabukaUrl, true);
abcXHR.send();
};
//
const constructABCUrl = function (pageABCConfig) {
if (!pageABCConfig.queryParams) {
// if no query params available, use all defaults
pageABCConfig.queryParams = {
'biz-intent-id': _instance.data.bizIntentId,
'biz-group-id': _instance.data.bizGroupId,
body: _instance.data.body
};
} else {
// use defaults for params that are not available
if (!pageABCConfig.queryParams['biz-intent-id']) {
pageABCConfig.queryParams['biz-intent-id'] =
_instance.data.bizIntentId;
}
if (!pageABCConfig.queryParams['biz-group-id']) {
pageABCConfig.queryParams['biz-group-id'] =
_instance.data.bizGroupId;
}
if (!pageABCConfig.queryParams['body']) {
pageABCConfig.queryParams['body'] = _instance.data.body;
}
}
let _abcUrl = abcUrlPrefix + '?';
Object.keys(pageABCConfig.queryParams).forEach(function (queryParam) {
_abcUrl +=
queryParam + '=' + pageABCConfig.queryParams[queryParam] + '&';
});
if (_abcUrl.substring(_abcUrl.length - 1) == '&') {
_abcUrl = _abcUrl.substring(0, _abcUrl.length - 1);
}
if (_abcUrl.substring(_abcUrl.length - 1) == '?') {
_abcUrl = _abcUrl.substring(0, _abcUrl.length - 1);
}
if (pageABCConfig['biz-intent-id']) {
_intent_id = pageABCConfig['biz-intent-id'];
}
if (pageABCConfig['biz-group-id']) {
_group_id = pageABCConfig['biz-group-id'];
}
return _abcUrl;
};
//
const constructABCButton = function (pageABCConfig) {
let _abcUrl = constructABCUrl(pageABCConfig);
// create abc button only if it doesn't exist
if (!_instance.abcButtonLink) {
_instance.abcButtonLink = document.createElement('div');
_instance.abcButtonLink.setAttribute('class', 'abcButtonLink');
_instance.abcButtonLink.setAttribute('id', 'abcButtonLink');
_instance.abcButtonLink.setAttribute('role', 'navigation');
_instance.abcButtonLink.setAttribute(
'aria-label',
'Message Us via Apple iMessage'
);
_instance.abcButtonLink.setAttribute('tabindex', '0');
_instance.abcButtonLink.onclick = function () {
window.open(_abcUrl);
let statParams = {
provider: 'abc',
state: 'started',
'biz-intent-id': _intent_id || 'N/A',
'biz-group-id': _group_id || ''
};
sendStats(statParams);
};
_instance.abcButtonImage = document.createElement('img');
_instance.abcButtonImage.setAttribute(
'src',
'https://www.telstra.com.au/content/dam/tcom/virtualassistant/abc/abc-floating-button.png'
);
_instance.abcButtonImage.setAttribute(
'alt',
'apple business chat icon'
);
if (_instance.appleDeviceType === 'tablet') {
_instance.persistentChatContainer.classList.add(
'abcChatContainerTablet'
);
_instance.abcButtonImage.classList.add('abcIconTablet');
} else {
_instance.persistentChatContainer.classList.add(
'abcChatContainerMobile'
);
_instance.abcButtonImage.classList.add('abcIconMobile');
}
_instance.abcButtonLink.appendChild(_instance.abcButtonImage);
_instance.persistentChatContainer.classList.add('fadein');
_instance.persistentChatContainer.appendChild(
_instance.abcButtonLink
);
_instance.abcTimeoutHandle = setTimeout(function () {
if (!proactiveExists()) {
showPersistentChatButton();
}
}, pageABCConfig.delay || _instance.data.abcButtonDelay);
}
};
//
const getTacticalABCURL = function () {
if (!abcConfigLoaded) {
return null;
}
let _cfg = getABCPageConfig(_loadedAbcConfig, false);
if (_cfg.enabled) {
return constructABCUrl(_cfg);
}
return null;
};
//
const updateSection = function (tag) {
const s = new Set(_instance.section);
s.add(tag);
_instance.section = Array.from(s);
};
//
const removeSection = function (tag) {
const s = new Set(_instance.section);
s.delete(tag);
_instance.section = Array.from(s);
};
//
const updateLPSection = function (tag) {
const s = new Set(window.lpTag.section);
s.add(tag);
window.lpTag.section = Array.from(s);
};
//
const removeLPSection = function (tag) {
const s = new Set(window.lpTag.section);
s.delete(tag);
window.lpTag.section = Array.from(s);
};
//
const hideLoadingIndicator = function () {
if (loadingIndicator) {
clearTimeout(loadingIndicatorTimer);
loadingIndicator.classList.add('t-lp-hide');
}
};
//
const showLoadingIndicator = function () {
clearTimeout(loadingIndicatorTimer);
if (dontShowLoadingIndicator) {
dontShowLoadingIndicator = false;
return;
}
if (loadingIndicator) {
if (!loadingIndicatorAttached) {
document.body.appendChild(loadingIndicator);
loadingIndicatorAttached = true;
}
[
loadingErrorIcon,
loadingErrorMessage,
loadingIndicatorCloseButton
].forEach((e) => e.classList.add('t-lp-hide'));
[
loadingSpinner,
loadingMessage,
loadingSpacer,
loadingIndicator
].forEach((e) => e.classList.remove('t-lp-hide'));
loadingIndicatorTimer = setTimeout(() => {
if (_instance.chatWindowOpen) {
hideLoadingIndicator();
return;
}
showLoadingFailure();
}, 15000);
}
};
//
const constructLoadingIndicator = function () {
loadingIndicator = document.createElement('div');
loadingIndicator.classList.add(
't-lp-loading-indicator-wrapper',
't-lp-hide'
);
loadingIndicator.innerHTML = `