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; //Variables prod window.domain = window.location.host; window.completeURL = window.location.hostname + window.location.pathname; window.pagina_atual = null; window.profileIdAppONB = null; //Funciones function genero(g) { let genderKey = g.charAt(0).toUpperCase(); if (genderKey == "O") { genderKey = "X"; } return genderKey; } function validacionCorreo(email) { if (/^[a-zA-Z0-9._%+-]+@(gmail|hotmail|outlook|yahoo)\.(com|com\.br|co\.uk|com\.au|fr|ca)$/.test(email)) { return 0; } else if (/^([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.)+([a-zA-Z]{2,})$/i.test(email)) { if (!/^[a-zA-Z0-9._%+-]+@(gmail|hotmail|outlook|yahoo)\.(com|com\.br|co\.uk|com\.au|fr|ca)$/.test(email)) { return 1; } } else { return -1; } } function checkIfEmpty(str) { if (str === '') { return false; } else { return true; } } //ONBOARDING // Função para obter o valor de um cookie pelo nome function getCookie(name) { const value = "; " + document.cookie; const parts = value.split("; " + name + "="); if (parts.length === 2) { return parts.pop().split(";").shift(); } } function buscarPagina() { var id_pagina; id_pagina = document.querySelector(".desktop__principalTitle"); //Onboarding derivacion if (id_pagina) { const profileId = Evergage.util.getParameterByName("profileid"); //console.log("GetITEM before: " + sessionStorage.getItem('_cltk')); //console.log("ProfileId: " + profileId); //sessionStorage.setItem('_cltk', profileId); //console.log("GetITEM: " + sessionStorage.getItem('_cltk')); //console.log("Entrou no modelo desktop"); if (id_pagina.className != pagina_atual) { console.log("Site Mapping OnBoarding v26"); console.log("Reiniciou site map"); pagina_atual = id_pagina.className; console.log("Pagina atual= " + pagina_atual); Evergage.reinit(); } else if (id_pagina.className == null && pagina_atual == null) { console.log("Os dois sào nulos"); Evergage.reinit(); } } else { console.log("Derivacion para aplicativo"); id_pagina = document.querySelectorAll('[id*="salesForce"]'); console.log("Id da página encontrado: " + id_pagina); console.log("V03") if (id_pagina.length > 0) { if (id_pagina[0].id != pagina_atual) { console.log("Reiniciou sitemap app"); pagina_atual = id_pagina[0].id; Evergage.reinit(); } } } } //Macro premia var validacionSolamenteCategoria = null; function getCategoryFromCatalog() { var divContainer = document.querySelector('.catalog-navigation'); var elementos = divContainer.querySelectorAll('.sub-title-macro.ng-star-inserted'); if (elementos.length == 1) { const match = /\/catalog\/(.+)/.exec(window.location.href); validacionSolamenteCategoria = 1; return match[1] } if (elementos.length >= 2) { var segundoElemento = elementos[1]; var texto = segundoElemento.textContent; validacionSolamenteCategoria = 0; return removerAcentuacoes(texto); } } function getSubCategoryFromCatalog() { if (validacionSolamenteCategoria == 1) { return ''; } var divContainer = document.querySelector('#category-filters'); var elemento = divContainer.querySelector('.facet-item.ng-star-inserted'); return removerAcentuacoes(elemento.textContent); } function removerAcentuacoes(str) { const mapaAcentosHex = { 'a': /[ÀÁÂÃÄÅàáâãäå]/g, 'e': /[ÈÉÊËèéêë]/g, 'i': /[ÌÍÎÏìíîï]/g, 'o': /[ÒÓÔÕÖòóôõö]/g, 'u': /[ÙÚÛÜùúûü]/g, 'c': /[Çç]/g, 'n': /[Ññ]/g, }; for (let letra in mapaAcentosHex) { const regex = mapaAcentosHex[letra]; str = str.replace(regex, letra); } return str; } function eliminarAposInterrogacao(string) { if (string.includes('?')) { return string.slice(0, string.indexOf('?')); } else { return string; } } //Fim de Funciones // Formularios Empresas/Pyme if (completeURL == 'www.macro.com.ar/empresas/contactanos' || completeURL == 'www.macro.com.ar/empresas-gracias') { Evergage.init({ cookieDomain: "macro.com.ar", }).then(() => { const config = { global: { }, pageTypes: [ { name: "FORMS Emp", isMatch: () => /\/empresas\/contactanos/.test(window.location.href), action: "FORMS Emp", contentZones: [ ], listeners: [ Evergage.listener("blur", ".form-control.salesForceFormEmpresasAtributoEmail", () => { if (document.querySelector('.form-control.salesForceFormEmpresasAtributoEmail').className == 'form-control salesForceFormEmpresasAtributoEmail valid'){ Evergage.sendEvent({ action: "Formularios Emp - Email", user: { attributes: { EmailFrormEMP: document.querySelector('#boxEmail').value, } } }); } }), Evergage.listener("blur", ".form-control.salesForceFormEmpresasAtributoNumeroCelular", () => { if (document.querySelector('.form-control.salesForceFormEmpresasAtributoNumeroCelular').className == 'form-control salesForceFormEmpresasAtributoNumeroCelular valid') { Evergage.sendEvent({ action: "Formularios Emp - CUIT", user: { attributes: { CUIT: document.querySelector('.salesForceFormEmpresasAtributoNumeroCelular').value, } } }); } }), Evergage.listener("blur", ".form-control.salesForceFormEmpresasButtonRazonSocial", () => { if (document.querySelector('.form-control.salesForceFormEmpresasButtonRazonSocial').className == 'form-control salesForceFormEmpresasButtonRazonSocial valid') { Evergage.sendEvent({ action: "Formularios Emp - Razón Social", user: { attributes: { Razon_Social: document.querySelector('#boxRazonSocial').value, } } }); } }), Evergage.listener("blur", ".form-control.salesForceFormEmpresasAtributoNombre", () => { if (document.querySelector('.form-control.salesForceFormEmpresasAtributoNombre').className == 'form-control salesForceFormEmpresasAtributoNombre valid') { Evergage.sendEvent({ action: "Formularios Emp - Nombre", user: { attributes: { Nombre: document.querySelector('#boxNombre').value, } } }); } }), Evergage.listener("blur", ".form-control.salesForceFormEmpresasAtributoApellido", () => { if (document.querySelector('.form-control.salesForceFormEmpresasAtributoApellido').className == 'form-control salesForceFormEmpresasAtributoApellido valid') { Evergage.sendEvent({ action: "Formularios Emp - Apellido", user: { attributes: { Apelido: document.querySelector('#boxApellido').value, } } }); } }), Evergage.listener("blur", ".form-control.col-12.salesForceFormEmpresasAtributoCodArea, .form-control.col-12.salesForceFormEmpresasAtributoNumero", () => { if (document.querySelector('.form-control.col-12.salesForceFormEmpresasAtributoCodArea').classList.contains('valid') && document.querySelector('.form-control.col-12.salesForceFormEmpresasAtributoNumero').classList.contains('valid')) { const celFormEmp = document.querySelector('#boxCelCodArea').value + document.querySelector('#boxCelNum').value; Evergage.sendEvent({ action: "Formularios Emp - Celular_Form_Emp", user: { attributes: { Celular_Form_Emp: celFormEmp } } }); } }), Evergage.listener("click", "#dropdownSucursal", () => { setTimeout(() => { const sucursalValue = document.querySelector('#dropdownSucursal').innerText.trim(); if (sucursalValue !== 'Sucursal') { Evergage.sendEvent({ action: "Formularios Emp - Sucursal", user: { attributes: { Sucursal_mas_cerca_Form_Emp: sucursalValue } } }); } }, 10000); // Adjust wait time as needed (milliseconds) }), Evergage.listener("click", ".salesForceFormEmpresasButtonEnviar.btn.btn-orange.mt-3.mt-xl-4", () => { console.log('Sent Event to Salesforce'); Evergage.sendEvent({ action: "Formularios Emp - Enviar", user: { attributes: { Sucursal_mas_cerca_Form_Emp: document.querySelector('#dropdownSucursal').innerText, CUIT: document.querySelector('#boxNumeroDoc').value, EmailFrormEMP: document.querySelector('#boxEmail').value, Razon_Social: document.querySelector('#boxRazonSocial').value, Nombre: document.querySelector('#boxNombre').value, Apelido: document.querySelector('#boxApellido').value, Celular_Form_Emp: document.querySelector('#boxCelCodArea').value + document.querySelector('#boxCelNum').value, } } }); }), ], }, { name: "FORMS Emp - Exitosa", isMatch: () => /\/empresas-gracias/.test(window.location.href), action: "FORMS Emp - Exitosa", }, ], pageTypeDefault: { name: "Pagina no mapeada" }, }; Evergage.initSitemap(config); console.log("Site Mapping portal"); console.log("Complete URL:" + completeURL); }); } // Formulario NyP if (completeURL == 'www.macro.com.ar/negocios-y-profesionales/contacto' || completeURL == 'www.macro.com.ar/negocios-y-profesionales/nyp-gracias') { Evergage.init({ cookieDomain: "macro.com.ar", }).then(() => { const config = { global: { }, pageTypes: [ { name: "FORMS NyP", isMatch: () => /\/negocios-y-profesionales\/contacto/.test(window.location.href), action: "FORMS NyP", contentZones: [{ }], listeners: [ Evergage.listener("blur", ".form-control.salesForceFormNypAtributoEmail", () => { if (document.querySelector('.form-control.salesForceFormNypAtributoEmail').className == 'form-control salesForceFormNypAtributoEmail valid'){ Evergage.sendEvent({ action: "Formularios NyP - Email", user: { attributes: { Email_Form_Nyp2: document.querySelector('#boxEmail').value, } } }); } }), Evergage.listener("blur", ".form-control.salesForceFormNypAtributoNumero", () => { if (document.querySelector('.form-control.salesForceFormNypAtributoNumero').className == 'form-control salesForceFormNypAtributoNumero valid') { Evergage.sendEvent({ action: "Formularios NyP - CUIT", user: { attributes: { CUIT: document.querySelector('.salesForceFormNypAtributoNumero').value, } } }); } }), Evergage.listener("blur", ".form-control.salesForceFormNypAtributoNombre", () => { if (document.querySelector('.form-control.salesForceFormNypAtributoNombre').className == 'form-control salesForceFormNypAtributoNombre valid') { Evergage.sendEvent({ action: "Formularios NyP - Nombre", user: { attributes: { Nombre: document.querySelector('#boxNombre').value, } } }); } }), Evergage.listener("blur", ".form-control.salesForceFormNypAtributoApellido", () => { if (document.querySelector('.form-control.salesForceFormNypAtributoApellido').className == 'form-control salesForceFormNypAtributoApellido valid') { Evergage.sendEvent({ action: "Formularios NyP - Apellido", user: { attributes: { Apelido: document.querySelector('#boxApellido').value, } } }); } }), Evergage.listener("blur", ".form-control.col-12.salesForceFormNypAtributoCodArea, .form-control.col-12.salesForceFormNypAtributoNumero", () => { if (document.querySelector('.form-control.col-12.salesForceFormNypAtributoCodArea').classList.contains('valid') && document.querySelector('.form-control.col-12.salesForceFormNypAtributoNumero').classList.contains('valid')) { const celFormNyP = document.querySelector('#boxCelCodArea').value + document.querySelector('#boxCelNum').value; Evergage.sendEvent({ action: "Formularios Emp - Celular_Form_Emp", user: { attributes: { Celular_Form_NyP: celFormNyP } } }); } }), Evergage.listener("click", "#dropdownSucursal", () => { setTimeout(() => { const sucursalValue = document.querySelector('#dropdownSucursal').innerText.trim(); if (sucursalValue !== 'Sucursal') { Evergage.sendEvent({ action: "Formularios NyP - Sucursal", user: { attributes: { Sucursal_mas_cerca_Form_Nyp: sucursalValue } } }); } }, 5000); // Adjust wait time as needed (milliseconds) }), Evergage.listener("click", ".salesForceFormNypButtonEnviar.btn.btn-orange.mt-3.mt-xl-4", () => { console.log('Sent Event to Salesforce'); Evergage.sendEvent({ action: "Formularios NyP - Enviar", user: { attributes: { Sucursal_mas_cerca_Form_Nyp: document.querySelector('#dropdownSucursal').innerText, CUIT: document.querySelector('#boxNumeroDoc').value, Email_Form_Nyp2: document.querySelector('#boxEmail').value, Nombre: document.querySelector('#boxNombre').value, Apelido: document.querySelector('#boxApellido').value, Celular_Form_NyP: document.querySelector('#boxCelCodArea').value + document.querySelector('#boxCelNum').value, } } }); }), ], }, { name: "FORMS NyP - Exitosa", isMatch: () => /\/negocios-y-profesionales\/nyp-gracias/.test(window.location.href), action: "FORMS NyP - Exitosa", }, ], pageTypeDefault: { name: "Pagina no mapeada" }, }; Evergage.initSitemap(config); console.log("Site Mapping portal"); console.log("Complete URL:" + completeURL); }); } // Formulario Comercios if ( completeURL == "www.macro.com.ar/comercio/contacto" || completeURL == "www.macro.com.ar/comercio/gracias" ) { Evergage.init({ cookieDomain: "macro.com.ar", }).then(() => { const config = { global: {}, pageTypes: [ { name: "FORMS Com", isMatch: () => /\/comercio\/contacto/.test(window.location.href), action: "FORMS Com", contentZones: [ { }, ], listeners: [ Evergage.listener( "blur", ".form-control.salesForceFormComAtributoEmail", () => { if ( document.querySelector( ".form-control.salesForceFormEmpresasAtributoEmail" ).className == "form-control salesForceFormEmpresasAtributoEmail valid" ) { Evergage.sendEvent({ action: "Formularios Com - Email", user: { attributes: { Email_Form_Com2: document.querySelector('.form-control.salesForceFormEmpresasAtributoEmail.valid').value, }, }, }); } } ), Evergage.listener( "blur", ".form-control.salesForceFormComAtributoNumero", () => { if ( document.querySelector( ".form-control.salesForceFormComAtributoNumero" ).className == "form-control salesForceFormComAtributoNumero valid" ) { Evergage.sendEvent({ action: "Formularios Com - CUIT", user: { attributes: { CUIT: document.querySelector( ".salesForceFormComAtributoNumero" ).value, }, }, }); } } ), Evergage.listener( "blur", ".form-control.salesForceFormComAtributoNombre", () => { if ( document.querySelector( ".form-control.salesForceFormComAtributoNombre" ).className == "form-control salesForceFormComAtributoNombre valid" ) { Evergage.sendEvent({ action: "Formularios Com - Nombre", user: { attributes: { Nombre: document.querySelector("#boxNombre").value, }, }, }); } } ), Evergage.listener( "blur", ".form-control.salesForceFormComAtributoApellido", () => { if ( document.querySelector( ".form-control.salesForceFormComAtributoApellido" ).className == "form-control salesForceFormComAtributoApellido valid" ) { Evergage.sendEvent({ action: "Formularios Com - Apellido", user: { attributes: { Apellido: document.querySelector("#boxApellido").value, }, }, }); } } ), Evergage.listener( "blur", "#boxCelCodArea, #boxCelNum", () => { if ( document .querySelector( "#boxCelCodArea" ) .classList.contains("valid") && document .querySelector( "#boxCelNum" ) .classList.contains("valid") ) { const celFormCom = document.querySelector("#boxCelCodArea").value + document.querySelector("#boxCelNum").value; Evergage.sendEvent({ action: "Formularios Com - Celular_Form_Com", user: { attributes: { Celular_Form_Com: celFormCom, }, }, }); } } ), Evergage.listener("click", "#dropdownSucursal", () => { setTimeout(() => { const sucursalValue = document .querySelector("#dropdownSucursal") .innerText.trim(); if (sucursalValue !== "Sucursal") { Evergage.sendEvent({ action: "Formularios Com - Sucursal", user: { attributes: { Sucursal_mas_cerca_Form_Com: sucursalValue, }, }, }); } }, 5000); // Adjust wait time as needed (milliseconds) }), Evergage.listener( "click", "#msformcontacta", () => { console.log("Sent Event to Salesforce"); Evergage.sendEvent({ action: "Formularios Com - Enviar", user: { attributes: { Sucursal_mas_cerca_Form_Com: document.querySelector("#dropdownSucursal").innerText, CUIT: document.querySelector("#boxNumeroDoc").value, Email_Form_Com2: document.querySelector("#boxEmail").value, Nombre: document.querySelector("#boxNombre").value, Apellido: document.querySelector("#boxApellido").value, Celular_Form_Com: document.querySelector("#boxCelCodArea").value + document.querySelector("#boxCelNum").value, }, }, }); } ), ], }, { name: "FORMS Com - Exitosa", isMatch: () => /\/comercio\/contacto/.test( window.location.href ), action: "FORMS Com - Exitosa", }, ], pageTypeDefault: { name: "Pagina no mapeada", }, }; Evergage.initSitemap(config); console.log("Site Mapping portal"); console.log("Complete URL:" + completeURL); }); } //Saca tu tarjeta de credito if (domain == 'sacatutarjeta.macro.com.ar') { Evergage.init({ cookieDomain: "sacatutarjeta.macro.com.ar", }).then(() => { const config = { global: { }, pageTypeDefault: { name: "Pagina no mapeada" }, pageTypes: [ ], }; Evergage.initSitemap(config); }); } //Pedi tu Prestamo Personal if (domain == 'sacatuprestamo.macro.com.ar') { Evergage.init({ cookieDomain: "sacatuprestamo.macro.com.ar", }).then(() => { const config = { global: { }, pageTypeDefault: { name: "Pagina no mapeada" }, pageTypes: [ ], }; Evergage.initSitemap(config); }); } //Formulario Banca Empresas if (domain == 'onboardingempresas.macro.com.ar') { console.log('FORMS BE DOMAIN'); Evergage.init({ cookieDomain: "onboardingempresas.macro.com.ar", }).then(() => { const config = { global: { }, pageTypeDefault: { name: "Pagina no mapeada" }, pageTypes: [ { name: "Formulario BE", isMatch: () => { const match = (window.location.origin) === 'https://onboardingempresas.macro.com.ar'; console.log("isMatch result:", match); // Agregado para verificar el resultado de isMatch return match; }, action: "Formulario BE", contentZones: [{ name: "Example", }], listeners: [ Evergage.listener("blur", "#input-cuil", () => { console.log("Enviando evento Formularios BE - CUIL"); // Console log para verificar el envío del evento Evergage.sendEvent({ action: "Formularios BE - CUIL", user: { attributes: { customerId: document.querySelector('#input-cuil').value, } } }); } ), Evergage.listener("blur", "#input-nombre", () => { console.log("Enviando evento Formularios BE - Nombre"); // Console log para verificar el envío del evento Evergage.sendEvent({ action: "Formularios BE - Nombre", user: { attributes: { Nombre: document.querySelector('#input-nombre').value, } } }); } ), Evergage.listener("blur", "#input-apellido", () => { Evergage.sendEvent({ action: "Formularios BE - Apellido", user: { attributes: { Apelido: document.querySelector('#input-apellido').value, } } }); }), Evergage.listener("blur", "#input-email", () => { Evergage.sendEvent({ action: "Formularios BE - Email", user: { attributes: { emailAddress: document.querySelector('#input-email').value, } } }); }), Evergage.listener("click", ".px-4.py-2.rounded-md.transition-all.duration-600", () => { Evergage.sendEvent({ action: "Formularios BE - Boton Iniciar", user: { attributes: { emailAddress: document.querySelector('#input-email').value, Cel_onb: document.querySelector('#codigo-area').value + document.querySelector('#input-telefono').value, Nombre: document.querySelector('#input-nombre').value, Apelido: document.querySelector('#input-apellido').value, customerId: document.querySelector('#input-cuil').value, DigCABEAtributoUltimoPaso: "1" } } }); }), Evergage.listener("click", "#sf-depf-continuar", () => { const pep = document.getElementById('sf-depf-pep-true') ? '1' : '0'; const facta = document.getElementById('sf-depf-facta-true') ? '1' : '0'; const sujetoObligado = document.getElementById('sf-depf-suejtoobligado-true') ? '1' : '0'; Evergage.sendEvent({ action: "Formularios BE PF - Continuar 1", user: { attributes: { Nombre: document.querySelector('#sf-depf-nombre').value, Apelido: document.querySelector('#sf-depf-apellido').value, DigCABEAtributoNombreFantasia: document.querySelector('#sf-depf-nombrefantasia').value, facturacion: document.querySelector('#sf-depf-facturacion').value, localidad: document.querySelector('#sf-depf-domFiscalLocalidad').value, calle: document.querySelector('#sf-depf-domFiscalCalle').value, numeroCalle: document.querySelector('#sf-depf-domFiscalNumero').value, piso: document.querySelector('#sf-depf-domFiscalPiso').value, departamento: document.querySelector('#sf-depf-domFiscalDepartamento').value, codigoPostal: document.querySelector('#sf-depf-domFiscalCodigoPostal').value, genero: document.querySelectorAll('#sf-depf-genero')[0].textContent, estadoCivil: document.querySelectorAll('#sf-depf-estadocivil')[0].textContent, DigCABEActividad: document.querySelectorAll('#sf-depf-actividad')[0].textContent, condicionIva: document.querySelectorAll('#sf-depf-condicioniva')[0].textContent, condicionGanancias: document.querySelectorAll('#sf-depf-condicionganancias')[0].textContent, domicilioFiscal: document.querySelectorAll('#sf-depf-domFiscalProvincia')[0].textContent, condPep: pep, condFacta: facta, condSujObl: sujetoObligado, DigCABEAtributoUltimoPaso: "2" } } }); }), Evergage.listener("click", "#sf-depj-continuar", () => { const fatca = document.getElementById('sf-depj-fatca-true') ? '1' : '0'; const sujetoObligado = document.getElementById('sf-depj-suejtoObligado-true') ? '1' : '0'; Evergage.sendEvent({ action: "Formularios BE PJ - Continuar 1", user: { attributes: { DigCABEAtributoNombreFantasia: document.querySelector('#sf-depj-nombreFantasia').value, facturacion: document.querySelector('#sf-depj-facturacion').value, localidad: document.querySelector('#sf-depj-domFiscalLocalidad').value, calle: document.querySelector('#sf-depj-domFiscalCalle').value, numeroCalle: document.querySelector('#sf-depj-domFiscalNumero').value, piso: document.querySelector('#sf-depj-domFiscalPiso').value, departamento: document.querySelector('#sf-depj-domFiscalDepartamento').value, codigoPostal: document.querySelector('#sf-depj-domFiscalCodigoPostal').value, DigCABEActividad: document.querySelectorAll('#sf-depj-actividad')[0].textContent, condicionIva: document.getElementById('id="sf-drpj-condicionIVA"').innerText, condicionGanancias: document.querySelectorAll('#sf-drpj-condicionGanancias')[0].textContent, domicilioFiscal: document.querySelectorAll('#sf-depj-domFiscalProvincia')[0].textContent, condFatca: fatca, condSujObl: sujetoObligado, tipoSociedad: document.querySelectorAll('#sf-depj-tiposociedad')[0].textContent, DigCABEAtributoUltimoPaso: "2" } } }); }), Evergage.listener("click", "#sf-ss-btncontinuar", () => { Evergage.sendEvent({ action: "Formularios BE - Continuar 2", user: { attributes: { DigCABEAtributoUltimoPaso: "3" } } }); }), Evergage.listener("click", "#sf-et-btncontinuar", () => { Evergage.sendEvent({ action: "Formularios BE - Continuar 3", user: { attributes: { DigCABEAtributoUltimoPaso: "4" } } }); }), Evergage.listener("click", "#sf-btnAgregarIntegrante", () => { Evergage.sendEvent({ action: "Formularios BE PJ - Agregar Integrante", user: { attributes: { } } }); }), Evergage.listener("click", "#sf-integrante-guardar", () => { Evergage.sendEvent({ action: "Formularios BE PJ - Guardar Integrante", user: { attributes: { } } }); }), Evergage.listener("click", "#sf-integrante-cancelar", () => { Evergage.sendEvent({ action: "Formularios BE PJ - Cancelar Integrante", user: { attributes: { } } }); }), Evergage.listener("click", "#sf-integrantes-integrantesInhabilitados-btnsalir", () => { Evergage.sendEvent({ action: "Formularios BE PJ - Integrantes Inhabilitados", user: { attributes: { } } }); }), Evergage.listener("click", "#sf-integrantes-btnContinuar", () => { Evergage.sendEvent({ action: "Formularios BE PJ - Continuar 4", user: { attributes: { DigCABEAtributoUltimoPaso: "5" } } }); }), Evergage.listener("click", "#sf-integrantes-btnAtras", () => { Evergage.sendEvent({ action: "Formularios BE PJ - Continuar 5", user: { attributes: { DigCABEAtributoUltimoPaso: "6" } } }); }), Evergage.listener("click", "#sf-documentacion-continuar", () => { Evergage.sendEvent({ action: "Formularios BE PJ - Continuar 6", user: { attributes: { DigCABEAtributoUltimoPaso: "7" } } }); }), Evergage.listener("click", "#sf-documentacion-cancelar", () => { Evergage.sendEvent({ action: "Formularios BE PJ - Continuar 7", user: { attributes: { DigCABEAtributoUltimoPaso: "8" } } }); }), ], }, ], }; console.log('paso por el init'); Evergage.initSitemap(config); console.log("funca?") }); } // onboardingempresas.macro.com.ar/ if (domain == 'www.macro.com.ar' && completeURL != 'www.macro.com.ar/bancainternet/' && completeURL != 'www.macro.com.ar/tramiteonline/onbWeb/' && completeURL != 'www.macro.com.ar/empresas/contactanos' && completeURL != 'www.macro.com.ar/empresas-gracias' && completeURL != 'www.macro.com.ar/negocios-y-profesionales/contacto' && completeURL != 'www.macro.com.ar/negocios-y-profesionales/nyp-gracias' && completeURL != 'www.macro.com.ar/comercio/contacto' && completeURL != 'www.macro.com.ar/comercio/gracias' ) { Evergage.init({ cookieDomain: "macro.com.ar", }).then(() => { const config = { global: {}, pageTypeDefault: { name: "Pagina no mapeada", }, pageTypes: [{ name: "Home Page", isMatch: () => /\/home-page/.test(window.location.href), action: "Home Page", contentZones: [{ name: "Home_Page_banner slider 1 - Carrousel", selector: ".Personalizacion_Salesforce_HomeCarrouselSlider1" }, { name: "Home_Page_CardP_AdquiriTarjetas", selector: ".Personalizacion_Salesforce_HomeMCardsCard1" }, { name: "Home_Page_BannerAutoTeEspera", selector: ".Personalizacion_Salesforce_HomeBannersFormatowide1" }, { name: "Home_Page_BannerAcompanaATuNegocio", selector: ".personalizacionSFBannerAcompanaATuNegocio" }], listeners: [ Evergage.listener("click", ".Action_SalesforceHomeCarrouselSlider1", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Home_Page_banner slider boton 1 - Carrousel", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".Action_SalesforceHomeBannersFormatowide1", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Home_Page_BannerAutoTeEspera_Boton", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_ActivaToken", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Activa tu token", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_EnvioTarjeta", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Segui el envío de tu tarjeta", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_Seguros", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Conoce nuestros seguros", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_DesbloqueaTD", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Desbloquea tu tarjeta de debito", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_ReponeTD", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Repone tu tarjeta de debito", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_DescargaApp", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Descarga App Macro", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_AdheriResumen", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Adheri tu e-resumen", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_ActualizaDatos", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Actualiza tus datos", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_AbriCuenta", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Abri una cuenta - Carrousel", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_PotenciaTuSueldo", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Potencia tu Sueldo", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForcePS_ActualizaDatos", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Actualiza tus datos", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForceHOMEAcompanaATuNegocio", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Banner Queremos acompañar a tu negocio", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForceButtonHeaderAbriCuenta", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Abrir tu cuenta", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForceButtonHeaderCobraSueldo", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Cobra tu sueldo", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".Action_SalesforceHomeMCardsCard1", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Home_Page_CardP_AdquiriTarjetas_Boton", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForceCP_TraeSueldo", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Trae tu sueldo", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForceCP_UsaModo", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Usa MODO", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".salesForceCP_BeneficiosMacroSelecta", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Beneficios con Macro Selecta", user: { attributes: { id: customerId } } }); }), ] }, { name: "Cobra tu jubilacion en Banco Macro - Pagina", isMatch: () => /\/jubilados\/servicios\/cambio-de-banco/.test(window.location.href), action: "Cobra tu jubilacion en Banco Macro - Pagina", listeners: [ Evergage.listener("click", ".salesForceJB_ButtonContacten", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Quiero que me contacten", user: { attributes: { id: customerId } } }); }), ] }, { name: "derivacion_OB - Pagina", isMatch: () => /\/derivacion_OB/.test(window.location.href), action: "derivacion_OB - Pagina", listeners: [ Evergage.listener("click", ".salesForceDOB_TraeTuSuedo", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton ¿Queres traer tu sueldo a Macro?", user: { attributes: { id: customerId } } }); }), ] }, { name: "Jubilados - Pagina", isMatch: () => /\/jubilados$/.test(window.location.href), action: "Jubilados - Pagina", listeners: [ Evergage.listener("click", ".salesForceJB_ButtonSaberMas", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Quiero Saber Mas", user: { attributes: { id: customerId } } }); }), ] }, { name: "Abri tu cuenta - Pagina", isMatch: () => /\/operacionessimples\/soluciones\/hacete-cliente/.test(window.location.href), action: "Abri tu cuenta - Pagina", listeners: [ Evergage.listener("click", ".salesForceButtonOperSimpleAbriCuenta", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Boton Abrir una cuenta por la Web", user: { attributes: { id: customerId } } }); }), ] }, { name: "Personas Sueldos - Pagina", isMatch: () => /\/personas\/sueldos$/.test(window.location.href), action: "Personas Sueldos - Pagina", listeners: [ Evergage.listener("blur", ".salesForceFPS_Email", () => { const customerId = sessionStorage.getItem('_cltk'); var userEmail = Evergage.cashDom(".salesForceFPS_Email").val(); if (validacionCorreo(userEmail) == 0) { Evergage.sendEvent({ action: "Email Personas Sueldos Formulario", user: { attributes: { id: customerId, Email_Per_Sueldos2: userEmail } } }) } else if (validacionCorreo(userEmail) == 1) { Evergage.sendEvent({ action: "Email Personas Sueldos Formulario", user: { attributes: { id: customerId, Email_Per_Sueldos2: userEmail } } }) } }), Evergage.listener("change", ".salesForceFPS_CodAreaCel , .salesForceFPS_NroCel", () => { const customerId = sessionStorage.getItem('_cltk'); const userArea = Evergage.cashDom(".salesForceFPS_CodAreaCel").val(); const userTel = Evergage.cashDom(".salesForceFPS_NroCel").val(); let validateArea = typeof userArea === 'string' && /^\d+$/.test(userArea) && userArea.length >= 2 && userArea.length <= 5; let validateTel = typeof userTel === 'string' && /^\d+$/.test(userTel) && userTel.length >= 6 && userTel.length <= 10; if (validateArea && validateTel) { const telefoneCompleto = '549' + userArea + userTel; Evergage.sendEvent({ action: "Telefono Personas Sueldos Formulario", user: { attributes: { id: customerId, Celular_Per_Sueldos: telefoneCompleto } } }) } }), Evergage.listener("click", ".salesForceFPS_ButtonEnviar", () => { const Nombre = Evergage.cashDom(".salesForceFPS_Nombre").val(); const Apellido = Evergage.cashDom(".salesForceFPS_Apellido").val(); const Email_Per_Sueldos2 = Evergage.cashDom(".salesForceFPS_Email").val(); let Genero = Evergage.cashDom(".salesForceFPS_Genero").val(); Genero = genero(Genero); const Sucursal_mas_cerca_Per_Sueldos = Evergage.cashDom(".salesForceFPS_SucCercana").val(); const Tipo = Evergage.cashDom(".salesForceFPS_TpoDoc").val(); const NUMERO_ID = Evergage.cashDom(".salesForceFPS_NroDoc").val(); const userArea = Evergage.cashDom(".salesForceFPS_CodAreaCel").val(); const userTel = Evergage.cashDom(".salesForceFPS_NroCel").val(); let Celular_Per_Sueldos = '549' + userArea + userTel; if (checkIfEmpty(Genero) && checkIfEmpty(Tipo) && checkIfEmpty(Nombre) && checkIfEmpty(Email_Per_Sueldos2) && checkIfEmpty(Sucursal_mas_cerca_Per_Sueldos) && checkIfEmpty(NUMERO_ID && checkIfEmpty(userArea) && checkIfEmpty(userTel))) { if (Tipo === "DNI") { Evergage.sendEvent({ action: "Persona Sueldo - Boton Enviar Formulario", user: { attributes: { Nombre: Nombre, Apelido: Apellido, DNI: NUMERO_ID, Tipo: Tipo, Genero: Genero, Email_Per_Sueldos2: Email_Per_Sueldos2, Celular_Per_Sueldos: Celular_Per_Sueldos, Sucursal_mas_cerca_Per_Sueldos: Sucursal_mas_cerca_Per_Sueldos } } }) } else if (Tipo === "CUIL") { Evergage.sendEvent({ action: "Persona Sueldo - Boton Enviar Formulario", user: { attributes: { Nombre: Nombre, Apelido: Apellido, NUMERO_ID: NUMERO_ID, Tipo: Tipo, Genero: Genero, Email_Per_Sueldos2: Email_Per_Sueldos2, Celular_Per_Sueldos: Celular_Per_Sueldos, Sucursal_mas_cerca_Per_Sueldos: Sucursal_mas_cerca_Per_Sueldos } } }) } else { Evergage.sendEvent({ action: "Persona Sueldo - Boton Enviar Formulario", user: { attributes: { Nombre: Nombre, Apelido: Apellido, customerId: NUMERO_ID, Tipo: Tipo, Genero: Genero, Email_Per_Sueldos: Email_Per_Sueldos, Celular_Per_Sueldos: Celular_Per_Sueldos, Sucursal_mas_cerca_Per_Sueldos: Sucursal_mas_cerca_Per_Sueldos } } }) } } }) ] }, { name: "Cobra tus haberes Formulario", isMatch: () => /\/jubilados\/contacto/.test(window.location.href), action: "Cobra tus haberes Formulario", listeners: [ Evergage.listener("blur", ".salesForceFJB_Email", () => { const customerId = sessionStorage.getItem('_cltk'); var contactEmail = Evergage.cashDom(".salesForceFJB_Email").val(); if (validacionCorreo(contactEmail) == 0) { Evergage.sendEvent({ action: "Email Jubilados Formulario", user: { attributes: { id: customerId, Email_Hb2: contactEmail, } } }) } else if (validacionCorreo(contactEmail) == 1) { Evergage.sendEvent({ action: "Email Jubilados Formulario", user: { attributes: { id: customerId, Email_Hb2: contactEmail, } } }) } }), Evergage.listener("change", ".salesForceFJB_CodAreaCel , .salesForceFJB_NroCel", () => { const customerId = sessionStorage.getItem('_cltk'); const Area = Evergage.cashDom(".salesForceFJB_CodAreaCel").val(); const Tel = Evergage.cashDom(".salesForceFJB_NroCel").val(); let validateArea = typeof Area === 'string' && /^\d+$/.test(Area) && Area.length >= 2 && Area.length <= 5; let validateTel = typeof Tel === 'string' && /^\d+$/.test(Tel) && Tel.length >= 6 && Tel.length <= 10; if (validateArea && validateTel) { const telefonoCompleto = '549' + Area + Tel; Evergage.sendEvent({ action: "Telefono Jubilados Formulario", user: { attributes: { id: customerId, Numero_Hb: telefonoCompleto } } }); } }), Evergage.listener("click", ".salesForceFJB_ButtonEnviar", () => { const Nombre = Evergage.cashDom(".salesForceFJB_Nombre").val(); const Apellido = Evergage.cashDom(".salesForceFJB_Apellido").val(); const Tipo = Evergage.cashDom(".salesForceFJB_TpoDoc").val(); const NUMERO_ID = Evergage.cashDom(".salesForceFJB_NroDoc").val(); let Genero = Evergage.cashDom(".salesForceFJB_Genero").val(); Genero = genero(Genero); const Email_Hb2 = Evergage.cashDom(".salesForceFJB_Email").val(); const Area = Evergage.cashDom(".salesForceFJB_CodAreaCel").val(); const Tel = Evergage.cashDom(".salesForceFJB_NroCel").val(); const Sucursal_Hb = Evergage.cashDom(".salesForceFJB_SucCercana").val(); let Numero_Hb = '549' + Area + Tel; if (checkIfEmpty(Nombre) && checkIfEmpty(Tipo) && checkIfEmpty(NUMERO_ID) && checkIfEmpty(Genero) && checkIfEmpty(Email_Hb2) && checkIfEmpty(Area) && checkIfEmpty(Tel) && checkIfEmpty(Sucursal_Hb)) { if (Tipo === "DNI") { Evergage.sendEvent({ action: "Jubilados - Boton enviar Formulario", user: { attributes: { Nombre: Nombre, Apelido: Apellido, Tipo: Tipo, DNI: NUMERO_ID, Genero: Genero, Email_Hb2: Email_Hb2, Numero_Hb: Numero_Hb, Sucursal_Hb: Sucursal_Hb } } }) } else if (Tipo === "LC") { Evergage.sendEvent({ action: "Jubilados - Boton enviar Formulario", user: { attributes: { Nombre: Nombre, Apelido: Apellido, Tipo: Tipo, DNI: NUMERO_ID, Genero: Genero, Email_Hb2: Email_Hb2, Numero_Hb: Numero_Hb, Sucursal_Hb: Sucursal_Hb } } }) } else { Evergage.sendEvent({ action: "Jubilados - Boton enviar Formulario", user: { attributes: { Nombre: Nombre, Apelido: Apellido, Tipo: Tipo, DNI: NUMERO_ID, Genero: Genero, Email_Hb2: Email_Hb2, Numero_Hb: Numero_Hb, Sucursal_Hb: Sucursal_Hb } } }) } } }) ] }, { name: "Personas Sueldos Gracias", isMatch: () => /\/personas\/sueldos\/formulario\/gracias/.test(window.location.href), action: "Personas Sueldos Gracias", }, { name: "Cobra tus haberes Formulario Gracias", isMatch: () => /\/jubilados\/contacto-gracias/.test(window.location.href), action: "Cobra tus haberes Formulario Gracias", },] }; Evergage.initSitemap(config); console.log("Site Mapping portal"); console.log("Complete URL:" + completeURL); }); } else if (completeURL == 'www.macro.com.ar/tramiteonline/onbWeb/') { //(completeURL == 'www.macro.com.ar/tramiteonline/onbWeb/') Evergage.init({ cookieDomain: "macro.com.ar", }).then(() => { const config = { global: {}, pageTypeDefault: { }, pageTypes: [ { name: "Onboarding Web - Inicio Desktop", action: "Onboarding Web - Inicio Desktop", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "desktop__principalTitle") { console.log("Entrou no onboarding Inicio DESKTOP"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), listeners: [ Evergage.listener("click", ".desktop__primaryButton", () => { console.log("Chamou aqui"); const customerId = getCookie('_cltk'); console.log("CLTK: " + customerId); if (profileIdAppONB) { Evergage.sendEvent({ action: "Clique Onboarding Web - Desktop", user: { attributes: { id: profileIdAppONB } } }) } else { console.log("Entrou no else"); Evergage.sendEvent({ action: "Clique Onboarding Web - Desktop", user: { attributes: { id: customerId } } }) } }) ] }, { name: "Onboarding Web - Inicio", action: "Onboarding Web - Inicio", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceHomeTitle") { console.log("Entrou no onboarding Inicio Mobile"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), listeners: [ Evergage.listener("click", "button", () => { console.log("Chamou aqui"); const customerId = getCookie("_cltk"); console.log("WEB Inicio - customerId: " + customerId); if (profileIdAppONB) { Evergage.sendEvent({ action: "Clique Onboarding Web - Inicio", user: { attributes: { id: customerId } } }) } else { Evergage.sendEvent({ action: "Clique Onboarding Web - Inicio", user: { attributes: { id: customerId } } }) } }) ] }, { name: "Onboarding Web - Error DNI no Vigente", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceDNIError") { console.log("Entrou no Error DNI no Vigente"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "Onboarding Web - Error DNI no Vigente", listeners: [ Evergage.listener("click", "#salesForceButtonDNINoVigente", () => { const customerId = getCookie("_cltk") console.log("WEB DNI no Vigente - profileID: " + customerId); Evergage.sendEvent({ action: "Onboarding Web - Error DNI no Vigente Reintentar", user: { attributes: { id: customerId } } }) }) ] }, { name: "Onboarding Web - Cliente con Deuda", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceDebtError") { console.log("Entrou no Cliente com Deuda"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "Onboarding Web - Cliente con Deuda", listeners: [ Evergage.listener("click", "#salesForceButtonClienteConDeuda", () => { const customerId = getCookie("_cltk") console.log("WEB Cliente con Deuda - profileID: " + customerId); Evergage.sendEvent({ action: "Onboarding Web - Cliente con Deuda click", user: { attributes: { id: customerId } } }) }) ] }, { name: "Onboarding Web - Confirma tus datos", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceConfirmationDataTitle") { console.log("Entrou no Confirma tus datos"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "Onboarding Web - Confirma tus datos", listeners: [ Evergage.listener("click", "#btn-generic", () => { const customerId = getCookie("_cltk") console.log("WEB Inicio - customerId: " + customerId); Evergage.sendEvent({ action: "Onboarding Web - Confirma tus dados boton", user: { attributes: { id: customerId } } }) }) ] }, { name: "Onboarding Web - Elegir Sucursal", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceBranchSelectionTitle") { console.log("Entrou no Elegir Sucursal"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "Onboarding Web - Elegir Sucursal", listeners: [ Evergage.listener("click", "#salesForceButtonElegirSucursal", () => { const customerId = getCookie("_cltk") console.log("WEB Inicio - customerId: " + customerId); const allData = document.querySelectorAll("[id*=salesForceCard]")[0].childNodes[0].innerText; const sucursalID = document.querySelectorAll("[id*=salesForceCard]")[0].id.replace("salesForceCardSucursal_", ""); const nombreSucursal = allData.split("\n")[0]; const disponibilidadSucursal = allData.split("\n")[1]; const direccionSucursal = allData.split("\n")[2]; const numeroTelefonoSucursal = allData.split("\n")[3]; Evergage.sendEvent({ action: "Onboarding Web - Eligir datos de Sucursal boton", user: { attributes: { id: customerId, sucursalID: sucursalID, nombreSucursal: nombreSucursal, disponibilidadSucursal: disponibilidadSucursal, direccionSucursal: direccionSucursal, numeroTelefonoSucursal: numeroTelefonoSucursal } } }); }) ] }, { name: "Onboarding Web - Ingresá tus datos personales", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceEnterPersonalDataTitle") { console.log("Entrou no Ingresá tus datos personales"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "Onboarding Web - Ingresá tus datos personales", listeners: [ Evergage.listener("click", "#btn-generic.button.button-primary", () => { const customerId = getCookie("_cltk") console.log("WEB Inicio - customerId: " + customerId); let localidad = Evergage.cashDom("input[formcontrolname = city]").val(); let codigoPostal = Evergage.cashDom("input[formcontrolname = zipcode]").val(); let calle = Evergage.cashDom("input[formcontrolname = street]").val(); let numero = Evergage.cashDom("input[formcontrolname = number]").val(); let piso = Evergage.cashDom("input[formcontrolname = floor]").val(); let dpto = Evergage.cashDom("input[formcontrolname = department]").val(); const select = document.querySelector('.ng-untouched.ng-pristine.ng-valid'); const ind = select.selectedIndex; let provincia = select.options[ind].text; Evergage.sendEvent({ action: "Onboarding Web - Boton Eligir datos de Sucursal", user: { attributes: { id: customerId, Provincia_Onb: provincia, Localidad_Onb: localidad, CodigoPostal_Onb: codigoPostal, Calle_Onb: calle, Numero_Onb: numero, Piso_Onb: piso, Departamento_Onb: dpto } } }); }) ] }, { name: "Onboarding Web - DNI y Genero", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceClientInformationTitle") { console.log("Entrou no DNI y Genero"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "Onboarding Web - DNI y Genero", listeners: [ Evergage.listener("click", "button", () => { console.log("Entrou DNI y Genero "); const customerId = getCookie("_cltk"); console.log("WEB Inicio - customerId: " + customerId); let dni = Evergage.cashDom("input[formcontrolname = idNumberField]").val(); console.log("DNI AQUI: " + dni); sessionStorage.setItem("dni", dni); let gender = Evergage.cashDom("select").val(); console.log("Finalizou aqui"); console.log(dni); console.log(gender); Evergage.sendEvent({ action: "Onboarding Web - Botton continuar - DNI y Genero", user: { attributes: { id: customerId, DNI: dni, Genero: gender } } }); }) ] }, {name: "Onboarding MA", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForce_Flujo_onb-cliente") { console.log("MA"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action:"Onboarding MA", listeners: [ Evergage.listener("click", "button", () => { const customerId = getCookie("_cltk"); console.log("WEB InicioCL - customerId: " + customerId); Evergage.sendEvent({ action: "Onboarding MA", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".button.button-primary", () => { const customerId = getCookie("_cltk"); console.log("WEB Inicio - customerId: " + customerId); Evergage.sendEvent({ action: "Onboarding Web - boton Email y phone", user: { attributes: { id: customerId, Cel_onb: Evergage.cashDom('input[type=number]').val(), emailAddress: Evergage.cashDom('input[type=email]').val() } } }) }) ] }, {name: "Onboarding PS", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForce_Flujo_onb-ps") { console.log("PS"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action:"Onboarding PS", listeners: [ Evergage.listener("click", "button", () => { const customerId = getCookie("_cltk"); console.log("WEB InicioCL - customerId: " + customerId); Evergage.sendEvent({ action: "Onboarding PS", user: { attributes: { id: customerId } } }); }), Evergage.listener("click", ".button.button-primary", () => { const customerId = getCookie("_cltk"); console.log("WEB Inicio - customerId: " + customerId); Evergage.sendEvent({ action: "Onboarding Web - boton Email y phone", user: { attributes: { id: customerId, Cel_onb: Evergage.cashDom('input[type=number]').val(), emailAddress: Evergage.cashDom('input[type=email]').val() } } }) }) ] }, { name: "Onboarding Web - Email y Telefono", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceContactInformationTitle") { console.log("Entrou no Email y Telefono"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), // action: "Onboarding Web - Email y Telefono", // listeners: [ // Evergage.listener("click", ".button.button-primary", // () => { // const customerId = getCookie("_cltk"); // console.log("WEB Inicio - customerId: " + customerId); // Evergage.sendEvent({ // action: "Onboarding Web - boton Email y phone", // user: { // attributes: { // id: customerId, // Cel_onb: Evergage.cashDom('input[type=number]').val(), // emailAddress: Evergage.cashDom('input[type=email]').val() // } // } // }) // }) // ], }, { name: "Onboarding Web - Mail Validation", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceMailValidationTitle") { console.log("Entrou no Mail Validation"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "Onboarding Web - Mail Validation", listeners: [ Evergage.listener("click", ".button.button-primary", () => { const customerId = getCookie("_cltk"); console.log("WEB Inicio - customerId: " + customerId); // Evergage.sendEvent({ // action: "Onboarding Web - boton Email y phone", // user: { // attributes: { // id: customerId, // // Cel_onb: Evergage.cashDom('input[type=number]').val(), // emailAddress: Evergage.cashDom('input[type=email]').val() // } // } // }) }) ], }, { name: "Onboarding Web - Felicitaciones Cuenta Creada", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceButtonFelicitaciones") { console.log("Entrou no Felicitaciones Cuenta Creada"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "Onboarding Web - Felicitaciones Cuenta Creada", listeners: [ Evergage.listener("click", "button", () => { console.log("Ingresso acá"); const customerId = getCookie("_cltk"); console.log("Felicitaciones - customerId: " + customerId); var primerNombre = Evergage.cashDom("#name").text(); var apellido = Evergage.cashDom("#lastName").text(); Evergage.sendEvent({ action: "Onboarding Web - Felicitaciones Cuenta Creada Boton", user: { attributes: { id: customerId, Nombre: primerNombre, Apelido: apellido } } }) }) ] }, { name: "Nombre_Apellido", isMatch: () => new Promise((resolve, reject) => { const NombreElement = document.getElementById('salesForceNombreProspecto'); const ApellidoElement = document.getElementById('salesForceApellidoProspecto'); const Nonbre = NombreElement.textContent.trim() || ""; const Apellido = ApellidoElement.textContent.trim() || ""; console.log("Nombre:", Nombre); console.log("Apellido:", Apellido); resolve({ Nombre, Apellido }); }), action:"Nombre_Apellido", listeners: [ Evergage.listener("click", "button", () => { const customerId = getCookie("_cltk"); console.log("WEB InicioCL - customerId: " + customerId); Evergage.sendEvent({ action: "Nombre_Apellido", user: { attributes: { id: customerId, Nombre: document.querySelector('#salesForceNombreProspecto').textContent.trim(), Apellido: document.querySelector('#salesForceApellidoProspecto').textContent.trim(), } } }); }) ] } , { name: "PS-Validacion CUIT", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesForceCUITValidationTitle") { console.log("CUIT"); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar página agora é: " + pagina_atual); } else { reject(false); } }), action: "PS-Validacion CUIT", listeners: [ Evergage.listener("click", "button", () => { const customerId = getCookie("_cltk"); console.log("WEB InicioCL - customerId: " + customerId); const cuitElement = document.getElementById('salesForceCUITValidationTitle'); if (cuitElement) { // obtener el número de CUIT en formato de texto const numeroTexto = cuitElement.innerText; // eliminar caracteres no numéricos const numeroSoloDigitos = numeroTexto.replace(/\D/g, ''); // convertir el número de CUIT a un número const numero = parseInt(numeroSoloDigitos, 10); console.log("El número es:", numero); Evergage.sendEvent({ action: "PS-Validacion CUIT", user: { attributes: { id: customerId, CUIT: numero } } }); } else { console.error("No se encontró el elemento con el ID salesForceCUITValidationTitle"); } }) ] }, { name: "Capturar Atributos de la oferta", isMatch: () => new Promise((resolve, reject) => { const segmentoElement = document.getElementById('salesForceSegmento'); const tarjetaCreditoElement = document.getElementById('salesForceTarjetaCredito'); const limiteCompraElement = document.getElementById('salesForceLimiteCompra'); const tasaAdelantoElement = document.getElementById('salesForceTasaAdelanto'); const mesesBonificadosElement = document.getElementById('salesForceMesesBonificados'); const puntosMacroPremiaElement = document.getElementById('salesForcePuntosMacroPremia'); const creditoTCElement = document.getElementById('salesForceCreditoTC'); const segmento = segmentoElement.textContent.trim() || ""; const tarjetaCredito = tarjetaCreditoElement.textContent.trim() || ""; const limiteCompra = limiteCompraElement.textContent.trim() || ""; const tasaAdelanto = tasaAdelantoElement.textContent.trim() || ""; const mesesBonificados = mesesBonificadosElement.textContent.trim() || ""; const puntosMacroPremia = puntosMacroPremiaElement.textContent.trim() || ""; const creditoTC = creditoTCElement.textContent.trim() || ""; console.log("Segmento:", segmento); console.log("Tarjeta de Crédito:", tarjetaCredito); console.log("Límite de Compra:", limiteCompra); console.log("Tasa de Adelanto:", tasaAdelanto); console.log("Meses Bonificados:", mesesBonificados); console.log("Puntos Macro Premia:", puntosMacroPremia); console.log("Crédito de Tarjeta de Crédito:", creditoTC); resolve({ segmento, tarjetaCredito, limiteCompra, tasaAdelanto, mesesBonificados, puntosMacroPremia, creditoTC }); }), action:"Capturar Atributos de la oferta", listeners: [ Evergage.listener("click", "button", () => { const customerId = getCookie("_cltk"); console.log("WEB InicioCL - customerId: " + customerId); Evergage.sendEvent({ action: "Capturar Atributos de la oferta", user: { attributes: { id: customerId, segmento: document.querySelector('#salesForceSegmento').textContent.trim(), tarjetaCredito: document.querySelector('#salesForceTarjetaCredito').textContent.trim(), limiteCompra: document.querySelector('#salesForceLimiteCompra').textContent.trim(), tasaAdelanto: document.querySelector('#salesForceTasaAdelanto').textContent.trim(), mesesBonificados: document.querySelector('#salesForceMesesBonificados').textContent.trim(), puntosMacroPremia: document.querySelector('#salesForcePuntosMacroPremia').textContent.trim(), creditoTC:document.querySelector('#salesForceCreditoTC').textContent.trim(), } } }); }) ] } , { name: "Solo cuenta sueldo", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "salesforceOfferAvailableButtonAction") { console.log("oferta "); resolve(true); } else if (pagina_atual == null) { buscarPagina(); console.log("Buscar pagina " + pagina_atual); } else { reject(false); } }), action: "Solo cuenta sueldo", listeners: [ Evergage.listener("click", "#btn-generic", () => { const customerId = getCookie("_cltk"); const cuentaSueldoButton = document.getElementById('btn-generic'); console.log(" clic en el botón 'Solo cuenta sueldo"); Evergage.sendEvent({ action: "Solo cuenta sueldo", user: { attributes: { id: customerId } } }); }) ] }, ] }; const handleSPAPageChange = () => { const urlChangeInterval = setInterval(() => { buscarPagina(); }, 3000); } handleSPAPageChange(); console.log("Site Mapping OnBoarding v26"); Evergage.initSitemap(config); }); } else if (completeURL == 'www.macro.com.ar/bancainternet/') { console.log("Banca Internet Prod"); console.log("------------------------------------") window.codigo_cliente = null window.login = false //Banca Internet function getIdNameByPage() { return new Promise((resolve, reject) => { const ids = [ 'taggeo_Inicio_Consolidada', 'Solicitud_Prestamo_Error_1', 'Solicitud_Prestamo_Visualizar_OP_Exitosa', 'Solicitud_Simulacion_Visualizar', 'Renovacion_Solicitud_Visualizar', 'Solicitud_Renovacion_Error_1', 'Solicitud_Renovacion_Error_2', 'Solicitud_Renovacion_Visualizar_OP_Fallida', 'Solicitud_Renovacion_Visualizar_OP_Exitosa', 'Solicitud_Adelanto_Visualizar_OP_Exitosa', 'Solicitud_Adelanto_Error_1', 'Solicitud_Adelanto_Visualizar_OP_Fallida', 'Adelanto_Simulacion_Visualizar' ]; let idEncontrada = null; for (const idName of ids) { const elemento = document.querySelector(`#${idName}`); if (elemento) { idEncontrada = idName; break; } } if (idEncontrada !== null) { resolve(idEncontrada); } else { resolve("Nenhum Id encontrado") } }); } Evergage.init({ cookieDomain: "macro.com.ar", }).then(() => { const config = { global: { onActionEvent: (actionEvent) => { if(!window.login){ let cod_cliente = Evergage.cashDom("#IS_Entity").val(); window.codigo_cliente = cod_cliente console.log("Codigo Cliente - Logado: "+ window.codigo_cliente); if(cod_cliente){ window.login = true; actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = cod_cliente; } } return actionEvent; }, listeners: [ Evergage.listener("click", "#insertLoanProntoCashNewPrestamos", () => { const customerId = sessionStorage.getItem('_cltk'); console.log("Listener Prestamo Personal: Cod_Cliente: " + window.codigo_cliente); Evergage.sendEvent({ action: "Banca Internet - Prestamo Personal - Boton Prestamos Personales", user: { attributes: { id: customerId, Codigo_Cliente: window.codigo_cliente } } }) }), Evergage.listener("click", "#renovacion", () => { const customerId = sessionStorage.getItem('_cltk'); console.log("Listener Renovacion: Cod_Cliente: " + window.codigo_cliente); Evergage.sendEvent({ action: "Banca internet - Renova tus prestamos - Boton renova tu Préstamo", user: { attributes: { id: customerId, Codigo_Cliente: window.codigo_cliente } } }) }), Evergage.listener("click", "#adelantoSueldo", () => { const customerId = sessionStorage.getItem('_cltk'); console.log("Listener Adelanto Sueldo: Cod_Cliente: " + window.codigo_cliente); Evergage.sendEvent({ action: "Banca Internet - Adelanto de Sueldo - Boton Adelanto de Sueldo", user: { attributes: { id: customerId, Codigo_Cliente: window.codigo_cliente } } }) }) ] }, pageTypes: [ { name: "Banca Internet - Home Page", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "taggeo_Inicio_Consolidada") { console.log("Ingressou taggeo inicio consolidada"); console.log("Codigo Cliente v3: " + window.codigo_cliente) resolve(true); } else { reject(false); } }), action: "Banca Internet - Home Page", listeners: [ ], contentZones: [ { name: "BI_PopUp"} ], }, { name: "Banca internet - Prestamo Personal - Pantalla Error", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Prestamo_Error_1") { console.log("Ingressou taggeo Solicitud_Prestamo_Error_1"); resolve(true); } else { reject(false); } }), action: "Banca internet - Prestamo Personal - Pantalla Error", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca internet - Prestamo Personal - Operación Exitosa", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Prestamo_Visualizar_OP_Exitosa") { console.log("Ingressou taggeo Solicitud_Prestamo_Visualizar_OP_Exitosa"); resolve(true); } else { reject(false); } }), action: "Banca internet - Prestamo Personal - Operación Exitosa", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca internet - Prestamo Personal - Visualización Simulación", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Simulacion_Visualizar") { console.log("Ingressou taggeo Solicitud_Simulacion_Visualizar"); resolve(true); } else { reject(false); } }), action: "Banca internet - Prestamo Personal - Visualización Simulación", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca internet - Renova tus prestamos - Visualización simulación", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Renovacion_Solicitud_Visualizar") { console.log("Entrou no Renovacion_Solicitud_Visualizar"); resolve(true); } else { reject(false); } }), action: "Banca internet - Renova tus prestamos - Visualización simulación", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca internet - Renova tus prestamos - Renovacion Error 1", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Renovacion_Error_1") { console.log("Entrou no Solicitud_Renovacion_Error_1"); resolve(true); } else { reject(false); } }), action: "Banca internet - Renova tus prestamos - Renovacion Error 1", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca internet - Renova tus prestamos - Renovacion Error 2", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Renovacion_Error_2") { console.log("Entrou no Solicitud_Simulacion_Visualizar"); resolve(true); } else { reject(false); } }), action: "Banca internet - Renova tus prestamos - Renovacion Error 2", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca internet - Renova tus prestamos - Operación fallida", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Renovacion_Visualizar_OP_Fallida") { console.log("Entrou no Solicitud_Renovacion_Visualizar_OP_Fallida"); resolve(true); } else { reject(false); } }), action: "Banca internet - Renova tus prestamos - Operación fallida", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca internet - Renova tus prestamos - Operación exitosa", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Renovacion_Visualizar_OP_Exitosa") { console.log("Entrou no Solicitud_Renovacion_Visualizar_OP_Exitosa"); resolve(true); } else { reject(false); } }), action: "Banca internet - Renova tus prestamos - Operación exitosa", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca Internet - Adelanto de Sueldo - Operación existosa", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Adelanto_Visualizar_OP_Exitosa") { console.log("Entrou no Solicitud_Adelanto_Visualizar_OP_Exitosa"); resolve(true); } else { reject(false); } }), action: "Banca Internet - Adelanto de Sueldo - Operación existosa", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca Internet - Adelanto de Sueldo - Error 1", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Adelanto_Error_1") { console.log("Entrou no Solicitud_Adelanto_Error_1"); resolve(true); } else { reject(false); } }), action: "Banca Internet - Adelanto de Sueldo - Error 1", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca Internet - Adelanto de Sueldo- Operación fallida", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Solicitud_Adelanto_Visualizar_OP_Fallida") { console.log("Entrou no Solicitud_Adelanto_Visualizar_OP_Fallida"); resolve(true); } else { reject(false); } }), action: "Banca Internet - Adelanto de Sueldo - Operación fallida", onActionEvent: (actionEvent) => { if (window.codigo_cliente) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.Codigo_Cliente = window.codigo_cliente } return actionEvent; }, }, { name: "Banca Internet - Adelanto de Sueldo - Simulacion Viasualizar", isMatch: () => new Promise((resolve, reject) => { if (pagina_atual == "Adelanto_Simulacion_Visualizar") { console.log("Entrou no Adelanto_Simulacion_Visualizar"); resolve(true); } else { reject(false); } }), action: "Banca Internet - Adelanto de Sueldo - Simulacion Viasualizar", listeners: [ Evergage.listener("click", "#nextStateSimular", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Banca Internet - Adelanto de Sueldo - Botón Simular", user: { attributes: { id: customerId, Codigo_Cliente: window.codigo_cliente } } }) }) ] } ] }; const handleSPAPageChange = () => { const urlChangeInterval = setInterval(() => { // Usando a Promise para prosseguir o código getIdNameByPage() .then(id => { if (pagina_atual != id) { console.log("Pagina atual:" + pagina_atual); console.log("id: " + id); pagina_atual = id; Evergage.reinit() } }); console.log("Site Mapping Banca Internet v15"); }, 3500); } handleSPAPageChange(); Evergage.initSitemap(config); }); } else { if (domain == 'macropremia.com.ar') { console.log("Macropremia NEW"); Evergage.init({ cookieDomain: "macropremia.com.ar", }).then(() => { const loginEvent = sessionStorage.getItem("user.entityMis"); if (loginEvent) { const tipoPersona = sessionStorage.getItem("user.codTipoPersona"); let puntos = Evergage.cashDom(".points.pl-2.text-end").text(); puntos = puntos.split(':')[1].trim(); console.log("Pontos: " + puntos); Evergage.sendEvent({ action: "Login Success", user: { attributes: { Codigo_Cliente: loginEvent, Tipo_Persona_Macropremia: tipoPersona, Puntos_Macropremia: puntos } } }); } const config = { global: { contentZones: [{ name: "global_popup", selector: "#classic-header" }], listeners: [ Evergage.listener("click", "#account-bar", () => { const customerId = sessionStorage.getItem('_cltk'); Evergage.sendEvent({ action: "Ingreso_Loggeo_Macropremia", user: { attributes: { id: customerId } } }); }), ] }, pageTypeDefault: { name: "Pagina no mapeada" }, pageTypes: [ { name: "Categoria", isMatch: () => new Promise((resolve, reject) => { globalCategoria = eliminarAposInterrogacao(getCategoryFromCatalog().toUpperCase()) resolve(true); }), action: "Categoria", catalog: { Categoria: { _id: () => { return globalCategoria; }, name: () => { return globalCategoria; }, "relatedCatalogObjects": { "SubCategoria": () => { return [getSubCategoryFromCatalog().toUpperCase()]; } }, } }, action: "Última categoria visitada", onActionEvent: (actionEvent) => { if (getCategoryFromCatalog().toUpperCase()) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.ultimaVisualizacionCategoria = globalCategoria; var entityMis = sessionStorage.getItem('user.entityMis'); if (entityMis) { actionEvent.user.attributes.Codigo_Cliente = entityMis; } } return actionEvent; }, }, { name: "Producto Visualizado", isMatch: () => new Promise((resolve, reject) => { const categoryName = Evergage.cashDom(".breadcrumb .breadcrumb-item.ng-star-inserted .sub-title-macro.ng-star-inserted").text(); if (Evergage.cashDom("#product-container").length > 0 && categoryName) { resolve(true); } else { reject(false); } }), itemAction: Evergage.ItemAction.ViewItem, action: "Producto Visualizado", catalog: { Categoria: { _id: Evergage.resolvers.buildCategoryId("li.breadcrumb-item.ng-star-inserted", null, "|", (categoryId) => eliminarAposInterrogacao(removerAcentuacoes(categoryId).toUpperCase())), name: Evergage.resolvers.fromSelector(".sub-title-macro.ng-star-inserted", (categoryId) => eliminarAposInterrogacao(removerAcentuacoes(categoryId).toUpperCase())), "relatedCatalogObjects": { "SubCategoria": Evergage.resolvers.fromSelector("li.breadcrumb-item.ng-star-inserted:nth-child(2)", (categoryId) => [eliminarAposInterrogacao(removerAcentuacoes(categoryId).toUpperCase())]), } } }, action: "Última categoria visitada", onActionEvent: (actionEvent) => { const category = Evergage.cashDom("li.breadcrumb-item.ng-star-inserted:nth-child(1)").text().toUpperCase(); if (category) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.ultimaVisualizacionCategoria = eliminarAposInterrogacao(removerAcentuacoes(category).toUpperCase()); var entityMis = sessionStorage.getItem('user.entityMis'); if (entityMis) { actionEvent.user.attributes.Codigo_Cliente = entityMis; } } return actionEvent; }, listeners: [ Evergage.listener("click", ".btn.btn-block.btn-primary", () => { const customerId = sessionStorage.getItem('_cltk'); var entityMis = sessionStorage.getItem('user.entityMis'); if (entityMis) { Evergage.sendEvent({ action: "Comprar1_Macropremia", user: { attributes: { id: customerId, Codigo_Cliente: entityMis } } }); } else { Evergage.sendEvent({ action: "Comprar1_Macropremia", user: { attributes: { id: customerId } } }); } }), ], } ] } const handleSPAPageChange = () => { const urlChangeInterval = setInterval(() => { let url = window.location.href; console.log("URL: " + url); console.log("Pagina Atual: " + pagina_atual); if (url !== pagina_atual) { pagina_atual = url; Evergage.reinit(); } }, 8500); } handleSPAPageChange(); Evergage.initSitemap(config); }); } } } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { console.error("siteWideJavascriptError" + e); } }; }