apxor-qe 1.5.1 → 1.6.1-qa.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("apxor")):"function"==typeof define&&define.amd?define(["apxor"],e):(t=t||self)["apxor-qe"]=e(t.Apxor)}(this,(function(t){"use strict";function e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function n(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,c(r.key),r)}}function o(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function c(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var d=function(t){return void 0!==t&&!function(t){return null===t}(t)},f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function g(t,e){return Array.from(e).map((function(e,n){return String.fromCharCode(e^function(t,e){return t.charCodeAt(Math.floor(e%t.length))}(t,n))})).join("")}var v=function(t,e){return g(t,e=function(t){var e,n,r,i,a,o,s=0,u=[];if(!t)return t;t+="";do{e=(o=f.indexOf(t.charAt(s++))<<18|f.indexOf(t.charAt(s++))<<12|(i=f.indexOf(t.charAt(s++)))<<6|(a=f.indexOf(t.charAt(s++))))>>16&255,n=o>>8&255,r=255&o,u.push(e),64!==i&&(u.push(n),64!==a&&u.push(r))}while(s<t.length);return u}(e))},h=function(t){switch(t){case"app_event":return"AE";case"client_event":return"CE";case"activity_time":case"activity_event":return"AE"}return"Unknown"},p=function(t){return t.toUpperCase()},_=function(t,e,n){switch(n){case"EQ":return t===e;case"GT":return t>e;case"GTE":return t>=e;case"LT":return t<e;case"LTE":return t<=e;case"NEQ":return t!==e;case"R":return y(e).test(t);default:return!1}},y=function(t){var e=t.replace(/.*\/([gimuy]*)$/,"$1");e===t&&(e="");var n=e?t.replace(new RegExp("^/(.*?)/"+e+"$"),"$1"):t;return new RegExp(n,e)},E=function(){var t=new Date;return t.getDate()+"/"+t.getMonth()+"/"+t.getFullYear()},x=window.ApxorLogger,m=o((function e(){var n=this;i(this,e),s(this,"Lecg","ALL"),s(this,"KWLx",[]),s(this,"YkGb",[]),s(this,"userAttributesValidated",!0),s(this,"sessionAttributeValidated",!0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(n.Lecg=t.audience.audience_type,n.KWLx=t.audience.attributes.user,n.YkGb=t.audience.attributes.session,!Array.isArray(n.KWLx)||!Array.isArray(n.YkGb))return x.error("No attributes"),!1}catch(t){return x.error(t),!1}return!0})),s(this,"validate",(function(e,r){var i=!0;"FTU"===n.Lecg&&(i=t.getController().getSessionInfo().is_first_session);var a=n.hTqd(e,n.KWLx),o=n.hTqd(r,n.YkGb);return a||(n.userAttributesValidated=!1),o||(n.sessionAttributeValidated=!1),i&&a&&o})),s(this,"hTqd",(function(t,e){var n=e.length,r=!0;try{for(var i,a=function(){var n=e[o];if(void 0===t[n.name]||!1===r)return{v:!1};var i=n.operator,a=n.type,s=n.value.map((function(t){if("s"===a)return t;if("l"===a)return parseInt(t);if("f"===a)return parseFloat(t);if("b"===a)switch(t){case"true":return!0;case"false":return!1}})),u=(Array.isArray(t[n.name])?t[n.name]:[t[n.name]]).some((function(t){return s.some((function(e){return"s"===a?t="".concat(t):"l"===a?t=parseInt(t):"f"===a?t=parseFloat(t):"b"===a&&(t=!!t),_(t,e,i)}))}));r=r&&u},o=0;o<n;o++)if(i=a())return i.v}catch(t){x.error(t),r=!1}return r}))})),b=window.ApxorLogger,A=o((function t(){var e=this;i(this,t),s(this,"eeAf",0),s(this,"lEEo",0),s(this,"xdhp","SESSION"),s(this,"TIcR",0),s(this,"kcoq",0),s(this,"dtUE",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.eeAf=t.frequency.count,-1===e.eeAf&&(e.eeAf=1e3),e.dtUE=e.eeAf,e.lEEo=t.frequency.time_interval,e.xdhp=t.frequency.validity,e.kcoq=t.frequency.ses_lmt,e._dayCount=t.frequency.day_lmt;var n=P.getInstance().getQeState();if(!d(n)||!d(n[t._id]))return!0;if("SESSION"===e.xdhp){if(e.eeAf=parseInt(e.eeAf)-parseInt(n[t._id].SESSION),e.eeAf<=0)return console.warn("Max count limit reached for session:"+t._id),!1}else{if("OVERALL"!==e.xdhp)return b.info("Invalid config."),!1;if(e.eeAf=parseInt(e.eeAf)-parseInt(n[t._id].OVERALL),e.eeAf<=0)return console.warn("Max count limit reached for overall:"+t._id),!1}}catch(t){return b.error(t),!1}return!0})),s(this,"ikdS",(function(){e.eeAf=e.eeAf-1})),s(this,"getFrequencyCount",(function(){return e.eeAf})),s(this,"MdUm",(function(){"SESSION"===e.xdhp&&(e.eeAf=e.dtUE,b.info("Campaign Limit reset"))})),s(this,"iOMM",(function(t){try{if(e.eeAf<=0)return!1;var n=P.getInstance().getQeState();if(!d(n)||!d(n[t]))return!0;if(0!==e.kcoq)if(parseInt(e.kcoq)-parseInt(n[t].SESSION)<=0)return!1;if(0!==e._dayCount){var r,i=E();if(parseInt(e._dayCount)-parseInt((null===(r=n[t])||void 0===r?void 0:r.DATES[i])||0)<=0)return!1}}catch(t){b.error("Error validating the frequency:"+t)}return!0}))})),w=o((function t(){var e=this;i(this,t),s(this,"figp",""),s(this,"Lecg",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var n,r;e.figp=t.meta.name,e.Lecg=t.meta.type,e._only_context=t.meta.only_context,e._attr=(null===(n=t.meta)||void 0===n?void 0:n.attr)||{},e._isExperiment=null===(r=t.meta)||void 0===r?void 0:r.isExperiment}catch(t){return window.ApxorLogger.error(t),!1}return!0}))})),B=window.ApxorLogger,D=o((function t(){var e=this;i(this,t),s(this,"qbZE",-1),s(this,"RbKz",-1),s(this,"tgyZ",-1),s(this,"cWdN",-1),s(this,"cidg",!1),s(this,"_nudge_expired",!1),s(this,"_not_yet_active",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(isNaN(Date.parse(t.validity.start_date))||isNaN(Date.parse(t.validity.end_date)))return B.error("Not valid dates"),!1;if(e.qbZE=Date.parse(t.validity.start_date),e.RbKz=Date.parse(t.validity.end_date),d(t.time_limits_in_day)&&(e.cidg=t.time_limits_in_day,e.cidg&&d(t.time_limits))){var n=(new Date).toISOString().split("T")[0];if(e.tgyZ=Date.parse(n+"T"+t.time_limits.start_time+".000Z"),e.cWdN=Date.parse(n+"T"+t.time_limits.end_time+".000Z"),isNaN(e.tgyZ)||isNaN(e.cWdN))return B.error("Not valid times"),!1}}catch(t){return B.error(t),!1}return!0})),s(this,"validate",(function(){var t=Date.now();return t>e.qbZE&&t<e.RbKz?!e.cidg||t>=e.tgyZ&&t<=e.cWdN:(t<e.qbZE?e._not_yet_active=!0:t>e.RbKz&&(e._nudge_expired=!0),!1)}))})),O=o((function t(){var e=this;i(this,t),s(this,"figp",""),s(this,"rXDy",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.figp=t.name,e.rXDy=t.additional_info}catch(t){return!1}return!0}))})),S=o((function t(){var e=this;i(this,t),s(this,"serE",0),s(this,"DOnR",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.serE=Number(t.lower),e.DOnR=Number(t.upper),isNaN(e.serE)||isNaN(e.DOnR))return!1}catch(t){return!1}return!0}))})),C=o((function t(){var e=this;i(this,t),s(this,"wxRT",0),s(this,"tlgv",""),s(this,"kimo",""),s(this,"xCDb",new O),s(this,"uvCn",new S),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.tlgv=t.event_type,e.kimo=t.activity,e.xCDb.parse(t.details)&&e.uvCn.parse(t.time_bounds)}catch(t){return!1}}))})),U=window.ApxorLogger,X=o((function t(){var e=this;i(this,t),s(this,"wxRT",0),s(this,"eAoS",-1),s(this,"eeAf",0),s(this,"FOfl",""),s(this,"kimo",""),s(this,"tlgv",""),s(this,"uvCn",new S),s(this,"xCDb",new O),s(this,"woYX",new C),s(this,"zzXl","AND"),s(this,"Ziyx",!1),s(this,"Lecg",void 0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.eAoS=t.sequence,e.eeAf=t.count_config.count,e.FOfl=t.count_config.operator,e.kimo=t.activity,e.tlgv=t.event_type,e.zzXl=t.combine_operator,e.Lecg=t.type,e.xCDb.parse(t.details)&&e.woYX.parse(t.trigger)&&e.uvCn.parse(t.time_bounds)}catch(t){return U.error(t),!1}}))})),L=window.ApxorLogger,T=o((function t(){var e=this;i(this,t),s(this,"eeAf",0),s(this,"FOfl",""),s(this,"tlgv",""),s(this,"uvCn",new S),s(this,"xCDb",new O),s(this,"zzXl","AND"),s(this,"parse",(function(t){try{return e.eeAf=t.count_config.count,e.FOfl=t.count_config.operator,e.tlgv=t.event_type,e.zzXl=t.combine_operator,e.xCDb.parse(t.details)&&e.uvCn.parse(t.time_bounds)}catch(t){return L.error(t),!1}}))})),M=window.ApxorLogger,R=function(){function e(){var n=this;i(this,e),s(this,"Purf",0),s(this,"jUXZ",""),s(this,"UHEM",new X),s(this,"VHgA",new T),s(this,"dwoA",!1),s(this,"KWyt",!1),s(this,"OOsw",0),s(this,"zzXl","AND"),s(this,"bXqj","OR"),s(this,"aJVI",-1),s(this,"moyq",[]),s(this,"FJhx",{}),s(this,"bNNf",!1),s(this,"initialize",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";if(n.jUXZ=r,n.OOsw=i,n.moyq=o,"termination"===s&&""!==s){n.VHgA.parse(e);return n.bXqj=n.VHgA.zzXl,n.gUva(),!0}var u=n.UHEM.parse(e);if(u){if(n.zzXl=n.UHEM.zzXl,n.UHEM.Ziyx){var l=n.UHEM.xCDb.figp;"APX_PAGE_OPENED"===l&&(l=n.UHEM.xCDb.rXDy.navigation_id,l=d(l)?l:n.UHEM.xCDb.figp),n.aJVI=t.getController().getEventCount(l);var c=n.UHEM.eeAf,f=n.UHEM.FOfl;if(n.KWyt=n.ZQVH(n.aJVI-1,c,f,!1),n.dwoA=n.KWyt,n.KWyt&&"APX_PAGE_OPENED"===n.UHEM.xCDb.figp)return!0}return a&&0!==i||n.PaJS(),!0}return!1})),s(this,"PaJS",(function(){var t,e=n.UHEM,r=e.woYX,i=P.getInstance();"app_start"===r.tlgv?(n.dwoA=!0,i.registerForEvent(h(e.tlgv)+"___"+e.xCDb.figp,n.YgWO)):i.registerForEvent(h(e.tlgv)+"___"+r.xCDb.figp,n.YgWO),null!==(t=window.ApxorRTM)&&void 0!==t&&t.badgesLists.includes(n.jUXZ)&&i.registerForEvent(h(e.tlgv)+"___"+"apxor-badge-container-".concat("-".concat(n.jUXZ).replaceAll(" ","").replace(/[^\w\s]/gi,"")),n.YgWO)})),s(this,"gUva",(function(){var t=n.VHgA,e=P.getInstance();n.dwoA=!0,e.registerForEvent(h(t.tlgv)+"___"+t.xCDb.figp,n.cQYJ)})),s(this,"LcXc",(function(t,e,r,i){var a,o=(Date.now()-n.FJhx[e])/1e3;(null===(a=n.UHEM)||void 0===a||null===(a=a.xCDb)||void 0===a||null===(a=a.rXDy)||void 0===a?void 0:a.time)/1e3>o&&n._displayCampaign(r)})),s(this,"gLck",(function(t,e,r,i){var a,o;n.bNNf=!0;var s=Date.now(),u=null===(a=n.UHEM)||void 0===a||null===(a=a.woYX)||void 0===a?void 0:a.xCDb.figp,l=(s-n.FJhx[u])/1e3,c=null===(o=n.UHEM)||void 0===o||null===(o=o.xCDb)||void 0===o||null===(o=o.rXDy)||void 0===o?void 0:o.time;(c/=1e3)>l&&n._displayCampaign(r)})),s(this,"YgWO",(function(e,r,i,a){var o,s,u=P.getInstance();if(n.dwoA){if(null!==(o=window.ApxorRTM)&&void 0!==o&&o.isBadgePresent&&null!==(s=window.ApxorRTM)&&void 0!==s&&s.badgesLists.includes(n.jUXZ)&&t.getController().isBadgeTriggerSatisfied(n.jUXZ))return n.KWyt=!0,n.UHEM.wxRT=i,void u.validate(n.jUXZ,n.OOsw);h(n.UHEM.tlgv)===e&&n.tBEr(i-n.UHEM.woYX.wxRT,n.UHEM.uvCn)&&n.UHEM.xCDb.figp===r&&n.BSUO(n.UHEM.xCDb.rXDy,a)&&(n.Purf+=1,n.KWyt=n.ZQVH(n.Purf,n.UHEM.eeAf,n.UHEM.FOfl),n.KWyt&&(n.UHEM.wxRT=i,u.validate(n.jUXZ,n.OOsw)))}else if(n.dwoA=n.uXGd(e,r,i,a),n.dwoA){var l=n.UHEM,c=l.woYX;if(c.wxRT=i,"activity_time"===(null==l?void 0:l.tlgv)){var d,f,g,v=null==l||null===(d=l.xCDb)||void 0===d||null===(d=d.rXDy)||void 0===d?void 0:d.time;(null==l||null===(f=l.xCDb)||void 0===f||null===(f=f.rXDy)||void 0===f?void 0:f.nkpi.length)>0&&(setTimeout((function(){n.bNNf||(n.KWyt=!0,n.KWyt&&(n.Purf+=1,n.KWyt=n.ZQVH(n.Purf,n.UHEM.eeAf,n.UHEM.FOfl),n.KWyt&&(n.UHEM.wxRT=i,u.validate(n.jUXZ,n.OOsw)))),l.xCDb.rXDy.nkpi.map((function(t){u.unregisterFromEvent(p(l.xCDb.rXDy.et)+"___"+t,n)}))}),v),l.xCDb.rXDy.nkpi.map((function(t){u.registerForEvent(p(l.xCDb.rXDy.et)+"___"+t,n.gLck)}))),(null==l||null===(g=l.xCDb)||void 0===g||null===(g=g.rXDy)||void 0===g?void 0:g.kpi.length)>0&&(setTimeout((function(){l.xCDb.rXDy.kpi.map((function(t){u.unregisterFromEvent(p(l.xCDb.rXDy.et)+"___"+t,n)}))}),v),l.xCDb.rXDy.kpi.map((function(t){t===l.woYX.xCDb.figp?(u.unregisterFromEvent(h(c.tlgv)+"___"+c.xCDb.figp,n),u.registerForEvent(p(l.xCDb.rXDy.et)+"___"+t,n.LcXc)):u.registerForEvent(p(l.xCDb.rXDy.et)+"___"+t,n.gLck)})))}else u.unregisterFromEvent(h(c.tlgv)+"___"+c.xCDb.figp,n),u.registerForEvent(h(l.tlgv)+"___"+l.xCDb.figp,n);n.FJhx[r]=Date.now()}})),s(this,"cQYJ",(function(t,e,r,i){var a=P.getInstance();h(n.VHgA.tlgv)===t&&n.tBEr(r,n.VHgA.uvCn)&&n.VHgA.xCDb.figp===e&&n.BSUO(n.VHgA.xCDb.rXDy,i)&&(n.Purf+=1,n.KWyt=n.ZQVH(n.Purf,n.VHgA.eeAf,n.VHgA.FOfl),n.KWyt&&(n.VHgA.wxRT=r,a.validateForTermination(n.jUXZ,n.OOsw)))})),s(this,"uXGd",(function(t,e,r,i){var a=n.UHEM.woYX;return h(a.tlgv)===t&&a.xCDb.figp===e&&n.tBEr(r,a.uvCn)&&n.BSUO(a.xCDb.rXDy,i)})),s(this,"tBEr",(function(t,e){var n=Math.ceil(t);return n>e.serE&&n<e.DOnR})),s(this,"ZQVH",(function(t,e,r){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(i&&n.UHEM.Ziyx&&(t+=n.aJVI),r){case"EQ":return t===e;case"GT":return t>e;case"GTE":return t>=e;case"LT":return t<e;case"LTE":return t<=e;default:return!1}})),s(this,"BSUO",(function(t,e){var n=!0;try{var i,a=function(){if(!e[o]||!1===n)return{v:!1};if("object"===r(t[o])){var i,a=t[o].op,s=t[o].t;"s"===s?i=t[o].val:"l"!==s&&"f"!==s||(i=parseFloat(t[o].val));var u=(Array.isArray(e[o])?e[o]:[e[o]]).some((function(t){return _(t,i,a)}));n=n&&u}else n=n&&_(e[o],t[o],"EQ")};for(var o in t)if(i=a())return i.v}catch(t){M.error(t),n=!1}return n}))}return o(e,[{key:"_displayCampaign",value:function(t){var e=P.getInstance();this.KWyt=!0,this.KWyt&&(this.Purf+=1,this.KWyt=this.ZQVH(this.Purf,this.UHEM.eeAf,this.UHEM.FOfl),this.KWyt&&(this.UHEM.wxRT=t,e.validate(this.jUXZ,this.OOsw)))}}]),e}(),j=window.ApxorLogger,F=o((function e(){var n=this;i(this,e),s(this,"zlRP",[]),s(this,"_ret_day",{}),s(this,"UUEf",{}),s(this,"jxTr",!1),s(this,"kPcF",!1),s(this,"retainedDaysValidated",!0),s(this,"retainedSessionValidated",!0),s(this,"eventDoneInLT",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{n.zlRP=t.overall_cfg.events,n._ret_day=t.overall_cfg.ret_day,n.UUEf=t.overall_cfg.session,n.jxTr=t.overall_cfg.toggleRetDay,n.kPcF=t.overall_cfg.toggleSession}catch(t){return j.error(t),!1}return!0})),s(this,"validate",(function(){var e=parseInt(t.getController().getFromStorage("apx_retained_days")),r=parseInt(t.getController().getFromStorage("apx_retained_session"));if(n.jxTr&&!isNaN(e)&&!(e>=n._ret_day.from&&e<=n._ret_day.to))return n.retainedDaysValidated=!1,!1;if(n.kPcF&&!isNaN(r)&&!(r>=n.UUEf.from&&r<=n.UUEf.to))return n.retainedSessionValidated=!1,!1;try{for(var i=t.getController().getFromStorage("_apx_lt_count"),a=t.getSiteId(),o=JSON.parse((new TextDecoder).decode(function(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return e}(v(a,i)))),s=0;s<n.zlRP.length;s++){if(o[n.zlRP[s].name.replace("'","").replace("’","")])return n.eventDoneInLT=!0,!1}}catch(t){j.error("Failed to validate the lt count:"+t)}return!0}))})),q=window.ApxorLogger,H=o((function t(){var e=this;i(this,t),s(this,"KWLx",[]),s(this,"YkGb",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.KWLx=t.attributes.user,e.YkGb=t.attributes.session,!Array.isArray(e.KWLx)||!Array.isArray(e.YkGb))return q.error("No attributes"),!1}catch(t){return q.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.hTqd(t,e.KWLx)&&e.hTqd(n,e.YkGb)})),s(this,"hTqd",(function(t,e){var n=e.length,r=!0;try{for(var i,a=function(){var n=e[o];if(!t[n.name]||!1===r)return{v:!1};var i=n.operator,a=n.type,s=n.value.map((function(t){return"s"===a?t:"l"===a?parseInt(t):"f"===a?parseFloat(t):void 0})),u=(Array.isArray(t[n.name])?t[n.name]:[t[n.name]]).some((function(t){return s.some((function(e){return _(t,e,i)}))}));r=r&&u},o=0;o<n;o++)if(i=a())return i.v}catch(t){q.error(t),r=!1}return r}))})),I=o((function e(){var n=this;i(this,e),s(this,"sKMB",t.getController()),s(this,"type",""),s(this,"_duration_seconds",0),s(this,"EUqu",1),s(this,"parse",(function(t){try{var e,r,i;if(n.Lecg=null===(e=t.terminate_info.time_based)||void 0===e?void 0:e.type,n._duration_seconds=null===(r=t.terminate_info)||void 0===r?void 0:r.time_based.duration_seconds,n.EUqu=null===(i=t.terminate_info.time_based)||void 0===i?void 0:i.days,n.Pflq(t._id))return n.sKMB.persistTerminationInfoLocally(t._id),!1}catch(t){return!1}return!0})),s(this,"Pflq",(function(t){var e,r=JSON.parse(n.sKMB.getFromStorage("apx_termination_ID"));if(!r[t]||null===(e=r[t])||void 0===e||!e.startDate)return!1;var i,a=new Date(r[t].startDate),o=new Date((i=new Date).getMonth()+"/"+i.getDate()+"/"+i.getFullYear()),s=parseInt((o-a)/864e5,10),u=function(){var t=new Date;return{hours:t.getHours(),mins:t.getMinutes()}}(),l=r[t].tgyZ;return s===n.EUqu&&u.hours>=l.hours||s>n.EUqu||r[t].goalAcheived}))})),V=o((function t(){var e=this;i(this,t),s(this,"enable_goal_events",!1),s(this,"attributes",{}),s(this,"GeVn",new H),s(this,"YOHg",new I),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var n,r,i;if(e.enable_time_based=null==t||null===(n=t.terminate_info)||void 0===n?void 0:n.enable_time_based,e.enable_time_based&&!e.YOHg.parse(t))return!1;if(e.enable_goal_events=null==t||null===(r=t.terminate_info)||void 0===r?void 0:r.enable_goal_events,e.enable_attributes=null==t||null===(i=t.terminate_info)||void 0===i?void 0:i.enable_attributes,e.enable_attributes&&!e.GeVn.parse(t.terminate_info))return!1}catch(t){return window.ApxorLogger.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.GeVn.validate(t,n)}))})),k=window.ApxorLogger,N=o((function e(){var r=this;i(this,e),s(this,"CVRh",[]),s(this,"AHwj",[]),s(this,"jUXZ",""),s(this,"ByBE",new w),s(this,"bgGW",new m),s(this,"xdhp",new D),s(this,"AIgt",new A),s(this,"IQFR",new F),s(this,"fgQe",new V),s(this,"DAMl",!1),s(this,"iODJ",[]),s(this,"_variant_code",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var e;if(!d(t._id))return k.error("No Id"),!1;if(!d(t.enabled)||!t.enabled)return k.error("Not enabled"),!1;if(!(r.ByBE.parse(t)&&r.xdhp.parse(t)&&r.AIgt.parse(t)&&r.bgGW.parse(t)&&r.IQFR.parse(t)&&r.fgQe.parse(t)))return!1;if(r._variant_code=r.ByBE._isExperiment||r.ByBE._only_context?null===(e=r.ByBE._attr)||void 0===e?void 0:e.apx_variant_code:"TG",!d(t.conditions)||!Array.isArray(t.conditions))return k.error("No valid conditions",t.conditions),!1;r.jUXZ=t._id,r.DAMl=!!d(t.sequence_enabled)&&t.sequence_enabled,r.DAMl&&t.conditions.sort((function(t,e){return t.sequence<e.sequence}));for(var n=t.conditions,i=n.length,a=0;a<i;a++){r.iODJ=[];var o=n[a];if("didn't"===o.type){var s,l={trigger_key:o.trigger.details.name,no_kpi_array:null==o||null===(s=o.details)||void 0===s||null===(s=s.additional_info)||void 0===s?void 0:s.nkpi,condition_id:null==o?void 0:o._id,time_bounds:o.time_bounds.upper};r.iODJ=[].concat(u(r.iODJ),[l])}var c=new R;c.initialize(o,r.jUXZ,a,r.DAMl,r.iODJ)&&r.CVRh.push(c)}if(r.fgQe.enable_goal_events)for(var f=t.terminate_info.goal_events.events,g=f.length,v=0;v<g;v++){var h=new R;h.initialize(f[v],r.jUXZ,v,!0,[],"termination")&&r.AHwj.push(h)}return r.CVRh.length>0}catch(t){return k.error(t),!1}})),s(this,"uhJX",(function(t){if(!(t<0))if(r.DAMl){var e=r.CVRh[t];if(d(e)&&e.KWyt){var n=r.CVRh[t-1];if(d(n)&&!n.KWyt)return;var i=r.CVRh[t+1];d(i)?i.PaJS():r.CdpR()}}else r.CdpR()})),s(this,"gtHb",(function(t){t<0||r.MQhs()})),s(this,"CdpR",(function(){var e=t.getController().getUserAttributes(),i=t.getController().getSessionAttributes();if(!r.xdhp.validate()||!r.bgGW.validate(e,i)||!r.IQFR.validate())return r.IQFR.retainedDaysValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Retained day criteria not met"}),r.IQFR.retainedSessionValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"User session criteria not met"}),r.IQFR.eventDoneInLT&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Event done in life time"})),r.bgGW.userAttributesValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"User property filter not met"}),r.bgGW.sessionAttributeValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Session property filter not met"}),r.xdhp._not_yet_active&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"nudge not yet active"})),void(r.xdhp._nudge_expired&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"nudge expired"})));for(var a=r.CVRh.length,o=a<1,s="",u=0;u<a;u++){var l=r.CVRh[u],c=l.KWyt;if(""===s.trim())o=c;else switch(s){case"AND":o=o&&c;break;case"OR":o=o||c}s=l.zzXl}if(o){var d,f;if(console.debug("onCondition satisfied"),!r.AIgt.iOMM(r.jUXZ))return console.warn("Maximum limit reached",r.jUXZ),void(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Campaign limit reached"}));null!==(d=window.ApxorRTM)&&void 0!==d&&d.isBadgePresent&&null!==(f=window.ApxorRTM)&&void 0!==f&&f.badgesLists.includes(r.jUXZ)&&t.getController().isBadgeTriggerSatisfied(r.jUXZ)||null==t||t.logEvent("apx_trigger_satisfied",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG"}),console.log("Dispatching event",r.ByBE.Lecg),!0===r.ByBE._only_context&&t.logEvent("apx_context_evaluated",n(n({},r.ByBE._attr),{},{message_name:r.ByBE.figp,id:r.jUXZ})),t.getController().dispatchEvent(r.ByBE.Lecg,{name:r.ByBE.Lecg,additional_info:{uuid:r.jUXZ,name:r.ByBE.figp}})}})),s(this,"MQhs",(function(){for(var e=r.AHwj.length,i=e<1,a="",o=0;o<e;o++){var s=r.AHwj[o],u=s.KWyt;if(""===a.trim())i=u;else switch(a){case"AND":i=i&&u;break;case"OR":i=i||u}a=s.bXqj}i&&(console.log("Dispatching event",r.ByBE.Lecg),t.getController().persistTerminationInfoLocally(r.jUXZ),!0===r.ByBE._only_context&&t.logEvent("apx_context_evaluated",n(n({},r.ByBE._attr),{},{message_name:r.ByBE.figp,id:r.jUXZ})),t.getController().dispatchEvent(r.ByBE.Lecg,{name:r.ByBE.Lecg,additional_info:{uuid:r.jUXZ,name:r.ByBE.figp}}))})),s(this,"validateForTerminationAttributes",(function(){var e=t.getController().getUserAttributes(),n=t.getController().getSessionAttributes();return r.fgQe.validate(e,n)})),s(this,"ikdS",(function(){r.AIgt.ikdS()})),s(this,"getFrequencyCount",(function(){return r.AIgt.getFrequencyCount()})),s(this,"trLO",(function(){return r.AIgt.MdUm()}))})),Z=o((function t(){var e=this;i(this,t),s(this,"XDsl",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{configs:[]};if(d(t)&&d(t.configs)){var n=t.configs;if(!Array.isArray(n))return;n.sort((function(t,e){var n,r;return(null!==(n=t.prio)&&void 0!==n?n:-1)-(null!==(r=e.prio)&&void 0!==r?r:-1)}));for(var r=0;r<n.length;r++){var i=n[r],a=i._id,o=new N;o.parse(i)?e.XDsl[a]=o:console.warn("Failed to parse cfg",a)}}})),s(this,"validate",(function(t,n){e.XDsl[t]&&e.XDsl[t].uhJX(n)})),s(this,"getVariantCode",(function(t){return e.XDsl[t]?e.XDsl[t]._variant_code:""})),s(this,"validateForTermination",(function(t,n){e.XDsl[t]&&e.XDsl[t].gtHb(n)})),s(this,"validateForTerminationAttributes",(function(t){return!!e.XDsl[t]&&e.XDsl[t].validateForTerminationAttributes()})),s(this,"ikdS",(function(t){e.XDsl[t].ikdS()})),s(this,"getFrequencyCount",(function(t){return e.XDsl[t].getFrequencyCount()})),s(this,"resetFrequencyCounts",(function(){var t=e.XDsl;for(var n in t)t[n].trLO()})),s(this,"jMAH",(function(t){try{if(e.XDsl){var n=e.XDsl[t];if(n&&n.ByBE)return n.ByBE}}catch(t){console.log("Error in getting the campaign meta ".concat(t))}return{}}))})),W=window.ApxorLogger,Q=o((function e(){var n=this;i(this,e),s(this,"rnqO",{}),s(this,"jgKf",[]),s(this,"isEr",!1),s(this,"initialize",(function(){var e=t.getController();e.registerForEvent("APP_EVENT",(function(t){return n.OmRD(t,"AE")})),e.registerForEvent("CLIENT_EVENT",(function(t){return n.OmRD(t,"CE")}))})),s(this,"uHZe",(function(){for(var t in n.jgKf)n.gOcO(t.event,t.key,t.type);n.isEr=!0})),s(this,"dgAX",(function(t,e){var r;"function"==typeof e&&((r=n.rnqO[t]?n.rnqO[t]:[]).push(e),n.rnqO[t]=r,W.debug("Listeners list: ",n.rnqO))})),s(this,"unregisterFromEvent",(function(t,e){if(n.rnqO[t]){for(var r=n.rnqO[t],i=[],a=0;a<r.length;a++){var o=r[a];o!==e&&i.push(o)}n.rnqO[t]=i}})),s(this,"OmRD",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AE",r=e+"___"+t.name;n.gOcO(t,r,e)})),s(this,"gOcO",(function(e,r,i){if(n.isEr){if(W.debug("Notifying listeners for event: "+e+", "+r,n.rnqO),n.rnqO[r])for(var a=n.rnqO[r],o=t.getController().getSDKRunningTimeInSec(),s=0;s<a.length;s++){(0,a[s])(i,e.name,o,e.additional_info)}}else n.jgKf.push({event:e,key:r,type:i})}))})),Y=window.ApxorLogger,P=function(){function e(){var n=this;return i(this,e),s(this,"qwnH",!1),s(this,"MWAY",null),s(this,"dOSQ",E()),s(this,"aXRJ",new Q),s(this,"yjQV",t.getSiteId()),s(this,"oLkt",{}),s(this,"getQeState",(function(){try{var e=t.getController().getFromStorage("qe_state");return e?JSON.parse(v(n.yjQV,e)):(n.oLkt={},n.setQeState())}catch(t){return n.oLkt={},n.setQeState()}})),s(this,"setQeState",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{t.getController().persistToStorage("qe_state",n.oLkt,!0)}catch(r){""===e?n.oLkt={}:n.oLkt[e]={SESSION:0,OVERALL:0,DATES:{}},t.getController().persistToStorage("qe_state",n.oLkt,!0)}return n.oLkt})),s(this,"initialize",(function(){n.qwnH||(n.qwnH=!0,n.MWAY=new Z,n.aXRJ.initialize(),n.oLkt=n.getQeState(),Y.info("QE Initialized.."))})),s(this,"parse",(function(t){n.lGLs()?(n.MWAY.parse(t),n.aXRJ.uHZe()):Y.warn("Must call init first. Unable to proceed")})),s(this,"validate",(function(t,e){n.lGLs()&&n.MWAY.validate(t,e)})),s(this,"getVariantCode",(function(t){return n.MWAY.getVariantCode(t)})),s(this,"validateForTermination",(function(t,e){n.lGLs()&&n.MWAY.validateForTermination(t,e)})),s(this,"validateForTerminationAttributes",(function(t,e){return n.MWAY.validateForTerminationAttributes(t,e)})),s(this,"updateCount",(function(t){try{d(n.oLkt[t])||n.createObjConfig(t),n.incrementFrequencies(t),n.setQeState(t),n.MWAY.ikdS(t)}catch(t){console.log("Could not update the count config:".concat(t))}})),s(this,"resetFrequencyCounts",(function(){n.MWAY.resetFrequencyCounts()})),s(this,"getFrequencyCount",(function(t){return n.MWAY.getFrequencyCount(t)})),s(this,"registerForEvent",(function(t,e){n.aXRJ.dgAX(t,e)})),s(this,"unregisterFromEvent",(function(t,e){n.aXRJ.unregisterFromEvent(t,e)})),s(this,"notifyEventListener",(function(t){n.aXRJ.OmRD(t)})),s(this,"fetch",(function(e,n,r,i){t.getController().fetchConfiguration(e,n,r,i)})),s(this,"lGLs",(function(){return n.qwnH})),s(this,"getCampaignMetaFromQueryEngine",(function(t){return n.MWAY.jMAH(t)})),s(this,"hUQY",(function(){return n.dOSQ})),e.instance||(e.instance=this),e.instance}return o(e,[{key:"createObjConfig",value:function(t){try{this.oLkt=this.getQeState(),d(this.oLkt[t])||(this.oLkt[t]={SESSION:0,OVERALL:0,DATES:{}},this.dOSQ&&(this.oLkt[t].DATES[this.dOSQ]=0),this.setQeState(t))}catch(t){Y.error("Can not create the frequency count object:"+t)}}},{key:"incrementFrequencies",value:function(t){this.oLkt=this.getQeState();var e=this.oLkt[t];e.SESSION=e.SESSION+1,e.OVERALL=e.OVERALL+1;var n=E();n===this.dOSQ&&e.DATES&&e.DATES[n]||(this.dOSQ=n,e.DATES={},e.DATES[this.dOSQ]=0),e.DATES[this.dOSQ]=e.DATES[this.dOSQ]+1}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}();s(P,"instance",void 0),window.ceVersion=151;try{void 0===exports&&null===exports||(exports.default=P,module.exports=exports.default)}catch(t){}return P}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("apxor")):"function"==typeof define&&define.amd?define(["apxor"],e):(t=t||self)["apxor-qe"]=e(t.Apxor)}(this,(function(t){"use strict";function e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function n(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){s(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,c(i.key),i)}}function a(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t){return function(t){if(Array.isArray(t))return u(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return u(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function c(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var f=window.ApxorLogger,h=function(t){return void 0!==t&&!function(t){return null===t}(t)},d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function v(t,e){return Array.from(e).map((function(e,n){return String.fromCharCode(e^function(t,e){return t.charCodeAt(Math.floor(e%t.length))}(t,n))})).join("")}var g=function(t,e){return v(t,e=function(t){var e,n,i,r,o,a,s=0,l=[];if(!t)return t;t+="";do{e=(a=d.indexOf(t.charAt(s++))<<18|d.indexOf(t.charAt(s++))<<12|(r=d.indexOf(t.charAt(s++)))<<6|(o=d.indexOf(t.charAt(s++))))>>16&255,n=a>>8&255,i=255&a,l.push(e),64!==r&&(l.push(n),64!==o&&l.push(i))}while(s<t.length);return l}(e))},p=function(t){switch(t){case"app_event":return"AE";case"client_event":return"CE";case"activity_time":case"activity_event":return"AE"}return"Unknown"},y=function(t){return t.toUpperCase()},_=function(t,e,n){switch(n){case"EQ":return t===e;case"GT":return t>e;case"GTE":return t>=e;case"LT":return t<e;case"LTE":return t<=e;case"NEQ":return t!==e;case"R":return m(e).test(t);default:return!1}},m=function(t){var e=t.replace(/.*\/([gimuy]*)$/,"$1");e===t&&(e="");var n=e?t.replace(new RegExp("^/(.*?)/"+e+"$"),"$1"):t;return new RegExp(n,e)},b=function(){var t=new Date;return t.getDate()+"/"+t.getMonth()+"/"+t.getFullYear()},L=function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r="([^/]+)",o=n?n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"):"",a=e.replace(new RegExp(o,"g"),r),s=new RegExp("^".concat(a)+(i?"":"$")),l=t.match(s);return null!==l};function w(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,o=A(t,e);if(o){var a=function(){if(S(o)){return function(t){return x(t)}(o)}return f.info("Invalid target element. Width and height are 0 for element: ".concat(t,". Can't show tooltip")),!1};return a()}return n?(f.info("Not found yet. Rechecking the DOM."),E(r,i,t,e)):(f.info("Element with selector:".concat(t," not found.")),!1)}function E(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=setInterval((function(){var e=A(n,i);if(e){clearInterval(r);!function(){if(S()){x()}else f.info("Invalid target element. Width and height are 0 for element: ".concat(n,". Can't show tooltip"))}()}else(t-=1)<=0&&(clearInterval(r),console.warn("Element with selector:".concat(n," not found.")))}),e)}var A=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=document.getElementById(t);if(!i)try{i=document.querySelector(t)}catch(t){window.ApxorLogger.error("Error finding element in DOM:"+t)}(i||(i=O(t)),!i&&n.length>0)&&(i=null===(e=document.getElementById(n))||void 0===e||null===(e=e.contentWindow)||void 0===e||null===(e=e.document)||void 0===e?void 0:e.querySelector(t));return i},O=function(t){var e=t.indexOf("svg");-1!==e&&(t=t.substring(0,e)+"svg:svg");try{return document.iHps(t,document,(function(t){return"svg"===t?"http://www.w3.org/2000/svg":null}),XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch(t){window.ApxorLogger.error("Error finding element in DOM:"+t)}return null};function S(t){try{var e=t.getBoundingClientRect();if(0===e.width||0===e.height)return!1}catch(t){return!1}return!0}function x(t){var e,n,i,r;return!!(n=(e=t).offsetHeight,i=e.offsetWidth,(r=e.getBoundingClientRect()).left>=-i&&r.top>=-n&&r.right<=(window.innerWidth||document.documentElement.clientWidth)+i&&r.bottom<=(window.innerHeight||document.documentElement.clientHeight)+n)}var N=function(t){var e='\n <style> \n .apx-container{\n padding:10px;\n }\n </style>\n <div id="apx-innerElement" class="apx-container">\n <div id="close-button" style="cursor: pointer;position:absolute;top:9px;right:9px;"><svg width="11" height="11" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path opacity="0.5" d="M11.0962 9.07071L17.8586 15.8331L15.8331 17.8586L9.0707 11.0962L8.99999 11.0255L8.92928 11.0962L2.16693 17.8586L0.141421 15.8331L6.90379 9.07071L6.9745 9L6.90379 8.92929L0.141421 2.16694L2.16693 0.141422L8.92928 6.9038L8.99999 6.97451L9.0707 6.9038L15.8331 0.141422L17.8586 2.16694L11.0962 8.92929L11.0255 9L11.0962 9.07071Z" fill="white" stroke="#002845" stroke-width="0.2"/>\n </svg>\n </div>\n <div style="font-family: inherit;font-style: normal;font-weight: 600;font-size: 16px;line-height: 22px;\n color: #FFFFFF; display: flex; gap: 12px;"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-circle-check-filled" width="33" height="33" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff" fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="none" d="M0 0h24v24H0z" fill="none"/>\n <path d="M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z" stroke-width="0" fill="currentColor" />\n</svg><div style = "align-self: center;padding-right:20px;">'.concat(t,"</div></div>\n </div>\n "),n=document.createElement("div");n.style="\n z-index:99999999;\n background:#16202f;\n position:fixed;\n top:1%;\n right:1%;\n border-radius: 12px;\n ",n.innerHTML=e,n.id="apx-container",document.body.appendChild(n)},D=window.ApxorLogger,z=a((function e(){var n=this;r(this,e),s(this,"ARue","ALL"),s(this,"LpbY",[]),s(this,"Hlto",[]),s(this,"userAttributesValidated",!0),s(this,"sessionAttributeValidated",!0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(n.ARue=t.audience.audience_type,n.LpbY=t.audience.attributes.user,n.Hlto=t.audience.attributes.session,!Array.isArray(n.LpbY)||!Array.isArray(n.Hlto))return D.error("No attributes"),!1}catch(t){return D.error(t),!1}return!0})),s(this,"validate",(function(e,i){var r=!0;"FTU"===n.ARue&&(r=t.getController().getSessionInfo().is_first_session);var o=n.asXO(e,n.LpbY),a=n.asXO(i,n.Hlto);return o||(n.userAttributesValidated=!1),a||(n.sessionAttributeValidated=!1),r&&o&&a})),s(this,"asXO",(function(t,e){var n=e.length,i=!0;try{for(var r,o=function(){var n=e[a];if(void 0===t[n.name]||!1===i)return{v:!1};var r=n.operator,o=n.type,s=n.value.map((function(t){if("s"===o)return t;if("l"===o)return parseInt(t);if("f"===o)return parseFloat(t);if("b"===o)switch(t){case"true":return!0;case"false":return!1;default:return t}})),l=(Array.isArray(t[n.name])?t[n.name]:[t[n.name]]).some((function(t){return s.some((function(e){return"s"===o?t="".concat(t):"l"===o?t=parseInt(t):"f"===o?t=parseFloat(t):"b"===o&&(t=!!t),_(t,e,r)}))}));i=i&&l},a=0;a<n;a++)if(r=o())return r.v}catch(t){D.error(t),i=!1}return i}))})),k=window.ApxorLogger,I=a((function e(){var n=this;r(this,e),s(this,"gJSN",0),s(this,"XtEG",0),s(this,"lrki","SESSION"),s(this,"pTMN",0),s(this,"rzbk",0),s(this,"GsAb",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{n.ltQf=t._id,n.liLD=t.meta,n.gJSN=t.frequency.count,-1===n.gJSN&&(n.gJSN=1e3),n.GsAb=n.gJSN,n.XtEG=t.frequency.time_interval,n.lrki=t.frequency.validity,n.rzbk=t.frequency.ses_lmt,n._dayCount=t.frequency.day_lmt;var e=rt.getInstance().getQeState();if(!h(e)||!h(e[t._id]))return!0;if("SESSION"===n.lrki){if(n.gJSN=parseInt(n.gJSN)-parseInt(e[t._id].SESSION),n.gJSN<=0)return n.zMgT("Session limit reached"),console.warn("Max count limit reached for session:"+t._id),!1}else{if("OVERALL"!==n.lrki)return k.info("Invalid config."),!1;if(n.gJSN=parseInt(n.gJSN)-parseInt(e[t._id].OVERALL),n.gJSN<=0)return n.zMgT("Overall limit reached"),console.warn("Max count limit reached for overall:"+t._id),!1}}catch(t){return k.error(t),!1}return!0})),s(this,"GDwW",(function(){n.gJSN=n.gJSN-1})),s(this,"getFrequencyCount",(function(){return n.gJSN})),s(this,"MYCG",(function(){"SESSION"===n.lrki&&(n.gJSN=n.GsAb,k.info("Campaign Limit reset"))})),s(this,"gbnE",(function(t){try{if(n.gJSN<=0)return"OVERALL"===n.lrki?n.zMgT("Overall limit reached"):"SESSION"===n.lrki&&n.zMgT("Session limit reached"),!1;var e=rt.getInstance().getQeState();if(!h(e)||!h(e[t]))return!0;if(0!==n.rzbk)if(parseInt(n.rzbk)-parseInt(e[t].SESSION)<=0)return n.zMgT("Session limit reached"),!1;if(0!==n._dayCount){var i,r=b();if(parseInt(n._dayCount)-parseInt((null===(i=e[t])||void 0===i?void 0:i.DATES[r])||0)<=0)return n.zMgT("Day limit reached"),!1}}catch(t){n.zMgT("Error validating the frequency: ".concat(t)),k.error("Error validating the frequency:"+t)}return!0})),s(this,"zMgT",(function(e){var i;null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===n.liLD.type?"survey":"campaign",apx_nudge_id:n.ltQf,apx_nudge_name:n.liLD.name,apx_variant_code:n.liLD.isExperiment||n.liLD.only_context?null===(i=n.liLD.attr)||void 0===i?void 0:i.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:e})}))})),T=a((function t(){var e=this;r(this,t),s(this,"gNrp",""),s(this,"ARue",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var n,i;e.gNrp=t.meta.name,e.ARue=t.meta.type,e._only_context=t.meta.only_context,e._attr=(null===(n=t.meta)||void 0===n?void 0:n.attr)||{},e._isExperiment=null===(i=t.meta)||void 0===i?void 0:i.isExperiment}catch(t){return window.ApxorLogger.error(t),!1}return!0}))})),C=window.ApxorLogger,U=a((function t(){var e=this;r(this,t),s(this,"Qnke",-1),s(this,"iLgX",-1),s(this,"EfLi",-1),s(this,"PpNt",-1),s(this,"VIcS",!1),s(this,"_nudge_expired",!1),s(this,"_not_yet_active",!1),s(this,"_not_in_specified_time",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(isNaN(Date.parse(t.validity.start_date))||isNaN(Date.parse(t.validity.end_date)))return C.error("Not valid dates"),!1;if(e.Qnke=Date.parse(t.validity.start_date),e.iLgX=Date.parse(t.validity.end_date),h(t.at_specific_time)&&(e.VIcS=t.at_specific_time,e.VIcS&&h(t.time_limits))){var n=(new Date).toISOString().split("T")[0];if(e.EfLi=Date.parse(n+"T"+t.time_limits.start_time+":00.000Z"),e.PpNt=Date.parse(n+"T"+t.time_limits.end_time+":00.000Z"),isNaN(e.EfLi)||isNaN(e.PpNt))return C.error("Not valid times"),!1}}catch(t){return C.error(t),!1}return!0})),s(this,"validate",(function(){var t=Date.now();return t>e.Qnke&&t<e.iLgX?(!e.VIcS||t>=e.EfLi&&t<=e.PpNt||(e._not_in_specified_time=!0),!e.VIcS||t>=e.EfLi&&t<=e.PpNt):(t<e.Qnke?e._not_yet_active=!0:t>e.iLgX&&(e._nudge_expired=!0),!1)}))})),V=a((function t(){var e=this;r(this,t),s(this,"gNrp",""),s(this,"PvVy",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.gNrp=t.name,e.PvVy=t.additional_info}catch(t){return!1}return!0}))})),F=a((function t(){var e=this;r(this,t),s(this,"ejXF",0),s(this,"dQza",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.ejXF=Number(t.lower),e.dQza=Number(t.upper),isNaN(e.ejXF)||isNaN(e.dQza))return!1}catch(t){return!1}return!0}))})),Q=a((function t(){var e=this;r(this,t),s(this,"OOcg",0),s(this,"vmZw",""),s(this,"aKIq",""),s(this,"UhhO",new V),s(this,"sMpO",new F),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.vmZw=t.event_type,e.aKIq=t.activity,e.UhhO.parse(t.details)&&e.sMpO.parse(t.time_bounds)}catch(t){return!1}}))})),Z=window.ApxorLogger,P=a((function t(){var e=this;r(this,t),s(this,"OOcg",0),s(this,"Nixp",-1),s(this,"gJSN",0),s(this,"zzjI",""),s(this,"aKIq",""),s(this,"vmZw",""),s(this,"sMpO",new F),s(this,"UhhO",new V),s(this,"iBqE",new Q),s(this,"mEtI","AND"),s(this,"xPfP",!1),s(this,"ARue",void 0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.Nixp=t.sequence,e.gJSN=t.count_config.count,e.zzjI=t.count_config.operator,e.aKIq=t.activity,e.vmZw=t.event_type,e.mEtI=t.combine_operator,e.ARue=t.type,e.UhhO.parse(t.details)&&e.iBqE.parse(t.trigger)&&e.sMpO.parse(t.time_bounds)}catch(t){return Z.error(t),!1}}))})),M=window.ApxorLogger,R=a((function t(){var e=this;r(this,t),s(this,"gJSN",0),s(this,"zzjI",""),s(this,"vmZw",""),s(this,"sMpO",new F),s(this,"UhhO",new V),s(this,"mEtI","AND"),s(this,"parse",(function(t){try{return e.gJSN=t.count_config.count,e.zzjI=t.count_config.operator,e.vmZw=t.event_type,e.mEtI=t.combine_operator,e.UhhO.parse(t.details)&&e.sMpO.parse(t.time_bounds)}catch(t){return M.error(t),!1}}))})),j=window.ApxorLogger,q=function(){function e(){var n=this;r(this,e),s(this,"zfeU",0),s(this,"ltQf",""),s(this,"LnyZ",new P),s(this,"gYxJ",new R),s(this,"rrDQ",!1),s(this,"kpHz",!1),s(this,"yvsV",0),s(this,"mEtI","AND"),s(this,"aCAW","OR"),s(this,"WXbt",-1),s(this,"jzCx",[]),s(this,"uNrb",{}),s(this,"WWDG",!1),s(this,"initialize",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";if(n.ltQf=i,n.yvsV=r,n.jzCx=a,"termination"===s&&""!==s){n.gYxJ.parse(e);return n.aCAW=n.gYxJ.mEtI,n.maFW(),!0}var l=n.LnyZ.parse(e);if(l){if(n.mEtI=n.LnyZ.mEtI,n.LnyZ.xPfP){var u=n.LnyZ.UhhO.gNrp;"APX_PAGE_OPENED"===u&&(u=n.LnyZ.UhhO.PvVy.navigation_id,u=h(u)?u:n.LnyZ.UhhO.gNrp),n.WXbt=t.getController().getEventCount(u);var c=n.LnyZ.gJSN,f=n.LnyZ.zzjI;if(n.kpHz=n.WCWA(n.WXbt-1,c,f,!1),n.rrDQ=n.kpHz,n.kpHz&&"APX_PAGE_OPENED"===n.LnyZ.UhhO.gNrp)return!0}return o&&0!==r||n.kpoN(),!0}return!1})),s(this,"kpoN",(function(){var t,e=n.LnyZ,i=e.iBqE,r=rt.getInstance();"app_start"===i.vmZw?(n.rrDQ=!0,r.registerForEvent(p(e.vmZw)+"___"+e.UhhO.gNrp,n.DTtA)):r.registerForEvent(p(e.vmZw)+"___"+i.UhhO.gNrp,n.DTtA),null!==(t=window.ApxorRTM)&&void 0!==t&&t.badgesLists.includes(n.ltQf)&&r.registerForEvent(p(e.vmZw)+"___"+"apxor-badge-container-".concat("-".concat(n.ltQf).replaceAll(" ","").replace(/[^\w\s]/gi,"")),n.DTtA)})),s(this,"maFW",(function(){var t=n.gYxJ,e=rt.getInstance();n.rrDQ=!0,e.registerForEvent(p(t.vmZw)+"___"+t.UhhO.gNrp,n.lTzm)})),s(this,"WPAT",(function(t,e,i,r){var o,a=(Date.now()-n.uNrb[e])/1e3;(null===(o=n.LnyZ)||void 0===o||null===(o=o.UhhO)||void 0===o||null===(o=o.PvVy)||void 0===o?void 0:o.time)/1e3>a&&n._displayCampaign(i)})),s(this,"TFdl",(function(t,e,i,r){var o,a;n.WWDG=!0;var s=Date.now(),l=null===(o=n.LnyZ)||void 0===o||null===(o=o.iBqE)||void 0===o?void 0:o.UhhO.gNrp,u=(s-n.uNrb[l])/1e3,c=null===(a=n.LnyZ)||void 0===a||null===(a=a.UhhO)||void 0===a||null===(a=a.PvVy)||void 0===a?void 0:a.time;(c/=1e3)>u&&n._displayCampaign(i)})),s(this,"DTtA",(function(e,i,r,o){var a,s,l=rt.getInstance();if(n.rrDQ){if(null!==(a=window.ApxorRTM)&&void 0!==a&&a.isBadgePresent&&null!==(s=window.ApxorRTM)&&void 0!==s&&s.badgesLists.includes(n.ltQf)&&t.getController().isBadgeTriggerSatisfied(n.ltQf))return n.kpHz=!0,n.LnyZ.OOcg=r,void l.validate(n.ltQf,n.yvsV);p(n.LnyZ.vmZw)===e&&n.AnPN(r-n.LnyZ.iBqE.OOcg,n.LnyZ.sMpO)&&n.LnyZ.UhhO.gNrp===i&&n.aZfX(n.LnyZ.UhhO.PvVy,o)&&(n.zfeU+=1,n.kpHz=n.WCWA(n.zfeU,n.LnyZ.gJSN,n.LnyZ.zzjI),n.kpHz&&(n.LnyZ.OOcg=r,l.validate(n.ltQf,n.yvsV)))}else if(n.rrDQ=n.LrmB(e,i,r,o),n.rrDQ){var u=n.LnyZ,c=u.iBqE;if(c.OOcg=r,"activity_time"===(null==u?void 0:u.vmZw)){var f,h,d,v=null==u||null===(f=u.UhhO)||void 0===f||null===(f=f.PvVy)||void 0===f?void 0:f.time;(null==u||null===(h=u.UhhO)||void 0===h||null===(h=h.PvVy)||void 0===h?void 0:h.nkpi.length)>0&&(setTimeout((function(){n.WWDG||(n.kpHz=!0,n.kpHz&&(n.zfeU+=1,n.kpHz=n.WCWA(n.zfeU,n.LnyZ.gJSN,n.LnyZ.zzjI),n.kpHz&&(n.LnyZ.OOcg=r,l.validate(n.ltQf,n.yvsV)))),u.UhhO.PvVy.nkpi.map((function(t){l.unregisterFromEvent(y(u.UhhO.PvVy.et)+"___"+t,n)}))}),v),u.UhhO.PvVy.nkpi.map((function(t){l.registerForEvent(y(u.UhhO.PvVy.et)+"___"+t,n.TFdl)}))),(null==u||null===(d=u.UhhO)||void 0===d||null===(d=d.PvVy)||void 0===d?void 0:d.kpi.length)>0&&(setTimeout((function(){u.UhhO.PvVy.kpi.map((function(t){l.unregisterFromEvent(y(u.UhhO.PvVy.et)+"___"+t,n)}))}),v),u.UhhO.PvVy.kpi.map((function(t){t===u.iBqE.UhhO.gNrp?(l.unregisterFromEvent(p(c.vmZw)+"___"+c.UhhO.gNrp,n),l.registerForEvent(y(u.UhhO.PvVy.et)+"___"+t,n.WPAT)):l.registerForEvent(y(u.UhhO.PvVy.et)+"___"+t,n.TFdl)})))}else l.unregisterFromEvent(p(c.vmZw)+"___"+c.UhhO.gNrp,n),l.registerForEvent(p(u.vmZw)+"___"+u.UhhO.gNrp,n);n.uNrb[i]=Date.now()}})),s(this,"lTzm",(function(t,e,i,r){var o=rt.getInstance();p(n.gYxJ.vmZw)===t&&n.AnPN(i,n.gYxJ.sMpO)&&n.gYxJ.UhhO.gNrp===e&&n.aZfX(n.gYxJ.UhhO.PvVy,r)&&(n.zfeU+=1,n.kpHz=n.WCWA(n.zfeU,n.gYxJ.gJSN,n.gYxJ.zzjI),n.kpHz&&(n.gYxJ.OOcg=i,o.validateForTermination(n.ltQf,n.yvsV)))})),s(this,"LrmB",(function(t,e,i,r){var o=n.LnyZ.iBqE;return p(o.vmZw)===t&&o.UhhO.gNrp===e&&n.AnPN(i,o.sMpO)&&n.aZfX(o.UhhO.PvVy,r)})),s(this,"AnPN",(function(t,e){var n=Math.ceil(t);return n>e.ejXF&&n<e.dQza})),s(this,"WCWA",(function(t,e,i){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(r&&n.LnyZ.xPfP&&(t+=n.WXbt),i){case"EQ":return t===e;case"GT":return t>e;case"GTE":return t>=e;case"LT":return t<e;case"LTE":return t<=e;default:return!1}})),s(this,"aZfX",(function(t,e){var n=!0;try{var r,o=function(){if(!1===n)return{v:!1};if("object"===i(t[a])){var r,o=t[a].op,s=t[a].t;if("s"===s)r=t[a].val;else if("l"===s||"f"===s)r=parseFloat(t[a].val);else if("b"===s)switch(t[a].val){case"true":r=!0;break;case"false":r=!1;break;default:r=t[a].val}var l=(Array.isArray(e[a])?e[a]:[e[a]]).some((function(t){return"s"===s?t="".concat(t):"l"===s?t=parseInt(t):"f"===s?t=parseFloat(t):"b"===s&&(t=!!t),_(t,r,o)}));n=n&&l}else n=n&&_(e[a],t[a],"EQ")};for(var a in t)if(r=o())return r.v}catch(t){j.error(t),n=!1}return n}))}return a(e,[{key:"_displayCampaign",value:function(t){var e=rt.getInstance();this.kpHz=!0,this.kpHz&&(this.zfeU+=1,this.kpHz=this.WCWA(this.zfeU,this.LnyZ.gJSN,this.LnyZ.zzjI),this.kpHz&&(this.LnyZ.OOcg=t,e.validate(this.ltQf,this.yvsV)))}}]),e}(),J=window.ApxorLogger,Y=a((function e(){var n=this;r(this,e),s(this,"MOQE",[]),s(this,"_ret_day",{}),s(this,"svXn",{}),s(this,"tkzI",!1),s(this,"paZC",!1),s(this,"retainedDaysValidated",!0),s(this,"retainedSessionValidated",!0),s(this,"eventDoneInLT",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{n.MOQE=t.overall_cfg.events,n._ret_day=t.overall_cfg.ret_day,n.svXn=t.overall_cfg.session,n.tkzI=t.overall_cfg.toggleRetDay,n.paZC=t.overall_cfg.toggleSession}catch(t){return J.error(t),!1}return!0})),s(this,"validate",(function(){var e=parseInt(t.getController().getFromStorage("apx_retained_days")),i=parseInt(t.getController().getFromStorage("apx_retained_session"));if(n.tkzI&&!isNaN(e)&&!(e>=n._ret_day.from&&e<=n._ret_day.to))return n.retainedDaysValidated=!1,!1;if(n.paZC&&!isNaN(i)&&!(i>=n.svXn.from&&i<=n.svXn.to))return n.retainedSessionValidated=!1,!1;try{for(var r=t.getController().getFromStorage("_apx_lt_count"),o=t.getSiteId(),a=JSON.parse((new TextDecoder).decode(function(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return e}(g(o,r)))),s=0;s<n.MOQE.length;s++){if(a[n.MOQE[s].name.replace("'","").replace("’","")])return n.eventDoneInLT=!0,!1}}catch(t){J.error("Failed to validate the lt count:"+t)}return!0}))})),H=window.ApxorLogger,W=a((function t(){var e=this;r(this,t),s(this,"LpbY",[]),s(this,"Hlto",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.LpbY=t.attributes.user,e.Hlto=t.attributes.session,!Array.isArray(e.LpbY)||!Array.isArray(e.Hlto))return H.error("No attributes"),!1}catch(t){return H.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.asXO(t,e.LpbY)&&e.asXO(n,e.Hlto)})),s(this,"asXO",(function(t,e){var n=e.length,i=!0;try{for(var r,o=function(){var n=e[a];if(!t[n.name]||!1===i)return{v:!1};var r=n.operator,o=n.type,s=n.value.map((function(t){return"s"===o?t:"l"===o?parseInt(t):"f"===o?parseFloat(t):void 0})),l=(Array.isArray(t[n.name])?t[n.name]:[t[n.name]]).some((function(t){return s.some((function(e){return _(t,e,r)}))}));i=i&&l},a=0;a<n;a++)if(r=o())return r.v}catch(t){H.error(t),i=!1}return i}))})),B=a((function e(){var n=this;r(this,e),s(this,"VYrJ",t.getController()),s(this,"type",""),s(this,"_duration_seconds",0),s(this,"ymgl",1),s(this,"parse",(function(t){try{var e,i,r;if(n.ARue=null===(e=t.terminate_info.time_based)||void 0===e?void 0:e.type,n._duration_seconds=null===(i=t.terminate_info)||void 0===i?void 0:i.time_based.duration_seconds,n.ymgl=null===(r=t.terminate_info.time_based)||void 0===r?void 0:r.days,n.bptN(t._id))return n.VYrJ.persistTerminationInfoLocally(t._id),!1}catch(t){return!1}return!0})),s(this,"bptN",(function(t){var e,i=JSON.parse(n.VYrJ.getFromStorage("apx_termination_ID"));if(!i[t]||null===(e=i[t])||void 0===e||!e.startDate)return!1;var r,o=new Date(i[t].startDate),a=new Date((r=new Date).getMonth()+"/"+r.getDate()+"/"+r.getFullYear()),s=parseInt((a-o)/864e5,10),l=function(){var t=new Date;return{hours:t.getHours(),mins:t.getMinutes()}}(),u=i[t].EfLi;return s===n.ymgl&&l.hours>=u.hours||s>n.ymgl||i[t].goalAcheived}))})),G=a((function t(){var e=this;r(this,t),s(this,"enable_goal_events",!1),s(this,"attributes",{}),s(this,"QkAi",new W),s(this,"vykZ",new B),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var n,i,r;if(e.enable_time_based=null==t||null===(n=t.terminate_info)||void 0===n?void 0:n.enable_time_based,e.enable_time_based&&!e.vykZ.parse(t))return!1;if(e.enable_goal_events=null==t||null===(i=t.terminate_info)||void 0===i?void 0:i.enable_goal_events,e.enable_attributes=null==t||null===(r=t.terminate_info)||void 0===r?void 0:r.enable_attributes,e.enable_attributes&&!e.QkAi.parse(t.terminate_info))return!1}catch(t){return window.ApxorLogger.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.QkAi.validate(t,n)}))})),X=a((function t(){var e=this;r(this,t),s(this,"vrga",""),s(this,"NSgn",""),s(this,"hgtN",""),s(this,"OmGM",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.vrga=null==t?void 0:t.screen_binding,!e.vrga||(e.NSgn=null==t?void 0:t.binding.url,e.hgtN=null==t?void 0:t.binding.var,e.OmGM=null==t?void 0:t.binding.operator,!0)}catch(t){return window.ApxorLogger.error(t),!1}})),s(this,"validate",(function(){var t=e.NSgn,n=e.hgtN,i=e.OmGM,r=window.location.href;return!e.vrga||("EQ"===i?t.includes(n)?!!L(r,t,n,!1):r===t:"SW"===i?t.includes(n)?!!L(r,t,n,!0):!!r.startsWith(t):void 0)}))})),K=window.ApxorLogger,$=a((function e(){var i=this;r(this,e),s(this,"lLoL",[]),s(this,"kuIQ",[]),s(this,"ltQf",""),s(this,"liLD",new T),s(this,"bEUi",new z),s(this,"lrki",new U),s(this,"Sfjv",new I),s(this,"qTcR",new Y),s(this,"DhFu",new G),s(this,"pEEU",new X),s(this,"YVfa",!1),s(this,"VKON",[]),s(this,"_variant_code",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var e;if(!h(t._id))return K.error("No Id"),!1;if(!h(t.enabled)||!t.enabled)return K.error("Not enabled"),!1;if(!(i.liLD.parse(t)&&i.lrki.parse(t)&&i.Sfjv.parse(t)&&i.bEUi.parse(t)&&i.qTcR.parse(t)&&i.DhFu.parse(t)&&i.pEEU.parse(t)))return!1;if(i._variant_code=i.liLD._isExperiment||i.liLD._only_context?null===(e=i.liLD._attr)||void 0===e?void 0:e.apx_variant_code:"TG",!h(t.conditions)||!Array.isArray(t.conditions))return K.error("No valid conditions",t.conditions),!1;i.ltQf=t._id,i.YVfa=!!h(t.sequence_enabled)&&t.sequence_enabled,i.YVfa&&t.conditions.sort((function(t,e){return t.sequence<e.sequence}));var n=t.conditions,r=n.length,o=null==t?void 0:t.no_context_enabled;0===r&&o&&i.ALzC();for(var a=function(){i.VKON=[];var t=n[s];if("didn't"===t.type){var e,r={trigger_key:t.trigger.details.name,no_kpi_array:null==t||null===(e=t.details)||void 0===e||null===(e=e.additional_info)||void 0===e?void 0:e.nkpi,condition_id:null==t?void 0:t._id,time_bounds:t.time_bounds.upper};i.VKON=[].concat(l(i.VKON),[r])}var o=new q;if(o.initialize(t,i.ltQf,s,i.YVfa,i.VKON)){i.lLoL.push(o);var a=(null==t?void 0:t.timeout)/(null==t?void 0:t.findinterval),u=(null==t?void 0:t.frameid)||"",c=null==t?void 0:t.url;window.location.href===c&&"view_visibility"===t.event_type&&!0===w(t.view_id,u,null==t?void 0:t.enable_retry,null==t?void 0:t.findinterval,a)&&i.ALzC(!0),window.addEventListener("navigate",(function(e){var n=null==t?void 0:t.url;window.location.href===n&&"view_visibility"===t.event_type&&!0===w(t.view_id,u,null==t?void 0:t.enable_retry,null==t?void 0:t.findinterval,a)&&i.ALzC(!0)}))}},s=0;s<r;s++)a();if(i.DhFu.enable_goal_events)for(var u=t.terminate_info.goal_events.events,c=u.length,f=0;f<c;f++){var d=new q;d.initialize(u[f],i.ltQf,f,!0,[],"termination")&&i.kuIQ.push(d)}return i.lLoL.length>0}catch(t){return K.error(t),!1}})),s(this,"iHps",(function(t){if(!(t<0))if(i.YVfa){var e=i.lLoL[t];if(h(e)&&e.kpHz){var n=i.lLoL[t-1];if(h(n)&&!n.kpHz)return;var r=i.lLoL[t+1];h(r)?r.kpoN():i.ALzC()}}else i.ALzC()})),s(this,"ybGY",(function(t){t<0||i.puwz()})),s(this,"ALzC",(function(){var e,r,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=t.getController().getUserAttributes(),s=t.getController().getSessionAttributes();if(null!==(e=window.ApxorRTM)&&void 0!==e&&e.isBadgePresent&&null!==(r=window.ApxorRTM)&&void 0!==r&&r.badgesLists.includes(i.ltQf)&&t.getController().isBadgeTriggerSatisfied(i.ltQf)||null==t||t.logEvent("apx_trigger_satisfied",{apx_nudge_type:"SURVEY"===i.liLD.ARue?"survey":"campaign",apx_nudge_id:i.ltQf,apx_nudge_name:i.liLD.gNrp,apx_variant_code:i.liLD._isExperiment||i.liLD._only_context?i.liLD._attr.apx_variant_code:"TG"}),!(i.lrki.validate()&&i.bEUi.validate(a,s)&&i.qTcR.validate()&&i.pEEU.validate()))return i.qTcR.retainedDaysValidated?i.qTcR.retainedSessionValidated?i.qTcR.eventDoneInLT?void i.zMgT("Event done in life time"):i.bEUi.userAttributesValidated?i.bEUi.sessionAttributeValidated?i.lrki._not_in_specified_time?void i.zMgT("Time limits check failed"):i.lrki._not_yet_active?void i.zMgT("not in the scheduled time"):i.lrki._nudge_expired?void i.zMgT("nudge expired"):void 0:void i.zMgT("Session property filter not met"):void i.zMgT("User property filter not met"):void i.zMgT("User session criteria not met"):void i.zMgT("Retained day criteria not met");var l=i.lLoL.length,u=l<1,c="";0===l&&(u=!0);for(var f=0;f<l;f++){var h=i.lLoL[f],d=h.kpHz;if(""===c.trim())u=d;else switch(c){case"AND":u=u&&d;break;case"OR":u=u||d}c=h.mEtI}if(!0===o&&(u=!0),u){if(console.debug("onCondition satisfied"),!i.Sfjv.gbnE(i.ltQf)){if(console.warn("Maximum limit reached",i.ltQf),t.getController().isTestDevice()){N("Maximum limit reached for campaign name ".concat(i.liLD.gNrp));var v=document.getElementById("close-button"),g=function(){var t=document.getElementById("apx-container");null==t||t.remove()};null==v||v.addEventListener("click",g),window.setTimeout(g,2e4)}return}console.log("Dispatching event",i.liLD.ARue),t.logEvent("apx_context_evaluated",n(n({apx_nudge_type:"SURVEY"===i.liLD.ARue?"survey":"campaign",apx_nudge_id:i.ltQf,apx_nudge_name:i.liLD.gNrp,apx_variant_code:i.liLD._isExperiment||i.liLD._only_context?i.liLD._attr.apx_variant_code:"TG"},i.liLD._attr),{},{message_name:i.liLD.gNrp,id:i.ltQf})),t.getController().dispatchEvent(i.liLD.ARue,{name:i.liLD.ARue,additional_info:{uuid:i.ltQf,name:i.liLD.gNrp}})}})),s(this,"puwz",(function(){for(var e=i.kuIQ.length,r=e<1,o="",a=0;a<e;a++){var s=i.kuIQ[a],l=s.kpHz;if(""===o.trim())r=l;else switch(o){case"AND":r=r&&l;break;case"OR":r=r||l}o=s.aCAW}r&&(console.log("Dispatching event",i.liLD.ARue),t.getController().persistTerminationInfoLocally(i.ltQf),!0===i.liLD._only_context&&t.logEvent("apx_context_evaluated",n(n({},i.liLD._attr),{},{message_name:i.liLD.gNrp,id:i.ltQf})),t.getController().dispatchEvent(i.liLD.ARue,{name:i.liLD.ARue,additional_info:{uuid:i.ltQf,name:i.liLD.gNrp}}))})),s(this,"validateForTerminationAttributes",(function(){var e=t.getController().getUserAttributes(),n=t.getController().getSessionAttributes();return i.DhFu.validate(e,n)})),s(this,"GDwW",(function(){i.Sfjv.GDwW()})),s(this,"getFrequencyCount",(function(){return i.Sfjv.getFrequencyCount()})),s(this,"PAkQ",(function(){return i.Sfjv.MYCG()})),s(this,"zMgT",(function(e){var n;null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===i.liLD.ARue?"survey":"campaign",apx_nudge_id:i.ltQf,apx_nudge_name:i.liLD.gNrp,apx_variant_code:i.liLD._isExperiment||i.liLD._only_context?null===(n=i.liLD._attr)||void 0===n?void 0:n.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:e})}))})),tt=a((function t(){var e=this;r(this,t),s(this,"Uyzu",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{configs:[]};if(h(t)&&h(t.configs)){var n=t.configs;if(!Array.isArray(n))return;n.sort((function(t,e){var n,i;return(null!==(n=t.prio)&&void 0!==n?n:-1)-(null!==(i=e.prio)&&void 0!==i?i:-1)}));for(var i=0;i<n.length;i++){var r=n[i],o=r._id,a=new $;a.parse(r)?e.Uyzu[o]=a:console.warn("Failed to parse cfg",o)}}})),s(this,"validate",(function(t,n){e.Uyzu[t]&&e.Uyzu[t].iHps(n)})),s(this,"getVariantCode",(function(t){return e.Uyzu[t]?e.Uyzu[t]._variant_code:""})),s(this,"validateForTermination",(function(t,n){e.Uyzu[t]&&e.Uyzu[t].ybGY(n)})),s(this,"validateForTerminationAttributes",(function(t){return!!e.Uyzu[t]&&e.Uyzu[t].validateForTerminationAttributes()})),s(this,"GDwW",(function(t){e.Uyzu[t].GDwW()})),s(this,"getFrequencyCount",(function(t){var n=e.Uyzu[t];if(null!=n)return n.getFrequencyCount()})),s(this,"resetFrequencyCounts",(function(){var t=e.Uyzu;for(var n in t)t[n].PAkQ()})),s(this,"SeVw",(function(t){try{if(e.Uyzu){var n=e.Uyzu[t];if(n&&n.liLD)return n.liLD}}catch(t){console.log("Error in getting the campaign meta ".concat(t))}return{}}))})),et=window.ApxorLogger,nt=a((function e(){var n=this;r(this,e),s(this,"fSbL",{}),s(this,"IMYI",[]),s(this,"kSMC",!1),s(this,"initialize",(function(){var e=t.getController();e.registerForEvent("APP_EVENT",(function(t){return n.rJYj(t,"AE")})),e.registerForEvent("CLIENT_EVENT",(function(t){return n.rJYj(t,"CE")}))})),s(this,"DOxG",(function(){for(var t in n.IMYI)n.Ugjx(t.event,t.key,t.type);n.kSMC=!0})),s(this,"KseZ",(function(t,e){var i;"function"==typeof e&&((i=n.fSbL[t]?n.fSbL[t]:[]).push(e),n.fSbL[t]=i,et.debug("Listeners list: ",n.fSbL))})),s(this,"unregisterFromEvent",(function(t,e){if(n.fSbL[t]){for(var i=n.fSbL[t],r=[],o=0;o<i.length;o++){var a=i[o];a!==e&&r.push(a)}n.fSbL[t]=r}})),s(this,"rJYj",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AE",i=e+"___"+t.name;n.Ugjx(t,i,e)})),s(this,"Ugjx",(function(e,i,r){if(n.kSMC){if(et.debug("Notifying listeners for event: "+e+", "+i,n.fSbL),n.fSbL[i])for(var o=n.fSbL[i],a=t.getController().getSDKRunningTimeInSec(),s=0;s<o.length;s++){(0,o[s])(r,e.name,a,e.additional_info)}}else n.IMYI.push({event:e,key:i,type:r})}))})),it=window.ApxorLogger,rt=function(){function e(){var n=this;return r(this,e),s(this,"VIBl",!1),s(this,"Bbtb",null),s(this,"RhAp",b()),s(this,"oHjc",new nt),s(this,"KoPV",t.getSiteId()),s(this,"knOf",{}),s(this,"getQeState",(function(){try{var e=t.getController().getFromStorage("qe_state");return e?JSON.parse(g(n.KoPV,e)):(n.knOf={},n.setQeState())}catch(t){return n.knOf={},n.setQeState()}})),s(this,"setQeState",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{t.getController().persistToStorage("qe_state",n.knOf,!0)}catch(i){""===e?n.knOf={}:n.knOf[e]={SESSION:0,OVERALL:0,DATES:{}},t.getController().persistToStorage("qe_state",n.knOf,!0)}return n.knOf})),s(this,"initialize",(function(){n.VIBl||(n.VIBl=!0,n.Bbtb=new tt,n.oHjc.initialize(),n.knOf=n.getQeState(),it.info("QE Initialized.."))})),s(this,"parse",(function(t){n.ZTGF()?(n.Bbtb.parse(t),n.oHjc.DOxG()):it.warn("Must call init first. Unable to proceed")})),s(this,"validate",(function(t,e){n.ZTGF()&&n.Bbtb.validate(t,e)})),s(this,"getVariantCode",(function(t){return n.Bbtb.getVariantCode(t)})),s(this,"validateForTermination",(function(t,e){n.ZTGF()&&n.Bbtb.validateForTermination(t,e)})),s(this,"validateForTerminationAttributes",(function(t,e){return n.Bbtb.validateForTerminationAttributes(t,e)})),s(this,"updateCount",(function(t){try{h(n.knOf[t])||n.createObjConfig(t),n.incrementFrequencies(t),n.setQeState(t),n.Bbtb.GDwW(t)}catch(t){console.log("Could not update the count config:".concat(t))}})),s(this,"resetFrequencyCounts",(function(){n.Bbtb.resetFrequencyCounts()})),s(this,"getFrequencyCount",(function(t){return n.Bbtb.getFrequencyCount(t)})),s(this,"registerForEvent",(function(t,e){n.oHjc.KseZ(t,e)})),s(this,"unregisterFromEvent",(function(t,e){n.oHjc.unregisterFromEvent(t,e)})),s(this,"notifyEventListener",(function(t){n.oHjc.rJYj(t)})),s(this,"fetch",(function(e,n,i,r){t.getController().fetchConfiguration(e,n,i,r)})),s(this,"ZTGF",(function(){return n.VIBl})),s(this,"getCampaignMetaFromQueryEngine",(function(t){return n.Bbtb.SeVw(t)})),s(this,"CoFi",(function(){return n.RhAp})),e.instance||(e.instance=this),e.instance}return a(e,[{key:"createObjConfig",value:function(t){try{this.knOf=this.getQeState(),h(this.knOf[t])||(this.knOf[t]={SESSION:0,OVERALL:0,DATES:{}},this.RhAp&&(this.knOf[t].DATES[this.RhAp]=0),this.setQeState(t))}catch(t){it.error("Can not create the frequency count object:"+t)}}},{key:"incrementFrequencies",value:function(t){this.knOf=this.getQeState();var e=this.knOf[t];e.SESSION=e.SESSION+1,e.OVERALL=e.OVERALL+1;var n=b();n===this.RhAp&&e.DATES&&e.DATES[n]||(this.RhAp=n,e.DATES={},e.DATES[this.RhAp]=0),e.DATES[this.RhAp]=e.DATES[this.RhAp]+1}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}();s(rt,"instance",void 0),window.ceVersion=160;try{void 0===exports&&null===exports||(exports.default=rt,module.exports=exports.default)}catch(t){}return rt}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apxor-qe",
3
- "version": "1.5.1",
3
+ "version": "1.6.1-qa.0",
4
4
  "author": "Uma Sankar Yedida <umasankar.yedida@apxor.com> (https://www.apxor.com)",
5
5
  "contributors": [
6
6
  {
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "jsdom": "^22.1.0",
55
- "apxor": "2.4.0"
55
+ "apxor": "2.5.1-qa.0"
56
56
  },
57
57
  "files": [
58
58
  "dist"