if (window.Evergage && window.SalesforceInteractions && window.SalesforceInteractions.mcis) { try { window.SalesforceInteractions.log.warn("Aborting SDK load since the SalesforceInteractions SDK was already found on this page."); } catch(e) {} } else { window.evergageBeaconParseTimeStart = (new Date().getTime()); 'use strict';var Evergage=function(n){function tc(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}));a.push.apply(a,b)}return a}function t(c){for(var d=1;darguments.length?c:a):b.value};return ja.apply(this,arguments)}function ya(c,d){var a=Array.isArray(c)?c:void 0;if(!a)a:{var b=null==c?null: "undefined"!=typeof Symbol&&c[Symbol.iterator]||c["@@iterator"];if(null!=b){var e,f,g,h=[],l=!0,E=!1;try{if(f=(b=b.call(c)).next,0===d){if(Object(b)!==b){a=void 0;break a}l=!1}else for(;!(l=(e=f.call(b)).done)&&(h.push(e.value),h.length!==d);l=!0);}catch(qa){E=!0;var k=qa}finally{try{if(!l&&null!=b.return&&(g=b.return(),Object(g)!==g)){a=void 0;break a}}finally{if(E)throw k;}}a=h}else a=void 0}if(!(c=a||wc(c,d)))throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); return c}function nb(c){var d=Array.isArray(c)?ob(c):void 0;d||(d="undefined"!==typeof Symbol&&null!=c[Symbol.iterator]||null!=c["@@iterator"]?Array.from(c):void 0);if(!(c=d||wc(c)))throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");return c}function wc(c,d){if(c){if("string"===typeof c)return ob(c,d);var a=Object.prototype.toString.call(c).slice(8,-1);"Object"===a&&c.constructor&&(a=c.constructor.name); if("Map"===a||"Set"===a)return Array.from(c);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return ob(c,d)}}function ob(c,d){if(null==d||d>c.length)d=c.length;for(var a=0,b=Array(d);ac.indexOf(a)})}function ze(c,d,a,b,e){e.guid=e.guid||p.guid++;var f=c.___ce=c.___ce||{};f[d]=f[d]||[];f[d].push([a,b,e]);c.addEventListener(d, e)}function xb(c){c=c.split(".");return[c[0],c.slice(1).sort()]}function Ra(c,d,a,b,e){var f=c.___ce=c.___ce||{};if(d)f[d]&&(f[d]=f[d].filter(function(f){var g=ya(f,3);f=g[0];var l=g[1];g=g[2];if(e&&g.guid!==e.guid||!Dc(f,a)||b&&b!==l)return!0;c.removeEventListener(d,g)}));else for(d in f)Ra(c,d,a,b,e)}function Ec(c){return c.multiple&&c.options?V(tb.call(c.options,function(c){return c.selected&&!c.disabled&&!c.parentNode.disabled}),"value"):c.value||""}function Fc(c){if(!G(c))return[];if(Ae.test(c))return[ma(RegExp.$1)]; var d=Be.test(c)&&RegExp.$1;d=Gc[d]||Gc["*"];d.innerHTML=c;return p(d.childNodes).detach().get()}function Ce(c,d){c=p(c);c.filter("script").add(c.find("script")).each(function(a,b){if(De.test(b.type)&&yb.contains(b)){var c=ma("script");c.text=b.textContent.replace(Ee,"");C(Fe,function(a,d){b[d]&&(c[d]=b[d])});d.head.insertBefore(c,null);d.head.removeChild(c)}})}function ba(c,d,a,b,e,f,g,h){C(c,function(c,f){C(p(f),function(c,f){C(p(d),function(c,d){var g=a?d:f;d=a?f:d;c=c?g.cloneNode(!0):g;e?d.insertBefore(c, b?d.firstElementChild:null):d.parentNode.insertBefore(c,b?d:d.nextElementSibling);Ce(c,d.ownerDocument)},h)},g)},f);return d}function Hc(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}));a.push.apply(a,b)}return a}function z(c){for(var d=1;darguments.length?c:a):b.value};return Ta.apply(this,arguments)}function Kc(c){var d=Array.isArray(c)?Ab(c):void 0;d||(d="undefined"!==typeof Symbol&&null!=c[Symbol.iterator]||null!=c["@@iterator"]?Array.from(c):void 0);if(!(c=d||Lc(c)))throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");return c}function Lc(c, d){if(c){if("string"===typeof c)return Ab(c,d);var a=Object.prototype.toString.call(c).slice(8,-1);"Object"===a&&c.constructor&&(a=c.constructor.name);if("Map"===a||"Set"===a)return Array.from(c);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Ab(c,d)}}function Ab(c,d){if(null==d||d>c.length)d=c.length;for(var a=0,b=Array(d);a=c.length?{done:!0}:{done:!1,value:c[b++]}},e:function(a){throw a;},f:d}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var e=!0,f=!1,g;return{s:function(){a=a.call(c)},n:function(){var b=a.next();e=b.done;return b},e:function(a){f=!0;g=a},f:function(){try{e||null==a.return||a.return()}finally{if(f)throw g; }}}}function Mc(c){r.setLoggingLevel(c)}function Nc(){return r.getLoggingLevel()}function Cb(c){var d,a,b,e=[],f=[a=1732584193,b=4023233417,~a,~b,3285377520],g=[],h=unescape(encodeURI(c))+"\u0080",l=h.length;for(g[c=--l/4+2|15]=8*l;~l;)g[l>>2]|=h.charCodeAt(l)<<8*~l--;for(d=l=0;dl;a=[a[4]+(e[l]=16>l?~~g[d+l]:2*h|0>h)+1518500249+[b&E|~b&k,h=341275144+(b^E^k),882459459+(b&E|b&k|E&k),h+1535694389][l++/5>>2]+((h=a[0])<<5|h>>>27),h,b<<30|b>>>2,E,k]){h=e[l-3]^e[l-8]^e[l-14]^e[l-16]; b=a[1];var E=a[2];var k=a[3]}for(l=5;l;)f[--l]+=a[l]}for(h="";40>l;)h+=(f[l>>3]>>4*(7-l++)&15).toString(16);return h}function Oc(){var c=(window.navigator.userAgent||"")+(window.navigator.platform||"")+(new Date).getTime+JSON.stringify({})+Math.random();return Da(c).slice(0,16)}function Pc(c,d,a){return"function"===typeof a?{bind:c,selector:d,callback:a}:null}function Le(){Db=v.onFireException.on(function(c,d){document.dispatchEvent(new CustomEvent(w.OnException,{detail:{error:c,context:d}}))});Eb= v.onEventSend.on(function(c){document.dispatchEvent(new CustomEvent(w.OnBeforeEventSend,{detail:{actionEvent:c},cancelable:!0}))&&document.dispatchEvent(new CustomEvent(w.OnEventSend,{detail:{actionEvent:c}}))});Fb=v.onPageMatchStatusUpdated.on(function(c){document.dispatchEvent(new CustomEvent(w.OnPageMatchStatusUpdated,{detail:{matchStatus:c}}))});Gb=v.onInitSitemap.on(function(c){document.dispatchEvent(new CustomEvent(w.OnInitSitemap,{detail:{sitemapConfig:c}}))})}function W(c){Db&&Db();Eb&&Eb(); Fb&&Fb();Gb&&Gb();document.dispatchEvent(new CustomEvent(w.OnShutDown,{detail:{message:c}}));Hb="shutDown";return!1}function Ua(c,d,a,b){return c.addEventListener?(c.addEventListener(d,a,b),!0):!1}function ca(c,d,a,b){return c.removeEventListener?(c.removeEventListener(d,a,b),!0):!1}function Ib(c){var d=document.createElement("a");d.href=c;return d}function Qc(c){try{return decodeURIComponent(c.replace(/\+/g," "))}catch(d){return null}}function Rc(c){if(c=c.detail&&c.detail.actionEvent)if(c.itemAction&& c.itemAction.includes("View"))Va();else{var d;if(d=c.interaction)c=c.interaction.name,d=c===oa.ViewCatalogObject||c===oa.ViewCatalogObjectDetail||c===oa.QuickViewCatalogObject||c===Ea.StopQuickViewCatalogObject;d&&Va()}}function Jb(c){-1!==X&&(Kb(!1,c),clearTimeout(X),X=-1)}function Va(){if(!q.beaconConfig.doNotTrackPingRequestsForActions){Jb(!0);document.removeEventListener(n.CustomEvents.OnEventSend,Rc);document.addEventListener(n.CustomEvents.OnEventSend,Rc);var c=Date.now();if(-1===H||c-H>=q.beaconConfig.minimumActivityTimeToRegister)H= c;X=setTimeout(function(){Kb(!0)},q.beaconConfig.timeOnPageTimerLengthMillis);r.info("Setting up time on page listeners.");ca(window,"unload",Lb);Ua(window,"unload",Lb);ca(window,"blur",Mb);Ua(window,"blur",Mb);ca(window,"focus",Nb);Ua(window,"focus",Nb);ca(document,"mousemove keydown scroll click",Fa);Ua(document,"mousemove keydown scroll click",Fa)}}function Kb(c,d){var a=Date.now();-1!==H&&(a-=H,q.beaconConfig.timeOnPageTimerLengthMillisD&&(D=0);c&&(-1!==X&&clearTimeout(X),X=setTimeout(function(){Kb(!0)},q.beaconConfig.timeOnPageTimerLengthMillis))}function Me(c){c={timeOnPageMillis:c};var d=Tc(),a={};if(d&&d.itemAction&&d.catalog)a=d.catalog;else if(d&&d.interaction&& d.interaction.catalogObject){a=d.interaction.catalogObject;var b={},e=a.id,f=a.type,g=xa(a,Oe);e&&f&&(b[a.type]={_id:e});a.relatedCatalogObjects&&(f=g.relatedCatalogObjects,e=f.Category,f=xa(f,Pe),Array.isArray(e)&&(b[a.type].categories=Uc(e)),0!==Object.keys(f).length&&(b[a.type].relatedCatalogObjects=f));a=b}0!==Object.keys(a).length&&(c.catalog=a);d&&d.interaction&&null!=d.interaction.name?c.action=d.interaction.name:d&&null!=d.action&&(c.action=d.action);Vc();c.performance={};d=xa(y,Qe);for(var h in d)y[h]&& (c.performance[h]=y[h]);return c}function Lb(c){Jb()}function Mb(c){try{r.trace("Evergage: window blurred"),Wa()}catch(d){x(d,"windowBlurFunction")}}function Nb(c){try{r.trace("Evergage: window focused"),Fa()}catch(d){x(d,"windowFocusFunction")}}function Wa(){try{-1!==Y&&(clearTimeout(Y),Y=-1);var c=Date.now(),d=0;-1!==H&&(d=c-H);r.trace("Evergage: timeOnPage before: setUserInactive: ".concat(D));D+=d;r.trace("Evergage: timeOnPage after: setUserInactive: ".concat(D));H=-1}catch(a){x(a,"setUserInactive")}} function Fa(){r.trace("activity registered");try{-1!==Y&&(clearTimeout(Y),Y=-1);var c=Date.now();if(-1===H||c-H>=q.beaconConfig.minimumActivityTimeToRegister)-1!==H&&(r.trace("Evergage: timeOnPage before: activityRegistered: ".concat(D)),D+=c-Math.max(H,-1),r.trace("Evergage: timeOnPage after: activityRegistered: ".concat(D))),H=c}catch(d){x(d,"activityRegistered")}}function Ob(c,d){c="string"===typeof c?Error(c):c;for(var a in d)Object.defineProperty(c,a,{value:d[a],enumerable:!1});return c}var M= function(c,d){return d={exports:{}},c(d,d.exports),d.exports}(function(c,d){c.exports=function(){function a(){for(var a=0,b={};a/,se=/^\w+$/,Pa=function(){function c(d){var a=1d?0:1;aarguments.length?this[0]&&this[0][c]:this.each(function(a,e){e[c]=d});for(var a in c)this.prop(a,c[a]);return this}};m.get=function(c){return void 0===c?Yc.call(this):this[0>c?c+this.length:c]};m.eq=function(c){return p(this.get(c))};m.first=function(){return this.eq(0)};m.last=function(){return this.eq(-1)};m.filter=function(c){var d=sb(c);return p(tb.call(this,function(a,b){return d.call(a,b,a)}))};var ue=/\S+/g;m.hasClass=function(c){return!!c&&wb.call(this,function(d){return d.classList.contains(c)})}; m.removeAttr=function(c){var d=Qa(c);return this.each(function(a,b){C(d,function(a,c){b.removeAttribute(c)})})};m.attr=function(c,d){if(c){if(G(c)){if(2>arguments.length){if(!this[0])return;var a=this[0].getAttribute(c);return null===a?void 0:a}return void 0===d?this:null===d?this.removeAttr(c):this.each(function(a,e){e.setAttribute(c,d)})}for(a in c)this.attr(a,c[a]);return this}};m.toggleClass=function(c,d){var a=Qa(c),b=void 0!==d;return this.each(function(c,f){C(a,function(a,c){b?d?f.classList.add(c): f.classList.remove(c):f.classList.toggle(c)})})};m.addClass=function(c){return this.toggleClass(c,!0)};m.removeClass=function(c){return arguments.length?this.toggleClass(c,!1):this.attr("class","")};p.unique=T;m.add=function(c,d){return p(T(this.get().concat(p(c,d).get())))};var ub=/^--/,vb={},xe=Wc.style,we=["webkit","moz","ms"];p.prefixedProp=zc;var ye={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0}; m.css=function(c,d){if(G(c)){var a=ub.test(c);c=zc(c,a);if(2>arguments.length)return this[0]&&la(this[0],c,a);if(!c)return this;d=Ac(c,d,a);return this.each(function(b,f){f&&1===f.nodeType&&(a?f.style.setProperty(c,d):f.style[c]=d)})}for(var b in c)this.css(b,c[b]);return this};m.data=function(c,d){if(!c){if(!this[0])return;var a={},b;for(b in this[0].dataset)a[b]=Bc(this[0],b);return a}if(G(c))return 2>arguments.length?this[0]&&Bc(this[0],c):this.each(function(a,b){a=d;try{a=JSON.stringify(a)}catch(g){}b.dataset[za(c)]= a});for(a in c)this.data(a,c[a]);return this};C([!0,!1],function(c,d){C(["Width","Height"],function(a,b){var c="".concat(d?"outer":"inner").concat(b);m[c]=function(e){if(this[0])return rb(this[0])?Aa[c]:this[0]["".concat(d?"offset":"client").concat(b)]+(e&&d?sa(this[0],"margin".concat(a?"Top":"Left"))+sa(this[0],"margin".concat(a?"Bottom":"Right")):0)}})});C(["width","height"],function(c,d){m[d]=function(a){if(!this[0])return void 0===a?void 0:this;if(!arguments.length)return rb(this[0])?this[0][za("outer-".concat(d))]: this[0].getBoundingClientRect()[d]-Cc(this[0],!c);var b=parseInt(a,10);return this.each(function(a,f){f&&1===f.nodeType&&(a=la(f,"boxSizing"),f.style[d]=Ac(d,b+("border-box"===a?Cc(f,!c):0)))})}});var Rb={};m.toggle=function(c){return this.each(function(d,a){if(void 0===c?"none"===la(a,"display"):c){if(a.style.display=a.___cd||"","none"===la(a,"display")){d=a.style;a=a.tagName;if(Rb[a])a=Rb[a];else{var b=ma(a);S.body.insertBefore(b,null);var e=la(b,"display");S.body.removeChild(b);a=Rb[a]="none"!== e?e:"block"}d.display=a}}else a.___cd=la(a,"display"),a.style.display="none"})};m.hide=function(){return this.toggle(!1)};m.show=function(){return this.toggle(!0)};var Sb={focus:"focusin",blur:"focusout"},Zc={mouseenter:"mouseover",mouseleave:"mouseout"},Xe=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;m.off=function(c,d,a){var b=this;if(void 0===c)this.each(function(a,b){Ra(b)});else if(G(c))ka(d)&&(a=d,d=""),C(Qa(c),function(c,e){c=xb(Zc[e]||Sb[e]||e);c=ya(c,2);var f=c[0],g=c[1];b.each(function(b, c){Ra(c,f,g,d,a)})});else for(var e in c)this.off(e,c[e]);return this};m.on=function(c,d,a,b){var e=this;if(!G(c)){for(var f in c)this.on(f,d,c[f]);return this}ka(d)&&(a=d,d="");C(Qa(c),function(c,f){c=xb(Zc[f]||Sb[f]||f);c=ya(c,2);var g=c[0],h=c[1];e.each(function(c,e){c=function He(c){if(!c.namespace||Dc(h,c.namespace.split("."))){var f=e;if(d){for(var l=c.target;!qb(l,d);){if(l===e)return;l=l.parentNode;if(!l)return}f=l;c.___cd=!0}c.___cd&&Object.defineProperty(c,"currentTarget",{configurable:!0, get:function(){return f}});l=a.call(f,c,c.data);b&&Ra(e,g,h,d,He);!1===l&&(c.preventDefault(),c.stopPropagation())}};c.guid=a.guid=a.guid||p.guid++;ze(e,g,h,d,c)})});return this};m.one=function(c,d,a){return this.on(c,d,a,!0)};m.ready=function(c){"loading"!==S.readyState?c(p):S.addEventListener("DOMContentLoaded",function(){c(p)});return this};m.trigger=function(c,d){if(G(c)){var a=xb(c),b=ya(a,2);a=b[0];b=b[1];var e=Xe.test(a)?"MouseEvents":"HTMLEvents";c=S.createEvent(e);c.initEvent(a,!0,!0);c.namespace= b.join(".")}c.data=d;var f=c.type in Sb;return this.each(function(a,b){if(f&&ka(b[c.type]))b[c.type]();else b.dispatchEvent(c)})};var Ye=/%20/g,Ze=/file|reset|submit|button|image/i,$e=/radio|checkbox/i;m.serialize=function(){var c="";this.each(function(d,a){C(a.elements||[a],function(a,d){d.disabled||!d.name||"FIELDSET"===d.tagName||Ze.test(d.type)||$e.test(d.type)&&!d.checked||(a=Ec(d),void 0!==a&&(a=Qb(a)?a:[a],C(a,function(a,b){a=c;b="&".concat(encodeURIComponent(d.name),"=").concat(encodeURIComponent(b).replace(Ye, "+"));c=a+b})))})});return c.slice(1)};m.val=function(c){return void 0===c?this[0]&&Ec(this[0]):this.each(function(d,a){if("SELECT"===a.tagName){var b=Qb(c)?c:null===c?[]:[c];C(a.options,function(a,c){c.selected=0<=b.indexOf(c.value)})}else a.value=null===c?"":c})};m.clone=function(){return this.map(function(c,d){return d.cloneNode(!0)})};m.detach=function(){return this.each(function(c,d){d.parentNode&&d.parentNode.removeChild(d)})};var Be=/^\s*<(\w+)[^>]*>/,Ae=/^\s*<(\w+)\s*\/?>(?:<\/\1>)?\s*$/, Gc={"*":Wc,tr:Se,td:Xc,th:Xc,thead:Pb,tbody:Pb,tfoot:Pb};p.parseHTML=Fc;m.empty=function(){return this.each(function(c,d){for(;d.firstChild;)d.removeChild(d.firstChild)})};m.html=function(c){return void 0===c?this[0]&&this[0].innerHTML:this.each(function(d,a){a.innerHTML=c})};m.remove=function(){return this.detach().off()};m.text=function(c){return void 0===c?this[0]?this[0].textContent:"":this.each(function(d,a){a.textContent=c})};m.unwrap=function(){this.parent().each(function(c,d){c=p(d);c.replaceWith(c.children())}); return this};m.offset=function(){var c=this[0];if(c)return c=c.getBoundingClientRect(),{top:c.top+Aa.pageYOffset-yb.clientTop,left:c.left+Aa.pageXOffset-yb.clientLeft}};m.offsetParent=function(){return p(this[0]&&this[0].offsetParent)};m.position=function(){var c=this[0];if(c)return{left:c.offsetLeft,top:c.offsetTop}};m.children=function(c){return ra(p(T(V(this,function(c){return c.children}))),c)};m.contents=function(){return p(T(V(this,function(c){return"IFRAME"===c.tagName?[c.contentDocument]: c.childNodes})))};m.find=function(c){return p(T(V(this,function(d){return pb(c,d)})))};var Ee=/^\s*\s*$/g,De=/^$|^module$|\/(java|ecma)script/i,Fe=["type","src","nonce","noModule"];m.after=function(){return ba(arguments,this,!1,!1,!1,!0,!0)};m.append=function(){return ba(arguments,this,!1,!1,!0)};m.appendTo=function(c){return ba(arguments,this,!0,!1,!0)};m.before=function(){return ba(arguments,this,!1,!0)};m.insertAfter=function(c){return ba(arguments,this,!0,!1,!1, !1,!1,!0)};m.insertBefore=function(c){return ba(arguments,this,!0,!0)};m.prepend=function(){return ba(arguments,this,!1,!0,!0,!0,!0)};m.prependTo=function(c){return ba(arguments,this,!0,!0,!0,!1,!1,!0)};m.replaceWith=function(c){return this.before(c).remove()};m.replaceAll=function(c){p(c).replaceWith(this);return this};m.wrapAll=function(c){c=p(c);for(var d=c[0];d.children.length;)d=d.firstElementChild;this.first().before(c);return this.appendTo(d)};m.wrap=function(c){return this.each(function(d, a){var b=p(c)[0];p(a).wrapAll(d?b.cloneNode(!0):b)})};m.wrapInner=function(c){return this.each(function(d,a){d=p(a);a=d.contents();a.length?a.wrapAll(c):d.append(c)})};m.has=function(c){var d=G(c)?function(a,b){return pb(c,b).length}:function(a,b){return b.contains(c)};return this.filter(d)};m.is=function(c){var d=sb(c);return wb.call(this,function(a,b){return d.call(a,b,a)})};m.next=function(c,d){return ra(p(T(V(this,"nextElementSibling",d))),c)};m.nextAll=function(c){return this.next(c,!0)};m.not= function(c){var d=sb(c);return this.filter(function(a,b){return!d.call(b,a,b)})};m.parent=function(c){return ra(p(T(V(this,"parentNode"))),c)};m.index=function(c){var d=c?p(c)[0]:this[0];c=c?this:p(d).parent().children();return yc.call(c,d)};m.closest=function(c){var d=this.filter(c);if(d.length)return d;var a=this.parent();return a.length?a.closest(c):d};m.parents=function(c){return ra(p(T(V(this,"parentElement",!0))),c)};m.prev=function(c,d){return ra(p(T(V(this,"previousElementSibling",d))),c)}; m.prevAll=function(c){return this.prev(c,!0)};m.siblings=function(c){return ra(p(T(V(this,function(c){return p(c).parent().children().not(c)}))),c)};var Tb=["error","warn","info","debug","trace"],r=new (function(){function c(){var d=0=new Date(a.lastSentTime)}).map(function(a){return a.consent});hf(d.consents)};document.addEventListener(w.OnConsentRevoke,function(d){d.detail&&d.detail.revokedConsent&&of({interaction:{name:ua.MetadataUpdate},consents:[d.detail.revokedConsent.consent]})}); var qd=function(d){return pd(d,mf).catch(function(a){r.error(a.message);v.onFireException.emit(a,"Site-wide JavaScript");return d})},of=function(d){pd(d,function(){return!0}).then(function(){return r.debug("Consent revoked")},function(a){return v.onFireException.emit(a,"Site-wide JavaScript")})},pd=function(d,a){a:{var b=d,e=u.matchedConfig;try{b=e&&e.onActionEvent?e.onActionEvent(b):b;if("object"===J(b)){d=b;break a}v.onFireException.emit(Error("onActionEvent failed for the ".concat(u.matchedConfig.name, " page config. Must return an object or null.")),"Site-wide Javascript")}catch(f){v.onFireException.emit(Error("onActionEvent failed for the ".concat(u.matchedConfig.name," page config. ").concat(f.message,".")),"Site-wide Javascript")}d=void 0}a:{b=d;try{b=N.global&&N.global.onActionEvent?N.global.onActionEvent(b):b;if("object"===J(b)){d=b;break a}v.onFireException.emit(Error("onActionEvent failed for the global page config. Must return an object or null."),"Site-wide Javascript")}catch(f){v.onFireException.emit(Error("onActionEvent failed for the global page config. ".concat(f.message, ".")),"Site-wide Javascript")}d=void 0}od(d);a&&!a()&&r.debug("No opt-in consents provided. Event will still be dispatched.");r.debug("Sent event: ",d);v.onEventSend.emit(d);return Promise.resolve(d)},pf=function(d){return new Promise(function(a,b){v.onInitSitemap.once(function(){return b("sitemap_reinit")});var e={name:null},f=[];Object.keys(d.interaction).forEach(function(a){var b=rd(d.interaction[a],a).then(function(b){e[a]=b});f.push(b)});Promise.all(f).then(function(){a(e)}).catch(function(a){v.onFireException.emit(Error("Catalog object interaction config was rejected"), "Site-wide Javascript")})})},rd=function(d,a){try{return F=a,"object"===J(d)&&!Array.isArray(d)&&0=e&&(Ia(b),g(!1))}catch(qa){Ia(b),h(qa)}},f);fa[b]=function(){clearInterval(k)}})},unbind:Ia,getBindings:function(){return fa},clearBindings:function(){for(var a in fa)fa.hasOwnProperty(a)&&"function"===typeof fa[a]&&Ia(a)}}};var Hb="shutDown";var va={cookieDomain:null, consents:null},zd=function(){function a(a,b,f){if(f)for(a=Math.random().toString(36).slice(2);e[a];)a=Math.random().toString(36).slice(2);else a=a||b;return a}function b(b,f){return{pageElementLoaded:function(h,l){if("string"!==typeof l||""===l)l=0"+h,f);e[b]=function(){E&&E.disconnect()}})},pageElementVisible:function(h, l){var k=l||0;if("string"!==typeof h||""===h||"number"!==typeof k||0>k||1"+h,f);e[b]=function(){n.disconnect()}})},pageExit:function(h){h=h||0;if("number"!==typeof h||0>h)throw Error("[pageExit] Invalid arguments"); return new Promise(function(l){function k(a){clearTimeout(p);10>=a.pageY-window.pageYOffset&&(p=0",f);e[b]=function(){n.off("mousemove",k)}})},pageInactive:function(h){function l(a,e){var f=new Promise(function(f){function h(a){a=a||new Event("pageInactive");b&&!e.isSubscribe?g.unbind(b):k.off("mousemove click scroll keyup keydown", l);f(a)}function l(b){clearTimeout(m);m=setTimeout(h.bind(this,b),a)}var k=B(document),m;l();k.on("mousemove click scroll keyup keydown",l)});f.subscribe=function(h){delete f.subscribe;e.isSubscribe=!0;f.then(function(f){f.disconnect=function(){b?g.unbind(b):e.isDisconnected=!0};h(f);!e.isDisconnected&&l(a,e).subscribe(h)});return f};return f}if("number"!==typeof h||0>=h)throw Error("[pageInactive] Invalid arguments");var k={isDisconnected:!1,isSubscribe:!1};b=a(b,"",f);e[b]=function(){k.isDisconnected= !0};return l(h,k)},pageScroll:function(h){if("number"!==typeof h||0>h||1=h&&(l(a),b?g.unbind(b):m.off("scroll",k))}var m=B(document);m.on("scroll",k);b=a(b,"",f);e[b]=function(){m.off("scroll",k)}})}}}var e={},f=b(null,!0),g=function(){return{bind:function(a){a&&e[a]&&(e[a](),delete e[a]);return b(a)},unbind:function(a){if(!a|| "string"!==typeof a||"function"!==typeof e[a])return null;e[a]();delete e[a]},getBindings:function(){return e},clearBindings:function(){for(var a in e)e.hasOwnProperty(a)&&(e[a](),delete e[a])}}}();return Object.assign(f,g)}(),cb=function(){function a(b){var e=this;Ba(this,a);this.clearRateLimiter=function(){e.sentEvents=[]};this.eventWithinLimitTimeRange=function(a,b,e){return e-b.timeg)?(r.info("Event rate limit exceeded. More than ".concat(g," events ")+"sent in ".concat(f,"ms.")),!0):!1};this.checkLimits=function(a,b){return e.checkGlobalLimits(a, b.time)};this.sentEvents=[];this.eventRateLimiterConfig=b}Ca(a,[{key:"resetCounters",value:function(){this.globalCounter=0}},{key:"isTriggerLimitExceeded",value:function(a){var b=Date.now();a=z(z({},a),{},{time:b});this.sentEvents.push(a);this.removeOldEvents(b);this.resetCounters();for(b=this.sentEvents.length-1;0<=b;b--)if(this.checkLimits(b,a))return!0;return!1}}]);return a}(),zf=function(a){function b(a){Ba(this,b);var f=e.call(this,a);f.getTimeRangeMax=function(){return f.eventRateLimiterConfig.perInteractionTimeRange? Math.max(f.eventRateLimiterConfig.globalTimeRange,f.eventRateLimiterConfig.perInteractionTimeRange):f.eventRateLimiterConfig.globalTimeRange};f.checkInteractionLimits=function(a,b,e){return f.eventRateLimiterConfig.perInteractionLimit&&f.eventRateLimiterConfig.perInteractionTimeRange&&f.eventWithinLimitTimeRange(f.eventRateLimiterConfig.perInteractionTimeRange,f.sentEvents[a],b)&&f.sentEvents[a].name===e&&(f.perEventCounter++,f.perEventCounter>f.eventRateLimiterConfig.perInteractionLimit)?(r.info("Event rate limit exceeded. More than ".concat(f.eventRateLimiterConfig.perInteractionLimit, " events ")+"with interaction name of ".concat(e," sent in ").concat(f.eventRateLimiterConfig.perInteractionTimeRange,"ms.")),!0):!1};f.checkLimits=function(a,b){return f.checkGlobalLimits(a,b.time)||f.checkInteractionLimits(a,b.time,b.name)};return f}Ie(b,a);var e=Ke(b);Ca(b,[{key:"resetCounters",value:function(){Ta(na(b.prototype),"resetCounters",this).call(this);this.perEventCounter=0}},{key:"isTriggerLimitExceeded",value:function(a){return Ta(na(b.prototype),"isTriggerLimitExceeded",this).call(this, a)}}]);return b}(cb),Db,Eb,Fb,Gb,bc=function(){var a=0=a.length)return a;var b=731,e=244;974!=b+e&&(b+=974-(b+e));10f.eventRateLimiterConfig.perExperienceLimit)return r.info("Event rate limit exceeded. More than ".concat(f.eventRateLimiterConfig.perExperienceLimit," events ")+"with experience id of ".concat(e," sent in ").concat(f.eventRateLimiterConfig.perExperienceTimeRange,"ms.")),!0}};f.checkLimits=function(a,b){return f.checkGlobalLimits(a,b.time)||f.checkExperienceLimits(a,b.time)};return f}Na(b,a);var e=Oa(b);ia(b,[{key:"resetCounters", value:function(){ja(R(b.prototype),"resetCounters",this).call(this);this.experienceRates=new Map}},{key:"isTriggerLimitExceeded",value:function(a){return ja(R(b.prototype),"isTriggerLimitExceeded",this).call(this,a)}}]);return b}(cb),lc=function(){function a(b){ha(this,a);this.baseURL=b}ia(a,[{key:"send",value:function(a){Nf(a);var b=this.baseURL+"?";var f="";var g=[],h;"string"!==typeof f&&(f="?");for(l in a)if(Lf.call(a,l)){(h=a[l])||null!==h&&void 0!==h&&!isNaN(h)||(h="");var l=encodeURIComponent(l); h=encodeURIComponent(h);null!==l&&null!==h&&g.push(l+"="+h)}a=g.length?f+g.join("&"):"";b+=a;if(navigator&&navigator.sendBeacon)return a=new Blob([],{type:"application/x-www-form-urlencoded"}),navigator.sendBeacon(b,a);a=new XMLHttpRequest;a.open("GET",b,!0);a.send()}}]);return a}(),Of=function(a){function b(a,g){ha(this,b);a=e.call(this,a);a.eventRateLimiter=g||new cb({globalLimit:q.beaconConfig.errorRateLimiterConfig.globalLimit,globalTimeRange:q.beaconConfig.errorRateLimiterConfig.globalTimeRange}); return a}Na(b,a);var e=Oa(b);ia(b,[{key:"send",value:function(a){if(this.eventRateLimiter.isTriggerLimitExceeded())r.warn("Error event rate limiter triggered.");else return ja(R(b.prototype),"send",this).call(this,a)}}]);return b}(lc),Pf=function(a){function b(a,g){ha(this,b);a=e.call(this,a);a.eventRateLimiter=g||new cb({globalLimit:q.beaconConfig.pingRateLimiterConfig.globalLimit,globalTimeRange:q.beaconConfig.pingRateLimiterConfig.globalTimeRange});return a}Na(b,a);var e=Oa(b);ia(b,[{key:"send", value:function(a){if(this.eventRateLimiter.isTriggerLimitExceeded())r.warn("Ping event rate limiter triggered.");else return ja(R(b.prototype),"send",this).call(this,a)}}]);return b}(lc),Qf=function(a){function b(a,g){ha(this,b);a=e.call(this,a);a.eventRateLimiter=g||new Mf({globalLimit:q.beaconConfig.campaignStatRateLimiterConfig.globalLimit,globalTimeRange:q.beaconConfig.campaignStatRateLimiterConfig.globalTimeRange,perExperienceLimit:q.beaconConfig.campaignStatRateLimiterConfig.perExperienceLimit, perExperienceTimeRange:q.beaconConfig.campaignStatRateLimiterConfig.perExperienceTimeRange});return a}Na(b,a);var e=Oa(b);ia(b,[{key:"send",value:function(a,e){e=e?e:[];if(this.eventRateLimiter.isTriggerLimitExceeded({experienceIds:e}))r.warn("Campaign Stat event rate limiter triggered.");else return ja(R(b.prototype),"send",this).call(this,a)}}]);return b}(lc),Nf=function(a){Object.keys(a).forEach(function(b){var e=a[b];if("number"!=typeof e&&"boolean"!==typeof e&&null!=e)if("string"==typeof e){a:switch(b){case "url":case "urlref":e= e.substring(0,3072);break a;case "title":e=e.substring(0,1024);break a;default:e=e.substring(0,1024)}a[b]=e}else"function"==typeof e?delete a[b]:a[b]=JSON.stringify(e)})},eb,fb,gb,Jd=!1,Kd=!1,Ld=!1,y={sdkLoadTime:null,sdkParseTime:null,sdkDnsTime:null,pageLoadTime:null,domLoadTime:null,networkTime:null,eventDnsTime:null},Md=function(){return window.performance.getEntriesByType?window.performance.getEntriesByType("resource").reverse().find(function(a){return 0<=a.name.indexOf("/api2/event/")}):null}, Nd=function(){return window.performance.getEntriesByType?window.performance.getEntriesByType("resource").find(function(a){return/\/evergage(Small)?(\.min)?\.js$/.test(a.name)}):null},Od=function(){if(window.performance.getEntriesByType){var a=window.performance.getEntriesByType("navigation");if(a&&0this.status)try{var a=JSON.parse(l.response); e(a)}catch(Ge){g(Ob(Ge,{status:this.status,statusText:l.statusText}))}else g(Ob("Response was not OK: ".concat(l.responseText),{status:this.status,statusText:l.statusText}))};l.onerror=function(){if(""===l.responseType||"text"===l.responseType){var a=l.responseText||l.statusText;if(a){g(Ob("Response error: ".concat(a),{status:this.status,statusText:l.statusText}));return}}r.debug("An error was sent with no text. This is un-actionable so it is being logged instead of written.")}; if(a.debug&&a.debug.explanations||a.explain)l.withCredentials=!0;if("true"==mc("isReadableEvent"))b.sendPost(l,b.baseURL,f);else try{if(!/^[\x20-\x7E]+$/.test(f))throw Error("GET request payload contains non-ASCII characters, try sending POST request");var k=encodeURIComponent(window.btoa(f)),m=b.baseURL+"?event="+k;if(8192 { if (validateOnTemplateDisplayEndEvent(event)) { const payload = event.detail.payload; const campaignElement = getCampaignElementFromPayload(payload); sendImpression(payload, campaignElement); bindCampaignClickthroughsAndDismissals(campaignElement); } }); const sendImpression = (payload, campaignElement) => { const userGroup = payload.userGroup; const stat = { control: userGroup === CAMPAIGN_STAT_USER_GROUP.CONTROL, experienceId: payload.experience, stat: CAMPAIGN_STAT_TYPE.IMPRESSION }; const itemStats = generateItemStats(campaignElement); if (Object.keys(itemStats).length > 0) { stat.catalog = itemStats; } if (userGroup === CAMPAIGN_STAT_USER_GROUP.CONTROL || (userGroup === CAMPAIGN_STAT_USER_GROUP.TEST && campaignElement.length > 0)) { Evergage.sendStat({campaignStats: [stat]}); } else { Evergage.log.warn("campaignStatsTracking.js", "Experience", payload.experience, "not found in DOM."); } }; const generateItemStats = (campaignElement) => { const catalogStats = {}; const itemNodes = Evergage.cashDom(campaignElement).find("[" + CAMPAIGN_STAT_ATTRIBUTE.ITEM_TYPE + "]"); if (!itemNodes || itemNodes.length === 0) { return catalogStats; } Array.from(itemNodes).forEach(function(itemNode) { const itemId = Evergage.cashDom(itemNode).attr(CAMPAIGN_STAT_ATTRIBUTE.ITEM); const itemType = Evergage.cashDom(itemNode).attr(CAMPAIGN_STAT_ATTRIBUTE.ITEM_TYPE); if (itemId && itemType) { if (!catalogStats[itemType]) { catalogStats[itemType] = []; } if (!catalogStats[itemType].includes(itemId)) { catalogStats[itemType].push(itemId); } } }); return catalogStats; } const buildCampaignSelector = (experienceId) => { return `[${CAMPAIGN_STAT_ATTRIBUTE.EXPERIENCE}='${experienceId}']` } const getCampaignElementFromPayload = (payload) => { const experienceId = payload.experience; const campaignSelector = buildCampaignSelector(experienceId); return Evergage.cashDom(campaignSelector); }; const getCampaignClickthroughAndDismissalElements = (campaignElement) => { const experienceId = Evergage.cashDom(campaignElement).attr(`${CAMPAIGN_STAT_ATTRIBUTE.EXPERIENCE}`); const campaignSelector = buildCampaignSelector(experienceId); return Evergage.cashDom(campaignElement).parent().find(` ${campaignSelector}[${CAMPAIGN_STAT_ATTRIBUTE.CLICKTHROUGH}], ${campaignSelector} a, ${campaignSelector} [${CAMPAIGN_STAT_ATTRIBUTE.CLICKTHROUGH}], ${campaignSelector} [${CAMPAIGN_STAT_ATTRIBUTE.DISMISSAL}] `); }; const sendClickthroughOrDismissal = (e) => { if (Evergage.cashDom(e.target).closest(`[${CAMPAIGN_STAT_ATTRIBUTE.IGNORE_CLICKTHROUGH}]`).length > 0) { return; } const campaignElement = Evergage.cashDom(e.target).closest(`[${CAMPAIGN_STAT_ATTRIBUTE.EXPERIENCE}]`); if (campaignElement.length > 0 && Evergage.cashDom(e.target).closest(` a, [${CAMPAIGN_STAT_ATTRIBUTE.CLICKTHROUGH}], [${CAMPAIGN_STAT_ATTRIBUTE.DISMISSAL}]`).length > 0) { const stat = { control: campaignElement.attr(CAMPAIGN_STAT_ATTRIBUTE.USER_GROUP) === CAMPAIGN_STAT_USER_GROUP.CONTROL, experienceId: campaignElement.attr(CAMPAIGN_STAT_ATTRIBUTE.EXPERIENCE), stat: Evergage.cashDom(e.target).closest(`[${CAMPAIGN_STAT_ATTRIBUTE.CLICKTHROUGH}]`).length > 0 || Evergage.cashDom(e.target).closest("a").length > 0 ? CAMPAIGN_STAT_TYPE.CLICKTHROUGH : CAMPAIGN_STAT_TYPE.DISMISSAL }; if (stat.stat === CAMPAIGN_STAT_TYPE.CLICKTHROUGH) { const itemClickthroughStats = generateItemClickthroughStats(e.target); if (Object.keys(itemClickthroughStats).length > 0) { stat.catalog = itemClickthroughStats; } } Evergage.sendStat({campaignStats: [stat]}); } }; const generateItemClickthroughStats = (target) => { const itemStats = {}; const itemId = Evergage.cashDom(target).closest("[" + CAMPAIGN_STAT_ATTRIBUTE.ITEM + "]").attr(CAMPAIGN_STAT_ATTRIBUTE.ITEM); const itemType = Evergage.cashDom(target).closest("[" + CAMPAIGN_STAT_ATTRIBUTE.ITEM_TYPE + "]").attr(CAMPAIGN_STAT_ATTRIBUTE.ITEM_TYPE); if (itemId && itemType) { itemStats[itemType] = [itemId]; } return itemStats; } const bindCampaignClickthroughsAndDismissals = (campaignElement) => { const elements = getCampaignClickthroughAndDismissalElements(campaignElement); elements.off("click", sendClickthroughOrDismissal); elements.on("click", sendClickthroughOrDismissal); }; const validateOnTemplateDisplayEndEvent = (event) => { if (!event.detail) { Evergage.log.warn("campaignStatsTracking.js", "No detail object found for onTemplateDisplayEndEvent", event); return false; } if (!event.detail.payload) { Evergage.log.warn("campaignStatsTracking.js", "No payload object found for onTemplateDisplayEndEvent", event); return false; } if (!event.detail.payload.campaign) { Evergage.log.warn("campaignStatsTracking.js", "No campaign found in payload object", event.detail); return false; } if (!event.detail.payload.experience) { Evergage.log.warn("campaignStatsTracking.js", "No experience found in payload object", event.detail); return false; } if (!event.detail.payload.userGroup) { Evergage.log.warn("campaignStatsTracking.js", "No user group found in payload object", event.detail); return false; } return true; }; } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Campaign Stats Tracking:campaignStatsTracking.js"); } }; try { /** * Personalization Flicker Defense */ Evergage.FlickerDefender = Evergage.FlickerDefender || (() => { const personalizationSectionsSelector = "head > style.evergagePersonalizationSections"; let personalizedSectionsString = ""; let sectionsHaveEverBeenHidden = false; let hasBeenHidden = false; let shouldReshowNow = false; let hiddenSections = {}; const timeoutOptions = { pageMatchTimeout: 1000, redisplayTimeout: Evergage.getConfig().hideContentSectionsMillis || 2500 } const utils = { getGlobalContentZoneSelectors: () => { return ((Evergage.getState().config.global || {}).contentZones || []) .filter((contentZone) => (contentZone || {}).selector) .map((contentZone) => contentZone.selector); }, getPageTypeContentZoneSelectors: () => { const { pageTypes } = Evergage.getState().config; return pageTypes.length < 1 ? [] : pageTypes .map((pageType) => pageType.contentZones || []) .reduce((acc, contentZonesArr) => acc.concat(contentZonesArr), []) .filter((contentZone) => (contentZone || {}).selector) .map((contentZone) => contentZone.selector); }, buildContentZoneSelectors: () => { return [ ...new Set([ ...utils.getGlobalContentZoneSelectors(), ...utils.getPageTypeContentZoneSelectors() ]) ]; }, addToPersonalizedSectionsString: (selector) => { if (typeof selector === "string") { try { document.querySelector(selector); if (personalizedSectionsString !== "") { personalizedSectionsString += ", "; } personalizedSectionsString += selector; } catch (exception) { Evergage.sendException(exception, "hideSectionsInvalidCSSSelector"); } } }, hasBeenReshown: () => { return Evergage.cashDom(personalizationSectionsSelector).length === 0; } }; const actions = { hideSections: () => { if (sectionsHaveEverBeenHidden) return; const selectors = utils.buildContentZoneSelectors(); if (selectors.length === 0) { Evergage.log.debug("Evergage: Issue with malformed request in hideSections."); return; } for (const selector of selectors) { utils.addToPersonalizedSectionsString(selector); } if (!personalizedSectionsString) return; const head = document.head || document.getElementsByTagName("head")[0]; const style = document.createElement("style"); Evergage.cashDom(style) .attr({ type: "text/css", class: "evergagePersonalizationSections" }) .text(`${personalizedSectionsString} { visibility: hidden !important; }`); clearTimeout(window.evergageReshowPersonalizedSectionsTimeout); window.evergageReshowPersonalizedSectionsTimeout = setTimeout(function () { if (utils.hasBeenReshown()) return; shouldReshowNow = true; actions.reshowPersonalizedSectionsNow(); }, timeoutOptions.redisplayTimeout); head.appendChild(style); sectionsHaveEverBeenHidden = true; }, reshowPersonalizedSections: () => { if (utils.hasBeenReshown()) return; try { if (typeof window.requestAnimationFrame === "function") { Evergage.log.info("Evergage: Scheduling for next animation frame redisplay of sections of the page marked for personalization."); window.requestAnimationFrame(actions.reshowPersonalizedSectionsNow); } else { actions.reshowPersonalizedSectionsNow(); } } catch (exception) { Evergage.sendException(exception, "reshowPersonalizedSections"); } }, reshowReadyPersonalizedSections: () => { Evergage.cashDom(personalizationSectionsSelector).text(`${personalizedSectionsString} { visibility: hidden !important }`); Evergage.log.info(`Evergage: Redisplaying the following sections of the page marked for personalization: ${personalizedSectionsString}`); }, reshowAllPersonalizedSections: () => { Evergage.cashDom(personalizationSectionsSelector).remove(); Evergage.log.info("Evergage: Redisplaying outstanding sections of the page marked for personalization."); }, reshowPersonalizedSectionsNow: () => { if (utils.hasBeenReshown()) return; try { if (shouldReshowNow || Object.keys(hiddenSections).length === 0) { actions.reshowAllPersonalizedSections(); } else if (Object.keys(hiddenSections).length > 0) { personalizedSectionsString = ""; for (const contentZone in hiddenSections) { utils.addToPersonalizedSectionsString(hiddenSections[contentZone]); } actions.reshowReadyPersonalizedSections(); } } catch (exception) { Evergage.sendException(exception, "reshowPersonalizedSectionsNow"); } } }; const beaconListeners = { addOnInit: () => { document.addEventListener(Evergage.CustomEvents.OnInit, (domEvent) => { clearTimeout(window.evergagePageMatchTimeout); window.evergagePageMatchTimeout = setTimeout(function () { const { pageType } = (Evergage.getCurrentPage().source || {}); if (utils.hasBeenReshown() || (typeof pageType === "string" && pageType !== "")) return; shouldReshowNow = true; actions.reshowPersonalizedSectionsNow(); }, timeoutOptions.pageMatchTimeout); }); }, addPageMatchStatusUpdated: () => { document.addEventListener(Evergage.CustomEvents.OnPageMatchStatusUpdated, (domEvent) => { if (!hasBeenHidden) { actions.hideSections(); if (Evergage.cashDom(personalizationSectionsSelector).length > 0) { hasBeenHidden = true; } } }); }, addOnEventResponse: () => { document.addEventListener(Evergage.CustomEvents.OnEventResponse, (domEvent) => { const { campaignResponses } = ((domEvent.detail || {}).response || {}); if ((campaignResponses || []).length >= 1) { personalizedSectionsString = ""; for (const campaign of campaignResponses) { const { contentZone } = ((campaign || {}).payload || {}); const contentZoneSelector = Evergage.getContentZoneSelector(((campaign || {}).payload || {}).contentZone); if (typeof contentZoneSelector === "string") { hiddenSections[contentZone] = contentZoneSelector; utils.addToPersonalizedSectionsString(contentZoneSelector); } } if (!personalizedSectionsString) { actions.reshowPersonalizedSections(); return; } Evergage.cashDom(personalizationSectionsSelector).text(`${personalizedSectionsString} { visibility: hidden !important; }`); } else { actions.reshowPersonalizedSections(); } }); }, addOnTemplateDisplayEnd: () => { document.addEventListener(Evergage.CustomEvents.OnTemplateDisplayEnd, (domEvent) => { if (utils.hasBeenReshown()) return; const { contentZone } = ((domEvent.detail || {}).payload || {}); if (typeof contentZone === "string" && hiddenSections[contentZone]) { delete hiddenSections[contentZone]; } actions.reshowPersonalizedSections(); }); }, }; return { setPageMatchTimeout: (millis) => { if (typeof millis === "number" && millis >= 0) { timeoutOptions.pageMatchTimeout = parseInt(millis); } else { Evergage.log.warn("flickerDefender.js", "setPageMatchTimeout: Passed argument must be a number and must be greater than or equal to 0", millis); } }, setRedisplayTimeout: (millis) => { if (typeof millis === "number" && millis >= 0) { timeoutOptions.redisplayTimeout = parseInt(millis); } else { Evergage.log.warn("flickerDefender.js", "setRedisplayTimeout: Passed argument must be a number and must be greater than or equal to 0", millis); } }, init: function() { for (const key in beaconListeners) { beaconListeners[key](); } } }; })(); if (window.SalesforceInteractions && window.SalesforceInteractions.mcis) { window.SalesforceInteractions.mcis.FlickerDefender = Evergage.FlickerDefender; } if (typeof Evergage.FlickerDefender.init === "function" && (window.frameElement || {}).id !== "siteEditorFrame") { Evergage.FlickerDefender.init(); } } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Flicker Defender:flickerDefender.js"); } }; try { !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.restrictContentZone=t.executeControl=t.handleCampaignResponses=t.renderTemplate=t.resetTemplate=t.registerTemplate=t.executeBundles=void 0;var a=n(5),l=n(1),s=i(n(2)),c=new Map,u=new Map,p=new Set,d=function(){return document.getElementsByTagName("html").length>0&&null!=document.getElementsByTagName("html")[0].getAttribute(s.VE_LOADING_ATTRIBUTE)||null!=document.getElementById(s.VE_ACTIVE_ELEMENT_ID)||"true"===localStorage.getItem(s.VE_INDICATOR_FLAG)||document.location.href.includes(s.TEST_TEMPLATE_PARAMETER)},f=function(e){return c.get(e)},h=function(e,t){return[e,t.campaign,t.experience].join(":")};t.executeBundles=function(e){if(e){var n=!0;e.forEach((function(e){var r,o;try{try{var i=document.createElement("script");o="prepareTemplate"+e.id,i.text="function "+o+"(TemplateService) { "+e.bundle+" }",r=document.head.appendChild(i),window[o]({registerTemplate:t.registerTemplate})}catch(r){n=!1,Function("TemplateService",e.bundle)({registerTemplate:t.registerTemplate})}}catch(e){l.dispatchError(e)}finally{r&&r.parentNode.removeChild(r),o&&window[o]&&(window[o]=void 0)}})),n||console.log("Marketing Cloud Personalization will soon require your Content Security Policy to allow `unsafe-inline`.")}},t.registerTemplate=function(e){var t=new a.Template(e);c.set(e.name,t)},t.resetTemplate=function(e,t){var n=h(e,t),r=u.get(n);if(r)try{r()}catch(e){l.dispatchError(e)}u.delete(n)},t.renderTemplate=function(e,t){if(c.has(e)){var n=f(e).render(t);u.set(h(e,t),n)}},t.handleCampaignResponses=function(e){d()||e.filter((function(e){return"ng"===e.type})).filter((function(e){return!g(e)})).forEach((function(e){switch(e.userGroup){case"Default":m(e);break;case"Control":t.executeControl(e)}}))};var m=function(e){e.templateNames.forEach((function(n){t.renderTemplate(n,e.payload)}))};t.executeControl=function(e){e.templateNames.forEach((function(t){var n=f(t),r=e.payload;if(n.control)try{var o=n.control(r);l.handleTemplateDispatch(o,r)}catch(e){l.dispatchError(e)}}))};var g=function(e){return e.payload.contentZone&&p.has(e.payload.contentZone)};t.restrictContentZone=function(e){e&&p.add(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dispatchError=t.handleTemplateDispatch=t.getQueryParam=void 0,t.getQueryParam=function(e){var t=location.search;e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))};var r=function(e){document.dispatchEvent(new CustomEvent(window.Evergage.CustomEvents.OnTemplateDisplayEnd,{detail:{payload:e}})),document.dispatchEvent(new CustomEvent(window.SalesforceInteractions.mcis.CustomEvents.OnTemplateDisplayEnd,{detail:{payload:e}}))};t.handleTemplateDispatch=function(e,t){window.Promise&&"function"==typeof window.Promise.resolve?window.Promise.resolve(e).then((function(){r(t)})):r(t)},t.dispatchError=function(e){document.dispatchEvent(new CustomEvent(window.SalesforceInteractions.CustomEvents.OnException,{detail:{error:new Error(e),context:"Handlebars Template Gear"}}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VE_ACTIVE_ELEMENT_ID=t.VE_INDICATOR_FLAG=t.VE_LOADING_ATTRIBUTE=t.TEST_TEMPLATE_PARAMETER=t.TEST_TEMPLATE_STORAGE_KEY=void 0,t.TEST_TEMPLATE_STORAGE_KEY="testTemplate",t.TEST_TEMPLATE_PARAMETER="evergageTestTemplate",t.VE_LOADING_ATTRIBUTE="evergagevisualeditorloading",t.VE_INDICATOR_FLAG="evgVE",t.VE_ACTIVE_ELEMENT_ID="evg_ui-visual-editor"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.render=void 0;var r=n(4),o=n(6),i=n(0);function a(){/complete|interactive|loaded/.test(document.readyState)?(r.renderTestTemplate(),o.initPreview()):document.addEventListener("DOMContentLoaded",(function(){r.renderTestTemplate(),o.initPreview()}))}document.addEventListener(window.Evergage.CustomEvents.OnEventResponse,(function(e){i.executeBundles(e.detail.response.compiledCampaignTemplates),i.handleCampaignResponses(e.detail.response.campaignResponses)})),t.render=a,a()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderTestTemplate=void 0;var r=n(0),o=n(1),i=n(2);t.renderTestTemplate=function(){if("true"==o.getQueryParam(i.TEST_TEMPLATE_PARAMETER)){var e=a();addEventListener("storage",(function(t){t.key==i.TEST_TEMPLATE_STORAGE_KEY&&(e&&r.resetTemplate(e.templateName,e.templateConfig),e=a())}))}};var a=function(){var e=localStorage.getItem(i.TEST_TEMPLATE_STORAGE_KEY);if(e)try{var t=JSON.parse(e);return r.executeBundles(t.templates),r.renderTemplate(t.templateName,t.templateConfig),r.restrictContentZone(t.templateConfig.contentZone),t}catch(e){}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Template=void 0;var o=r(n(7)),i=n(1),a=function(){function e(e){var t=this;if(this.getContentZoneFromMatchedConfig=function(e){var t=window.Evergage.getState().result.matchedConfig;return e.contentZone&&t&&t.contentZones&&0!==t.contentZones.length&&t.contentZones.find((function(t){return t.name===e.contentZone}))||null},this.applyRender=function(e){var n=t.getContentZoneFromMatchedConfig(e);n&&t.executeInsertionForTarget(n,e)},this.replaceContentAtTarget=function(e,t){t.innerHTML=e},this.name=e.name,this.apply=e.apply,this.reset=e.reset,this.control=e.control,e.handlebars)try{this.generateHtml=o.default.template(e.handlebars),o.default.partials[e.name]=o.default.template(e.handlebars)}catch(e){i.dispatchError(e)}else this.generateHtml=function(){}}return e.prototype.render=function(e){try{var t=this.apply(e,this.generateHtml,this.applyRender);return i.handleTemplateDispatch(t,e),this.reset.bind(this,e,this.generateHtml)}catch(e){i.dispatchError(e)}},e.prototype.executeInsertionForTarget=function(e,t){if(this.generateHtml){var n=e.selector;try{var r=document.querySelector(n);if(!r){var o='Could not render template. Content zone "'+e.name+'" defined but the selector "'+n+'" not found on the page.';return void i.dispatchError(o)}var a=this.generateHtml(t);if(!a)return;this.replaceContentAtTarget(a,r)}catch(e){i.dispatchError(e)}}},e}();t.Template=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initPreview=void 0;var r=n(2),o=n(0);t.initPreview=function(){window.Evergage.Render={render:function(e,t,n){var i=JSON.stringify({templateName:e,templateConfig:t,templates:n});window.localStorage.setItem(r.TEST_TEMPLATE_STORAGE_KEY,i),o.resetTemplate(e,t),o.executeBundles(n),o.renderTemplate(e,t)},reset:o.resetTemplate}}},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"extend",(function(){return u})),n.d(r,"toString",(function(){return p})),n.d(r,"isFunction",(function(){return d})),n.d(r,"isArray",(function(){return f})),n.d(r,"indexOf",(function(){return h})),n.d(r,"escapeExpression",(function(){return m})),n.d(r,"isEmpty",(function(){return g})),n.d(r,"createFrame",(function(){return v})),n.d(r,"blockParams",(function(){return E})),n.d(r,"appendContextPath",(function(){return T}));var o={};n.r(o),n.d(o,"VERSION",(function(){return k})),n.d(o,"COMPILER_REVISION",(function(){return j})),n.d(o,"LAST_COMPATIBLE_COMPILER_REVISION",(function(){return I})),n.d(o,"REVISION_CHANGES",(function(){return L})),n.d(o,"HandlebarsEnvironment",(function(){return R})),n.d(o,"log",(function(){return H})),n.d(o,"createFrame",(function(){return v})),n.d(o,"logger",(function(){return M}));var i={};n.r(i),n.d(i,"checkRevision",(function(){return V})),n.d(i,"template",(function(){return B})),n.d(i,"wrapProgram",(function(){return G})),n.d(i,"resolvePartial",(function(){return Z})),n.d(i,"invokePartial",(function(){return F})),n.d(i,"noop",(function(){return q}));const a={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},l=/[&<>"'`=]/g,s=/[&<>"'`=]/;function c(e){return a[e]}function u(e){for(let t=1;t0?(n.ids&&(n.ids=[n.name]),e.helpers.each(t,n)):r(this);if(n.data&&n.ids){let e=v(n.data);e.contextPath=T(n.data.contextPath,n.name),n={data:e}}return o(t,n)}))}(e),function(e){e.registerHelper("each",(function(e,t){if(!t)throw new b("Must pass iterator to #each");let n,r,o=t.fn,i=t.inverse,a=0,l="";function s(t,i,a){n&&(n.key=t,n.index=i,n.first=0===i,n.last=!!a,r&&(n.contextPath=r+t)),l+=o(e[t],{data:n,blockParams:E([e[t],t],[r+t,null])})}if(t.data&&t.ids&&(r=T(t.data.contextPath,t.ids[0])+"."),d(e)&&(e=e.call(this)),t.data&&(n=v(t.data)),e&&"object"==typeof e)if(f(e))for(let t=e.length;a{void 0!==t&&s(t,a-1),t=e,a++}),void 0!==t&&s(t,a-1,!0)}return 0===a&&(l=i(this)),l}))}(e),function(e){e.registerHelper("helperMissing",(function(){if(1!==arguments.length)throw new b('Missing helper: "'+arguments[arguments.length-1].name+'"')}))}(e),function(e){e.registerHelper("if",(function(e,t){if(2!=arguments.length)throw new b("#if requires exactly one argument");return d(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||g(e)?t.inverse(this):t.fn(this)})),e.registerHelper("unless",(function(t,n){if(2!=arguments.length)throw new b("#unless requires exactly one argument");return e.helpers.if.call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})}))}(e),function(e){e.registerHelper("log",(function(){let t=[void 0],n=arguments[arguments.length-1];for(let e=0;e=0?t:parseInt(e,10)}return e},log:function(e,...t){if(e=C.lookupLevel(e),"undefined"!=typeof console&&C.lookupLevel(C.level)<=e){let n=C.methodMap[e];console[n]||(n="log"),console[n](...t)}}};var M=C;function A(...e){return u(Object.create(null),...e)}const x=Object.create(null);function S(e,t){return void 0!==e.whitelist[t]?!0===e.whitelist[t]:void 0!==e.defaultValue?e.defaultValue:(function(e){!0!==x[e]&&(x[e]=!0,(void 0)("error",`Handlebars: Access has been denied to resolve the property "${e}" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}(t),!1)}const k="4.7.7",j=8,I=7,L={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};function R(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},_(this),O(this)}R.prototype={constructor:R,logger:M,log:M.log,registerHelper:function(e,t){if("[object Object]"===p.call(e)){if(t)throw new b("Arg not supported with multiple helpers");u(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if("[object Object]"===p.call(e))u(this.partials,e);else{if(void 0===t)throw new b(`Attempting to register a partial called "${e}" as undefined`);this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if("[object Object]"===p.call(e)){if(t)throw new b("Arg not supported with multiple decorators");u(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses(){Object.keys(x).forEach(e=>{delete x[e]})}};let H=M.log;function N(e){this.string=e}N.prototype.toString=N.prototype.toHTML=function(){return""+this.string};var D=N;function V(e){const t=e&&e[0]||1;if(!(t>=I&&t<=j)){if(t{let r=e[n];e[n]=function(e,t){const n=t.lookupProperty;return function(e,t){return"function"!=typeof e?e:function(){const n=arguments[arguments.length-1];return arguments[arguments.length-1]=t(n),e.apply(this,arguments)}}(e,e=>u({lookupProperty:n},e))}(r,t)})}(i,r),r.helpers=i,e.usePartial&&(r.partials=r.mergeIfNeeded(o.partials,t.partials)),(e.usePartial||e.useDecorators)&&(r.decorators=u({},t.decorators,o.decorators)),r.hooks={},r.protoAccessControl=function(e){let t=Object.create(null);t.constructor=!1,t.__defineGetter__=!1,t.__defineSetter__=!1,t.__lookupGetter__=!1;let n=Object.create(null);return n.__proto__=!1,{properties:{whitelist:A(n,e.allowedProtoProperties),defaultValue:e.allowProtoPropertiesByDefault},methods:{whitelist:A(t,e.allowedProtoMethods),defaultValue:e.allowProtoMethodsByDefault}}}(o);let a=o.allowCallsToHelperMissing||n;P(r,"helperMissing",a),P(r,"blockHelperMissing",a)}},o._child=function(t,n,o,i){if(e.useBlockParams&&!o)throw new b("must pass block params");if(e.useDepths&&!i)throw new b("must pass parent depths");return G(r,t,e[t],n,0,o,i)},o}function G(e,t,n,r,o,i,a){function l(t,o={}){let l=a;return!a||t==a[0]||t===e.nullContext&&null===a[0]||(l=[t].concat(a)),n(e,t,e.helpers,e.partials,o.data||r,i&&[o.blockParams].concat(i),l)}return(l=U(n,l,e,a,r,i)).program=t,l.depth=a?a.length:0,l.blockParams=o||0,l}function Z(e,t,n){return e?e.call||n.name||(n.name=e,e=n.partials[e]):e="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name],e}function F(e,t,n){const r=n.data&&n.data["partial-block"];let o;if(n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath),n.fn&&n.fn!==q){n.data=v(n.data);let e=n.fn;o=n.data["partial-block"]=function(t,n={}){return n.data=v(n.data),n.data["partial-block"]=r,e(t,n)},e.partials&&(n.partials=u({},n.partials,e.partials))}if(void 0===e&&o&&(e=o),void 0===e)throw new b("The partial "+n.name+" could not be found");if(e instanceof Function)return e(t,n)}function q(){return""}function U(e,t,n,r,o,i){if(e.decorator){let a={};u(t=e.decorator(t,a,n,r&&r[0],o,i,r),a)}return t}function Y(){let e=new R;return u(e,o),e.SafeString=D,e.Exception=b,e.Utils=r,e.escapeExpression=m,e.VM=i,e.template=function(t){return B(t,e)},e}let K=Y();K.create=Y,function(e){let t="undefined"!=typeof global?global:window,n=t.Handlebars;e.noConflict=function(){return t.Handlebars===e&&(t.Handlebars=n),e}}(K),K.default=K;t.default=K}])); } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Handlebars Templates:index.js"); } }; try { // syncs with @frontend/packages/ui-chrome-extension/src/constants.ts#CUSTOM_EVENT.MESSAGE_FROM_INTERACTION_STUDIO_TOOLS_GEAR var VE_CUSTOM_EVENT_NAME = 'msg_from_interaction_studio_tools_gear'; // syncs with @frontend/packages/ui-chrome-extension/src/constants.ts#EVENT_TYPE.MESSAGE_FROM_INTERACTION_STUDIO_TOOLS_GEAR var TO_LAUNCHER_MESSAGE_TYPE = 'nxve_messageFromInteractionStudioToolsGear'; var TO_LAUNCHER_PAYLOAD_TYPE = 'beaconSDK_domEvent'; function sendMessageToEvergageLauncher(message) { try { document.dispatchEvent( new CustomEvent(VE_CUSTOM_EVENT_NAME, { detail: JSON.stringify(message), }) ); } catch (e) { console.error(e); } } var eventLinkId = null; if (Evergage !== null) { document.addEventListener(Evergage.CustomEvents.OnInit, function ( domEvent ) { sendMessageToEvergageLauncher({ type: TO_LAUNCHER_MESSAGE_TYPE, payload: { type: TO_LAUNCHER_PAYLOAD_TYPE, payload: { name: Evergage.CustomEvents.OnInit, detail: domEvent.detail, }, }, }); }); document.addEventListener(Evergage.CustomEvents.OnEventSend, function ( domEvent ) { eventLinkId = Math.random().toString().slice(2); const { actionEvent } = domEvent.detail || {}; actionEvent._toolsEventLinkId = eventLinkId; if (actionEvent.interaction) { actionEvent.explain = true; } else { actionEvent.debug = Object.assign( (actionEvent.debug || {}), { explanations: true } ); } sendMessageToEvergageLauncher({ type: TO_LAUNCHER_MESSAGE_TYPE, payload: { type: TO_LAUNCHER_PAYLOAD_TYPE, payload: { name: Evergage.CustomEvents.OnEventSend, detail: domEvent.detail, }, }, }); }); document.addEventListener(Evergage.CustomEvents.OnEventResponse, function ( domEvent ) { if (domEvent.detail) { const currentPage = Evergage.getCurrentPage(); const sitemapConfig = Evergage.getState().config; const matchedPageConfig = Evergage.getState().result && Evergage.getState().result.matchedConfig; eventLinkId = null; sendMessageToEvergageLauncher({ type: TO_LAUNCHER_MESSAGE_TYPE, payload: { type: TO_LAUNCHER_PAYLOAD_TYPE, payload: { name: Evergage.CustomEvents.OnEventResponse, detail: { response: domEvent.detail.response, currentPage: currentPage, sitemapConfig: sitemapConfig, matchedPageConfig: matchedPageConfig, }, }, }, }); } }); } } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: System Tools:interactionStudioTools.js"); } }; try { Evergage.Surveys = Evergage.Surveys || (function() { var SURVEY_ACTION = { SUBMIT: "submit", PAGE_NEXT: "pageNext", PAGE_PREV: "pagePrev" }; var SURVEY_EVENT_PARAM = { SURVEY_ACTION: 'surveyAction', SURVEY_ID: 'surveyId', SURVEY_START_TIME: 'surveyStartTime' }; var initialized = false; function isInitialized() { return (initialized || typeof window.Survey === 'object'); } /** * processSurveyResponses * ** recursive ** * @param responses {object} a collection of survey element response values keyed by element.name (question.name) * @param elements {object} a collection of SurveyElements for a given page or panel of a survey * @param addResponseFn {function} invoked for each questionType element that has been processed */ function processSurveyResponses(elements, survey, sender) { try { var shouldHandleElementAsPanel = function(element) { return (element.type === 'panel' && Evergage.cashDom.isArray(element.elements) && element.elements.length !== 0 && !isString(element.questionId)); }; var formatAnswer = function(answer) { var result = (answer) ? answer : null; if (result != null && Evergage.cashDom.isArray(result) || isPlainObject(result)) { result = JSON.stringify(result); } return result; }; var formatQuestionId = function(element, rowId) { var questionId = "survey:" + survey.id + ":" + element.questionId; if (isString(rowId)) { questionId += ":" + rowId; } return questionId; }; var responses = []; for (var elementIndex = 0; elementIndex < elements.length; elementIndex++) { var element = elements[elementIndex]; if (shouldHandleElementAsPanel(element)) { responses = responses.concat(processSurveyResponses(element.elements, survey, sender)); } else { if (element.type === "matrix") { for (var rowIndex = 0; rowIndex < element.rows.length; rowIndex++) { var row = element.rows[rowIndex]; var rowId = element.rowIds[rowIndex]; var allRowsValues = sender.data[element.name] ? sender.data[element.name] : {}; if (allRowsValues[row.value]) { var rowValue = allRowsValues[row.value]; responses.push({ questionId: formatQuestionId(element, rowId), answer: rowValue }); } } } else { var answer = formatAnswer(sender.data[element.name]); if (answer) { responses.push({ questionId: formatQuestionId(element), answer: answer }); } } } } return responses; } catch (e) { Evergage.log.error('Evergage: There was an error when attempting to ' + 'process survey responses: ', e); } } function isPlainObject(obj) { if (typeof obj !== 'object' || obj === null) return false; const proto = Object.getPrototypeOf(obj); return proto === null || proto === Object.prototype; } function isString(property) { return typeof property === 'string' || property instanceof String; } function handleSurveyAction(surveyAction, survey, sender) { try { if (surveyAction === SURVEY_ACTION.PAGE_NEXT) { return; } else { var surveyActionEvent = new SurveyActionEvent(surveyAction, survey.id, new Date().getTime()); Evergage.cashDom.each(survey.config.pages, function(index, page) { surveyActionEvent.addResponses(processSurveyResponses(page.elements, survey, sender)); }); surveyActionEvent.send(); } } catch (e) { Evergage.log.error('Evergage: There was an error when attempting to ' + 'submit survey responses surveyId[' + message.surveyConfig.survey.id + ']: ', e); } } function renderSurvey(survey, renderTarget) { if (typeof survey !== "object" || !renderTarget) return Evergage.log.error("Evergage: renderSurvey arguments are not valid"); return injectSurveyResourcesIntoPage().then(() => { try { if (surveyAlreadyRendered(survey.id, renderTarget)) return; window.Survey.JsonObject.metaData.addProperty("questionbase", "questionId"); window.Survey.JsonObject.metaData.addProperty("questionbase", "rowIds"); var surveyModel = new window.Survey.Model(survey.config); // eslint-disable-next-line new-cap Evergage.cashDom(renderTarget).Survey({ model: surveyModel, onComplete: function(sender) { handleSurveyAction(SURVEY_ACTION.SUBMIT, survey, sender); }, onPartialSend: function(sender) { handleSurveyAction(SURVEY_ACTION.PAGE_NEXT, survey, sender); } }); Evergage.cashDom(renderTarget).attr("data-evg-survey-id", survey.id); } catch (e) { Evergage.log.error('Evergage: There was an error when attempting to render the survey', e); } }); } function injectSurveyResourceIntoPage(type, url) { try { var documentHead = document.head || document.getElementsByTagName('head')[0]; var isStylesheet = (type === 'style'); var surveyResourceElement = document.createElement(isStylesheet ? 'link' : 'script'); surveyResourceElement.setAttribute('type', ((isStylesheet) ? 'text/css' : 'text/javascript')); surveyResourceElement.setAttribute('class', 'evergageSurvey-' + type); surveyResourceElement.setAttribute(((isStylesheet) ? 'href' : 'src'), url); if (isStylesheet) { surveyResourceElement.setAttribute('rel', 'stylesheet'); } documentHead.appendChild(surveyResourceElement); Evergage.log.trace('Evergage: Injected survey resource of type[' + type + '] url[' + url + ']'); } catch (e) { Evergage.log.error('Evergage: There was an error when attempting to inject surveyJS resources into the page: ', e); } } function injectSurveyResourcesIntoPage() { return new Promise(resolve => { if (isInitialized()) { return resolve(); } var SURVEY_JS_CDN_BASE_URL = '//cdn.evergage.com/evergage-content/3pp'; var SURVEY_JS_VERSION = 'surveyjs-1.0.95'; var SURVEY_JS_SCRIPT_NAME = 'survey.cash.min.js'; var SURVEY_JS_STYLESHEET_NAME = 'survey.min.css'; Object.entries({ script: [SURVEY_JS_CDN_BASE_URL, SURVEY_JS_VERSION, SURVEY_JS_SCRIPT_NAME].join('/'), style: [SURVEY_JS_CDN_BASE_URL, SURVEY_JS_VERSION, SURVEY_JS_STYLESHEET_NAME].join('/') }).forEach(function(entry) { const [resourceType, resourceUrl] = entry injectSurveyResourceIntoPage(resourceType, resourceUrl); }); var interval = setInterval(function(){ if (Evergage.cashDom.fn.Survey != null && window.Survey != null) { clearInterval(interval); initialized = true; resolve(); } }, 100); }) } function surveyAlreadyRendered(surveyId, renderTarget) { return Evergage.cashDom(renderTarget).attr("data-evg-survey-id") === surveyId; } function SurveyActionEvent(surveyAction, surveyId, timestamp) { this.params = { source: {}, attributes: {} }; this.params.source[SURVEY_EVENT_PARAM.SURVEY_ACTION] = surveyAction; this.params.source[SURVEY_EVENT_PARAM.SURVEY_ID] = surveyId; this.params.source[SURVEY_EVENT_PARAM.SURVEY_START_TIME] = timestamp; } SurveyActionEvent.prototype.addResponses = function(responses) { for (var i = 0; i < responses.length; i++) { var response = responses[i]; this.addResponse(response.questionId, response.answer); } }; SurveyActionEvent.prototype.addResponse = function(name, value) { Evergage.log.trace('Evergage: Adding response to SurveyActionEvent: ' + JSON.stringify({ name: name, value: value })); this.params.attributes[name] = value; }; SurveyActionEvent.prototype.send = function() { Evergage.log.trace('Evergage: Tracking survey event: ', this.params); Evergage.sendEvent({ action: "Survey " + this.params.source[SURVEY_EVENT_PARAM.SURVEY_ACTION], source: this.params.source, user: { attributes: this.params.attributes } }); }; return { renderSurvey: renderSurvey, injectSurveyResourcesIntoPage: injectSurveyResourcesIntoPage }; })(window); if (window.SalesforceInteractions && window.SalesforceInteractions.mcis) { window.SalesforceInteractions.mcis.Surveys = Evergage.Surveys; } } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Surveys:SurveyJS.js"); } }; try { (function () { var VE_LOCAL_STORAGE_KEY = 'evgVE'; var SITEMAP_EDITOR_LOCAL_STORAGE_KEY = 'evgVE-cdp-sitemap-editor'; var SdkNamespace = window.Evergage || window.SalesforceInteractions; function injectEditorLaunchScript(isStandaloneSitemapEditor) { try { // getConfig() is not exposed on the Salesforce/CDP build of the SDK var trackerUrl = typeof SdkNamespace.getConfig === 'function' && SdkNamespace.getConfig().trackerUrl; var baseUrl = !isStandaloneSitemapEditor && trackerUrl ? trackerUrl : 'https://cdn.evergage.com'; var scriptPath = isStandaloneSitemapEditor ? '/evergage-content/sitemap-editor/4.0.2/launch.sitemap-editor.js' : '/visual-editor/launch.js'; var scriptUrl = [baseUrl, scriptPath].join(''); var scriptTag = document.createElement('script'); scriptTag.setAttribute('id', 'salesforceInteractionsLauncherScript'); scriptTag.src = scriptUrl; if ( document.getElementById('salesforceInteractionsLauncherScript') == null ) { document.head.appendChild(scriptTag); } else { SdkNamespace.log.info('Launch script is already here.'); } } catch (err) { SdkNamespace.log.error( 'Failed to inject Salesforce Interactions Launcher script: ' + err ); } } function getUrlBoolean(name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var results = regex.exec(location.search); return results === null ? null : results[1] === 'true'; } var visualEditorParam = getUrlBoolean('evergageEditor'); var standaloneEditorParam = getUrlBoolean('salesforceInteractionsSitemapEditor'); var visualEditorEnabledInStorage = function () { return window.localStorage[VE_LOCAL_STORAGE_KEY] === 'true'; }; var standloneSitemapEditorEnabledInStorage = function () { return window.localStorage[SITEMAP_EDITOR_LOCAL_STORAGE_KEY] === 'true'; }; // honor and set local storage based off queryParam if (visualEditorParam !== null) { window.localStorage.setItem(VE_LOCAL_STORAGE_KEY, visualEditorParam); } if (standaloneEditorParam !== null) { window.localStorage.setItem( SITEMAP_EDITOR_LOCAL_STORAGE_KEY, standaloneEditorParam ); } var inSiteEditorFrameContext = window.frameElement && window.frameElement.id === 'siteEditorFrame'; // trigger off of localStorage only // chrome extension reads/sets localStorage more easily than modifying the currentTab URL if ( !visualEditorEnabledInStorage() && !standloneSitemapEditorEnabledInStorage() && !inSiteEditorFrameContext ) { return; } if (window.top === window.self || inSiteEditorFrameContext) { document.addEventListener( SdkNamespace.CustomEvents.OnInit, (event) => { injectEditorLaunchScript( standloneSitemapEditorEnabledInStorage() ); event.preventDefault(); }, { once: true } ); } })(); } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Visual Editor:visualEditor.js"); } }; try { var evgr = Evergage.resolvers; const BButils = { init: ()=>{ window.BBdata = window.BBdata || {} window.BBdata.campaignEvents = window.BBdata.campaignEvents || [] document.addEventListener(Evergage.CustomEvents.OnEventResponse, (event) => { var actionEvent = event.detail.actionEvent var response = event.detail.response var isAnon = (actionEvent.user.anonId==response.resolvedUserId) window.BBdata.isAnon = isAnon window.BBdata.personalizationId = response.resolvedUserId }) document.addEventListener(Evergage.CustomEvents.OnStatSend, (event) => { const statType = event.detail.campaignStat.stat const isControl = event.detail.campaignStat.control const campaignId = event.detail.campaignResponse.campaignId const experienceId = event.detail.campaignResponse.experienceId const campaignName = event.detail.campaignResponse.campaignName const experienceName = event.detail.campaignResponse.experienceName const campaignStats = { user_id: window.BBdata.personalizationId, is_id: !window.BBdata.isAnon, is_control: isControl, campaign_id: campaignId, campaign_name: campaignName, experience_id: experienceId, experience_name: experienceName, interaction: statType, timestamp: new Date().toISOString() } window.BBdata.campaignEvents.push(campaignStats) }) window.addEventListener("beforeunload", (event) => { if(!window.BBdata || !window.BBdata.campaignEvents || window.BBdata.campaignEvents.length <= 0) return const campaignEvents = window.BBdata.campaignEvents const api = "https://personalization-itlg-neg-xapp-vpdx82.8v7uho.bra-s1.cloudhub.io/api/web/send-client-interaction"; fetch(api, { method: 'POST', body: JSON.stringify(campaignEvents), mode: 'cors', headers: new Headers({ "Content-Type": "application/json", }), }) .then(res => { if(res.status == 200) { window.BBdata.campaignEvents=[] } }) }) }, handleSFMCQS: ()=>{ //captura o parametro SFMCQS const searchParams = new URLSearchParams(window.location.search) const SFMCQS = searchParams.get('SFMCQS') if(!SFMCQS){return null} //transforma em bytes para ler corretamente caracteres especiais const text = atob(SFMCQS); const length = text.length; const bytes = new Uint8Array(length); for (let i = 0; i < length; i++) { bytes[i] = text.charCodeAt(i); } const decoder = new TextDecoder(); // default is utf-8 const decoded = decoder.decode(bytes); //reconstitui e retorna o objeto const SFMCOBJ = JSON.parse(decoded) return SFMCOBJ }, handleContactId: ()=>{ const searchParams = new URLSearchParams(window.location.search) const query = searchParams.get('q') if(!query){return null} try{ const contactId = atob(query); return contactId } catch{ return null } }, handleHorus: ()=>{ window.BBdata.showPersonalizationCampaign = false window.addEventListener("message", event => { if(event.data.operation =='chatComponentIsLoaded'){ window.postMessage({operation:"getHorusInteractionStatus"}) } if(event.data.operation =='canShowSalesforceInteraction'){ if(event.data.payload.status && !window.BBdata.showPersonalizationCampaign){ window.BBdata.showPersonalizationCampaign=true window.postMessage({operation:"showPersonalizationCampaign", payload:{status: true}}) } else if(!event.data.payload.status && window.BBdata.showPersonalizationCampaign){ window.BBdata.showPersonalizationCampaign=false window.postMessage({operation:"showPersonalizationCampaign", payload:{status: false}}) } } }, false); }, getGAID: ()=>{ const name = "_ga" + "="; const decodedCookie = decodeURIComponent(document.cookie); const cookieArray = decodedCookie.split(';'); for (var i = 0; i < cookieArray.length; i++) { var cookie = cookieArray[i].trim(); if (cookie.indexOf(name) === 0) { const valueArray = cookie.substring(name.length, cookie.length).split('.') const _gid = valueArray[2]+'.'+valueArray[3] return _gid } } return ""; }, getCookie: (cookieName)=>{ const name = cookieName const decodedCookie = decodeURIComponent(document.cookie); const cookieArray = decodedCookie.split(';'); for (var i = 0; i < cookieArray.length; i++) { var cookie = cookieArray[i].trim(); if (cookie.indexOf(name) === 0) { const valueArray = cookie.substring(name.length, cookie.length).split('=') const cookieValue = valueArray[1] return cookieValue } } return ""; }, getMCI: async ()=>{ const mci = await Evergage.DisplayUtils.pageElementLoaded("#mci-ibt").then((el)=>{ return el.value }) return mci // const MCI = document.getElementById('mci-ibt'); // if(!MCI){return null} // return MCI.value; }, checkDomain: { // return window.location.hostname portal: ()=>{ const hn = window.location.hostname return (hn=='www.bb.com.br') }, apf: ()=>{ const hn = window.location.hostname return (hn=='www21.bb.com.br' || hn=='www2.bb.com.br' ) }, blog: ()=>{ const hn = window.location.hostname return (hn=='blog.bb.com.br' ) } }, getWindowSize: ()=>{ return Number(Object(window).innerWidth) <= 767 ? "small" : "large" }, retirarAcentos: (string)=>{ return string.normalize('NFD').replace(/[\u0300-\u036f]/g, ""); }, } Evergage.init({ cookieDomain: "bb.com.br", }).then(() => { Evergage.setLoggingLevel("debug") BButils.init() if(BButils.checkDomain.portal()){ const configPortal = { global: { listeners: [ Evergage.DisplayUtils.pageElementLoaded("bb-menu").then((menu)=>{ setTimeout(()=>{ //APF Evergage.DisplayUtils.pageElementLoaded("a[title='Pessoa Física']").then(el=>{ el.addEventListener("click", (event)=>{ Evergage.sendEvent({ action:'APF' }) }) }) //APJ Evergage.DisplayUtils.pageElementLoaded("a[title='Pessoa Jurídica']").then(el=>{ el.addEventListener("click", (event)=>{ Evergage.sendEvent({ action:'APJ' }) }) }) //SETOR PUBLICO Evergage.DisplayUtils.pageElementLoaded("a[title='Setor Público']").then(el=>{ el.addEventListener("click", (event)=>{ Evergage.sendEvent({ action:'ASP' }) }) }) //PRIVATE Evergage.DisplayUtils.pageElementLoaded("a[title='Produtor Rural/ Private']").then(el=>{ el.addEventListener("click", (event)=>{ Evergage.sendEvent({ action:'APRP' }) }) }) }, 1) }), ], onActionEvent: (actionEvent) => { const SFMCOBJ = BButils.handleSFMCQS() actionEvent.action = actionEvent.action || ('PageView - ' + BButils.retirarAcentos(document.title)); actionEvent.user = actionEvent.user || {}; if(SFMCOBJ){actionEvent.user.attributes = SFMCOBJ || {}} else{actionEvent.user.attributes = actionEvent.user.attributes || {};} actionEvent.user.attributes.gid = BButils.getGAID() || {}; actionEvent.user.attributes.windowSize = BButils.getWindowSize() || '' return actionEvent; }, contentZones:[ {name: "global_popup"}, {name: "wp_page1"}, {name: "wp_page2"}, {name: "wp_page3"}, {name: "wp_page4"}, {name: "wp_page5"}, {name: "wp_page6"}, {name: "hide_components"}, {name: "wp_retrospectiva_2024_saudacao_1"}, {name: "wp_retrospectiva_2024_tempo_2"}, {name: "wp_retrospectiva_2024_pix_3"}, {name: "wp_retrospectiva_2024_produtos_4"}, {name: "wp_retrospectiva_2024_acessos_5"}, {name: "wp_retrospectiva_2024__superprotegido_6"}, {name: "wp_retrospectiva_2024_agradecimento_7"} ], }, pageTypeDefault: { name: "default", }, pageTypes: [ { name: "home", isMatch: () => /\/site\/(pra-voce\/)?$/.test(window.location.pathname), action: "PageView - Home", contentZones:[], listeners: [] }, { name: "Estilo - Home", isMatch: () => /\/site\/estilo\/$/.test(window.location.pathname), action: "PageView - Estilo Home", contentZones:[], listeners: [] }, { name: "Private - Home", isMatch: () => /\/site\/private\/$/.test(window.location.pathname), action: "PageView - Private Home", contentZones:[], listeners: [] }, { name: "Exclusivo - Home", isMatch: () => /\/site\/exclusivo\/$/.test(window.location.pathname), action: "PageView - Exclusivo Home", contentZones:[], listeners: [] }, { name: "Pro Seu Negocio - Home", isMatch: () => /\/site\/pro-seu-negocio\/$/.test(window.location.pathname), action: "PageView - Negocio Home", contentZones:[], listeners: [] }, { name: "Agronegocios - Home", isMatch: () => /\/site\/agronegocios\/$/.test(window.location.pathname), action: "PageView - Agronegocios Home", contentZones:[], listeners: [] }, { name: "Setor Publico - Home", isMatch: () => /\/site\/setor-publico\/$/.test(window.location.pathname), action: "PageView - Setor Publico Home", contentZones:[], listeners: [] }, { name: "Corporate - Home", isMatch: () => /\/site\/corporate\/$/.test(window.location.pathname), action: "PageView - Corporate Home", contentZones:[], listeners: [] }, { name: "Beneficios BB - Home", isMatch: () => /\/site\/pra-voce\/beneficios-bb\/$/.test(window.location.pathname), action: "PageView - Beneficios BB Home", contentZones:[], listeners: [] }, { name: "Beneficios BB - Gastronomia", isMatch: () => /\/site\/pra-voce\/beneficios-bb\/bb-gastronomia\/$/.test(window.location.pathname), action: "PageView - Beneficios BB Gastronomia", contentZones:[], listeners: [] }, { name: "Beneficios BB - Vantagens", isMatch: () => /\/site\/pra-voce\/beneficios-bb\/vantagens-e-beneficios\/$/.test(window.location.pathname), action: "PageView - Beneficios BB Vantagens", contentZones:[], listeners: [] }, { name: "Cartoes - Beneficios", isMatch: () => /\/site\/pra-voce\/cartoes-de-credito\/beneficios-ourocard\/$/.test(window.location.pathname), action: "PageView - Cartoes Beneficios", contentZones:[], listeners: [] }, { name: "Estilo - Cartoes", isMatch: () => /\/site\/estilo\/cartoes\/$/.test(window.location.pathname), action: "PageView - Estilo Cartoes", contentZones:[], listeners: [] }, { name: "Emprestimo Pessoal - Credito Salario", isMatch: () => /\/site\/pra-voce\/emprestimo\/emprestimo-pessoal\/credito-salario\/$/.test(window.location.pathname), action: "PageView - Emprestimo Pessoal - Credito Salario", contentZones:[], listeners: [] }, { name: "Emprestimo Pessoal - Consignado", isMatch: () => /\/site\/pra-voce\/emprestimo\/emprestimo-pessoal\/emprestimo-consignado-privado\/$/.test(window.location.pathname), action: "PageView - Emprestimo Pessoal - Consignado", contentZones:[], listeners: [ Evergage.DisplayUtils.pageElementLoaded('#leads-funil').then((funil)=>{ const isCampaign = funil.parentElement.attributes.hasOwnProperty('data-evg-campaign-id') if(isCampaign) return Evergage.sendEvent({ action: 'View Componente - Leads Funil - Consignado Privado', source:{ pageType: "Emprestimo Pessoal - Consignado", contentZones:['hide_components'] } }) var inputName = funil.querySelector('input[formcontrolname="name"]') var inputCPF = funil.querySelector('input[formcontrolname="cpf"]') var inputTelefone = funil.querySelector('input[formcontrolname="phone"]') var inputEmail = funil.querySelector('input[formcontrolname="email"]') var inputSubmit = funil.querySelector('#send-leads-funil') var inputClose = funil.querySelector('#close-leads-funil') inputSubmit.addEventListener('click', (el)=>{ Evergage.DisplayUtils.pageElementLoaded('.feedback.error').then(el=>{ Evergage.sendEvent({ action: 'Error - Leads Funil - Consignado Privado', source:{ pageType: "Emprestimo Pessoal - Consignado" } }) }) Evergage.DisplayUtils.pageElementLoaded('.feedback.success').then(el=>{ const name = inputName.value const cpf = inputCPF.value const phone = inputTelefone.value const email = inputEmail.value Evergage.sendEvent({ action: 'Success - Leads Funil - Consignado Privado', user:{ attributes:{ nome_completo: name, emailAddress: email, cpf:cpf } }, source:{ pageType: "Emprestimo Pessoal - Consignado" } }) //window.load(URL, _blank) }) }) }) ] }, { name: "Shopping BB - Home", isMatch: () => /\/site\/shopping-bb\/$/.test(window.location.pathname), action: "PageView - Shopping BB - Home", contentZones:[], listeners: [] }, { name: "Shopping BB - Cashback", isMatch: () => /\/site\/shopping-bb\/cashback\/$/.test(window.location.pathname), action: "PageView - Shopping BB - Cashback", contentZones:[], listeners: [] }, { name: "Emprestimo Pessoal - Consignado - É No BB", isMatch: () => /\/site\/pra-voce\/emprestimo\/emprestimo-pessoal\/consignado-privado-e-no-bb\/$/.test(window.location.pathname), action: "PageView - Emprestimo Pessoal - E No BB", contentZones:[], listeners: [ Evergage.listener('click', 'a[title="COMEÇAR AGORA"]', ev=>{ Evergage.sendEvent({ action: "Click - Emprestimo Pessoal Consignado - Comecar Agora" }) }) ] }, { name: "Seguros", isMatch: () => /\/site\/pra-voce\/seguros\/$/.test(window.location.pathname), action: "PageView - Seguros", contentZones:[], listeners: [ Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro de vida']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro de vida" }) }) }), Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro residencial']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro residencial" }) }) }), Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro auto']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro auto" }) }) }), Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro rural']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro rural" }) }) }), Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro de Itens Pessoais']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro de Itens Pessoais" }) }) }), Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro Proteção Pessoal']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro Protecao Pessoal" }) }) }), Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro celular']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro celular" }) }) }), Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro viagem']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro viagem" }) }) }), Evergage.DisplayUtils.pageElementLoaded("bb-card-image-wc[data-title='Seguro empréstimo']").then(el=>{ el.addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: "Click - Seguro emprestimo" }) }) }) ], onActionEvent: (actionEvent) => { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; return actionEvent } }, { name: "bbfriday-2024", isMatch: () => /(.*)\/promocoes\/bbfriday\/$/.test(window.location.pathname), action: "PageView - BBFriday 2024", listeners: [ Evergage.DisplayUtils.pageElementLoaded("div[data-elementor-type='wp-page']").then(()=>{ const opcoesEnquete = Evergage.cashDom("a[href*='enquete-promocoes-bb-friday']") for(var index=0; index < opcoesEnquete.length; index++){ opcoesEnquete[index].addEventListener('click', (ev)=>{ Evergage.sendEvent({ action: 'BBFriday 2024 Enquete - ' + ev.target.innerText }) }) } }) ], onActionEvent: (actionEvent) => { try{ const SFMCOBJ = BButils.handleSFMCQS() actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = SFMCOBJ || {}; }catch{ actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; } return actionEvent } }, { name: "Retrospectiva", isMatch: () => /\/retrospectiva\/$/.test(window.location.pathname), action: "Restrospectiva", listeners: [ Evergage.DisplayUtils.pageElementLoaded("div[data-elementor-type='wp-page']").then(el=>{ //el.innerHTML = '' //Evergage.reinit() }) ], contentZones: [ {name: 'retro_2024_primeiro_nome', selector: "#content-image989427562"}, ], onActionEvent: (actionEvent) => { const contactId = BButils.handleContactId() actionEvent.user = actionEvent.user || {}; console.log(actionEvent.user) if(contactId && (contactId.length==18 || contactId.slice(0,3)=='003')){ actionEvent.user.attributes = { 'contact_id': BButils.handleContactId() } } else { actionEvent.user.attributes = actionEvent.user.attributes || {}; window.location.replace('https://www.bb.com.br/site/') } return actionEvent } } ], }; Evergage.initSitemap(configPortal); } else if(BButils.checkDomain.apf()){ BButils.handleHorus() const configAPF = { global:{ // add toast listeners: [ //div.dados-conta > ul > li.minha-pagina > a Evergage.listener("click","div.dados-conta > ul > li.minha-pagina > a", (event) => { let rotulo = event.currentTarget.title; console.log('mp') if (rotulo != null) { if (rotulo.trim().length > 0) { Evergage.sendEvent({ action: "Click - APF - Minha Pagina" }); setTimeout(()=>{ Evergage.DisplayUtils.pageElementLoaded("#aapf").then((el)=>{ if(el.action){ Evergage.reinit() } }),1500}) } } }), Evergage.listener("click","#menu-rapido-itens > ul > li > a", (event) => { let rotulo = event.currentTarget.innerText; if (rotulo != null) { if (rotulo.trim().length > 0) { Evergage.sendEvent({ action: "Click - APF - Acesso Rápido - " + BButils.retirarAcentos(rotulo) }); setTimeout(()=>{ Evergage.DisplayUtils.pageElementLoaded("#aapf").then((el)=>{ if(el.action){ Evergage.reinit() } }),1500}) } } }), Evergage.listener("click","div.menu-segundo-nivel > ul > li > ul > li > a", (event) => { let rotulo = event.currentTarget.innerHTML; if (rotulo != null) { if (rotulo.trim().length > 0) { Evergage.sendEvent({ action: "Click - APF - Submenu - " + BButils.retirarAcentos(rotulo) }); setTimeout(()=>{ Evergage.DisplayUtils.pageElementLoaded("#aapf").then((el)=>{ if(el.action){ Evergage.reinit() } }),1500}) } } }), ], contentZones:[ {name: "global_popup"}, {name: "barra_superior", selector: ".barraSuperior"}, {name: "menu_rapido1", selector: "#menu-rapido-itens"} ], // end onActionEvent: (actionEvent) => { //actionEvent.action = actionEvent.action || ('PageView - ' + BButils.retirarAcentos(document.title)); //Gera um evento de pageview baseado no título da página independente de ela estar mapeada actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.gid = BButils.getGAID() || {}; actionEvent.user.attributes.windowSize = BButils.getWindowSize() || '' actionEvent.user.attributes.segmento = `${BButils.getCookie('segmento')} - ${BButils.getCookie('aapf.s')}` || {}; return actionEvent } }, pageTypeDefault: { name: "default", }, pageTypes: [ { name: "APF - Home", isMatch: () => /\/aapf\/personalizacao\/coca.jsp/.test(document.getElementById('aapf').action), action: "PageView - APF - Home", listeners: [ Evergage.DisplayUtils.pageElementLoaded("#mci-ibt").then((el)=>{ Evergage.sendEvent({ action: 'APF - MCI', user: { attributes:{ mci: el.value } } }) }) ], contentZones:[ {name: "banner_apf_home", selector: "#transacaoBanner"}, {name: "banner_apf_home_1", selector: "#touchslideritensBanners"}, ], onActionEvent: (actionEvent) => { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; //actionEvent.user.attributes.mci = await BButils.getMCI() || '' return actionEvent } }, { name: "Central de Extrato - Pessoa Física", isMatch: () => /\/aapf\/extrato\/centralExtrato.jsp/.test(document.getElementById('aapf').action), action: "PageView - APF - Extrato" }, ] } Evergage.initSitemap(configAPF) } else if(BButils.checkDomain.blog()){ const configBlog = { global:{ onActionEvent: (actionEvent) => { actionEvent.action = actionEvent.action || ('PageView - ' + BButils.retirarAcentos(document.title)); actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.gid = BButils.getGAID() || {}; actionEvent.user.attributes.windowSize = BButils.getWindowSize() || '' return actionEvent } }, pageTypeDefault: { name: "default", }, pageTypes: [ { name: "Blog BB Home", isMatch: () => /^\/$/.test(window.location.pathname), action: "BlogBB - Home", listeners: [], onActionEvent: (actionEvent) => { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; return actionEvent } }, { name: "Blog BB Categoria", isMatch: () => /\/categoria(.+)$/.test(window.location.pathname), action: "BlogBB - Categoria - " + BButils.retirarAcentos(document.title), listeners: [], onActionEvent: (actionEvent) => { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; return actionEvent } }, { name: "Blog BB Post", isMatch: () => window.location.pathname.split('/').length==3, action: "BlogBB - Post - " + BButils.retirarAcentos(document.title), listeners: [], onActionEvent: (actionEvent) => { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; return actionEvent } } ] } Evergage.initSitemap(configBlog) } else { console.error('No sitemap for this domain') } }); } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { console.error("siteWideJavascriptError" + e); } }; }