apxor-qe 1.1.8 → 1.1.9-qa

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 r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}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 n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function o(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=c(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(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 r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))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 r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function c(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;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=function(t){return void 0!==t&&!function(t){return null===t}(t)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function h(t,e){return Array.from(e).map((function(e,r){return String.fromCharCode(e^function(t,e){return t.charCodeAt(Math.floor(e%t.length))}(t,r))})).join("")}var v=function(t,e){return h(t,e=function(t){var e,r,n,i,o,s,a=0,u=[];if(!t)return t;t+="";do{e=(s=l.indexOf(t.charAt(a++))<<18|l.indexOf(t.charAt(a++))<<12|(i=l.indexOf(t.charAt(a++)))<<6|(o=l.indexOf(t.charAt(a++))))>>16&255,r=s>>8&255,n=255&s,u.push(e),64!==i&&(u.push(r),64!==o&&u.push(n))}while(a<t.length);return u}(e))},d=function(t){switch(t){case"app_event":return"AE";case"client_event":return"CE";case"activity_time":case"activity_event":return"AE"}return"Unknown"},g=function(t){return t.toUpperCase()},y=function(t,e,r){switch(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;case"NEQ":return t!==e;case"R":return p(e).test(t);default:return!1}},p=function(t){var e=t.replace(/.*\/([gimuy]*)$/,"$1");e===t&&(e="");var r=e?t.replace(new RegExp("^/(.*?)/"+e+"$"),"$1"):t;return new RegExp(r,e)},m=function(){var t=new Date;return t.getDate()+"/"+t.getMonth()+"/"+t.getFullYear()},E=window.ApxorLogger,_=o((function e(){var i=this;n(this,e),s(this,"OfVB","ALL"),s(this,"ettn",[]),s(this,"vUUM",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(i.OfVB=t.audience.audience_type,i.ettn=t.audience.attributes.user,i.vUUM=t.audience.attributes.session,!Array.isArray(i.ettn)||!Array.isArray(i.vUUM))return E.error("No attributes"),!1}catch(t){return E.error(t),!1}return!0})),s(this,"validate",(function(e,r){var n=!0;return"FTU"===i.OfVB&&(n=t.getController().getSessionInfo().is_first_session),n&&i.exjS(e,i.ettn)&&i.exjS(r,i.vUUM)})),s(this,"exjS",(function(t,e){var n=e.length,i=!0;try{for(var o=function(){var r=e[s];if(!t.hasOwnProperty(r.name)||!1===i)return{v:!1};var n=r.operator,o=r.type,a=r.value.map((function(t){return"s"===o?t:"l"===o?parseInt(t):"f"===o?parseFloat(t):void 0})),u=(Array.isArray(t[r.name])?t[r.name]:[t[r.name]]).some((function(t){return a.some((function(e){return y(t,e,n)}))}));i=i&&u},s=0;s<n;s++){var a=o();if("object"===r(a))return a.v}}catch(t){E.error(t),i=!1}return i}))})),w=window.ApxorLogger,b=o((function t(){var e=this;n(this,t),s(this,"Emou",0),s(this,"GhBW",0),s(this,"simP","SESSION"),s(this,"IJYj",0),s(this,"wXLA",0),s(this,"ZSMr",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.Emou=t.frequency.count,e.ZSMr=e.Emou,e.GhBW=t.frequency.time_interval,e.simP=t.frequency.validity,e.wXLA=t.frequency.ses_lmt,e._dayCount=t.frequency.day_lmt;var r=T.getInstance().getQeState();if(!f(r)||!f(r[t._id]))return!0;if("SESSION"===e.simP){if(e.Emou=parseInt(e.Emou)-parseInt(r[t._id].SESSION),e.Emou<=0)return console.warn("Max count limit reached for session:"+t._id),!1}else{if("OVERALL"!==e.simP)return w.info("Invalid config."),!1;if(e.Emou=parseInt(e.Emou)-parseInt(r[t._id].OVERALL),e.Emou<=0)return console.warn("Max count limit reached for overall:"+t._id),!1}}catch(t){return w.error(t),!1}return!0})),s(this,"bqry",(function(){e.Emou=e.Emou-1})),s(this,"getFrequencyCount",(function(){return e.Emou})),s(this,"tmtM",(function(){"SESSION"===e.simP&&(e.Emou=e.ZSMr,w.info("Campaign Limit reset"))})),s(this,"yLDu",(function(t){try{if(e.Emou<=0)return!1;var r=T.getInstance().getQeState();if(!f(r)||!f(r[t]))return!0;if(0!==e.wXLA)if(parseInt(e.wXLA)-parseInt(r[t].SESSION)<=0)return!1;if(0!==e._dayCount){T.getInstance();var n,i=m();if(parseInt(e._dayCount)-parseInt((null===(n=r[t])||void 0===n?void 0:n.DATES[i])||0)<=0)return!1}}catch(t){w.error("Error validating the frequency:"+t)}return!0}))})),U=o((function t(){var e=this;n(this,t),s(this,"UMma",""),s(this,"OfVB",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var r;e.UMma=t.meta.name,e.OfVB=t.meta.type,e._only_context=t.meta.only_context,e._attr=(null===(r=t.meta)||void 0===r?void 0:r.attr)||{}}catch(t){return window.ApxorLogger.error(t),!1}return!0}))})),k=window.ApxorLogger,S=o((function t(){var e=this;n(this,t),s(this,"goYt",-1),s(this,"JWXa",-1),s(this,"Ejxd",-1),s(this,"PDvT",-1),s(this,"Mihk",!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 k.error("Not valid dates"),!1;if(e.goYt=Date.parse(t.validity.start_date),e.JWXa=Date.parse(t.validity.end_date),f(t.time_limits_in_day)&&(e.Mihk=t.time_limits_in_day,e.Mihk&&f(t.time_limits))){var r=(new Date).toISOString().split("T")[0];if(e.Ejxd=Date.parse(r+"T"+t.time_limits.start_time+".000Z"),e.PDvT=Date.parse(r+"T"+t.time_limits.end_time+".000Z"),isNaN(e.Ejxd)||isNaN(e.PDvT))return k.error("Not valid times"),!1}}catch(t){return k.error(t),!1}return!0})),s(this,"validate",(function(){var t=Date.now();return t>e.goYt&&t<e.JWXa&&(!e.Mihk||t>=e.Ejxd&&t<=e.PDvT)}))})),I=o((function t(){var e=this;n(this,t),s(this,"UMma",""),s(this,"VIEi",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.UMma=t.name,e.VIEi=t.additional_info}catch(t){return!1}return!0}))})),A=o((function t(){var e=this;n(this,t),s(this,"PsJB",0),s(this,"grao",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.PsJB=Number(t.lower),e.grao=Number(t.upper),isNaN(e.PsJB)||isNaN(e.grao))return!1}catch(t){return!1}return!0}))})),L=o((function t(){var e=this;n(this,t),s(this,"CbXU",0),s(this,"ewls",""),s(this,"MVxz",""),s(this,"sekt",new I),s(this,"tUBQ",new A),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.ewls=t.event_type,e.MVxz=t.activity,e.sekt.parse(t.details)&&e.tUBQ.parse(t.time_bounds)}catch(t){return!1}}))})),O=o((function t(){var e=this;n(this,t),s(this,"CbXU",0),s(this,"WLxu",-1),s(this,"Emou",0),s(this,"KWDf",""),s(this,"MVxz",""),s(this,"ewls",""),s(this,"tUBQ",new A),s(this,"sekt",new I),s(this,"NOVF",new L),s(this,"TfZt","AND"),s(this,"CoRw",!1),s(this,"OfVB",void 0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.WLxu=t.sequence,e.Emou=t.count_config.count,e.KWDf=t.count_config.operator,e.MVxz=t.activity,e.ewls=t.event_type,e.TfZt=t.combine_operator,e.OfVB=t.type,e.sekt.parse(t.details)&&e.NOVF.parse(t.trigger)&&e.tUBQ.parse(t.time_bounds)}catch(t){return Logger.error(t),!1}}))})),N=window.ApxorLogger,Q=function(){function e(){var i=this;n(this,e),s(this,"IMqs",0),s(this,"gXrs",""),s(this,"yQUu",new O),s(this,"BBeS",!1),s(this,"kLHJ",!1),s(this,"sokt",0),s(this,"TfZt","AND"),s(this,"YGYC",-1),s(this,"VbaS",[]),s(this,"XMjs",{}),s(this,"OJJJ",!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]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];i.gXrs=r,i.sokt=n,i.VbaS=s;var a=i.yQUu.parse(e);if(a){if(i.TfZt=i.yQUu.TfZt,i.yQUu.CoRw){var u=i.yQUu.sekt.UMma;"APX_PAGE_OPENED"===u&&(u=i.yQUu.sekt.VIEi.navigation_id,u=isDefined(u)?u:i.yQUu.sekt.UMma),i.YGYC=t.getController().getEventCount(u);var c=i.yQUu.Emou,f=i.yQUu.KWDf;if(i.kLHJ=i.qIkJ(i.YGYC-1,c,f,!1),i.BBeS=i.kLHJ,i.kLHJ&&"APX_PAGE_OPENED"===i.yQUu.sekt.UMma)return!0}return o&&0!==n||i.czbJ(),!0}return!1})),s(this,"czbJ",(function(){var t=i.yQUu,e=t.NOVF,r=T.getInstance();"app_start"===e.ewls?(i.BBeS=!0,r.registerForEvent(d(t.ewls)+"___"+t.sekt.UMma,i.duSt)):r.registerForEvent(d(t.ewls)+"___"+e.sekt.UMma,i.duSt)})),s(this,"psBN",(function(t,e,r,n){var o,s,a,u=(Date.now()-i.XMjs[e])/1e3;(null===(o=i.yQUu)||void 0===o||null===(s=o.sekt)||void 0===s||null===(a=s.VIEi)||void 0===a?void 0:a.time)/1e3>u&&i._displayCampaign(r)})),s(this,"AjAw",(function(t,e,r,n){var o,s,a,u,c;i.OJJJ=!0;var f=Date.now(),l=null===(o=i.yQUu)||void 0===o||null===(s=o.NOVF)||void 0===s?void 0:s.sekt.UMma,h=(f-i.XMjs[l])/1e3,v=null===(a=i.yQUu)||void 0===a||null===(u=a.sekt)||void 0===u||null===(c=u.VIEi)||void 0===c?void 0:c.time;(v/=1e3)>h&&i._displayCampaign(r)})),s(this,"duSt",(function(t,e,r,n){var o=T.getInstance();if(i.BBeS)d(i.yQUu.ewls)===t&&i.KAEL(r-i.yQUu.NOVF.CbXU,i.yQUu.tUBQ)&&i.yQUu.sekt.UMma===e&&i.oBze(i.yQUu.sekt.VIEi,n)&&(i.IMqs+=1,i.kLHJ=i.qIkJ(i.IMqs,i.yQUu.Emou,i.yQUu.KWDf),i.kLHJ&&(i.yQUu.CbXU=r,o.validate(i.gXrs,i.sokt)));else if(i.BBeS=i.diIq(t,e,r,n),i.BBeS){var s=i.yQUu,a=s.NOVF;if(a.CbXU=r,"activity_time"===(null==s?void 0:s.ewls)){var u,c,f,l,h,v,y=null==s||null===(u=s.sekt)||void 0===u||null===(c=u.VIEi)||void 0===c?void 0:c.time;(null==s||null===(f=s.sekt)||void 0===f||null===(l=f.VIEi)||void 0===l?void 0:l.nkpi.length)>0&&(setTimeout((function(){i.OJJJ||(i.kLHJ=!0,i.kLHJ&&(i.IMqs+=1,i.kLHJ=i.qIkJ(i.IMqs,i.yQUu.Emou,i.yQUu.KWDf),i.kLHJ&&(i.yQUu.CbXU=r,o.validate(i.gXrs,i.sokt)))),s.sekt.VIEi.nkpi.map((function(t){o.unregisterFromEvent(g(s.sekt.VIEi.et)+"___"+t,i)}))}),y),s.sekt.VIEi.nkpi.map((function(t){o.registerForEvent(g(s.sekt.VIEi.et)+"___"+t,i.AjAw)}))),(null==s||null===(h=s.sekt)||void 0===h||null===(v=h.VIEi)||void 0===v?void 0:v.kpi.length)>0&&(setTimeout((function(){s.sekt.VIEi.kpi.map((function(t){o.unregisterFromEvent(g(s.sekt.VIEi.et)+"___"+t,i)}))}),y),s.sekt.VIEi.kpi.map((function(t){t===s.NOVF.sekt.UMma?(o.unregisterFromEvent(d(a.ewls)+"___"+a.sekt.UMma,i),o.registerForEvent(g(s.sekt.VIEi.et)+"___"+t,i.psBN)):o.registerForEvent(g(s.sekt.VIEi.et)+"___"+t,i.AjAw)})))}else o.unregisterFromEvent(d(a.ewls)+"___"+a.sekt.UMma,i),o.registerForEvent(d(s.ewls)+"___"+s.sekt.UMma,i);i.XMjs[e]=Date.now()}})),s(this,"diIq",(function(t,e,r,n){var o=i.yQUu.NOVF;return d(o.ewls)===t&&o.sekt.UMma===e&&i.KAEL(r,o.tUBQ)&&i.oBze(o.sekt.VIEi,n)})),s(this,"KAEL",(function(t,e){var r=Math.round(t);return r>e.PsJB&&r<e.grao})),s(this,"qIkJ",(function(t,e,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(n&&i.yQUu.CoRw&&(t+=i.YGYC),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,"oBze",(function(t,e){var n=!0;try{var i=function(){if(!e.hasOwnProperty(o)||!1===n)return{v:!1};if("object"===r(t[o])){var i,s=t[o].op,a=t[o].t;"s"===a?i=t[o].val:"l"!==a&&"f"!==a||(i=parseFloat(t[o].val));var u=(Array.isArray(e[o])?e[o]:[e[o]]).some((function(t){return y(t,i,s)}));n=n&&u}else n=n&&y(e[o],t[o],"EQ")};for(var o in t){var s=i();if("object"===r(s))return s.v}}catch(t){N.error(t),n=!1}return n}))}return o(e,[{key:"_displayCampaign",value:function(t){var e=T.getInstance();this.kLHJ=!0,this.kLHJ&&(this.IMqs+=1,this.kLHJ=this.qIkJ(this.IMqs,this.yQUu.Emou,this.yQUu.KWDf),this.kLHJ&&(this.yQUu.CbXU=t,e.validate(this.gXrs,this.sokt)))}}]),e}(),q=o((function e(){var r=this;n(this,e),s(this,"bARU",[]),s(this,"_ret_day",{}),s(this,"GZRU",{}),s(this,"Nqnt",!1),s(this,"dUFp",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{r.bARU=t.overall_cfg.events,r._ret_day=t.overall_cfg.ret_day,r.GZRU=t.overall_cfg.session,r.Nqnt=t.overall_cfg.toggleRetDay,r.bARU=t.overall_cfg.events,r.dUFp=t.overall_cfg.toggleSession}catch(t){return Logger.error(error),!1}return!0})),s(this,"validate",(function(){var e=parseInt(t.getController().getFromStorage("apx_retained_days")),n=parseInt(t.getController().getFromStorage("apx_retained_session"));if(r.Nqnt&&!isNaN(e)&&!(e>=r._ret_day.from&&e<=r._ret_day.to))return!1;if(r.dUFp&&!isNaN(n)&&!(n>=r.GZRU.from&&n<=r.GZRU.to))return!1;try{for(var i=t.getController().getFromStorage("_apx_lt_count"),o=t.getSiteId(),s=JSON.parse(v(o,i)),a=0;a<r.bARU.length;a++){var u=r.bARU[a].name.replace("'","").replace("’","");if(s.hasOwnProperty(u))return!1}}catch(t){Logger.error("Failed to validate the lt count:"+t)}return!0}))})),x=window.ApxorLogger,C=o((function r(){var i=this;n(this,r),s(this,"otLU",[]),s(this,"gXrs",""),s(this,"jfwg",new U),s(this,"ezqH",new _),s(this,"simP",new S),s(this,"EiWZ",new b),s(this,"TjgD",new q),s(this,"mWeK",!1),s(this,"iLkJ",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(!f(t._id))return x.error("No Id"),!1;if(!f(t.enabled)||!t.enabled)return x.error("Not enabled"),!1;if(!(i.jfwg.parse(t)&&i.simP.parse(t)&&i.EiWZ.parse(t)&&i.ezqH.parse(t)&&i.TjgD.parse(t)))return!1;if(!f(t.conditions)||!Array.isArray(t.conditions))return x.error("No valid conditions",t.conditions),!1;i.gXrs=t._id,i.mWeK=!!f(t.sequence_enabled)&&t.sequence_enabled,i.mWeK&&t.conditions.sort((function(t,e){return t.sequence<e.sequence}));for(var e=t.conditions,r=e.length,n=0;n<r;n++){i.iLkJ=[];var o=e[n];if("didn't"===o.type){var s,u,c={trigger_key:o.trigger.details.name,no_kpi_array:null==o||null===(s=o.details)||void 0===s||null===(u=s.additional_info)||void 0===u?void 0:u.nkpi,condition_id:null==o?void 0:o._id,time_bounds:o.time_bounds.upper};i.iLkJ=[].concat(a(i.iLkJ),[c])}var l=new Q;l.initialize(o,i.gXrs,n,i.mWeK,i.iLkJ)&&i.otLU.push(l)}return i.otLU.length>0}catch(t){return x.error(t),!1}})),s(this,"cbQp",(function(t){if(!(t<0))if(i.mWeK){var e=i.otLU[t];if(f(e)&&e.kLHJ){var r=i.otLU[t-1];if(f(r)&&!r.kLHJ)return;var n=i.otLU[t+1];f(n)?n.czbJ():i.WcYv()}}else i.WcYv()})),s(this,"WcYv",(function(){var r=t.getController().getUserAttributes(),n=t.getController().getSessionAttributes();if(i.simP.validate()&&i.ezqH.validate(r,n)&&i.TjgD.validate()){for(var o=i.otLU.length,a=o<1,u="",c=0;c<o;c++){var f=i.otLU[c],l=f.kLHJ;if(""===u.trim())a=l;else switch(u){case"AND":a=a&&l;break;case"OR":a=a||l}u=f.TfZt}if(a){if(console.debug("onCondition satisfied"),!i.EiWZ.yLDu(i.gXrs))return void console.warn("Maximum limit reached",i.gXrs);console.log("Dispatching event",i.jfwg.OfVB),!0===i.jfwg._only_context&&t.logEvent("apx_context_evaluated",function(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach((function(e){s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},i.jfwg._attr)),t.getController().dispatchEvent(i.jfwg.OfVB,{name:i.jfwg.OfVB,additional_info:{uuid:i.gXrs,name:i.jfwg.UMma}})}}})),s(this,"bqry",(function(){i.EiWZ.bqry()})),s(this,"getFrequencyCount",(function(){return i.EiWZ.getFrequencyCount()})),s(this,"HUdh",(function(){return i.EiWZ.tmtM()}))})),J=o((function t(){var e=this;n(this,t),s(this,"LNoX",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{configs:[]};if(f(t)&&f(t.configs)){var r=t.configs;if(!Array.isArray(r))return;r.sort((function(t,e){var r,n;return(null!==(r=t.prio)&&void 0!==r?r:-1)-(null!==(n=e.prio)&&void 0!==n?n:-1)}));for(var n=0;n<r.length;n++){var i=r[n],o=i._id,s=new C;s.parse(i)?e.LNoX[o]=s:console.warn("Failed to parse cfg",o)}}})),s(this,"validate",(function(t,r){e.LNoX.hasOwnProperty(t)&&e.LNoX[t].cbQp(r)})),s(this,"bqry",(function(t){e.LNoX[t].bqry()})),s(this,"getFrequencyCount",(function(t){return e.LNoX[t].getFrequencyCount()})),s(this,"resetFrequencyCounts",(function(){var t=e.LNoX;for(var r in t)t[r].HUdh()})),s(this,"PHJV",(function(t){if(Array.isArray(e.LNoX)){var r=e.LNoX[t];if(r)return r.jfwg}return{}}))})),j=window.ApxorLogger,V=o((function e(){var r=this;n(this,e),s(this,"HxTr",{}),s(this,"oqbQ",[]),s(this,"QtRQ",!1),s(this,"initialize",(function(){var e=t.getController();e.registerForEvent("APP_EVENT",(function(t){return r.RyTO(t,"AE")})),e.registerForEvent("CLIENT_EVENT",(function(t){return r.RyTO(t,"CE")}))})),s(this,"ZDXN",(function(){for(var t in r.oqbQ)r.qMVa(t.event,t.key,t.type);r.QtRQ=!0})),s(this,"qcxk",(function(t,e){var n;"function"==typeof e&&((n=r.HxTr[t]?r.HxTr[t]:[]).push(e),r.HxTr[t]=n,j.debug("Listeners list: ",r.HxTr))})),s(this,"unregisterFromEvent",(function(t,e){if(r.HxTr[t]){for(var n=r.HxTr[t],i=[],o=0;o<n.length;o++){var s=n[o];s!==e&&i.push(s)}r.HxTr[t]=i}})),s(this,"RyTO",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AE",n=e+"___"+t.name;r.qMVa(t,n,e)})),s(this,"qMVa",(function(e,n,i){if(r.QtRQ){if(j.debug("Notifying listeners for event: "+e+", "+n,r.HxTr),r.HxTr[n])for(var o=r.HxTr[n],s=t.getController().getSDKRunningTimeInSec(),a=0;a<o.length;a++){(0,o[a])(i,e.name,s,e.additional_info)}}else r.oqbQ.push({event:e,key:n,type:i})}))})),F=window.ApxorLogger,T=function(){function e(){var r=this;return n(this,e),s(this,"UGsj",!1),s(this,"gFZz",null),s(this,"yJkn",m()),s(this,"GXGW",new V),s(this,"AyEV",t.getSiteId()),s(this,"rIKH",{}),s(this,"getQeState",(function(){try{var e=t.getController().getFromStorage("qe_state");return e?JSON.parse(v(r.AyEV,e)):(r.rIKH={},r.setQeState())}catch(t){return r.rIKH={},r.setQeState()}})),s(this,"setQeState",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{t.getController().persistToStorage("qe_state",r.rIKH,!0)}catch(n){""===e?r.rIKH={}:r.rIKH[e]={SESSION:0,OVERALL:0,DATES:{}},t.getController().persistToStorage("qe_state",r.rIKH,!0)}return r.rIKH})),s(this,"initialize",(function(){r.UGsj||(r.UGsj=!0,r.gFZz=new J,r.GXGW.initialize(),r.rIKH=r.getQeState(),F.info("QE Initialized.."))})),s(this,"parse",(function(t){r.wZyE()?(r.gFZz.parse(t),r.GXGW.ZDXN()):F.warn("Must call init first. Unable to proceed")})),s(this,"validate",(function(t,e){r.wZyE()&&r.gFZz.validate(t,e)})),s(this,"updateCount",(function(t){try{f(r.rIKH[t])||r.createObjConfig(t),r.incrementFrequencies(t),r.setQeState(t),r.gFZz.bqry(t)}catch(t){console.log("Could not update the count config:".concat(t))}})),s(this,"resetFrequencyCounts",(function(){r.gFZz.resetFrequencyCounts()})),s(this,"getFrequencyCount",(function(t){return r.gFZz.getFrequencyCount(t)})),s(this,"registerForEvent",(function(t,e){r.GXGW.qcxk(t,e)})),s(this,"unregisterFromEvent",(function(t,e){r.GXGW.unregisterFromEvent(t,e)})),s(this,"fetch",(function(e,r,n,i){t.getController().fetchConfiguration(e,r,n,i)})),s(this,"wZyE",(function(){return r.UGsj})),s(this,"getCampaignMetaFromQueryEngine",(function(t){return r.gFZz.PHJV(t)})),s(this,"xfag",(function(){return r.yJkn})),e.instance||(e.instance=this),e.instance}return o(e,[{key:"createObjConfig",value:function(t){try{this.rIKH=this.getQeState(),f(this.rIKH[t])||(this.rIKH[t]={SESSION:0,OVERALL:0,DATES:{}},this.yJkn&&(this.rIKH[t].DATES[this.yJkn]=0),this.setQeState(t))}catch(t){F.error("Can not create the frequency count object:"+t)}}},{key:"incrementFrequencies",value:function(t){this.rIKH=this.getQeState();var e=this.rIKH[t];e.SESSION=e.SESSION+1,e.OVERALL=e.OVERALL+1;var r=m();r!==this.yJkn&&(this.yJkn=r,e.DATES={},e.DATES[this.yJkn]=0),e.DATES[this.yJkn]=e.DATES[this.yJkn]+1}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}();s(T,"instance",void 0),window.ceVersion=118;try{void 0===exports&&null===exports||(exports.default=T,module.exports=exports.default)}catch(t){}return T}));
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 r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function r(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach((function(e){s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function n(t){return(n="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 r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,f(n.key),n)}}function a(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=f(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(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 r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))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 r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function f(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;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)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function v(t,e){return Array.from(e).map((function(e,r){return String.fromCharCode(e^function(t,e){return t.charCodeAt(Math.floor(e%t.length))}(t,r))})).join("")}var d=function(t,e){return v(t,e=function(t){var e,r,n,i,o,a,s=0,c=[];if(!t)return t;t+="";do{e=(a=l.indexOf(t.charAt(s++))<<18|l.indexOf(t.charAt(s++))<<12|(i=l.indexOf(t.charAt(s++)))<<6|(o=l.indexOf(t.charAt(s++))))>>16&255,r=a>>8&255,n=255&a,c.push(e),64!==i&&(c.push(r),64!==o&&c.push(n))}while(s<t.length);return c}(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,r){switch(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;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 r=e?t.replace(new RegExp("^/(.*?)/"+e+"$"),"$1"):t;return new RegExp(r,e)},_=function(){var t=new Date;return t.getDate()+"/"+t.getMonth()+"/"+t.getFullYear()},S=window.ApxorLogger,x=a((function e(){var r=this;i(this,e),s(this,"UyeA","ALL"),s(this,"yyom",[]),s(this,"jEHM",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(r.UyeA=t.audience.audience_type,r.yyom=t.audience.attributes.user,r.jEHM=t.audience.attributes.session,!Array.isArray(r.yyom)||!Array.isArray(r.jEHM))return S.error("No attributes"),!1}catch(t){return S.error(t),!1}return!0})),s(this,"validate",(function(e,n){var i=!0;return"FTU"===r.UyeA&&(i=t.getController().getSessionInfo().is_first_session),i&&r.KpSk(e,r.yyom)&&r.KpSk(n,r.jEHM)})),s(this,"KpSk",(function(t,e){var r=e.length,i=!0;try{for(var o=function(){var r=e[a];if(!t.hasOwnProperty(r.name)||!1===i)return{v:!1};var n=r.operator,o=r.type,s=r.value.map((function(t){return"s"===o?t:"l"===o?parseInt(t):"f"===o?parseFloat(t):void 0})),c=(Array.isArray(t[r.name])?t[r.name]:[t[r.name]]).some((function(t){return s.some((function(e){return y(t,e,n)}))}));i=i&&c},a=0;a<r;a++){var s=o();if("object"===n(s))return s.v}}catch(t){S.error(t),i=!1}return i}))})),b=window.ApxorLogger,E=a((function t(){var e=this;i(this,t),s(this,"ZjTK",0),s(this,"boPN",0),s(this,"cvxt","SESSION"),s(this,"mzQU",0),s(this,"RbMC",0),s(this,"CMct",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.ZjTK=t.frequency.count,e.CMct=e.ZjTK,e.boPN=t.frequency.time_interval,e.cvxt=t.frequency.validity,e.RbMC=t.frequency.ses_lmt,e._dayCount=t.frequency.day_lmt;var r=Q.getInstance().getQeState();if(!h(r)||!h(r[t._id]))return!0;if("SESSION"===e.cvxt){if(e.ZjTK=parseInt(e.ZjTK)-parseInt(r[t._id].SESSION),e.ZjTK<=0)return console.warn("Max count limit reached for session:"+t._id),!1}else{if("OVERALL"!==e.cvxt)return b.info("Invalid config."),!1;if(e.ZjTK=parseInt(e.ZjTK)-parseInt(r[t._id].OVERALL),e.ZjTK<=0)return console.warn("Max count limit reached for overall:"+t._id),!1}}catch(t){return b.error(t),!1}return!0})),s(this,"gQZN",(function(){e.ZjTK=e.ZjTK-1})),s(this,"getFrequencyCount",(function(){return e.ZjTK})),s(this,"flSr",(function(){"SESSION"===e.cvxt&&(e.ZjTK=e.CMct,b.info("Campaign Limit reset"))})),s(this,"Ldoq",(function(t){try{if(e.ZjTK<=0)return!1;var r=Q.getInstance().getQeState();if(!h(r)||!h(r[t]))return!0;if(0!==e.RbMC)if(parseInt(e.RbMC)-parseInt(r[t].SESSION)<=0)return!1;if(0!==e._dayCount){Q.getInstance();var n,i=_();if(parseInt(e._dayCount)-parseInt((null===(n=r[t])||void 0===n?void 0:n.DATES[i])||0)<=0)return!1}}catch(t){b.error("Error validating the frequency:"+t)}return!0}))})),N=a((function t(){var e=this;i(this,t),s(this,"cWZl",""),s(this,"UyeA",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var r;e.cWZl=t.meta.name,e.UyeA=t.meta.type,e._only_context=t.meta.only_context,e._attr=(null===(r=t.meta)||void 0===r?void 0:r.attr)||{}}catch(t){return window.ApxorLogger.error(t),!1}return!0}))})),j=window.ApxorLogger,I=a((function t(){var e=this;i(this,t),s(this,"vGcI",-1),s(this,"qWUf",-1),s(this,"IZiK",-1),s(this,"TIGO",-1),s(this,"XRsG",!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 j.error("Not valid dates"),!1;if(e.vGcI=Date.parse(t.validity.start_date),e.qWUf=Date.parse(t.validity.end_date),h(t.time_limits_in_day)&&(e.XRsG=t.time_limits_in_day,e.XRsG&&h(t.time_limits))){var r=(new Date).toISOString().split("T")[0];if(e.IZiK=Date.parse(r+"T"+t.time_limits.start_time+".000Z"),e.TIGO=Date.parse(r+"T"+t.time_limits.end_time+".000Z"),isNaN(e.IZiK)||isNaN(e.TIGO))return j.error("Not valid times"),!1}}catch(t){return j.error(t),!1}return!0})),s(this,"validate",(function(){var t=Date.now();return t>e.vGcI&&t<e.qWUf&&(!e.XRsG||t>=e.IZiK&&t<=e.TIGO)}))})),A=a((function t(){var e=this;i(this,t),s(this,"cWZl",""),s(this,"xbhS",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.cWZl=t.name,e.xbhS=t.additional_info}catch(t){return!1}return!0}))})),Z=a((function t(){var e=this;i(this,t),s(this,"jwPz",0),s(this,"GTYM",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.jwPz=Number(t.lower),e.GTYM=Number(t.upper),isNaN(e.jwPz)||isNaN(e.GTYM))return!1}catch(t){return!1}return!0}))})),w=a((function t(){var e=this;i(this,t),s(this,"PLZU",0),s(this,"Nckz",""),s(this,"bmxQ",""),s(this,"BBIh",new A),s(this,"ckOr",new Z),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.Nckz=t.event_type,e.bmxQ=t.activity,e.BBIh.parse(t.details)&&e.ckOr.parse(t.time_bounds)}catch(t){return!1}}))})),C=a((function t(){var e=this;i(this,t),s(this,"PLZU",0),s(this,"oeND",-1),s(this,"ZjTK",0),s(this,"Erqi",""),s(this,"bmxQ",""),s(this,"Nckz",""),s(this,"ckOr",new Z),s(this,"BBIh",new A),s(this,"vBxh",new w),s(this,"xXjK","AND"),s(this,"OKxH",!1),s(this,"UyeA",void 0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.oeND=t.sequence,e.ZjTK=t.count_config.count,e.Erqi=t.count_config.operator,e.bmxQ=t.activity,e.Nckz=t.event_type,e.xXjK=t.combine_operator,e.UyeA=t.type,e.BBIh.parse(t.details)&&e.vBxh.parse(t.trigger)&&e.ckOr.parse(t.time_bounds)}catch(t){return Logger.error(t),!1}}))})),T=window.ApxorLogger,B=function(){function e(){var r=this;i(this,e),s(this,"GEya",0),s(this,"yhMK",""),s(this,"Zffo",new C),s(this,"tYzf",!1),s(this,"Cjuc",!1),s(this,"YDoy",0),s(this,"xXjK","AND"),s(this,"MVDT",-1),s(this,"rObi",[]),s(this,"xGwf",{}),s(this,"DIfm",!1),s(this,"initialize",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=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]:[];r.yhMK=n,r.YDoy=i,r.rObi=a;var s=r.Zffo.parse(e);if(s){if(r.xXjK=r.Zffo.xXjK,r.Zffo.OKxH){var c=r.Zffo.BBIh.cWZl;"APX_PAGE_OPENED"===c&&(c=r.Zffo.BBIh.xbhS.navigation_id,c=isDefined(c)?c:r.Zffo.BBIh.cWZl),r.MVDT=t.getController().getEventCount(c);var u=r.Zffo.ZjTK,f=r.Zffo.Erqi;if(r.Cjuc=r.affJ(r.MVDT-1,u,f,!1),r.tYzf=r.Cjuc,r.Cjuc&&"APX_PAGE_OPENED"===r.Zffo.BBIh.cWZl)return!0}return o&&0!==i||r.WARv(),!0}return!1})),s(this,"WARv",(function(){var t=r.Zffo,e=t.vBxh,n=Q.getInstance();"app_start"===e.Nckz?(r.tYzf=!0,n.registerForEvent(g(t.Nckz)+"___"+t.BBIh.cWZl,r.jWUh)):n.registerForEvent(g(t.Nckz)+"___"+e.BBIh.cWZl,r.jWUh)})),s(this,"mejv",(function(t,e,n,i){var o,a,s,c=(Date.now()-r.xGwf[e])/1e3;(null===(o=r.Zffo)||void 0===o||null===(a=o.BBIh)||void 0===a||null===(s=a.xbhS)||void 0===s?void 0:s.time)/1e3>c&&r._displayCampaign(n)})),s(this,"MxyB",(function(t,e,n,i){var o,a,s,c,u;r.DIfm=!0;var f=Date.now(),h=null===(o=r.Zffo)||void 0===o||null===(a=o.vBxh)||void 0===a?void 0:a.BBIh.cWZl,l=(f-r.xGwf[h])/1e3,v=null===(s=r.Zffo)||void 0===s||null===(c=s.BBIh)||void 0===c||null===(u=c.xbhS)||void 0===u?void 0:u.time;(v/=1e3)>l&&r._displayCampaign(n)})),s(this,"jWUh",(function(t,e,n,i){var o=Q.getInstance();if(r.tYzf)g(r.Zffo.Nckz)===t&&r.iNJh(n-r.Zffo.vBxh.PLZU,r.Zffo.ckOr)&&r.Zffo.BBIh.cWZl===e&&r.EcjA(r.Zffo.BBIh.xbhS,i)&&(r.GEya+=1,r.Cjuc=r.affJ(r.GEya,r.Zffo.ZjTK,r.Zffo.Erqi),r.Cjuc&&(r.Zffo.PLZU=n,o.validate(r.yhMK,r.YDoy)));else if(r.tYzf=r.JRja(t,e,n,i),r.tYzf){var a=r.Zffo,s=a.vBxh;if(s.PLZU=n,"activity_time"===(null==a?void 0:a.Nckz)){var c,u,f,h,l,v,d=null==a||null===(c=a.BBIh)||void 0===c||null===(u=c.xbhS)||void 0===u?void 0:u.time;(null==a||null===(f=a.BBIh)||void 0===f||null===(h=f.xbhS)||void 0===h?void 0:h.nkpi.length)>0&&(setTimeout((function(){r.DIfm||(r.Cjuc=!0,r.Cjuc&&(r.GEya+=1,r.Cjuc=r.affJ(r.GEya,r.Zffo.ZjTK,r.Zffo.Erqi),r.Cjuc&&(r.Zffo.PLZU=n,o.validate(r.yhMK,r.YDoy)))),a.BBIh.xbhS.nkpi.map((function(t){o.unregisterFromEvent(p(a.BBIh.xbhS.et)+"___"+t,r)}))}),d),a.BBIh.xbhS.nkpi.map((function(t){o.registerForEvent(p(a.BBIh.xbhS.et)+"___"+t,r.MxyB)}))),(null==a||null===(l=a.BBIh)||void 0===l||null===(v=l.xbhS)||void 0===v?void 0:v.kpi.length)>0&&(setTimeout((function(){a.BBIh.xbhS.kpi.map((function(t){o.unregisterFromEvent(p(a.BBIh.xbhS.et)+"___"+t,r)}))}),d),a.BBIh.xbhS.kpi.map((function(t){t===a.vBxh.BBIh.cWZl?(o.unregisterFromEvent(g(s.Nckz)+"___"+s.BBIh.cWZl,r),o.registerForEvent(p(a.BBIh.xbhS.et)+"___"+t,r.mejv)):o.registerForEvent(p(a.BBIh.xbhS.et)+"___"+t,r.MxyB)})))}else o.unregisterFromEvent(g(s.Nckz)+"___"+s.BBIh.cWZl,r),o.registerForEvent(g(a.Nckz)+"___"+a.BBIh.cWZl,r);r.xGwf[e]=Date.now()}})),s(this,"JRja",(function(t,e,n,i){var o=r.Zffo.vBxh;return g(o.Nckz)===t&&o.BBIh.cWZl===e&&r.iNJh(n,o.ckOr)&&r.EcjA(o.BBIh.xbhS,i)})),s(this,"iNJh",(function(t,e){var r=Math.ceil(t);return r>e.jwPz&&r<e.GTYM})),s(this,"affJ",(function(t,e,n){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(i&&r.Zffo.OKxH&&(t+=r.MVDT),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;default:return!1}})),s(this,"EcjA",(function(t,e){var r=!0;try{var i=function(){if(!e.hasOwnProperty(o)||!1===r)return{v:!1};if("object"===n(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 c=(Array.isArray(e[o])?e[o]:[e[o]]).some((function(t){return y(t,i,a)}));r=r&&c}else r=r&&y(e[o],t[o],"EQ")};for(var o in t){var a=i();if("object"===n(a))return a.v}}catch(t){T.error(t),r=!1}return r}))}return a(e,[{key:"_displayCampaign",value:function(t){var e=Q.getInstance();this.Cjuc=!0,this.Cjuc&&(this.GEya+=1,this.Cjuc=this.affJ(this.GEya,this.Zffo.ZjTK,this.Zffo.Erqi),this.Cjuc&&(this.Zffo.PLZU=t,e.validate(this.yhMK,this.YDoy)))}}]),e}(),q=a((function e(){var r=this;i(this,e),s(this,"LSNB",[]),s(this,"_ret_day",{}),s(this,"QNnT",{}),s(this,"GRZt",!1),s(this,"gpHa",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{r.LSNB=t.overall_cfg.events,r._ret_day=t.overall_cfg.ret_day,r.QNnT=t.overall_cfg.session,r.GRZt=t.overall_cfg.toggleRetDay,r.LSNB=t.overall_cfg.events,r.gpHa=t.overall_cfg.toggleSession}catch(t){return Logger.error(error),!1}return!0})),s(this,"validate",(function(){var e=parseInt(t.getController().getFromStorage("apx_retained_days")),n=parseInt(t.getController().getFromStorage("apx_retained_session"));if(r.GRZt&&!isNaN(e)&&!(e>=r._ret_day.from&&e<=r._ret_day.to))return!1;if(r.gpHa&&!isNaN(n)&&!(n>=r.QNnT.from&&n<=r.QNnT.to))return!1;try{for(var i=t.getController().getFromStorage("_apx_lt_count"),o=t.getSiteId(),a=JSON.parse(d(o,i)),s=0;s<r.LSNB.length;s++){var c=r.LSNB[s].name.replace("'","").replace("’","");if(a.hasOwnProperty(c))return!1}}catch(t){Logger.error("Failed to validate the lt count:"+t)}return!0}))})),O=window.ApxorLogger,L=a((function e(){var n=this;i(this,e),s(this,"QqSU",[]),s(this,"yhMK",""),s(this,"Yryc",new N),s(this,"sbOv",new x),s(this,"cvxt",new I),s(this,"NHPo",new E),s(this,"wSOP",new q),s(this,"aNTC",!1),s(this,"cmsS",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(!h(t._id))return O.error("No Id"),!1;if(!h(t.enabled)||!t.enabled)return O.error("Not enabled"),!1;if(!(n.Yryc.parse(t)&&n.cvxt.parse(t)&&n.NHPo.parse(t)&&n.sbOv.parse(t)&&n.wSOP.parse(t)))return!1;if(!h(t.conditions)||!Array.isArray(t.conditions))return O.error("No valid conditions",t.conditions),!1;n.yhMK=t._id,n.aNTC=!!h(t.sequence_enabled)&&t.sequence_enabled,n.aNTC&&t.conditions.sort((function(t,e){return t.sequence<e.sequence}));for(var e=t.conditions,r=e.length,i=0;i<r;i++){n.cmsS=[];var o=e[i];if("didn't"===o.type){var a,s,u={trigger_key:o.trigger.details.name,no_kpi_array:null==o||null===(a=o.details)||void 0===a||null===(s=a.additional_info)||void 0===s?void 0:s.nkpi,condition_id:null==o?void 0:o._id,time_bounds:o.time_bounds.upper};n.cmsS=[].concat(c(n.cmsS),[u])}var f=new B;f.initialize(o,n.yhMK,i,n.aNTC,n.cmsS)&&n.QqSU.push(f)}return n.QqSU.length>0}catch(t){return O.error(t),!1}})),s(this,"CEav",(function(t){if(!(t<0))if(n.aNTC){var e=n.QqSU[t];if(h(e)&&e.Cjuc){var r=n.QqSU[t-1];if(h(r)&&!r.Cjuc)return;var i=n.QqSU[t+1];h(i)?i.WARv():n.zLpd()}}else n.zLpd()})),s(this,"zLpd",(function(){var e=t.getController().getUserAttributes(),i=t.getController().getSessionAttributes();if(n.cvxt.validate()&&n.sbOv.validate(e,i)&&n.wSOP.validate()){for(var o=n.QqSU.length,a=o<1,s="",c=0;c<o;c++){var u=n.QqSU[c],f=u.Cjuc;if(""===s.trim())a=f;else switch(s){case"AND":a=a&&f;break;case"OR":a=a||f}s=u.xXjK}if(a){if(console.debug("onCondition satisfied"),!n.NHPo.Ldoq(n.yhMK))return void console.warn("Maximum limit reached",n.yhMK);console.log("Dispatching event",n.Yryc.UyeA),!0===n.Yryc._only_context&&t.logEvent("apx_context_evaluated",r(r({},n.Yryc._attr),{},{message_name:n.Yryc.cWZl,id:n.yhMK})),t.getController().dispatchEvent(n.Yryc.UyeA,{name:n.Yryc.UyeA,additional_info:{uuid:n.yhMK,name:n.Yryc.cWZl}})}}})),s(this,"gQZN",(function(){n.NHPo.gQZN()})),s(this,"getFrequencyCount",(function(){return n.NHPo.getFrequencyCount()})),s(this,"rFYG",(function(){return n.NHPo.flSr()}))})),F=a((function t(){var e=this;i(this,t),s(this,"qqVx",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{configs:[]};if(h(t)&&h(t.configs)){var r=t.configs;if(!Array.isArray(r))return;r.sort((function(t,e){var r,n;return(null!==(r=t.prio)&&void 0!==r?r:-1)-(null!==(n=e.prio)&&void 0!==n?n:-1)}));for(var n=0;n<r.length;n++){var i=r[n],o=i._id,a=new L;a.parse(i)?e.qqVx[o]=a:console.warn("Failed to parse cfg",o)}}})),s(this,"validate",(function(t,r){e.qqVx.hasOwnProperty(t)&&e.qqVx[t].CEav(r)})),s(this,"gQZN",(function(t){e.qqVx[t].gQZN()})),s(this,"getFrequencyCount",(function(t){return e.qqVx[t].getFrequencyCount()})),s(this,"resetFrequencyCounts",(function(){var t=e.qqVx;for(var r in t)t[r].rFYG()})),s(this,"VHHg",(function(t){try{if(e.qqVx){var r=e.qqVx[t];if(r&&r.Yryc)return r.Yryc}}catch(t){console.log("Error in getting the campaign meta ".concat(t))}return{}}))})),K=window.ApxorLogger,P=a((function e(){var r=this;i(this,e),s(this,"aNgA",{}),s(this,"TkMT",[]),s(this,"SETl",!1),s(this,"initialize",(function(){var e=t.getController();e.registerForEvent("APP_EVENT",(function(t){return r.LevP(t,"AE")})),e.registerForEvent("CLIENT_EVENT",(function(t){return r.LevP(t,"CE")}))})),s(this,"EHRd",(function(){for(var t in r.TkMT)r.mXFd(t.event,t.key,t.type);r.SETl=!0})),s(this,"iUsm",(function(t,e){var n;"function"==typeof e&&((n=r.aNgA[t]?r.aNgA[t]:[]).push(e),r.aNgA[t]=n,K.debug("Listeners list: ",r.aNgA))})),s(this,"unregisterFromEvent",(function(t,e){if(r.aNgA[t]){for(var n=r.aNgA[t],i=[],o=0;o<n.length;o++){var a=n[o];a!==e&&i.push(a)}r.aNgA[t]=i}})),s(this,"LevP",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AE",n=e+"___"+t.name;r.mXFd(t,n,e)})),s(this,"mXFd",(function(e,n,i){if(r.SETl){if(K.debug("Notifying listeners for event: "+e+", "+n,r.aNgA),r.aNgA[n])for(var o=r.aNgA[n],a=t.getController().getSDKRunningTimeInSec(),s=0;s<o.length;s++){(0,o[s])(i,e.name,a,e.additional_info)}}else r.TkMT.push({event:e,key:n,type:i})}))})),D=window.ApxorLogger,Q=function(){function e(){var r=this;return i(this,e),s(this,"eqVJ",!1),s(this,"FpCq",null),s(this,"QvjF",_()),s(this,"Impm",new P),s(this,"Ihrw",t.getSiteId()),s(this,"LxRr",{}),s(this,"getQeState",(function(){try{var e=t.getController().getFromStorage("qe_state");return e?JSON.parse(d(r.Ihrw,e)):(r.LxRr={},r.setQeState())}catch(t){return r.LxRr={},r.setQeState()}})),s(this,"setQeState",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{t.getController().persistToStorage("qe_state",r.LxRr,!0)}catch(n){""===e?r.LxRr={}:r.LxRr[e]={SESSION:0,OVERALL:0,DATES:{}},t.getController().persistToStorage("qe_state",r.LxRr,!0)}return r.LxRr})),s(this,"initialize",(function(){r.eqVJ||(r.eqVJ=!0,r.FpCq=new F,r.Impm.initialize(),r.LxRr=r.getQeState(),D.info("QE Initialized.."))})),s(this,"parse",(function(t){r.JRKV()?(r.FpCq.parse(t),r.Impm.EHRd()):D.warn("Must call init first. Unable to proceed")})),s(this,"validate",(function(t,e){r.JRKV()&&r.FpCq.validate(t,e)})),s(this,"updateCount",(function(t){try{h(r.LxRr[t])||r.createObjConfig(t),r.incrementFrequencies(t),r.setQeState(t),r.FpCq.gQZN(t)}catch(t){console.log("Could not update the count config:".concat(t))}})),s(this,"resetFrequencyCounts",(function(){r.FpCq.resetFrequencyCounts()})),s(this,"getFrequencyCount",(function(t){return r.FpCq.getFrequencyCount(t)})),s(this,"registerForEvent",(function(t,e){r.Impm.iUsm(t,e)})),s(this,"unregisterFromEvent",(function(t,e){r.Impm.unregisterFromEvent(t,e)})),s(this,"fetch",(function(e,r,n,i){t.getController().fetchConfiguration(e,r,n,i)})),s(this,"JRKV",(function(){return r.eqVJ})),s(this,"getCampaignMetaFromQueryEngine",(function(t){return r.FpCq.VHHg(t)})),s(this,"nawi",(function(){return r.QvjF})),e.instance||(e.instance=this),e.instance}return a(e,[{key:"createObjConfig",value:function(t){try{this.LxRr=this.getQeState(),h(this.LxRr[t])||(this.LxRr[t]={SESSION:0,OVERALL:0,DATES:{}},this.QvjF&&(this.LxRr[t].DATES[this.QvjF]=0),this.setQeState(t))}catch(t){D.error("Can not create the frequency count object:"+t)}}},{key:"incrementFrequencies",value:function(t){this.LxRr=this.getQeState();var e=this.LxRr[t];e.SESSION=e.SESSION+1,e.OVERALL=e.OVERALL+1;var r=_();r===this.QvjF&&e.DATES&&e.DATES[r]||(this.QvjF=r,e.DATES={},e.DATES[this.QvjF]=0),e.DATES[this.QvjF]=e.DATES[this.QvjF]+1}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}();s(Q,"instance",void 0),window.ceVersion=119;try{void 0===exports&&null===exports||(exports.default=Q,module.exports=exports.default)}catch(t){}return Q}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apxor-qe",
3
- "version": "1.1.8",
3
+ "version": "1.1.9-qa",
4
4
  "author": "Uma Sankar Yedida <umasankar.yedida@apxor.com> (https://www.apxor.com)",
5
5
  "contributors": [
6
6
  {