apxor-qe 1.4.1 → 1.5.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 o(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,l(r.key),r)}}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=l(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 c(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 c(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 c(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 c(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 l(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 h=function(t){return void 0!==t&&!function(t){return null===t}(t)},f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function d(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 d(t,e=function(t){var e,n,r,i,o,a,s=0,u=[];if(!t)return t;t+="";do{e=(a=f.indexOf(t.charAt(s++))<<18|f.indexOf(t.charAt(s++))<<12|(i=f.indexOf(t.charAt(s++)))<<6|(o=f.indexOf(t.charAt(s++))))>>16&255,n=a>>8&255,r=255&a,u.push(e),64!==i&&(u.push(n),64!==o&&u.push(r))}while(s<t.length);return u}(e))},g=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()},y=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 w(e).test(t);default:return!1}},w=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)},m=function(){var t=new Date;return t.getDate()+"/"+t.getMonth()+"/"+t.getFullYear()},_=window.ApxorLogger,S=a((function e(){var n=this;i(this,e),s(this,"upBe","ALL"),s(this,"qHve",[]),s(this,"hfXD",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(n.upBe=t.audience.audience_type,n.qHve=t.audience.attributes.user,n.hfXD=t.audience.attributes.session,!Array.isArray(n.qHve)||!Array.isArray(n.hfXD))return _.error("No attributes"),!1}catch(t){return _.error(t),!1}return!0})),s(this,"validate",(function(e,r){var i=!0;return"FTU"===n.upBe&&(i=t.getController().getSessionInfo().is_first_session),i&&n.AYgA(e,n.qHve)&&n.AYgA(r,n.hfXD)})),s(this,"AYgA",(function(t,e){var n=e.length,r=!0;try{for(var i,o=function(){var n=e[a];if(!t[n.name]||!1===r)return{v:!1};var i=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})),u=(Array.isArray(t[n.name])?t[n.name]:[t[n.name]]).some((function(t){return s.some((function(e){return y(t,e,i)}))}));r=r&&u},a=0;a<n;a++)if(i=o())return i.v}catch(t){_.error(t),r=!1}return r}))})),A=window.ApxorLogger,b=a((function t(){var e=this;i(this,t),s(this,"cyan",0),s(this,"xUCG",0),s(this,"TTrx","SESSION"),s(this,"dBjB",0),s(this,"QeCL",0),s(this,"voNY",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.cyan=t.frequency.count,-1===e.cyan&&(e.cyan=1e3),e.voNY=e.cyan,e.xUCG=t.frequency.time_interval,e.TTrx=t.frequency.validity,e.QeCL=t.frequency.ses_lmt,e._dayCount=t.frequency.day_lmt;var n=Y.getInstance().getQeState();if(!h(n)||!h(n[t._id]))return!0;if("SESSION"===e.TTrx){if(e.cyan=parseInt(e.cyan)-parseInt(n[t._id].SESSION),e.cyan<=0)return console.warn("Max count limit reached for session:"+t._id),!1}else{if("OVERALL"!==e.TTrx)return A.info("Invalid config."),!1;if(e.cyan=parseInt(e.cyan)-parseInt(n[t._id].OVERALL),e.cyan<=0)return console.warn("Max count limit reached for overall:"+t._id),!1}}catch(t){return A.error(t),!1}return!0})),s(this,"yGJs",(function(){e.cyan=e.cyan-1})),s(this,"getFrequencyCount",(function(){return e.cyan})),s(this,"NSSU",(function(){"SESSION"===e.TTrx&&(e.cyan=e.voNY,A.info("Campaign Limit reset"))})),s(this,"HBeu",(function(t){try{if(e.cyan<=0)return!1;var n=Y.getInstance().getQeState();if(!h(n)||!h(n[t]))return!0;if(0!==e.QeCL)if(parseInt(e.QeCL)-parseInt(n[t].SESSION)<=0)return!1;if(0!==e._dayCount){var r,i=m();if(parseInt(e._dayCount)-parseInt((null===(r=n[t])||void 0===r?void 0:r.DATES[i])||0)<=0)return!1}}catch(t){A.error("Error validating the frequency:"+t)}return!0}))})),E=a((function t(){var e=this;i(this,t),s(this,"dXou",""),s(this,"upBe",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var n;e.dXou=t.meta.name,e.upBe=t.meta.type,e._only_context=t.meta.only_context,e._attr=(null===(n=t.meta)||void 0===n?void 0:n.attr)||{}}catch(t){return window.ApxorLogger.error(t),!1}return!0}))})),H=window.ApxorLogger,L=a((function t(){var e=this;i(this,t),s(this,"ZXIv",-1),s(this,"PYEw",-1),s(this,"gDYY",-1),s(this,"JWWv",-1),s(this,"WVbP",!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 H.error("Not valid dates"),!1;if(e.ZXIv=Date.parse(t.validity.start_date),e.PYEw=Date.parse(t.validity.end_date),h(t.time_limits_in_day)&&(e.WVbP=t.time_limits_in_day,e.WVbP&&h(t.time_limits))){var n=(new Date).toISOString().split("T")[0];if(e.gDYY=Date.parse(n+"T"+t.time_limits.start_time+".000Z"),e.JWWv=Date.parse(n+"T"+t.time_limits.end_time+".000Z"),isNaN(e.gDYY)||isNaN(e.JWWv))return H.error("Not valid times"),!1}}catch(t){return H.error(t),!1}return!0})),s(this,"validate",(function(){var t=Date.now();return t>e.ZXIv&&t<e.PYEw&&(!e.WVbP||t>=e.gDYY&&t<=e.JWWv)}))})),F=a((function t(){var e=this;i(this,t),s(this,"dXou",""),s(this,"PjLw",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.dXou=t.name,e.PjLw=t.additional_info}catch(t){return!1}return!0}))})),x=a((function t(){var e=this;i(this,t),s(this,"ubix",0),s(this,"xTww",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.ubix=Number(t.lower),e.xTww=Number(t.upper),isNaN(e.ubix)||isNaN(e.xTww))return!1}catch(t){return!1}return!0}))})),T=a((function t(){var e=this;i(this,t),s(this,"wLrd",0),s(this,"GwDz",""),s(this,"HJIQ",""),s(this,"LHnZ",new F),s(this,"pZbN",new x),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.GwDz=t.event_type,e.HJIQ=t.activity,e.LHnZ.parse(t.details)&&e.pZbN.parse(t.time_bounds)}catch(t){return!1}}))})),D=window.ApxorLogger,Z=a((function t(){var e=this;i(this,t),s(this,"wLrd",0),s(this,"BvTW",-1),s(this,"cyan",0),s(this,"FdOF",""),s(this,"HJIQ",""),s(this,"GwDz",""),s(this,"pZbN",new x),s(this,"LHnZ",new F),s(this,"idDI",new T),s(this,"Sdoc","AND"),s(this,"LnGT",!1),s(this,"upBe",void 0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.BvTW=t.sequence,e.cyan=t.count_config.count,e.FdOF=t.count_config.operator,e.HJIQ=t.activity,e.GwDz=t.event_type,e.Sdoc=t.combine_operator,e.upBe=t.type,e.LHnZ.parse(t.details)&&e.idDI.parse(t.trigger)&&e.pZbN.parse(t.time_bounds)}catch(t){return D.error(t),!1}}))})),N=window.ApxorLogger,I=a((function t(){var e=this;i(this,t),s(this,"cyan",0),s(this,"FdOF",""),s(this,"GwDz",""),s(this,"pZbN",new x),s(this,"LHnZ",new F),s(this,"Sdoc","AND"),s(this,"parse",(function(t){try{return e.cyan=t.count_config.count,e.FdOF=t.count_config.operator,e.GwDz=t.event_type,e.Sdoc=t.combine_operator,e.LHnZ.parse(t.details)&&e.pZbN.parse(t.time_bounds)}catch(t){return N.error(t),!1}}))})),C=window.ApxorLogger,G=function(){function e(){var n=this;i(this,e),s(this,"AFha",0),s(this,"xWwF",""),s(this,"ZXgH",new Z),s(this,"AwpM",new I),s(this,"CTgi",!1),s(this,"dzHG",!1),s(this,"ewWl",0),s(this,"Sdoc","AND"),s(this,"gzxI","OR"),s(this,"Swao",-1),s(this,"SKdF",[]),s(this,"ATJy",{}),s(this,"qFlV",!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,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.xWwF=r,n.ewWl=i,n.SKdF=a,"termination"===s&&""!==s){n.AwpM.parse(e);return n.gzxI=n.AwpM.Sdoc,n.cvYj(),!0}var u=n.ZXgH.parse(e);if(u){if(n.Sdoc=n.ZXgH.Sdoc,n.ZXgH.LnGT){var c=n.ZXgH.LHnZ.dXou;"APX_PAGE_OPENED"===c&&(c=n.ZXgH.LHnZ.PjLw.navigation_id,c=h(c)?c:n.ZXgH.LHnZ.dXou),n.Swao=t.getController().getEventCount(c);var l=n.ZXgH.cyan,f=n.ZXgH.FdOF;if(n.dzHG=n.TfGM(n.Swao-1,l,f,!1),n.CTgi=n.dzHG,n.dzHG&&"APX_PAGE_OPENED"===n.ZXgH.LHnZ.dXou)return!0}return o&&0!==i||n.DGaq(),!0}return!1})),s(this,"DGaq",(function(){var t=n.ZXgH,e=t.idDI,r=Y.getInstance();"app_start"===e.GwDz?(n.CTgi=!0,r.registerForEvent(g(t.GwDz)+"___"+t.LHnZ.dXou,n.ZNEJ)):r.registerForEvent(g(t.GwDz)+"___"+e.LHnZ.dXou,n.ZNEJ)})),s(this,"cvYj",(function(){var t=n.AwpM,e=Y.getInstance();n.CTgi=!0,e.registerForEvent(g(t.GwDz)+"___"+t.LHnZ.dXou,n.YBSM)})),s(this,"Ijls",(function(t,e,r,i){var o,a=(Date.now()-n.ATJy[e])/1e3;(null===(o=n.ZXgH)||void 0===o||null===(o=o.LHnZ)||void 0===o||null===(o=o.PjLw)||void 0===o?void 0:o.time)/1e3>a&&n._displayCampaign(r)})),s(this,"MKnM",(function(t,e,r,i){var o,a;n.qFlV=!0;var s=Date.now(),u=null===(o=n.ZXgH)||void 0===o||null===(o=o.idDI)||void 0===o?void 0:o.LHnZ.dXou,c=(s-n.ATJy[u])/1e3,l=null===(a=n.ZXgH)||void 0===a||null===(a=a.LHnZ)||void 0===a||null===(a=a.PjLw)||void 0===a?void 0:a.time;(l/=1e3)>c&&n._displayCampaign(r)})),s(this,"ZNEJ",(function(t,e,r,i){var o=Y.getInstance();if(n.CTgi)g(n.ZXgH.GwDz)===t&&n.gVIC(r-n.ZXgH.idDI.wLrd,n.ZXgH.pZbN)&&n.ZXgH.LHnZ.dXou===e&&n.XxaE(n.ZXgH.LHnZ.PjLw,i)&&(n.AFha+=1,n.dzHG=n.TfGM(n.AFha,n.ZXgH.cyan,n.ZXgH.FdOF),n.dzHG&&(n.ZXgH.wLrd=r,o.validate(n.xWwF,n.ewWl)));else if(n.CTgi=n.cAeN(t,e,r,i),n.CTgi){var a=n.ZXgH,s=a.idDI;if(s.wLrd=r,"activity_time"===(null==a?void 0:a.GwDz)){var u,c,l,h=null==a||null===(u=a.LHnZ)||void 0===u||null===(u=u.PjLw)||void 0===u?void 0:u.time;(null==a||null===(c=a.LHnZ)||void 0===c||null===(c=c.PjLw)||void 0===c?void 0:c.nkpi.length)>0&&(setTimeout((function(){n.qFlV||(n.dzHG=!0,n.dzHG&&(n.AFha+=1,n.dzHG=n.TfGM(n.AFha,n.ZXgH.cyan,n.ZXgH.FdOF),n.dzHG&&(n.ZXgH.wLrd=r,o.validate(n.xWwF,n.ewWl)))),a.LHnZ.PjLw.nkpi.map((function(t){o.unregisterFromEvent(p(a.LHnZ.PjLw.et)+"___"+t,n)}))}),h),a.LHnZ.PjLw.nkpi.map((function(t){o.registerForEvent(p(a.LHnZ.PjLw.et)+"___"+t,n.MKnM)}))),(null==a||null===(l=a.LHnZ)||void 0===l||null===(l=l.PjLw)||void 0===l?void 0:l.kpi.length)>0&&(setTimeout((function(){a.LHnZ.PjLw.kpi.map((function(t){o.unregisterFromEvent(p(a.LHnZ.PjLw.et)+"___"+t,n)}))}),h),a.LHnZ.PjLw.kpi.map((function(t){t===a.idDI.LHnZ.dXou?(o.unregisterFromEvent(g(s.GwDz)+"___"+s.LHnZ.dXou,n),o.registerForEvent(p(a.LHnZ.PjLw.et)+"___"+t,n.Ijls)):o.registerForEvent(p(a.LHnZ.PjLw.et)+"___"+t,n.MKnM)})))}else o.unregisterFromEvent(g(s.GwDz)+"___"+s.LHnZ.dXou,n),o.registerForEvent(g(a.GwDz)+"___"+a.LHnZ.dXou,n);n.ATJy[e]=Date.now()}})),s(this,"YBSM",(function(t,e,r,i){var o=Y.getInstance();g(n.AwpM.GwDz)===t&&n.gVIC(r,n.AwpM.pZbN)&&n.AwpM.LHnZ.dXou===e&&n.XxaE(n.AwpM.LHnZ.PjLw,i)&&(n.AFha+=1,n.dzHG=n.TfGM(n.AFha,n.AwpM.cyan,n.AwpM.FdOF),n.dzHG&&(n.AwpM.wLrd=r,o.validateForTermination(n.xWwF,n.ewWl)))})),s(this,"cAeN",(function(t,e,r,i){var o=n.ZXgH.idDI;return g(o.GwDz)===t&&o.LHnZ.dXou===e&&n.gVIC(r,o.pZbN)&&n.XxaE(o.LHnZ.PjLw,i)})),s(this,"gVIC",(function(t,e){var n=Math.ceil(t);return n>e.ubix&&n<e.xTww})),s(this,"TfGM",(function(t,e,r){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(i&&n.ZXgH.LnGT&&(t+=n.Swao),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,"XxaE",(function(t,e){var n=!0;try{var i,o=function(){if(!e[a]||!1===n)return{v:!1};if("object"===r(t[a])){var i,o=t[a].op,s=t[a].t;"s"===s?i=t[a].val:"l"!==s&&"f"!==s||(i=parseFloat(t[a].val));var u=(Array.isArray(e[a])?e[a]:[e[a]]).some((function(t){return y(t,i,o)}));n=n&&u}else n=n&&y(e[a],t[a],"EQ")};for(var a in t)if(i=o())return i.v}catch(t){C.error(t),n=!1}return n}))}return a(e,[{key:"_displayCampaign",value:function(t){var e=Y.getInstance();this.dzHG=!0,this.dzHG&&(this.AFha+=1,this.dzHG=this.TfGM(this.AFha,this.ZXgH.cyan,this.ZXgH.FdOF),this.dzHG&&(this.ZXgH.wLrd=t,e.validate(this.xWwF,this.ewWl)))}}]),e}(),q=window.ApxorLogger,X=a((function e(){var n=this;i(this,e),s(this,"PuiS",[]),s(this,"_ret_day",{}),s(this,"KMnE",{}),s(this,"TIdq",!1),s(this,"BItf",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{n.PuiS=t.overall_cfg.events,n._ret_day=t.overall_cfg.ret_day,n.KMnE=t.overall_cfg.session,n.TIdq=t.overall_cfg.toggleRetDay,n.PuiS=t.overall_cfg.events,n.BItf=t.overall_cfg.toggleSession}catch(t){return q.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.TIdq&&!isNaN(e)&&!(e>=n._ret_day.from&&e<=n._ret_day.to))return!1;if(n.BItf&&!isNaN(r)&&!(r>=n.KMnE.from&&r<=n.KMnE.to))return!1;try{for(var i=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),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return e}(v(o,i)))),s=0;s<n.PuiS.length;s++){if(a[n.PuiS[s].name.replace("'","").replace("’","")])return!1}}catch(t){q.error("Failed to validate the lt count:"+t)}return!0}))})),M=window.ApxorLogger,O=a((function t(){var e=this;i(this,t),s(this,"qHve",[]),s(this,"hfXD",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.qHve=t.attributes.user,e.hfXD=t.attributes.session,!Array.isArray(e.qHve)||!Array.isArray(e.hfXD))return M.error("No attributes"),!1}catch(t){return M.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.AYgA(t,e.qHve)&&e.AYgA(n,e.hfXD)})),s(this,"AYgA",(function(t,e){var n=e.length,r=!0;try{for(var i,o=function(){var n=e[a];if(!t[n.name]||!1===r)return{v:!1};var i=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})),u=(Array.isArray(t[n.name])?t[n.name]:[t[n.name]]).some((function(t){return s.some((function(e){return y(t,e,i)}))}));r=r&&u},a=0;a<n;a++)if(i=o())return i.v}catch(t){M.error(t),r=!1}return r}))})),j=a((function e(){var n=this;i(this,e),s(this,"mmqX",t.getController()),s(this,"type",""),s(this,"_duration_seconds",0),s(this,"ebrV",1),s(this,"parse",(function(t){try{var e,r,i;if(n.upBe=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.ebrV=null===(i=t.terminate_info.time_based)||void 0===i?void 0:i.days,n.zuMV(t._id))return n.mmqX.persistTerminationInfoLocally(t._id),!1}catch(t){return!1}return!0})),s(this,"zuMV",(function(t){var e,r=JSON.parse(n.mmqX.getFromStorage("apx_termination_ID"));if(!r[t]||null===(e=r[t])||void 0===e||!e.startDate)return!1;var i,o=new Date(r[t].startDate),a=new Date((i=new Date).getMonth()+"/"+i.getDate()+"/"+i.getFullYear()),s=parseInt((a-o)/864e5,10),u=function(){var t=new Date;return{hours:t.getHours(),mins:t.getMinutes()}}(),c=r[t].gDYY;return s===n.ebrV&&u.hours>=c.hours||s>n.ebrV||r[t].goalAcheived}))})),P=a((function t(){var e=this;i(this,t),s(this,"enable_goal_events",!1),s(this,"attributes",{}),s(this,"KDkd",new O),s(this,"uNVj",new j),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.uNVj.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.KDkd.parse(t.terminate_info))return!1}catch(t){return window.ApxorLogger.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.KDkd.validate(t,n)}))})),W=window.ApxorLogger,z=a((function e(){var r=this;i(this,e),s(this,"hmOw",[]),s(this,"mlaS",[]),s(this,"xWwF",""),s(this,"axSA",new E),s(this,"oypC",new S),s(this,"TTrx",new L),s(this,"ihSD",new b),s(this,"KUHf",new X),s(this,"qNqv",new P),s(this,"AKqc",!1),s(this,"NIKc",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(!h(t._id))return W.error("No Id"),!1;if(!h(t.enabled)||!t.enabled)return W.error("Not enabled"),!1;if(!(r.axSA.parse(t)&&r.TTrx.parse(t)&&r.ihSD.parse(t)&&r.oypC.parse(t)&&r.KUHf.parse(t)&&r.qNqv.parse(t)))return!1;if(!h(t.conditions)||!Array.isArray(t.conditions))return W.error("No valid conditions",t.conditions),!1;r.xWwF=t._id,r.AKqc=!!h(t.sequence_enabled)&&t.sequence_enabled,r.AKqc&&t.conditions.sort((function(t,e){return t.sequence<e.sequence}));for(var e=t.conditions,n=e.length,i=0;i<n;i++){r.NIKc=[];var o=e[i];if("didn't"===o.type){var a,s={trigger_key:o.trigger.details.name,no_kpi_array:null==o||null===(a=o.details)||void 0===a||null===(a=a.additional_info)||void 0===a?void 0:a.nkpi,condition_id:null==o?void 0:o._id,time_bounds:o.time_bounds.upper};r.NIKc=[].concat(u(r.NIKc),[s])}var c=new G;c.initialize(o,r.xWwF,i,r.AKqc,r.NIKc)&&r.hmOw.push(c)}if(r.qNqv.enable_goal_events)for(var l=t.terminate_info.goal_events.events,f=l.length,d=0;d<f;d++){var v=new G;v.initialize(l[d],r.xWwF,d,!0,[],"termination")&&r.mlaS.push(v)}return r.hmOw.length>0}catch(t){return W.error(t),!1}})),s(this,"SslG",(function(t){if(!(t<0))if(r.AKqc){var e=r.hmOw[t];if(h(e)&&e.dzHG){var n=r.hmOw[t-1];if(h(n)&&!n.dzHG)return;var i=r.hmOw[t+1];h(i)?i.DGaq():r.wUEZ()}}else r.wUEZ()})),s(this,"uDmd",(function(t){t<0||r.Fkcf()})),s(this,"wUEZ",(function(){var e=t.getController().getUserAttributes(),i=t.getController().getSessionAttributes();if(r.TTrx.validate()&&r.oypC.validate(e,i)&&r.KUHf.validate()){for(var o=r.hmOw.length,a=o<1,s="",u=0;u<o;u++){var c=r.hmOw[u],l=c.dzHG;if(""===s.trim())a=l;else switch(s){case"AND":a=a&&l;break;case"OR":a=a||l}s=c.Sdoc}if(a){if(console.debug("onCondition satisfied"),!r.ihSD.HBeu(r.xWwF))return void console.warn("Maximum limit reached",r.xWwF);console.log("Dispatching event",r.axSA.upBe),!0===r.axSA._only_context&&t.logEvent("apx_context_evaluated",n(n({},r.axSA._attr),{},{message_name:r.axSA.dXou,id:r.xWwF})),t.getController().dispatchEvent(r.axSA.upBe,{name:r.axSA.upBe,additional_info:{uuid:r.xWwF,name:r.axSA.dXou}})}}})),s(this,"Fkcf",(function(){for(var e=r.mlaS.length,i=e<1,o="",a=0;a<e;a++){var s=r.mlaS[a],u=s.dzHG;if(""===o.trim())i=u;else switch(o){case"AND":i=i&&u;break;case"OR":i=i||u}o=s.gzxI}i&&(console.log("Dispatching event",r.axSA.upBe),t.getController().persistTerminationInfoLocally(r.xWwF),!0===r.axSA._only_context&&t.logEvent("apx_context_evaluated",n(n({},r.axSA._attr),{},{message_name:r.axSA.dXou,id:r.xWwF})),t.getController().dispatchEvent(r.axSA.upBe,{name:r.axSA.upBe,additional_info:{uuid:r.xWwF,name:r.axSA.dXou}}))})),s(this,"validateForTerminationAttributes",(function(){var e=t.getController().getUserAttributes(),n=t.getController().getSessionAttributes();return r.qNqv.validate(e,n)})),s(this,"yGJs",(function(){r.ihSD.yGJs()})),s(this,"getFrequencyCount",(function(){return r.ihSD.getFrequencyCount()})),s(this,"vtVj",(function(){return r.ihSD.NSSU()}))})),R=a((function t(){var e=this;i(this,t),s(this,"aSMs",{}),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,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],o=i._id,a=new z;a.parse(i)?e.aSMs[o]=a:console.warn("Failed to parse cfg",o)}}})),s(this,"validate",(function(t,n){e.aSMs[t]&&e.aSMs[t].SslG(n)})),s(this,"validateForTermination",(function(t,n){e.aSMs[t]&&e.aSMs[t].uDmd(n)})),s(this,"validateForTerminationAttributes",(function(t){return!!e.aSMs[t]&&e.aSMs[t].validateForTerminationAttributes()})),s(this,"yGJs",(function(t){e.aSMs[t].yGJs()})),s(this,"getFrequencyCount",(function(t){return e.aSMs[t].getFrequencyCount()})),s(this,"resetFrequencyCounts",(function(){var t=e.aSMs;for(var n in t)t[n].vtVj()})),s(this,"iSci",(function(t){try{if(e.aSMs){var n=e.aSMs[t];if(n&&n.axSA)return n.axSA}}catch(t){console.log("Error in getting the campaign meta ".concat(t))}return{}}))})),K=window.ApxorLogger,B=a((function e(){var n=this;i(this,e),s(this,"MqKW",{}),s(this,"PZUh",[]),s(this,"CrNj",!1),s(this,"initialize",(function(){var e=t.getController();e.registerForEvent("APP_EVENT",(function(t){return n.Snah(t,"AE")})),e.registerForEvent("CLIENT_EVENT",(function(t){return n.Snah(t,"CE")}))})),s(this,"hUlQ",(function(){for(var t in n.PZUh)n.lMiM(t.event,t.key,t.type);n.CrNj=!0})),s(this,"colh",(function(t,e){var r;"function"==typeof e&&((r=n.MqKW[t]?n.MqKW[t]:[]).push(e),n.MqKW[t]=r,K.debug("Listeners list: ",n.MqKW))})),s(this,"unregisterFromEvent",(function(t,e){if(n.MqKW[t]){for(var r=n.MqKW[t],i=[],o=0;o<r.length;o++){var a=r[o];a!==e&&i.push(a)}n.MqKW[t]=i}})),s(this,"Snah",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AE",r=e+"___"+t.name;n.lMiM(t,r,e)})),s(this,"lMiM",(function(e,r,i){if(n.CrNj){if(K.debug("Notifying listeners for event: "+e+", "+r,n.MqKW),n.MqKW[r])for(var o=n.MqKW[r],a=t.getController().getSDKRunningTimeInSec(),s=0;s<o.length;s++){(0,o[s])(i,e.name,a,e.additional_info)}}else n.PZUh.push({event:e,key:r,type:i})}))})),V=window.ApxorLogger,Y=function(){function e(){var n=this;return i(this,e),s(this,"FyrB",!1),s(this,"EGlR",null),s(this,"Emjp",m()),s(this,"WpgE",new B),s(this,"kKtz",t.getSiteId()),s(this,"TsRo",{}),s(this,"getQeState",(function(){try{var e=t.getController().getFromStorage("qe_state");return e?JSON.parse(v(n.kKtz,e)):(n.TsRo={},n.setQeState())}catch(t){return n.TsRo={},n.setQeState()}})),s(this,"setQeState",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{t.getController().persistToStorage("qe_state",n.TsRo,!0)}catch(r){""===e?n.TsRo={}:n.TsRo[e]={SESSION:0,OVERALL:0,DATES:{}},t.getController().persistToStorage("qe_state",n.TsRo,!0)}return n.TsRo})),s(this,"initialize",(function(){n.FyrB||(n.FyrB=!0,n.EGlR=new R,n.WpgE.initialize(),n.TsRo=n.getQeState(),V.info("QE Initialized.."))})),s(this,"parse",(function(t){n.lHre()?(n.EGlR.parse(t),n.WpgE.hUlQ()):V.warn("Must call init first. Unable to proceed")})),s(this,"validate",(function(t,e){n.lHre()&&n.EGlR.validate(t,e)})),s(this,"validateForTermination",(function(t,e){n.lHre()&&n.EGlR.validateForTermination(t,e)})),s(this,"validateForTerminationAttributes",(function(t,e){return n.EGlR.validateForTerminationAttributes(t,e)})),s(this,"updateCount",(function(t){try{h(n.TsRo[t])||n.createObjConfig(t),n.incrementFrequencies(t),n.setQeState(t),n.EGlR.yGJs(t)}catch(t){console.log("Could not update the count config:".concat(t))}})),s(this,"resetFrequencyCounts",(function(){n.EGlR.resetFrequencyCounts()})),s(this,"getFrequencyCount",(function(t){return n.EGlR.getFrequencyCount(t)})),s(this,"registerForEvent",(function(t,e){n.WpgE.colh(t,e)})),s(this,"unregisterFromEvent",(function(t,e){n.WpgE.unregisterFromEvent(t,e)})),s(this,"fetch",(function(e,n,r,i){t.getController().fetchConfiguration(e,n,r,i)})),s(this,"lHre",(function(){return n.FyrB})),s(this,"getCampaignMetaFromQueryEngine",(function(t){return n.EGlR.iSci(t)})),s(this,"rvWz",(function(){return n.Emjp})),e.instance||(e.instance=this),e.instance}return a(e,[{key:"createObjConfig",value:function(t){try{this.TsRo=this.getQeState(),h(this.TsRo[t])||(this.TsRo[t]={SESSION:0,OVERALL:0,DATES:{}},this.Emjp&&(this.TsRo[t].DATES[this.Emjp]=0),this.setQeState(t))}catch(t){V.error("Can not create the frequency count object:"+t)}}},{key:"incrementFrequencies",value:function(t){this.TsRo=this.getQeState();var e=this.TsRo[t];e.SESSION=e.SESSION+1,e.OVERALL=e.OVERALL+1;var n=m();n===this.Emjp&&e.DATES&&e.DATES[n]||(this.Emjp=n,e.DATES={},e.DATES[this.Emjp]=0),e.DATES[this.Emjp]=e.DATES[this.Emjp]+1}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}();s(Y,"instance",void 0),window.ceVersion=141;try{void 0===exports&&null===exports||(exports.default=Y,module.exports=exports.default)}catch(t){}return Y}));
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)},v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function f(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 p=function(t,e){return f(t,e=function(t){var e,n,r,i,a,o,s=0,u=[];if(!t)return t;t+="";do{e=(o=v.indexOf(t.charAt(s++))<<18|v.indexOf(t.charAt(s++))<<12|(i=v.indexOf(t.charAt(s++)))<<6|(a=v.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))},_=function(t){switch(t){case"app_event":return"AE";case"client_event":return"CE";case"activity_time":case"activity_event":return"AE"}return"Unknown"},h=function(t){return t.toUpperCase()},g=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)},m=function(){var t=new Date;return t.getDate()+"/"+t.getMonth()+"/"+t.getFullYear()},w=window.ApxorLogger,T=o((function e(){var n=this;i(this,e),s(this,"owVv","ALL"),s(this,"ZfAX",[]),s(this,"kLZG",[]),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.owVv=t.audience.audience_type,n.ZfAX=t.audience.attributes.user,n.kLZG=t.audience.attributes.session,!Array.isArray(n.ZfAX)||!Array.isArray(n.kLZG))return w.error("No attributes"),!1}catch(t){return w.error(t),!1}return!0})),s(this,"validate",(function(e,r){var i=!0;"FTU"===n.owVv&&(i=t.getController().getSessionInfo().is_first_session);var a=n.KPjz(e,n.ZfAX),o=n.KPjz(r,n.kLZG);return a||(n.userAttributesValidated=!1),o||(n.sessionAttributeValidated=!1),i&&a&&o})),s(this,"KPjz",(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 g(t,e,i)}))}));r=r&&u},o=0;o<n;o++)if(i=a())return i.v}catch(t){w.error(t),r=!1}return r}))})),x=window.ApxorLogger,K=o((function t(){var e=this;i(this,t),s(this,"YpuZ",0),s(this,"CaWP",0),s(this,"HdbP","SESSION"),s(this,"QrLx",0),s(this,"WUjI",0),s(this,"Gnyd",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.YpuZ=t.frequency.count,-1===e.YpuZ&&(e.YpuZ=1e3),e.Gnyd=e.YpuZ,e.CaWP=t.frequency.time_interval,e.HdbP=t.frequency.validity,e.WUjI=t.frequency.ses_lmt,e._dayCount=t.frequency.day_lmt;var n=R.getInstance().getQeState();if(!d(n)||!d(n[t._id]))return!0;if("SESSION"===e.HdbP){if(e.YpuZ=parseInt(e.YpuZ)-parseInt(n[t._id].SESSION),e.YpuZ<=0)return console.warn("Max count limit reached for session:"+t._id),!1}else{if("OVERALL"!==e.HdbP)return x.info("Invalid config."),!1;if(e.YpuZ=parseInt(e.YpuZ)-parseInt(n[t._id].OVERALL),e.YpuZ<=0)return console.warn("Max count limit reached for overall:"+t._id),!1}}catch(t){return x.error(t),!1}return!0})),s(this,"aokP",(function(){e.YpuZ=e.YpuZ-1})),s(this,"getFrequencyCount",(function(){return e.YpuZ})),s(this,"mtuI",(function(){"SESSION"===e.HdbP&&(e.YpuZ=e.Gnyd,x.info("Campaign Limit reset"))})),s(this,"XinH",(function(t){try{if(e.YpuZ<=0)return!1;var n=R.getInstance().getQeState();if(!d(n)||!d(n[t]))return!0;if(0!==e.WUjI)if(parseInt(e.WUjI)-parseInt(n[t].SESSION)<=0)return!1;if(0!==e._dayCount){var r,i=m();if(parseInt(e._dayCount)-parseInt((null===(r=n[t])||void 0===r?void 0:r.DATES[i])||0)<=0)return!1}}catch(t){x.error("Error validating the frequency:"+t)}return!0}))})),b=o((function t(){var e=this;i(this,t),s(this,"CTVX",""),s(this,"owVv",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var n,r;e.CTVX=t.meta.name,e.owVv=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}))})),E=window.ApxorLogger,C=o((function t(){var e=this;i(this,t),s(this,"zmJs",-1),s(this,"kepU",-1),s(this,"ysVa",-1),s(this,"ocLU",-1),s(this,"hxyS",!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 E.error("Not valid dates"),!1;if(e.zmJs=Date.parse(t.validity.start_date),e.kepU=Date.parse(t.validity.end_date),d(t.time_limits_in_day)&&(e.hxyS=t.time_limits_in_day,e.hxyS&&d(t.time_limits))){var n=(new Date).toISOString().split("T")[0];if(e.ysVa=Date.parse(n+"T"+t.time_limits.start_time+".000Z"),e.ocLU=Date.parse(n+"T"+t.time_limits.end_time+".000Z"),isNaN(e.ysVa)||isNaN(e.ocLU))return E.error("Not valid times"),!1}}catch(t){return E.error(t),!1}return!0})),s(this,"validate",(function(){var t=Date.now();return t>e.zmJs&&t<e.kepU?!e.hxyS||t>=e.ysVa&&t<=e.ocLU:(t<e.zmJs?e._not_yet_active=!0:t>e.kepU&&(e._nudge_expired=!0),!1)}))})),S=o((function t(){var e=this;i(this,t),s(this,"CTVX",""),s(this,"orON",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.CTVX=t.name,e.orON=t.additional_info}catch(t){return!1}return!0}))})),A=o((function t(){var e=this;i(this,t),s(this,"oxbV",0),s(this,"QyjH",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.oxbV=Number(t.lower),e.QyjH=Number(t.upper),isNaN(e.oxbV)||isNaN(e.QyjH))return!1}catch(t){return!1}return!0}))})),N=o((function t(){var e=this;i(this,t),s(this,"VAxM",0),s(this,"KJQk",""),s(this,"Nckt",""),s(this,"KdUl",new S),s(this,"Bfpr",new A),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.KJQk=t.event_type,e.Nckt=t.activity,e.KdUl.parse(t.details)&&e.Bfpr.parse(t.time_bounds)}catch(t){return!1}}))})),Y=window.ApxorLogger,V=o((function t(){var e=this;i(this,t),s(this,"VAxM",0),s(this,"mCnB",-1),s(this,"YpuZ",0),s(this,"SvML",""),s(this,"Nckt",""),s(this,"KJQk",""),s(this,"Bfpr",new A),s(this,"KdUl",new S),s(this,"rFlu",new N),s(this,"ndXU","AND"),s(this,"cmkQ",!1),s(this,"owVv",void 0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.mCnB=t.sequence,e.YpuZ=t.count_config.count,e.SvML=t.count_config.operator,e.Nckt=t.activity,e.KJQk=t.event_type,e.ndXU=t.combine_operator,e.owVv=t.type,e.KdUl.parse(t.details)&&e.rFlu.parse(t.trigger)&&e.Bfpr.parse(t.time_bounds)}catch(t){return Y.error(t),!1}}))})),O=window.ApxorLogger,L=o((function t(){var e=this;i(this,t),s(this,"YpuZ",0),s(this,"SvML",""),s(this,"KJQk",""),s(this,"Bfpr",new A),s(this,"KdUl",new S),s(this,"ndXU","AND"),s(this,"parse",(function(t){try{return e.YpuZ=t.count_config.count,e.SvML=t.count_config.operator,e.KJQk=t.event_type,e.ndXU=t.combine_operator,e.KdUl.parse(t.details)&&e.Bfpr.parse(t.time_bounds)}catch(t){return O.error(t),!1}}))})),P=window.ApxorLogger,q=function(){function e(){var n=this;i(this,e),s(this,"iqYa",0),s(this,"tTqB",""),s(this,"Pwgu",new V),s(this,"PACz",new L),s(this,"LpHt",!1),s(this,"HLiN",!1),s(this,"nODh",0),s(this,"ndXU","AND"),s(this,"Pxjw","OR"),s(this,"BNbu",-1),s(this,"rjRg",[]),s(this,"vBOh",{}),s(this,"WFwv",!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.tTqB=r,n.nODh=i,n.rjRg=o,"termination"===s&&""!==s){n.PACz.parse(e);return n.Pxjw=n.PACz.ndXU,n.vfXG(),!0}var u=n.Pwgu.parse(e);if(u){if(n.ndXU=n.Pwgu.ndXU,n.Pwgu.cmkQ){var l=n.Pwgu.KdUl.CTVX;"APX_PAGE_OPENED"===l&&(l=n.Pwgu.KdUl.orON.navigation_id,l=d(l)?l:n.Pwgu.KdUl.CTVX),n.BNbu=t.getController().getEventCount(l);var c=n.Pwgu.YpuZ,v=n.Pwgu.SvML;if(n.HLiN=n.tKdV(n.BNbu-1,c,v,!1),n.LpHt=n.HLiN,n.HLiN&&"APX_PAGE_OPENED"===n.Pwgu.KdUl.CTVX)return!0}return a&&0!==i||n.zSnG(),!0}return!1})),s(this,"zSnG",(function(){var t,e=n.Pwgu,r=e.rFlu,i=R.getInstance();"app_start"===r.KJQk?(n.LpHt=!0,i.registerForEvent(_(e.KJQk)+"___"+e.KdUl.CTVX,n.hjRG)):i.registerForEvent(_(e.KJQk)+"___"+r.KdUl.CTVX,n.hjRG),null!==(t=window.ApxorRTM)&&void 0!==t&&t.badgesLists.includes(n.tTqB)&&i.registerForEvent(_(e.KJQk)+"___"+"apxor-badge-container-".concat("-".concat(n.tTqB).replaceAll(" ","").replace(/[^\w\s]/gi,"")),n.hjRG)})),s(this,"vfXG",(function(){var t=n.PACz,e=R.getInstance();n.LpHt=!0,e.registerForEvent(_(t.KJQk)+"___"+t.KdUl.CTVX,n.oueL)})),s(this,"RlTL",(function(t,e,r,i){var a,o=(Date.now()-n.vBOh[e])/1e3;(null===(a=n.Pwgu)||void 0===a||null===(a=a.KdUl)||void 0===a||null===(a=a.orON)||void 0===a?void 0:a.time)/1e3>o&&n._displayCampaign(r)})),s(this,"lwFR",(function(t,e,r,i){var a,o;n.WFwv=!0;var s=Date.now(),u=null===(a=n.Pwgu)||void 0===a||null===(a=a.rFlu)||void 0===a?void 0:a.KdUl.CTVX,l=(s-n.vBOh[u])/1e3,c=null===(o=n.Pwgu)||void 0===o||null===(o=o.KdUl)||void 0===o||null===(o=o.orON)||void 0===o?void 0:o.time;(c/=1e3)>l&&n._displayCampaign(r)})),s(this,"hjRG",(function(e,r,i,a){var o,s,u=R.getInstance();if(n.LpHt){if(null!==(o=window.ApxorRTM)&&void 0!==o&&o.isBadgePresent&&null!==(s=window.ApxorRTM)&&void 0!==s&&s.badgesLists.includes(n.tTqB)&&t.getController().isBadgeTriggerSatisfied(n.tTqB))return n.HLiN=!0,n.Pwgu.VAxM=i,void u.validate(n.tTqB,n.nODh);_(n.Pwgu.KJQk)===e&&n.CFTa(i-n.Pwgu.rFlu.VAxM,n.Pwgu.Bfpr)&&n.Pwgu.KdUl.CTVX===r&&n.iGQO(n.Pwgu.KdUl.orON,a)&&(n.iqYa+=1,n.HLiN=n.tKdV(n.iqYa,n.Pwgu.YpuZ,n.Pwgu.SvML),n.HLiN&&(n.Pwgu.VAxM=i,u.validate(n.tTqB,n.nODh)))}else if(n.LpHt=n.gwDR(e,r,i,a),n.LpHt){var l=n.Pwgu,c=l.rFlu;if(c.VAxM=i,"activity_time"===(null==l?void 0:l.KJQk)){var d,v,f,p=null==l||null===(d=l.KdUl)||void 0===d||null===(d=d.orON)||void 0===d?void 0:d.time;(null==l||null===(v=l.KdUl)||void 0===v||null===(v=v.orON)||void 0===v?void 0:v.nkpi.length)>0&&(setTimeout((function(){n.WFwv||(n.HLiN=!0,n.HLiN&&(n.iqYa+=1,n.HLiN=n.tKdV(n.iqYa,n.Pwgu.YpuZ,n.Pwgu.SvML),n.HLiN&&(n.Pwgu.VAxM=i,u.validate(n.tTqB,n.nODh)))),l.KdUl.orON.nkpi.map((function(t){u.unregisterFromEvent(h(l.KdUl.orON.et)+"___"+t,n)}))}),p),l.KdUl.orON.nkpi.map((function(t){u.registerForEvent(h(l.KdUl.orON.et)+"___"+t,n.lwFR)}))),(null==l||null===(f=l.KdUl)||void 0===f||null===(f=f.orON)||void 0===f?void 0:f.kpi.length)>0&&(setTimeout((function(){l.KdUl.orON.kpi.map((function(t){u.unregisterFromEvent(h(l.KdUl.orON.et)+"___"+t,n)}))}),p),l.KdUl.orON.kpi.map((function(t){t===l.rFlu.KdUl.CTVX?(u.unregisterFromEvent(_(c.KJQk)+"___"+c.KdUl.CTVX,n),u.registerForEvent(h(l.KdUl.orON.et)+"___"+t,n.RlTL)):u.registerForEvent(h(l.KdUl.orON.et)+"___"+t,n.lwFR)})))}else u.unregisterFromEvent(_(c.KJQk)+"___"+c.KdUl.CTVX,n),u.registerForEvent(_(l.KJQk)+"___"+l.KdUl.CTVX,n);n.vBOh[r]=Date.now()}})),s(this,"oueL",(function(t,e,r,i){var a=R.getInstance();_(n.PACz.KJQk)===t&&n.CFTa(r,n.PACz.Bfpr)&&n.PACz.KdUl.CTVX===e&&n.iGQO(n.PACz.KdUl.orON,i)&&(n.iqYa+=1,n.HLiN=n.tKdV(n.iqYa,n.PACz.YpuZ,n.PACz.SvML),n.HLiN&&(n.PACz.VAxM=r,a.validateForTermination(n.tTqB,n.nODh)))})),s(this,"gwDR",(function(t,e,r,i){var a=n.Pwgu.rFlu;return _(a.KJQk)===t&&a.KdUl.CTVX===e&&n.CFTa(r,a.Bfpr)&&n.iGQO(a.KdUl.orON,i)})),s(this,"CFTa",(function(t,e){var n=Math.ceil(t);return n>e.oxbV&&n<e.QyjH})),s(this,"tKdV",(function(t,e,r){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(i&&n.Pwgu.cmkQ&&(t+=n.BNbu),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,"iGQO",(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 g(t,i,a)}));n=n&&u}else n=n&&g(e[o],t[o],"EQ")};for(var o in t)if(i=a())return i.v}catch(t){P.error(t),n=!1}return n}))}return o(e,[{key:"_displayCampaign",value:function(t){var e=R.getInstance();this.HLiN=!0,this.HLiN&&(this.iqYa+=1,this.HLiN=this.tKdV(this.iqYa,this.Pwgu.YpuZ,this.Pwgu.SvML),this.HLiN&&(this.Pwgu.VAxM=t,e.validate(this.tTqB,this.nODh)))}}]),e}(),U=window.ApxorLogger,F=o((function e(){var n=this;i(this,e),s(this,"OuRa",[]),s(this,"_ret_day",{}),s(this,"ErWu",{}),s(this,"dqnh",!1),s(this,"rpSj",!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.OuRa=t.overall_cfg.events,n._ret_day=t.overall_cfg.ret_day,n.ErWu=t.overall_cfg.session,n.dqnh=t.overall_cfg.toggleRetDay,n.rpSj=t.overall_cfg.toggleSession}catch(t){return U.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.dqnh&&!isNaN(e)&&!(e>=n._ret_day.from&&e<=n._ret_day.to))return n.retainedDaysValidated=!1,!1;if(n.rpSj&&!isNaN(r)&&!(r>=n.ErWu.from&&r<=n.ErWu.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}(p(a,i)))),s=0;s<n.OuRa.length;s++){if(o[n.OuRa[s].name.replace("'","").replace("’","")])return n.eventDoneInLT=!0,!1}}catch(t){U.error("Failed to validate the lt count:"+t)}return!0}))})),X=window.ApxorLogger,B=o((function t(){var e=this;i(this,t),s(this,"ZfAX",[]),s(this,"kLZG",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.ZfAX=t.attributes.user,e.kLZG=t.attributes.session,!Array.isArray(e.ZfAX)||!Array.isArray(e.kLZG))return X.error("No attributes"),!1}catch(t){return X.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.KPjz(t,e.ZfAX)&&e.KPjz(n,e.kLZG)})),s(this,"KPjz",(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 g(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}))})),D=o((function e(){var n=this;i(this,e),s(this,"FOrk",t.getController()),s(this,"type",""),s(this,"_duration_seconds",0),s(this,"qKfs",1),s(this,"parse",(function(t){try{var e,r,i;if(n.owVv=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.qKfs=null===(i=t.terminate_info.time_based)||void 0===i?void 0:i.days,n.cJes(t._id))return n.FOrk.persistTerminationInfoLocally(t._id),!1}catch(t){return!1}return!0})),s(this,"cJes",(function(t){var e,r=JSON.parse(n.FOrk.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].ysVa;return s===n.qKfs&&u.hours>=l.hours||s>n.qKfs||r[t].goalAcheived}))})),k=o((function t(){var e=this;i(this,t),s(this,"enable_goal_events",!1),s(this,"attributes",{}),s(this,"NYIx",new B),s(this,"yGMZ",new D),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.yGMZ.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.NYIx.parse(t.terminate_info))return!1}catch(t){return window.ApxorLogger.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.NYIx.validate(t,n)}))})),Z=window.ApxorLogger,j=o((function e(){var r=this;i(this,e),s(this,"Qyfu",[]),s(this,"BCZU",[]),s(this,"tTqB",""),s(this,"YTKa",new b),s(this,"EHOf",new T),s(this,"HdbP",new C),s(this,"wXgl",new K),s(this,"qUBE",new F),s(this,"OyjG",new k),s(this,"scuX",!1),s(this,"KHpv",[]),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 Z.error("No Id"),!1;if(!d(t.enabled)||!t.enabled)return Z.error("Not enabled"),!1;if(!(r.YTKa.parse(t)&&r.HdbP.parse(t)&&r.wXgl.parse(t)&&r.EHOf.parse(t)&&r.qUBE.parse(t)&&r.OyjG.parse(t)))return!1;if(r._variant_code=r.YTKa._isExperiment||r.YTKa._only_context?null===(e=r.YTKa._attr)||void 0===e?void 0:e.apx_variant_code:"TG",!d(t.conditions)||!Array.isArray(t.conditions))return Z.error("No valid conditions",t.conditions),!1;r.tTqB=t._id,r.scuX=!!d(t.sequence_enabled)&&t.sequence_enabled,r.scuX&&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.KHpv=[];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.KHpv=[].concat(u(r.KHpv),[l])}var c=new q;c.initialize(o,r.tTqB,a,r.scuX,r.KHpv)&&r.Qyfu.push(c)}if(r.OyjG.enable_goal_events)for(var v=t.terminate_info.goal_events.events,f=v.length,p=0;p<f;p++){var _=new q;_.initialize(v[p],r.tTqB,p,!0,[],"termination")&&r.BCZU.push(_)}return r.Qyfu.length>0}catch(t){return Z.error(t),!1}})),s(this,"jKQM",(function(t){if(!(t<0))if(r.scuX){var e=r.Qyfu[t];if(d(e)&&e.HLiN){var n=r.Qyfu[t-1];if(d(n)&&!n.HLiN)return;var i=r.Qyfu[t+1];d(i)?i.zSnG():r.zWDC()}}else r.zWDC()})),s(this,"VcYO",(function(t){t<0||r.srDl()})),s(this,"zWDC",(function(){var e=t.getController().getUserAttributes(),i=t.getController().getSessionAttributes();if(!r.HdbP.validate()||!r.EHOf.validate(e,i)||!r.qUBE.validate())return r.qUBE.retainedDaysValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.YTKa.owVv?"survey":"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Retained day criteria not met"}),r.qUBE.retainedSessionValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.YTKa.owVv?"survey":"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"User session criteria not met"}),r.qUBE.eventDoneInLT&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.YTKa.owVv?"survey":"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Event done in life time"})),r.EHOf.userAttributesValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.YTKa.owVv?"survey":"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"User property filter not met"}),r.EHOf.sessionAttributeValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.YTKa.owVv?"survey":"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Session property filter not met"}),r.HdbP._not_yet_active&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.YTKa.owVv?"survey":"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"nudge not yet active"})),void(r.HdbP._nudge_expired&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.YTKa.owVv?"survey":"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"nudge expired"})));for(var a=r.Qyfu.length,o=a<1,s="",u=0;u<a;u++){var l=r.Qyfu[u],c=l.HLiN;if(""===s.trim())o=c;else switch(s){case"AND":o=o&&c;break;case"OR":o=o||c}s=l.ndXU}if(o){var d,v;if(console.debug("onCondition satisfied"),!r.wXgl.XinH(r.tTqB))return console.warn("Maximum limit reached",r.tTqB),void(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Campaign limit reached"}));null!==(d=window.ApxorRTM)&&void 0!==d&&d.isBadgePresent&&null!==(v=window.ApxorRTM)&&void 0!==v&&v.badgesLists.includes(r.tTqB)&&t.getController().isBadgeTriggerSatisfied(r.tTqB)||null==t||t.logEvent("apx_trigger_satisfied",{apx_nudge_type:"SURVEY"===r.YTKa.owVv?"survey":"campaign",apx_nudge_id:r.tTqB,apx_nudge_name:r.YTKa.CTVX,apx_variant_code:r.YTKa._isExperiment||r.YTKa._only_context?r.YTKa._attr.apx_variant_code:"TG"}),console.log("Dispatching event",r.YTKa.owVv),!0===r.YTKa._only_context&&t.logEvent("apx_context_evaluated",n(n({},r.YTKa._attr),{},{message_name:r.YTKa.CTVX,id:r.tTqB})),t.getController().dispatchEvent(r.YTKa.owVv,{name:r.YTKa.owVv,additional_info:{uuid:r.tTqB,name:r.YTKa.CTVX}})}})),s(this,"srDl",(function(){for(var e=r.BCZU.length,i=e<1,a="",o=0;o<e;o++){var s=r.BCZU[o],u=s.HLiN;if(""===a.trim())i=u;else switch(a){case"AND":i=i&&u;break;case"OR":i=i||u}a=s.Pxjw}i&&(console.log("Dispatching event",r.YTKa.owVv),t.getController().persistTerminationInfoLocally(r.tTqB),!0===r.YTKa._only_context&&t.logEvent("apx_context_evaluated",n(n({},r.YTKa._attr),{},{message_name:r.YTKa.CTVX,id:r.tTqB})),t.getController().dispatchEvent(r.YTKa.owVv,{name:r.YTKa.owVv,additional_info:{uuid:r.tTqB,name:r.YTKa.CTVX}}))})),s(this,"validateForTerminationAttributes",(function(){var e=t.getController().getUserAttributes(),n=t.getController().getSessionAttributes();return r.OyjG.validate(e,n)})),s(this,"aokP",(function(){r.wXgl.aokP()})),s(this,"getFrequencyCount",(function(){return r.wXgl.getFrequencyCount()})),s(this,"unSR",(function(){return r.wXgl.mtuI()}))})),I=o((function t(){var e=this;i(this,t),s(this,"Nxlp",{}),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 j;o.parse(i)?e.Nxlp[a]=o:console.warn("Failed to parse cfg",a)}}})),s(this,"validate",(function(t,n){e.Nxlp[t]&&e.Nxlp[t].jKQM(n)})),s(this,"getVariantCode",(function(t){return e.Nxlp[t]?e.Nxlp[t]._variant_code:""})),s(this,"validateForTermination",(function(t,n){e.Nxlp[t]&&e.Nxlp[t].VcYO(n)})),s(this,"validateForTerminationAttributes",(function(t){return!!e.Nxlp[t]&&e.Nxlp[t].validateForTerminationAttributes()})),s(this,"aokP",(function(t){e.Nxlp[t].aokP()})),s(this,"getFrequencyCount",(function(t){return e.Nxlp[t].getFrequencyCount()})),s(this,"resetFrequencyCounts",(function(){var t=e.Nxlp;for(var n in t)t[n].unSR()})),s(this,"MRwp",(function(t){try{if(e.Nxlp){var n=e.Nxlp[t];if(n&&n.YTKa)return n.YTKa}}catch(t){console.log("Error in getting the campaign meta ".concat(t))}return{}}))})),Q=window.ApxorLogger,H=o((function e(){var n=this;i(this,e),s(this,"Cwvl",{}),s(this,"LCmY",[]),s(this,"TBZE",!1),s(this,"initialize",(function(){var e=t.getController();e.registerForEvent("APP_EVENT",(function(t){return n.uTFw(t,"AE")})),e.registerForEvent("CLIENT_EVENT",(function(t){return n.uTFw(t,"CE")}))})),s(this,"PseG",(function(){for(var t in n.LCmY)n.AqCu(t.event,t.key,t.type);n.TBZE=!0})),s(this,"OVFP",(function(t,e){var r;"function"==typeof e&&((r=n.Cwvl[t]?n.Cwvl[t]:[]).push(e),n.Cwvl[t]=r,Q.debug("Listeners list: ",n.Cwvl))})),s(this,"unregisterFromEvent",(function(t,e){if(n.Cwvl[t]){for(var r=n.Cwvl[t],i=[],a=0;a<r.length;a++){var o=r[a];o!==e&&i.push(o)}n.Cwvl[t]=i}})),s(this,"uTFw",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AE",r=e+"___"+t.name;n.AqCu(t,r,e)})),s(this,"AqCu",(function(e,r,i){if(n.TBZE){if(Q.debug("Notifying listeners for event: "+e+", "+r,n.Cwvl),n.Cwvl[r])for(var a=n.Cwvl[r],o=t.getController().getSDKRunningTimeInSec(),s=0;s<a.length;s++){(0,a[s])(i,e.name,o,e.additional_info)}}else n.LCmY.push({event:e,key:r,type:i})}))})),z=window.ApxorLogger,R=function(){function e(){var n=this;return i(this,e),s(this,"jnoF",!1),s(this,"dXeZ",null),s(this,"yqdw",m()),s(this,"mBNE",new H),s(this,"DtLZ",t.getSiteId()),s(this,"zSlf",{}),s(this,"getQeState",(function(){try{var e=t.getController().getFromStorage("qe_state");return e?JSON.parse(p(n.DtLZ,e)):(n.zSlf={},n.setQeState())}catch(t){return n.zSlf={},n.setQeState()}})),s(this,"setQeState",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{t.getController().persistToStorage("qe_state",n.zSlf,!0)}catch(r){""===e?n.zSlf={}:n.zSlf[e]={SESSION:0,OVERALL:0,DATES:{}},t.getController().persistToStorage("qe_state",n.zSlf,!0)}return n.zSlf})),s(this,"initialize",(function(){n.jnoF||(n.jnoF=!0,n.dXeZ=new I,n.mBNE.initialize(),n.zSlf=n.getQeState(),z.info("QE Initialized.."))})),s(this,"parse",(function(t){n.JpIa()?(n.dXeZ.parse(t),n.mBNE.PseG()):z.warn("Must call init first. Unable to proceed")})),s(this,"validate",(function(t,e){n.JpIa()&&n.dXeZ.validate(t,e)})),s(this,"getVariantCode",(function(t){return n.dXeZ.getVariantCode(t)})),s(this,"validateForTermination",(function(t,e){n.JpIa()&&n.dXeZ.validateForTermination(t,e)})),s(this,"validateForTerminationAttributes",(function(t,e){return n.dXeZ.validateForTerminationAttributes(t,e)})),s(this,"updateCount",(function(t){try{d(n.zSlf[t])||n.createObjConfig(t),n.incrementFrequencies(t),n.setQeState(t),n.dXeZ.aokP(t)}catch(t){console.log("Could not update the count config:".concat(t))}})),s(this,"resetFrequencyCounts",(function(){n.dXeZ.resetFrequencyCounts()})),s(this,"getFrequencyCount",(function(t){return n.dXeZ.getFrequencyCount(t)})),s(this,"registerForEvent",(function(t,e){n.mBNE.OVFP(t,e)})),s(this,"unregisterFromEvent",(function(t,e){n.mBNE.unregisterFromEvent(t,e)})),s(this,"notifyEventListener",(function(t){n.mBNE.uTFw(t)})),s(this,"fetch",(function(e,n,r,i){t.getController().fetchConfiguration(e,n,r,i)})),s(this,"JpIa",(function(){return n.jnoF})),s(this,"getCampaignMetaFromQueryEngine",(function(t){return n.dXeZ.MRwp(t)})),s(this,"lXby",(function(){return n.yqdw})),e.instance||(e.instance=this),e.instance}return o(e,[{key:"createObjConfig",value:function(t){try{this.zSlf=this.getQeState(),d(this.zSlf[t])||(this.zSlf[t]={SESSION:0,OVERALL:0,DATES:{}},this.yqdw&&(this.zSlf[t].DATES[this.yqdw]=0),this.setQeState(t))}catch(t){z.error("Can not create the frequency count object:"+t)}}},{key:"incrementFrequencies",value:function(t){this.zSlf=this.getQeState();var e=this.zSlf[t];e.SESSION=e.SESSION+1,e.OVERALL=e.OVERALL+1;var n=m();n===this.yqdw&&e.DATES&&e.DATES[n]||(this.yqdw=n,e.DATES={},e.DATES[this.yqdw]=0),e.DATES[this.yqdw]=e.DATES[this.yqdw]+1}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}();s(R,"instance",void 0),window.ceVersion=150;try{void 0===exports&&null===exports||(exports.default=R,module.exports=exports.default)}catch(t){}return R}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apxor-qe",
3
- "version": "1.4.1",
3
+ "version": "1.5.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.3.1"
55
+ "apxor": "2.4.0"
56
56
  },
57
57
  "files": [
58
58
  "dist"