apxor-qe 1.8.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,33 @@
6
6
 
7
7
  Apxor = Apxor && Object.prototype.hasOwnProperty.call(Apxor, 'default') ? Apxor['default'] : Apxor;
8
8
 
9
+ function _iterableToArrayLimit(r, l) {
10
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
11
+ if (null != t) {
12
+ var e,
13
+ n,
14
+ i,
15
+ u,
16
+ a = [],
17
+ f = !0,
18
+ o = !1;
19
+ try {
20
+ if (i = (t = t.call(r)).next, 0 === l) {
21
+ if (Object(t) !== t) return;
22
+ f = !1;
23
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
24
+ } catch (r) {
25
+ o = !0, n = r;
26
+ } finally {
27
+ try {
28
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
29
+ } finally {
30
+ if (o) throw n;
31
+ }
32
+ }
33
+ return a;
34
+ }
35
+ }
9
36
  function ownKeys(e, r) {
10
37
  var t = Object.keys(e);
11
38
  if (Object.getOwnPropertySymbols) {
@@ -72,12 +99,18 @@
72
99
  }
73
100
  return obj;
74
101
  }
102
+ function _slicedToArray(arr, i) {
103
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
104
+ }
75
105
  function _toConsumableArray(arr) {
76
106
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
77
107
  }
78
108
  function _arrayWithoutHoles(arr) {
79
109
  if (Array.isArray(arr)) return _arrayLikeToArray(arr);
80
110
  }
111
+ function _arrayWithHoles(arr) {
112
+ if (Array.isArray(arr)) return arr;
113
+ }
81
114
  function _iterableToArray(iter) {
82
115
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
83
116
  }
@@ -97,6 +130,60 @@
97
130
  function _nonIterableSpread() {
98
131
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
99
132
  }
133
+ function _nonIterableRest() {
134
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
135
+ }
136
+ function _createForOfIteratorHelper(o, allowArrayLike) {
137
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
138
+ if (!it) {
139
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
140
+ if (it) o = it;
141
+ var i = 0;
142
+ var F = function () {};
143
+ return {
144
+ s: F,
145
+ n: function () {
146
+ if (i >= o.length) return {
147
+ done: true
148
+ };
149
+ return {
150
+ done: false,
151
+ value: o[i++]
152
+ };
153
+ },
154
+ e: function (e) {
155
+ throw e;
156
+ },
157
+ f: F
158
+ };
159
+ }
160
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
161
+ }
162
+ var normalCompletion = true,
163
+ didErr = false,
164
+ err;
165
+ return {
166
+ s: function () {
167
+ it = it.call(o);
168
+ },
169
+ n: function () {
170
+ var step = it.next();
171
+ normalCompletion = step.done;
172
+ return step;
173
+ },
174
+ e: function (e) {
175
+ didErr = true;
176
+ err = e;
177
+ },
178
+ f: function () {
179
+ try {
180
+ if (!normalCompletion && it.return != null) it.return();
181
+ } finally {
182
+ if (didErr) throw err;
183
+ }
184
+ }
185
+ };
186
+ }
100
187
  function _toPrimitive(input, hint) {
101
188
  if (typeof input !== "object" || input === null) return input;
102
189
  var prim = input[Symbol.toPrimitive];
@@ -192,6 +279,9 @@
192
279
  data = b64_decode(data);
193
280
  return xor_decrypt(key, data);
194
281
  };
282
+ var isNumber = function isNumber(term) {
283
+ return isDefined(term) && !isNull(term) && !isNaN(term);
284
+ };
195
285
  var generateKey = function generateKey(key) {
196
286
  switch (key) {
197
287
  case "app_event":
@@ -202,13 +292,23 @@
202
292
  return "AE";
203
293
  case "activity_event":
204
294
  return "AE";
295
+ case "apxor_event":
296
+ return "AEV";
297
+ case "customer_event":
298
+ return "CEV";
299
+ case "any_event":
300
+ return "ANV";
301
+ case "campaign_event":
302
+ return "CNV";
303
+ case "survey_event":
304
+ return "SVE";
205
305
  }
206
306
  return "Unknown";
207
307
  };
208
308
  var toUpperCase = function toUpperCase(key) {
209
309
  return key.toUpperCase();
210
310
  };
