apxor-qe 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("apxor")):"function"==typeof define&&define.amd?define(["apxor"],e):(t=t||self)["apxor-qe"]=e(t.Apxor)}(this,(function(t){"use strict";function e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function n(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,c(r.key),r)}}function o(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function c(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var d=function(t){return void 0!==t&&!function(t){return null===t}(t)},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}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("apxor")):"function"==typeof define&&define.amd?define(["apxor"],e):(t=t||self)["apxor-qe"]=e(t.Apxor)}(this,(function(t){"use strict";function e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function n(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,c(r.key),r)}}function o(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function c(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var d=function(t){return void 0!==t&&!function(t){return null===t}(t)},f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function g(t,e){return Array.from(e).map((function(e,n){return String.fromCharCode(e^function(t,e){return t.charCodeAt(Math.floor(e%t.length))}(t,n))})).join("")}var v=function(t,e){return g(t,e=function(t){var e,n,r,i,a,o,s=0,u=[];if(!t)return t;t+="";do{e=(o=f.indexOf(t.charAt(s++))<<18|f.indexOf(t.charAt(s++))<<12|(i=f.indexOf(t.charAt(s++)))<<6|(a=f.indexOf(t.charAt(s++))))>>16&255,n=o>>8&255,r=255&o,u.push(e),64!==i&&(u.push(n),64!==a&&u.push(r))}while(s<t.length);return u}(e))},h=function(t){switch(t){case"app_event":return"AE";case"client_event":return"CE";case"activity_time":case"activity_event":return"AE"}return"Unknown"},p=function(t){return t.toUpperCase()},_=function(t,e,n){switch(n){case"EQ":return t===e;case"GT":return t>e;case"GTE":return t>=e;case"LT":return t<e;case"LTE":return t<=e;case"NEQ":return t!==e;case"R":return y(e).test(t);default:return!1}},y=function(t){var e=t.replace(/.*\/([gimuy]*)$/,"$1");e===t&&(e="");var n=e?t.replace(new RegExp("^/(.*?)/"+e+"$"),"$1"):t;return new RegExp(n,e)},E=function(){var t=new Date;return t.getDate()+"/"+t.getMonth()+"/"+t.getFullYear()},x=window.ApxorLogger,m=o((function e(){var n=this;i(this,e),s(this,"Lecg","ALL"),s(this,"KWLx",[]),s(this,"YkGb",[]),s(this,"userAttributesValidated",!0),s(this,"sessionAttributeValidated",!0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(n.Lecg=t.audience.audience_type,n.KWLx=t.audience.attributes.user,n.YkGb=t.audience.attributes.session,!Array.isArray(n.KWLx)||!Array.isArray(n.YkGb))return x.error("No attributes"),!1}catch(t){return x.error(t),!1}return!0})),s(this,"validate",(function(e,r){var i=!0;"FTU"===n.Lecg&&(i=t.getController().getSessionInfo().is_first_session);var a=n.hTqd(e,n.KWLx),o=n.hTqd(r,n.YkGb);return a||(n.userAttributesValidated=!1),o||(n.sessionAttributeValidated=!1),i&&a&&o})),s(this,"hTqd",(function(t,e){var n=e.length,r=!0;try{for(var i,a=function(){var n=e[o];if(void 0===t[n.name]||!1===r)return{v:!1};var i=n.operator,a=n.type,s=n.value.map((function(t){if("s"===a)return t;if("l"===a)return parseInt(t);if("f"===a)return parseFloat(t);if("b"===a)switch(t){case"true":return!0;case"false":return!1}})),u=(Array.isArray(t[n.name])?t[n.name]:[t[n.name]]).some((function(t){return s.some((function(e){return"s"===a?t="".concat(t):"l"===a?t=parseInt(t):"f"===a?t=parseFloat(t):"b"===a&&(t=!!t),_(t,e,i)}))}));r=r&&u},o=0;o<n;o++)if(i=a())return i.v}catch(t){x.error(t),r=!1}return r}))})),b=window.ApxorLogger,A=o((function t(){var e=this;i(this,t),s(this,"eeAf",0),s(this,"lEEo",0),s(this,"xdhp","SESSION"),s(this,"TIcR",0),s(this,"kcoq",0),s(this,"dtUE",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.eeAf=t.frequency.count,-1===e.eeAf&&(e.eeAf=1e3),e.dtUE=e.eeAf,e.lEEo=t.frequency.time_interval,e.xdhp=t.frequency.validity,e.kcoq=t.frequency.ses_lmt,e._dayCount=t.frequency.day_lmt;var n=P.getInstance().getQeState();if(!d(n)||!d(n[t._id]))return!0;if("SESSION"===e.xdhp){if(e.eeAf=parseInt(e.eeAf)-parseInt(n[t._id].SESSION),e.eeAf<=0)return console.warn("Max count limit reached for session:"+t._id),!1}else{if("OVERALL"!==e.xdhp)return b.info("Invalid config."),!1;if(e.eeAf=parseInt(e.eeAf)-parseInt(n[t._id].OVERALL),e.eeAf<=0)return console.warn("Max count limit reached for overall:"+t._id),!1}}catch(t){return b.error(t),!1}return!0})),s(this,"ikdS",(function(){e.eeAf=e.eeAf-1})),s(this,"getFrequencyCount",(function(){return e.eeAf})),s(this,"MdUm",(function(){"SESSION"===e.xdhp&&(e.eeAf=e.dtUE,b.info("Campaign Limit reset"))})),s(this,"iOMM",(function(t){try{if(e.eeAf<=0)return!1;var n=P.getInstance().getQeState();if(!d(n)||!d(n[t]))return!0;if(0!==e.kcoq)if(parseInt(e.kcoq)-parseInt(n[t].SESSION)<=0)return!1;if(0!==e._dayCount){var r,i=E();if(parseInt(e._dayCount)-parseInt((null===(r=n[t])||void 0===r?void 0:r.DATES[i])||0)<=0)return!1}}catch(t){b.error("Error validating the frequency:"+t)}return!0}))})),w=o((function t(){var e=this;i(this,t),s(this,"figp",""),s(this,"Lecg",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var n,r;e.figp=t.meta.name,e.Lecg=t.meta.type,e._only_context=t.meta.only_context,e._attr=(null===(n=t.meta)||void 0===n?void 0:n.attr)||{},e._isExperiment=null===(r=t.meta)||void 0===r?void 0:r.isExperiment}catch(t){return window.ApxorLogger.error(t),!1}return!0}))})),B=window.ApxorLogger,D=o((function t(){var e=this;i(this,t),s(this,"qbZE",-1),s(this,"RbKz",-1),s(this,"tgyZ",-1),s(this,"cWdN",-1),s(this,"cidg",!1),s(this,"_nudge_expired",!1),s(this,"_not_yet_active",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(isNaN(Date.parse(t.validity.start_date))||isNaN(Date.parse(t.validity.end_date)))return B.error("Not valid dates"),!1;if(e.qbZE=Date.parse(t.validity.start_date),e.RbKz=Date.parse(t.validity.end_date),d(t.time_limits_in_day)&&(e.cidg=t.time_limits_in_day,e.cidg&&d(t.time_limits))){var n=(new Date).toISOString().split("T")[0];if(e.tgyZ=Date.parse(n+"T"+t.time_limits.start_time+".000Z"),e.cWdN=Date.parse(n+"T"+t.time_limits.end_time+".000Z"),isNaN(e.tgyZ)||isNaN(e.cWdN))return B.error("Not valid times"),!1}}catch(t){return B.error(t),!1}return!0})),s(this,"validate",(function(){var t=Date.now();return t>e.qbZE&&t<e.RbKz?!e.cidg||t>=e.tgyZ&&t<=e.cWdN:(t<e.qbZE?e._not_yet_active=!0:t>e.RbKz&&(e._nudge_expired=!0),!1)}))})),O=o((function t(){var e=this;i(this,t),s(this,"figp",""),s(this,"rXDy",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{e.figp=t.name,e.rXDy=t.additional_info}catch(t){return!1}return!0}))})),S=o((function t(){var e=this;i(this,t),s(this,"serE",0),s(this,"DOnR",0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.serE=Number(t.lower),e.DOnR=Number(t.upper),isNaN(e.serE)||isNaN(e.DOnR))return!1}catch(t){return!1}return!0}))})),C=o((function t(){var e=this;i(this,t),s(this,"wxRT",0),s(this,"tlgv",""),s(this,"kimo",""),s(this,"xCDb",new O),s(this,"uvCn",new S),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.tlgv=t.event_type,e.kimo=t.activity,e.xCDb.parse(t.details)&&e.uvCn.parse(t.time_bounds)}catch(t){return!1}}))})),U=window.ApxorLogger,X=o((function t(){var e=this;i(this,t),s(this,"wxRT",0),s(this,"eAoS",-1),s(this,"eeAf",0),s(this,"FOfl",""),s(this,"kimo",""),s(this,"tlgv",""),s(this,"uvCn",new S),s(this,"xCDb",new O),s(this,"woYX",new C),s(this,"zzXl","AND"),s(this,"Ziyx",!1),s(this,"Lecg",void 0),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return e.eAoS=t.sequence,e.eeAf=t.count_config.count,e.FOfl=t.count_config.operator,e.kimo=t.activity,e.tlgv=t.event_type,e.zzXl=t.combine_operator,e.Lecg=t.type,e.xCDb.parse(t.details)&&e.woYX.parse(t.trigger)&&e.uvCn.parse(t.time_bounds)}catch(t){return U.error(t),!1}}))})),L=window.ApxorLogger,T=o((function t(){var e=this;i(this,t),s(this,"eeAf",0),s(this,"FOfl",""),s(this,"tlgv",""),s(this,"uvCn",new S),s(this,"xCDb",new O),s(this,"zzXl","AND"),s(this,"parse",(function(t){try{return e.eeAf=t.count_config.count,e.FOfl=t.count_config.operator,e.tlgv=t.event_type,e.zzXl=t.combine_operator,e.xCDb.parse(t.details)&&e.uvCn.parse(t.time_bounds)}catch(t){return L.error(t),!1}}))})),M=window.ApxorLogger,R=function(){function e(){var n=this;i(this,e),s(this,"Purf",0),s(this,"jUXZ",""),s(this,"UHEM",new X),s(this,"VHgA",new T),s(this,"dwoA",!1),s(this,"KWyt",!1),s(this,"OOsw",0),s(this,"zzXl","AND"),s(this,"bXqj","OR"),s(this,"aJVI",-1),s(this,"moyq",[]),s(this,"FJhx",{}),s(this,"bNNf",!1),s(this,"initialize",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";if(n.jUXZ=r,n.OOsw=i,n.moyq=o,"termination"===s&&""!==s){n.VHgA.parse(e);return n.bXqj=n.VHgA.zzXl,n.gUva(),!0}var u=n.UHEM.parse(e);if(u){if(n.zzXl=n.UHEM.zzXl,n.UHEM.Ziyx){var l=n.UHEM.xCDb.figp;"APX_PAGE_OPENED"===l&&(l=n.UHEM.xCDb.rXDy.navigation_id,l=d(l)?l:n.UHEM.xCDb.figp),n.aJVI=t.getController().getEventCount(l);var c=n.UHEM.eeAf,f=n.UHEM.FOfl;if(n.KWyt=n.ZQVH(n.aJVI-1,c,f,!1),n.dwoA=n.KWyt,n.KWyt&&"APX_PAGE_OPENED"===n.UHEM.xCDb.figp)return!0}return a&&0!==i||n.PaJS(),!0}return!1})),s(this,"PaJS",(function(){var t,e=n.UHEM,r=e.woYX,i=P.getInstance();"app_start"===r.tlgv?(n.dwoA=!0,i.registerForEvent(h(e.tlgv)+"___"+e.xCDb.figp,n.YgWO)):i.registerForEvent(h(e.tlgv)+"___"+r.xCDb.figp,n.YgWO),null!==(t=window.ApxorRTM)&&void 0!==t&&t.badgesLists.includes(n.jUXZ)&&i.registerForEvent(h(e.tlgv)+"___"+"apxor-badge-container-".concat("-".concat(n.jUXZ).replaceAll(" ","").replace(/[^\w\s]/gi,"")),n.YgWO)})),s(this,"gUva",(function(){var t=n.VHgA,e=P.getInstance();n.dwoA=!0,e.registerForEvent(h(t.tlgv)+"___"+t.xCDb.figp,n.cQYJ)})),s(this,"LcXc",(function(t,e,r,i){var a,o=(Date.now()-n.FJhx[e])/1e3;(null===(a=n.UHEM)||void 0===a||null===(a=a.xCDb)||void 0===a||null===(a=a.rXDy)||void 0===a?void 0:a.time)/1e3>o&&n._displayCampaign(r)})),s(this,"gLck",(function(t,e,r,i){var a,o;n.bNNf=!0;var s=Date.now(),u=null===(a=n.UHEM)||void 0===a||null===(a=a.woYX)||void 0===a?void 0:a.xCDb.figp,l=(s-n.FJhx[u])/1e3,c=null===(o=n.UHEM)||void 0===o||null===(o=o.xCDb)||void 0===o||null===(o=o.rXDy)||void 0===o?void 0:o.time;(c/=1e3)>l&&n._displayCampaign(r)})),s(this,"YgWO",(function(e,r,i,a){var o,s,u=P.getInstance();if(n.dwoA){if(null!==(o=window.ApxorRTM)&&void 0!==o&&o.isBadgePresent&&null!==(s=window.ApxorRTM)&&void 0!==s&&s.badgesLists.includes(n.jUXZ)&&t.getController().isBadgeTriggerSatisfied(n.jUXZ))return n.KWyt=!0,n.UHEM.wxRT=i,void u.validate(n.jUXZ,n.OOsw);h(n.UHEM.tlgv)===e&&n.tBEr(i-n.UHEM.woYX.wxRT,n.UHEM.uvCn)&&n.UHEM.xCDb.figp===r&&n.BSUO(n.UHEM.xCDb.rXDy,a)&&(n.Purf+=1,n.KWyt=n.ZQVH(n.Purf,n.UHEM.eeAf,n.UHEM.FOfl),n.KWyt&&(n.UHEM.wxRT=i,u.validate(n.jUXZ,n.OOsw)))}else if(n.dwoA=n.uXGd(e,r,i,a),n.dwoA){var l=n.UHEM,c=l.woYX;if(c.wxRT=i,"activity_time"===(null==l?void 0:l.tlgv)){var d,f,g,v=null==l||null===(d=l.xCDb)||void 0===d||null===(d=d.rXDy)||void 0===d?void 0:d.time;(null==l||null===(f=l.xCDb)||void 0===f||null===(f=f.rXDy)||void 0===f?void 0:f.nkpi.length)>0&&(setTimeout((function(){n.bNNf||(n.KWyt=!0,n.KWyt&&(n.Purf+=1,n.KWyt=n.ZQVH(n.Purf,n.UHEM.eeAf,n.UHEM.FOfl),n.KWyt&&(n.UHEM.wxRT=i,u.validate(n.jUXZ,n.OOsw)))),l.xCDb.rXDy.nkpi.map((function(t){u.unregisterFromEvent(p(l.xCDb.rXDy.et)+"___"+t,n)}))}),v),l.xCDb.rXDy.nkpi.map((function(t){u.registerForEvent(p(l.xCDb.rXDy.et)+"___"+t,n.gLck)}))),(null==l||null===(g=l.xCDb)||void 0===g||null===(g=g.rXDy)||void 0===g?void 0:g.kpi.length)>0&&(setTimeout((function(){l.xCDb.rXDy.kpi.map((function(t){u.unregisterFromEvent(p(l.xCDb.rXDy.et)+"___"+t,n)}))}),v),l.xCDb.rXDy.kpi.map((function(t){t===l.woYX.xCDb.figp?(u.unregisterFromEvent(h(c.tlgv)+"___"+c.xCDb.figp,n),u.registerForEvent(p(l.xCDb.rXDy.et)+"___"+t,n.LcXc)):u.registerForEvent(p(l.xCDb.rXDy.et)+"___"+t,n.gLck)})))}else u.unregisterFromEvent(h(c.tlgv)+"___"+c.xCDb.figp,n),u.registerForEvent(h(l.tlgv)+"___"+l.xCDb.figp,n);n.FJhx[r]=Date.now()}})),s(this,"cQYJ",(function(t,e,r,i){var a=P.getInstance();h(n.VHgA.tlgv)===t&&n.tBEr(r,n.VHgA.uvCn)&&n.VHgA.xCDb.figp===e&&n.BSUO(n.VHgA.xCDb.rXDy,i)&&(n.Purf+=1,n.KWyt=n.ZQVH(n.Purf,n.VHgA.eeAf,n.VHgA.FOfl),n.KWyt&&(n.VHgA.wxRT=r,a.validateForTermination(n.jUXZ,n.OOsw)))})),s(this,"uXGd",(function(t,e,r,i){var a=n.UHEM.woYX;return h(a.tlgv)===t&&a.xCDb.figp===e&&n.tBEr(r,a.uvCn)&&n.BSUO(a.xCDb.rXDy,i)})),s(this,"tBEr",(function(t,e){var n=Math.ceil(t);return n>e.serE&&n<e.DOnR})),s(this,"ZQVH",(function(t,e,r){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(i&&n.UHEM.Ziyx&&(t+=n.aJVI),r){case"EQ":return t===e;case"GT":return t>e;case"GTE":return t>=e;case"LT":return t<e;case"LTE":return t<=e;default:return!1}})),s(this,"BSUO",(function(t,e){var n=!0;try{var i,a=function(){if(!e[o]||!1===n)return{v:!1};if("object"===r(t[o])){var i,a=t[o].op,s=t[o].t;"s"===s?i=t[o].val:"l"!==s&&"f"!==s||(i=parseFloat(t[o].val));var u=(Array.isArray(e[o])?e[o]:[e[o]]).some((function(t){return _(t,i,a)}));n=n&&u}else n=n&&_(e[o],t[o],"EQ")};for(var o in t)if(i=a())return i.v}catch(t){M.error(t),n=!1}return n}))}return o(e,[{key:"_displayCampaign",value:function(t){var e=P.getInstance();this.KWyt=!0,this.KWyt&&(this.Purf+=1,this.KWyt=this.ZQVH(this.Purf,this.UHEM.eeAf,this.UHEM.FOfl),this.KWyt&&(this.UHEM.wxRT=t,e.validate(this.jUXZ,this.OOsw)))}}]),e}(),j=window.ApxorLogger,F=o((function e(){var n=this;i(this,e),s(this,"zlRP",[]),s(this,"_ret_day",{}),s(this,"UUEf",{}),s(this,"jxTr",!1),s(this,"kPcF",!1),s(this,"retainedDaysValidated",!0),s(this,"retainedSessionValidated",!0),s(this,"eventDoneInLT",!1),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{n.zlRP=t.overall_cfg.events,n._ret_day=t.overall_cfg.ret_day,n.UUEf=t.overall_cfg.session,n.jxTr=t.overall_cfg.toggleRetDay,n.kPcF=t.overall_cfg.toggleSession}catch(t){return j.error(t),!1}return!0})),s(this,"validate",(function(){var e=parseInt(t.getController().getFromStorage("apx_retained_days")),r=parseInt(t.getController().getFromStorage("apx_retained_session"));if(n.jxTr&&!isNaN(e)&&!(e>=n._ret_day.from&&e<=n._ret_day.to))return n.retainedDaysValidated=!1,!1;if(n.kPcF&&!isNaN(r)&&!(r>=n.UUEf.from&&r<=n.UUEf.to))return n.retainedSessionValidated=!1,!1;try{for(var i=t.getController().getFromStorage("_apx_lt_count"),a=t.getSiteId(),o=JSON.parse((new TextDecoder).decode(function(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return e}(v(a,i)))),s=0;s<n.zlRP.length;s++){if(o[n.zlRP[s].name.replace("'","").replace("’","")])return n.eventDoneInLT=!0,!1}}catch(t){j.error("Failed to validate the lt count:"+t)}return!0}))})),q=window.ApxorLogger,H=o((function t(){var e=this;i(this,t),s(this,"KWLx",[]),s(this,"YkGb",[]),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(e.KWLx=t.attributes.user,e.YkGb=t.attributes.session,!Array.isArray(e.KWLx)||!Array.isArray(e.YkGb))return q.error("No attributes"),!1}catch(t){return q.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.hTqd(t,e.KWLx)&&e.hTqd(n,e.YkGb)})),s(this,"hTqd",(function(t,e){var n=e.length,r=!0;try{for(var i,a=function(){var n=e[o];if(!t[n.name]||!1===r)return{v:!1};var i=n.operator,a=n.type,s=n.value.map((function(t){return"s"===a?t:"l"===a?parseInt(t):"f"===a?parseFloat(t):void 0})),u=(Array.isArray(t[n.name])?t[n.name]:[t[n.name]]).some((function(t){return s.some((function(e){return _(t,e,i)}))}));r=r&&u},o=0;o<n;o++)if(i=a())return i.v}catch(t){q.error(t),r=!1}return r}))})),I=o((function e(){var n=this;i(this,e),s(this,"sKMB",t.getController()),s(this,"type",""),s(this,"_duration_seconds",0),s(this,"EUqu",1),s(this,"parse",(function(t){try{var e,r,i;if(n.Lecg=null===(e=t.terminate_info.time_based)||void 0===e?void 0:e.type,n._duration_seconds=null===(r=t.terminate_info)||void 0===r?void 0:r.time_based.duration_seconds,n.EUqu=null===(i=t.terminate_info.time_based)||void 0===i?void 0:i.days,n.Pflq(t._id))return n.sKMB.persistTerminationInfoLocally(t._id),!1}catch(t){return!1}return!0})),s(this,"Pflq",(function(t){var e,r=JSON.parse(n.sKMB.getFromStorage("apx_termination_ID"));if(!r[t]||null===(e=r[t])||void 0===e||!e.startDate)return!1;var i,a=new Date(r[t].startDate),o=new Date((i=new Date).getMonth()+"/"+i.getDate()+"/"+i.getFullYear()),s=parseInt((o-a)/864e5,10),u=function(){var t=new Date;return{hours:t.getHours(),mins:t.getMinutes()}}(),l=r[t].tgyZ;return s===n.EUqu&&u.hours>=l.hours||s>n.EUqu||r[t].goalAcheived}))})),V=o((function t(){var e=this;i(this,t),s(this,"enable_goal_events",!1),s(this,"attributes",{}),s(this,"GeVn",new H),s(this,"YOHg",new I),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var n,r,i;if(e.enable_time_based=null==t||null===(n=t.terminate_info)||void 0===n?void 0:n.enable_time_based,e.enable_time_based&&!e.YOHg.parse(t))return!1;if(e.enable_goal_events=null==t||null===(r=t.terminate_info)||void 0===r?void 0:r.enable_goal_events,e.enable_attributes=null==t||null===(i=t.terminate_info)||void 0===i?void 0:i.enable_attributes,e.enable_attributes&&!e.GeVn.parse(t.terminate_info))return!1}catch(t){return window.ApxorLogger.error(t),!1}return!0})),s(this,"validate",(function(t,n){return e.GeVn.validate(t,n)}))})),k=window.ApxorLogger,N=o((function e(){var r=this;i(this,e),s(this,"CVRh",[]),s(this,"AHwj",[]),s(this,"jUXZ",""),s(this,"ByBE",new w),s(this,"bgGW",new m),s(this,"xdhp",new D),s(this,"AIgt",new A),s(this,"IQFR",new F),s(this,"fgQe",new V),s(this,"DAMl",!1),s(this,"iODJ",[]),s(this,"_variant_code",""),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var e;if(!d(t._id))return k.error("No Id"),!1;if(!d(t.enabled)||!t.enabled)return k.error("Not enabled"),!1;if(!(r.ByBE.parse(t)&&r.xdhp.parse(t)&&r.AIgt.parse(t)&&r.bgGW.parse(t)&&r.IQFR.parse(t)&&r.fgQe.parse(t)))return!1;if(r._variant_code=r.ByBE._isExperiment||r.ByBE._only_context?null===(e=r.ByBE._attr)||void 0===e?void 0:e.apx_variant_code:"TG",!d(t.conditions)||!Array.isArray(t.conditions))return k.error("No valid conditions",t.conditions),!1;r.jUXZ=t._id,r.DAMl=!!d(t.sequence_enabled)&&t.sequence_enabled,r.DAMl&&t.conditions.sort((function(t,e){return t.sequence<e.sequence}));for(var n=t.conditions,i=n.length,a=0;a<i;a++){r.iODJ=[];var o=n[a];if("didn't"===o.type){var s,l={trigger_key:o.trigger.details.name,no_kpi_array:null==o||null===(s=o.details)||void 0===s||null===(s=s.additional_info)||void 0===s?void 0:s.nkpi,condition_id:null==o?void 0:o._id,time_bounds:o.time_bounds.upper};r.iODJ=[].concat(u(r.iODJ),[l])}var c=new R;c.initialize(o,r.jUXZ,a,r.DAMl,r.iODJ)&&r.CVRh.push(c)}if(r.fgQe.enable_goal_events)for(var f=t.terminate_info.goal_events.events,g=f.length,v=0;v<g;v++){var h=new R;h.initialize(f[v],r.jUXZ,v,!0,[],"termination")&&r.AHwj.push(h)}return r.CVRh.length>0}catch(t){return k.error(t),!1}})),s(this,"uhJX",(function(t){if(!(t<0))if(r.DAMl){var e=r.CVRh[t];if(d(e)&&e.KWyt){var n=r.CVRh[t-1];if(d(n)&&!n.KWyt)return;var i=r.CVRh[t+1];d(i)?i.PaJS():r.CdpR()}}else r.CdpR()})),s(this,"gtHb",(function(t){t<0||r.MQhs()})),s(this,"CdpR",(function(){var e=t.getController().getUserAttributes(),i=t.getController().getSessionAttributes();if(!r.xdhp.validate()||!r.bgGW.validate(e,i)||!r.IQFR.validate())return r.IQFR.retainedDaysValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Retained day criteria not met"}),r.IQFR.retainedSessionValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"User session criteria not met"}),r.IQFR.eventDoneInLT&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Event done in life time"})),r.bgGW.userAttributesValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"User property filter not met"}),r.bgGW.sessionAttributeValidated||null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Session property filter not met"}),r.xdhp._not_yet_active&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"nudge not yet active"})),void(r.xdhp._nudge_expired&&(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"nudge expired"})));for(var a=r.CVRh.length,o=a<1,s="",u=0;u<a;u++){var l=r.CVRh[u],c=l.KWyt;if(""===s.trim())o=c;else switch(s){case"AND":o=o&&c;break;case"OR":o=o||c}s=l.zzXl}if(o){var d,f;if(console.debug("onCondition satisfied"),!r.AIgt.iOMM(r.jUXZ))return console.warn("Maximum limit reached",r.jUXZ),void(null==t||t.logEvent("apx_non_eligible_user",{apx_nudge_type:"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG",apx_failure_type:"warn",apx_reason:"Campaign limit reached"}));null!==(d=window.ApxorRTM)&&void 0!==d&&d.isBadgePresent&&null!==(f=window.ApxorRTM)&&void 0!==f&&f.badgesLists.includes(r.jUXZ)&&t.getController().isBadgeTriggerSatisfied(r.jUXZ)||null==t||t.logEvent("apx_trigger_satisfied",{apx_nudge_type:"SURVEY"===r.ByBE.Lecg?"survey":"campaign",apx_nudge_id:r.jUXZ,apx_nudge_name:r.ByBE.figp,apx_variant_code:r.ByBE._isExperiment||r.ByBE._only_context?r.ByBE._attr.apx_variant_code:"TG"}),console.log("Dispatching event",r.ByBE.Lecg),!0===r.ByBE._only_context&&t.logEvent("apx_context_evaluated",n(n({},r.ByBE._attr),{},{message_name:r.ByBE.figp,id:r.jUXZ})),t.getController().dispatchEvent(r.ByBE.Lecg,{name:r.ByBE.Lecg,additional_info:{uuid:r.jUXZ,name:r.ByBE.figp}})}})),s(this,"MQhs",(function(){for(var e=r.AHwj.length,i=e<1,a="",o=0;o<e;o++){var s=r.AHwj[o],u=s.KWyt;if(""===a.trim())i=u;else switch(a){case"AND":i=i&&u;break;case"OR":i=i||u}a=s.bXqj}i&&(console.log("Dispatching event",r.ByBE.Lecg),t.getController().persistTerminationInfoLocally(r.jUXZ),!0===r.ByBE._only_context&&t.logEvent("apx_context_evaluated",n(n({},r.ByBE._attr),{},{message_name:r.ByBE.figp,id:r.jUXZ})),t.getController().dispatchEvent(r.ByBE.Lecg,{name:r.ByBE.Lecg,additional_info:{uuid:r.jUXZ,name:r.ByBE.figp}}))})),s(this,"validateForTerminationAttributes",(function(){var e=t.getController().getUserAttributes(),n=t.getController().getSessionAttributes();return r.fgQe.validate(e,n)})),s(this,"ikdS",(function(){r.AIgt.ikdS()})),s(this,"getFrequencyCount",(function(){return r.AIgt.getFrequencyCount()})),s(this,"trLO",(function(){return r.AIgt.MdUm()}))})),Z=o((function t(){var e=this;i(this,t),s(this,"XDsl",{}),s(this,"parse",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{configs:[]};if(d(t)&&d(t.configs)){var n=t.configs;if(!Array.isArray(n))return;n.sort((function(t,e){var n,r;return(null!==(n=t.prio)&&void 0!==n?n:-1)-(null!==(r=e.prio)&&void 0!==r?r:-1)}));for(var r=0;r<n.length;r++){var i=n[r],a=i._id,o=new N;o.parse(i)?e.XDsl[a]=o:console.warn("Failed to parse cfg",a)}}})),s(this,"validate",(function(t,n){e.XDsl[t]&&e.XDsl[t].uhJX(n)})),s(this,"getVariantCode",(function(t){return e.XDsl[t]?e.XDsl[t]._variant_code:""})),s(this,"validateForTermination",(function(t,n){e.XDsl[t]&&e.XDsl[t].gtHb(n)})),s(this,"validateForTerminationAttributes",(function(t){return!!e.XDsl[t]&&e.XDsl[t].validateForTerminationAttributes()})),s(this,"ikdS",(function(t){e.XDsl[t].ikdS()})),s(this,"getFrequencyCount",(function(t){return e.XDsl[t].getFrequencyCount()})),s(this,"resetFrequencyCounts",(function(){var t=e.XDsl;for(var n in t)t[n].trLO()})),s(this,"jMAH",(function(t){try{if(e.XDsl){var n=e.XDsl[t];if(n&&n.ByBE)return n.ByBE}}catch(t){console.log("Error in getting the campaign meta ".concat(t))}return{}}))})),W=window.ApxorLogger,Q=o((function e(){var n=this;i(this,e),s(this,"rnqO",{}),s(this,"jgKf",[]),s(this,"isEr",!1),s(this,"initialize",(function(){var e=t.getController();e.registerForEvent("APP_EVENT",(function(t){return n.OmRD(t,"AE")})),e.registerForEvent("CLIENT_EVENT",(function(t){return n.OmRD(t,"CE")}))})),s(this,"uHZe",(function(){for(var t in n.jgKf)n.gOcO(t.event,t.key,t.type);n.isEr=!0})),s(this,"dgAX",(function(t,e){var r;"function"==typeof e&&((r=n.rnqO[t]?n.rnqO[t]:[]).push(e),n.rnqO[t]=r,W.debug("Listeners list: ",n.rnqO))})),s(this,"unregisterFromEvent",(function(t,e){if(n.rnqO[t]){for(var r=n.rnqO[t],i=[],a=0;a<r.length;a++){var o=r[a];o!==e&&i.push(o)}n.rnqO[t]=i}})),s(this,"OmRD",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AE",r=e+"___"+t.name;n.gOcO(t,r,e)})),s(this,"gOcO",(function(e,r,i){if(n.isEr){if(W.debug("Notifying listeners for event: "+e+", "+r,n.rnqO),n.rnqO[r])for(var a=n.rnqO[r],o=t.getController().getSDKRunningTimeInSec(),s=0;s<a.length;s++){(0,a[s])(i,e.name,o,e.additional_info)}}else n.jgKf.push({event:e,key:r,type:i})}))})),Y=window.ApxorLogger,P=function(){function e(){var n=this;return i(this,e),s(this,"qwnH",!1),s(this,"MWAY",null),s(this,"dOSQ",E()),s(this,"aXRJ",new Q),s(this,"yjQV",t.getSiteId()),s(this,"oLkt",{}),s(this,"getQeState",(function(){try{var e=t.getController().getFromStorage("qe_state");return e?JSON.parse(v(n.yjQV,e)):(n.oLkt={},n.setQeState())}catch(t){return n.oLkt={},n.setQeState()}})),s(this,"setQeState",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{t.getController().persistToStorage("qe_state",n.oLkt,!0)}catch(r){""===e?n.oLkt={}:n.oLkt[e]={SESSION:0,OVERALL:0,DATES:{}},t.getController().persistToStorage("qe_state",n.oLkt,!0)}return n.oLkt})),s(this,"initialize",(function(){n.qwnH||(n.qwnH=!0,n.MWAY=new Z,n.aXRJ.initialize(),n.oLkt=n.getQeState(),Y.info("QE Initialized.."))})),s(this,"parse",(function(t){n.lGLs()?(n.MWAY.parse(t),n.aXRJ.uHZe()):Y.warn("Must call init first. Unable to proceed")})),s(this,"validate",(function(t,e){n.lGLs()&&n.MWAY.validate(t,e)})),s(this,"getVariantCode",(function(t){return n.MWAY.getVariantCode(t)})),s(this,"validateForTermination",(function(t,e){n.lGLs()&&n.MWAY.validateForTermination(t,e)})),s(this,"validateForTerminationAttributes",(function(t,e){return n.MWAY.validateForTerminationAttributes(t,e)})),s(this,"updateCount",(function(t){try{d(n.oLkt[t])||n.createObjConfig(t),n.incrementFrequencies(t),n.setQeState(t),n.MWAY.ikdS(t)}catch(t){console.log("Could not update the count config:".concat(t))}})),s(this,"resetFrequencyCounts",(function(){n.MWAY.resetFrequencyCounts()})),s(this,"getFrequencyCount",(function(t){return n.MWAY.getFrequencyCount(t)})),s(this,"registerForEvent",(function(t,e){n.aXRJ.dgAX(t,e)})),s(this,"unregisterFromEvent",(function(t,e){n.aXRJ.unregisterFromEvent(t,e)})),s(this,"notifyEventListener",(function(t){n.aXRJ.OmRD(t)})),s(this,"fetch",(function(e,n,r,i){t.getController().fetchConfiguration(e,n,r,i)})),s(this,"lGLs",(function(){return n.qwnH})),s(this,"getCampaignMetaFromQueryEngine",(function(t){return n.MWAY.jMAH(t)})),s(this,"hUQY",(function(){return n.dOSQ})),e.instance||(e.instance=this),e.instance}return o(e,[{key:"createObjConfig",value:function(t){try{this.oLkt=this.getQeState(),d(this.oLkt[t])||(this.oLkt[t]={SESSION:0,OVERALL:0,DATES:{}},this.dOSQ&&(this.oLkt[t].DATES[this.dOSQ]=0),this.setQeState(t))}catch(t){Y.error("Can not create the frequency count object:"+t)}}},{key:"incrementFrequencies",value:function(t){this.oLkt=this.getQeState();var e=this.oLkt[t];e.SESSION=e.SESSION+1,e.OVERALL=e.OVERALL+1;var n=E();n===this.dOSQ&&e.DATES&&e.DATES[n]||(this.dOSQ=n,e.DATES={},e.DATES[this.dOSQ]=0),e.DATES[this.dOSQ]=e.DATES[this.dOSQ]+1}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}();s(P,"instance",void 0),window.ceVersion=151;try{void 0===exports&&null===exports||(exports.default=P,module.exports=exports.default)}catch(t){}return P}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apxor-qe",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "author": "Uma Sankar Yedida <umasankar.yedida@apxor.com> (https://www.apxor.com)",
5
5
  "contributors": [
6
6
  {