window.__lpEnvSite = "21991129";
window.__watchDogURL = "https://telstrava-watchdog-prod.au-syd.mybluemix.net/v1/virtual-assistant-status";
window.__loadLivePersonSrc = function(){ window.lpTag=window.lpTag||{};if(typeof window.lpTag._tagCount==='undefined'){window.lpTag={site:window.__lpEnvSite||'81478844',section:lpTag.section||'',autoStart:lpTag.autoStart===false?false:true,ovr:lpTag.ovr||{},_v:'1.6.0',_tagCount:1,protocol:'https:',events:{bind:function(app,ev,fn){lpTag.defer(function(){lpTag.events.bind(app,ev,fn);},0);},trigger:function(app,ev,json){lpTag.defer(function(){lpTag.events.trigger(app,ev,json);},1);}},defer:function(fn,fnType){if(fnType==0){this._defB=this._defB||[];this._defB.push(fn);}else if(fnType==1){this._defT=this._defT||[];this._defT.push(fn);}else{this._defL=this._defL||[];this._defL.push(fn);}},load:function(src,chr,id){var t=this;setTimeout(function(){t._load(src,chr,id);},0);},_load:function(src,chr,id){var url=src;if(!src){url=this.protocol+'//'+((this.ovr&&this.ovr.domain)?this.ovr.domain:'lptag.liveperson.net')+'/tag/tag.js?site='+this.site;}var s=document.createElement('script');s.setAttribute('charset',chr?chr:'UTF-8');if(id){s.setAttribute('id',id);}s.setAttribute('src',url);document.getElementsByTagName('head').item(0).appendChild(s);},init:function(){this._timing=this._timing||{};this._timing.start=(new Date()).getTime();var that=this;if(window.attachEvent){window.attachEvent('onload',function(){that._domReady('domReady');});}else{window.addEventListener('DOMContentLoaded',function(){that._domReady('contReady');},false);window.addEventListener('load',function(){that._domReady('domReady');},false);}if(typeof(window._lptStop)=='undefined'){this.load();}},start:function(){this.autoStart=true;},_domReady:function(n){if(!this.isDom){this.isDom=true;this.events.trigger('LPT','DOM_READY',{t:n});}this._timing[n]=(new Date()).getTime();},vars:lpTag.vars||[],dbs:lpTag.dbs||[],ctn:lpTag.ctn||[],sdes:lpTag.sdes||[],ev:lpTag.ev||[]};lpTag.init();}else{window.lpTag._tagCount+=1;}
};
window.__disableVA = false;
var lpSettings = lpSettings || {
"heading": "Need to talk to us?",
"description": "Please tell us what you want to chat about",
"options": {"route0": {"label": "Mobile on a plan","isActive": "true","section": "telstra,service,aem,consumer","help": "","childs": {"route0": {"label": "Bill, Plan or Add-Ons","isActive": "true","section": "service-mobile,va-livechat","lead": "MOB-bill-plan-addon","help": "It's quick and easy to:
Order a new phone here
How to track your order
Check your contract termination fees
Cancel or change your order
Get help with a back order
Request a payment extension
Check your Upgrade & Recontracting Fees
Our latest offers"}, "route1": {"label": "Buy Online","isActive": "true","section": "sales-mobile","lead": "MOB-buy-online","help": "It's quick and easy to:
Order a new phone here
How to track your order
Check your contract termination fees
Cancel or change your order
Get help with a back order
Our latest offers"}, "route2": {"label": "Existing Order","isActive": "true","section": "service-general","lead": "MOB-existing-order,va-livechat","help": "It's quick and easy to:
Order a new phone here
How to track your order
Check your contract termination fees
Cancel or change your order
Get help with a back order
Track your order
"}, "route3": {"label": "Fault","isActive": "true","section": "fault-mobile,va-livechat","lead": "MOB-fault","help": "It's quick and easy to:
View our Mobile interactive help guides
Unlock your iPhone"}, "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 Enquiries","isActive": "true","section": "service-general,mob-other,va-livechat","lead": "MOB-other","help": "It's quick and easy to:
Order a new phone here
How to track your order
Check your contract termination fees
Cancel or change your order
Get help with a back order
Get help with our online Support Articles
"}}}, "route1": {"label": "Pre-Paid Mobile","isActive": "true","section": "telstra,service,aem,consumer","childs": {"route0": {"label": "Activate or Recharge","isActive": "true","section": "prepaid","lead": "PPM-activate-recharge,va-livechat","help": "It's quick and easy to:
How to activate your Pre-Paid Service
How to recharge your Pre-Paid Service
Automatic Recharge
Payment Option
How to change your plan
Troubleshooting
Check your activation status
Check out our Pre-Paid support articles"}, "route1": {"label": "Existing Order","isActive": "true","section": "prepaid,va-livechat","lead": "PPM-existing-order"}, "route2": {"label": "My Offer / Plan","isActive": "true","section": "prepaid,va-livechat","lead": "PPM-my-offer-plan","help": "It's quick and easy to:
Old Pre-Paid plans
View or change your plan
Explore new plans
Pre-Paid Plus packs
International roaming
Pre-Paid Expiry period "}, "route3": {"label": "Fault","isActive": "true","section": "fault-mobile,va-livechat","lead": "PPM-fault","help": "It's quick and easy to:
View Pre-Paid Troubleshooting Tips"}, "route4": {"label": "SIM replacement","isActive": "true","section": "prepaid-sim-deflect","lead": "PPM-sim-rep","help": "It's quick and easy to:
Replacing a lost or stolen Pre-Paid Sim card
Unlocking your Telstra mobile device
Track your order
Cancel or change your order
Check out our Pre-Paid support articles"}, "route5": {"label": "Disconnection","isActive": "true","section": "saves","lead": "PPM-disconnection"}}}, "route2": {"label": "NBN & NBN Bundles","isActive": "true","section": "telstra,service,aem,consumer","childs": {"route0": {"label": "Buy Online","isActive": "true","section": "sales-nbn","lead": "NBN-buy-online","help": "It's quick and easy to:
Browse our Online Shop"}, "route1": {"label": "Bill, Plan or Add-Ons","isActive": "true","section": "service-nbn","lead": "NBN-bill-plan-addon","help": "Track your NBN Order"}, "route2": {"label": "Existing Order","isActive": "true","section": "nbn-orders","lead": "NBN-existing-order","help": "Track your NBN Order"}, "route3": {"label": "Moving Home","isActive": "true","section": "nbn-moves","lead": "NBN-moving-home"}, "route4": {"label": "Fault","isActive": "true","section": "fault-nbn","lead": "NBN-fault"}, "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": "Bill, Plan or Add-Ons","isActive": "true","section": "service-home","lead": "BBHP-bill-plan-addon"}, "route1": {"label": "Buy Online","isActive": "true","section": "sales-home","lead": "BBHP-buy-online","help": "It's quick and easy to:
Broadband
Bundles
Home Phone"}, "route2": {"label": "Existing Order","isActive": "true","section": "service-bundles-home","lead": "BBHP-existing-order"}, "route3": {"label": "Moving Home","isActive": "true","section": "copper-moves","lead": "BBHP-moving-home"}, "route4": {"label": "Fault","isActive": "true","section": "fault-adsl","lead": "BBHP-fault"}, "route5": {"label": "Disconnection","isActive": "true","section": "saves","lead": "BBHP-disconnection"}}}, "route4": {"label": "Entertainment & Apps","isActive": "true","section": "telstra,service,aem,consumer","childs": {"route0": {"label": "24x7 App","isActive": "true","section": "service-apps,va-livechat","lead": "EAA-247-app"}, "route1": {"label": "Email","isActive": "true","section": "fault-email","lead": "EAA-email","help": "It's quick and easy to:
Troubleshoot email for desktop
Troubleshoot email for mobile"}, "route2": {"label": "Foxtel","isActive": "true","section": "apps-foxtel-deflect","lead": "EAA-foxtel"}, "route3": {"label": "My Account","isActive": "true","section": "service-apps,va-livechat","lead": "EAA-my-acc","help": "It's quick and easy to:
Register for My Account
Retrieve your Username
Retrieve or reset your Password"}, "route4": {"label": "Telstra Air","isActive": "true","section": "service-apps,va-livechat","lead": "EAA-telstra-air"}, "route5": {"label": "Platinum","isActive": "true","section": "platinum","lead": "EAA-platinum"}}}, "route5": {"label": "Business Accounts & Products","isActive": "true","section": "telstra,service,aem,consumer,business","lead": "BAAP-none","childs": {}}}
};
/*
LivePerson class
*/
var console = console || {
log: function(log1, log2){
}
};
var TelstraLivePerson = function(_config){
this.data = _config;
this.backMask = false;
this.container = false;
this.containerBox = false;
this.closeBT = false;
this.childElements = {};
this.siteId = false;
this.section = false;
this.sourceSection = false;
this.authToken = false;
this.isDirect = false;
this.lead = false;
this.urlMap = window.__lpUrlMap || false;
this.callBack = false;
this.callBackInterval = 1; // in second
this.callBackTread = false;
var _vaSection = "virtualassistant";
var _instance = this;
this._watchDogURL = 'virtual-assistant-status';
if(window.__watchDogURL){
this._watchDogURL = window.__watchDogURL;
}
this._watchDog = {
"virtual-assistant-status":{
"orchestrator":false,
"watson-virtual-agent":false,
"liveperson-agent-api":false,
"watson-tone-analyzer":false
}
};
this.isVAActive = function(){
if(_instance._watchDog
&& _instance._watchDog["virtual-assistant-status"]
&& _instance._watchDog["virtual-assistant-status"]["orchestrator"]
&& _instance._watchDog["virtual-assistant-status"]["watson-virtual-agent"]
&& _instance._watchDog["virtual-assistant-status"]["liveperson-agent-api"]
//&& _instance._watchDog["virtual-assistant-status"]["watson-tone-analyzer"]
){
return true;
}else{
return false;
}
}
// async bind
var _style = "";
_style+= '.telstra_live_person_back.hide, .telstra_live_person_containerBox.hide{display:none;}';
_style+= '.telstra_live_person_back{width:100%; height:1000%; position: absolute; top: 0; left: 0; background-color: #666666; opacity: 0.8;}';
_style+= '.telstra_live_person_containerBox{width: 100%;position: fixed; top: 100px;}';
_style+= '.telstra_live_person_container{width: 80%; max-width:474px; max-height:100%; min-height: 220px; margin: 0px auto; background-color: #ffffff;color: #666666; padding: 10px;}';
_style+= '.telstra_live_person_container_header{font-size: 24px; padding: 10px; border-bottom: 1px solid #dddddd;}';
_style+= '.telstra_live_person_container_description{padding: 10px;}';
_style+= '.telstra_live_person_container_routeLevel1{width: 90%; padding: 5px 10px; margin-bottom: 5px;}';
_style+= '.telstra_live_person_container_routeLevel1>select{width: 100%; padding: 5px 0px;}';
_style+= '.telstra_live_person_container_routeLevel2{width: 90%; padding: 5px 10px; margin-bottom: 5px;}';
_style+= '.telstra_live_person_container_routeLevel2>select{width: 100%; padding: 5px 0px;}';
_style+= '.telstra_live_person_container_chatNow_desc{width: 90%; padding: 5px 10px;}';
_style+= '.telstra_live_person_container_chatNow_bt{float: right;left: -20px;}';
//_style+= '.LPMcontainer.LPMoverlay{display:none!important;}';
var _styleElement = document.createElement("STYLE");
_styleElement.innerHTML = _style;
document.getElementsByTagName('head')[0].appendChild(_styleElement);
var _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);
}
}, 500);
this.init = function(_initSetting){
this.section = _initSetting.section || [];
if(this.urlMap){
var _urlVal = document.URL.split("?")[0].split("#")[0];
if(this.urlMap[_urlVal]){
this.section = this.urlMap[_urlVal];
}
}
this.sourceSection = _initSetting.sourceSection || [];
this.callBack = _initSetting.callBack || false;
this.callBackInterval = _initSetting.callBackInterval || this.callBackInterval;
/*Initializing TP TAG*/
window.lpTag = window.lpTag || {};
window.lpTag.section = this.section;
if(window.__loadLivePersonSrc){
window.__loadLivePersonSrc();
// incase if lp overwrite sections
window.lpTag.section = this.section;
}
this.section = JSON.parse(JSON.stringify(this.sourceSection));
window.lpTag.sdes = lpTag.sdes||[];
this.isDirect = _initSetting.isDirect;
var _styleLocal = "";
if(!_initSetting.onlyTcomCSS){
_styleLocal+= '.telstra_live_person_container>.close {float: right;display: block;height: 26px;width: 26px;border: 0;padding: 0;cursor: pointer;background-color: #00aaf3;}';
_styleLocal+= '.close:after {display: inline-block;content: "x";font-size: 18px !important;color: #fff !important;font-weight: normal !important;line-height: 26px;}';
if(_initSetting.forceButtonCss){
_styleLocal+= '.button,.btn {padding: 14px 20px 14px 20px;border: none;text-decoration: none;display: inline-block;white-space: nowrap;position: relative;outline: none;line-height: normal;max-width: 100%;background-color: #1964c8;color: #fff;}';
}
}else{
//Tcom Specific css
}
var _styleLocalElement = document.createElement("STYLE");
_styleLocalElement.innerHTML = _styleLocal;
document.getElementsByTagName('head')[0].appendChild(_styleLocalElement);
// Add event Listner
window.lpTag.events.bind("lpUnifiedWindow","state",function(_data) {
// when resume;
if(_data && (_data.state === "waiting" || _data.state === "resume" )){
if(_instance.callBackTread){
clearInterval(_instance.callBackTread);
_instance.callBackTread = false;
}else if(_instance.callBack){
_instance.callBackTread = setInterval(function(){
_instance.callBack();
}, _instance.callBackInterval*1000);
}
}else if(_data && _data.state === "ended"){
// when ended;
if(_instance.callBackTread){
clearInterval(_instance.callBackTread);
_instance.callBackTread = false;
}
}
});
}
var _runLiveChat = function(){
var sdesConsumerConfig = {
"type": "ctmrinfo", //MANDATORY
"info": {
"cstatus": "non-auth"
}
}
if(_instance.authToken){
sdesConsumerConfig.info.cstatus = "auth-tdi";
sdesConsumerConfig.info.customerId = _instance.authToken;
}
window.lpTag.sdes.push(sdesConsumerConfig);
if(_instance.lead){
lpTag.sdes.push({
"type": "lead", //MANDATORY
"lead": {
"topic": _instance.lead+"", //Customers Level1+Level2 routing choice selection as string - REFER TO TAB3 COLUMN E
}
});
}
// Section Manupulation
if(window.__disableVA || !_instance.isVAActive()){
// remove VA section
_instance.removeSection(_vaSection);
}
window.lpTag.newPage(document.URL, {
section: _instance.section, //REFER TO TAB3 COLUMN I
});
_instance.section = JSON.parse(JSON.stringify(_instance.sourceSection));
window.engagementId; // NOTE: The value of the var has to be an integer.
window.lpTag.events.bind("LP_OFFERS","OFFER_IMPRESSION",function(data) { //This is triggered when the engagement has been displayed on the page.
if (data.engagementType===6){
window.engagementId = data.engagementId;
var checkForChat = setInterval(checkRendererStubReady, 500);
function checkRendererStubReady() {
if (window.lpTag && window.lpTag.taglets && window.lpTag.taglets.rendererStub){
var info = window.lpTag.taglets.rendererStub.getEngagementInfo(engagementId);
if(info.state!="undefined") {
window.lpTag.taglets.rendererStub.click(window.engagementId);
clearInterval(checkForChat);
}
}
}
}
});
}
this.show= function(_showConfig){
var _showConfig = _showConfig || {};
if(_showConfig.section && _showConfig.section.length && _showConfig.section.length>0){
for(var _i = 0; _i<_showConfig.section.length; _i++){
this.updateSection(_showConfig.section[_i]);
}
}
if(_showConfig.authToken){
this.authToken = _showConfig.authToken;
this.updateSection("auth-tdi");
this.removeSection("non-auth");
}else{
this.updateSection("non-auth");
this.removeSection("auth-tdi");
}
if(_showConfig.lead){
this.lead = _showConfig.lead;
}
if(this.isDirect || _showConfig.isDirect){
console.log("direct route");
_runLiveChat();
}else{
//add exclude
this.updateLPSection("exclude");
_instance.backMask.classList.remove('hide');
_instance.containerBox.classList.remove('hide');
}
}
this.hide= function(){
//Remove exclude
this.removeLPSection("exclude");
_instance.backMask.classList.add('hide');
_instance.containerBox.classList.add('hide');
_instance.childElements['routeLevel1Select'].value="0";
_instance.onSelectRouter1(_instance.childElements['routeLevel1Select'].value);
}
this.render = function(){
this.childElements['header'] = document.createElement("DIV");
this.childElements['header'].setAttribute("class", "telstra_live_person_container_header");
this.childElements['header'].innerHTML = this.data.heading;
this.container.appendChild(this.childElements['header']);
this.childElements['description'] = document.createElement("DIV");
this.childElements['description'].setAttribute("class", "telstra_live_person_container_description");
this.childElements['description'].innerHTML = this.data.description;
this.container.appendChild(this.childElements['description']);
this.childElements['routeLevel1'] = document.createElement("DIV");
this.childElements['routeLevel1Select'] = document.createElement("SELECT");
var _defaultOption = document.createElement("OPTION");
_defaultOption.value="0";
_defaultOption.innerHTML="Choose a category";
this.childElements['routeLevel1Select'].appendChild(_defaultOption);
for(var _option in this.data.options){
var _localOption = document.createElement("OPTION");
_localOption.value = _option;
_localOption.innerHTML = this.data.options[_option].label;
this.childElements['routeLevel1Select'].appendChild(_localOption);
}
this.childElements['routeLevel1Select'].onchange = function(e){
_instance.onSelectRouter1(e.target.value);
};
this.childElements['routeLevel1'].setAttribute("class", "telstra_live_person_container_routeLevel1");
this.childElements['routeLevel1'].appendChild(this.childElements['routeLevel1Select']);
this.container.appendChild(this.childElements['routeLevel1']);
//this.container.innerHTML = "Popup";
this.childElements['routeLevel2'] = document.createElement("DIV");
this.childElements['routeLevel2'].setAttribute("class", "telstra_live_person_container_routeLevel2");
this.container.appendChild(this.childElements['routeLevel2']);
// Chat now component
this.childElements['chatNow'] = document.createElement("DIV");
this.childElements['chatNow'].setAttribute("class", "telstra_live_person_container_chatNow");
this.container.appendChild(this.childElements['chatNow']);
}
this.onSelectRouter1 = function(_id){
console.log("Route1Selected:"+_id);
//clear child
while (this.childElements['routeLevel2'].firstChild) {
this.childElements['routeLevel2'].removeChild(this.childElements['routeLevel2'].firstChild);
}
if(_id+""!="0"){
if(this.data.options[_id].childs && JSON.stringify(this.data.options[_id].childs)!=JSON.stringify({})){
var _dataOptions = this.data.options[_id].childs
this.childElements['routeLevel2Select'] = document.createElement("SELECT");
this.childElements['routeLevel2'].appendChild(this.childElements['routeLevel2Select']);
var _defaultOption = document.createElement("OPTION");
_defaultOption.value="0";
_defaultOption.innerHTML="Choose a category";
this.childElements['routeLevel2Select'].appendChild(_defaultOption);
for(var _option in _dataOptions){
var _localOption = document.createElement("OPTION");
_localOption.value = _option;
_localOption.innerHTML = _dataOptions[_option].label;
this.childElements['routeLevel2Select'].appendChild(_localOption);
}
this.childElements['routeLevel2Select'].onchange = function(e){
_instance.onSelectRouter2(e.target.value);
};
this.showChatNow(false, false);
}else{
this.childElements['routeLevel2Select'] = false;
var _parentObject = false;
for(var _option in this.data.options){
if(_option === _id){
_parentObject = this.data.options[_option];
_parentObject.id = _id;
}
}
this.showChatNow(_parentObject, false);
console.log("No child route found for "+_id);
}
}else{
this.showChatNow(false, false);
}
}
this.onSelectRouter2 = function(_id){
var _ParentRouteId = this.childElements['routeLevel1Select'].value;
var _ChildRouteId = this.childElements['routeLevel2Select'];
if(_ChildRouteId){
_ChildRouteId = _ChildRouteId.value;
}
var _parentObject = false;
var _childObject = false;
for(var _option in this.data.options){
if(_option === _ParentRouteId){
_parentObject = this.data.options[_option];
_parentObject.id = _ParentRouteId;
for(var _childOption in this.data.options[_option].childs){
if(_childOption === _ChildRouteId){
_childObject = this.data.options[_option].childs[_childOption];
_childObject.id = _ChildRouteId;
}
}
}
}
if(_id+""=="0"){
this.showChatNow(false, false);
}else{
this.showChatNow(_parentObject, _childObject);
}
}
this.showChatNow = function(_parentObject, _childObject){
var _showableObj = _childObject || _parentObject;
var _helpShowable = function(_arrString){
var __returnObj = true;
if(_arrString && _arrString.length>0){
for(var _arrStringI = 0; _arrStringI < _arrString.length; _arrStringI++){
var _sectionArr = _arrString[_arrStringI].split(',');
for(var _sectionArrI = 0; _sectionArrI < _sectionArr.length; _sectionArrI++){
if(_sectionArr[_sectionArrI] == _vaSection){
//__returnObj = false;
}
}
}
}
return __returnObj;
};
//clear child
while (this.childElements['chatNow'].firstChild) {
this.childElements['chatNow'].removeChild(this.childElements['chatNow'].firstChild);
}
if(!_showableObj){
return;
}
if(_showableObj.lead){
this.lead = _showableObj.lead;
}else{
this.lead = false;
}
var _infoArray = [];
_infoArray[0] = _parentObject.section;
if(_childObject){
_infoArray[1] = _childObject.section;
}
this.childElements['chatNowDesc'] = document.createElement("DIV");
this.childElements['chatNowDesc'].setAttribute("class", "telstra_live_person_container_chatNow_desc");
this.childElements['chatNow'].appendChild(this.childElements['chatNowDesc']);
if(_showableObj.help && _showableObj.help!=""){
// remove if section for child or parent has _vaSection
var _sectionStringArr = [];
if(_parentObject && _parentObject.section){
_sectionStringArr[_sectionStringArr.length]=_parentObject.section;
}
if(_childObject && _childObject.section){
_sectionStringArr[_sectionStringArr.length]=_childObject.section;
}
if(_helpShowable(_sectionStringArr) || window.__disableVA || (!window.__disableVA && !_instance.isVAActive())){
this.childElements['chatNowDesc'].innerHTML = _showableObj.help;
}
}
this.childElements['chatNowBt'] = document.createElement("A");
this.childElements['chatNowBt'].setAttribute("class", "telstra_live_person_container_chatNow_bt btn primary");
this.childElements['chatNowBt'].innerHTML = "Chat now";
this.childElements['chatNowBt'].setAttribute("href", "javascript:void(0);");
// Adding Chat initialisation
this.childElements['chatNowBt'].onclick = function(){
_instance.initChat(_infoArray);
}
this.childElements['chatNow'].appendChild(this.childElements['chatNowBt']);
var _clearDiv = document.createElement("DIV");
_clearDiv.style.clear = "both";
this.childElements['chatNow'].appendChild(_clearDiv);
}
this.updateSection = function(_id){
var _isUnique = true;
for(var _i = 0; _i