211
- var StAu = function StAu(actual, expected, operator) {
311
+ var VOPn = function VOPn(actual, expected, operator) {
212
312
  switch (operator) {
213
313
  case "EQ":
214
314
  return actual === expected;
@@ -264,6 +364,111 @@
264
364
  mins: currentTime.getMinutes()
265
365
  };
266
366
  };
367
+ var _getCurrentTime = function _getCurrentTime(userTimezone) {
368
+ var now = new Date();
369
+ var hours = now.getHours();
370
+ var minutes = now.getMinutes();
371
+ hours = (hours < 10 ? "0" : "") + hours;
372
+ minutes = (minutes < 10 ? "0" : "") + minutes;
373
+ var currentTime = hours + ":" + minutes;
374
+ if (!userTimezone) {
375
+ // Convert current time to UTC format
376
+ var utcHours = now.getUTCHours();
377
+ var utcMinutes = now.getUTCMinutes();
378
+ utcHours = (utcHours < 10 ? "0" : "") + utcHours;
379
+ utcMinutes = (utcMinutes < 10 ? "0" : "") + utcMinutes;
380
+ currentTime = utcHours + ":" + utcMinutes;
381
+ }
382
+ return currentTime;
383
+ };
384
+ var _timeEvaluator = function _timeEvaluator(currentTime, expectedTime, operator) {
385
+ if (operator === "GT") {
386
+ var hourMinuteList = currentTime.split(":");
387
+ var expectedHourMInuteList = expectedTime.split(":");
388
+ if (hourMinuteList[0] >= expectedHourMInuteList[0]) {
389
+ if (hourMinuteList[0] > expectedHourMInuteList[0]) {
390
+ return true;
391
+ } else if (hourMinuteList[0] == expectedHourMInuteList[0]) {
392
+ if (hourMinuteList[1] >= expectedHourMInuteList[1]) {
393
+ return true;
394
+ }
395
+ } else {
396
+ return false;
397
+ }
398
+ } else {
399
+ return false;
400
+ }
401
+ } else if (operator === "LT") {
402
+ var _hourMinuteList = currentTime.split(":");
403
+ var _expectedHourMInuteList = expectedTime.split(":");
404
+ if (_hourMinuteList[0] <= _expectedHourMInuteList[0]) {
405
+ if (_hourMinuteList[0] < _expectedHourMInuteList[0]) {
406
+ return true;
407
+ } else if (_hourMinuteList[0] == _expectedHourMInuteList[0]) {
408
+ if (_hourMinuteList[1] <= _expectedHourMInuteList[1]) {
409
+ return true;
410
+ }
411
+ } else {
412
+ return false;
413
+ }
414
+ } else {
415
+ return false;
416
+ }
417
+ }
418
+ };
419
+ var isTimeBetween = function isTimeBetween(startTime, endTime, currentTime) {
420
+ // Extract hours and minutes from the time strings
421
+ var WFNY$split$map = startTime.split(":").map(Number),
422
+ WFNY$split$map2 = _slicedToArray(WFNY$split$map, 2),
423
+ startHour = WFNY$split$map2[0],
424
+ startMinute = WFNY$split$map2[1];
425
+ var GBJY$split$map = endTime.split(":").map(Number),
426
+ GBJY$split$map2 = _slicedToArray(GBJY$split$map, 2),
427
+ endHour = GBJY$split$map2[0],
428
+ endMinute = GBJY$split$map2[1];
429
+ var _currentTime$split$ma = currentTime.split(":").map(Number),
430
+ _currentTime$split$ma2 = _slicedToArray(_currentTime$split$ma, 2),
431
+ currentHour = _currentTime$split$ma2[0],
432
+ currentMinute = _currentTime$split$ma2[1];
433
+
434
+ // Convert times to minutes for easier comparison
435
+ var startTimeInMinutes = startHour * 60 + startMinute;
436
+ var endTimeInMinutes = endHour * 60 + endMinute;
437
+ var currentTimeInMinutes = currentHour * 60 + currentMinute;
438
+
439
+ // Check if current time is between start time and end time
440
+ return currentTimeInMinutes >= startTimeInMinutes && currentTimeInMinutes <= endTimeInMinutes;
441
+ };
442
+ //returns time in seconds
443
+ var calculateTime = function calculateTime(unit, value) {
444
+ switch (unit) {
445
+ case "second":
446
+ return value * 1000;
447
+ case "minute":
448
+ return value * 60 * 1000;
449
+ case "hour":
450
+ return value * 60 * 60 * 1000;
451
+ case "day":
452
+ return value * 24 * 60 * 60 * 1000;
453
+ default:
454
+ return 1;
455
+ }
456
+ };
457
+ var getPastDates = function getPastDates(num) {
458
+ var dates = [];
459
+ var today = new Date();
460
+
461
+ // Loop to get past 'num' days including today
462
+ for (var i = 0; i < num; i++) {
463
+ var pastDate = new Date(today);
464
+ pastDate.setDate(today.getDate() - i);
465
+ var dd = String(pastDate.getDate());
466
+ var mm = String(pastDate.getMonth());
467
+ var yyyy = pastDate.getFullYear();
468
+ dates.push(dd + "/" + mm + "/" + yyyy);
469
+ }
470
+ return dates;
471
+ };
267
472
  var _doesUrlMatchSkeleton = function _doesUrlMatchSkeleton(currenturl, skeleton, variable) {
268
473
  var startsWith = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
269
474
  if (!currenturl || !skeleton || !variable) {
@@ -423,7 +628,7 @@
423
628
  path = path.substring(0, index) + "svg:svg";
424
629
  }
425
630
  try {
426
- return document.WTJq(path, document, function (prefix) {
631
+ return document.IDxi(path, document, function (prefix) {
427
632
  if (prefix === "svg") {
428
633
  return "http://www.w3.org/2000/svg";
429
634
  } else {
@@ -455,6 +660,22 @@
455
660
  return true;
456
661
  }
457
662
 
663
+ /**
664
+ * @function isObjectWithGivenKeyPresent
665
+ * @private
666
+ * @description takes and array of objects(key value pairs) and checks if any object has a given key
667
+ * @param {arrayOfObjects, key}
668
+ */
669
+ function isObjectWithGivenKeyPresent(arrayOfObjects, key) {
670
+ for (var i = 0; i < arrayOfObjects.length; i++) {
671
+ // eslint-disable-next-line no-prototype-builtins
672
+ if (arrayOfObjects[i].hasOwnProperty(key)) {
673
+ return arrayOfObjects[i];
674
+ }
675
+ }
676
+ return null;
677
+ }
678
+
458
679
  /**
459
680
  * @function _scrollIntoTargetIfNeeded
460
681
  * @private
@@ -478,23 +699,39 @@
478
699
  feedbackParentDiv.id = "apx-container";
479
700
  document.body.appendChild(feedbackParentDiv);
480
701
  };
702
+ var validationToastDisplayandRemoval = function validationToastDisplayandRemoval(message) {
703
+ feedBackMessagePopUpCE(message);
704
+ var closeButton = document.getElementById("close-button");
705
+ var dismissCallback = function dismissCallback() {
706
+ var modal_popup_container = document.getElementById("apx-container");
707
+ modal_popup_container === null || modal_popup_container === void 0 || modal_popup_container.remove();
708
+ };
709
+ closeButton === null || closeButton === void 0 || closeButton.addEventListener("click", dismissCallback);
710
+ window.setTimeout(dismissCallback, 20000);
711
+ };
712
+
713
+ var QE_STATE = "qe_state";
714
+ var APX_RETAINED_SESSIONS = "apx_retained_session";
715
+ var APX_RETAINED_DAYS = "apx_retained_days";
716
+ var APX_CONTEXT_EVALUATED = "apx_context_evaluated";
717
+ var APX_VARIANT_CODE = "apx_variant_code";
481
718
 
482
719
  var Logger$1 = window.ApxorLogger;
483
720
  var Audience = /*#__PURE__*/_createClass(function Audience() {
484
721
  var _this = this;
485
722
  _classCallCheck(this, Audience);
486
- _defineProperty(this, "WBXT", "ALL");
487
- _defineProperty(this, "fGzd", []);
488
- _defineProperty(this, "eYdP", []);
723
+ _defineProperty(this, "cTiq", "ALL");
724
+ _defineProperty(this, "zLkI", []);
725
+ _defineProperty(this, "NPii", []);
489
726
  _defineProperty(this, "userAttributesValidated", true);
490
727
  _defineProperty(this, "sessionAttributeValidated", true);
491
728
  _defineProperty(this, "parse", function () {
492
729
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
493
730
  try {
494
- _this.WBXT = config.audience.audience_type;
495
- _this.fGzd = config.audience.attributes.user;
496
- _this.eYdP = config.audience.attributes.session;
497
- if (!Array.isArray(_this.fGzd) || !Array.isArray(_this.eYdP)) {
731
+ _this.cTiq = config.audience.audience_type;
732
+ _this.zLkI = config.audience.attributes.user;
733
+ _this.NPii = config.audience.attributes.session;
734
+ if (!Array.isArray(_this.zLkI) || !Array.isArray(_this.NPii)) {
498
735
  Logger$1.error("No attributes");
499
736
  return false;
500
737
  }
@@ -506,11 +743,11 @@
506
743
  });
507
744
  _defineProperty(this, "validate", function (user, session) {
508
745
  var status = true;
509
- if (_this.WBXT === "FTU") {
746
+ if (_this.cTiq === "FTU") {
510
747
  status = Apxor.getController().getSessionInfo().is_first_session;
511
748
  }
512
- var userAttributesCompare = _this.WJGy(user, _this.fGzd);
513
- var sessionAttributesCompare = _this.WJGy(session, _this.eYdP);
749
+ var userAttributesCompare = _this.uvln(user, _this.zLkI);
750
+ var sessionAttributesCompare = _this.uvln(session, _this.NPii);
514
751
  if (!userAttributesCompare) {
515
752
  _this.userAttributesValidated = false;
516
753
  }
@@ -519,7 +756,7 @@
519
756
  }
520
757
  return status && userAttributesCompare && sessionAttributesCompare;
521
758
  });
522
- _defineProperty(this, "WJGy", function (attributes, expected) {
759
+ _defineProperty(this, "uvln", function (attributes, expected) {
523
760
  var length = expected.length;
524
761
  var status = true;
525
762
  try {
@@ -567,7 +804,7 @@
567
804
  } else if (type === "b") {
568
805
  loggedValue = !!loggedValue;
569
806
  }
570
- return StAu(loggedValue, configValue, operator);
807
+ return VOPn(loggedValue, configValue, operator);
571
808
  });
572
809
  });
573
810
  status = status && match;
@@ -585,229 +822,18 @@
585
822
  });
586
823
  });
587
824
 
588
- var QE_STATE = "qe_state";
589
- var APX_RETAINED_SESSIONS = "apx_retained_session";
590
- var APX_RETAINED_DAYS = "apx_retained_days";
591
- var APX_CONTEXT_EVALUATED = "apx_context_evaluated";
592
- var APX_VARIANT_CODE = "apx_variant_code";
593
-
594
- var Logger$2 = window.ApxorLogger;
595
- var Frequency = /*#__PURE__*/_createClass(function Frequency() {
596
- var _this = this;
597
- _classCallCheck(this, Frequency);
598
- _defineProperty(this, "MSzB", 0);
599
- _defineProperty(this, "EOhX", 0);
600
- _defineProperty(this, "kTyF", "SESSION");
601
- _defineProperty(this, "JeZK", 0);
602
- _defineProperty(this, "ubBd", 0);
603
- _defineProperty(this, "ZJRP", 0);
604
- _defineProperty(this, "parse", function () {
605
- var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
606
- try {
607
- _this.tkvH = config._id;
608
- _this.FaOX = config.meta;
609
- _this.MSzB = config.frequency.count;
610
- if (_this.MSzB === -1) {
611
- _this.MSzB = 1000;
612
- }
613
- _this.ZJRP = _this.MSzB;
614
- _this.EOhX = config.frequency.time_interval;
615
- _this.kTyF = config.frequency.validity;
616
- _this.ubBd = config.frequency.ses_lmt;
617
- _this._dayCount = config.frequency.day_lmt;
618
- // let data = Apxor.getController().getFromStorage(QE_STATE);
619
- // let qe_state = JSON.parse(decode(Apxor.getSiteId(), data));
620
- var qe_state = CE.getInstance().getQeState();
621
- if (!isDefined(qe_state) || !isDefined(qe_state[config._id])) return true;
622
- if (_this.kTyF === "SESSION") {
623
- _this.MSzB = parseInt(_this.MSzB) - parseInt(qe_state[config._id]["SESSION"]);
624
- if (_this.MSzB <= 0) {
625
- _this.vYAT("Session limit reached");
626
- console.warn("Max count limit reached for session:" + config._id);
627
- return false;
628
- }
629
- } else if (_this.kTyF === "OVERALL") {
630
- _this.MSzB = parseInt(_this.MSzB) - parseInt(qe_state[config._id]["OVERALL"]);
631
- if (_this.MSzB <= 0) {
632
- _this.vYAT("Overall limit reached");
633
- console.warn("Max count limit reached for overall:" + config._id);
634
- return false;
635
- }
636
- } else {
637
- Logger$2.info("Invalid config.");
638
- return false;
639
- }
640
- } catch (error) {
641
- Logger$2.error(error);
642
- return false;
643
- }
644
- return true;
645
- });
646
- _defineProperty(this, "hJWa", function () {
647
- _this.MSzB = _this.MSzB - 1;
648
- });
649
- _defineProperty(this, "getFrequencyCount", function () {
650
- return _this.MSzB;
651
- });
652
- _defineProperty(this, "Hhtv", function () {
653
- if (_this.kTyF === "SESSION") {
654
- _this.MSzB = _this.ZJRP;
655
- Logger$2.info("Campaign Limit reset");
656
- }
657
- });
658
- /**
659
- * @function tiom
660
- * @description Validates if the campaign count is with in the limits set in the config.
661
- * @param {string} Config id
662
- * @returns {boolean} true - If the Campaign limits are not reached
663
- * false - Otherwise
664
- */
665
- _defineProperty(this, "tiom", function (id) {
666
- try {
667
- if (_this.MSzB <= 0) {
668
- if (_this.kTyF === "OVERALL") {
669
- _this.vYAT("Overall limit reached");
670
- } else if (_this.kTyF === "SESSION") {
671
- _this.vYAT("Session limit reached");
672
- }
673
- return false;
674
- }
675
-
676
- // let data = Apxor.getController().getFromStorage(QE_STATE);
677
- // let qe_state = JSON.parse(decode(Apxor.getSiteId(), data));
678
- var qe_state = CE.getInstance().getQeState();
679
- //If the frequency counts are not stored no validity checks are needed.
680
- if (!isDefined(qe_state) || !isDefined(qe_state[id])) return true;
681
-
682
- //If the config has a session count limit set
683
- if (_this.ubBd !== 0) {
684
- var sessionCountInConfig = parseInt(_this.ubBd);
685
- var thisSessionCount = parseInt(qe_state[id]["SESSION"]);
686
- if (sessionCountInConfig - thisSessionCount <= 0) {
687
- _this.vYAT("Session limit reached");
688
- return false;
689
- }
690
- }
691
-
692
- //If the config has a day count limit set
693
- if (_this._dayCount !== 0) {
694
- var _qe_state$id;
695
- var date = getDateInDDMMYYYY();
696
- var dayCountInConfig = parseInt(_this._dayCount);
697
- var thisDayCount = parseInt(((_qe_state$id = qe_state[id]) === null || _qe_state$id === void 0 ? void 0 : _qe_state$id.DATES[date]) || 0);
698
- if (dayCountInConfig - thisDayCount <= 0) {
699
- _this.vYAT("Day limit reached");
700
- return false;
701
- }
702
- }
703
- } catch (e) {
704
- _this.vYAT("Error validating the frequency: ".concat(e));
705
- Logger$2.error("Error validating the frequency:" + e);
706
- }
707
- return true;
708
- });
709
- _defineProperty(this, "vYAT", function (reason) {
710
- var _this$FaOX$attr;
711
- Apxor === null || Apxor === void 0 || Apxor.logEvent("apx_non_eligible_user", {
712
- apx_nudge_type: _this.FaOX.type === "SURVEY" ? "survey" : "campaign",
713
- apx_nudge_id: _this.tkvH,
714
- apx_nudge_name: _this.FaOX.name,
715
- apx_variant_code: _this.FaOX.isExperiment || _this.FaOX.only_context ? (_this$FaOX$attr = _this.FaOX.attr) === null || _this$FaOX$attr === void 0 ? void 0 : _this$FaOX$attr[APX_VARIANT_CODE] : "TG",
716
- apx_failure_type: "warn",
717
- apx_reason: reason
718
- });
719
- });
720
- });
721
-
722
- var Meta = /*#__PURE__*/_createClass(function Meta() {
723
- var _this = this;
724
- _classCallCheck(this, Meta);
725
- _defineProperty(this, "FiDT", "");
726
- _defineProperty(this, "WBXT", "");
727
- _defineProperty(this, "parse", function () {
728
- var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
729
- try {
730
- var _config$meta, _config$meta2;
731
- _this.FiDT = config.meta.name;
732
- _this.WBXT = config.meta.type;
733
- _this._only_context = config.meta.only_context;
734
- _this._attr = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.attr) || {};
735
- _this._isExperiment = (_config$meta2 = config.meta) === null || _config$meta2 === void 0 ? void 0 : _config$meta2.isExperiment;
736
- } catch (error) {
737
- window.ApxorLogger.error(error);
738
- return false;
739
- }
740
- return true;
741
- });
742
- });
743
-
744
- var Logger$3 = window.ApxorLogger;
745
- var Validity = /*#__PURE__*/_createClass(function Validity() {
746
- var _this = this;
747
- _classCallCheck(this, Validity);
748
- _defineProperty(this, "QLwb", -1);
749
- _defineProperty(this, "MNVx", -1);
750
- _defineProperty(this, "ybQh", -1);
751
- _defineProperty(this, "yFSG", -1);
752
- _defineProperty(this, "GpDT", false);
753
- _defineProperty(this, "_nudge_expired", false);
754
- _defineProperty(this, "_not_yet_active", false);
755
- _defineProperty(this, "_not_in_specified_time", false);
756
- _defineProperty(this, "parse", function () {
757
- var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
758
- try {
759
- if (isNaN(Date.parse(config.validity.start_date)) || isNaN(Date.parse(config.validity.end_date))) {
760
- Logger$3.error("Not valid dates");
761
- return false;
762
- }
763
- _this.QLwb = Date.parse(config.validity.start_date);
764
- _this.MNVx = Date.parse(config.validity.end_date);
765
- if (isDefined(config.at_specific_time)) {
766
- _this.GpDT = config.at_specific_time;
767
- if (_this.GpDT && isDefined(config.time_limits)) {
768
- var currentDate = new Date().toISOString().split("T")[0];
769
- _this.ybQh = Date.parse(currentDate + "T" + config.time_limits.start_time + ":00.000Z");
770
- _this.yFSG = Date.parse(currentDate + "T" + config.time_limits.end_time + ":00.000Z");
771
-
772
- // If invalid format is passed, return false
773
- if (isNaN(_this.ybQh) || isNaN(_this.yFSG)) {
774
- Logger$3.error("Not valid times");
775
- return false;
776
- }
777
- }
778
- }
779
- } catch (error) {
780
- Logger$3.error(error);
781
- return false;
782
- }
783
- return true;
784
- });
785
- _defineProperty(this, "validate", function () {
786
- var currentTime = Date.now();
787
- if (currentTime > _this.QLwb && currentTime < _this.MNVx) {
788
- if (_this.GpDT && !(currentTime >= _this.ybQh && currentTime <= _this.yFSG)) {
789
- _this._not_in_specified_time = true;
790
- }
791
- return !_this.GpDT || currentTime >= _this.ybQh && currentTime <= _this.yFSG;
792
- } else if (currentTime < _this.QLwb) {
793
- _this._not_yet_active = true;
794
- } else if (currentTime > _this.MNVx) {
795
- _this._nudge_expired = true;
796
- }
797
- return false;
798
- });
799
- });
800
-
801
825
  var Details = /*#__PURE__*/_createClass(function Details() {
802
826
  var _this = this;
803
827
  _classCallCheck(this, Details);
804
- _defineProperty(this, "FiDT", "");
805
- _defineProperty(this, "bFur", {});
828
+ _defineProperty(this, "DUbs", "");
829
+ _defineProperty(this, "wLHD", {});
830
+ _defineProperty(this, "VPDM", "");
806
831
  _defineProperty(this, "parse", function () {
807
832
  var details = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
808
833
  try {
809
- _this.FiDT = details.name;
810
- _this.bFur = details.additional_info;
834
+ _this.DUbs = details.name;
835
+ _this.wLHD = details.additional_info;
836
+ _this.VPDM = details === null || details === void 0 ? void 0 : details.path;
811
837
  } catch (error) {
812
838
  return false;
813
839
  }
@@ -818,14 +844,14 @@
818
844
  var Timebounds = /*#__PURE__*/_createClass(function Timebounds() {
819
845
  var _this = this;
820
846
  _classCallCheck(this, Timebounds);
821
- _defineProperty(this, "xTRO", 0);
822
- _defineProperty(this, "qRLS", 0);
847
+ _defineProperty(this, "tAKC", 0);
848
+ _defineProperty(this, "TvSz", 0);
823
849
  _defineProperty(this, "parse", function () {
824
850
  var timeBounds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
825
851
  try {
826
- _this.xTRO = Number(timeBounds.lower);
827
- _this.qRLS = Number(timeBounds.upper);
828
- if (isNaN(_this.xTRO) || isNaN(_this.qRLS)) {
852
+ _this.tAKC = Number(timeBounds.lower);
853
+ _this.TvSz = Number(timeBounds.upper);
854
+ if (isNaN(_this.tAKC) || isNaN(_this.TvSz)) {
829
855
  return false;
830
856
  }
831
857
  } catch (error) {
@@ -838,102 +864,118 @@
838
864
  var PreCondition = /*#__PURE__*/_createClass(function PreCondition() {
839
865
  var _this = this;
840
866
  _classCallCheck(this, PreCondition);
841
- _defineProperty(this, "XwIs", 0);
842
- _defineProperty(this, "PTXF", "");
843
- _defineProperty(this, "UDkI", "");
844
- _defineProperty(this, "yHbl", new Details());
845
- _defineProperty(this, "ECcI", new Timebounds());
867
+ _defineProperty(this, "Bnen", 0);
868
+ _defineProperty(this, "ApYz", "");
869
+ _defineProperty(this, "xNqg", "");
870
+ _defineProperty(this, "XbMU", new Details());
871
+ _defineProperty(this, "XDKy", new Timebounds());
846
872
  _defineProperty(this, "parse", function () {
847
873
  var precondition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
848
874
  try {
849
- _this.PTXF = precondition.event_type;
850
- _this.UDkI = precondition.activity;
851
- return _this.yHbl.parse(precondition.details) && _this.ECcI.parse(precondition.time_bounds);
875
+ _this.ApYz = precondition.event_type;
876
+ _this.xNqg = precondition.activity;
877
+ return _this.XbMU.parse(precondition.details) && _this.XDKy.parse(precondition.time_bounds);
852
878
  } catch (error) {
853
879
  return false;
854
880
  }
855
881
  });
856
882
  });
857
883
 
858
- var Logger$4 = window.ApxorLogger;
884
+ var Logger$2 = window.ApxorLogger;
859
885
  var Condition = /*#__PURE__*/_createClass(function Condition() {
860
886
  var _this = this;
861
887
  _classCallCheck(this, Condition);
862
- _defineProperty(this, "XwIs", 0);
863
- _defineProperty(this, "CcMq", -1);
864
- _defineProperty(this, "MSzB", 0);
865
- _defineProperty(this, "jxcB", "");
866
- _defineProperty(this, "UDkI", "");
867
- _defineProperty(this, "PTXF", "");
868
- _defineProperty(this, "ECcI", new Timebounds());
869
- _defineProperty(this, "yHbl", new Details());
870
- _defineProperty(this, "koaL", new PreCondition());
871
- _defineProperty(this, "ZdyA", "AND");
872
- _defineProperty(this, "cUqy", false);
873
- _defineProperty(this, "WBXT", void 0);
888
+ _defineProperty(this, "Bnen", 0);
889
+ _defineProperty(this, "WfCJ", -1);
890
+ _defineProperty(this, "pbmh", 0);
891
+ _defineProperty(this, "kbAA", "");
892
+ _defineProperty(this, "xNqg", "");
893
+ _defineProperty(this, "ApYz", "");
894
+ _defineProperty(this, "XDKy", new Timebounds());
895
+ _defineProperty(this, "XbMU", new Details());
896
+ _defineProperty(this, "jpTU", new PreCondition());
897
+ _defineProperty(this, "VnOY", "AND");
898
+ _defineProperty(this, "Cfql", false);
899
+ _defineProperty(this, "cTiq", void 0);
900
+ _defineProperty(this, "ihbo", "");
874
901
  _defineProperty(this, "parse", function () {
875
902
  var condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
876
903
  try {
877
- _this.CcMq = condition.sequence;
878
- _this.MSzB = condition.count_config.count;
879
- _this.jxcB = condition.count_config.operator;
880
- _this.UDkI = condition.activity;
881
- _this.PTXF = condition.event_type;
882
- _this.ZdyA = condition.combine_operator;
883
- _this.WBXT = condition.type;
884
- return _this.yHbl.parse(condition.details) && _this.koaL.parse(condition.trigger) && _this.ECcI.parse(condition.time_bounds);
904
+ var Siqm$count_conf, Siqm$count_conf2;
905
+ _this.WfCJ = condition === null || condition === void 0 ? void 0 : condition.sequence;
906
+ _this._conditionType = condition === null || condition === void 0 ? void 0 : condition.condition_type;
907
+ _this._id = condition === null || condition === void 0 ? void 0 : condition._id;
908
+ _this._eventCategory = condition !== null && condition !== void 0 && condition.event_category ? condition === null || condition === void 0 ? void 0 : condition.event_category : "specific_event";
909
+ _this.pbmh = condition === null || condition === void 0 || (Siqm$count_conf = condition.count_config) === null || Siqm$count_conf === void 0 ? void 0 : Siqm$count_conf.count;
910
+ _this.kbAA = condition === null || condition === void 0 || (Siqm$count_conf2 = condition.count_config) === null || Siqm$count_conf2 === void 0 ? void 0 : Siqm$count_conf2.operator;
911
+ _this.xNqg = condition === null || condition === void 0 ? void 0 : condition.activity;
912
+ _this.ApYz = condition === null || condition === void 0 ? void 0 : condition.event_type;
913
+ _this.VnOY = condition.combine_operator;
914
+ _this._timeEnabled = condition === null || condition === void 0 ? void 0 : condition.time_enabled;
915
+ _this._time = condition === null || condition === void 0 ? void 0 : condition.time;
916
+ _this.cTiq = condition === null || condition === void 0 ? void 0 : condition.type;
917
+ _this.ihbo = condition === null || condition === void 0 ? void 0 : condition.route;
918
+ return _this.XbMU.parse(condition === null || condition === void 0 ? void 0 : condition.details) && _this.jpTU.parse(condition.trigger) && _this.XDKy.parse(condition.time_bounds);
885
919
  } catch (error) {
886
- Logger$4.error(error);
920
+ Logger$2.error(error);
887
921
  return false;
888
922
  }
889
923
  });
890
924
  });
891
925
 
892
- var Logger$5 = window.ApxorLogger;
926
+ var Logger$3 = window.ApxorLogger;
893
927
  var GoalEvent = /*#__PURE__*/_createClass(function GoalEvent() {
894
928
  var _this = this;
895
929
  _classCallCheck(this, GoalEvent);
896
- _defineProperty(this, "MSzB", 0);
897
- _defineProperty(this, "jxcB", "");
898
- _defineProperty(this, "PTXF", "");
899
- _defineProperty(this, "ECcI", new Timebounds());
900
- _defineProperty(this, "yHbl", new Details());
901
- _defineProperty(this, "ZdyA", "AND");
930
+ _defineProperty(this, "pbmh", 0);
931
+ _defineProperty(this, "kbAA", "");
932
+ _defineProperty(this, "ApYz", "");
933
+ _defineProperty(this, "XDKy", new Timebounds());
934
+ _defineProperty(this, "XbMU", new Details());
935
+ _defineProperty(this, "VnOY", "AND");
902
936
  _defineProperty(this, "parse", function (data) {
903
937
  try {
904
- _this.MSzB = data.count_config.count;
905
- _this.jxcB = data.count_config.operator;
906
- _this.PTXF = data.event_type;
907
- _this.ZdyA = data.combine_operator;
908
- return _this.yHbl.parse(data.details) && _this.ECcI.parse(data.time_bounds);
938
+ _this.pbmh = data.count_config.count;
939
+ _this.kbAA = data.count_config.operator;
940
+ _this.ApYz = data.event_type;
941
+ _this.VnOY = data.combine_operator;
942
+ return _this.XbMU.parse(data.details) && _this.XDKy.parse(data.time_bounds);
909
943
  } catch (error) {
910
- Logger$5.error(error);
944
+ Logger$3.error(error);
911
945
  return false;
912
946
  }
913
947
  });
914
948
  });
915
949
 
916
950
  /* eslint-disable no-unused-vars */
917
- var Logger$6 = window.ApxorLogger;
951
+ var Logger$4 = window.ApxorLogger;
918
952
  var ConditionValidator = /*#__PURE__*/function () {
919
953
  function ConditionValidator() {
920
954
  var _this = this;
921
955
  _classCallCheck(this, ConditionValidator);
922
- _defineProperty(this, "HUFK", 0);
923
- _defineProperty(this, "tkvH", "");
924
- _defineProperty(this, "HBDN", new Condition());
925
- _defineProperty(this, "vGYK", new GoalEvent());
926
- _defineProperty(this, "ZDcP", false);
927
- _defineProperty(this, "KUlF", false);
928
- _defineProperty(this, "SgFM", 0);
929
- _defineProperty(this, "ZdyA", "AND");
930
- _defineProperty(this, "seqy", "OR");
931
- _defineProperty(this, "TPiO", -1);
932
- _defineProperty(this, "sHgA", []);
933
- _defineProperty(this, "HTsU", {});
934
- _defineProperty(this, "qHPA", false);
956
+ _defineProperty(this, "jHBh", 0);
957
+ _defineProperty(this, "Hazg", "");
958
+ _defineProperty(this, "Siqm", new Condition());
959
+ _defineProperty(this, "HVKs", new GoalEvent());
960
+ _defineProperty(this, "Lqob", false);
961
+ _defineProperty(this, "HxYU", false);
962
+ _defineProperty(this, "EAVr", 0);
963
+ _defineProperty(this, "VnOY", "AND");
964
+ _defineProperty(this, "mOhQ", "OR");
965
+ _defineProperty(this, "BAXl", -1);
966
+ _defineProperty(this, "clsd", []);
967
+ _defineProperty(this, "KhPZ", {});
968
+ _defineProperty(this, "EVfa", false);
969
+ _defineProperty(this, "Vnko", void 0);
970
+ _defineProperty(this, "PfDn", void 0);
971
+ _defineProperty(this, "fsXY", void 0);
972
+ _defineProperty(this, "mQvT", void 0);
973
+ _defineProperty(this, "no_KPI_TriggerDetails", []);
974
+ _defineProperty(this, "KvTt", false);
975
+ _defineProperty(this, "timerDidnt", void 0);
976
+ _defineProperty(this, "timerDid", void 0);
935
977
  /**
936
- * If respectSequence is true, don't auto-IyAK to events except for the condition whose index is 0
978
+ * If respectSequence is true, don't auto-rxvk to events except for the condition whose index is 0
937
979
  *
938
980
  * @param condition
939
981
  * @param type
@@ -948,192 +990,438 @@
948
990
  var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
949
991
  var respectSequence = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
950
992
  var noKpiArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
951
- var flag = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "";
952
- _this.tkvH = id;
953
- _this.SgFM = index;
954
- _this.sHgA = noKpiArray;
993
+ var across_sessions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
994
+ var flag = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : "";
995
+ var childConditionIndex = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : -1;
996
+ var registerChecker = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
997
+ _this.Hazg = id;
998
+ _this.EAVr = index;
999
+ _this.clsd = noKpiArray;
1000
+ _this.Vnko = respectSequence;
1001
+ _this.childConditionIndex = childConditionIndex;
1002
+ _this.across_sessions = across_sessions ? across_sessions : false;
955
1003
  if (flag !== "termination" || flag === "") {
956
- var result = _this.HBDN.parse(condition);
1004
+ var result = _this.Siqm.parse(condition);
957
1005
  if (result) {
958
- _this.ZdyA = _this.HBDN.ZdyA;
1006
+ _this.VnOY = _this.Siqm.VnOY;
959
1007
 
960
1008
  // FIXME: Why this code is written? Don't see any usecase
961
- if (_this.HBDN.cUqy) {
962
- var eventName = _this.HBDN.yHbl.FiDT;
1009
+ if (_this.Siqm.Cfql) {
1010
+ var eventName = _this.Siqm.XbMU.DUbs;
963
1011
  if (eventName === "APX_PAGE_OPENED") {
964
- eventName = _this.HBDN.yHbl.bFur["navigation_id"];
965
- eventName = isDefined(eventName) ? eventName : _this.HBDN.yHbl.FiDT;
1012
+ eventName = _this.Siqm.XbMU.wLHD["navigation_id"];
1013
+ eventName = isDefined(eventName) ? eventName : _this.Siqm.XbMU.DUbs;
966
1014
  }
967
- _this.TPiO = Apxor.getController().getEventCount(eventName);
968
- var count = _this.HBDN.MSzB;
969
- var operator = _this.HBDN.jxcB;
970
- _this.KUlF = _this.tZfA(_this.TPiO - 1, count, operator, false);
971
- _this.ZDcP = _this.KUlF;
972
- // If the condition is already satisfied and if it is page view, no need to IyAK
1015
+ _this.BAXl = Apxor.getController().getEventCount(eventName);
1016
+ var count = _this.Siqm.pbmh;
1017
+ var operator = _this.Siqm.kbAA;
1018
+ _this.HxYU = _this.yHAo(_this.BAXl - 1, count, operator, false);
1019
+ _this.Lqob = _this.HxYU;
1020
+ // If the condition is already satisfied and if it is page view, no need to rxvk
973
1021
  // This only applies for NAVIGATION_EVENTS
974
- if (_this.KUlF && _this.HBDN.yHbl.FiDT === "APX_PAGE_OPENED") {
1022
+ if (_this.HxYU && _this.Siqm.XbMU.DUbs === "APX_PAGE_OPENED") {
975
1023
  return true;
976
1024
  }
977
1025
  }
978
- if (!respectSequence || index === 0) {
979
- _this.IyAK();
1026
+ if (registerChecker === true) {
1027
+ if (!respectSequence || index === 0 || respectSequence === "unordered") {
1028
+ _this.rxvk();
1029
+ }
980
1030
  }
981
1031
  return true;
982
1032
  }
983
1033
  } else {
984
- var _result = _this.vGYK.parse(condition);
985
- _this.seqy = _this.vGYK.ZdyA;
986
- _this.BUIy();
1034
+ var _result = _this.HVKs.parse(condition);
1035
+ _this.mOhQ = _this.HVKs.VnOY;
1036
+ _this.xATX();
987
1037
  return true;
988
1038
  }
989
1039
  return false;
990
1040
  });
991
- _defineProperty(this, "IyAK", function () {
1041
+ _defineProperty(this, "rxvk", function () {
992
1042
  var _window$ApxorRTM;
993
- var condition = _this.HBDN;
994
- var precondition = condition.koaL;
995
- var ceInstance = CE.getInstance();
996
- if (precondition.PTXF === "app_start") {
997
- _this.ZDcP = true;
998
- ceInstance.registerForEvent(generateKey(condition.PTXF) + "___" + condition.yHbl.FiDT, _this.SeWP);
999
- } else {
1000
- ceInstance.registerForEvent(generateKey(condition.PTXF) + "___" + precondition.yHbl.FiDT, _this.SeWP);
1001
- }
1002
- if ((_window$ApxorRTM = window.ApxorRTM) !== null && _window$ApxorRTM !== void 0 && _window$ApxorRTM.badgesLists.includes(_this.tkvH)) {
1003
- ceInstance.registerForEvent(generateKey(condition.PTXF) + "___" + "apxor-badge-container-".concat("-".concat(_this.tkvH).replaceAll(" ", "").replace(/[^\w\s]/gi, "")), _this.SeWP);
1004
- }
1005
- });
1006
- _defineProperty(this, "BUIy", function () {
1007
- var condition = _this.vGYK;
1008
- var ceInstance = CE.getInstance();
1009
- _this.ZDcP = true;
1010
- ceInstance.registerForEvent(generateKey(condition.PTXF) + "___" + condition.yHbl.FiDT, _this.wgNe);
1011
- });
1012
- _defineProperty(this, "owSn", function (type, name, time, additionalInfo) {
1013
- var _this$HBDN;
1014
- var eventTime = Date.now();
1015
- var time_differnce = (eventTime - _this.HTsU[name]) / 1000;
1016
- var time_fromConfig = ((_this$HBDN = _this.HBDN) === null || _this$HBDN === void 0 || (_this$HBDN = _this$HBDN.yHbl) === null || _this$HBDN === void 0 || (_this$HBDN = _this$HBDN.bFur) === null || _this$HBDN === void 0 ? void 0 : _this$HBDN.time) / 1000;
1017
- if (time_fromConfig > time_differnce) {
1018
- _this._displayCampaign(time);
1019
- }
1020
- });
1021
- _defineProperty(this, "jrrY", function (type, name, time, additionalInfo) {
1022
- var _this$_condition2, _this$_condition3;
1023
- _this.qHPA = true;
1024
- var currentTime = Date.now();
1025
- var eventName = (_this$_condition2 = _this.HBDN) === null || _this$_condition2 === void 0 || (_this$_condition2 = _this$_condition2.koaL) === null || _this$_condition2 === void 0 ? void 0 : _this$_condition2.yHbl.FiDT;
1026
- var eventTime = _this.HTsU[eventName];
1027
- var time_differnce = (currentTime - eventTime) / 1000;
1028
- var time_fromConfig = (_this$_condition3 = _this.HBDN) === null || _this$_condition3 === void 0 || (_this$_condition3 = _this$_condition3.yHbl) === null || _this$_condition3 === void 0 || (_this$_condition3 = _this$_condition3.bFur) === null || _this$_condition3 === void 0 ? void 0 : _this$_condition3.time;
1029
- time_fromConfig = time_fromConfig / 1000;
1030
- if (time_fromConfig > time_differnce) {
1031
- _this._displayCampaign(time);
1043
+ var childConditionIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
1044
+ if (childConditionIndex != -1) {
1045
+ _this.PfDn = childConditionIndex;
1032
1046
  }
1033
- //unregister the event
1034
- });
1035
- _defineProperty(this, "SeWP", function (type, name, time, additionalInfo) {
1036
- var _window$ApxorRTM2, _window$ApxorRTM3;
1047
+ var condition = _this.Siqm;
1048
+ var event_category = condition !== null && condition !== void 0 && condition._eventCategory ? condition === null || condition === void 0 ? void 0 : condition._eventCategory : "specific_event";
1049
+ var precondition = condition.jpTU;
1037
1050
  var ceInstance = CE.getInstance();
1038
- if (!_this.ZDcP) {
1039
- // Validate Precondition
1040
- _this.ZDcP = _this.KRhD(type, name, time, additionalInfo);
1041
- if (_this.ZDcP) {
1042
- var condition = _this.HBDN;
1043
- var precondition = condition.koaL;
1044
- precondition.XwIs = time;
1045
- //events will be registred by its type activity event_type: "activity_time"
1046
- if ((condition === null || condition === void 0 ? void 0 : condition.PTXF) === "activity_time") {
1047
- var HBDN$yHbl, HBDN$_details2, HBDN$_details3;
1048
- var event_time = condition === null || condition === void 0 || (HBDN$yHbl = condition.yHbl) === null || HBDN$yHbl === void 0 || (HBDN$yHbl = HBDN$yHbl.bFur) === null || HBDN$yHbl === void 0 ? void 0 : HBDN$yHbl.time;
1049
- if ((condition === null || condition === void 0 || (HBDN$_details2 = condition.yHbl) === null || HBDN$_details2 === void 0 || (HBDN$_details2 = HBDN$_details2.bFur) === null || HBDN$_details2 === void 0 ? void 0 : HBDN$_details2.nkpi.length) > 0) {
1050
- setTimeout(function () {
1051
- if (!_this.qHPA) {
1052
- _this.KUlF = true;
1053
- if (_this.KUlF) {
1054
- _this.HUFK += 1;
1055
- _this.KUlF = _this.tZfA(_this.HUFK, _this.HBDN.MSzB, _this.HBDN.jxcB);
1056
- if (_this.KUlF) {
1057
- _this.HBDN.XwIs = time;
1058
- ceInstance.validate(_this.tkvH, _this.SgFM);
1051
+ if (precondition.ApYz === "app_start") {
1052
+ _this.Lqob = true;
1053
+ if (condition !== null && condition !== void 0 && condition._timeEnabled) {
1054
+ if ((condition === null || condition === void 0 ? void 0 : condition._time.unit) != "session") {
1055
+ var timeInMillisec = calculateTime(condition._time.unit, condition._time.value);
1056
+ if ((condition === null || condition === void 0 ? void 0 : condition.cTiq) == "didn't") {
1057
+ _this.EVfa = false;
1058
+ _this.timerDidnt = setTimeout(function () {
1059
+ if (!_this.EVfa) {
1060
+ _this.HxYU = true;
1061
+ if (_this.HxYU) {
1062
+ _this.jHBh += 1;
1063
+ _this.HxYU = _this.yHAo(_this.jHBh, _this.Siqm.pbmh, _this.Siqm.kbAA);
1064
+ if (_this.HxYU) {
1065
+ _this.Siqm.Bnen = Date.now();
1066
+ _this.EVfa = false;
1067
+ ceInstance.validate(_this.Hazg, _this.EAVr, _this.PfDn);
1059
1068
  }
1060
1069
  }
1070
+ if (event_category === "specific_event") {
1071
+ ceInstance.unregisterFromEvent(generateKey(_this.Siqm.ApYz) + "___" + _this.Siqm.XbMU.DUbs, _this.spmy);
1072
+ } else {
1073
+ _this.cwdN(event_category);
1074
+ }
1075
+ _this.Lqob = false;
1061
1076
  }
1062
- condition.yHbl.bFur.nkpi.map(function (nokpi) {
1063
- ceInstance.unregisterFromEvent(toUpperCase(condition.yHbl.bFur.et) + "___" + nokpi, _this);
1064
- });
1065
- }, event_time);
1066
- condition.yHbl.bFur.nkpi.map(function (nokpi) {
1067
- ceInstance.registerForEvent(toUpperCase(condition.yHbl.bFur.et) + "___" + nokpi, _this.jrrY);
1068
- });
1069
- }
1070
- //it is for unregistering the events did case after completing the time imit
1071
- if ((condition === null || condition === void 0 || (HBDN$_details3 = condition.yHbl) === null || HBDN$_details3 === void 0 || (HBDN$_details3 = HBDN$_details3.bFur) === null || HBDN$_details3 === void 0 ? void 0 : HBDN$_details3.kpi.length) > 0) {
1072
- setTimeout(function () {
1073
- condition.yHbl.bFur.kpi.map(function (kpi) {
1074
- ceInstance.unregisterFromEvent(toUpperCase(condition.yHbl.bFur.et) + "___" + kpi, _this);
1075
- });
1076
- }, event_time);
1077
- condition.yHbl.bFur.kpi.map(function (kpi) {
1078
- if (kpi === condition.koaL.yHbl.FiDT) {
1079
- //unregister the previous event
1080
- ceInstance.unregisterFromEvent(generateKey(precondition.PTXF) + "___" + precondition.yHbl.FiDT, _this);
1081
- ceInstance.registerForEvent(toUpperCase(condition.yHbl.bFur.et) + "___" + kpi, _this.owSn);
1082
- } else {
1083
- ceInstance.registerForEvent(toUpperCase(condition.yHbl.bFur.et) + "___" + kpi, _this.jrrY);
1077
+ }, timeInMillisec);
1078
+ if (_this.across_sessions) {
1079
+ var _timeInMillisec = calculateTime(condition._time.unit, condition._time.value);
1080
+ var timeEnabled = condition._timeEnabled;
1081
+ var condition_id = condition._id;
1082
+ _this.kdvQ(condition.cTiq, condition.XbMU.DUbs, Date.now(), condition.XbMU.wLHD, _timeInMillisec, timeEnabled, condition_id);
1083
+ }
1084
+ if (event_category === "specific_event") {
1085
+ ceInstance.registerForEvent(generateKey(_this.Siqm.ApYz) + "___" + _this.Siqm.XbMU.DUbs, _this.spmy);
1086
+ _this.mQvT = _this.Siqm;
1087
+ } else {
1088
+ _this.pSsI(event_category);
1089
+ }
1090
+ } else if ((condition === null || condition === void 0 ? void 0 : condition.cTiq) == "did") {
1091
+ _this.timerDid = setTimeout(function () {
1092
+ if (!_this.KvTt) {
1093
+ if (event_category === "specific_event") {
1094
+ ceInstance.unregisterFromEvent(generateKey(_this.Siqm.ApYz) + "___" + _this.Siqm.XbMU.DUbs, _this.WArq);
1095
+ } else {
1096
+ _this.uGas(event_category);
1097
+ }
1084
1098
  }
1085
- });
1099
+ }, timeInMillisec);
1100
+ if (_this.across_sessions) {
1101
+ var _timeInMillisec2 = calculateTime(condition._time.unit, condition._time.value);
1102
+ var _timeEnabled = condition._timeEnabled;
1103
+ var _condition_id = condition._id;
1104
+ _this.kdvQ(condition.cTiq, condition.XbMU.DUbs, Date.now(), condition.XbMU.wLHD, _timeInMillisec2, _timeEnabled, _condition_id);
1105
+ }
1106
+ if (event_category === "specific_event") {
1107
+ ceInstance.registerForEvent(generateKey(_this.Siqm.ApYz) + "___" + _this.Siqm.XbMU.DUbs, _this.WArq);
1108
+ _this.fsXY = _this.Siqm;
1109
+ } else {
1110
+ _this.rCaj(event_category);
1111
+ }
1086
1112
  }
1087
- } else {
1088
- ceInstance.unregisterFromEvent(generateKey(precondition.PTXF) + "___" + precondition.yHbl.FiDT, _this);
1089
- ceInstance.registerForEvent(generateKey(condition.PTXF) + "___" + condition.yHbl.FiDT, _this);
1090
1113
  }
1091
- _this.HTsU[name] = Date.now();
1114
+ } else {
1115
+ if (event_category === "specific_event") {
1116
+ ceInstance.registerForEvent(generateKey(condition.ApYz) + "___" + condition.XbMU.DUbs, _this.lMCD);
1117
+ } else {
1118
+ _this.meTs(event_category);
1119
+ }
1120
+ }
1121
+ } else {
1122
+ if (condition !== null && condition !== void 0 && condition._timeEnabled) {
1123
+ if ((condition === null || condition === void 0 ? void 0 : condition._time.unit) != "session") {
1124
+ var _timeInMillisec3 = calculateTime(condition._time.unit, condition._time.value);
1125
+ if ((condition === null || condition === void 0 ? void 0 : condition.cTiq) == "didn't") {
1126
+ _this.EVfa = false;
1127
+ _this.timerDidnt = setTimeout(function () {
1128
+ if (!_this.EVfa) {
1129
+ _this.HxYU = true;
1130
+ if (_this.HxYU) {
1131
+ _this.jHBh += 1;
1132
+ _this.HxYU = _this.yHAo(_this.jHBh, _this.Siqm.pbmh, _this.Siqm.kbAA);
1133
+ if (_this.HxYU) {
1134
+ _this.Siqm.Bnen = Date.now();
1135
+ _this.EVfa = false;
1136
+ ceInstance.validate(_this.Hazg, _this.EAVr);
1137
+ }
1138
+ }
1139
+ }
1140
+ if (event_category === "specific_event") {
1141
+ ceInstance.unregisterFromEvent(generateKey(_this.Siqm.ApYz) + "___" + _this.Siqm.XbMU.DUbs, _this.spmy);
1142
+ }
1143
+ _this.Lqob = false;
1144
+ }, _timeInMillisec3);
1145
+ if (event_category === "specific_event") {
1146
+ ceInstance.registerForEvent(generateKey(_this.Siqm.ApYz) + "___" + _this.Siqm.XbMU.DUbs, _this.spmy);
1147
+ _this.mQvT = _this.Siqm;
1148
+ } else {
1149
+ _this.pSsI();
1150
+ }
1151
+ } else if ((condition === null || condition === void 0 ? void 0 : condition.cTiq) == "did") {
1152
+ _this.timerDid = setTimeout(function () {
1153
+ if (!_this.KvTt) {
1154
+ if (event_category === "specific_event") {
1155
+ ceInstance.unregisterFromEvent(generateKey(_this.Siqm.ApYz) + "___" + _this.Siqm.XbMU.DUbs, _this.WArq);
1156
+ }
1157
+ }
1158
+ }, _timeInMillisec3);
1159
+ if (event_category === "specific_event") {
1160
+ ceInstance.registerForEvent(generateKey(_this.Siqm.ApYz) + "___" + _this.Siqm.XbMU.DUbs, _this.WArq);
1161
+ }
1162
+ }
1163
+ }
1164
+ } else {
1165
+ if (event_category === "specific_event") {
1166
+ ceInstance.registerForEvent(generateKey(condition.ApYz) + "___" + precondition.XbMU.DUbs, _this.lMCD);
1167
+ }
1168
+ }
1169
+ }
1170
+ if ((_window$ApxorRTM = window.ApxorRTM) !== null && _window$ApxorRTM !== void 0 && _window$ApxorRTM.badgesLists.includes(_this.Hazg)) {
1171
+ ceInstance.registerForEvent(generateKey(condition.ApYz) + "___" + "apxor-badge-container-".concat("-".concat(_this.Hazg).replaceAll(" ", "").replace(/[^\w\s]/gi, "")), _this.lMCD);
1172
+ }
1173
+ });
1174
+ _defineProperty(this, "meTs", function (event_category) {
1175
+ var ceInstance = new CE();
1176
+ if (event_category === "apxor_event") {
1177
+ ceInstance.registerForEvent("apxor_event", function (type, name, time, additionalInfo) {
1178
+ _this.lMCD(generateKey(_this.Siqm.ApYz), _this.Siqm.XbMU.DUbs, time, _this.Siqm.XbMU.wLHD);
1179
+ });
1180
+ } else if (event_category === "customer_event") {
1181
+ ceInstance.registerForEvent("customer_event", function (type, name, time, additionalInfo) {
1182
+ _this.lMCD(generateKey(_this.Siqm.ApYz), _this.Siqm.XbMU.DUbs, time, _this.Siqm.XbMU.wLHD);
1183
+ });
1184
+ } else if (event_category === "any_event") {
1185
+ ceInstance.registerForEvent("any_event", function (type, name, time, additionalInfo) {
1186
+ _this.lMCD(generateKey(_this.Siqm.ApYz), _this.Siqm.XbMU.DUbs, time, _this.Siqm.XbMU.wLHD);
1187
+ });
1188
+ } else if (event_category === "campaign_event") {
1189
+ ceInstance.registerForEvent("campaign_event", function (type, name, time, additionalInfo) {
1190
+ _this.lMCD(generateKey(_this.Siqm.ApYz), _this.Siqm.XbMU.DUbs, time, _this.Siqm.XbMU.wLHD);
1191
+ });
1192
+ } else if (event_category === "survey_event") {
1193
+ ceInstance.registerForEvent("survey_event", function (type, name, time, additionalInfo) {
1194
+ _this.lMCD(generateKey(_this.Siqm.ApYz), _this.Siqm.XbMU.DUbs, time, _this.Siqm.XbMU.wLHD);
1195
+ });
1196
+ }
1197
+ });
1198
+ _defineProperty(this, "cwdN", function (event_category) {
1199
+ var ceInstance = new CE();
1200
+ var eventCategory = _this.Siqm._eventCategory;
1201
+ if (eventCategory === "apxor_event") {
1202
+ ceInstance.unregisterFromEvent("apxor_event", _this.spmy);
1203
+ } else if (eventCategory === "customer_event") {
1204
+ ceInstance.unregisterFromEvent("customer_event", _this.spmy);
1205
+ } else if (eventCategory === "any_event") {
1206
+ ceInstance.unregisterFromEvent("any_event", _this.spmy);
1207
+ } else if (eventCategory === "campaign_event") {
1208
+ ceInstance.unregisterFromEvent("campaign_event", _this.spmy);
1209
+ } else if (eventCategory === "survey_event") {
1210
+ ceInstance.unregisterFromEvent("survey_event", _this.spmy);
1211
+ }
1212
+ });
1213
+ _defineProperty(this, "pSsI", function () {
1214
+ var ceInstance = new CE();
1215
+ var eventCategory = _this.Siqm._eventCategory;
1216
+ if (eventCategory === "apxor_event") {
1217
+ ceInstance.registerForEvent("apxor_event", _this.spmy);
1218
+ } else if (eventCategory === "customer_event") {
1219
+ ceInstance.registerForEvent("customer_event", _this.spmy);
1220
+ } else if (eventCategory === "any_event") {
1221
+ ceInstance.registerForEvent("any_event", _this.spmy);
1222
+ } else if (eventCategory === "campaign_event") {
1223
+ ceInstance.registerForEvent("campaign_event", _this.spmy);
1224
+ } else if (eventCategory === "survey_event") {
1225
+ ceInstance.registerForEvent("survey_event", _this.spmy);
1226
+ }
1227
+ });
1228
+ _defineProperty(this, "rCaj", function () {
1229
+ var ceInstance = new CE();
1230
+ var eventCategory = _this.Siqm._eventCategory;
1231
+ if (eventCategory === "apxor_event") {
1232
+ ceInstance.registerForEvent("apxor_event", _this.WArq);
1233
+ } else if (eventCategory === "customer_event") {
1234
+ ceInstance.registerForEvent("customer_event", _this.WArq);
1235
+ } else if (eventCategory === "any_event") {
1236
+ ceInstance.registerForEvent("any_event", _this.WArq);
1237
+ } else if (eventCategory === "campaign_event") {
1238
+ ceInstance.registerForEvent("campaign_event", _this.WArq);
1239
+ } else if (eventCategory === "survey_event") {
1240
+ ceInstance.registerForEvent("survey_event", _this.WArq);
1241
+ }
1242
+ });
1243
+ _defineProperty(this, "uGas", function () {
1244
+ var ceInstance = new CE();
1245
+ var eventCategory = _this.Siqm._eventCategory;
1246
+ if (eventCategory === "apxor_event") {
1247
+ ceInstance.unregisterFromEvent("apxor_event", _this.WArq);
1248
+ } else if (eventCategory === "customer_event") {
1249
+ ceInstance.unregisterFromEvent("customer_event", _this.WArq);
1250
+ } else if (eventCategory === "any_event") {
1251
+ ceInstance.unregisterFromEvent("any_event", _this.WArq);
1252
+ } else if (eventCategory === "campaign_event") {
1253
+ ceInstance.unregisterFromEvent("campaign_event", _this.WArq);
1254
+ } else if (eventCategory === "survey_event") {
1255
+ ceInstance.unregisterFromEvent("survey_event", _this.WArq);
1256
+ }
1257
+ });
1258
+ _defineProperty(this, "xATX", function () {
1259
+ var condition = _this.HVKs;
1260
+ var ceInstance = CE.getInstance();
1261
+ _this.Lqob = true;
1262
+ ceInstance.registerForEvent(generateKey(condition.ApYz) + "___" + condition.XbMU.DUbs, _this.ApRS);
1263
+ });
1264
+ _defineProperty(this, "vInL", function (type, name, time, additionalInfo) {
1265
+ var _this$Siqm;
1266
+ var eventTime = Date.now();
1267
+ var time_differnce = (eventTime - _this.KhPZ[name]) / 1000;
1268
+ var time_fromConfig = ((_this$Siqm = _this.Siqm) === null || _this$Siqm === void 0 || (_this$Siqm = _this$Siqm.XbMU) === null || _this$Siqm === void 0 || (_this$Siqm = _this$Siqm.wLHD) === null || _this$Siqm === void 0 ? void 0 : _this$Siqm.time) / 1000;
1269
+ if (time_fromConfig > time_differnce) {
1270
+ _this._displayCampaign(time);
1271
+ }
1272
+ });
1273
+ _defineProperty(this, "WhKN", function (type, name, time, additionalInfo) {
1274
+ var _this$_condition2, _this$_condition3;
1275
+ _this.EVfa = true;
1276
+ var currentTime = Date.now();
1277
+ var eventName = (_this$_condition2 = _this.Siqm) === null || _this$_condition2 === void 0 || (_this$_condition2 = _this$_condition2.jpTU) === null || _this$_condition2 === void 0 ? void 0 : _this$_condition2.XbMU.DUbs;
1278
+ var eventTime = _this.KhPZ[eventName];
1279
+ var time_differnce = (currentTime - eventTime) / 1000;
1280
+ var time_fromConfig = (_this$_condition3 = _this.Siqm) === null || _this$_condition3 === void 0 || (_this$_condition3 = _this$_condition3.XbMU) === null || _this$_condition3 === void 0 || (_this$_condition3 = _this$_condition3.wLHD) === null || _this$_condition3 === void 0 ? void 0 : _this$_condition3.time;
1281
+ time_fromConfig = time_fromConfig / 1000;
1282
+ if (time_fromConfig > time_differnce) {
1283
+ _this._displayCampaign(time);
1284
+ }
1285
+ //unregister the event
1286
+ });
1287
+ _defineProperty(this, "WArq", function () {
1288
+ _this.KvTt = true;
1289
+ var ceInstance = new CE();
1290
+ clearTimeout(_this.timerDid);
1291
+ _this.jHBh += 1;
1292
+ _this.HxYU = _this.yHAo(_this.jHBh, _this.Siqm.pbmh, _this.Siqm.kbAA);
1293
+ if (_this.HxYU) {
1294
+ ceInstance.unregisterFromEvent(generateKey(_this.fsXY.ApYz) + "___" + _this.fsXY.XbMU.DUbs, _this.WArq);
1295
+ _this.KvTt = false;
1296
+ ceInstance.validate(_this.Hazg, _this.EAVr, _this.PfDn);
1297
+ }
1298
+ });
1299
+ _defineProperty(this, "spmy", function (type, name, time, additionalInfo) {
1300
+ _this.EVfa = true;
1301
+ clearTimeout(_this.timerDidnt);
1302
+ var ceInstance = new CE();
1303
+ ceInstance.unregisterFromEvent(generateKey(_this.mQvT.ApYz) + "___" + _this.mQvT.XbMU.DUbs, _this.spmy);
1304
+ //return;
1305
+ });
1306
+ _defineProperty(this, "lMCD", function (type, name, time, additionalInfo) {
1307
+ var _window$ApxorRTM2, _window$ApxorRTM3;
1308
+ var ceInstance = CE.getInstance();
1309
+ if (!_this.Lqob) {
1310
+ // Validate Precondition
1311
+ _this.Lqob = _this.PvbP(type, name, time, additionalInfo);
1312
+ if (_this.Lqob) {
1313
+ var condition = _this.Siqm;
1314
+ var precondition = condition.jpTU;
1315
+ precondition.Bnen = time;
1316
+ //events will be registred by its type activity event_type: "activity_time"
1317
+ if ((condition === null || condition === void 0 ? void 0 : condition.ApYz) === "activity_time") {
1318
+ var Siqm$XbMU, Siqm$ihbo, Siqm$_details2, Siqm$_details3;
1319
+ var event_time = condition === null || condition === void 0 || (Siqm$XbMU = condition.XbMU) === null || Siqm$XbMU === void 0 || (Siqm$XbMU = Siqm$XbMU.wLHD) === null || Siqm$XbMU === void 0 ? void 0 : Siqm$XbMU.time;
1320
+ if ((condition === null || condition === void 0 || (Siqm$ihbo = condition.ihbo) === null || Siqm$ihbo === void 0 ? void 0 : Siqm$ihbo.length) > 0) {
1321
+ setTimeout(function () {
1322
+ var _Apxor$getController;
1323
+ var appEventsForNoKpi = (_Apxor$getController = Apxor.getController()) === null || _Apxor$getController === void 0 ? void 0 : _Apxor$getController._appEventsNoKpi;
1324
+ appEventsForNoKpi.length <= 2 && condition.ihbo === location.pathname && _this._displayCampaign(time);
1325
+ }, event_time);
1326
+ } else if ((condition === null || condition === void 0 || (Siqm$_details2 = condition.XbMU) === null || Siqm$_details2 === void 0 || (Siqm$_details2 = Siqm$_details2.wLHD) === null || Siqm$_details2 === void 0 ? void 0 : Siqm$_details2.nkpi.length) > 0) {
1327
+ setTimeout(function () {
1328
+ if (!_this.EVfa) {
1329
+ _this.HxYU = true;
1330
+ if (_this.HxYU) {
1331
+ _this.jHBh += 1;
1332
+ _this.HxYU = _this.yHAo(_this.jHBh, _this.Siqm.pbmh, _this.Siqm.kbAA);
1333
+ if (_this.HxYU) {
1334
+ _this.Siqm.Bnen = time;
1335
+ _this.EVfa = false;
1336
+ ceInstance.validate(_this.Hazg, _this.EAVr);
1337
+ }
1338
+ }
1339
+ }
1340
+ condition.XbMU.wLHD.nkpi.map(function (nokpi) {
1341
+ ceInstance.unregisterFromEvent(toUpperCase(condition.XbMU.wLHD.et) + "___" + nokpi, _this);
1342
+ _this.Lqob = false;
1343
+ });
1344
+ }, event_time);
1345
+ condition.XbMU.wLHD.nkpi.map(function (nokpi) {
1346
+ ceInstance.registerForEvent(toUpperCase(condition.XbMU.wLHD.et) + "___" + nokpi, _this.spmy);
1347
+ });
1348
+ }
1349
+ //it is for unregistering the events did case after completing the time imit
1350
+ else if ((condition === null || condition === void 0 || (Siqm$_details3 = condition.XbMU) === null || Siqm$_details3 === void 0 || (Siqm$_details3 = Siqm$_details3.wLHD) === null || Siqm$_details3 === void 0 ? void 0 : Siqm$_details3.kpi.length) > 0) {
1351
+ setTimeout(function () {
1352
+ condition.XbMU.wLHD.kpi.map(function (kpi) {
1353
+ ceInstance.unregisterFromEvent(toUpperCase(condition.XbMU.wLHD.et) + "___" + kpi, _this);
1354
+ });
1355
+ }, event_time);
1356
+ condition.XbMU.wLHD.kpi.map(function (kpi) {
1357
+ if (kpi === condition.jpTU.XbMU.DUbs) {
1358
+ //unregister the previous event
1359
+ ceInstance.unregisterFromEvent(generateKey(precondition.ApYz) + "___" + precondition.XbMU.DUbs, _this);
1360
+ ceInstance.registerForEvent(toUpperCase(condition.XbMU.wLHD.et) + "___" + kpi, _this.vInL);
1361
+ } else {
1362
+ ceInstance.registerForEvent(toUpperCase(condition.XbMU.wLHD.et) + "___" + kpi, _this.WhKN);
1363
+ }
1364
+ });
1365
+ }
1366
+ } else {
1367
+ ceInstance.unregisterFromEvent(generateKey(precondition.ApYz) + "___" + precondition.XbMU.DUbs, _this);
1368
+ ceInstance.registerForEvent(generateKey(condition.ApYz) + "___" + condition.XbMU.DUbs, _this);
1369
+ }
1370
+ _this.KhPZ[name] = Date.now();
1092
1371
  }
1093
1372
  return;
1094
1373
  }
1095
- if ((_window$ApxorRTM2 = window.ApxorRTM) !== null && _window$ApxorRTM2 !== void 0 && _window$ApxorRTM2.isBadgePresent && (_window$ApxorRTM3 = window.ApxorRTM) !== null && _window$ApxorRTM3 !== void 0 && _window$ApxorRTM3.badgesLists.includes(_this.tkvH) && Apxor.getController().isBadgeTriggerSatisfied(_this.tkvH)) {
1096
- _this.KUlF = true;
1097
- _this.HBDN.XwIs = time;
1098
- ceInstance.validate(_this.tkvH, _this.SgFM);
1374
+ if ((_window$ApxorRTM2 = window.ApxorRTM) !== null && _window$ApxorRTM2 !== void 0 && _window$ApxorRTM2.isBadgePresent && (_window$ApxorRTM3 = window.ApxorRTM) !== null && _window$ApxorRTM3 !== void 0 && _window$ApxorRTM3.badgesLists.includes(_this.Hazg) && Apxor.getController().isBadgeTriggerSatisfied(_this.Hazg)) {
1375
+ _this.HxYU = true;
1376
+ _this.Siqm.Bnen = time;
1377
+ ceInstance.validate(_this.Hazg, _this.EAVr);
1099
1378
  return;
1100
1379
  }
1101
1380
 
1102
1381
  // Validate Condition
1103
- var validationStatus = generateKey(_this.HBDN.PTXF) === type && _this.AYJW(time - _this.HBDN.koaL.XwIs, _this.HBDN.ECcI) && _this.HBDN.yHbl.FiDT === name && _this.bscd(_this.HBDN.yHbl.bFur, additionalInfo);
1382
+ var validationStatus = generateKey(_this.Siqm.ApYz) === type && _this.kUup(time - _this.Siqm.jpTU.Bnen, _this.Siqm.XDKy) && _this.Siqm.XbMU.DUbs === name && _this.ZDpg(_this.Siqm.XbMU.wLHD, additionalInfo);
1104
1383
  if (validationStatus) {
1105
- _this.HUFK += 1;
1106
- _this.KUlF = _this.tZfA(_this.HUFK, _this.HBDN.MSzB, _this.HBDN.jxcB);
1107
- if (_this.KUlF) {
1108
- _this.HBDN.XwIs = time;
1109
- ceInstance.validate(_this.tkvH, _this.SgFM);
1384
+ _this.jHBh += 1;
1385
+ _this.HxYU = _this.yHAo(_this.jHBh, _this.Siqm.pbmh, _this.Siqm.kbAA);
1386
+ if (_this.HxYU) {
1387
+ _this.Siqm.Bnen = time;
1388
+ if (_this.across_sessions) {
1389
+ var timeInMillisec = calculateTime(_this.Siqm._time.unit, _this.Siqm._time.value);
1390
+ var timeEnabled = _this.Siqm._timeEnabled;
1391
+ var condition_id = _this.Siqm._id;
1392
+ var satisfiedCount = _this.jHBh;
1393
+ _this.kdvQ(_this.Siqm.cTiq, name, time, additionalInfo, timeInMillisec, timeEnabled, condition_id, satisfiedCount);
1394
+ }
1395
+ ceInstance.validate(_this.Hazg, _this.EAVr, _this.PfDn);
1110
1396
  }
1111
1397
  }
1112
1398
  });
1113
- _defineProperty(this, "wgNe", function (type, name, time, additionalInfo) {
1399
+ _defineProperty(this, "ApRS", function (type, name, time, additionalInfo) {
1114
1400
  var ceInstance = CE.getInstance();
1115
- var validationStatus = generateKey(_this.vGYK.PTXF) === type && _this.AYJW(time, _this.vGYK.ECcI) && _this.vGYK.yHbl.FiDT === name && _this.bscd(_this.vGYK.yHbl.bFur, additionalInfo);
1401
+ var validationStatus = generateKey(_this.HVKs.ApYz) === type && _this.kUup(time, _this.HVKs.XDKy) && _this.HVKs.XbMU.DUbs === name && _this.ZDpg(_this.HVKs.XbMU.wLHD, additionalInfo);
1116
1402
  if (validationStatus) {
1117
- _this.HUFK += 1;
1118
- _this.KUlF = _this.tZfA(_this.HUFK, _this.vGYK.MSzB, _this.vGYK.jxcB);
1119
- if (_this.KUlF) {
1120
- _this.vGYK.XwIs = time;
1121
- ceInstance.validateForTermination(_this.tkvH, _this.SgFM);
1403
+ _this.jHBh += 1;
1404
+ _this.HxYU = _this.yHAo(_this.jHBh, _this.HVKs.pbmh, _this.HVKs.kbAA);
1405
+ if (_this.HxYU) {
1406
+ _this.HVKs.Bnen = time;
1407
+ ceInstance.validateForTermination(_this.Hazg, _this.EAVr);
1122
1408
  }
1123
1409
  }
1124
1410
  });
1125
- _defineProperty(this, "KRhD", function (type, name, time, additionalInfo) {
1126
- var precondition = _this.HBDN.koaL;
1127
- return generateKey(precondition.PTXF) === type && precondition.yHbl.FiDT === name && _this.AYJW(time, precondition.ECcI) && _this.bscd(precondition.yHbl.bFur, additionalInfo);
1411
+ _defineProperty(this, "PvbP", function (type, name, time, additionalInfo) {
1412
+ var precondition = _this.Siqm.jpTU;
1413
+ var result = generateKey(precondition.ApYz) === type && precondition.XbMU.DUbs === name && _this.kUup(time, precondition.XDKy) && _this.ZDpg(precondition.XbMU.wLHD, additionalInfo);
1414
+ result = name === "APX_PAGE_OPENED" ? result && location.pathname === precondition.XbMU.VPDM : result;
1415
+ return result;
1128
1416
  });
1129
- _defineProperty(this, "AYJW", function (time, timeBounds) {
1417
+ _defineProperty(this, "kUup", function (time, timeBounds) {
1130
1418
  var currentTime = Math.ceil(time);
1131
- return currentTime > timeBounds.xTRO && currentTime < timeBounds.qRLS;
1419
+ return currentTime > timeBounds.tAKC && currentTime < timeBounds.TvSz;
1132
1420
  });
1133
- _defineProperty(this, "tZfA", function (current, required, operator) {
1421
+ _defineProperty(this, "yHAo", function (current, required, operator) {
1134
1422
  var checkOld = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1135
- if (checkOld && _this.HBDN.cUqy) {
1136
- current = current + _this.TPiO;
1423
+ if (checkOld && _this.Siqm.Cfql) {
1424
+ current = current + _this.BAXl;
1137
1425
  }
1138
1426
  switch (operator) {
1139
1427
  case "EQ":
@@ -1150,7 +1438,7 @@
1150
1438
  return false;
1151
1439
  }
1152
1440
  });
1153
- _defineProperty(this, "bscd", function (expected, received) {
1441
+ _defineProperty(this, "ZDpg", function (expected, received) {
1154
1442
  var status = true;
1155
1443
  try {
1156
1444
  var _loop = function _loop() {
@@ -1160,6 +1448,7 @@
1160
1448
  };
1161
1449
  }
1162
1450
  if (_typeof(expected[item]) === "object") {
1451
+ var _expected$item, _expected$item2;
1163
1452
  var operator = expected[item].op;
1164
1453
  var type = expected[item].t;
1165
1454
  var expectedValue;
@@ -1195,14 +1484,24 @@
1195
1484
  } else if (type === "b") {
1196
1485
  loggedValue = !!loggedValue;
1197
1486
  }
1198
- return StAu(loggedValue, expectedValue, operator);
1487
+ return VOPn(loggedValue, expectedValue, operator);
1199
1488
  }
1200
- // StAu(loggedValue, expectedValue, operator)
1489
+ // VOPn(loggedValue, expectedValue, operator)
1201
1490
  );
1202
1491
 
1492
+ var presence_checker = (_expected$item = expected[item]) !== null && _expected$item !== void 0 && _expected$item.present ? (_expected$item2 = expected[item]) === null || _expected$item2 === void 0 ? void 0 : _expected$item2.present : false;
1493
+ if (presence_checker) {
1494
+ var present;
1495
+ if (received.hasOwn(received, item)) {
1496
+ present = true;
1497
+ } else {
1498
+ present = false;
1499
+ }
1500
+ status = status && present;
1501
+ }
1203
1502
  status = status && match;
1204
1503
  } else {
1205
- status = status && StAu(received[item], expected[item], "EQ");
1504
+ status = status && VOPn(received[item], expected[item], "EQ");
1206
1505
  }
1207
1506
  },
1208
1507
  _ret;
@@ -1211,23 +1510,95 @@
1211
1510
  if (_ret) return _ret.v;
1212
1511
  }
1213
1512
  } catch (error) {
1214
- Logger$6.error(error);
1513
+ Logger$4.error(error);
1215
1514
  status = false;
1216
1515
  }
1217
1516
  return status;
1218
1517
  });
1518
+ _defineProperty(this, "kdvQ", function (type, name, time, additionalInfo, timeInMillisec, timeEnabled, id, satisfiedCount) {
1519
+ var objectPresenceChecker = false;
1520
+ var requiredObject;
1521
+ _this.no_KPI_TriggerDetails = Apxor.getController().getFromStorage("apx_nokpi_triggerdetails");
1522
+ if (_this.no_KPI_TriggerDetails === null || _this.no_KPI_TriggerDetails === undefined) {
1523
+ _this.no_KPI_TriggerDetails = [];
1524
+ } else {
1525
+ _this.no_KPI_TriggerDetails = JSON.parse(_this.no_KPI_TriggerDetails);
1526
+ }
1527
+ var finishTime = 0;
1528
+ if (timeEnabled) {
1529
+ finishTime = Date.now() + timeInMillisec;
1530
+ }
1531
+ for (var i = 0; i < _this.no_KPI_TriggerDetails.length; i++) {
1532
+ if (_this.no_KPI_TriggerDetails[i].id === id) {
1533
+ // If the id is found, increment its satisfiedcount by 1
1534
+ objectPresenceChecker = true;
1535
+ requiredObject = _this.no_KPI_TriggerDetails[i];
1536
+ break; // Assuming ids are unique, you can exit the loop after finding the matching object
1537
+ }
1538
+ }
1539
+
1540
+ var triggerObj;
1541
+ if (objectPresenceChecker) {
1542
+ requiredObject.satisfiedCount += 1;
1543
+ } else {
1544
+ triggerObj = {
1545
+ id: id,
1546
+ type: type,
1547
+ time: time,
1548
+ name: name,
1549
+ additionalInfo: additionalInfo,
1550
+ satisfiedCount: satisfiedCount,
1551
+ timeBased: timeEnabled,
1552
+ finishTime: finishTime
1553
+ };
1554
+ _this.no_KPI_TriggerDetails.push(triggerObj);
1555
+ }
1556
+ Apxor.getController().persistToStorage("apx_nokpi_triggerdetails", JSON.stringify(_this.no_KPI_TriggerDetails));
1557
+ });
1558
+ _defineProperty(this, "wogz", function (validators) {
1559
+ var ceInstance = new CE();
1560
+ var _iterator = _createForOfIteratorHelper(validators),
1561
+ _step;
1562
+ try {
1563
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1564
+ var validator = _step.value;
1565
+ if ((validator === null || validator === void 0 ? void 0 : validator.length) === 1 || (validator === null || validator === void 0 ? void 0 : validator.length) === undefined) {
1566
+ ceInstance.unregisterFromEvent(generateKey(validator === null || validator === void 0 ? void 0 : validator.Siqm.ApYz) + "___" + (validator === null || validator === void 0 ? void 0 : validator.Siqm.XbMU.DUbs), _this.lMCD);
1567
+ } else {
1568
+ var _iterator2 = _createForOfIteratorHelper(validator),
1569
+ _step2;
1570
+ try {
1571
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1572
+ var _childValidator$_cond;
1573
+ var childValidator = _step2.value;
1574
+ ceInstance.unregisterFromEvent(generateKey(childValidator === null || childValidator === void 0 ? void 0 : childValidator.Siqm.ApYz) + "___" + (childValidator === null || childValidator === void 0 || (_childValidator$_cond = childValidator.Siqm) === null || _childValidator$_cond === void 0 ? void 0 : _childValidator$_cond.XbMU.DUbs), _this.lMCD);
1575
+ }
1576
+ } catch (err) {
1577
+ _iterator2.e(err);
1578
+ } finally {
1579
+ _iterator2.f();
1580
+ }
1581
+ }
1582
+ }
1583
+ } catch (err) {
1584
+ _iterator.e(err);
1585
+ } finally {
1586
+ _iterator.f();
1587
+ }
1588
+ });
1219
1589
  }
1220
1590
  _createClass(ConditionValidator, [{
1221
1591
  key: "_displayCampaign",
1222
1592
  value: function _displayCampaign(time) {
1223
1593
  var ceInstance = CE.getInstance();
1224
- this.KUlF = true;
1225
- if (this.KUlF) {
1226
- this.HUFK += 1;
1227
- this.KUlF = this.tZfA(this.HUFK, this.HBDN.MSzB, this.HBDN.jxcB);
1228
- if (this.KUlF) {
1229
- this.HBDN.XwIs = time;
1230
- ceInstance.validate(this.tkvH, this.SgFM);
1594
+ this.HxYU = true;
1595
+ if (this.HxYU) {
1596
+ this.jHBh += 1;
1597
+ this.HxYU = this.yHAo(this.jHBh, this.Siqm.pbmh, this.Siqm.kbAA);
1598
+ if (this.HxYU) {
1599
+ this.Siqm.Bnen = time;
1600
+ ceInstance.validate(this.Hazg, this.EAVr);
1601
+ //ceInstance.updateCount(this.Hazg);
1231
1602
  }
1232
1603
  }
1233
1604
  }
@@ -1235,15 +1606,347 @@
1235
1606
  return ConditionValidator;
1236
1607
  }();
1237
1608
 
1609
+ var Logger$5 = window.ApxorLogger;
1610
+ var Frequency = /*#__PURE__*/_createClass(function Frequency() {
1611
+ var _this = this;
1612
+ _classCallCheck(this, Frequency);
1613
+ _defineProperty(this, "pbmh", 0);
1614
+ _defineProperty(this, "Mjgx", 0);
1615
+ _defineProperty(this, "Dqwg", "SESSION");
1616
+ _defineProperty(this, "lszB", 0);
1617
+ _defineProperty(this, "sMcD", 0);
1618
+ _defineProperty(this, "XmlV", 0);
1619
+ _defineProperty(this, "_enable_repetition_gap", void 0);
1620
+ _defineProperty(this, "_enable_days_limit", void 0);
1621
+ _defineProperty(this, "_enable_session_limit", void 0);
1622
+ _defineProperty(this, "zBpL", void 0);
1623
+ _defineProperty(this, "zOqp", void 0);
1624
+ _defineProperty(this, "nczi", void 0);
1625
+ _defineProperty(this, "DSLimits", void 0);
1626
+ _defineProperty(this, "parse", function () {
1627
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1628
+ try {
1629
+ var _config$frequency, _config$frequency3, _config$frequency4, _config$frequency7, _config$frequency8;
1630
+ _this.Hazg = config._id;
1631
+ _this.Ereh = config.meta;
1632
+ _this.pbmh = config.frequency.count;
1633
+ if (_this.pbmh === -1) {
1634
+ _this.pbmh = 9999999;
1635
+ }
1636
+ _this.XmlV = _this.pbmh;
1637
+ _this.Mjgx = config.frequency.time_interval;
1638
+ _this.Dqwg = config.frequency.validity;
1639
+ _this.DSLimits = config.frequency.DSLimits;
1640
+ _this.sMcD = config.frequency.ses_lmt;
1641
+ _this._enable_session_limit = (_config$frequency = config.frequency) === null || _config$frequency === void 0 ? void 0 : _config$frequency.enable_session_limit;
1642
+ if (_this._enable_session_limit) {
1643
+ var _config$frequency2;
1644
+ _this.zBpL = (_config$frequency2 = config.frequency) === null || _config$frequency2 === void 0 ? void 0 : _config$frequency2.session_count;
1645
+ }
1646
+ _this._dayCount = (_config$frequency3 = config.frequency) !== null && _config$frequency3 !== void 0 && _config$frequency3.day_lmt ? (_config$frequency4 = config.frequency) === null || _config$frequency4 === void 0 ? void 0 : _config$frequency4.day_lmt : 0;
1647
+ _this._enable_repetition_gap = config.frequency.enable_repetition_gap ? config.frequency.enable_repetition_gap : false;
1648
+ if (_this._enable_repetition_gap) {
1649
+ var _config$frequency5, _config$frequency6;
1650
+ _this._repetitionValue = (_config$frequency5 = config.frequency) === null || _config$frequency5 === void 0 ? void 0 : _config$frequency5.repetition_gap.val;
1651
+ _this._repetitionUnit = (_config$frequency6 = config.frequency) === null || _config$frequency6 === void 0 ? void 0 : _config$frequency6.repetition_gap.unit;
1652
+ }
1653
+ _this._enable_days_limit = (_config$frequency7 = config.frequency) !== null && _config$frequency7 !== void 0 && _config$frequency7.enable_days_limit ? (_config$frequency8 = config.frequency) === null || _config$frequency8 === void 0 ? void 0 : _config$frequency8.enable_days_limit : false;
1654
+ if (_this._enable_days_limit) {
1655
+ _this.nczi = config.frequency.days_limit.days ? config.frequency.days_limit.days : 1;
1656
+ _this.zOqp = config.frequency.days_limit.limit;
1657
+ }
1658
+
1659
+ // let data = Apxor.getController().getFromStorage(QE_STATE);
1660
+ // let qe_state = JSON.parse(decode(Apxor.getSiteId(), data));
1661
+ var qe_state = CE.getInstance().getQeState();
1662
+ if (!isDefined(qe_state) || !isDefined(qe_state[config._id])) return true;
1663
+ if (_this.Dqwg === "SESSION") {
1664
+ _this.pbmh = parseInt(_this.pbmh) - parseInt(qe_state[config._id]["SESSION"]);
1665
+ if (_this.pbmh <= 0) {
1666
+ _this.sVnr("Session limit reached");
1667
+ console.warn("Max count limit reached for session:" + config._id);
1668
+ if (Apxor.getController().isTestDevice()) {
1669
+ validationToastDisplayandRemoval("Maximum overall limit reached for campaign name ".concat(_this.Ereh.name));
1670
+ }
1671
+ return false;
1672
+ }
1673
+ } else if (_this.Dqwg === "OVERALL") {
1674
+ _this.pbmh = parseInt(_this.pbmh) - parseInt(qe_state[config._id]["OVERALL"]);
1675
+ if (_this.pbmh <= 0) {
1676
+ _this.sVnr("Overall limit reached");
1677
+ console.warn("Max count limit reached for overall:" + config._id);
1678
+ if (Apxor.getController().isTestDevice()) {
1679
+ validationToastDisplayandRemoval("Maximum overall limit reached for campaign name ".concat(_this.Ereh.name));
1680
+ }
1681
+ return false;
1682
+ }
1683
+ } else {
1684
+ Logger$5.info("Invalid config.");
1685
+ return false;
1686
+ }
1687
+ } catch (error) {
1688
+ Logger$5.error(error);
1689
+ return false;
1690
+ }
1691
+ return true;
1692
+ });
1693
+ _defineProperty(this, "mfzx", function () {
1694
+ _this.pbmh = _this.pbmh - 1;
1695
+ });
1696
+ _defineProperty(this, "getFrequencyCount", function () {
1697
+ return _this.pbmh;
1698
+ });
1699
+ _defineProperty(this, "mDnO", function () {
1700
+ if (_this.Dqwg === "SESSION") {
1701
+ _this.pbmh = _this.XmlV;
1702
+ Logger$5.info("Campaign Limit reset");
1703
+ }
1704
+ });
1705
+ /**
1706
+ * @function dhZT
1707
+ * @description Validates if the campaign count is with in the limits set in the config.
1708
+ * @param {string} Config id
1709
+ * @returns {boolean} true - If the Campaign limits are not reached
1710
+ * false - Otherwise
1711
+ */
1712
+ _defineProperty(this, "dhZT", function (id) {
1713
+ try {
1714
+ if (_this.pbmh <= 0) {
1715
+ if (_this.Dqwg === "OVERALL") {
1716
+ _this.sVnr("Overall limit reached");
1717
+ if (Apxor.getController().isTestDevice()) {
1718
+ validationToastDisplayandRemoval("Maximum overall limit reached for campaign name ".concat(_this.Ereh.name));
1719
+ }
1720
+ } else if (_this.Dqwg === "SESSION") {
1721
+ if (Apxor.getController().isTestDevice()) {
1722
+ validationToastDisplayandRemoval("Maximum session limit reached for campaign name ".concat(_this.Ereh.name));
1723
+ }
1724
+ _this.sVnr("Session limit reached");
1725
+ }
1726
+ return false;
1727
+ }
1728
+
1729
+ // let data = Apxor.getController().getFromStorage(QE_STATE);
1730
+ // let qe_state = JSON.parse(decode(Apxor.getSiteId(), data));
1731
+ var qe_state = CE.getInstance().getQeState();
1732
+ //If the frequency counts are not stored no validity checks are needed.
1733
+ if (!isDefined(qe_state) || !isDefined(qe_state[id])) return true;
1734
+ if (_this._enable_session_limit) {
1735
+ var sessionCountFromConfig = parseInt(_this.zBpL);
1736
+ var thisSessionCount = parseInt(qe_state[id]["SESSION"]);
1737
+ if (sessionCountFromConfig - thisSessionCount <= 0) {
1738
+ _this.sVnr("Session limit reached");
1739
+ if (Apxor.getController().isTestDevice()) {
1740
+ validationToastDisplayandRemoval("Maximum session limit reached for campaign name ".concat(_this.Ereh.name));
1741
+ }
1742
+ return false;
1743
+ }
1744
+ }
1745
+ if (_this._enable_repetition_gap) {
1746
+ if (_this._repetitionUnit != "session") {
1747
+ var repetition_times = Apxor.getController().getFromStorage("apx-last-shown-times");
1748
+ repetition_times = JSON.parse(repetition_times);
1749
+ if (!isNull(isObjectWithGivenKeyPresent(repetition_times, _this.Hazg))) {
1750
+ var currentObj = isObjectWithGivenKeyPresent(repetition_times, _this.Hazg);
1751
+ var current_repetition_time = currentObj[_this.Hazg];
1752
+ var current_time = Date.now();
1753
+ var timeInSecFromConfig;
1754
+ timeInSecFromConfig = calculateTime(_this._repetitionUnit, _this._repetitionValue);
1755
+ if (current_time - current_repetition_time < timeInSecFromConfig) {
1756
+ _this.sVnr("Config does not satisfy time difference ");
1757
+ if (Apxor.getController().isTestDevice()) {
1758
+ validationToastDisplayandRemoval("Config does not satisfy time difference for campaign name ".concat(_this.Ereh.name));
1759
+ }
1760
+ return false;
1761
+ }
1762
+ }
1763
+ } else {
1764
+ var sessionsTowait = Apxor.getController().getFromStorage("apx-last-shown-session");
1765
+ sessionsTowait = JSON.parse(sessionsTowait);
1766
+ if (!isNull(isObjectWithGivenKeyPresent(sessionsTowait, _this.Hazg))) {
1767
+ var _currentObj = isObjectWithGivenKeyPresent(sessionsTowait, _this.Hazg);
1768
+ var current_repetition_session = _currentObj[_this.Hazg];
1769
+ var current_session = Apxor.getController().getFromStorage("apx_retained_session");
1770
+ if (current_session - current_repetition_session < parseInt(_this._repetitionValue)) {
1771
+ _this.sVnr("Config does not satisfy session difference ");
1772
+ if (Apxor.getController().isTestDevice()) {
1773
+ validationToastDisplayandRemoval("Config does not satisfy session difference for campaign name ".concat(_this.Ereh.name));
1774
+ }
1775
+ return false;
1776
+ }
1777
+ }
1778
+ }
1779
+ }
1780
+
1781
+ //If the config has a session count limit set
1782
+ if (_this.sMcD !== 0 && _this.DSLimits) {
1783
+ var sessionCountInConfig = parseInt(_this.sMcD);
1784
+ var _thisSessionCount = parseInt(qe_state[id]["SESSION"]);
1785
+ if (sessionCountInConfig - _thisSessionCount <= 0) {
1786
+ _this.sVnr("Session limit reached");
1787
+ if (Apxor.getController().isTestDevice()) {
1788
+ validationToastDisplayandRemoval("Session limit reached for campaign name ".concat(_this.Ereh.name));
1789
+ }
1790
+ return false;
1791
+ }
1792
+ }
1793
+
1794
+ //If the config has a day count limit set
1795
+ if (_this._dayCount !== 0) {
1796
+ var _qe_state$id;
1797
+ var date = getDateInDDMMYYYY();
1798
+ var dayCountInConfig = parseInt(_this._dayCount);
1799
+ var thisDayCount = parseInt(((_qe_state$id = qe_state[id]) === null || _qe_state$id === void 0 ? void 0 : _qe_state$id.DATES[date]) || 0);
1800
+ if (dayCountInConfig - thisDayCount <= 0) {
1801
+ _this.sVnr("Day limit reached");
1802
+ if (Apxor.getController().isTestDevice()) {
1803
+ validationToastDisplayandRemoval("Day limit reached for campaign name ".concat(_this.Ereh.name));
1804
+ }
1805
+ return false;
1806
+ }
1807
+ }
1808
+ if (_this.nczi > 0 && _this._enable_days_limit) {
1809
+ var daysCount = _this.nczi;
1810
+ var shownLimit = 0;
1811
+ var daysListInDDMMYYYY = getPastDates(daysCount);
1812
+ daysListInDDMMYYYY.forEach(function (fetchedDate) {
1813
+ var _qe_state$id2;
1814
+ shownLimit = shownLimit + parseInt(((_qe_state$id2 = qe_state[id]) === null || _qe_state$id2 === void 0 ? void 0 : _qe_state$id2.DATES[fetchedDate]) || 0);
1815
+ });
1816
+ if (shownLimit > _this.zOqp) {
1817
+ Logger$5.info("Shown Limit Crossed");
1818
+ if (Apxor.getController().isTestDevice()) {
1819
+ validationToastDisplayandRemoval("Days limit reached for campaign name ".concat(_this.Ereh.name));
1820
+ }
1821
+ return false;
1822
+ }
1823
+ }
1824
+ } catch (e) {
1825
+ _this.sVnr("Error validating the frequency: ".concat(e));
1826
+ Logger$5.error("Error validating the frequency:" + e);
1827
+ }
1828
+ return true;
1829
+ });
1830
+ _defineProperty(this, "sVnr", function (reason) {
1831
+ var _this$Ereh$attr;
1832
+ Apxor === null || Apxor === void 0 || Apxor.logEvent("apx_non_eligible_user", {
1833
+ apx_nudge_type: _this.Ereh.type === "SURVEY" ? "survey" : "campaign",
1834
+ apx_nudge_id: _this.Hazg,
1835
+ apx_nudge_name: _this.Ereh.name,
1836
+ apx_variant_code: _this.Ereh.isExperiment || _this.Ereh.only_context ? (_this$Ereh$attr = _this.Ereh.attr) === null || _this$Ereh$attr === void 0 ? void 0 : _this$Ereh$attr[APX_VARIANT_CODE] : "TG",
1837
+ apx_failure_type: "warn",
1838
+ apx_reason: reason
1839
+ });
1840
+ });
1841
+ });
1842
+
1843
+ var Logger$6 = window.ApxorLogger;
1844
+ // import { isDefined } from "./utils";
1845
+ // import ConfigItem from "./ConfigItem";
1846
+ var GroupConditionValidator = /*#__PURE__*/_createClass(function GroupConditionValidator() {
1847
+ var _this = this;
1848
+ _classCallCheck(this, GroupConditionValidator);
1849
+ _defineProperty(this, "trNx", []);
1850
+ _defineProperty(this, "VxYR", 0);
1851
+ _defineProperty(this, "fAbO", false);
1852
+ _defineProperty(this, "jQQw", void 0);
1853
+ _defineProperty(this, "initialize", function () {
1854
+ var conditions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1855
+ var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
1856
+ var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1857
+ var respectSequence = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "unordered";
1858
+ var noKpiArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
1859
+ var parentRespectSequence = arguments.length > 5 ? arguments[5] : undefined;
1860
+ var across_sessions = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
1861
+ _this.Hazg = id;
1862
+ _this.EAVr = index;
1863
+ _this.clsd = noKpiArray;
1864
+ _this.Vnko = respectSequence;
1865
+ _this.across_sessions = across_sessions;
1866
+ var childConditions = [];
1867
+ _this.VxYR = conditions.length;
1868
+ try {
1869
+ if (childConditions != null) {
1870
+ respectSequence = conditions === null || conditions === void 0 ? void 0 : conditions.sequence_type;
1871
+ childConditions = _this.RaJD(conditions, _this.VxYR);
1872
+ if (parentRespectSequence === "unordered" || _this.EAVr === 0) {
1873
+ _this.rxvk();
1874
+ }
1875
+ return _this.trNx;
1876
+ }
1877
+ } catch (error) {
1878
+ Logger$6.error(error);
1879
+ return false;
1880
+ }
1881
+ });
1882
+ _defineProperty(this, "RaJD", function (conditions, conditionsLength) {
1883
+ for (var index = 0; index < conditionsLength; index++) {
1884
+ _this.jQQw = new ConditionValidator();
1885
+ try {
1886
+ if (_this.jQQw.initialize(conditions[index], _this.Hazg, _this.EAVr, _this.Vnko, _this.XfJZ, _this.across_sessions, "", -1, false)) {
1887
+ _this.trNx.push(_this.jQQw);
1888
+ _this.trNx.sequence_type = _this.Vnko;
1889
+ }
1890
+ } catch (error) {
1891
+ Logger$6.error(error);
1892
+ }
1893
+ }
1894
+ return _this.trNx;
1895
+ });
1896
+ _defineProperty(this, "rxvk", function () {
1897
+ if (_this.Vnko === "ordered" || _this.Vnko === "strictly_ordered") {
1898
+ _this.trNx[0].rxvk(0);
1899
+ } else {
1900
+ var _iterator = _createForOfIteratorHelper(_this.trNx),
1901
+ _step;
1902
+ try {
1903
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1904
+ var validator = _step.value;
1905
+ validator.rxvk();
1906
+ }
1907
+ } catch (err) {
1908
+ _iterator.e(err);
1909
+ } finally {
1910
+ _iterator.f();
1911
+ }
1912
+ }
1913
+ });
1914
+ _defineProperty(this, "wogz", function (validators) {
1915
+ _this.jQQw.wogz(validators);
1916
+ });
1917
+ });
1918
+
1919
+ var Meta = /*#__PURE__*/_createClass(function Meta() {
1920
+ var _this = this;
1921
+ _classCallCheck(this, Meta);
1922
+ _defineProperty(this, "DUbs", "");
1923
+ _defineProperty(this, "cTiq", "");
1924
+ _defineProperty(this, "parse", function () {
1925
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1926
+ try {
1927
+ var _config$meta, _config$meta2;
1928
+ _this.DUbs = config.meta.name;
1929
+ _this.cTiq = config.meta.type;
1930
+ _this._only_context = config.meta.only_context;
1931
+ _this._attr = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.attr) || {};
1932
+ _this._isExperiment = (_config$meta2 = config.meta) === null || _config$meta2 === void 0 ? void 0 : _config$meta2.isExperiment;
1933
+ } catch (error) {
1934
+ window.ApxorLogger.error(error);
1935
+ return false;
1936
+ }
1937
+ return true;
1938
+ });
1939
+ });
1940
+
1238
1941
  var Logger$7 = window.ApxorLogger;
1239
1942
  var OverallConfig = /*#__PURE__*/_createClass(function OverallConfig() {
1240
1943
  var _this = this;
1241
1944
  _classCallCheck(this, OverallConfig);
1242
- _defineProperty(this, "yTgw", []);
1945
+ _defineProperty(this, "sOpG", []);
1243
1946
  _defineProperty(this, "_ret_day", {});
1244
- _defineProperty(this, "jJTV", {});
1245
- _defineProperty(this, "oZvY", false);
1246
- _defineProperty(this, "laSF", false);
1947
+ _defineProperty(this, "wQCq", {});
1948
+ _defineProperty(this, "Rlap", false);
1949
+ _defineProperty(this, "oepX", false);
1247
1950
  _defineProperty(this, "retainedDaysValidated", true);
1248
1951
  _defineProperty(this, "retainedSessionValidated", true);
1249
1952
  _defineProperty(this, "eventDoneInLT", false);
@@ -1251,11 +1954,11 @@
1251
1954
  _defineProperty(this, "parse", function () {
1252
1955
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1253
1956
  try {
1254
- _this.yTgw = config.overall_cfg.events;
1957
+ _this.sOpG = config.overall_cfg.events;
1255
1958
  _this._ret_day = config.overall_cfg.ret_day;
1256
- _this.jJTV = config.overall_cfg.session;
1257
- _this.oZvY = config.overall_cfg.toggleRetDay;
1258
- _this.laSF = config.overall_cfg.toggleSession;
1959
+ _this.wQCq = config.overall_cfg.session;
1960
+ _this.Rlap = config.overall_cfg.toggleRetDay;
1961
+ _this.oepX = config.overall_cfg.toggleSession;
1259
1962
  } catch (error) {
1260
1963
  Logger$7.error(error);
1261
1964
  return false;
@@ -1265,11 +1968,11 @@
1265
1968
  _defineProperty(this, "validate", function () {
1266
1969
  var retainedDays = parseInt(Apxor.getController().getFromStorage(APX_RETAINED_DAYS));
1267
1970
  var retainedSession = parseInt(Apxor.getController().getFromStorage(APX_RETAINED_SESSIONS));
1268
- if (_this.oZvY && !isNaN(retainedDays) && !(retainedDays >= _this._ret_day.from && retainedDays <= _this._ret_day.to)) {
1971
+ if (_this.Rlap && !isNaN(retainedDays) && !(retainedDays >= _this._ret_day.from && retainedDays <= _this._ret_day.to)) {
1269
1972
  _this.retainedDaysValidated = false;
1270
1973
  return false;
1271
1974
  }
1272
- if (_this.laSF && !isNaN(retainedSession) && !(retainedSession >= _this.jJTV.from && retainedSession <= _this.jJTV.to)) {
1975
+ if (_this.oepX && !isNaN(retainedSession) && !(retainedSession >= _this.wQCq.from && retainedSession <= _this.wQCq.to)) {
1273
1976
  _this.retainedSessionValidated = false;
1274
1977
  return false;
1275
1978
  }
@@ -1278,8 +1981,8 @@
1278
1981
  var data = Apxor.getController().getFromStorage("_apx_lt_count");
1279
1982
  var siteid = Apxor.getSiteId();
1280
1983
  var LtCountObjDecoded = JSON.parse(new TextDecoder().decode(stringToArrayBuffer(decode(siteid, data))));
1281
- for (var i = 0; i < _this.yTgw.length; i++) {
1282
- var evName = _this.yTgw[i].name.replace("'", "").replace("’", "");
1984
+ for (var i = 0; i < _this.sOpG.length; i++) {
1985
+ var evName = _this.sOpG[i].name.replace("'", "").replace("’", "");
1283
1986
  if (LtCountObjDecoded[evName]) {
1284
1987
  _this.eventDoneInLT = true;
1285
1988
  return false;
@@ -1296,14 +1999,14 @@
1296
1999
  var Attributes = /*#__PURE__*/_createClass(function Attributes() {
1297
2000
  var _this = this;
1298
2001
  _classCallCheck(this, Attributes);
1299
- _defineProperty(this, "fGzd", []);
1300
- _defineProperty(this, "eYdP", []);
2002
+ _defineProperty(this, "zLkI", []);
2003
+ _defineProperty(this, "NPii", []);
1301
2004
  _defineProperty(this, "parse", function () {
1302
2005
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1303
2006
  try {
1304
- _this.fGzd = config.attributes.user;
1305
- _this.eYdP = config.attributes.session;
1306
- if (!Array.isArray(_this.fGzd) || !Array.isArray(_this.eYdP)) {
2007
+ _this.zLkI = config.attributes.user;
2008
+ _this.NPii = config.attributes.session;
2009
+ if (!Array.isArray(_this.zLkI) || !Array.isArray(_this.NPii)) {
1307
2010
  Logger$8.error("No attributes");
1308
2011
  return false;
1309
2012
  }
@@ -1314,9 +2017,9 @@
1314
2017
  return true;
1315
2018
  });
1316
2019
  _defineProperty(this, "validate", function (user, session) {
1317
- return _this.WJGy(user, _this.fGzd) && _this.WJGy(session, _this.eYdP);
2020
+ return _this.uvln(user, _this.zLkI) && _this.uvln(session, _this.NPii);
1318
2021
  });
1319
- _defineProperty(this, "WJGy", function (attributes, expected) {
2022
+ _defineProperty(this, "uvln", function (attributes, expected) {
1320
2023
  var length = expected.length;
1321
2024
  var status = true;
1322
2025
  try {
@@ -1346,7 +2049,7 @@
1346
2049
  }
1347
2050
  var match = loggedValues.some(function (loggedValue) {
1348
2051
  return values.some(function (configValue) {
1349
- return StAu(loggedValue, configValue, operator);
2052
+ return VOPn(loggedValue, configValue, operator);
1350
2053
  });
1351
2054
  });
1352
2055
  status = status && match;
@@ -1370,18 +2073,18 @@
1370
2073
  var TimeBasedTermination = /*#__PURE__*/_createClass(function TimeBasedTermination() {
1371
2074
  var _this = this;
1372
2075
  _classCallCheck(this, TimeBasedTermination);
1373
- _defineProperty(this, "lSAU", Apxor.getController());
2076
+ _defineProperty(this, "BRup", Apxor.getController());
1374
2077
  _defineProperty(this, "type", "");
1375
2078
  _defineProperty(this, "_duration_seconds", 0);
1376
- _defineProperty(this, "UCQR", 1);
2079
+ _defineProperty(this, "VJoQ", 1);
1377
2080
  _defineProperty(this, "parse", function (config) {
1378
2081
  try {
1379
2082
  var _config$terminate_inf, _config$terminate_inf2, _config$terminate_inf3;
1380
- _this.WBXT = (_config$terminate_inf = config.terminate_info.time_based) === null || _config$terminate_inf === void 0 ? void 0 : _config$terminate_inf.type;
2083
+ _this.cTiq = (_config$terminate_inf = config.terminate_info.time_based) === null || _config$terminate_inf === void 0 ? void 0 : _config$terminate_inf.type;
1381
2084
  _this._duration_seconds = (_config$terminate_inf2 = config.terminate_info) === null || _config$terminate_inf2 === void 0 ? void 0 : _config$terminate_inf2.time_based.duration_seconds;
1382
- _this.UCQR = (_config$terminate_inf3 = config.terminate_info.time_based) === null || _config$terminate_inf3 === void 0 ? void 0 : _config$terminate_inf3.days;
1383
- if (_this.StAu(config._id)) {
1384
- _this.lSAU.persistTerminationInfoLocally(config._id);
2085
+ _this.VJoQ = (_config$terminate_inf3 = config.terminate_info.time_based) === null || _config$terminate_inf3 === void 0 ? void 0 : _config$terminate_inf3.days;
2086
+ if (_this.VOPn(config._id)) {
2087
+ _this.BRup.persistTerminationInfoLocally(config._id);
1385
2088
  return false;
1386
2089
  }
1387
2090
  } catch (_unused) {
@@ -1389,16 +2092,16 @@
1389
2092
  }
1390
2093
  return true;
1391
2094
  });
1392
- _defineProperty(this, "StAu", function (id) {
2095
+ _defineProperty(this, "VOPn", function (id) {
1393
2096
  var _Data$id;
1394
- var Data = JSON.parse(_this.lSAU.getFromStorage(APX_TERMINATION_ID));
2097
+ var Data = JSON.parse(_this.BRup.getFromStorage(APX_TERMINATION_ID));
1395
2098
  if (!Data[id] || !((_Data$id = Data[id]) !== null && _Data$id !== void 0 && _Data$id.startDate)) return false;
1396
2099
  var startDate = new Date(Data[id].startDate);
1397
2100
  var presentDate = new Date(getDateInMMDDYYYY());
1398
2101
  var diff = parseInt((presentDate - startDate) / (1000 * 60 * 60 * 24), 10);
1399
2102
  var currentTime = _getTime();
1400
- var ybQh = Data[id].ybQh;
1401
- return diff === _this.UCQR && currentTime.hours >= ybQh.hours || diff > _this.UCQR || Data[id].goalAcheived;
2103
+ var WFNY = Data[id].WFNY;
2104
+ return diff === _this.VJoQ && currentTime.hours >= WFNY.hours || diff > _this.VJoQ || Data[id].goalAcheived;
1402
2105
  });
1403
2106
  });
1404
2107
 
@@ -1407,49 +2110,154 @@
1407
2110
  _classCallCheck(this, TerminationInfo);
1408
2111
  _defineProperty(this, "enable_goal_events", false);
1409
2112
  _defineProperty(this, "attributes", {});
1410
- _defineProperty(this, "MEqZ", new Attributes());
1411
- _defineProperty(this, "ujNH", new TimeBasedTermination());
2113
+ _defineProperty(this, "nGPc", new Attributes());
2114
+ _defineProperty(this, "Ayla", new TimeBasedTermination());
1412
2115
  _defineProperty(this, "parse", function () {
1413
2116
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1414
2117
  try {
1415
2118
  var _config$terminate_inf, _config$terminate_inf2, _config$terminate_inf3;
1416
2119
  _this.enable_time_based = config === null || config === void 0 || (_config$terminate_inf = config.terminate_info) === null || _config$terminate_inf === void 0 ? void 0 : _config$terminate_inf.enable_time_based;
1417
- if (_this.enable_time_based && !_this.ujNH.parse(config)) {
2120
+ if (_this.enable_time_based && !_this.Ayla.parse(config)) {
1418
2121
  return false;
1419
2122
  }
1420
2123
  _this.enable_goal_events = config === null || config === void 0 || (_config$terminate_inf2 = config.terminate_info) === null || _config$terminate_inf2 === void 0 ? void 0 : _config$terminate_inf2.enable_goal_events;
1421
2124
  _this.enable_attributes = config === null || config === void 0 || (_config$terminate_inf3 = config.terminate_info) === null || _config$terminate_inf3 === void 0 ? void 0 : _config$terminate_inf3.enable_attributes;
1422
- if (_this.enable_attributes && !_this.MEqZ.parse(config.terminate_info)) {
2125
+ if (_this.enable_attributes && !_this.nGPc.parse(config.terminate_info)) {
2126
+ return false;
2127
+ }
2128
+ } catch (error) {
2129
+ window.ApxorLogger.error(error);
2130
+ return false;
2131
+ }
2132
+ return true;
2133
+ });
2134
+ _defineProperty(this, "validate", function (user, session) {
2135
+ return _this.nGPc.validate(user, session);
2136
+ });
2137
+ });
2138
+
2139
+ var Logger$9 = window.ApxorLogger;
2140
+ var Validity = /*#__PURE__*/_createClass(function Validity() {
2141
+ var _this = this;
2142
+ _classCallCheck(this, Validity);
2143
+ _defineProperty(this, "YgQr", -1);
2144
+ _defineProperty(this, "FdHW", -1);
2145
+ _defineProperty(this, "WFNY", -1);
2146
+ _defineProperty(this, "GBJY", -1);
2147
+ _defineProperty(this, "Ngly", -1);
2148
+ _defineProperty(this, "REwA", -1);
2149
+ _defineProperty(this, "_is_user_timezone", void 0);
2150
+ _defineProperty(this, "ezbU", false);
2151
+ _defineProperty(this, "Npsa", false);
2152
+ _defineProperty(this, "_nudge_expired", false);
2153
+ _defineProperty(this, "_not_yet_active", false);
2154
+ _defineProperty(this, "_not_in_specified_time", false);
2155
+ _defineProperty(this, "_days_in_week", []);
2156
+ _defineProperty(this, "parse", function () {
2157
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2158
+ try {
2159
+ var _config$validity, _config$validity2;
2160
+ _this.Hazg = config._id;
2161
+ _this.Ereh = config.meta;
2162
+ if (isNaN(Date.parse(config.validity.start_date)) || isNaN(Date.parse(config.validity.end_date)) || !Array.isArray(config.validity.days_in_week)) {
2163
+ Logger$9.error("Not valid dates");
1423
2164
  return false;
1424
2165
  }
2166
+ _this.YgQr = Date.parse(config.validity.start_date);
2167
+ _this.FdHW = Date.parse(config.validity.end_date);
2168
+ _this._days_in_week = (_config$validity = config.validity) !== null && _config$validity !== void 0 && _config$validity.days_in_week ? (_config$validity2 = config.validity) === null || _config$validity2 === void 0 ? void 0 : _config$validity2.days_in_week : [1, 2, 3, 4, 5, 6, 7];
2169
+ _this._is_user_timezone = config.is_user_timezone ? config.is_user_timezone : true;
2170
+ if (isDefined(config.at_specific_time)) {
2171
+ _this.ezbU = config.at_specific_time;
2172
+ if (_this.ezbU && isDefined(config.time_limits)) {
2173
+ _this.WFNY = config.time_limits.start_time;
2174
+ _this.GBJY = config.time_limits.end_time;
2175
+
2176
+ // If invalid format is passed, return false
2177
+ if (isNumber(_this.WFNY) || isNumber(_this.GBJY)) {
2178
+ Logger$9.error("Not valid times");
2179
+ return false;
2180
+ }
2181
+ }
2182
+ }
2183
+ if (isDefined(config.time_excludes_in_day)) {
2184
+ _this.Npsa = config.time_excludes_in_day;
2185
+ if (_this.Npsa && isDefined(config.time_excludes)) {
2186
+ _this.Ngly = config.time_excludes.start_time;
2187
+ _this.REwA = config.time_excludes.end_time;
2188
+ // If invalid format is passed, return false
2189
+ if (isNumber(_this.Ngly) || isNumber(_this.REwA)) {
2190
+ Logger$9.error("Not valid exclude times");
2191
+ return false;
2192
+ }
2193
+ }
2194
+ }
1425
2195
  } catch (error) {
1426
- window.ApxorLogger.error(error);
2196
+ Logger$9.error(error);
1427
2197
  return false;
1428
2198
  }
1429
2199
  return true;
1430
2200
  });
1431
- _defineProperty(this, "validate", function (user, session) {
1432
- return _this.MEqZ.validate(user, session);
2201
+ _defineProperty(this, "validate", function () {
2202
+ var currentTime = Date.now();
2203
+ var currentDate = new Date();
2204
+ var currentDay = currentDate.getDay() + 1;
2205
+ var currentTimeIn24hourFormat = _getCurrentTime(_this._is_user_timezone);
2206
+ if (currentTime > _this.YgQr && currentTime < _this.FdHW && _this._days_in_week.includes(currentDay)) {
2207
+ if (_this.ezbU && !(_timeEvaluator(currentTimeIn24hourFormat, _this.WFNY, "GT") && _timeEvaluator(currentTimeIn24hourFormat, _this.GBJY, "LT"))) {
2208
+ _this._not_in_specified_time = true;
2209
+ }
2210
+ if (_this.Npsa && isTimeBetween(_this.Ngly, _this.REwA, currentTimeIn24hourFormat)) {
2211
+ _this.sVnr("Exclude Time limits check failed");
2212
+ if (Apxor.getController().isTestDevice()) {
2213
+ validationToastDisplayandRemoval("Exclude Time Limits check failed for campaign name ".concat(_this.Ereh.name));
2214
+ }
2215
+ return false;
2216
+ }
2217
+ return !_this.ezbU || _timeEvaluator(currentTimeIn24hourFormat, _this.WFNY, "GT") && _timeEvaluator(currentTimeIn24hourFormat, _this.GBJY, "LT");
2218
+ } else if (currentTime < _this.YgQr) {
2219
+ _this._not_yet_active = true;
2220
+ } else if (currentTime > _this.FdHW) {
2221
+ _this._nudge_expired = true;
2222
+ } else if (!_this._days_in_week.includes(currentDay)) {
2223
+ _this.sVnr("Current week day did not match with Configured Week day");
2224
+ if (Apxor.getController().isTestDevice()) {
2225
+ validationToastDisplayandRemoval("Current week day did not match with Configured Week day for campaign name ".concat(_this.Ereh.name));
2226
+ }
2227
+ return false;
2228
+ }
2229
+ return false;
2230
+ });
2231
+ _defineProperty(this, "sVnr", function (reason) {
2232
+ var _this$Ereh$attr;
2233
+ Apxor === null || Apxor === void 0 || Apxor.logEvent("apx_non_eligible_user", {
2234
+ apx_nudge_type: _this.Ereh.type === "SURVEY" ? "survey" : "campaign",
2235
+ apx_nudge_id: _this.Hazg,
2236
+ apx_nudge_name: _this.Ereh.name,
2237
+ apx_variant_code: _this.Ereh.isExperiment || _this.Ereh.only_context ? (_this$Ereh$attr = _this.Ereh.attr) === null || _this$Ereh$attr === void 0 ? void 0 : _this$Ereh$attr[APX_VARIANT_CODE] : "TG",
2238
+ apx_failure_type: "warn",
2239
+ apx_reason: reason
2240
+ });
1433
2241
  });
1434
2242
  });
1435
2243
 
1436
2244
  var Binding = /*#__PURE__*/_createClass(function Binding() {
1437
2245
  var _this = this;
1438
2246
  _classCallCheck(this, Binding);
1439
- _defineProperty(this, "KdxM", "");
1440
- _defineProperty(this, "BOkL", "");
1441
- _defineProperty(this, "Trrq", "");
1442
- _defineProperty(this, "fqdK", "");
2247
+ _defineProperty(this, "gZtK", "");
2248
+ _defineProperty(this, "Jgmn", "");
2249
+ _defineProperty(this, "ZcgN", "");
2250
+ _defineProperty(this, "iVwK", "");
1443
2251
  _defineProperty(this, "parse", function () {
1444
2252
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1445
2253
  try {
1446
- _this.KdxM = config === null || config === void 0 ? void 0 : config.screen_binding;
1447
- if (!_this.KdxM) {
2254
+ _this.gZtK = config === null || config === void 0 ? void 0 : config.screen_binding;
2255
+ if (!_this.gZtK) {
1448
2256
  return true;
1449
2257
  } else {
1450
- _this.BOkL = config === null || config === void 0 ? void 0 : config.binding.url;
1451
- _this.Trrq = config === null || config === void 0 ? void 0 : config.binding["var"];
1452
- _this.fqdK = config === null || config === void 0 ? void 0 : config.binding.operator;
2258
+ _this.Jgmn = config === null || config === void 0 ? void 0 : config.binding.url;
2259
+ _this.ZcgN = config === null || config === void 0 ? void 0 : config.binding["var"];
2260
+ _this.iVwK = config === null || config === void 0 ? void 0 : config.binding.operator;
1453
2261
  return true;
1454
2262
  }
1455
2263
  } catch (error) {
@@ -1464,11 +2272,11 @@
1464
2272
  * operator :operator can be either "EQ" used for equality comparision or "SW" used for startswith comparision
1465
2273
  */
1466
2274
  _defineProperty(this, "validate", function () {
1467
- var url = _this.BOkL;
1468
- var variable = _this.Trrq;
1469
- var operator = _this.fqdK;
2275
+ var url = _this.Jgmn;
2276
+ var variable = _this.ZcgN;
2277
+ var operator = _this.iVwK;
1470
2278
  var currentUrl = window.location.href;
1471
- if (!_this.KdxM) {
2279
+ if (!_this.gZtK) {
1472
2280
  return true;
1473
2281
  } else {
1474
2282
  if (operator === "EQ") {
@@ -1506,52 +2314,81 @@
1506
2314
  });
1507
2315
  });
1508
2316
 
1509
- var Logger$9 = window.ApxorLogger;
2317
+ var Logger$a = window.ApxorLogger;
2318
+ var APP_EVENT = "APP_EVENT";
2319
+ var CLIENT_EVENT = "CLIENT_EVENT";
1510
2320
  var ConfigItem = /*#__PURE__*/_createClass(function ConfigItem() {
1511
2321
  var _this = this;
1512
2322
  _classCallCheck(this, ConfigItem);
1513
- _defineProperty(this, "TbxE", []);
1514
- _defineProperty(this, "oJYY", []);
1515
- _defineProperty(this, "tkvH", "");
1516
- _defineProperty(this, "FaOX", new Meta());
1517
- _defineProperty(this, "wdlK", new Audience());
1518
- _defineProperty(this, "kTyF", new Validity());
1519
- _defineProperty(this, "tsTs", new Frequency());
1520
- _defineProperty(this, "aNwp", new OverallConfig());
1521
- _defineProperty(this, "smLy", new TerminationInfo());
1522
- _defineProperty(this, "VfRX", new Binding());
1523
- _defineProperty(this, "RJwC", false);
1524
- _defineProperty(this, "eGzd", []);
2323
+ _defineProperty(this, "TXth", []);
2324
+ _defineProperty(this, "OAcN", []);
2325
+ _defineProperty(this, "Hazg", "");
2326
+ _defineProperty(this, "Ereh", new Meta());
2327
+ _defineProperty(this, "xtma", new Audience());
2328
+ _defineProperty(this, "Dqwg", new Validity());
2329
+ _defineProperty(this, "YVWL", new Frequency());
2330
+ _defineProperty(this, "GLor", new OverallConfig());
2331
+ _defineProperty(this, "FpDf", new TerminationInfo());
2332
+ _defineProperty(this, "PlQx", new Binding());
2333
+ _defineProperty(this, "Vnko", false);
2334
+ _defineProperty(this, "XfJZ", []);
1525
2335
  _defineProperty(this, "_variant_code", "");
2336
+ _defineProperty(this, "fAbO", false);
2337
+ _defineProperty(this, "groupCombineOperator", "OR");
2338
+ _defineProperty(this, "EVfa", false);
2339
+ _defineProperty(this, "IdSa", false);
2340
+ _defineProperty(this, "QKLq", void 0);
2341
+ _defineProperty(this, "timeForKPI", void 0);
2342
+ _defineProperty(this, "kpiIndex", 0);
2343
+ _defineProperty(this, "sVPQ", void 0);
2344
+ _defineProperty(this, "_across_sessions", false);
2345
+ _defineProperty(this, "Oxkj", void 0);
2346
+ _defineProperty(this, "znHr", false);
2347
+ _defineProperty(this, "gBkh", void 0);
2348
+ _defineProperty(this, "jclx", void 0);
2349
+ _defineProperty(this, "YeUq", void 0);
2350
+ _defineProperty(this, "Mjec", void 0);
2351
+ _defineProperty(this, "Qtoh", void 0);
2352
+ _defineProperty(this, "USib", void 0);
2353
+ _defineProperty(this, "OtEm", void 0);
2354
+ _defineProperty(this, "piHE", void 0);
2355
+ _defineProperty(this, "aGhL", void 0);
2356
+ _defineProperty(this, "lIwH", void 0);
1526
2357
  _defineProperty(this, "parse", function () {
1527
2358
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1528
2359
  try {
1529
- var _this$FaOX$_attr;
2360
+ var _this$Ereh$_attr;
1530
2361
  // If ID is not present, throw it out
1531
2362
  if (!isDefined(config._id)) {
1532
- Logger$9.error("No Id");
2363
+ Logger$a.error("No Id");
1533
2364
  return false;
1534
2365
  }
1535
2366
 
1536
2367
  // If config is disabled, throw it out
1537
2368
  if (!isDefined(config.enabled) || !config.enabled) {
1538
- Logger$9.error("Not enabled");
2369
+ Logger$a.error("Not enabled");
1539
2370
  return false;
1540
2371
  }
1541
2372
 
1542
2373
  // If META, VALIDITY, FREQUENCY and AUDIENCE is not parsed properly, throw it out
1543
- if (!(_this.FaOX.parse(config) && _this.kTyF.parse(config) && _this.tsTs.parse(config) && _this.wdlK.parse(config) && _this.aNwp.parse(config) && _this.smLy.parse(config) && _this.VfRX.parse(config))) {
2374
+ if (!(_this.Ereh.parse(config) && _this.Dqwg.parse(config) && _this.YVWL.parse(config) && _this.xtma.parse(config) && _this.GLor.parse(config) && _this.FpDf.parse(config) && _this.PlQx.parse(config))) {
1544
2375
  return false;
1545
2376
  }
1546
- _this._variant_code = _this.FaOX._isExperiment || _this.FaOX._only_context ? (_this$FaOX$_attr = _this.FaOX._attr) === null || _this$FaOX$_attr === void 0 ? void 0 : _this$FaOX$_attr[APX_VARIANT_CODE] : "TG";
2377
+ _this._variant_code = _this.Ereh._isExperiment || _this.Ereh._only_context ? (_this$Ereh$_attr = _this.Ereh._attr) === null || _this$Ereh$_attr === void 0 ? void 0 : _this$Ereh$_attr[APX_VARIANT_CODE] : "TG";
2378
+ _this._across_sessions = config !== null && config !== void 0 && config.across_sessions ? config === null || config === void 0 ? void 0 : config.across_sessions : false;
2379
+ _this.enable_conditions = config === null || config === void 0 ? void 0 : config.enable_conditions;
2380
+ _this.enable_conditions_v2 = config === null || config === void 0 ? void 0 : config.enable_conditions_v2;
1547
2381
  // If there are no conditions, throw it out
1548
2382
  if (!isDefined(config.conditions) || !Array.isArray(config.conditions)) {
1549
- Logger$9.error("No valid conditions", config.conditions);
2383
+ Logger$a.error("No valid conditions", config.conditions);
1550
2384
  return false;
1551
2385
  }
1552
- _this.tkvH = config._id;
1553
- _this.RJwC = isDefined(config.sequence_enabled) ? config.sequence_enabled : false;
1554
- if (_this.RJwC) {
2386
+ _this.Hazg = config._id;
2387
+ _this.Vnko = isDefined(config.sequence_enabled) ? config.sequence_enabled : false;
2388
+ if (isDefined(config.conditions_v2) && _this.enable_conditions_v2) {
2389
+ _this.Vnko = config === null || config === void 0 ? void 0 : config.sequence_type;
2390
+ }
2391
+ if (_this.Vnko === true) {
1555
2392
  // iff respectSequence is true, Sort the Conditions by their sequence order
1556
2393
  // We need to sort, if server sends them in orderless manner
1557
2394
  config.conditions.sort(function (prev, current) {
@@ -1560,44 +2397,76 @@
1560
2397
  }
1561
2398
 
1562
2399
  // Parse all conditions now
1563
- var conditions = config.conditions;
2400
+ var conditions;
2401
+ if (isDefined(config.conditions_v2) && _this.enable_conditions_v2) {
2402
+ conditions = config.conditions_v2;
2403
+ _this.znHr = true;
2404
+ } else {
2405
+ conditions = config.conditions;
2406
+ }
2407
+ _this.Oxkj = conditions;
1564
2408
  var length = conditions.length;
1565
2409
  var no_context_enabled = config === null || config === void 0 ? void 0 : config.no_context_enabled;
1566
2410
  if (length === 0 && no_context_enabled) {
1567
2411
  setTimeout(function () {
1568
- _this.VHRs();
2412
+ _this.LjPk();
1569
2413
  }, 10);
1570
2414
  }
1571
- var _loop = function _loop() {
1572
- _this.eGzd = [];
1573
- var condition = conditions[index];
2415
+ _this.lIwH = length;
2416
+ _this.svJa(conditions, length);
2417
+ _this.RLRD();
2418
+ if (_this.FpDf.enable_goal_events) {
2419
+ var goal_events = config.terminate_info.goal_events.events;
2420
+ var goaleventslength = goal_events.length;
2421
+ for (var i = 0; i < goaleventslength; i++) {
2422
+ var conditionValidator = new ConditionValidator();
2423
+ if (conditionValidator.initialize(goal_events[i], _this.Hazg, i, true, [], _this._across_sessions, "termination")) {
2424
+ _this.OAcN.push(conditionValidator);
2425
+ }
2426
+ }
2427
+ }
2428
+ return _this.TXth.length > 0;
2429
+ } catch (error) {
2430
+ Logger$a.error(error);
2431
+ return false;
2432
+ }
2433
+ });
2434
+ _defineProperty(this, "svJa", function (conditions, length) {
2435
+ var _loop = function _loop() {
2436
+ _this.XfJZ = [];
2437
+ var condition = conditions[index];
2438
+ var condition_type = condition !== null && condition !== void 0 && condition.condition_type ? condition === null || condition === void 0 ? void 0 : condition.condition_type : "single";
2439
+ if (condition_type === "group") {
2440
+ // Recursively handle nested group conditions
2441
+ var conditions_v2 = condition.conditions_v2;
2442
+ _this.groupCombineOperator = condition.combine_operator;
2443
+ var groupRespectSequence = condition === null || condition === void 0 ? void 0 : condition.sequence_type;
2444
+ _this.aGhL = new GroupConditionValidator();
2445
+ var groupValidator = _this.aGhL.initialize(conditions_v2, _this.Hazg, index, groupRespectSequence, _this.XfJZ, _this.Vnko, _this._across_sessions);
2446
+ _this.TXth.push(groupValidator);
2447
+ //this.svJa(condition.conditions_v2, length_child_conditions);
2448
+ } else {
1574
2449
  if (condition.type === "didn't") {
1575
- var HBDN$details;
2450
+ var Siqm$details;
1576
2451
  var obj = {
1577
2452
  trigger_key: condition.trigger.details.name,
1578
- no_kpi_array: condition === null || condition === void 0 || (HBDN$details = condition.details) === null || HBDN$details === void 0 || (HBDN$details = HBDN$details.additional_info) === null || HBDN$details === void 0 ? void 0 : HBDN$details.nkpi,
2453
+ no_kpi_array: condition === null || condition === void 0 || (Siqm$details = condition.details) === null || Siqm$details === void 0 || (Siqm$details = Siqm$details.additional_info) === null || Siqm$details === void 0 ? void 0 : Siqm$details.nkpi,
1579
2454
  condition_id: condition === null || condition === void 0 ? void 0 : condition._id,
1580
2455
  time_bounds: condition.time_bounds.upper
1581
2456
  };
1582
- _this.eGzd = [].concat(_toConsumableArray(_this.eGzd), [obj]);
1583
- //this will be the key
1584
- //when event occur check this array and then then check the time
1585
- //check the time diffrence
1586
- //to delete the condion from the nkpi array if the time limit exceeded
1587
- //create an array of objects y=using all these;
2457
+ _this.XfJZ = [].concat(_toConsumableArray(_this.XfJZ), [obj]);
1588
2458
  }
1589
-
1590
- var conditionValidator = new ConditionValidator();
1591
- if (conditionValidator.initialize(condition, _this.tkvH, index, _this.RJwC, _this.eGzd)) {
1592
- _this.TbxE.push(conditionValidator);
2459
+ _this.aGhL = new ConditionValidator();
2460
+ if (_this.aGhL.initialize(condition, _this.Hazg, index, _this.Vnko, _this.XfJZ, _this._across_sessions)) {
2461
+ _this.TXth.push(_this.aGhL);
1593
2462
  var max_retries = (condition === null || condition === void 0 ? void 0 : condition.timeout) / (condition === null || condition === void 0 ? void 0 : condition.findinterval);
1594
2463
  var frame_id = (condition === null || condition === void 0 ? void 0 : condition.frameid) || "";
1595
2464
  var url = condition === null || condition === void 0 ? void 0 : condition.url;
1596
2465
  if (window.location.href === url) {
1597
2466
  if (condition.event_type === "view_visibility") {
1598
2467
  if (_findTargetElement(condition.view_id, frame_id, condition === null || condition === void 0 ? void 0 : condition.enable_retry, condition === null || condition === void 0 ? void 0 : condition.findinterval, max_retries) === true) {
1599
- //this.IyAK();
1600
- _this.VHRs(true);
2468
+ //this.rxvk();
2469
+ _this.LjPk(true);
1601
2470
  }
1602
2471
  }
1603
2472
  }
@@ -1607,125 +2476,796 @@
1607
2476
  if (window.location.href === url) {
1608
2477
  if (condition.event_type === "view_visibility") {
1609
2478
  if (_findTargetElement(condition.view_id, frame_id, condition === null || condition === void 0 ? void 0 : condition.enable_retry, condition === null || condition === void 0 ? void 0 : condition.findinterval, max_retries) === true) {
1610
- //this.IyAK();
1611
- _this.VHRs(true);
2479
+ //this.rxvk();
2480
+ _this.LjPk(true);
1612
2481
  }
1613
2482
  }
1614
2483
  }
1615
2484
  });
1616
2485
  }
1617
- };
1618
- for (var index = 0; index < length; index++) {
1619
- _loop();
1620
2486
  }
1621
- if (_this.smLy.enable_goal_events) {
1622
- var goal_events = config.terminate_info.goal_events.events;
1623
- var goaleventslength = goal_events.length;
1624
- for (var i = 0; i < goaleventslength; i++) {
1625
- var conditionValidator = new ConditionValidator();
1626
- if (conditionValidator.initialize(goal_events[i], _this.tkvH, i, true, [], "termination")) {
1627
- _this.oJYY.push(conditionValidator);
2487
+ };
2488
+ for (var index = 0; index < length; index++) {
2489
+ _loop();
2490
+ }
2491
+ });
2492
+ _defineProperty(this, "RLRD", function () {
2493
+ if (_this._across_sessions && _this.Vnko === "ordered") {
2494
+ var satisfied = false;
2495
+ var no_KPI_TriggerDetails = Apxor.getController().getFromStorage("apx_nokpi_triggerdetails");
2496
+ no_KPI_TriggerDetails = JSON.parse(no_KPI_TriggerDetails);
2497
+ if (no_KPI_TriggerDetails != null && no_KPI_TriggerDetails != undefined) {
2498
+ var _loop2 = function _loop2(i) {
2499
+ var _this$_conditionValid, _this$_conditionValid2, _this$_conditionValid3;
2500
+ if ((_this$_conditionValid = _this.TXth[i]) !== null && _this$_conditionValid !== void 0 && (_this$_conditionValid = _this$_conditionValid.Siqm) !== null && _this$_conditionValid !== void 0 && _this$_conditionValid._timeEnabled && _this.TXth[i].length === undefined) {
2501
+ if (_this.TXth[i].Siqm.cTiq === "didn't") {
2502
+ var conditionValidatorId = _this.TXth[i].Siqm._id;
2503
+ var matchingObject = _this.PrdI(conditionValidatorId, no_KPI_TriggerDetails);
2504
+ if (matchingObject) {
2505
+ if (Date.now() > matchingObject.finishTime) {
2506
+ _this.TXth[i].HxYU = true;
2507
+ _this.TXth[i].jHBh = matchingObject.satisfiedCount;
2508
+ satisfied = true;
2509
+ } else {
2510
+ var timeleft = matchingObject.finishTime - Date.now();
2511
+ var eventCategory = _this.TXth[i].Siqm._eventCategory ? _this.TXth[i].Siqm._eventCategory : "specific_event";
2512
+ var ceInstance = new CE();
2513
+ if (eventCategory === "specific_event") {
2514
+ ceInstance.registerForEvent(generateKey(_this.TXth[i].Siqm.ApYz) + "___" + _this.TXth[i].Siqm.XbMU.DUbs, _this.spmy);
2515
+ _this.Qtoh = _this.TXth[i];
2516
+ } else {
2517
+ _this.pSsI(eventCategory);
2518
+ }
2519
+ setTimeout(function () {
2520
+ if (i === _this.TXth.length - 1 && !_this.EVfa) {
2521
+ _this.TXth[i].HxYU = true;
2522
+ _this.TXth[i].jHBh = matchingObject.satisfiedCount;
2523
+ satisfied = true;
2524
+ if (eventCategory === "specific_event") {
2525
+ ceInstance.unregisterFromEvent(generateKey(_this.TXth[i].Siqm.ApYz) + "___" + _this.TXth[i].Siqm.XbMU.DUbs, _this.spmy);
2526
+ } else {
2527
+ _this.czAw(_this.TXth[i]);
2528
+ }
2529
+ _this.LjPk();
2530
+ }
2531
+ }, timeleft);
2532
+ }
2533
+ }
2534
+ }
2535
+ if (_this.TXth[i].Siqm.cTiq === "did") {
2536
+ var _conditionValidatorId = _this.TXth[i].Siqm._id;
2537
+ var _matchingObject = _this.PrdI(_conditionValidatorId, no_KPI_TriggerDetails);
2538
+ if (_matchingObject) {
2539
+ if (_matchingObject.satisfiedCount == null) {
2540
+ if (Date.now() < _matchingObject.finishTime) {
2541
+ _this.YeUq = _matchingObject;
2542
+ _this.jclx = i;
2543
+ var _timeleft = _matchingObject.finishTime - Date.now();
2544
+ var _eventCategory = _this.TXth[i].Siqm._eventCategory ? _this.TXth[i].Siqm._eventCategory : "specific_event";
2545
+ var _ceInstance = new CE();
2546
+ if (_eventCategory === "specific_event") {
2547
+ _ceInstance.registerForEvent(generateKey(_this.TXth[i].Siqm.ApYz) + "___" + _this.TXth[i].Siqm.XbMU.DUbs, _this.XiMu);
2548
+ } else {
2549
+ _this.pSsI(_eventCategory);
2550
+ }
2551
+ setTimeout(function () {
2552
+ if (_eventCategory === "specific_event") {
2553
+ _ceInstance.unregisterFromEvent(generateKey(_this.TXth[i].Siqm.ApYz) + "___" + _this.TXth[i].Siqm.XbMU.DUbs, _this.XiMu);
2554
+ } else {
2555
+ _this.czAw(_this.TXth[i]);
2556
+ }
2557
+ }, _timeleft);
2558
+ }
2559
+ } else {
2560
+ _this.TXth[i].jHBh = _matchingObject.satisfiedCount;
2561
+ _this.TXth[i].HxYU = true;
2562
+ }
2563
+ }
2564
+ }
2565
+ } else {
2566
+ satisfied = _this.vbaL(i, no_KPI_TriggerDetails);
2567
+ }
2568
+ if (satisfied && (!((_this$_conditionValid2 = _this.TXth[i]) !== null && _this$_conditionValid2 !== void 0 && (_this$_conditionValid2 = _this$_conditionValid2.Siqm) !== null && _this$_conditionValid2 !== void 0 && _this$_conditionValid2._timeEnabled) || ((_this$_conditionValid3 = _this.TXth[i]) === null || _this$_conditionValid3 === void 0 ? void 0 : _this$_conditionValid3.length) > 1)) {
2569
+ if (i === _this.TXth.length - 1) {
2570
+ _this.LjPk();
2571
+ }
2572
+ } else if (!satisfied) {
2573
+ if (!_this.TXth[i].length === undefined) _this.TXth[i].rxvk();
1628
2574
  }
2575
+ };
2576
+ for (var i = 0; i < _this.TXth.length; i++) {
2577
+ _loop2(i);
1629
2578
  }
1630
2579
  }
1631
- return _this.TbxE.length > 0;
1632
- } catch (error) {
1633
- Logger$9.error(error);
1634
- return false;
2580
+ } else if (_this._across_sessions && _this.Vnko === "unordered") {
2581
+ var _no_KPI_TriggerDetails = Apxor.getController().getFromStorage("apx_nokpi_triggerdetails");
2582
+ _no_KPI_TriggerDetails = JSON.parse(_no_KPI_TriggerDetails);
2583
+ if (_no_KPI_TriggerDetails != null && _no_KPI_TriggerDetails != undefined) {
2584
+ for (var _i = 0; _i < _this.TXth.length; _i++) {
2585
+ _this.vbaL(_i, _no_KPI_TriggerDetails);
2586
+ }
2587
+ }
2588
+ }
2589
+ });
2590
+ _defineProperty(this, "vbaL", function (index, no_KPI_TriggerDetails) {
2591
+ if (_this.TXth[index].length === undefined || _this.TXth[index].length === 1) {
2592
+ var conditionValidatorId = _this.TXth[index].Siqm._id;
2593
+ var satisfied = false;
2594
+ var matchingObject = _this.PrdI(conditionValidatorId, no_KPI_TriggerDetails);
2595
+ if (matchingObject) {
2596
+ _this.gBkh = matchingObject;
2597
+ var validator = new ConditionValidator();
2598
+ satisfied = validator.yHAo(matchingObject.satisfiedCount, _this.TXth[index].Siqm.pbmh, _this.TXth[index].Siqm.kbAA);
2599
+ if (matchingObject) {
2600
+ if (satisfied) {
2601
+ _this.TXth[index].HxYU = true;
2602
+ } else {
2603
+ _this.TXth[index].jHBh = matchingObject.satisfiedCount;
2604
+ }
2605
+ }
2606
+ } else {
2607
+ _this.TXth[index].rxvk();
2608
+ }
2609
+ return satisfied;
2610
+ } else if (_this.TXth[index].length >= 1) {
2611
+ var _this$_conditionValid4;
2612
+ var groupRespectSequence = "unordered";
2613
+ groupRespectSequence = (_this$_conditionValid4 = _this.TXth[index]) === null || _this$_conditionValid4 === void 0 ? void 0 : _this$_conditionValid4.sequence_type;
2614
+ var individualConditionSatisfied;
2615
+ if (groupRespectSequence === "ordered" || groupRespectSequence === "strictly_ordered") {
2616
+ for (var i = 0; i < _this.TXth[index].length; i++) {
2617
+ var individualCondition = _this.TXth[index][i];
2618
+ var singleConditionValidatorId = individualCondition.Siqm._id;
2619
+ individualConditionSatisfied = false;
2620
+ var _matchingObject2 = _this.PrdI(singleConditionValidatorId, no_KPI_TriggerDetails);
2621
+ if (_matchingObject2) {
2622
+ var _validator = new ConditionValidator();
2623
+ individualConditionSatisfied = _validator.yHAo(_matchingObject2.satisfiedCount, individualCondition.Siqm.pbmh, individualCondition.Siqm.kbAA);
2624
+ if (_matchingObject2) {
2625
+ if (individualConditionSatisfied) {
2626
+ _this.TXth[index][i].HxYU = true;
2627
+ var childIndex = i + 1;
2628
+ var upcomingValidator = _this.TXth[index][i + 1];
2629
+ if (upcomingValidator === undefined && isDefined(_this.TXth[index + 1])) {
2630
+ _this.TXth[index + 1].rxvk();
2631
+ individualConditionSatisfied = true;
2632
+ }
2633
+ if (upcomingValidator != undefined) {
2634
+ _this.TXth[index][i + 1].rxvk(childIndex);
2635
+ }
2636
+ } else {
2637
+ _this.TXth[index][i].jHBh = _matchingObject2.satisfiedCount;
2638
+ }
2639
+ }
2640
+ } else {
2641
+ if (isDefined(_this.TXth[index][i - 1]) && _this.TXth[index][i].HxYU === true) {
2642
+ _this.TXth[index][i].rxvk();
2643
+ } else if (isUndefined(_this.TXth[index][i - 1])) {
2644
+ _this.TXth[index][i].rxvk();
2645
+ }
2646
+ }
2647
+ }
2648
+ return individualConditionSatisfied;
2649
+ } else {
2650
+ var conditionSatisfiedChecker;
2651
+ for (var _i2 = 0; _i2 < _this.TXth[index].length; _i2++) {
2652
+ var individualCombineOperator = _this.TXth[index][0].Siqm.VnOY;
2653
+ if (individualCombineOperator === "OR") {
2654
+ conditionSatisfiedChecker = false;
2655
+ } else {
2656
+ conditionSatisfiedChecker = true;
2657
+ }
2658
+ var _individualCondition = _this.TXth[index][_i2];
2659
+ var _singleConditionValidatorId = _individualCondition.Siqm._id;
2660
+ individualConditionSatisfied = false;
2661
+ var _matchingObject3 = _this.PrdI(_singleConditionValidatorId, no_KPI_TriggerDetails);
2662
+ if (_matchingObject3) {
2663
+ var _validator2 = new ConditionValidator();
2664
+ individualConditionSatisfied = _validator2.yHAo(_matchingObject3.satisfiedCount, _individualCondition.Siqm.pbmh, _individualCondition.Siqm.kbAA);
2665
+ if (_matchingObject3) {
2666
+ if (individualConditionSatisfied) {
2667
+ _this.TXth[index][_i2].HxYU = true;
2668
+ } else {
2669
+ _this.TXth[index][_i2].jHBh = _matchingObject3.satisfiedCount;
2670
+ }
2671
+ }
2672
+ } else {
2673
+ _individualCondition.rxvk();
2674
+ }
2675
+ if (individualCombineOperator === "AND") {
2676
+ conditionSatisfiedChecker = conditionSatisfiedChecker && individualConditionSatisfied;
2677
+ } else {
2678
+ conditionSatisfiedChecker = conditionSatisfiedChecker || individualConditionSatisfied;
2679
+ }
2680
+ }
2681
+ return conditionSatisfiedChecker;
2682
+ }
1635
2683
  }
1636
2684
  });
1637
- _defineProperty(this, "WTJq", function (index) {
2685
+ _defineProperty(this, "PrdI", function (id, list) {
2686
+ return list.find(function (obj) {
2687
+ return obj.id === id;
2688
+ });
2689
+ });
2690
+ _defineProperty(this, "IDxi", function (index) {
2691
+ var childIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
2692
+ var ceInstance = CE.getInstance();
1638
2693
  if (index < 0) {
1639
2694
  return;
1640
2695
  }
1641
- if (_this.RJwC) {
1642
- var conditionValidator = _this.TbxE[index];
1643
- if (isDefined(conditionValidator) && conditionValidator.KUlF) {
1644
- // Check if previous validator is satisfied
1645
- var prevValidator = _this.TbxE[index - 1];
1646
- if (isDefined(prevValidator) && !prevValidator.KUlF) {
1647
- // TODO: If current index is satisfied before previous one, do something
1648
- // either unregister all conditions or remove this item from ConfigLookup
1649
- return;
2696
+ var currentValidator = _this.TXth[index];
2697
+ var groupRespectSequence = "unordered";
2698
+ if ((currentValidator === null || currentValidator === void 0 ? void 0 : currentValidator.length) > 1) {
2699
+ groupRespectSequence = currentValidator === null || currentValidator === void 0 ? void 0 : currentValidator.sequence_type;
2700
+ }
2701
+ if (_this.Vnko === true || _this.Vnko === "ordered" || _this.Vnko === "strictly_ordered" || groupRespectSequence === "ordered" || groupRespectSequence === "strictly_ordered") {
2702
+ _this.kpiIndex = index + 1;
2703
+ var conditionValidator = _this.TXth[index];
2704
+ if ((conditionValidator === null || conditionValidator === void 0 ? void 0 : conditionValidator.length) > 0) {
2705
+ if (isDefined(conditionValidator)) {
2706
+ if (_this.Vnko === "unordered" && groupRespectSequence === "ordered") {
2707
+ var prevValidator = currentValidator[childIndex - 1];
2708
+ if (isDefined(prevValidator)) {
2709
+ if (prevValidator.length === undefined || prevValidator.length == 1) {
2710
+ if (!prevValidator.HxYU) {
2711
+ return;
2712
+ }
2713
+ } else if (prevValidator.length > 1) {
2714
+ if (!_this.pDnJ(prevValidator)) {
2715
+ return;
2716
+ }
2717
+ }
2718
+ }
2719
+ var nextValidator = currentValidator[childIndex + 1];
2720
+ if (!isDefined(nextValidator)) {
2721
+ if (groupRespectSequence === "strictly_ordered") {
2722
+ if (_this.fAbO != true) {
2723
+ _this.LjPk();
2724
+ }
2725
+ } else {
2726
+ var _currentValidator$chi;
2727
+ if (((_currentValidator$chi = currentValidator[childIndex]) === null || _currentValidator$chi === void 0 ? void 0 : _currentValidator$chi.length) > 0) {
2728
+ if (_this.pDnJ(currentValidator)) {
2729
+ _this.LjPk();
2730
+ }
2731
+ } else {
2732
+ _this.LjPk();
2733
+ }
2734
+ }
2735
+ } else {
2736
+ nextValidator.rxvk(childIndex + 1);
2737
+ if (_this.Vnko === "strictly_ordered") {
2738
+ _this._currentEventname = conditionValidator[childIndex].Siqm.XbMU.DUbs;
2739
+ var controller = Apxor.getController();
2740
+ controller.registerForEvent(APP_EVENT, _this.NaLQ);
2741
+ controller.registerForEvent(CLIENT_EVENT, _this.NaLQ);
2742
+ }
2743
+ }
2744
+ } else {
2745
+ var _prevValidator = _this.TXth[index - 1];
2746
+ // if (isDefined(prevValidator) && !prevValidator.HxYU) {
2747
+ // return;
2748
+ // }
2749
+ if (isDefined(_prevValidator)) {
2750
+ if (_prevValidator.length === undefined || _prevValidator.length == 1) {
2751
+ if (!_prevValidator.HxYU) {
2752
+ return;
2753
+ }
2754
+ } else if (_prevValidator.length > 1) {
2755
+ if (!_this.pDnJ(_prevValidator)) {
2756
+ return;
2757
+ }
2758
+ }
2759
+ }
2760
+ var sVPQ;
2761
+ if (conditionValidator.length === undefined || conditionValidator.length === 1) {
2762
+ sVPQ = _this.TXth[index + 1];
2763
+ } else if (conditionValidator.length > 1) {
2764
+ if (groupRespectSequence === "ordered" || groupRespectSequence === "strictly_ordered") {
2765
+ if (childIndex === conditionValidator.length - 1) {
2766
+ sVPQ = _this.TXth[index + 1];
2767
+ } else {
2768
+ sVPQ = _this.TXth[index][childIndex + 1];
2769
+ }
2770
+ } else {
2771
+ if (_this.pDnJ(conditionValidator)) {
2772
+ sVPQ = _this.TXth[index + 1];
2773
+ }
2774
+ }
2775
+ }
2776
+ if (!isDefined(sVPQ)) {
2777
+ if (_this.Vnko === "strictly_ordered") {
2778
+ if (_this.fAbO != true) {
2779
+ _this.LjPk();
2780
+ }
2781
+ } else {
2782
+ if (_this.pDnJ(conditionValidator)) {
2783
+ _this.LjPk();
2784
+ }
2785
+ }
2786
+ } else {
2787
+ if (sVPQ.length === undefined || sVPQ.length === 1) {
2788
+ sVPQ.rxvk(childIndex + 1);
2789
+ } else {
2790
+ if (_this.pDnJ(conditionValidator)) {
2791
+ if (sVPQ.length === undefined) {
2792
+ sVPQ.rxvk();
2793
+ } else if (sVPQ.length > 1) {
2794
+ if (sVPQ.sequence_type === "unordered") {
2795
+ for (var i = 0; i < sVPQ.length; i++) {
2796
+ sVPQ[i].rxvk(i);
2797
+ }
2798
+ } else if (sVPQ.sequence_type === "ordered" || sVPQ.sequence_type === "strictly_ordered") {
2799
+ sVPQ[0].rxvk(0);
2800
+ }
2801
+ }
2802
+ }
2803
+ }
2804
+ if (_this.Vnko === "strictly_ordered") {
2805
+ _this._currentEventname = conditionValidator[childIndex].Siqm.XbMU.DUbs;
2806
+ var BRup = Apxor.getController();
2807
+ BRup.registerForEvent(APP_EVENT, _this.NaLQ);
2808
+ BRup.registerForEvent(CLIENT_EVENT, _this.NaLQ);
2809
+ }
2810
+ }
2811
+ }
1650
2812
  }
1651
- var nextValidator = _this.TbxE[index + 1];
1652
- if (!isDefined(nextValidator)) {
1653
- // It means this is the last condition
1654
- // Validate all conditions
1655
- _this.VHRs();
1656
- } else {
1657
- nextValidator.IyAK();
2813
+ } else {
2814
+ if (isDefined(conditionValidator) && conditionValidator.HxYU) {
2815
+ conditionValidator.KhPZ[conditionValidator.Siqm.XbMU.DUbs] = Date.now();
2816
+ // Check if previous validator is satisfied
2817
+ var _prevValidator2 = _this.TXth[index - 1];
2818
+ // if (isDefined(prevValidator) && !prevValidator.HxYU) {
2819
+ // // TODO: If current index is satisfied before previous one, do something
2820
+ // // either unregister all conditions or remove this item from ConfigLookup
2821
+ // return;
2822
+ // }
2823
+
2824
+ if (isDefined(_prevValidator2)) {
2825
+ if (_prevValidator2.length === undefined || _prevValidator2.length == 1) {
2826
+ if (!_prevValidator2.HxYU) {
2827
+ return;
2828
+ }
2829
+ } else if (_prevValidator2.length > 1) {
2830
+ if (!_this.pDnJ(_prevValidator2)) {
2831
+ return;
2832
+ }
2833
+ }
2834
+ }
2835
+ var _nextValidator2 = _this.TXth[index + 1];
2836
+ if (!isDefined(_nextValidator2)) {
2837
+ // It means this is the last condition
2838
+ // Validate all conditions
2839
+ if (_this.Vnko === "strictly_ordered") {
2840
+ if (_this.fAbO != true) {
2841
+ _this.LjPk();
2842
+ }
2843
+ } else {
2844
+ _this.LjPk();
2845
+ }
2846
+ } else {
2847
+ var _nextValidator2$_cond;
2848
+ if (_nextValidator2 !== null && _nextValidator2 !== void 0 && (_nextValidator2$_cond = _nextValidator2.Siqm) !== null && _nextValidator2$_cond !== void 0 && _nextValidator2$_cond._timeEnabled) {
2849
+ var _nextValidator2$_cond2;
2850
+ if (((_nextValidator2$_cond2 = _nextValidator2.Siqm) === null || _nextValidator2$_cond2 === void 0 ? void 0 : _nextValidator2$_cond2._time.unit) != "session") {
2851
+ var _nextValidator2$_cond3, _nextValidator2$_cond4;
2852
+ var timeInMillisec = calculateTime(_nextValidator2.Siqm._time.unit, _nextValidator2.Siqm._time.value);
2853
+ if (((_nextValidator2$_cond3 = _nextValidator2.Siqm) === null || _nextValidator2$_cond3 === void 0 ? void 0 : _nextValidator2$_cond3.cTiq) == "didn't") {
2854
+ _this.OtEm = setTimeout(function () {
2855
+ if (!_this.EVfa) {
2856
+ _this.EVfa = false;
2857
+ _nextValidator2.HxYU = true;
2858
+ if (_nextValidator2.HxYU) {
2859
+ _nextValidator2.jHBh += 1;
2860
+ var _conditionValidator = new ConditionValidator();
2861
+ _nextValidator2.HxYU = _conditionValidator.yHAo(_nextValidator2.jHBh, _nextValidator2.Siqm.pbmh, _nextValidator2.Siqm.kbAA);
2862
+ if (_nextValidator2.HxYU) {
2863
+ _nextValidator2.Siqm.Bnen = Date.now();
2864
+ var nextIndex = index + 1;
2865
+ var upcomingValidator = _this.TXth[nextIndex + 1];
2866
+ if (!isDefined(upcomingValidator)) {
2867
+ // this.EVfa = false;
2868
+ _this.LjPk();
2869
+ } else {
2870
+ upcomingValidator.rxvk();
2871
+ }
2872
+ // ceInstance.validate(this.Hazg, index);
2873
+ }
2874
+ }
2875
+
2876
+ ceInstance.unregisterFromEvent(generateKey(_nextValidator2.Siqm.ApYz) + "___" + _nextValidator2.Siqm.XbMU.DUbs, _this.spmy);
2877
+ _nextValidator2.Lqob = false;
2878
+ } else {
2879
+ _this.EVfa = false;
2880
+ }
2881
+ }, timeInMillisec);
2882
+ if (_this._across_sessions) {
2883
+ var _timeInMillisec = calculateTime(_nextValidator2.Siqm._time.unit, _nextValidator2.Siqm._time.value);
2884
+ var timeEnabled = _nextValidator2.Siqm._timeEnabled;
2885
+ var condition_id = _nextValidator2.Siqm._id;
2886
+ var cv = new ConditionValidator();
2887
+ cv.kdvQ(_nextValidator2.Siqm.cTiq, _nextValidator2.Siqm.XbMU.DUbs, Date.now(), _nextValidator2.Siqm.XbMU.wLHD, _timeInMillisec, timeEnabled, condition_id);
2888
+ }
2889
+ if (_nextValidator2.Siqm._eventCategory === "specific_event") {
2890
+ ceInstance.registerForEvent(generateKey(_nextValidator2.Siqm.ApYz) + "___" + _nextValidator2.Siqm.XbMU.DUbs, _this.spmy);
2891
+ _this.Qtoh = _nextValidator2;
2892
+ } else {
2893
+ _this.pSsI(_nextValidator2);
2894
+ }
2895
+ } else if (((_nextValidator2$_cond4 = _nextValidator2.Siqm) === null || _nextValidator2$_cond4 === void 0 ? void 0 : _nextValidator2$_cond4.cTiq) == "did") {
2896
+ _this.EVfa = false;
2897
+ _this.sVPQ = _nextValidator2;
2898
+ if (isDefined(_this.TXth[index + 2]) && _this._across_sessions) {
2899
+ _this.Mjec = _this.TXth[index + 2];
2900
+ }
2901
+ _this.piHE = setTimeout(function () {
2902
+ if (!_this.EVfa) {
2903
+ _this.EVfa = false;
2904
+ ceInstance.unregisterFromEvent(generateKey(_nextValidator2.Siqm.ApYz) + "___" + _nextValidator2.Siqm.XbMU.DUbs, _this.WhKN);
2905
+ } else {
2906
+ _this.EVfa = false;
2907
+ }
2908
+ }, timeInMillisec);
2909
+ _this.QKLq = conditionValidator;
2910
+ _this.timeForKPI = timeInMillisec;
2911
+ ceInstance.registerForEvent(generateKey(_nextValidator2.Siqm.ApYz) + "___" + _nextValidator2.Siqm.XbMU.DUbs, _this.WhKN);
2912
+ _this.USib = _nextValidator2;
2913
+ if (_this._across_sessions) {
2914
+ var _timeInMillisec2 = calculateTime(_nextValidator2.Siqm._time.unit, _nextValidator2.Siqm._time.value);
2915
+ var _timeEnabled = _nextValidator2.Siqm._timeEnabled;
2916
+ var _condition_id = _nextValidator2.Siqm._id;
2917
+ var _cv = new ConditionValidator();
2918
+ _cv.kdvQ(_nextValidator2.Siqm.cTiq, _nextValidator2.Siqm.XbMU.DUbs, Date.now(), _nextValidator2.Siqm.XbMU.wLHD, _timeInMillisec2, _timeEnabled, _condition_id);
2919
+ }
2920
+ }
2921
+ }
2922
+ } else {
2923
+ if (_nextValidator2.length > 0) {
2924
+ if (_nextValidator2.sequence_type === "ordered" || _nextValidator2.sequence_type === "strictly_ordered") {
2925
+ _nextValidator2[0].rxvk(childIndex + 1);
2926
+ } else {
2927
+ var _iterator = _createForOfIteratorHelper(_nextValidator2),
2928
+ _step;
2929
+ try {
2930
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2931
+ var validator = _step.value;
2932
+ validator.rxvk();
2933
+ }
2934
+ } catch (err) {
2935
+ _iterator.e(err);
2936
+ } finally {
2937
+ _iterator.f();
2938
+ }
2939
+ }
2940
+ } else {
2941
+ _nextValidator2.rxvk();
2942
+ }
2943
+ }
2944
+ if (_this.Vnko === "strictly_ordered") {
2945
+ _this._currentEventname = conditionValidator.Siqm.XbMU.DUbs;
2946
+ var _controller2 = Apxor.getController();
2947
+ _controller2.registerForEvent(APP_EVENT, _this.NaLQ);
2948
+ _controller2.registerForEvent(CLIENT_EVENT, _this.NaLQ);
2949
+ }
2950
+ }
1658
2951
  }
1659
2952
  }
1660
2953
  } else {
1661
2954
  // Validate all conditions
1662
- _this.VHRs();
2955
+ _this.ghfw();
2956
+ _this.LjPk();
2957
+ }
2958
+ });
2959
+ _defineProperty(this, "NaLQ", function (event) {
2960
+ if (event && event.name != _this._currentEventname) {
2961
+ _this.fAbO = true;
2962
+ return;
2963
+ }
2964
+ });
2965
+ _defineProperty(this, "pSsI", function (validator) {
2966
+ var ceInstance = new CE();
2967
+ var eventCategory = validator.Siqm._eventCategory;
2968
+ if (eventCategory === "apxor_event") {
2969
+ ceInstance.registerForEvent("apxor_event", _this.spmy);
2970
+ } else if (eventCategory === "customer_event") {
2971
+ ceInstance.registerForEvent("customer_event", _this.spmy);
2972
+ } else if (eventCategory === "any_event") {
2973
+ ceInstance.registerForEvent("any_event", _this.spmy);
2974
+ } else if (eventCategory === "campaign_event") {
2975
+ ceInstance.registerForEvent("campaign_event", _this.spmy);
2976
+ } else if (eventCategory === "survey_event") {
2977
+ ceInstance.registerForEvent("survey_event", _this.spmy);
2978
+ }
2979
+ });
2980
+ _defineProperty(this, "czAw", function (validator) {
2981
+ var ceInstance = new CE();
2982
+ var eventCategory = validator.Siqm._eventCategory;
2983
+ if (eventCategory === "apxor_event") {
2984
+ ceInstance.unregisterFromEvent("apxor_event", _this.spmy);
2985
+ } else if (eventCategory === "customer_event") {
2986
+ ceInstance.unregisterFromEvent("customer_event", _this.spmy);
2987
+ } else if (eventCategory === "any_event") {
2988
+ ceInstance.unregisterFromEvent("any_event", _this.spmy);
2989
+ } else if (eventCategory === "campaign_event") {
2990
+ ceInstance.unregisterFromEvent("campaign_event", _this.spmy);
2991
+ } else if (eventCategory === "survey_event") {
2992
+ ceInstance.unregisterFromEvent("survey_event", _this.spmy);
2993
+ }
2994
+ });
2995
+ _defineProperty(this, "spmy", function () {
2996
+ var _this$_unregisterVali, _this$_unregisterVali2;
2997
+ if (_this.OtEm) {
2998
+ _this.EVfa = false;
2999
+ clearTimeout(_this.OtEm);
3000
+ }
3001
+ var ceInstance = new CE();
3002
+ _this.EVfa = true;
3003
+ if (_this._across_sessions) {
3004
+ if (localStorage.getItem("apx_nokpi_triggerdetails") !== null) {
3005
+ localStorage.removeItem("apx_nokpi_triggerdetails");
3006
+ }
3007
+ }
3008
+ ceInstance.unregisterFromEvent(generateKey((_this$_unregisterVali = _this.Qtoh) === null || _this$_unregisterVali === void 0 || (_this$_unregisterVali = _this$_unregisterVali.Siqm) === null || _this$_unregisterVali === void 0 ? void 0 : _this$_unregisterVali.ApYz) + "___" + ((_this$_unregisterVali2 = _this.Qtoh) === null || _this$_unregisterVali2 === void 0 || (_this$_unregisterVali2 = _this$_unregisterVali2.Siqm) === null || _this$_unregisterVali2 === void 0 || (_this$_unregisterVali2 = _this$_unregisterVali2.XbMU) === null || _this$_unregisterVali2 === void 0 ? void 0 : _this$_unregisterVali2.DUbs), _this.spmy);
3009
+ });
3010
+ _defineProperty(this, "WhKN", function () {
3011
+ var _this$_unregisterVali3, _this$_unregisterVali4, _this$_nextUpcomingVa;
3012
+ var ceInstance = new CE();
3013
+ _this.EVfa = true;
3014
+ if (_this.piHE) {
3015
+ clearTimeout(_this.piHE);
3016
+ }
3017
+ var conditionValidator = new ConditionValidator();
3018
+ _this.sVPQ.jHBh += 1;
3019
+ _this.sVPQ.HxYU = conditionValidator.yHAo(_this.sVPQ.jHBh, _this.sVPQ.Siqm.pbmh, _this.sVPQ.Siqm.kbAA);
3020
+ ceInstance.unregisterFromEvent(generateKey((_this$_unregisterVali3 = _this.USib) === null || _this$_unregisterVali3 === void 0 || (_this$_unregisterVali3 = _this$_unregisterVali3.Siqm) === null || _this$_unregisterVali3 === void 0 ? void 0 : _this$_unregisterVali3.ApYz) + "___" + ((_this$_unregisterVali4 = _this.USib) === null || _this$_unregisterVali4 === void 0 || (_this$_unregisterVali4 = _this$_unregisterVali4.Siqm) === null || _this$_unregisterVali4 === void 0 ? void 0 : _this$_unregisterVali4.XbMU.DUbs), _this.WhKN);
3021
+ if (_this._across_sessions && (_this$_nextUpcomingVa = _this.Mjec) !== null && _this$_nextUpcomingVa !== void 0 && _this$_nextUpcomingVa.Siqm._timeBased) {
3022
+ var no_KPI_TriggerDetails = Apxor.getController().getFromStorage("apx_nokpi_triggerdetails");
3023
+ if (no_KPI_TriggerDetails === null || no_KPI_TriggerDetails === undefined) {
3024
+ no_KPI_TriggerDetails = [];
3025
+ } else {
3026
+ no_KPI_TriggerDetails = JSON.parse(no_KPI_TriggerDetails);
3027
+ }
3028
+ var objectPresenceChecker;
3029
+ var requiredObject;
3030
+ for (var i = 0; i < no_KPI_TriggerDetails.length; i++) {
3031
+ if (_this.no_KPI_TriggerDetails[i].id === _this.Mjec.Siqm._id) {
3032
+ objectPresenceChecker = true;
3033
+ requiredObject = no_KPI_TriggerDetails[i];
3034
+ break;
3035
+ }
3036
+ }
3037
+ var triggerObj;
3038
+ if (objectPresenceChecker) {
3039
+ requiredObject.satisfiedCount += 1;
3040
+ } else {
3041
+ var id = _this.sVPQ.Siqm._id;
3042
+ var type = _this.sVPQ.Siqm.cTiq;
3043
+ var name = _this.sVPQ.Siqm.XbMU.DUbs;
3044
+ var additionalInfo = _this.sVPQ.Siqm.XbMU.wLHD;
3045
+ triggerObj = {
3046
+ id: id,
3047
+ type: type,
3048
+ time: Date.now(),
3049
+ name: name,
3050
+ additionalInfo: additionalInfo,
3051
+ satisfiedCount: _this.sVPQ.Siqm._timeEnabled,
3052
+ timeBased: _this.sVPQ.Siqm._timeEnabled
3053
+ //finishTime: finishTime,
3054
+ };
3055
+
3056
+ _this.no_KPI_TriggerDetails.push(triggerObj);
3057
+ }
3058
+ }
3059
+ if (_this.sVPQ.HxYU) {
3060
+ var upcomingValidator = _this.TXth[_this.kpiIndex + 1];
3061
+ if (!isDefined(upcomingValidator)) {
3062
+ _this.LjPk();
3063
+ } else {
3064
+ upcomingValidator.rxvk();
3065
+ }
3066
+ }
3067
+ });
3068
+ _defineProperty(this, "XiMu", function () {
3069
+ if (_this.jclx === _this.TXth.length - 1) {
3070
+ _this.IdSa = true;
3071
+ var HxYU = true;
3072
+ if (HxYU) {
3073
+ if (_this.TXth[_this.jclx]) {
3074
+ _this.TXth[_this.jclx].jHBh = _this.YeUq.satisfiedCount;
3075
+ _this.TXth[_this.jclx].HxYU = true;
3076
+ _this.LjPk();
3077
+ }
3078
+ }
3079
+ } else {
3080
+ var no_KPI_TriggerDetails = Apxor.getController().getFromStorage("apx_nokpi_triggerdetails");
3081
+ if (no_KPI_TriggerDetails === null || no_KPI_TriggerDetails === undefined) {
3082
+ no_KPI_TriggerDetails = [];
3083
+ } else {
3084
+ no_KPI_TriggerDetails = JSON.parse(no_KPI_TriggerDetails);
3085
+ }
3086
+ var requiredObject;
3087
+ var objectPresenceChecker;
3088
+ for (var i = 0; i < no_KPI_TriggerDetails.length; i++) {
3089
+ if (no_KPI_TriggerDetails[i].id === _this.jclx) {
3090
+ objectPresenceChecker = true;
3091
+ requiredObject = no_KPI_TriggerDetails[i];
3092
+ break;
3093
+ }
3094
+ }
3095
+ if (objectPresenceChecker) {
3096
+ requiredObject.satisfiedCount = 1;
3097
+ }
3098
+ Apxor.getController().persistToStorage("apx_nokpi_triggerdetails", JSON.stringify(no_KPI_TriggerDetails));
3099
+ _this.TXth[_this.jclx].jHBh = _this.YeUq.satisfiedCount;
3100
+ _this.TXth[_this.jclx].HxYU = true;
3101
+ if (_this.TXth[_this.jclx + 1].Siqm._timeEnabled) {
3102
+ var timeInMillisec = calculateTime(_this.TXth[_this.jclx + 1].Siqm._time.unit, _this.TXth[_this.jclx + 1].Siqm._time.value);
3103
+ var timeEnabled = _this.TXth[_this.jclx + 1].Siqm._timeEnabled;
3104
+ var condition_id = _this.TXth[_this.jclx + 1].Siqm._id;
3105
+ var satisfiedCount = _this.TXth[_this.jclx + 1].jHBh;
3106
+ var name = _this.TXth[_this.jclx + 1].Siqm.XbMU.DUbs;
3107
+ var additionalInfo = _this.TXth[_this.jclx + 1].XbMU.wLHD;
3108
+ var condition_validator = new ConditionValidator();
3109
+ condition_validator.kdvQ(_this.Siqm.cTiq, name, Date.now(), additionalInfo, timeInMillisec, timeEnabled, condition_id, satisfiedCount);
3110
+ }
3111
+ }
3112
+ });
3113
+ _defineProperty(this, "ghfw", function () {
3114
+ if (_this._across_sessions && _this.znHr) {
3115
+ var matching_validator;
3116
+ var matchedIndex;
3117
+ var matchednestedIndex;
3118
+ var conditionType = "single";
3119
+ var HxYU = false;
3120
+ var no_KPI_TriggerDetails = Apxor.getController().getFromStorage("apx_nokpi_triggerdetails");
3121
+ no_KPI_TriggerDetails = JSON.parse(no_KPI_TriggerDetails);
3122
+ if (no_KPI_TriggerDetails.length > 0) {
3123
+ var _iterator2 = _createForOfIteratorHelper(no_KPI_TriggerDetails),
3124
+ _step2;
3125
+ try {
3126
+ var _loop3 = function _loop3() {
3127
+ var trigger = _step2.value;
3128
+ var id_to_check = trigger["id"];
3129
+ var satifiedCount = trigger["satisfiedCount"];
3130
+ matching_validator = _this.TXth.find(function (validator, index) {
3131
+ if ((validator === null || validator === void 0 ? void 0 : validator.length) === 1 || (validator === null || validator === void 0 ? void 0 : validator.length) === undefined) {
3132
+ if (validator.Siqm._id === id_to_check) {
3133
+ conditionType = "single";
3134
+ matchedIndex = index;
3135
+ return true;
3136
+ }
3137
+ // If the condition is a single condition, directly check the id
3138
+ } else if (validator.length > 0) {
3139
+ // If the condition is a group, check if any individual condition has the id
3140
+ var nestedIndex = validator.findIndex(function (individualCondition) {
3141
+ return individualCondition.Siqm._id === id_to_check;
3142
+ });
3143
+ if (nestedIndex !== -1) {
3144
+ // If id_to_check is found in a nested condition, store both indexes
3145
+ matchedIndex = index;
3146
+ matchednestedIndex = nestedIndex;
3147
+ conditionType = "group";
3148
+ return true;
3149
+ }
3150
+ }
3151
+ return false;
3152
+ });
3153
+ if (conditionType === "single" && matching_validator) {
3154
+ var condition_validator = new ConditionValidator();
3155
+ HxYU = condition_validator.yHAo(satifiedCount, matching_validator.Siqm.pbmh, matching_validator.Siqm.kbAA);
3156
+ var matchingValidatorIndex = _this.TXth.findIndex(function (validator) {
3157
+ var _validator$Siqm;
3158
+ return (validator === null || validator === void 0 || (_validator$Siqm = validator.Siqm) === null || _validator$Siqm === void 0 ? void 0 : _validator$Siqm._id) === id_to_check;
3159
+ });
3160
+ if (matchingValidatorIndex === undefined) {
3161
+ matchingValidatorIndex = matchedIndex;
3162
+ }
3163
+ if (HxYU) {
3164
+ _this.TXth[matchingValidatorIndex].HxYU = true;
3165
+ }
3166
+ } else if (conditionType === "group" && matching_validator) {
3167
+ var _condition_validator = new ConditionValidator();
3168
+ HxYU = _condition_validator.yHAo(satifiedCount, matching_validator[matchednestedIndex].Siqm.pbmh, matching_validator[matchednestedIndex].Siqm.kbAA);
3169
+ if (HxYU) {
3170
+ _this.TXth[matchedIndex][matchednestedIndex].HxYU = true;
3171
+ }
3172
+ }
3173
+ };
3174
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3175
+ _loop3();
3176
+ }
3177
+ } catch (err) {
3178
+ _iterator2.e(err);
3179
+ } finally {
3180
+ _iterator2.f();
3181
+ }
3182
+ }
1663
3183
  }
1664
3184
  });
1665
- _defineProperty(this, "zTfD", function (index) {
3185
+ _defineProperty(this, "pCjf", function (index) {
1666
3186
  if (index < 0) {
1667
3187
  return;
1668
3188
  }
1669
- _this.PXuU();
3189
+ _this.pVIH();
1670
3190
  });
1671
- _defineProperty(this, "VHRs", function () {
3191
+ _defineProperty(this, "LjPk", function () {
1672
3192
  var _window$ApxorRTM, _window$ApxorRTM2;
1673
3193
  var view_visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1674
3194
  // Check If Audience, Validity is satisfied or not
1675
3195
  var userAttributes = Apxor.getController().getUserAttributes();
1676
3196
  var sessionAttributes = Apxor.getController().getSessionAttributes();
1677
- if (!((_window$ApxorRTM = window.ApxorRTM) !== null && _window$ApxorRTM !== void 0 && _window$ApxorRTM.isBadgePresent && (_window$ApxorRTM2 = window.ApxorRTM) !== null && _window$ApxorRTM2 !== void 0 && _window$ApxorRTM2.badgesLists.includes(_this.tkvH) && Apxor.getController().isBadgeTriggerSatisfied(_this.tkvH))) {
3197
+ if (!((_window$ApxorRTM = window.ApxorRTM) !== null && _window$ApxorRTM !== void 0 && _window$ApxorRTM.isBadgePresent && (_window$ApxorRTM2 = window.ApxorRTM) !== null && _window$ApxorRTM2 !== void 0 && _window$ApxorRTM2.badgesLists.includes(_this.Hazg) && Apxor.getController().isBadgeTriggerSatisfied(_this.Hazg))) {
1678
3198
  Apxor === null || Apxor === void 0 || Apxor.logEvent("apx_trigger_satisfied", {
1679
- apx_nudge_type: _this.FaOX.WBXT === "SURVEY" ? "survey" : "campaign",
1680
- apx_nudge_id: _this.tkvH,
1681
- apx_nudge_name: _this.FaOX.FiDT,
1682
- apx_variant_code: _this.FaOX._isExperiment || _this.FaOX._only_context ? _this.FaOX._attr[APX_VARIANT_CODE] : "TG"
3199
+ apx_nudge_type: _this.Ereh.cTiq === "SURVEY" ? "survey" : "campaign",
3200
+ apx_nudge_id: _this.Hazg,
3201
+ apx_nudge_name: _this.Ereh.DUbs,
3202
+ apx_variant_code: _this.Ereh._isExperiment || _this.Ereh._only_context ? _this.Ereh._attr[APX_VARIANT_CODE] : "TG"
1683
3203
  });
1684
3204
  }
1685
- if (!_this.kTyF.validate() || !_this.wdlK.validate(userAttributes, sessionAttributes) || !_this.aNwp.validate() || !_this.VfRX.validate()) {
1686
- if (!_this.aNwp.retainedDaysValidated) {
1687
- _this.vYAT("Retained day criteria not met");
3205
+ if (!_this.Dqwg.validate() || !_this.xtma.validate(userAttributes, sessionAttributes) || !_this.GLor.validate() || !_this.PlQx.validate()) {
3206
+ // eslint-disable-next-line no-unused-vars
3207
+ var apx_nudge_type = _this.Ereh.cTiq === "SURVEY" ? "survey" : "campaign";
3208
+ if (!_this.GLor.retainedDaysValidated) {
3209
+ _this.sVnr("Retained day criteria not met");
1688
3210
  return;
1689
3211
  }
1690
- if (!_this.aNwp.retainedSessionValidated) {
1691
- _this.vYAT("User session criteria not met");
3212
+ if (!_this.GLor.retainedSessionValidated) {
3213
+ _this.sVnr("User session criteria not met");
1692
3214
  return;
1693
3215
  }
1694
- if (_this.aNwp.eventDoneInLT) {
1695
- _this.vYAT("Event done in life time");
3216
+ if (_this.GLor.eventDoneInLT) {
3217
+ _this.sVnr("Event done in life time");
1696
3218
  return;
1697
3219
  }
1698
- if (!_this.wdlK.userAttributesValidated) {
1699
- _this.vYAT("User property filter not met");
3220
+ if (!_this.xtma.userAttributesValidated) {
3221
+ _this.sVnr("User property filter not met");
1700
3222
  return;
1701
3223
  }
1702
- if (!_this.wdlK.sessionAttributeValidated) {
1703
- _this.vYAT("Session property filter not met");
3224
+ if (!_this.xtma.sessionAttributeValidated) {
3225
+ _this.sVnr("Session property filter not met");
1704
3226
  return;
1705
3227
  }
1706
- if (_this.kTyF._not_in_specified_time) {
1707
- _this.vYAT("Time limits check failed");
3228
+ if (_this.Dqwg._not_in_specified_time) {
3229
+ _this.sVnr("Time limits check failed");
1708
3230
  return;
1709
3231
  }
1710
- if (_this.kTyF._not_yet_active) {
1711
- _this.vYAT("not in the scheduled time");
3232
+ if (_this.Dqwg._not_yet_active) {
3233
+ _this.sVnr("not in the scheduled time");
1712
3234
  return;
1713
3235
  }
1714
- if (_this.kTyF._nudge_expired) {
1715
- _this.vYAT("nudge expired");
3236
+ if (_this.Dqwg._nudge_expired) {
3237
+ _this.sVnr("nudge expired");
1716
3238
  return;
1717
3239
  }
1718
3240
  return;
1719
3241
  }
1720
- var length = _this.TbxE.length;
3242
+ var length = _this.TXth.length;
1721
3243
  var isSatisfied = length < 1;
1722
3244
  var combineOperator = "";
1723
3245
  if (length === 0) {
1724
3246
  isSatisfied = true;
1725
3247
  }
1726
3248
  for (var index = 0; index < length; index++) {
1727
- var validator = _this.TbxE[index];
1728
- var currentResult = validator.KUlF;
3249
+ var currentResult = void 0;
3250
+ var validator = _this.TXth[index];
3251
+ if (validator.length > 1) {
3252
+ var combine_operator = validator[0].Siqm.VnOY;
3253
+ if (combine_operator === "AND") {
3254
+ currentResult = true;
3255
+ } else {
3256
+ currentResult = false;
3257
+ }
3258
+ for (var i = 0; i < validator.length; i++) {
3259
+ var _combine_operator = validator[0].Siqm.VnOY;
3260
+ if (_combine_operator === "AND") {
3261
+ currentResult = currentResult && validator[i].HxYU;
3262
+ } else {
3263
+ currentResult = currentResult || validator[i].HxYU;
3264
+ }
3265
+ }
3266
+ } else {
3267
+ currentResult = validator.HxYU;
3268
+ }
1729
3269
  if (combineOperator.trim() === "") {
1730
3270
  isSatisfied = currentResult;
1731
3271
  } else {
@@ -1738,61 +3278,94 @@
1738
3278
  break;
1739
3279
  }
1740
3280
  }
1741
- combineOperator = validator.ZdyA;
3281
+ if (validator.length > 1) {
3282
+ combineOperator = _this.groupCombineOperator;
3283
+ } else {
3284
+ combineOperator = validator.VnOY;
3285
+ }
1742
3286
  }
1743
3287
  if (view_visibility === true) {
1744
3288
  isSatisfied = true;
1745
3289
  }
1746
3290
  if (isSatisfied) {
3291
+ var _window$ApxorRTM3, _window$ApxorRTM4;
1747
3292
  console.debug("onCondition satisfied");
1748
3293
  // Check if count reached it's maximum
1749
- if (!_this.tsTs.tiom(_this.tkvH)) {
1750
- console.warn("Maximum limit reached", _this.tkvH);
1751
- if (Apxor.getController().isTestDevice()) {
1752
- feedBackMessagePopUpCE("Maximum limit reached for campaign name ".concat(_this.FaOX.FiDT));
1753
- var closeButton = document.getElementById("close-button");
1754
- var dismissCallback = function dismissCallback() {
1755
- var modal_popup_container = document.getElementById("apx-container");
1756
- modal_popup_container === null || modal_popup_container === void 0 || modal_popup_container.remove();
1757
- };
1758
- closeButton === null || closeButton === void 0 || closeButton.addEventListener("click", dismissCallback);
1759
- window.setTimeout(dismissCallback, 20000);
1760
- }
3294
+ if (!_this.YVWL.dhZT(_this.Hazg)) {
3295
+ console.warn("Maximum limit reached", _this.Hazg);
1761
3296
  return;
1762
3297
  }
1763
3298
 
1764
3299
  //logging event for view not found for test device
1765
-
1766
- console.log("Dispatching event", _this.FaOX.WBXT);
1767
-
1768
- //if (this.FaOX._only_context === true) {
1769
- Apxor.logEvent(APX_CONTEXT_EVALUATED, _objectSpread2(_objectSpread2({
1770
- apx_nudge_type: _this.FaOX.WBXT === "SURVEY" ? "survey" : "campaign",
1771
- apx_nudge_id: _this.tkvH,
1772
- apx_nudge_name: _this.FaOX.FiDT,
1773
- apx_variant_code: _this.FaOX._isExperiment || _this.FaOX._only_context ? _this.FaOX._attr[APX_VARIANT_CODE] : "TG"
1774
- }, _this.FaOX._attr), {}, {
1775
- message_name: _this.FaOX.FiDT,
1776
- id: _this.tkvH
1777
- }));
1778
- //}
3300
+ if (!((_window$ApxorRTM3 = window.ApxorRTM) !== null && _window$ApxorRTM3 !== void 0 && _window$ApxorRTM3.isBadgePresent && (_window$ApxorRTM4 = window.ApxorRTM) !== null && _window$ApxorRTM4 !== void 0 && _window$ApxorRTM4.badgesLists.includes(_this.Hazg) && Apxor.getController().isBadgeTriggerSatisfied(_this.Hazg))) {
3301
+ var _apx_nudge_type = _this.Ereh.cTiq === "SURVEY" ? "survey" : "campaign";
3302
+ Apxor === null || Apxor === void 0 || Apxor.logEvent("apx_trigger_satisfied", {
3303
+ apx_nudge_type: _this.Ereh.cTiq === "SURVEY" ? "survey" : "campaign",
3304
+ apx_nudge_id: _this.Hazg,
3305
+ apx_nudge_name: _this.Ereh.DUbs,
3306
+ apx_variant_code: _this.Ereh._isExperiment || _this.Ereh._only_context ? _this.Ereh._attr[APX_VARIANT_CODE] : "TG"
3307
+ }, false, "", _apx_nudge_type);
3308
+ }
3309
+ if (_this._across_sessions) {
3310
+ localStorage.removeItem("apx_nokpi_triggerdetails");
3311
+ }
3312
+ var _iterator3 = _createForOfIteratorHelper(_this.TXth),
3313
+ _step3;
3314
+ try {
3315
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3316
+ var _validator3 = _step3.value;
3317
+ if ((_validator3 === null || _validator3 === void 0 ? void 0 : _validator3.length) === 1 || (_validator3 === null || _validator3 === void 0 ? void 0 : _validator3.length) === undefined) {
3318
+ _validator3.HxYU = false;
3319
+ _validator3.jHBh = 0;
3320
+ } else {
3321
+ var _iterator4 = _createForOfIteratorHelper(_validator3),
3322
+ _step4;
3323
+ try {
3324
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
3325
+ var childValidator = _step4.value;
3326
+ childValidator.HxYU = false;
3327
+ childValidator.jHBh = 0;
3328
+ }
3329
+ } catch (err) {
3330
+ _iterator4.e(err);
3331
+ } finally {
3332
+ _iterator4.f();
3333
+ }
3334
+ }
3335
+ }
3336
+ //this.aGhL = new ConditionValidator();
3337
+ } catch (err) {
3338
+ _iterator3.e(err);
3339
+ } finally {
3340
+ _iterator3.f();
3341
+ }
3342
+ _this.aGhL.wogz(_this.TXth);
3343
+ _this.TXth = [];
3344
+ _this.svJa(_this.Oxkj, _this.lIwH);
3345
+ if (_this.Ereh._only_context === true) {
3346
+ var _apx_nudge_type2 = _this.Ereh.cTiq === "SURVEY" ? "survey" : "campaign";
3347
+ Apxor.logEvent(APX_CONTEXT_EVALUATED, _objectSpread2(_objectSpread2({}, _this.Ereh._attr), {}, {
3348
+ message_name: _this.Ereh.DUbs,
3349
+ id: _this.Hazg
3350
+ }), false, "", _apx_nudge_type2);
3351
+ }
1779
3352
  // Emit event
1780
- Apxor.getController().dispatchEvent(_this.FaOX.WBXT, {
1781
- name: _this.FaOX.WBXT,
3353
+ Apxor.getController().dispatchEvent(_this.Ereh.cTiq, {
3354
+ name: _this.Ereh.cTiq,
1782
3355
  additional_info: {
1783
- uuid: _this.tkvH,
1784
- name: _this.FaOX.FiDT
3356
+ uuid: _this.Hazg,
3357
+ name: _this.Ereh.DUbs
1785
3358
  }
1786
3359
  });
1787
3360
  }
1788
3361
  });
1789
- _defineProperty(this, "PXuU", function () {
1790
- var length = _this.oJYY.length;
3362
+ _defineProperty(this, "pVIH", function () {
3363
+ var length = _this.OAcN.length;
1791
3364
  var isSatisfied = length < 1;
1792
3365
  var combineOperator = "";
1793
3366
  for (var index = 0; index < length; index++) {
1794
- var validator = _this.oJYY[index];
1795
- var currentResult = validator.KUlF;
3367
+ var validator = _this.OAcN[index];
3368
+ var currentResult = validator.HxYU;
1796
3369
  if (combineOperator.trim() === "") {
1797
3370
  isSatisfied = currentResult;
1798
3371
  } else {
@@ -1805,23 +3378,23 @@
1805
3378
  break;
1806
3379
  }
1807
3380
  }
1808
- combineOperator = validator.seqy;
3381
+ combineOperator = validator.mOhQ;
1809
3382
  }
1810
3383
  if (isSatisfied) {
1811
- console.log("Dispatching event", _this.FaOX.WBXT);
1812
- Apxor.getController().persistTerminationInfoLocally(_this.tkvH);
1813
- if (_this.FaOX._only_context === true) {
1814
- Apxor.logEvent(APX_CONTEXT_EVALUATED, _objectSpread2(_objectSpread2({}, _this.FaOX._attr), {}, {
1815
- message_name: _this.FaOX.FiDT,
1816
- id: _this.tkvH
1817
- }));
3384
+ Apxor.getController().persistTerminationInfoLocally(_this.Hazg);
3385
+ if (_this.Ereh._only_context === true) {
3386
+ var apx_nudge_type = _this.Ereh.cTiq === "SURVEY" ? "survey" : "campaign";
3387
+ Apxor.logEvent(APX_CONTEXT_EVALUATED, _objectSpread2(_objectSpread2({}, _this.Ereh._attr), {}, {
3388
+ message_name: _this.Ereh.DUbs,
3389
+ id: _this.Hazg
3390
+ }), false, "apxor", apx_nudge_type);
1818
3391
  }
1819
3392
  // Emit event
1820
- Apxor.getController().dispatchEvent(_this.FaOX.WBXT, {
1821
- name: _this.FaOX.WBXT,
3393
+ Apxor.getController().dispatchEvent(_this.Ereh.cTiq, {
3394
+ name: _this.Ereh.cTiq,
1822
3395
  additional_info: {
1823
- uuid: _this.tkvH,
1824
- name: _this.FaOX.FiDT
3396
+ uuid: _this.Hazg,
3397
+ name: _this.Ereh.DUbs
1825
3398
  }
1826
3399
  });
1827
3400
  }
@@ -1829,24 +3402,42 @@
1829
3402
  _defineProperty(this, "validateForTerminationAttributes", function () {
1830
3403
  var userAttributes = Apxor.getController().getUserAttributes();
1831
3404
  var sessionAttributes = Apxor.getController().getSessionAttributes();
1832
- return _this.smLy.validate(userAttributes, sessionAttributes);
3405
+ return _this.FpDf.validate(userAttributes, sessionAttributes);
1833
3406
  });
1834
- _defineProperty(this, "hJWa", function () {
1835
- _this.tsTs.hJWa();
3407
+ _defineProperty(this, "mfzx", function () {
3408
+ _this.YVWL.mfzx();
1836
3409
  });
1837
3410
  _defineProperty(this, "getFrequencyCount", function () {
1838
- return _this.tsTs.getFrequencyCount();
3411
+ return _this.YVWL.getFrequencyCount();
3412
+ });
3413
+ _defineProperty(this, "uurO", function () {
3414
+ return _this.YVWL.mDnO();
1839
3415
  });
1840
- _defineProperty(this, "KlBp", function () {
1841
- return _this.tsTs.Hhtv();
3416
+ _defineProperty(this, "pDnJ", function (validator) {
3417
+ var currentResult;
3418
+ var combine_operator = validator[0].Siqm.VnOY;
3419
+ if (combine_operator === "AND") {
3420
+ currentResult = true;
3421
+ } else {
3422
+ currentResult = false;
3423
+ }
3424
+ for (var i = 0; i < validator.length; i++) {
3425
+ var _combine_operator2 = validator[0].Siqm.VnOY;
3426
+ if (_combine_operator2 === "AND") {
3427
+ currentResult = currentResult && validator[i].HxYU;
3428
+ } else {
3429
+ currentResult = currentResult || validator[i].HxYU;
3430
+ }
3431
+ }
3432
+ return currentResult;
1842
3433
  });
1843
- _defineProperty(this, "vYAT", function (reason) {
1844
- var _this$FaOX$_attr2;
3434
+ _defineProperty(this, "sVnr", function (reason) {
3435
+ var _this$Ereh$_attr2;
1845
3436
  Apxor === null || Apxor === void 0 || Apxor.logEvent("apx_non_eligible_user", {
1846
- apx_nudge_type: _this.FaOX.WBXT === "SURVEY" ? "survey" : "campaign",
1847
- apx_nudge_id: _this.tkvH,
1848
- apx_nudge_name: _this.FaOX.FiDT,
1849
- apx_variant_code: _this.FaOX._isExperiment || _this.FaOX._only_context ? (_this$FaOX$_attr2 = _this.FaOX._attr) === null || _this$FaOX$_attr2 === void 0 ? void 0 : _this$FaOX$_attr2[APX_VARIANT_CODE] : "TG",
3437
+ apx_nudge_type: _this.Ereh.cTiq === "SURVEY" ? "survey" : "campaign",
3438
+ apx_nudge_id: _this.Hazg,
3439
+ apx_nudge_name: _this.Ereh.DUbs,
3440
+ apx_variant_code: _this.Ereh._isExperiment || _this.Ereh._only_context ? (_this$Ereh$_attr2 = _this.Ereh._attr) === null || _this$Ereh$_attr2 === void 0 ? void 0 : _this$Ereh$_attr2[APX_VARIANT_CODE] : "TG",
1850
3441
  apx_failure_type: "warn",
1851
3442
  apx_reason: reason
1852
3443
  });
@@ -1856,7 +3447,7 @@
1856
3447
  var ConfigLookup = /*#__PURE__*/_createClass(function ConfigLookup() {
1857
3448
  var _this = this;
1858
3449
  _classCallCheck(this, ConfigLookup);
1859
- _defineProperty(this, "UGOI", {});
3450
+ _defineProperty(this, "FFaa", {});
1860
3451
  _defineProperty(this, "parse", function () {
1861
3452
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
1862
3453
  configs: []
@@ -1879,7 +3470,7 @@
1879
3470
  var configId = _config._id;
1880
3471
  var configItem = new ConfigItem();
1881
3472
  if (configItem.parse(_config)) {
1882
- _this.UGOI[configId] = configItem;
3473
+ _this.FFaa[configId] = configItem;
1883
3474
  } else {
1884
3475
  console.warn("Failed to parse cfg", configId);
1885
3476
  }
@@ -1887,51 +3478,52 @@
1887
3478
  }
1888
3479
  });
1889
3480
  _defineProperty(this, "validate", function (id, index) {
1890
- if (_this.UGOI[id]) {
1891
- var configItem = _this.UGOI[id];
1892
- configItem.WTJq(index);
3481
+ var childIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
3482
+ if (_this.FFaa[id]) {
3483
+ var configItem = _this.FFaa[id];
3484
+ configItem.IDxi(index, childIndex);
1893
3485
  }
1894
3486
  });
1895
3487
  _defineProperty(this, "getVariantCode", function (id) {
1896
- if (_this.UGOI[id]) {
1897
- var configItem = _this.UGOI[id];
3488
+ if (_this.FFaa[id]) {
3489
+ var configItem = _this.FFaa[id];
1898
3490
  return configItem._variant_code;
1899
3491
  }
1900
3492
  return "";
1901
3493
  });
1902
3494
  _defineProperty(this, "validateForTermination", function (id, index) {
1903
- if (_this.UGOI[id]) {
1904
- var configItem = _this.UGOI[id];
1905
- configItem.zTfD(index);
3495
+ if (_this.FFaa[id]) {
3496
+ var configItem = _this.FFaa[id];
3497
+ configItem.pCjf(index);
1906
3498
  }
1907
3499
  });
1908
3500
  _defineProperty(this, "validateForTerminationAttributes", function (id) {
1909
- if (_this.UGOI[id]) {
1910
- var configItem = _this.UGOI[id];
3501
+ if (_this.FFaa[id]) {
3502
+ var configItem = _this.FFaa[id];
1911
3503
  return configItem.validateForTerminationAttributes();
1912
3504
  }
1913
3505
  return false;
1914
3506
  });
1915
- _defineProperty(this, "hJWa", function (id) {
1916
- var campiagnConfig = _this.UGOI[id];
1917
- campiagnConfig.hJWa();
3507
+ _defineProperty(this, "mfzx", function (id) {
3508
+ var campiagnConfig = _this.FFaa[id];
3509
+ campiagnConfig.mfzx();
1918
3510
  });
1919
3511
  _defineProperty(this, "getFrequencyCount", function (id) {
1920
- var campiagnConfig = _this.UGOI[id];
3512
+ var campiagnConfig = _this.FFaa[id];
1921
3513
  if (campiagnConfig != undefined) return campiagnConfig.getFrequencyCount();
1922
3514
  });
1923
3515
  _defineProperty(this, "resetFrequencyCounts", function () {
1924
- var configs = _this.UGOI;
3516
+ var configs = _this.FFaa;
1925
3517
  for (var configId in configs) {
1926
- configs[configId].KlBp();
3518
+ configs[configId].uurO();
1927
3519
  }
1928
3520
  });
1929
- _defineProperty(this, "ZNQa", function (campaignId) {
3521
+ _defineProperty(this, "EdXf", function (campaignId) {
1930
3522
  try {
1931
- if (_this.UGOI) {
1932
- var configItem = _this.UGOI[campaignId];
1933
- if (configItem && configItem.FaOX) {
1934
- return configItem.FaOX;
3523
+ if (_this.FFaa) {
3524
+ var configItem = _this.FFaa[campaignId];
3525
+ if (configItem && configItem.Ereh) {
3526
+ return configItem.Ereh;
1935
3527
  }
1936
3528
  }
1937
3529
  } catch (e) {
@@ -1941,48 +3533,48 @@
1941
3533
  });
1942
3534
  });
1943
3535
 
1944
- var APP_EVENT = "APP_EVENT";
1945
- var CLIENT_EVENT = "CLIENT_EVENT";
1946
- var Logger$a = window.ApxorLogger;
3536
+ var APP_EVENT$1 = "APP_EVENT";
3537
+ var CLIENT_EVENT$1 = "CLIENT_EVENT";
3538
+ var Logger$b = window.ApxorLogger;
1947
3539
  var EventsListener = /*#__PURE__*/_createClass(function EventsListener() {
1948
3540
  var _this = this;
1949
3541
  _classCallCheck(this, EventsListener);
1950
- _defineProperty(this, "kUGk", {});
1951
- _defineProperty(this, "OKHG", []);
1952
- _defineProperty(this, "oTBy", false);
3542
+ _defineProperty(this, "HpgQ", {});
3543
+ _defineProperty(this, "gaon", []);
3544
+ _defineProperty(this, "indb", false);
1953
3545
  _defineProperty(this, "initialize", function () {
1954
3546
  var controller = Apxor.getController();
1955
- controller.registerForEvent(APP_EVENT, function (event) {
1956
- return _this.bhnD(event, "AE");
3547
+ controller.registerForEvent(APP_EVENT$1, function (event) {
3548
+ return _this.KJki(event, "AE");
1957
3549
  });
1958
- controller.registerForEvent(CLIENT_EVENT, function (event) {
1959
- return _this.bhnD(event, "CE");
3550
+ controller.registerForEvent(CLIENT_EVENT$1, function (event) {
3551
+ return _this.KJki(event, "CE");
1960
3552
  });
1961
3553
  });
1962
- _defineProperty(this, "JJQh", function () {
3554
+ _defineProperty(this, "hOGO", function () {
1963
3555
  // Clear Buffer
1964
- for (var item in _this.OKHG) {
1965
- _this.sFoD(item.event, item.key, item.type);
3556
+ for (var item in _this.gaon) {
3557
+ _this.dTHU(item.event, item.key, item.type);
1966
3558
  }
1967
- _this.oTBy = true;
3559
+ _this.indb = true;
1968
3560
  });
1969
- _defineProperty(this, "vWFx", function (event, callback) {
3561
+ _defineProperty(this, "lNUe", function (event, callback) {
1970
3562
  if (!isFunction(callback)) {
1971
3563
  return;
1972
3564
  }
1973
3565
  var listeners;
1974
- if (_this.kUGk[event]) {
1975
- listeners = _this.kUGk[event];
3566
+ if (_this.HpgQ[event]) {
3567
+ listeners = _this.HpgQ[event];
1976
3568
  } else {
1977
3569
  listeners = [];
1978
3570
  }
1979
3571
  listeners.push(callback);
1980
- _this.kUGk[event] = listeners;
1981
- Logger$a.debug("Listeners list: ", _this.kUGk);
3572
+ _this.HpgQ[event] = listeners;
3573
+ Logger$b.debug("Listeners list: ", _this.HpgQ);
1982
3574
  });
1983
3575
  _defineProperty(this, "unregisterFromEvent", function (event, callback) {
1984
- if (_this.kUGk[event]) {
1985
- var listeners = _this.kUGk[event];
3576
+ if (_this.HpgQ[event]) {
3577
+ var listeners = _this.HpgQ[event];
1986
3578
  var updatedListeners = [];
1987
3579
  for (var index = 0; index < listeners.length; index++) {
1988
3580
  var listener = listeners[index];
@@ -1990,25 +3582,36 @@
1990
3582
  updatedListeners.push(listener);
1991
3583
  }
1992
3584
  }
1993
- _this.kUGk[event] = updatedListeners;
3585
+ _this.HpgQ[event] = updatedListeners;
1994
3586
  }
1995
3587
  });
1996
- _defineProperty(this, "bhnD", function (event) {
3588
+ _defineProperty(this, "KJki", function (event) {
1997
3589
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "AE";
3590
+ _this.dTHU(event, "any_event", type);
3591
+ if ((event === null || event === void 0 ? void 0 : event.loggedBy) === "apxor") {
3592
+ _this.dTHU(event, "apxor_event", type);
3593
+ } else if ((event === null || event === void 0 ? void 0 : event.loggedBy) === "customer") {
3594
+ _this.dTHU(event, "customer_event", type);
3595
+ }
3596
+ if ((event === null || event === void 0 ? void 0 : event.apx_nudge_type) === "campaign") {
3597
+ _this.dTHU(event, "campaign_event", type);
3598
+ } else if ((event === null || event === void 0 ? void 0 : event.apx_nudge_type) === "survey") {
3599
+ _this.dTHU(event, "survey_event", type);
3600
+ }
1998
3601
  var key = type + "___" + event.name;
1999
- _this.sFoD(event, key, type);
3602
+ _this.dTHU(event, key, type);
2000
3603
  });
2001
- _defineProperty(this, "sFoD", function (event, key, type) {
2002
- if (!_this.oTBy) {
2003
- _this.OKHG.push({
3604
+ _defineProperty(this, "dTHU", function (event, key, type) {
3605
+ if (!_this.indb) {
3606
+ _this.gaon.push({
2004
3607
  event: event,
2005
3608
  key: key,
2006
3609
  type: type
2007
3610
  });
2008
3611
  } else {
2009
- Logger$a.debug("Notifying listeners for event: " + event + ", " + key, _this.kUGk);
2010
- if (_this.kUGk[key]) {
2011
- var listeners = _this.kUGk[key];
3612
+ Logger$b.debug("Notifying listeners for event: " + event + ", " + key, _this.HpgQ);
3613
+ if (_this.HpgQ[key]) {
3614
+ var listeners = _this.HpgQ[key];
2012
3615
  var time = Apxor.getController().getSDKRunningTimeInSec();
2013
3616
  for (var index = 0; index < listeners.length; index++) {
2014
3617
  var listener = listeners[index];
@@ -2019,22 +3622,22 @@
2019
3622
  });
2020
3623
  });
2021
3624
 
2022
- var Logger$b = window.ApxorLogger;
3625
+ var Logger$c = window.ApxorLogger;
2023
3626
  var CE = /*#__PURE__*/function () {
2024
3627
  function CE() {
2025
3628
  var _this = this;
2026
3629
  _classCallCheck(this, CE);
2027
- _defineProperty(this, "UnLY", false);
2028
- _defineProperty(this, "sqeD", null);
2029
- _defineProperty(this, "OmCk", getDateInDDMMYYYY());
2030
- _defineProperty(this, "ymVO", new EventsListener());
2031
- _defineProperty(this, "looJ", Apxor.getSiteId());
3630
+ _defineProperty(this, "akqR", false);
3631
+ _defineProperty(this, "wxWE", null);
3632
+ _defineProperty(this, "nMjQ", getDateInDDMMYYYY());
3633
+ _defineProperty(this, "jVuN", new EventsListener());
3634
+ _defineProperty(this, "wPAI", Apxor.getSiteId());
2032
3635
  _defineProperty(this, "_qeState", {});
2033
3636
  _defineProperty(this, "getQeState", function () {
2034
3637
  try {
2035
3638
  var data = Apxor.getController().getFromStorage(QE_STATE);
2036
3639
  if (data) {
2037
- return JSON.parse(decode(_this.looJ, data));
3640
+ return JSON.parse(decode(_this.wPAI, data));
2038
3641
  } else {
2039
3642
  _this._qeState = {};
2040
3643
  return _this.setQeState();
@@ -2063,12 +3666,12 @@
2063
3666
  return _this._qeState;
2064
3667
  });
2065
3668
  _defineProperty(this, "initialize", function () {
2066
- if (!_this.UnLY) {
2067
- _this.UnLY = true;
2068
- _this.sqeD = new ConfigLookup();
2069
- _this.ymVO.initialize();
3669
+ if (!_this.akqR) {
3670
+ _this.akqR = true;
3671
+ _this.wxWE = new ConfigLookup();
3672
+ _this.jVuN.initialize();
2070
3673
  _this._qeState = _this.getQeState();
2071
- Logger$b.info("QE Initialized..");
3674
+ Logger$c.info("QE Initialized..");
2072
3675
  }
2073
3676
  });
2074
3677
  /**
@@ -2077,12 +3680,12 @@
2077
3680
  * @param config
2078
3681
  */
2079
3682
  _defineProperty(this, "parse", function (config) {
2080
- if (!_this.pHuQ()) {
2081
- Logger$b.warn("Must call init first. Unable to proceed");
3683
+ if (!_this.Gpek()) {
3684
+ Logger$c.warn("Must call init first. Unable to proceed");
2082
3685
  return;
2083
3686
  }
2084
- _this.sqeD.parse(config);
2085
- _this.ymVO.JJQh();
3687
+ _this.wxWE.parse(config);
3688
+ _this.jVuN.hOGO();
2086
3689
  });
2087
3690
  /**
2088
3691
  * Validates all conditions for given config ID
@@ -2091,22 +3694,23 @@
2091
3694
  * @param index
2092
3695
  */
2093
3696
  _defineProperty(this, "validate", function (id, index) {
2094
- if (!_this.pHuQ()) {
3697
+ var childIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
3698
+ if (!_this.Gpek()) {
2095
3699
  return;
2096
3700
  }
2097
- _this.sqeD.validate(id, index);
3701
+ _this.wxWE.validate(id, index, childIndex);
2098
3702
  });
2099
3703
  _defineProperty(this, "getVariantCode", function (id) {
2100
- return _this.sqeD.getVariantCode(id);
3704
+ return _this.wxWE.getVariantCode(id);
2101
3705
  });
2102
3706
  _defineProperty(this, "validateForTermination", function (id, index) {
2103
- if (!_this.pHuQ()) {
3707
+ if (!_this.Gpek()) {
2104
3708
  return;
2105
3709
  }
2106
- _this.sqeD.validateForTermination(id, index);
3710
+ _this.wxWE.validateForTermination(id, index);
2107
3711
  });
2108
3712
  _defineProperty(this, "validateForTerminationAttributes", function (user, session) {
2109
- return _this.sqeD.validateForTerminationAttributes(user, session);
3713
+ return _this.wxWE.validateForTerminationAttributes(user, session);
2110
3714
  });
2111
3715
  _defineProperty(this, "updateCount", function (id) {
2112
3716
  try {
@@ -2115,25 +3719,25 @@
2115
3719
  }
2116
3720
  _this.incrementFrequencies(id);
2117
3721
  _this.setQeState(id);
2118
- _this.sqeD.hJWa(id);
3722
+ _this.wxWE.mfzx(id);
2119
3723
  } catch (e) {
2120
3724
  console.log("Could not update the count config:".concat(e));
2121
3725
  }
2122
3726
  });
2123
3727
  _defineProperty(this, "resetFrequencyCounts", function () {
2124
- _this.sqeD.resetFrequencyCounts();
3728
+ _this.wxWE.resetFrequencyCounts();
2125
3729
  });
2126
3730
  _defineProperty(this, "getFrequencyCount", function (id) {
2127
- return _this.sqeD.getFrequencyCount(id);
3731
+ return _this.wxWE.getFrequencyCount(id);
2128
3732
  });
2129
3733
  _defineProperty(this, "registerForEvent", function (event, callback) {
2130
- _this.ymVO.vWFx(event, callback);
3734
+ _this.jVuN.lNUe(event, callback);
2131
3735
  });
2132
3736
  _defineProperty(this, "unregisterFromEvent", function (event, callback) {
2133
- _this.ymVO.unregisterFromEvent(event, callback);
3737
+ _this.jVuN.unregisterFromEvent(event, callback);
2134
3738
  });
2135
3739
  _defineProperty(this, "notifyEventListener", function (event) {
2136
- _this.ymVO.bhnD(event);
3740
+ _this.jVuN.KJki(event);
2137
3741
  });
2138
3742
  /**
2139
3743
  * Fetches the config from Server
@@ -2146,14 +3750,14 @@
2146
3750
  _defineProperty(this, "fetch", function (type, validateUrl, apiUrl, callback) {
2147
3751
  Apxor.getController().fetchConfiguration(type, validateUrl, apiUrl, callback);
2148
3752
  });
2149
- _defineProperty(this, "pHuQ", function () {
2150
- return _this.UnLY;
3753
+ _defineProperty(this, "Gpek", function () {
3754
+ return _this.akqR;
2151
3755
  });
2152
3756
  _defineProperty(this, "getCampaignMetaFromQueryEngine", function (campaignId) {
2153
- return _this.sqeD.ZNQa(campaignId);
3757
+ return _this.wxWE.EdXf(campaignId);
2154
3758
  });
2155
- _defineProperty(this, "cLOV", function () {
2156
- return _this.OmCk;
3759
+ _defineProperty(this, "AzVj", function () {
3760
+ return _this.nMjQ;
2157
3761
  });
2158
3762
  if (!CE.instance) {
2159
3763
  CE.instance = this;
@@ -2177,11 +3781,11 @@
2177
3781
  OVERALL: 0,
2178
3782
  DATES: {}
2179
3783
  };
2180
- if (this.OmCk) this._qeState[id].DATES[this.OmCk] = 0;
3784
+ if (this.nMjQ) this._qeState[id].DATES[this.nMjQ] = 0;
2181
3785
  this.setQeState(id);
2182
3786
  }
2183
3787
  } catch (e) {
2184
- Logger$b.error("Can not create the frequency count object:" + e);
3788
+ Logger$c.error("Can not create the frequency count object:" + e);
2185
3789
  }
2186
3790
  }
2187
3791
  }, {
@@ -2196,12 +3800,12 @@
2196
3800
 
2197
3801
  // Increment the DATES count for this particular date by 1. If the date changes reset.
2198
3802
  var currentDate = getDateInDDMMYYYY();
2199
- if (currentDate !== this.OmCk || !(configFrequency.DATES && configFrequency.DATES[currentDate])) {
2200
- this.OmCk = currentDate;
3803
+ if (currentDate !== this.nMjQ || !(configFrequency.DATES && configFrequency.DATES[currentDate])) {
3804
+ this.nMjQ = currentDate;
2201
3805
  configFrequency.DATES = {};
2202
- configFrequency.DATES[this.OmCk] = 0;
3806
+ configFrequency.DATES[this.nMjQ] = 0;
2203
3807
  }
2204
- configFrequency.DATES[this.OmCk] = configFrequency.DATES[this.OmCk] + 1;
3808
+ configFrequency.DATES[this.nMjQ] = configFrequency.DATES[this.nMjQ] + 1;
2205
3809
  }
2206
3810
  }], [{
2207
3811
  key: "getInstance",
@@ -2220,7 +3824,7 @@
2220
3824
 
2221
3825
  /* eslint-disable no-empty */
2222
3826
 
2223
- window.ceVersion = 180;
3827
+ window.ceVersion = 200;
2224
3828
  try {
2225
3829
  if (exports !== undefined || exports !== null) {
2226
3830
  exports["default"] = CE;