apxor-qe 1.1.6 → 1.1.8
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.
- package/dist/apxor.qe.d.ts +2 -0
- package/dist/apxor.qe.min.js +1 -1
- package/package.json +1 -1
package/dist/apxor.qe.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ declare namespace CE {
|
|
|
4
4
|
validate(id: string, index: number): void;
|
|
5
5
|
getCount(id: string): number;
|
|
6
6
|
updateCount(id: string): void;
|
|
7
|
+
getQeState(): object;
|
|
8
|
+
setQeState(id: string): object;
|
|
7
9
|
registerForEvent(event: any, callback: any): void;
|
|
8
10
|
unregisterFromEvent(event: any, callback: any): void;
|
|
9
11
|
fetch(type: any, vUrl: string, aUrl: string, callback: any): void;
|
package/dist/apxor.qe.min.js
CHANGED
|
@@ -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 a(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 s(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 l=function(t){return void 0!==t&&!function(t){return null===t}(t)},f="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,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,r=a>>8&255,n=255&a,u.push(e),64!==i&&(u.push(r),64!==o&&u.push(n))}while(s<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()},p=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 y(e).test(t);default:return!1}},y=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()},_=window.ApxorLogger,S=o((function e(){var i=this;n(this,e),a(this,"IlmU","ALL"),a(this,"Ubgx",[]),a(this,"zTzr",[]),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(i.IlmU=t.audience.audience_type,i.Ubgx=t.audience.attributes.user,i.zTzr=t.audience.attributes.session,!Array.isArray(i.Ubgx)||!Array.isArray(i.zTzr))return _.error("No attributes"),!1}catch(t){return _.error(t),!1}return!0})),a(this,"validate",(function(e,r){var n=!0;return"FTU"===i.IlmU&&(n=t.getController().getSessionInfo().is_first_session),n&&i.vYeI(e,i.Ubgx)&&i.vYeI(r,i.zTzr)})),a(this,"vYeI",(function(t,e){var n=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})),u=(Array.isArray(t[r.name])?t[r.name]:[t[r.name]]).some((function(t){return s.some((function(e){return p(t,e,n)}))}));i=i&&u},a=0;a<n;a++){var s=o();if("object"===r(s))return s.v}}catch(t){_.error(t),i=!1}return i}))})),x=window.ApxorLogger,b=o((function e(){var r=this;n(this,e),a(this,"bKXH",0),a(this,"LVVc",0),a(this,"TlfN","SESSION"),a(this,"zTNm",0),a(this,"XVfO",0),a(this,"IHTF",0),a(this,"parse",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{r.bKXH=e.frequency.count,r.IHTF=r.bKXH,r.LVVc=e.frequency.time_interval,r.TlfN=e.frequency.validity,r.XVfO=e.frequency.ses_lmt,r._dayCount=e.frequency.day_lmt;var n=t.getController().getFromStorage("qe_state"),i=JSON.parse(v(t.getSiteId(),n));if(!l(i)||!l(i[e._id]))return!0;if("SESSION"===r.TlfN){if(r.bKXH=parseInt(r.bKXH)-parseInt(i[e._id].SESSION),r.bKXH<=0)return console.warn("Max count limit reached for session:"+e._id),!1}else{if("OVERALL"!==r.TlfN)return x.info("Invalid config."),!1;if(r.bKXH=parseInt(r.bKXH)-parseInt(i[e._id].OVERALL),r.bKXH<=0)return console.warn("Max count limit reached for overall:"+e._id),!1}}catch(t){return x.error(t),!1}return!0})),a(this,"lZsf",(function(){r.bKXH=r.bKXH-1})),a(this,"getFrequencyCount",(function(){return r.bKXH})),a(this,"xeEy",(function(){"SESSION"===r.TlfN&&(r.bKXH=r.IHTF,x.info("Campaign Limit reset"))})),a(this,"LpVm",(function(e){try{if(r.bKXH<=0)return!1;var n=t.getController().getFromStorage("qe_state"),i=JSON.parse(v(t.getSiteId(),n));if(!l(i)||!l(i[e]))return!0;if(0!==r.XVfO)if(parseInt(r.XVfO)-parseInt(i[e].SESSION)<=0)return!1;if(0!==r._dayCount){q.getInstance();var o=m();if(parseInt(r._dayCount)-parseInt(i[e].DATES[o]||0)<=0)return!1}}catch(t){x.error("Error validating the frequency:"+t)}return!0}))})),O=o((function t(){var e=this;n(this,t),a(this,"ttIP",""),a(this,"IlmU",""),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var r;e.ttIP=t.meta.name,e.IlmU=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}))})),H=window.ApxorLogger,I=o((function t(){var e=this;n(this,t),a(this,"BEyc",-1),a(this,"FnVv",-1),a(this,"llmB",-1),a(this,"vpNk",-1),a(this,"qoEc",!1),a(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.BEyc=Date.parse(t.validity.start_date),e.FnVv=Date.parse(t.validity.end_date),l(t.time_limits_in_day)&&(e.qoEc=t.time_limits_in_day,e.qoEc&&l(t.time_limits))){var r=(new Date).toISOString().split("T")[0];if(e.llmB=Date.parse(r+"T"+t.time_limits.start_time+".000Z"),e.vpNk=Date.parse(r+"T"+t.time_limits.end_time+".000Z"),isNaN(e.llmB)||isNaN(e.vpNk))return H.error("Not valid times"),!1}}catch(t){return H.error(t),!1}return!0})),a(this,"validate",(function(){var t=Date.now();return t>e.BEyc&&t<e.FnVv&&(!e.qoEc||t>=e.llmB&&t<=e.vpNk)}))})),E=o((function t(){var e=this;n(this,t),a(this,"ttIP",""),a(this,"Hxtl",{}),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.ttIP=t.name,e.Hxtl=t.additional_info}catch(t){return!1}return!0}))})),F=o((function t(){var e=this;n(this,t),a(this,"Bieg",0),a(this,"HoKu",0),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.Bieg=Number(t.lower),e.HoKu=Number(t.upper),isNaN(e.Bieg)||isNaN(e.HoKu))return!1}catch(t){return!1}return!0}))})),w=o((function t(){var e=this;n(this,t),a(this,"BroN",0),a(this,"uZkY",""),a(this,"YJOW",""),a(this,"cHFQ",new E),a(this,"qSGC",new F),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.uZkY=t.event_type,e.YJOW=t.activity,e.cHFQ.parse(t.details)&&e.qSGC.parse(t.time_bounds)}catch(t){return!1}}))})),N=o((function t(){var e=this;n(this,t),a(this,"BroN",0),a(this,"Blda",-1),a(this,"bKXH",0),a(this,"PKZu",""),a(this,"YJOW",""),a(this,"uZkY",""),a(this,"qSGC",new F),a(this,"cHFQ",new E),a(this,"QHAu",new w),a(this,"SkKC","AND"),a(this,"qtsr",!1),a(this,"IlmU",void 0),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.Blda=t.sequence,e.bKXH=t.count_config.count,e.PKZu=t.count_config.operator,e.YJOW=t.activity,e.uZkY=t.event_type,e.SkKC=t.combine_operator,e.IlmU=t.type,e.cHFQ.parse(t.details)&&e.QHAu.parse(t.trigger)&&e.qSGC.parse(t.time_bounds)}catch(t){return Logger.error(t),!1}}))})),A=window.ApxorLogger,C=function(){function e(){var i=this;n(this,e),a(this,"htlg",0),a(this,"aJcG",""),a(this,"xuOm",new N),a(this,"EToX",!1),a(this,"SxIc",!1),a(this,"NGcs",0),a(this,"SkKC","AND"),a(this,"SYkI",-1),a(this,"gKCQ",[]),a(this,"EuKs",{}),a(this,"PKXT",!1),a(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],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];i.aJcG=r,i.NGcs=n,i.gKCQ=a;var s=i.xuOm.parse(e);if(s){if(i.SkKC=i.xuOm.SkKC,i.xuOm.qtsr){var u=i.xuOm.cHFQ.ttIP;"APX_PAGE_OPENED"===u&&(u=i.xuOm.cHFQ.Hxtl.navigation_id,u=isDefined(u)?u:i.xuOm.cHFQ.ttIP),i.SYkI=t.getController().getEventCount(u);var c=i.xuOm.bKXH,l=i.xuOm.PKZu;if(i.SxIc=i.xiQe(i.SYkI-1,c,l,!1),i.EToX=i.SxIc,i.SxIc&&"APX_PAGE_OPENED"===i.xuOm.cHFQ.ttIP)return!0}return o&&0!==n||i.wxCK(),!0}return!1})),a(this,"wxCK",(function(){var t=i.xuOm,e=t.QHAu,r=q.getInstance();"app_start"===e.uZkY?(i.EToX=!0,r.registerForEvent(d(t.uZkY)+"___"+t.cHFQ.ttIP,i.Hbrj)):r.registerForEvent(d(t.uZkY)+"___"+e.cHFQ.ttIP,i.Hbrj)})),a(this,"Pwsv",(function(t,e,r,n){var o,a,s,u=(Date.now()-i.EuKs[e])/1e3;(null===(o=i.xuOm)||void 0===o||null===(a=o.cHFQ)||void 0===a||null===(s=a.Hxtl)||void 0===s?void 0:s.time)/1e3>u&&i._displayCampaign()})),a(this,"oiOg",(function(t,e,r,n){var o,a,s,u,c;i.PKXT=!0;var l=Date.now(),f=null===(o=i.xuOm)||void 0===o||null===(a=o.QHAu)||void 0===a?void 0:a.cHFQ.ttIP,h=(l-i.EuKs[f])/1e3,v=null===(s=i.xuOm)||void 0===s||null===(u=s.cHFQ)||void 0===u||null===(c=u.Hxtl)||void 0===c?void 0:c.time;(v/=1e3)>h&&i._displayCampaign()})),a(this,"Hbrj",(function(t,e,r,n){var o=q.getInstance();if(i.EToX)d(i.xuOm.uZkY)===t&&i.SPfP(r-i.xuOm.QHAu.BroN,i.xuOm.qSGC)&&i.xuOm.cHFQ.ttIP===e&&i.Zevy(i.xuOm.cHFQ.Hxtl,n)&&(i.htlg+=1,i.SxIc=i.xiQe(i.htlg,i.xuOm.bKXH,i.xuOm.PKZu),i.SxIc&&(i.xuOm.BroN=r,o.validate(i.aJcG,i.NGcs)));else if(i.EToX=i.fipO(t,e,r,n),i.EToX){var a=i.xuOm,s=a.QHAu;if(s.BroN=r,"activity_time"===(null==a?void 0:a.uZkY)){var u,c,l,f,h,v,p=null==a||null===(u=a.cHFQ)||void 0===u||null===(c=u.Hxtl)||void 0===c?void 0:c.time;(null==a||null===(l=a.cHFQ)||void 0===l||null===(f=l.Hxtl)||void 0===f?void 0:f.nkpi.length)>0&&(setTimeout((function(){i.PKXT||(i.SxIc=!0,i.SxIc&&(i.htlg+=1,i.SxIc=i.xiQe(i.htlg,i.xuOm.bKXH,i.xuOm.PKZu),i.SxIc&&(i.xuOm.BroN=r,o.validate(i.aJcG,i.NGcs)))),a.cHFQ.Hxtl.nkpi.map((function(t){o.unregisterFromEvent(g(a.cHFQ.Hxtl.et)+"___"+t,i)}))}),p),a.cHFQ.Hxtl.nkpi.map((function(t){o.registerForEvent(g(a.cHFQ.Hxtl.et)+"___"+t,i.oiOg)}))),(null==a||null===(h=a.cHFQ)||void 0===h||null===(v=h.Hxtl)||void 0===v?void 0:v.kpi.length)>0&&(setTimeout((function(){a.cHFQ.Hxtl.kpi.map((function(t){o.unregisterFromEvent(g(a.cHFQ.Hxtl.et)+"___"+t,i)}))}),p),a.cHFQ.Hxtl.kpi.map((function(t){t===a.QHAu.cHFQ.ttIP?(o.unregisterFromEvent(d(s.uZkY)+"___"+s.cHFQ.ttIP,i),o.registerForEvent(g(a.cHFQ.Hxtl.et)+"___"+t,i.Pwsv)):o.registerForEvent(g(a.cHFQ.Hxtl.et)+"___"+t,i.oiOg)})))}else o.unregisterFromEvent(d(s.uZkY)+"___"+s.cHFQ.ttIP,i),o.registerForEvent(d(a.uZkY)+"___"+a.cHFQ.ttIP,i);i.EuKs[e]=Date.now()}})),a(this,"fipO",(function(t,e,r,n){var o=i.xuOm.QHAu;return d(o.uZkY)===t&&o.cHFQ.ttIP===e&&i.SPfP(r,o.qSGC)&&i.Zevy(o.cHFQ.Hxtl,n)})),a(this,"SPfP",(function(t,e){var r=Math.round(t);return r>e.Bieg&&r<e.HoKu})),a(this,"xiQe",(function(t,e,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(n&&i.xuOm.qtsr&&(t+=i.SYkI),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}})),a(this,"Zevy",(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,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 p(t,i,a)}));n=n&&u}else n=n&&p(e[o],t[o],"EQ")};for(var o in t){var a=i();if("object"===r(a))return a.v}}catch(t){A.error(t),n=!1}return n}))}return o(e,[{key:"_displayCampaign",value:function(){var t=q.getInstance();this.SxIc=!0,this.SxIc&&(this.htlg+=1,this.SxIc=this.xiQe(this.htlg,this.xuOm.bKXH,this.xuOm.PKZu),this.SxIc&&(this.xuOm.BroN=time,t.validate(this.aJcG,this.NGcs)))}}]),e}(),P=o((function e(){var r=this;n(this,e),a(this,"KjjG",[]),a(this,"_ret_day",{}),a(this,"KDPD",{}),a(this,"eviS",!1),a(this,"SMAj",!1),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{r.KjjG=t.overall_cfg.events,r._ret_day=t.overall_cfg.ret_day,r.KDPD=t.overall_cfg.session,r.eviS=t.overall_cfg.toggleRetDay,r.KjjG=t.overall_cfg.events,r.SMAj=t.overall_cfg.toggleSession}catch(t){return Logger.error(error),!1}return!0})),a(this,"validate",(function(){var e=parseInt(t.getController().getFromStorage("apx_retained_days")),n=parseInt(t.getController().getFromStorage("apx_retained_session"));if(r.eviS&&!isNaN(e)&&!(e>=r._ret_day.from&&e<=r._ret_day.to))return!1;if(r.SMAj&&!isNaN(n)&&!(n>=r.KDPD.from&&n<=r.KDPD.to))return!1;try{for(var i=t.getController().getFromStorage("_apx_lt_count"),o=t.getSiteId(),a=JSON.parse(v(o,i)),s=0;s<r.KjjG.length;s++){var u=r.KjjG[s].name.replace("'","").replace("’","");if(a.hasOwnProperty(u))return!1}}catch(t){Logger.error("Failed to validate the lt count:"+t)}return!0}))})),T=window.ApxorLogger,K=o((function r(){var i=this;n(this,r),a(this,"eNJE",[]),a(this,"aJcG",""),a(this,"fdyk",new O),a(this,"gLFR",new S),a(this,"TlfN",new I),a(this,"NBKT",new b),a(this,"MBiV",new P),a(this,"QYrI",!1),a(this,"QFWr",[]),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(!l(t._id))return T.error("No Id"),!1;if(!l(t.enabled)||!t.enabled)return T.error("Not enabled"),!1;if(!(i.fdyk.parse(t)&&i.TlfN.parse(t)&&i.NBKT.parse(t)&&i.gLFR.parse(t)&&i.MBiV.parse(t)))return!1;if(!l(t.conditions)||!Array.isArray(t.conditions))return T.error("No valid conditions",t.conditions),!1;i.aJcG=t._id,i.QYrI=!!l(t.sequence_enabled)&&t.sequence_enabled,i.QYrI&&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.QFWr=[];var o=e[n];if("didn't"===o.type){var a,u,c={trigger_key:o.trigger.details.name,no_kpi_array:null==o||null===(a=o.details)||void 0===a||null===(u=a.additional_info)||void 0===u?void 0:u.nkpi,condition_id:null==o?void 0:o._id,time_bounds:o.time_bounds.upper};i.QFWr=[].concat(s(i.QFWr),[c])}var f=new C;f.initialize(o,i.aJcG,n,i.QYrI,i.QFWr)&&i.eNJE.push(f)}return i.eNJE.length>0}catch(t){return T.error(t),!1}})),a(this,"mztK",(function(t){if(!(t<0))if(i.QYrI){var e=i.eNJE[t];if(l(e)&&e.SxIc){var r=i.eNJE[t-1];if(l(r)&&!r.SxIc)return;var n=i.eNJE[t+1];l(n)?n.wxCK():i.YdiE()}}else i.YdiE()})),a(this,"YdiE",(function(){var r=t.getController().getUserAttributes(),n=t.getController().getSessionAttributes();if(i.TlfN.validate()&&i.gLFR.validate(r,n)&&i.MBiV.validate()){for(var o=i.eNJE.length,s=o<1,u="",c=0;c<o;c++){var l=i.eNJE[c],f=l.SxIc;if(""===u.trim())s=f;else switch(u){case"AND":s=s&&f;break;case"OR":s=s||f}u=l.SkKC}if(s){if(console.debug("onCondition satisfied"),!i.NBKT.LpVm(i.aJcG))return void console.warn("Maximum limit reached",i.aJcG);console.log("Dispatching event",i.fdyk.IlmU),!0===i.fdyk._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){a(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.fdyk._attr)),t.getController().dispatchEvent(i.fdyk.IlmU,{name:i.fdyk.IlmU,additional_info:{uuid:i.aJcG,name:i.fdyk.ttIP}})}}})),a(this,"lZsf",(function(){i.NBKT.lZsf()})),a(this,"getFrequencyCount",(function(){return i.NBKT.getFrequencyCount()})),a(this,"HSky",(function(){return i.NBKT.xeEy()}))})),Q=o((function t(){var e=this;n(this,t),a(this,"aXgn",{}),a(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{configs:[]};if(l(t)&&l(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 K;a.parse(i)?e.aXgn[o]=a:console.warn("Failed to parse cfg",o)}}})),a(this,"validate",(function(t,r){e.aXgn.hasOwnProperty(t)&&e.aXgn[t].mztK(r)})),a(this,"lZsf",(function(t){e.aXgn[t].lZsf()})),a(this,"getFrequencyCount",(function(t){return e.aXgn[t].getFrequencyCount()})),a(this,"resetFrequencyCounts",(function(){var t=e.aXgn;for(var r in t)t[r].HSky()})),a(this,"nwfh",(function(t){if(Array.isArray(e.aXgn)){var r=e.aXgn[t];if(r)return r.fdyk}return{}}))})),k=window.ApxorLogger,X=o((function e(){var r=this;n(this,e),a(this,"yHdn",{}),a(this,"OAbJ",[]),a(this,"sHPw",!1),a(this,"initialize",(function(){var e=t.getController();e.registerForEvent("APP_EVENT",(function(t){return r.CadS(t,"AE")})),e.registerForEvent("CLIENT_EVENT",(function(t){return r.CadS(t,"CE")}))})),a(this,"YVgY",(function(){for(var t in r.OAbJ)r.IXTy(t.event,t.key,t.type);r.sHPw=!0})),a(this,"rKHV",(function(t,e){var n;"function"==typeof e&&((n=r.yHdn[t]?r.yHdn[t]:[]).push(e),r.yHdn[t]=n,k.debug("Listeners list: ",r.yHdn))})),a(this,"unregisterFromEvent",(function(t,e){if(r.yHdn[t]){for(var n=r.yHdn[t],i=[],o=0;o<n.length;o++){var a=n[o];a!==e&&i.push(a)}r.yHdn[t]=i}})),a(this,"CadS",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AE",n=e+"___"+t.name;r.IXTy(t,n,e)})),a(this,"IXTy",(function(e,n,i){if(r.sHPw){if(k.debug("Notifying listeners for event: "+e+", "+n,r.yHdn),r.yHdn[n])for(var o=r.yHdn[n],a=t.getController().getTime(),s=0;s<o.length;s++){(0,o[s])(i,e.name,a,e.additional_info)}}else r.OAbJ.push({event:e,key:n,type:i})}))})),j=window.ApxorLogger,q=function(){function e(){var r=this;return n(this,e),a(this,"sYTJ",!1),a(this,"XpLf",null),a(this,"jbpI",m()),a(this,"OZlv",new X),a(this,"kfFP",t.getSiteId()),a(this,"ecri",{}),a(this,"initialize",(function(){if(!r.sYTJ){r.sYTJ=!0,r.XpLf=new Q,r.OZlv.initialize();var e=t.getController().getFromStorage("qe_state");e?r.ecri=JSON.parse(v(r.kfFP,e)):t.getController().persistToStorage("qe_state",r.ecri,!0),j.info("QE Initialized..")}})),a(this,"parse",(function(t){r.XUgw()?(r.XpLf.parse(t),r.OZlv.YVgY()):j.warn("Must call init first. Unable to proceed")})),a(this,"validate",(function(t,e){r.XUgw()&&r.XpLf.validate(t,e)})),a(this,"updateCount",(function(e){try{l(r.ecri[e])||r.createObjConfig(e),r.incrementFrequencies(e),t.getController().persistToStorage("qe_state",r.ecri,!0),r.XpLf.lZsf(e)}catch(t){console.log("Could not update the count config:".concat(t))}})),a(this,"resetFrequencyCounts",(function(){r.XpLf.resetFrequencyCounts()})),a(this,"getFrequencyCount",(function(t){return r.XpLf.getFrequencyCount(t)})),a(this,"registerForEvent",(function(t,e){r.OZlv.rKHV(t,e)})),a(this,"unregisterFromEvent",(function(t,e){r.OZlv.unregisterFromEvent(t,e)})),a(this,"fetch",(function(e,r,n,i){t.getController().fetchConfiguration(e,r,n,i)})),a(this,"XUgw",(function(){return r.sYTJ})),a(this,"getCampaignMetaFromQueryEngine",(function(t){return r.XpLf.nwfh(t)})),a(this,"TVAf",(function(){return r.jbpI})),e.instance||(e.instance=this),e.instance}return o(e,[{key:"createObjConfig",value:function(e){try{var r=t.getController().getFromStorage("qe_state");this.ecri=JSON.parse(v(this.kfFP,r)),l(this.ecri[e])||(this.ecri[e]={SESSION:0,OVERALL:0,DATES:{}},this.jbpI&&(this.ecri[e].DATES[this.jbpI]=0),t.getController().persistToStorage("qe_state",this.ecri,!0))}catch(t){j.error("Can not create the frequency count object:"+t)}}},{key:"incrementFrequencies",value:function(e){var r=t.getController().getFromStorage("qe_state");this.ecri=JSON.parse(v(this.kfFP,r));var n=this.ecri[e];n.SESSION=n.SESSION+1,n.OVERALL=n.OVERALL+1;var i=m();i!==this.jbpI&&(this.jbpI=i,n.DATES={},n.DATES[this.jbpI]=0),n.DATES[this.jbpI]=n.DATES[this.jbpI]+1}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}();a(q,"instance",void 0),window.ceVersion=116;try{void 0===exports&&null===exports||(exports.default=q,module.exports=exports.default)}catch(t){}return q}));
|
|
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}));
|