var omnitureInterval, counter = !1, proActiveCounter = !1, newSessionAgent = !1, newSessionMsg = !1, newSessionMinimize = !1, newSessionStartOver = !1, newSessionChatTranscript = !1, newSessionClose = !1, newSessionsocketConnected = !1, chatdetails = ""; function getOmnitureCookie(e) { let t = {}; return document.cookie.split(";").forEach(function (e) { var n = e.split("=")[0], o = e.substring(e.split("=")[0].length + 1); t[n.trim()] = o }), t[e] } var socketConnected = "", isChatOpen = "", isChatAgentConnected = "", chatId = "", engagementId = "", chatEngineType = "", clickedStartOver = !1, isChatActive = "", chatEntry = "", pageCategory = "", isProactive = "", proactiveType = "", chatTranscript = "", omnitureCookieNames = ["__csomni", "__ceidomni", "__cacomni", "__cminomni", "__cromni", "__ctromni", "__cepomni", "__cpcpomni", "__cabomni", "__cpaomni"]; setInterval(function () { var e = void 0 !== getOmnitureCookie("__eccomp"), t = e ? readCookieContentById("eccompslex", "__cwss") : getOmnitureCookie("__cwss"); t && (socketConnected = t); var n = e ? readCookieContentById("__eccompslex", "__cwof") : getOmnitureCookie("__cwof"); if (n && (isChatOpen = n), isChatAgentConnected = e ? readCookieContentById("__eccompslex", "__caf") : getOmnitureCookie("__caf")) { engagementId = (e ? readCookieContentById("__eccomp", "__cpseid") : getOmnitureCookie("__cpseid")) || "NA" } else engagementId = "NA"; chatId = (e ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA"; var o, i, c, s = e ? readCookieContentById("__eccomp", "__cepomni") : getOmnitureCookie("__cepomni"); s && (chatEntry = s), pageCategory = (e ? readCookieContentById("__eccomp", "__cpcpomni") : getOmnitureCookie("__cpcpomni")) || "NA"; var a = e ? readCookieContentById("__eccomp", "__cpaomni") : getOmnitureCookie("__cpaomni"); a && (isProactive = a); var r = e ? readCookieContentById("__eccomp", "__cwpsa") : getOmnitureCookie("__cwpsa"); r && (proactiveType = r); var C = e ? readCookieContentById("__eccomp", "__cwt") : getOmnitureCookie("__cwt"); C && (chatTranscript = C) }, 2e3); var paType = "", chatAvailableck = !1; function echatPayloadCall(e, t, n) { (chatAvailableck = "965-0-0" == (n ? readCookieContentById("__eccomp", "__cabomni") : getOmnitureCookie("__cabomni"))) || (setTimeout(function () { 1 === $("#eChat_B_GA").length && !1 === counter && ("function" == typeof s_oTrackPage && s_oTrackPage({ s_oLSTB: "Chat~" + e + "~G~" + t + "~eChat_B_GA~R", s_oAPT: "965-0-0" }), counter = !0) }, 3e3), setTimeout(function () { 1 === $("#btnPaSubtle").length && !1 === proActiveCounter && ("function" == typeof s_oTrackPage && s_oTrackPage({ s_oLSTB: "Chat~" + e + "~G~" + t + "~eChat_B_GA~PS", s_oAPT: "965-0-0" }), proActiveCounter = !0) }, 36e3), setTimeout(function () { 1 === $("#btnPaAggressive").length && !1 === proActiveCounter && ("function" == typeof s_oTrackPage && s_oTrackPage({ s_oLSTB: "Chat~" + e + "~G~" + t + "~eChat_B_GA~PA", s_oAPT: "965-0-0" }), proActiveCounter = !0) }, 36e3)) } var entryPointID = ""; function getChatButtonType(e) { switch (e) { case "eChat_Bell_ContactUs_MOB": case "eChat_Bell_ContactUs_INT": case "eChat_Bell_ContactUs_TV": case "eChat_Bell_ContactUs_HP": case "eChat_Bell_MOB_Escalations": case "eChat_Bell_BRS_Escalations": case "eChat_Bell_EPP": return "F"; default: return "G" } } function getPosition(e) { switch (e) { case "eChat_Bell_ContactUs_MOB": case "eChat_Bell_MOB_Escalations": return "T1"; case "eChat_Bell_ContactUs_INT": case "eChat_Bell_BRS_Escalations": return "T2"; case "eChat_Bell_ContactUs_TV": return "T3"; case "eChat_Bell_ContactUs_HP": return "T4"; case "eChat_Bell_EPP": return "C1"; default: return "BR" } } var position = "", chatButtonType = ""; function getEntryPoint() { entryPointID = null != chatEntry && void 0 != chatEntry && "" != chatEntry ? chatEntry : "eChat_B_GA" } function newSessionPayloadCall(e, t, n) { getEntryPoint(), pageCategory = setPageCategory(e, n), position = getPosition(entryPointID), chatButtonType = getChatButtonType(entryPointID); var o = { attributes: !0, childList: !0, characterData: !0 }; let i = new MutationObserver(function e(t) { for (var o, c, s = t[t.length - 1], a = 0; a < s.addedNodes.length; a++)if (!s.addedNodes[a].contains(document.querySelector("#agentTypingDots"))) { if (newSessionAgent = "966-0-0" == (n ? readCookieContentById("__eccomp", "__ceidomni") : getOmnitureCookie("__ceidomni")), isChatAgentConnected) { engagementId = (n ? readCookieContentById("__eccomp", "__cpseid") : getOmnitureCookie("__cpseid")) || "NA" } else engagementId = "NA"; chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", newSessionAgent || "true" !== isChatAgentConnected || (n ? updateCookieContentById("__eccomp", "__ceidomni", "966-0-0") : setOmnitureCookie("__ceidomni", "966-0-0"), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~Agent~" + entryPointID + "~" + isProactive + "~NA~CA", s_oAPT: "966-0-0", s_oAJC: !0 }), newSessionAgent = !0, i.disconnect(), clearInterval(omnitureInterval)) } }); $(document).ready(function () { $(document).on("click", ".echat-send-button", function () { var e; newSessionMsg = "967-0-0" == (n ? readCookieContentById("__eccomp", "__csomni") : getOmnitureCookie("__csomni")), chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", newSessionMsg || (proactiveType ? (entryPointID = setEntryPointCookie("eChat_B_GA", n), isProactive = proactiveType) : isProactive = "R", n ? (updateCookieContentById("__eccomp", "__cpaomni", isProactive), updateCookieContentById("__eccomp", "__csomni", "967-0-0")) : (setOmnitureCookie("__cpaomni", isProactive), setOmnitureCookie("__csomni", "967-0-0")), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~Bot~" + entryPointID + "~" + isProactive + "~NA~CS", s_oAPT: "967-0-0", s_oAJC: !0 }), newSessionMsg = !0) }), $(document).on("click", ".eChat-agent-text-button-small, .echat-blue-button-text, .eChat-secondaryCta, .eChat-agent-text-card", function () { var e; newSessionMsg = "967-0-0" == (n ? readCookieContentById("__eccomp", "__csomni") : getOmnitureCookie("__csomni")), chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", newSessionMsg || (proactiveType ? (entryPointID = setEntryPointCookie("eChat_B_GA", n), isProactive = proactiveType) : isProactive = "R", n ? (updateCookieContentById("__eccomp", "__cpaomni", isProactive), updateCookieContentById("__eccomp", "__csomni", "967-0-0")) : (setOmnitureCookie("__cpaomni", isProactive), setOmnitureCookie("__csomni", "967-0-0")), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~Bot~" + entryPointID + "~" + isProactive + "~NA~CS", s_oAPT: "967-0-0", s_oAJC: !0 }), newSessionMsg = !0) }) }), $(document).on("click", "#closechatSessionButton", function () { "968-0-0" == (n ? readCookieContentById("__eccomp", "__cacomni") : getOmnitureCookie("__cacomni")) ? (newSessionClose = !0, newSessionsocketConnected = !0) : newSessionsocketConnected = !1, chatEngineType = ("true" === isChatAgentConnected || "True" === isChatAgentConnected) && null != isChatAgentConnected && void 0 != isChatAgentConnected && "" != isChatAgentConnected ? "Agent" : "Bot", newSessionClose || newSessionsocketConnected ? (proactiveType = "R", deleteOmnitureCookies(n), newSessionClose = !0, newSessionsocketConnected = !0) : (s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~" + chatEngineType + "~" + entryPointID + "~" + isProactive + "~user~CC", s_oAPT: "968-0-0", s_oAJC: !0 }), newSessionClose = !0, newSessionsocketConnected = !0, proactiveType = "R", deleteOmnitureCookies(n)) }), omnitureInterval = setInterval(function () { var e, t, c; if (("true" === isChatAgentConnected || "True" === isChatAgentConnected) && null != isChatAgentConnected && void 0 != isChatAgentConnected && "" != isChatAgentConnected) { engagementId = (n ? readCookieContentById("__eccomp", "__cpseid") : getOmnitureCookie("__cpseid")) || "NA", $(document).on("click", ".echat-send-button", function () { var e; newSessionAgent = "966-0-0" == (n ? readCookieContentById("__eccomp", "__ceidomni") : getOmnitureCookie("__ceidomni")), chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", newSessionAgent || "true" !== isChatAgentConnected || (n ? updateCookieContentById("__eccomp", "__ceidomni", "966-0-0") : setOmnitureCookie("__ceidomni", "966-0-0"), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~Agent~" + entryPointID + "~" + isProactive + "~NA~CA", s_oAPT: "966-0-0", s_oAJC: !0 }), newSessionAgent = !0, clearInterval(omnitureInterval)) }), $(document).on("DOMSubtreeModified", "#messages", function () { var e = document.querySelector("#msgWindowHeight"); i.observe(e, o) }) } if ("false" === socketConnected && "true" === isChatOpen) { newSessionsocketConnected = "968-0-0" == (n ? readCookieContentById("__eccomp", "__cacomni") : getOmnitureCookie("__cacomni")), chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", isChatActive = (n ? readCookieContentById("__eccompslex", "__cwf") : getOmnitureCookie("__cwf")) || isChatActive, chatEngineType = ("true" === isChatAgentConnected || "True" === isChatAgentConnected) && null != isChatAgentConnected && void 0 != isChatAgentConnected && "" != isChatAgentConnected ? "Agent" : "Bot", newSessionsocketConnected || "true" != isChatActive || (n ? updateCookieContentById("__eccomp", "__cacomni", "968-0-0") : setOmnitureCookie("__cacomni", "968-0-0"), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~" + chatEngineType + "~" + entryPointID + "~" + isProactive + "~Auto~CC", s_oAPT: "968-0-0", s_oAJC: !0 }), newSessionsocketConnected = !0, clearInterval(omnitureInterval)) } }, 2e3), $(document).on("click", "#minimizeChatWindowBtn", function () { var e; newSessionMinimize = "969-0-0" == (n ? readCookieContentById("__eccomp", "__cminomni") : getOmnitureCookie("__cminomni")), chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", chatEngineType = ("true" === isChatAgentConnected || "True" === isChatAgentConnected) && null != isChatAgentConnected && void 0 != isChatAgentConnected && "" != isChatAgentConnected ? "Agent" : "Bot", newSessionMinimize || (n ? updateCookieContentById("__eccomp", "__cminomni", "969-0-0") : setOmnitureCookie("__cminomni", "969-0-0"), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~" + chatEngineType + "~" + entryPointID + "~" + isProactive + "~NA~CM", s_oAPT: "969-0-0", s_oAJC: !0 }), newSessionMinimize = !0) }), $(document).on("click", "#minimizeChevronDownBtn", function () { var e; newSessionMinimize = "969-0-0" == (n ? readCookieContentById("__eccomp", "__cminomni") : getOmnitureCookie("__cminomni")), chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", chatEngineType = ("true" === isChatAgentConnected || "True" === isChatAgentConnected) && null != isChatAgentConnected && void 0 != isChatAgentConnected && "" != isChatAgentConnected ? "Agent" : "Bot", newSessionMinimize || (proactiveType ? (entryPointID = setEntryPointCookie("eChat_B_GA", n), isProactive = proactiveType) : isProactive = "R", n ? (updateCookieContentById("__eccomp", "__cpaomni", isProactive), updateCookieContentById("__eccomp", "__cminomni", "969-0-0")) : (setOmnitureCookie("__cpaomni", isProactive), setOmnitureCookie("__cminomni", "969-0-0")), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~" + chatEngineType + "~" + entryPointID + "~" + isProactive + "~NA~CM", s_oAPT: "969-0-0", s_oAJC: !0 }), newSessionMinimize = !0) }), $(document).on("click", "#startOver", function () { clickedStartOver = !0 }), $(document).on("click", "#ButtonYes", function () { var e; newSessionStartOver = "970-0-0" == (n ? readCookieContentById("__eccomp", "__cromni") : getOmnitureCookie("__cromni")), chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", !newSessionStartOver && clickedStartOver && (n ? updateCookieContentById("__eccomp", "__cromni", "970-0-0") : setOmnitureCookie("__cromni", "970-0-0"), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~Bot~" + entryPointID + "~" + isProactive + "~NA~CR", s_oAPT: "970-0-0", s_oAJC: !0 }), newSessionStartOver = !0, clickedStartOver = !1) }), $(document).on("click", "#ButtonNo", function () { var e; chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", !newSessionStartOver && clickedStartOver && (clickedStartOver = !1) }), $(document).on("click", "#btnSubmitTranscriptRequest", function () { setTimeout(function () { if (!$("#chatTranscriptPanel").is(":visible")) { var e; newSessionChatTranscript = "971-0-0" == (n ? readCookieContentById("__eccomp", "__ctromni") : getOmnitureCookie("__ctromni")), chatId = (n ? readCookieContentById("__eccompslex", "__csid") : getOmnitureCookie("__csid")) || "NA", newSessionChatTranscript || (n ? updateCookieContentById("__eccomp", "__ctromni", "971-0-0") : setOmnitureCookie("__ctromni", "971-0-0"), s_oTrackPage({ s_oChat: "" + chatId + "~" + engagementId + "~" + pageCategory + "~" + chatButtonType + "~" + position + "~Agent~" + entryPointID + "~" + isProactive + "~NA~CT", s_oAPT: "971-0-0", s_oAJC: !0 }), newSessionChatTranscript = !0) } }, 1e3) }), t || (newSessionAgent = !1, newSessionMsg = !1, newSessionMinimize = !1, newSessionStartOver = !1, newSessionChatTranscript = !1, newSessionClose = !1, newSessionsocketConnected = !1) } function sanitizeHTML(e) { var t, n = "(?:[^\"'>]|\"[^\"]*\"|'[^']*')*", o = RegExp("<(?:!--(?:(?:-*[^->])*--+|-?)|script\\b" + n + ">[\\s\\S]*?</script\\s*|style\\b" + n + ">[\\s\\S]*?</style\\s*|/?[a-z]" + n + ")>", "gi"); do t = e, e = e.replace(o, ""); while (e !== t); return e.replace(/</g, "&lt;") } function setOmnitureCookie(e, t) { "https:" == window.location.protocol ? document.cookie = e + "=" + t + ";domain=.bell.ca;path=/;secure=true;samesite=Lax" : document.cookie = e + "=" + t + ";domain=.bell.ca;path=/" } function deleteOmnitureCookies(e) { for (var t = 0; t < omnitureCookieNames.length; t++)e ? deleteCookieContentById("__eccomp", omnitureCookieNames[t]) : document.cookie = omnitureCookieNames[t] + "=;expires=" + new Date().toUTCString() + ";domain=.bell.ca;path=/" } function setEntryPointCookie(e, t) { var n = t ? readCookieContentById("__eccomp", "__cepomni") : getOmnitureCookie("__cepomni"); return n || (t ? updateCookieContentById("__eccomp", "__cepomni", e) : setOmnitureCookie("__cepomni", e), e) } function setPageCategory(e, t) { var n = t ? readCookieContentById("__eccomp", "__cpcpomni") : getOmnitureCookie("__cpcpomni"); return n || (t ? updateCookieContentById("__eccomp", "__cpcpomni", e) : setOmnitureCookie("__cpcpomni", e), e) } $(document).on("DOMSubtreeModified", "#messages", function () { $("#messages").find("a").each(function () { var e = $(this).attr("href"); e = sanitizeHTML(e); var t = $(this).text(); t = sanitizeHTML(t = t.replace(/\s/g, "")), e && "" !== e && "#" !== e && "javascript:void(0)" !== e && -1 === e.toLowerCase().indexOf("://m.bell.ca") && (e.indexOf("?") > -1 ? -1 == e.indexOf("?INT=") && -1 == e.indexOf("&INT=") && $(this).attr("href", e + "&INT=CEVA_CEVA_TXT_Echat_MASS_060121_aj_" + t) : -1 == e.indexOf("?INT=") && $(this).attr("href", e + "?INT=CEVA_CEVA_TXT_Echat_MASS_060121_aj_" + t)) }) }), $("#eChat_Bell_ContactUs_MOB, #eChat_Bell_ContactUs_INT, #eChat_Bell_ContactUs_TV , #eChat_Bell_ContactUs_HP,#eChat_Bell_MOB_Escalations, #eChat_Bell_BRS_Escalations, #eChat_Bell_EPP").on("click", function (e) { var t = void 0 !== getOmnitureCookie("__eccomp"), n = t ? readCookieContentById("__eccompslex", "__cwof") : getOmnitureCookie("__cwof"), o = this.id; "true" !== n && (entryPointID = setEntryPointCookie(o, t)) }), $(document).ready(function () { $("#eChat_BELL_INIT_GA, #eChat_B_GA").on("click", function (e) { var t = void 0 !== getOmnitureCookie("__eccomp"); "true" !== (t ? readCookieContentById("__eccompslex", "__cwof") : getOmnitureCookie("__cwof")) && (entryPointID = setEntryPointCookie("eChat_B_GA", t)), "true" === (t ? readCookieContentById("__eccompslex", "__cwi") : getOmnitureCookie("__cwi")) && !0 == counter && (t ? updateCookieContentById("__eccomp", "__cabomni", "965-0-0") : setOmnitureCookie("__cabomni", "965-0-0"), chatAvailableck = !0) }) }), readCookieContentById = (e, t) => { if (!e || !t) return ""; var n = getOmnitureCookie(e); if (!(n && n.indexOf("<<@" + t + "@||") > -1)) return ""; var o, i = n.split("<<@" + t + "@||"); return i[1].substring(0, i[1].indexOf("||>")) }, updateCookieContentById = (e, t, n) => { if (e && t) { var o = getOmnitureCookie(e); if (o && o.indexOf("<<@" + t + "@||") > -1) { var i = o.split("<<@" + t + "@||"), c = i[1].substring(0, i[1].indexOf("||>")), s = o.split("<<@" + t + "@||" + c + "||>>"), a = (s[0] ? s[0] : "") + "<<@" + t + "@||" + n + "||>>" + (s[1] ? s[1] : ""); setOmnitureCookie(e, a) } else { var a = (o || "") + "<<@" + t + "@||" + n + "||>>"; setOmnitureCookie(e, a) } } }, deleteCookieContentById = (e, t) => { if (e && t) { var n = getOmnitureCookie(e); if (n && n.indexOf("<<@" + t + "@||") > -1) { var o, i = n.split("<<@" + t + "@||"), c = i[1].substring(0, i[1].indexOf("||>")), s = n.split("<<@" + t + "@||" + c + "||>>"); setOmnitureCookie(e, (s[0] ? s[0] : "") + (s[1] ? s[1] : "")) } } };