apxor-qe 1.2.4 → 1.4.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.
- package/dist/apxor.qe.js.bak +665 -358
- package/dist/apxor.qe.min.js +1 -1
- package/package.json +2 -2
package/dist/apxor.qe.js.bak
CHANGED
|
@@ -175,6 +175,14 @@
|
|
|
175
175
|
return String.fromCharCode(c ^ keyCharAt(key, i));
|
|
176
176
|
}).join("");
|
|
177
177
|
}
|
|
178
|
+
function stringToArrayBuffer(str) {
|
|
179
|
+
var buffer = new ArrayBuffer(str.length);
|
|
180
|
+
var view = new Uint8Array(buffer);
|
|
181
|
+
for (var i = 0; i < str.length; i++) {
|
|
182
|
+
view[i] = str.charCodeAt(i);
|
|
183
|
+
}
|
|
184
|
+
return buffer;
|
|
185
|
+
}
|
|
178
186
|
var decode = function decode(key, data) {
|
|
179
187
|
data = b64_decode(data);
|
|
180
188
|
return xor_decrypt(key, data);
|
|
@@ -195,7 +203,7 @@
|
|
|
195
203
|
var toUpperCase = function toUpperCase(key) {
|
|
196
204
|
return key.toUpperCase();
|
|
197
205
|
};
|
|
198
|
-
var
|
|
206
|
+
var qjgz = function qjgz(actual, expected, operator) {
|
|
199
207
|
switch (operator) {
|
|
200
208
|
case "EQ":
|
|
201
209
|
return actual === expected;
|
|
@@ -234,20 +242,38 @@
|
|
|
234
242
|
return dateDDMMYYYY;
|
|
235
243
|
};
|
|
236
244
|
|
|
245
|
+
/**
|
|
246
|
+
* @function getDateInMMDDYYYY
|
|
247
|
+
* @description Returns the current date in MM/DD/YYYY Format
|
|
248
|
+
* @returns {string}
|
|
249
|
+
*/
|
|
250
|
+
var getDateInMMDDYYYY = function getDateInMMDDYYYY() {
|
|
251
|
+
var currentDate = new Date();
|
|
252
|
+
var dateDDMMYYYY = currentDate.getMonth() + "/" + currentDate.getDate() + "/" + currentDate.getFullYear();
|
|
253
|
+
return dateDDMMYYYY;
|
|
254
|
+
};
|
|
255
|
+
var _getTime = function _getTime() {
|
|
256
|
+
var currentTime = new Date();
|
|
257
|
+
return {
|
|
258
|
+
hours: currentTime.getHours(),
|
|
259
|
+
mins: currentTime.getMinutes()
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
|
|
237
263
|
var Logger = window.ApxorLogger;
|
|
238
264
|
var Audience = /*#__PURE__*/_createClass(function Audience() {
|
|
239
265
|
var _this = this;
|
|
240
266
|
_classCallCheck(this, Audience);
|
|
241
|
-
_defineProperty(this, "
|
|
242
|
-
_defineProperty(this, "
|
|
243
|
-
_defineProperty(this, "
|
|
267
|
+
_defineProperty(this, "pfyk", "ALL");
|
|
268
|
+
_defineProperty(this, "oyin", []);
|
|
269
|
+
_defineProperty(this, "Pifw", []);
|
|
244
270
|
_defineProperty(this, "parse", function () {
|
|
245
271
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
246
272
|
try {
|
|
247
|
-
_this.
|
|
248
|
-
_this.
|
|
249
|
-
_this.
|
|
250
|
-
if (!Array.isArray(_this.
|
|
273
|
+
_this.pfyk = config.audience.audience_type;
|
|
274
|
+
_this.oyin = config.audience.attributes.user;
|
|
275
|
+
_this.Pifw = config.audience.attributes.session;
|
|
276
|
+
if (!Array.isArray(_this.oyin) || !Array.isArray(_this.Pifw)) {
|
|
251
277
|
Logger.error("No attributes");
|
|
252
278
|
return false;
|
|
253
279
|
}
|
|
@@ -259,12 +285,12 @@
|
|
|
259
285
|
});
|
|
260
286
|
_defineProperty(this, "validate", function (user, session) {
|
|
261
287
|
var status = true;
|
|
262
|
-
if (_this.
|
|
288
|
+
if (_this.pfyk === "FTU") {
|
|
263
289
|
status = Apxor.getController().getSessionInfo().is_first_session;
|
|
264
290
|
}
|
|
265
|
-
return status && _this.
|
|
291
|
+
return status && _this.larY(user, _this.oyin) && _this.larY(session, _this.Pifw);
|
|
266
292
|
});
|
|
267
|
-
_defineProperty(this, "
|
|
293
|
+
_defineProperty(this, "larY", function (attributes, expected) {
|
|
268
294
|
var length = expected.length;
|
|
269
295
|
var status = true;
|
|
270
296
|
try {
|
|
@@ -294,7 +320,7 @@
|
|
|
294
320
|
}
|
|
295
321
|
var match = loggedValues.some(function (loggedValue) {
|
|
296
322
|
return values.some(function (configValue) {
|
|
297
|
-
return
|
|
323
|
+
return qjgz(loggedValue, configValue, operator);
|
|
298
324
|
});
|
|
299
325
|
});
|
|
300
326
|
status = status && match;
|
|
@@ -316,34 +342,37 @@
|
|
|
316
342
|
var Frequency = /*#__PURE__*/_createClass(function Frequency() {
|
|
317
343
|
var _this = this;
|
|
318
344
|
_classCallCheck(this, Frequency);
|
|
319
|
-
_defineProperty(this, "
|
|
320
|
-
_defineProperty(this, "
|
|
321
|
-
_defineProperty(this, "
|
|
322
|
-
_defineProperty(this, "
|
|
323
|
-
_defineProperty(this, "
|
|
324
|
-
_defineProperty(this, "
|
|
345
|
+
_defineProperty(this, "kedV", 0);
|
|
346
|
+
_defineProperty(this, "VSmt", 0);
|
|
347
|
+
_defineProperty(this, "YTxk", "SESSION");
|
|
348
|
+
_defineProperty(this, "zwPH", 0);
|
|
349
|
+
_defineProperty(this, "gMHQ", 0);
|
|
350
|
+
_defineProperty(this, "amzH", 0);
|
|
325
351
|
_defineProperty(this, "parse", function () {
|
|
326
352
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
327
353
|
try {
|
|
328
|
-
_this.
|
|
329
|
-
_this.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
_this.
|
|
354
|
+
_this.kedV = config.frequency.count;
|
|
355
|
+
if (_this.kedV === -1) {
|
|
356
|
+
_this.kedV = 1000;
|
|
357
|
+
}
|
|
358
|
+
_this.amzH = _this.kedV;
|
|
359
|
+
_this.VSmt = config.frequency.time_interval;
|
|
360
|
+
_this.YTxk = config.frequency.validity;
|
|
361
|
+
_this.gMHQ = config.frequency.ses_lmt;
|
|
333
362
|
_this._dayCount = config.frequency.day_lmt;
|
|
334
363
|
// let data = Apxor.getController().getFromStorage(QE_STATE);
|
|
335
364
|
// let qe_state = JSON.parse(decode(Apxor.getSiteId(), data));
|
|
336
365
|
var qe_state = CE.getInstance().getQeState();
|
|
337
366
|
if (!isDefined(qe_state) || !isDefined(qe_state[config._id])) return true;
|
|
338
|
-
if (_this.
|
|
339
|
-
_this.
|
|
340
|
-
if (_this.
|
|
367
|
+
if (_this.YTxk === "SESSION") {
|
|
368
|
+
_this.kedV = parseInt(_this.kedV) - parseInt(qe_state[config._id]["SESSION"]);
|
|
369
|
+
if (_this.kedV <= 0) {
|
|
341
370
|
console.warn("Max count limit reached for session:" + config._id);
|
|
342
371
|
return false;
|
|
343
372
|
}
|
|
344
|
-
} else if (_this.
|
|
345
|
-
_this.
|
|
346
|
-
if (_this.
|
|
373
|
+
} else if (_this.YTxk === "OVERALL") {
|
|
374
|
+
_this.kedV = parseInt(_this.kedV) - parseInt(qe_state[config._id]["OVERALL"]);
|
|
375
|
+
if (_this.kedV <= 0) {
|
|
347
376
|
console.warn("Max count limit reached for overall:" + config._id);
|
|
348
377
|
return false;
|
|
349
378
|
}
|
|
@@ -357,28 +386,28 @@
|
|
|
357
386
|
}
|
|
358
387
|
return true;
|
|
359
388
|
});
|
|
360
|
-
_defineProperty(this, "
|
|
361
|
-
_this.
|
|
389
|
+
_defineProperty(this, "oDrA", function () {
|
|
390
|
+
_this.kedV = _this.kedV - 1;
|
|
362
391
|
});
|
|
363
392
|
_defineProperty(this, "getFrequencyCount", function () {
|
|
364
|
-
return _this.
|
|
393
|
+
return _this.kedV;
|
|
365
394
|
});
|
|
366
|
-
_defineProperty(this, "
|
|
367
|
-
if (_this.
|
|
368
|
-
_this.
|
|
395
|
+
_defineProperty(this, "XbPF", function () {
|
|
396
|
+
if (_this.YTxk === "SESSION") {
|
|
397
|
+
_this.kedV = _this.amzH;
|
|
369
398
|
Logger$1.info("Campaign Limit reset");
|
|
370
399
|
}
|
|
371
400
|
});
|
|
372
401
|
/**
|
|
373
|
-
* @function
|
|
402
|
+
* @function WTEf
|
|
374
403
|
* @description Validates if the campaign count is with in the limits set in the config.
|
|
375
404
|
* @param {string} Config id
|
|
376
405
|
* @returns {boolean} true - If the Campaign limits are not reached
|
|
377
406
|
* false - Otherwise
|
|
378
407
|
*/
|
|
379
|
-
_defineProperty(this, "
|
|
408
|
+
_defineProperty(this, "WTEf", function (id) {
|
|
380
409
|
try {
|
|
381
|
-
if (_this.
|
|
410
|
+
if (_this.kedV <= 0) {
|
|
382
411
|
return false;
|
|
383
412
|
}
|
|
384
413
|
|
|
@@ -389,8 +418,8 @@
|
|
|
389
418
|
if (!isDefined(qe_state) || !isDefined(qe_state[id])) return true;
|
|
390
419
|
|
|
391
420
|
//If the config has a session count limit set
|
|
392
|
-
if (_this.
|
|
393
|
-
var sessionCountInConfig = parseInt(_this.
|
|
421
|
+
if (_this.gMHQ !== 0) {
|
|
422
|
+
var sessionCountInConfig = parseInt(_this.gMHQ);
|
|
394
423
|
var thisSessionCount = parseInt(qe_state[id]["SESSION"]);
|
|
395
424
|
if (sessionCountInConfig - thisSessionCount <= 0) {
|
|
396
425
|
return false;
|
|
@@ -417,14 +446,14 @@
|
|
|
417
446
|
var Meta = /*#__PURE__*/_createClass(function Meta() {
|
|
418
447
|
var _this = this;
|
|
419
448
|
_classCallCheck(this, Meta);
|
|
420
|
-
_defineProperty(this, "
|
|
421
|
-
_defineProperty(this, "
|
|
449
|
+
_defineProperty(this, "EDaN", "");
|
|
450
|
+
_defineProperty(this, "pfyk", "");
|
|
422
451
|
_defineProperty(this, "parse", function () {
|
|
423
452
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
424
453
|
try {
|
|
425
454
|
var _config$meta;
|
|
426
|
-
_this.
|
|
427
|
-
_this.
|
|
455
|
+
_this.EDaN = config.meta.name;
|
|
456
|
+
_this.pfyk = config.meta.type;
|
|
428
457
|
_this._only_context = config.meta.only_context;
|
|
429
458
|
_this._attr = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.attr) || {};
|
|
430
459
|
} catch (error) {
|
|
@@ -439,11 +468,11 @@
|
|
|
439
468
|
var Validity = /*#__PURE__*/_createClass(function Validity() {
|
|
440
469
|
var _this = this;
|
|
441
470
|
_classCallCheck(this, Validity);
|
|
442
|
-
_defineProperty(this, "
|
|
443
|
-
_defineProperty(this, "
|
|
444
|
-
_defineProperty(this, "
|
|
445
|
-
_defineProperty(this, "
|
|
446
|
-
_defineProperty(this, "
|
|
471
|
+
_defineProperty(this, "isju", -1);
|
|
472
|
+
_defineProperty(this, "eexF", -1);
|
|
473
|
+
_defineProperty(this, "Xmbz", -1);
|
|
474
|
+
_defineProperty(this, "IRGG", -1);
|
|
475
|
+
_defineProperty(this, "jPEb", false);
|
|
447
476
|
_defineProperty(this, "parse", function () {
|
|
448
477
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
449
478
|
try {
|
|
@@ -451,17 +480,17 @@
|
|
|
451
480
|
Logger$2.error("Not valid dates");
|
|
452
481
|
return false;
|
|
453
482
|
}
|
|
454
|
-
_this.
|
|
455
|
-
_this.
|
|
483
|
+
_this.isju = Date.parse(config.validity.start_date);
|
|
484
|
+
_this.eexF = Date.parse(config.validity.end_date);
|
|
456
485
|
if (isDefined(config.time_limits_in_day)) {
|
|
457
|
-
_this.
|
|
458
|
-
if (_this.
|
|
486
|
+
_this.jPEb = config.time_limits_in_day;
|
|
487
|
+
if (_this.jPEb && isDefined(config.time_limits)) {
|
|
459
488
|
var currentDate = new Date().toISOString().split("T")[0];
|
|
460
|
-
_this.
|
|
461
|
-
_this.
|
|
489
|
+
_this.Xmbz = Date.parse(currentDate + "T" + config.time_limits.start_time + ".000Z");
|
|
490
|
+
_this.IRGG = Date.parse(currentDate + "T" + config.time_limits.end_time + ".000Z");
|
|
462
491
|
|
|
463
492
|
// If invalid format is passed, return false
|
|
464
|
-
if (isNaN(_this.
|
|
493
|
+
if (isNaN(_this.Xmbz) || isNaN(_this.IRGG)) {
|
|
465
494
|
Logger$2.error("Not valid times");
|
|
466
495
|
return false;
|
|
467
496
|
}
|
|
@@ -475,8 +504,8 @@
|
|
|
475
504
|
});
|
|
476
505
|
_defineProperty(this, "validate", function () {
|
|
477
506
|
var currentTime = Date.now();
|
|
478
|
-
if (currentTime > _this.
|
|
479
|
-
return !_this.
|
|
507
|
+
if (currentTime > _this.isju && currentTime < _this.eexF) {
|
|
508
|
+
return !_this.jPEb || currentTime >= _this.Xmbz && currentTime <= _this.IRGG;
|
|
480
509
|
}
|
|
481
510
|
return false;
|
|
482
511
|
});
|
|
@@ -485,13 +514,13 @@
|
|
|
485
514
|
var Details = /*#__PURE__*/_createClass(function Details() {
|
|
486
515
|
var _this = this;
|
|
487
516
|
_classCallCheck(this, Details);
|
|
488
|
-
_defineProperty(this, "
|
|
489
|
-
_defineProperty(this, "
|
|
517
|
+
_defineProperty(this, "EDaN", "");
|
|
518
|
+
_defineProperty(this, "EpkX", {});
|
|
490
519
|
_defineProperty(this, "parse", function () {
|
|
491
520
|
var details = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
492
521
|
try {
|
|
493
|
-
_this.
|
|
494
|
-
_this.
|
|
522
|
+
_this.EDaN = details.name;
|
|
523
|
+
_this.EpkX = details.additional_info;
|
|
495
524
|
} catch (error) {
|
|
496
525
|
return false;
|
|
497
526
|
}
|
|
@@ -502,14 +531,14 @@
|
|
|
502
531
|
var Timebounds = /*#__PURE__*/_createClass(function Timebounds() {
|
|
503
532
|
var _this = this;
|
|
504
533
|
_classCallCheck(this, Timebounds);
|
|
505
|
-
_defineProperty(this, "
|
|
506
|
-
_defineProperty(this, "
|
|
534
|
+
_defineProperty(this, "vQNe", 0);
|
|
535
|
+
_defineProperty(this, "idSb", 0);
|
|
507
536
|
_defineProperty(this, "parse", function () {
|
|
508
537
|
var timeBounds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
509
538
|
try {
|
|
510
|
-
_this.
|
|
511
|
-
_this.
|
|
512
|
-
if (isNaN(_this.
|
|
539
|
+
_this.vQNe = Number(timeBounds.lower);
|
|
540
|
+
_this.idSb = Number(timeBounds.upper);
|
|
541
|
+
if (isNaN(_this.vQNe) || isNaN(_this.idSb)) {
|
|
513
542
|
return false;
|
|
514
543
|
}
|
|
515
544
|
} catch (error) {
|
|
@@ -522,17 +551,17 @@
|
|
|
522
551
|
var PreCondition = /*#__PURE__*/_createClass(function PreCondition() {
|
|
523
552
|
var _this = this;
|
|
524
553
|
_classCallCheck(this, PreCondition);
|
|
525
|
-
_defineProperty(this, "
|
|
526
|
-
_defineProperty(this, "
|
|
527
|
-
_defineProperty(this, "
|
|
528
|
-
_defineProperty(this, "
|
|
529
|
-
_defineProperty(this, "
|
|
554
|
+
_defineProperty(this, "dAXx", 0);
|
|
555
|
+
_defineProperty(this, "QksQ", "");
|
|
556
|
+
_defineProperty(this, "SmWY", "");
|
|
557
|
+
_defineProperty(this, "SbdV", new Details());
|
|
558
|
+
_defineProperty(this, "OuAR", new Timebounds());
|
|
530
559
|
_defineProperty(this, "parse", function () {
|
|
531
560
|
var precondition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
532
561
|
try {
|
|
533
|
-
_this.
|
|
534
|
-
_this.
|
|
535
|
-
return _this.
|
|
562
|
+
_this.QksQ = precondition.event_type;
|
|
563
|
+
_this.SmWY = precondition.activity;
|
|
564
|
+
return _this.SbdV.parse(precondition.details) && _this.OuAR.parse(precondition.time_bounds);
|
|
536
565
|
} catch (error) {
|
|
537
566
|
return false;
|
|
538
567
|
}
|
|
@@ -543,29 +572,29 @@
|
|
|
543
572
|
var Condition = /*#__PURE__*/_createClass(function Condition() {
|
|
544
573
|
var _this = this;
|
|
545
574
|
_classCallCheck(this, Condition);
|
|
546
|
-
_defineProperty(this, "
|
|
547
|
-
_defineProperty(this, "
|
|
548
|
-
_defineProperty(this, "
|
|
549
|
-
_defineProperty(this, "
|
|
550
|
-
_defineProperty(this, "
|
|
551
|
-
_defineProperty(this, "
|
|
552
|
-
_defineProperty(this, "
|
|
553
|
-
_defineProperty(this, "
|
|
554
|
-
_defineProperty(this, "
|
|
555
|
-
_defineProperty(this, "
|
|
556
|
-
_defineProperty(this, "
|
|
557
|
-
_defineProperty(this, "
|
|
575
|
+
_defineProperty(this, "dAXx", 0);
|
|
576
|
+
_defineProperty(this, "kVOA", -1);
|
|
577
|
+
_defineProperty(this, "kedV", 0);
|
|
578
|
+
_defineProperty(this, "oakv", "");
|
|
579
|
+
_defineProperty(this, "SmWY", "");
|
|
580
|
+
_defineProperty(this, "QksQ", "");
|
|
581
|
+
_defineProperty(this, "OuAR", new Timebounds());
|
|
582
|
+
_defineProperty(this, "SbdV", new Details());
|
|
583
|
+
_defineProperty(this, "YEhB", new PreCondition());
|
|
584
|
+
_defineProperty(this, "yHRM", "AND");
|
|
585
|
+
_defineProperty(this, "Pkry", false);
|
|
586
|
+
_defineProperty(this, "pfyk", void 0);
|
|
558
587
|
_defineProperty(this, "parse", function () {
|
|
559
588
|
var condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
560
589
|
try {
|
|
561
|
-
_this.
|
|
562
|
-
_this.
|
|
563
|
-
_this.
|
|
564
|
-
_this.
|
|
565
|
-
_this.
|
|
566
|
-
_this.
|
|
567
|
-
_this.
|
|
568
|
-
return _this.
|
|
590
|
+
_this.kVOA = condition.sequence;
|
|
591
|
+
_this.kedV = condition.count_config.count;
|
|
592
|
+
_this.oakv = condition.count_config.operator;
|
|
593
|
+
_this.SmWY = condition.activity;
|
|
594
|
+
_this.QksQ = condition.event_type;
|
|
595
|
+
_this.yHRM = condition.combine_operator;
|
|
596
|
+
_this.pfyk = condition.type;
|
|
597
|
+
return _this.SbdV.parse(condition.details) && _this.YEhB.parse(condition.trigger) && _this.OuAR.parse(condition.time_bounds);
|
|
569
598
|
} catch (error) {
|
|
570
599
|
Logger$3.error(error);
|
|
571
600
|
return false;
|
|
@@ -573,25 +602,51 @@
|
|
|
573
602
|
});
|
|
574
603
|
});
|
|
575
604
|
|
|
576
|
-
/* eslint-disable no-unused-vars */
|
|
577
605
|
var Logger$4 = window.ApxorLogger;
|
|
606
|
+
var GoalEvent = /*#__PURE__*/_createClass(function GoalEvent() {
|
|
607
|
+
var _this = this;
|
|
608
|
+
_classCallCheck(this, GoalEvent);
|
|
609
|
+
_defineProperty(this, "kedV", 0);
|
|
610
|
+
_defineProperty(this, "oakv", "");
|
|
611
|
+
_defineProperty(this, "QksQ", "");
|
|
612
|
+
_defineProperty(this, "OuAR", new Timebounds());
|
|
613
|
+
_defineProperty(this, "SbdV", new Details());
|
|
614
|
+
_defineProperty(this, "yHRM", "AND");
|
|
615
|
+
_defineProperty(this, "parse", function (data) {
|
|
616
|
+
try {
|
|
617
|
+
_this.kedV = data.count_config.count;
|
|
618
|
+
_this.oakv = data.count_config.operator;
|
|
619
|
+
_this.QksQ = data.event_type;
|
|
620
|
+
_this.yHRM = data.combine_operator;
|
|
621
|
+
return _this.SbdV.parse(data.details) && _this.OuAR.parse(data.time_bounds);
|
|
622
|
+
} catch (error) {
|
|
623
|
+
Logger$4.error(error);
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
/* eslint-disable no-unused-vars */
|
|
630
|
+
var Logger$5 = window.ApxorLogger;
|
|
578
631
|
var ConditionValidator = /*#__PURE__*/function () {
|
|
579
632
|
function ConditionValidator() {
|
|
580
633
|
var _this = this;
|
|
581
634
|
_classCallCheck(this, ConditionValidator);
|
|
582
|
-
_defineProperty(this, "
|
|
583
|
-
_defineProperty(this, "
|
|
584
|
-
_defineProperty(this, "
|
|
585
|
-
_defineProperty(this, "
|
|
586
|
-
_defineProperty(this, "
|
|
587
|
-
_defineProperty(this, "
|
|
588
|
-
_defineProperty(this, "
|
|
589
|
-
_defineProperty(this, "
|
|
590
|
-
_defineProperty(this, "
|
|
591
|
-
_defineProperty(this, "
|
|
592
|
-
_defineProperty(this, "
|
|
635
|
+
_defineProperty(this, "XsTp", 0);
|
|
636
|
+
_defineProperty(this, "jaGt", "");
|
|
637
|
+
_defineProperty(this, "qXKr", new Condition());
|
|
638
|
+
_defineProperty(this, "yIMt", new GoalEvent());
|
|
639
|
+
_defineProperty(this, "gZba", false);
|
|
640
|
+
_defineProperty(this, "HPUo", false);
|
|
641
|
+
_defineProperty(this, "RIDN", 0);
|
|
642
|
+
_defineProperty(this, "yHRM", "AND");
|
|
643
|
+
_defineProperty(this, "mCal", "OR");
|
|
644
|
+
_defineProperty(this, "fTSz", -1);
|
|
645
|
+
_defineProperty(this, "eiXR", []);
|
|
646
|
+
_defineProperty(this, "JfUj", {});
|
|
647
|
+
_defineProperty(this, "rduQ", false);
|
|
593
648
|
/**
|
|
594
|
-
* If respectSequence is true, don't auto-
|
|
649
|
+
* If respectSequence is true, don't auto-OJSD to events except for the condition whose index is 0
|
|
595
650
|
*
|
|
596
651
|
* @param condition
|
|
597
652
|
* @param type
|
|
@@ -606,155 +661,181 @@
|
|
|
606
661
|
var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
607
662
|
var respectSequence = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
608
663
|
var noKpiArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
609
|
-
|
|
610
|
-
_this.
|
|
611
|
-
_this.
|
|
612
|
-
|
|
613
|
-
if (
|
|
614
|
-
|
|
664
|
+
var flag = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "";
|
|
665
|
+
_this.jaGt = id;
|
|
666
|
+
_this.RIDN = index;
|
|
667
|
+
_this.eiXR = noKpiArray;
|
|
668
|
+
if (flag !== "termination" || flag === "") {
|
|
669
|
+
var result = _this.qXKr.parse(condition);
|
|
670
|
+
if (result) {
|
|
671
|
+
_this.yHRM = _this.qXKr.yHRM;
|
|
615
672
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
673
|
+
// FIXME: Why this code is written? Don't see any usecase
|
|
674
|
+
if (_this.qXKr.Pkry) {
|
|
675
|
+
var eventName = _this.qXKr.SbdV.EDaN;
|
|
676
|
+
if (eventName === "APX_PAGE_OPENED") {
|
|
677
|
+
eventName = _this.qXKr.SbdV.EpkX["navigation_id"];
|
|
678
|
+
eventName = isDefined(eventName) ? eventName : _this.qXKr.SbdV.EDaN;
|
|
679
|
+
}
|
|
680
|
+
_this.fTSz = Apxor.getController().getEventCount(eventName);
|
|
681
|
+
var count = _this.qXKr.kedV;
|
|
682
|
+
var operator = _this.qXKr.oakv;
|
|
683
|
+
_this.HPUo = _this.jjDO(_this.fTSz - 1, count, operator, false);
|
|
684
|
+
_this.gZba = _this.HPUo;
|
|
685
|
+
// If the condition is already satisfied and if it is page view, no need to OJSD
|
|
686
|
+
// This only applies for NAVIGATION_EVENTS
|
|
687
|
+
if (_this.HPUo && _this.qXKr.SbdV.EDaN === "APX_PAGE_OPENED") {
|
|
688
|
+
return true;
|
|
689
|
+
}
|
|
622
690
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
var operator = _this.kTpA.GFOB;
|
|
626
|
-
_this.mOYl = _this.TnSn(_this.AdbQ - 1, count, operator, false);
|
|
627
|
-
_this.LeeG = _this.mOYl;
|
|
628
|
-
// If the condition is already satisfied and if it is page view, no need to UPYl
|
|
629
|
-
// This only applies for NAVIGATION_EVENTS
|
|
630
|
-
if (_this.mOYl && _this.kTpA.QrLp.KsvN === "APX_PAGE_OPENED") {
|
|
631
|
-
return true;
|
|
691
|
+
if (!respectSequence || index === 0) {
|
|
692
|
+
_this.OJSD();
|
|
632
693
|
}
|
|
694
|
+
return true;
|
|
633
695
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
696
|
+
} else {
|
|
697
|
+
var _result = _this.yIMt.parse(condition);
|
|
698
|
+
_this.mCal = _this.yIMt.yHRM;
|
|
699
|
+
_this.IIJM();
|
|
637
700
|
return true;
|
|
638
701
|
}
|
|
639
702
|
return false;
|
|
640
703
|
});
|
|
641
|
-
_defineProperty(this, "
|
|
642
|
-
var condition = _this.
|
|
643
|
-
var precondition = condition.
|
|
704
|
+
_defineProperty(this, "OJSD", function () {
|
|
705
|
+
var condition = _this.qXKr;
|
|
706
|
+
var precondition = condition.YEhB;
|
|
644
707
|
var ceInstance = CE.getInstance();
|
|
645
|
-
if (precondition.
|
|
646
|
-
_this.
|
|
647
|
-
ceInstance.registerForEvent(generateKey(condition.
|
|
708
|
+
if (precondition.QksQ === "app_start") {
|
|
709
|
+
_this.gZba = true;
|
|
710
|
+
ceInstance.registerForEvent(generateKey(condition.QksQ) + "___" + condition.SbdV.EDaN, _this.vJpn);
|
|
648
711
|
} else {
|
|
649
|
-
ceInstance.registerForEvent(generateKey(condition.
|
|
712
|
+
ceInstance.registerForEvent(generateKey(condition.QksQ) + "___" + precondition.SbdV.EDaN, _this.vJpn);
|
|
650
713
|
}
|
|
651
714
|
});
|
|
652
|
-
_defineProperty(this, "
|
|
653
|
-
var _this
|
|
715
|
+
_defineProperty(this, "IIJM", function () {
|
|
716
|
+
var condition = _this.yIMt;
|
|
717
|
+
var ceInstance = CE.getInstance();
|
|
718
|
+
_this.gZba = true;
|
|
719
|
+
ceInstance.registerForEvent(generateKey(condition.QksQ) + "___" + condition.SbdV.EDaN, _this.nTnW);
|
|
720
|
+
});
|
|
721
|
+
_defineProperty(this, "aZcq", function (type, name, time, additionalInfo) {
|
|
722
|
+
var _this$qXKr;
|
|
654
723
|
var eventTime = Date.now();
|
|
655
|
-
var time_differnce = (eventTime - _this.
|
|
656
|
-
var time_fromConfig = ((_this$
|
|
724
|
+
var time_differnce = (eventTime - _this.JfUj[name]) / 1000;
|
|
725
|
+
var time_fromConfig = ((_this$qXKr = _this.qXKr) === null || _this$qXKr === void 0 || (_this$qXKr = _this$qXKr.SbdV) === null || _this$qXKr === void 0 || (_this$qXKr = _this$qXKr.EpkX) === null || _this$qXKr === void 0 ? void 0 : _this$qXKr.time) / 1000;
|
|
657
726
|
if (time_fromConfig > time_differnce) {
|
|
658
727
|
_this._displayCampaign(time);
|
|
659
728
|
}
|
|
660
729
|
});
|
|
661
|
-
_defineProperty(this, "
|
|
730
|
+
_defineProperty(this, "EfFk", function (type, name, time, additionalInfo) {
|
|
662
731
|
var _this$_condition2, _this$_condition3;
|
|
663
|
-
_this.
|
|
732
|
+
_this.rduQ = true;
|
|
664
733
|
var currentTime = Date.now();
|
|
665
|
-
var eventName = (_this$_condition2 = _this.
|
|
666
|
-
var eventTime = _this.
|
|
734
|
+
var eventName = (_this$_condition2 = _this.qXKr) === null || _this$_condition2 === void 0 || (_this$_condition2 = _this$_condition2.YEhB) === null || _this$_condition2 === void 0 ? void 0 : _this$_condition2.SbdV.EDaN;
|
|
735
|
+
var eventTime = _this.JfUj[eventName];
|
|
667
736
|
var time_differnce = (currentTime - eventTime) / 1000;
|
|
668
|
-
var time_fromConfig = (_this$_condition3 = _this.
|
|
737
|
+
var time_fromConfig = (_this$_condition3 = _this.qXKr) === null || _this$_condition3 === void 0 || (_this$_condition3 = _this$_condition3.SbdV) === null || _this$_condition3 === void 0 || (_this$_condition3 = _this$_condition3.EpkX) === null || _this$_condition3 === void 0 ? void 0 : _this$_condition3.time;
|
|
669
738
|
time_fromConfig = time_fromConfig / 1000;
|
|
670
739
|
if (time_fromConfig > time_differnce) {
|
|
671
740
|
_this._displayCampaign(time);
|
|
672
741
|
}
|
|
673
742
|
//unregister the event
|
|
674
743
|
});
|
|
675
|
-
_defineProperty(this, "
|
|
744
|
+
_defineProperty(this, "vJpn", function (type, name, time, additionalInfo) {
|
|
676
745
|
var ceInstance = CE.getInstance();
|
|
677
|
-
if (!_this.
|
|
746
|
+
if (!_this.gZba) {
|
|
678
747
|
// Validate Precondition
|
|
679
|
-
_this.
|
|
680
|
-
if (_this.
|
|
681
|
-
var condition = _this.
|
|
682
|
-
var precondition = condition.
|
|
683
|
-
precondition.
|
|
748
|
+
_this.gZba = _this.alII(type, name, time, additionalInfo);
|
|
749
|
+
if (_this.gZba) {
|
|
750
|
+
var condition = _this.qXKr;
|
|
751
|
+
var precondition = condition.YEhB;
|
|
752
|
+
precondition.dAXx = time;
|
|
684
753
|
//events will be registred by its type activity event_type: "activity_time"
|
|
685
|
-
if ((condition === null || condition === void 0 ? void 0 : condition.
|
|
686
|
-
var
|
|
687
|
-
var event_time = condition === null || condition === void 0 || (
|
|
688
|
-
if ((condition === null || condition === void 0 || (
|
|
754
|
+
if ((condition === null || condition === void 0 ? void 0 : condition.QksQ) === "activity_time") {
|
|
755
|
+
var qXKr$SbdV, qXKr$_details2, qXKr$_details3;
|
|
756
|
+
var event_time = condition === null || condition === void 0 || (qXKr$SbdV = condition.SbdV) === null || qXKr$SbdV === void 0 || (qXKr$SbdV = qXKr$SbdV.EpkX) === null || qXKr$SbdV === void 0 ? void 0 : qXKr$SbdV.time;
|
|
757
|
+
if ((condition === null || condition === void 0 || (qXKr$_details2 = condition.SbdV) === null || qXKr$_details2 === void 0 || (qXKr$_details2 = qXKr$_details2.EpkX) === null || qXKr$_details2 === void 0 ? void 0 : qXKr$_details2.nkpi.length) > 0) {
|
|
689
758
|
setTimeout(function () {
|
|
690
|
-
if (!_this.
|
|
691
|
-
_this.
|
|
692
|
-
if (_this.
|
|
693
|
-
_this.
|
|
694
|
-
_this.
|
|
695
|
-
if (_this.
|
|
696
|
-
_this.
|
|
697
|
-
ceInstance.validate(_this.
|
|
759
|
+
if (!_this.rduQ) {
|
|
760
|
+
_this.HPUo = true;
|
|
761
|
+
if (_this.HPUo) {
|
|
762
|
+
_this.XsTp += 1;
|
|
763
|
+
_this.HPUo = _this.jjDO(_this.XsTp, _this.qXKr.kedV, _this.qXKr.oakv);
|
|
764
|
+
if (_this.HPUo) {
|
|
765
|
+
_this.qXKr.dAXx = time;
|
|
766
|
+
ceInstance.validate(_this.jaGt, _this.RIDN);
|
|
698
767
|
}
|
|
699
768
|
}
|
|
700
769
|
}
|
|
701
|
-
condition.
|
|
702
|
-
ceInstance.unregisterFromEvent(toUpperCase(condition.
|
|
770
|
+
condition.SbdV.EpkX.nkpi.map(function (nokpi) {
|
|
771
|
+
ceInstance.unregisterFromEvent(toUpperCase(condition.SbdV.EpkX.et) + "___" + nokpi, _this);
|
|
703
772
|
});
|
|
704
773
|
}, event_time);
|
|
705
|
-
condition.
|
|
706
|
-
ceInstance.registerForEvent(toUpperCase(condition.
|
|
774
|
+
condition.SbdV.EpkX.nkpi.map(function (nokpi) {
|
|
775
|
+
ceInstance.registerForEvent(toUpperCase(condition.SbdV.EpkX.et) + "___" + nokpi, _this.EfFk);
|
|
707
776
|
});
|
|
708
777
|
}
|
|
709
778
|
//it is for unregistering the events did case after completing the time imit
|
|
710
|
-
if ((condition === null || condition === void 0 || (
|
|
779
|
+
if ((condition === null || condition === void 0 || (qXKr$_details3 = condition.SbdV) === null || qXKr$_details3 === void 0 || (qXKr$_details3 = qXKr$_details3.EpkX) === null || qXKr$_details3 === void 0 ? void 0 : qXKr$_details3.kpi.length) > 0) {
|
|
711
780
|
setTimeout(function () {
|
|
712
|
-
condition.
|
|
713
|
-
ceInstance.unregisterFromEvent(toUpperCase(condition.
|
|
781
|
+
condition.SbdV.EpkX.kpi.map(function (kpi) {
|
|
782
|
+
ceInstance.unregisterFromEvent(toUpperCase(condition.SbdV.EpkX.et) + "___" + kpi, _this);
|
|
714
783
|
});
|
|
715
784
|
}, event_time);
|
|
716
|
-
condition.
|
|
717
|
-
if (kpi === condition.
|
|
785
|
+
condition.SbdV.EpkX.kpi.map(function (kpi) {
|
|
786
|
+
if (kpi === condition.YEhB.SbdV.EDaN) {
|
|
718
787
|
//unregister the previous event
|
|
719
|
-
ceInstance.unregisterFromEvent(generateKey(precondition.
|
|
720
|
-
ceInstance.registerForEvent(toUpperCase(condition.
|
|
788
|
+
ceInstance.unregisterFromEvent(generateKey(precondition.QksQ) + "___" + precondition.SbdV.EDaN, _this);
|
|
789
|
+
ceInstance.registerForEvent(toUpperCase(condition.SbdV.EpkX.et) + "___" + kpi, _this.aZcq);
|
|
721
790
|
} else {
|
|
722
|
-
ceInstance.registerForEvent(toUpperCase(condition.
|
|
791
|
+
ceInstance.registerForEvent(toUpperCase(condition.SbdV.EpkX.et) + "___" + kpi, _this.EfFk);
|
|
723
792
|
}
|
|
724
793
|
});
|
|
725
794
|
}
|
|
726
795
|
} else {
|
|
727
|
-
ceInstance.unregisterFromEvent(generateKey(precondition.
|
|
728
|
-
ceInstance.registerForEvent(generateKey(condition.
|
|
796
|
+
ceInstance.unregisterFromEvent(generateKey(precondition.QksQ) + "___" + precondition.SbdV.EDaN, _this);
|
|
797
|
+
ceInstance.registerForEvent(generateKey(condition.QksQ) + "___" + condition.SbdV.EDaN, _this);
|
|
729
798
|
}
|
|
730
|
-
_this.
|
|
799
|
+
_this.JfUj[name] = Date.now();
|
|
731
800
|
}
|
|
732
801
|
return;
|
|
733
802
|
}
|
|
734
803
|
|
|
735
804
|
// Validate Condition
|
|
736
|
-
var validationStatus = generateKey(_this.
|
|
805
|
+
var validationStatus = generateKey(_this.qXKr.QksQ) === type && _this.oLnh(time - _this.qXKr.YEhB.dAXx, _this.qXKr.OuAR) && _this.qXKr.SbdV.EDaN === name && _this.MUef(_this.qXKr.SbdV.EpkX, additionalInfo);
|
|
806
|
+
if (validationStatus) {
|
|
807
|
+
_this.XsTp += 1;
|
|
808
|
+
_this.HPUo = _this.jjDO(_this.XsTp, _this.qXKr.kedV, _this.qXKr.oakv);
|
|
809
|
+
if (_this.HPUo) {
|
|
810
|
+
_this.qXKr.dAXx = time;
|
|
811
|
+
ceInstance.validate(_this.jaGt, _this.RIDN);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
_defineProperty(this, "nTnW", function (type, name, time, additionalInfo) {
|
|
816
|
+
var ceInstance = CE.getInstance();
|
|
817
|
+
var validationStatus = generateKey(_this.yIMt.QksQ) === type && _this.oLnh(time, _this.yIMt.OuAR) && _this.yIMt.SbdV.EDaN === name && _this.MUef(_this.yIMt.SbdV.EpkX, additionalInfo);
|
|
737
818
|
if (validationStatus) {
|
|
738
|
-
_this.
|
|
739
|
-
_this.
|
|
740
|
-
if (_this.
|
|
741
|
-
_this.
|
|
742
|
-
ceInstance.
|
|
819
|
+
_this.XsTp += 1;
|
|
820
|
+
_this.HPUo = _this.jjDO(_this.XsTp, _this.yIMt.kedV, _this.yIMt.oakv);
|
|
821
|
+
if (_this.HPUo) {
|
|
822
|
+
_this.yIMt.dAXx = time;
|
|
823
|
+
ceInstance.validateForTermination(_this.jaGt, _this.RIDN);
|
|
743
824
|
}
|
|
744
825
|
}
|
|
745
826
|
});
|
|
746
|
-
_defineProperty(this, "
|
|
747
|
-
var precondition = _this.
|
|
748
|
-
return generateKey(precondition.
|
|
827
|
+
_defineProperty(this, "alII", function (type, name, time, additionalInfo) {
|
|
828
|
+
var precondition = _this.qXKr.YEhB;
|
|
829
|
+
return generateKey(precondition.QksQ) === type && precondition.SbdV.EDaN === name && _this.oLnh(time, precondition.OuAR) && _this.MUef(precondition.SbdV.EpkX, additionalInfo);
|
|
749
830
|
});
|
|
750
|
-
_defineProperty(this, "
|
|
831
|
+
_defineProperty(this, "oLnh", function (time, timeBounds) {
|
|
751
832
|
var currentTime = Math.ceil(time);
|
|
752
|
-
return currentTime > timeBounds.
|
|
833
|
+
return currentTime > timeBounds.vQNe && currentTime < timeBounds.idSb;
|
|
753
834
|
});
|
|
754
|
-
_defineProperty(this, "
|
|
835
|
+
_defineProperty(this, "jjDO", function (current, required, operator) {
|
|
755
836
|
var checkOld = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
756
|
-
if (checkOld && _this.
|
|
757
|
-
current = current + _this.
|
|
837
|
+
if (checkOld && _this.qXKr.Pkry) {
|
|
838
|
+
current = current + _this.fTSz;
|
|
758
839
|
}
|
|
759
840
|
switch (operator) {
|
|
760
841
|
case "EQ":
|
|
@@ -771,7 +852,7 @@
|
|
|
771
852
|
return false;
|
|
772
853
|
}
|
|
773
854
|
});
|
|
774
|
-
_defineProperty(this, "
|
|
855
|
+
_defineProperty(this, "MUef", function (expected, received) {
|
|
775
856
|
var status = true;
|
|
776
857
|
try {
|
|
777
858
|
var _loop = function _loop() {
|
|
@@ -796,11 +877,11 @@
|
|
|
796
877
|
loggedValues = [received[item]];
|
|
797
878
|
}
|
|
798
879
|
var match = loggedValues.some(function (loggedValue) {
|
|
799
|
-
return
|
|
880
|
+
return qjgz(loggedValue, expectedValue, operator);
|
|
800
881
|
});
|
|
801
882
|
status = status && match;
|
|
802
883
|
} else {
|
|
803
|
-
status = status &&
|
|
884
|
+
status = status && qjgz(received[item], expected[item], "EQ");
|
|
804
885
|
}
|
|
805
886
|
},
|
|
806
887
|
_ret;
|
|
@@ -809,7 +890,7 @@
|
|
|
809
890
|
if (_ret) return _ret.v;
|
|
810
891
|
}
|
|
811
892
|
} catch (error) {
|
|
812
|
-
Logger$
|
|
893
|
+
Logger$5.error(error);
|
|
813
894
|
status = false;
|
|
814
895
|
}
|
|
815
896
|
return status;
|
|
@@ -819,13 +900,13 @@
|
|
|
819
900
|
key: "_displayCampaign",
|
|
820
901
|
value: function _displayCampaign(time) {
|
|
821
902
|
var ceInstance = CE.getInstance();
|
|
822
|
-
this.
|
|
823
|
-
if (this.
|
|
824
|
-
this.
|
|
825
|
-
this.
|
|
826
|
-
if (this.
|
|
827
|
-
this.
|
|
828
|
-
ceInstance.validate(this.
|
|
903
|
+
this.HPUo = true;
|
|
904
|
+
if (this.HPUo) {
|
|
905
|
+
this.XsTp += 1;
|
|
906
|
+
this.HPUo = this.jjDO(this.XsTp, this.qXKr.kedV, this.qXKr.oakv);
|
|
907
|
+
if (this.HPUo) {
|
|
908
|
+
this.qXKr.dAXx = time;
|
|
909
|
+
ceInstance.validate(this.jaGt, this.RIDN);
|
|
829
910
|
}
|
|
830
911
|
}
|
|
831
912
|
}
|
|
@@ -838,26 +919,26 @@
|
|
|
838
919
|
var APX_RETAINED_DAYS = "apx_retained_days";
|
|
839
920
|
var APX_CONTEXT_EVALUATED = "apx_context_evaluated";
|
|
840
921
|
|
|
841
|
-
var Logger$
|
|
922
|
+
var Logger$6 = window.ApxorLogger;
|
|
842
923
|
var OverallConfig = /*#__PURE__*/_createClass(function OverallConfig() {
|
|
843
924
|
var _this = this;
|
|
844
925
|
_classCallCheck(this, OverallConfig);
|
|
845
|
-
_defineProperty(this, "
|
|
926
|
+
_defineProperty(this, "kgNo", []);
|
|
846
927
|
_defineProperty(this, "_ret_day", {});
|
|
847
|
-
_defineProperty(this, "
|
|
848
|
-
_defineProperty(this, "
|
|
849
|
-
_defineProperty(this, "
|
|
928
|
+
_defineProperty(this, "mequ", {});
|
|
929
|
+
_defineProperty(this, "CRUL", false);
|
|
930
|
+
_defineProperty(this, "mxWo", false);
|
|
850
931
|
_defineProperty(this, "parse", function () {
|
|
851
932
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
852
933
|
try {
|
|
853
|
-
_this.
|
|
934
|
+
_this.kgNo = config.overall_cfg.events;
|
|
854
935
|
_this._ret_day = config.overall_cfg.ret_day;
|
|
855
|
-
_this.
|
|
856
|
-
_this.
|
|
857
|
-
_this.
|
|
858
|
-
_this.
|
|
936
|
+
_this.mequ = config.overall_cfg.session;
|
|
937
|
+
_this.CRUL = config.overall_cfg.toggleRetDay;
|
|
938
|
+
_this.kgNo = config.overall_cfg.events;
|
|
939
|
+
_this.mxWo = config.overall_cfg.toggleSession;
|
|
859
940
|
} catch (error) {
|
|
860
|
-
Logger$
|
|
941
|
+
Logger$6.error(error);
|
|
861
942
|
return false;
|
|
862
943
|
}
|
|
863
944
|
return true;
|
|
@@ -865,71 +946,214 @@
|
|
|
865
946
|
_defineProperty(this, "validate", function () {
|
|
866
947
|
var retainedDays = parseInt(Apxor.getController().getFromStorage(APX_RETAINED_DAYS));
|
|
867
948
|
var retainedSession = parseInt(Apxor.getController().getFromStorage(APX_RETAINED_SESSIONS));
|
|
868
|
-
if (_this.
|
|
949
|
+
if (_this.CRUL && !isNaN(retainedDays) && !(retainedDays >= _this._ret_day.from && retainedDays <= _this._ret_day.to)) {
|
|
869
950
|
return false;
|
|
870
951
|
}
|
|
871
|
-
if (_this.
|
|
952
|
+
if (_this.mxWo && !isNaN(retainedSession) && !(retainedSession >= _this.mequ.from && retainedSession <= _this.mequ.to)) {
|
|
872
953
|
return false;
|
|
873
954
|
}
|
|
874
955
|
try {
|
|
875
956
|
// particular event not happened in Life time
|
|
876
957
|
var data = Apxor.getController().getFromStorage("_apx_lt_count");
|
|
877
958
|
var siteid = Apxor.getSiteId();
|
|
878
|
-
var LtCountObjDecoded = JSON.parse(decode(siteid, data));
|
|
879
|
-
for (var i = 0; i < _this.
|
|
880
|
-
var evName = _this.
|
|
959
|
+
var LtCountObjDecoded = JSON.parse(new TextDecoder().decode(stringToArrayBuffer(decode(siteid, data))));
|
|
960
|
+
for (var i = 0; i < _this.kgNo.length; i++) {
|
|
961
|
+
var evName = _this.kgNo[i].name.replace("'", "").replace("’", "");
|
|
881
962
|
if (LtCountObjDecoded[evName]) {
|
|
882
963
|
return false;
|
|
883
964
|
}
|
|
884
965
|
}
|
|
885
966
|
} catch (e) {
|
|
886
|
-
Logger$
|
|
967
|
+
Logger$6.error("Failed to validate the lt count:" + e);
|
|
887
968
|
}
|
|
888
969
|
return true;
|
|
889
970
|
});
|
|
890
971
|
});
|
|
891
972
|
|
|
892
|
-
var Logger$
|
|
973
|
+
var Logger$7 = window.ApxorLogger;
|
|
974
|
+
var Attributes = /*#__PURE__*/_createClass(function Attributes() {
|
|
975
|
+
var _this = this;
|
|
976
|
+
_classCallCheck(this, Attributes);
|
|
977
|
+
_defineProperty(this, "oyin", []);
|
|
978
|
+
_defineProperty(this, "Pifw", []);
|
|
979
|
+
_defineProperty(this, "parse", function () {
|
|
980
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
981
|
+
try {
|
|
982
|
+
_this.oyin = config.attributes.user;
|
|
983
|
+
_this.Pifw = config.attributes.session;
|
|
984
|
+
if (!Array.isArray(_this.oyin) || !Array.isArray(_this.Pifw)) {
|
|
985
|
+
Logger$7.error("No attributes");
|
|
986
|
+
return false;
|
|
987
|
+
}
|
|
988
|
+
} catch (error) {
|
|
989
|
+
Logger$7.error(error);
|
|
990
|
+
return false;
|
|
991
|
+
}
|
|
992
|
+
return true;
|
|
993
|
+
});
|
|
994
|
+
_defineProperty(this, "validate", function (user, session) {
|
|
995
|
+
return _this.larY(user, _this.oyin) && _this.larY(session, _this.Pifw);
|
|
996
|
+
});
|
|
997
|
+
_defineProperty(this, "larY", function (attributes, expected) {
|
|
998
|
+
var length = expected.length;
|
|
999
|
+
var status = true;
|
|
1000
|
+
try {
|
|
1001
|
+
var _loop = function _loop() {
|
|
1002
|
+
var item = expected[index];
|
|
1003
|
+
if (!attributes[item.name] || status === false) {
|
|
1004
|
+
return {
|
|
1005
|
+
v: false
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
var operator = item.operator;
|
|
1009
|
+
var type = item.type;
|
|
1010
|
+
var values = item.value.map(function (value) {
|
|
1011
|
+
if (type === "s") {
|
|
1012
|
+
return value;
|
|
1013
|
+
} else if (type === "l") {
|
|
1014
|
+
return parseInt(value);
|
|
1015
|
+
} else if (type === "f") {
|
|
1016
|
+
return parseFloat(value);
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
var loggedValues = [];
|
|
1020
|
+
if (Array.isArray(attributes[item.name])) {
|
|
1021
|
+
loggedValues = attributes[item.name];
|
|
1022
|
+
} else {
|
|
1023
|
+
loggedValues = [attributes[item.name]];
|
|
1024
|
+
}
|
|
1025
|
+
var match = loggedValues.some(function (loggedValue) {
|
|
1026
|
+
return values.some(function (configValue) {
|
|
1027
|
+
return qjgz(loggedValue, configValue, operator);
|
|
1028
|
+
});
|
|
1029
|
+
});
|
|
1030
|
+
status = status && match;
|
|
1031
|
+
},
|
|
1032
|
+
_ret;
|
|
1033
|
+
for (var index = 0; index < length; index++) {
|
|
1034
|
+
_ret = _loop();
|
|
1035
|
+
if (_ret) return _ret.v;
|
|
1036
|
+
}
|
|
1037
|
+
} catch (error) {
|
|
1038
|
+
Logger$7.error(error);
|
|
1039
|
+
status = false;
|
|
1040
|
+
}
|
|
1041
|
+
return status;
|
|
1042
|
+
});
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
//TERMINATION KEYS
|
|
1046
|
+
var APX_TERMINATION_ID = "apx_termination_ID";
|
|
1047
|
+
|
|
1048
|
+
var TimeBasedTermination = /*#__PURE__*/_createClass(function TimeBasedTermination() {
|
|
1049
|
+
var _this = this;
|
|
1050
|
+
_classCallCheck(this, TimeBasedTermination);
|
|
1051
|
+
_defineProperty(this, "NURV", Apxor.getController());
|
|
1052
|
+
_defineProperty(this, "type", "");
|
|
1053
|
+
_defineProperty(this, "_duration_seconds", 0);
|
|
1054
|
+
_defineProperty(this, "eUbV", 1);
|
|
1055
|
+
_defineProperty(this, "parse", function (config) {
|
|
1056
|
+
try {
|
|
1057
|
+
var _config$terminate_inf, _config$terminate_inf2, _config$terminate_inf3;
|
|
1058
|
+
_this.pfyk = (_config$terminate_inf = config.terminate_info.time_based) === null || _config$terminate_inf === void 0 ? void 0 : _config$terminate_inf.type;
|
|
1059
|
+
_this._duration_seconds = (_config$terminate_inf2 = config.terminate_info) === null || _config$terminate_inf2 === void 0 ? void 0 : _config$terminate_inf2.time_based.duration_seconds;
|
|
1060
|
+
_this.eUbV = (_config$terminate_inf3 = config.terminate_info.time_based) === null || _config$terminate_inf3 === void 0 ? void 0 : _config$terminate_inf3.days;
|
|
1061
|
+
if (_this.qjgz(config._id)) {
|
|
1062
|
+
_this.NURV.persistTerminationInfoLocally(config._id);
|
|
1063
|
+
return false;
|
|
1064
|
+
}
|
|
1065
|
+
} catch (_unused) {
|
|
1066
|
+
return false;
|
|
1067
|
+
}
|
|
1068
|
+
return true;
|
|
1069
|
+
});
|
|
1070
|
+
_defineProperty(this, "qjgz", function (id) {
|
|
1071
|
+
var _Data$id;
|
|
1072
|
+
var Data = JSON.parse(_this.NURV.getFromStorage(APX_TERMINATION_ID));
|
|
1073
|
+
if (!Data[id] || !((_Data$id = Data[id]) !== null && _Data$id !== void 0 && _Data$id.startDate)) return false;
|
|
1074
|
+
var startDate = new Date(Data[id].startDate);
|
|
1075
|
+
var presentDate = new Date(getDateInMMDDYYYY());
|
|
1076
|
+
var diff = parseInt((presentDate - startDate) / (1000 * 60 * 60 * 24), 10);
|
|
1077
|
+
var currentTime = _getTime();
|
|
1078
|
+
var Xmbz = Data[id].Xmbz;
|
|
1079
|
+
return diff === _this.eUbV && currentTime.hours >= Xmbz.hours || diff > _this.eUbV || Data[id].goalAcheived;
|
|
1080
|
+
});
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
var TerminationInfo = /*#__PURE__*/_createClass(function TerminationInfo() {
|
|
1084
|
+
var _this = this;
|
|
1085
|
+
_classCallCheck(this, TerminationInfo);
|
|
1086
|
+
_defineProperty(this, "enable_goal_events", false);
|
|
1087
|
+
_defineProperty(this, "attributes", {});
|
|
1088
|
+
_defineProperty(this, "WnkR", new Attributes());
|
|
1089
|
+
_defineProperty(this, "jcBj", new TimeBasedTermination());
|
|
1090
|
+
_defineProperty(this, "parse", function () {
|
|
1091
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1092
|
+
try {
|
|
1093
|
+
var _config$terminate_inf, _config$terminate_inf2, _config$terminate_inf3;
|
|
1094
|
+
_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;
|
|
1095
|
+
if (_this.enable_time_based && !_this.jcBj.parse(config)) {
|
|
1096
|
+
return false;
|
|
1097
|
+
}
|
|
1098
|
+
_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;
|
|
1099
|
+
_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;
|
|
1100
|
+
if (_this.enable_attributes && !_this.WnkR.parse(config.terminate_info)) {
|
|
1101
|
+
return false;
|
|
1102
|
+
}
|
|
1103
|
+
} catch (error) {
|
|
1104
|
+
window.ApxorLogger.error(error);
|
|
1105
|
+
return false;
|
|
1106
|
+
}
|
|
1107
|
+
return true;
|
|
1108
|
+
});
|
|
1109
|
+
_defineProperty(this, "validate", function (user, session) {
|
|
1110
|
+
return _this.WnkR.validate(user, session);
|
|
1111
|
+
});
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
var Logger$8 = window.ApxorLogger;
|
|
893
1115
|
var ConfigItem = /*#__PURE__*/_createClass(function ConfigItem() {
|
|
894
1116
|
var _this = this;
|
|
895
1117
|
_classCallCheck(this, ConfigItem);
|
|
896
|
-
_defineProperty(this, "
|
|
897
|
-
_defineProperty(this, "
|
|
898
|
-
_defineProperty(this, "
|
|
899
|
-
_defineProperty(this, "
|
|
900
|
-
_defineProperty(this, "
|
|
901
|
-
_defineProperty(this, "
|
|
902
|
-
_defineProperty(this, "
|
|
903
|
-
_defineProperty(this, "
|
|
904
|
-
_defineProperty(this, "
|
|
1118
|
+
_defineProperty(this, "oWeW", []);
|
|
1119
|
+
_defineProperty(this, "bwHJ", []);
|
|
1120
|
+
_defineProperty(this, "jaGt", "");
|
|
1121
|
+
_defineProperty(this, "ylID", new Meta());
|
|
1122
|
+
_defineProperty(this, "fGtu", new Audience());
|
|
1123
|
+
_defineProperty(this, "YTxk", new Validity());
|
|
1124
|
+
_defineProperty(this, "CWOw", new Frequency());
|
|
1125
|
+
_defineProperty(this, "VUII", new OverallConfig());
|
|
1126
|
+
_defineProperty(this, "xoSz", new TerminationInfo());
|
|
1127
|
+
_defineProperty(this, "uZEl", false);
|
|
1128
|
+
_defineProperty(this, "TYUY", []);
|
|
905
1129
|
_defineProperty(this, "parse", function () {
|
|
906
1130
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
907
1131
|
try {
|
|
908
1132
|
// If ID is not present, throw it out
|
|
909
1133
|
if (!isDefined(config._id)) {
|
|
910
|
-
Logger$
|
|
1134
|
+
Logger$8.error("No Id");
|
|
911
1135
|
return false;
|
|
912
1136
|
}
|
|
913
1137
|
|
|
914
1138
|
// If config is disabled, throw it out
|
|
915
1139
|
if (!isDefined(config.enabled) || !config.enabled) {
|
|
916
|
-
Logger$
|
|
1140
|
+
Logger$8.error("Not enabled");
|
|
917
1141
|
return false;
|
|
918
1142
|
}
|
|
919
1143
|
|
|
920
1144
|
// If META, VALIDITY, FREQUENCY and AUDIENCE is not parsed properly, throw it out
|
|
921
|
-
if (!(_this.
|
|
1145
|
+
if (!(_this.ylID.parse(config) && _this.YTxk.parse(config) && _this.CWOw.parse(config) && _this.fGtu.parse(config) && _this.VUII.parse(config) && _this.xoSz.parse(config))) {
|
|
922
1146
|
return false;
|
|
923
1147
|
}
|
|
924
1148
|
|
|
925
1149
|
// If there are no conditions, throw it out
|
|
926
1150
|
if (!isDefined(config.conditions) || !Array.isArray(config.conditions)) {
|
|
927
|
-
Logger$
|
|
1151
|
+
Logger$8.error("No valid conditions", config.conditions);
|
|
928
1152
|
return false;
|
|
929
1153
|
}
|
|
930
|
-
_this.
|
|
931
|
-
_this.
|
|
932
|
-
if (_this.
|
|
1154
|
+
_this.jaGt = config._id;
|
|
1155
|
+
_this.uZEl = isDefined(config.sequence_enabled) ? config.sequence_enabled : false;
|
|
1156
|
+
if (_this.uZEl) {
|
|
933
1157
|
// iff respectSequence is true, Sort the Conditions by their sequence order
|
|
934
1158
|
// We need to sort, if server sends them in orderless manner
|
|
935
1159
|
config.conditions.sort(function (prev, current) {
|
|
@@ -941,17 +1165,17 @@
|
|
|
941
1165
|
var conditions = config.conditions;
|
|
942
1166
|
var length = conditions.length;
|
|
943
1167
|
for (var index = 0; index < length; index++) {
|
|
944
|
-
_this.
|
|
1168
|
+
_this.TYUY = [];
|
|
945
1169
|
var condition = conditions[index];
|
|
946
1170
|
if (condition.type === "didn't") {
|
|
947
|
-
var
|
|
1171
|
+
var qXKr$details;
|
|
948
1172
|
var obj = {
|
|
949
1173
|
trigger_key: condition.trigger.details.name,
|
|
950
|
-
no_kpi_array: condition === null || condition === void 0 || (
|
|
1174
|
+
no_kpi_array: condition === null || condition === void 0 || (qXKr$details = condition.details) === null || qXKr$details === void 0 || (qXKr$details = qXKr$details.additional_info) === null || qXKr$details === void 0 ? void 0 : qXKr$details.nkpi,
|
|
951
1175
|
condition_id: condition === null || condition === void 0 ? void 0 : condition._id,
|
|
952
1176
|
time_bounds: condition.time_bounds.upper
|
|
953
1177
|
};
|
|
954
|
-
_this.
|
|
1178
|
+
_this.TYUY = [].concat(_toConsumableArray(_this.TYUY), [obj]);
|
|
955
1179
|
//this will be the key
|
|
956
1180
|
//when event occur check this array and then then check the time
|
|
957
1181
|
//check the time diffrence
|
|
@@ -960,57 +1184,73 @@
|
|
|
960
1184
|
}
|
|
961
1185
|
|
|
962
1186
|
var conditionValidator = new ConditionValidator();
|
|
963
|
-
if (conditionValidator.initialize(condition, _this.
|
|
964
|
-
_this.
|
|
1187
|
+
if (conditionValidator.initialize(condition, _this.jaGt, index, _this.uZEl, _this.TYUY)) {
|
|
1188
|
+
_this.oWeW.push(conditionValidator);
|
|
965
1189
|
}
|
|
966
1190
|
}
|
|
967
|
-
|
|
1191
|
+
if (_this.xoSz.enable_goal_events) {
|
|
1192
|
+
var goal_events = config.terminate_info.goal_events.events;
|
|
1193
|
+
var goaleventslength = goal_events.length;
|
|
1194
|
+
for (var i = 0; i < goaleventslength; i++) {
|
|
1195
|
+
var _conditionValidator = new ConditionValidator();
|
|
1196
|
+
if (_conditionValidator.initialize(goal_events[i], _this.jaGt, i, true, [], "termination")) {
|
|
1197
|
+
_this.bwHJ.push(_conditionValidator);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
return _this.oWeW.length > 0;
|
|
968
1202
|
} catch (error) {
|
|
969
|
-
Logger$
|
|
1203
|
+
Logger$8.error(error);
|
|
970
1204
|
return false;
|
|
971
1205
|
}
|
|
972
1206
|
});
|
|
973
|
-
_defineProperty(this, "
|
|
1207
|
+
_defineProperty(this, "Adtv", function (index) {
|
|
974
1208
|
if (index < 0) {
|
|
975
1209
|
return;
|
|
976
1210
|
}
|
|
977
|
-
if (_this.
|
|
978
|
-
var conditionValidator = _this.
|
|
979
|
-
if (isDefined(conditionValidator) && conditionValidator.
|
|
1211
|
+
if (_this.uZEl) {
|
|
1212
|
+
var conditionValidator = _this.oWeW[index];
|
|
1213
|
+
if (isDefined(conditionValidator) && conditionValidator.HPUo) {
|
|
980
1214
|
// Check if previous validator is satisfied
|
|
981
|
-
var prevValidator = _this.
|
|
982
|
-
if (isDefined(prevValidator) && !prevValidator.
|
|
1215
|
+
var prevValidator = _this.oWeW[index - 1];
|
|
1216
|
+
if (isDefined(prevValidator) && !prevValidator.HPUo) {
|
|
983
1217
|
// TODO: If current index is satisfied before previous one, do something
|
|
984
1218
|
// either unregister all conditions or remove this item from ConfigLookup
|
|
985
1219
|
return;
|
|
986
1220
|
}
|
|
987
|
-
var nextValidator = _this.
|
|
1221
|
+
var nextValidator = _this.oWeW[index + 1];
|
|
988
1222
|
if (!isDefined(nextValidator)) {
|
|
989
1223
|
// It means this is the last condition
|
|
990
1224
|
// Validate all conditions
|
|
991
|
-
_this.
|
|
1225
|
+
_this.BmHg();
|
|
992
1226
|
} else {
|
|
993
|
-
nextValidator.
|
|
1227
|
+
nextValidator.OJSD();
|
|
994
1228
|
}
|
|
995
1229
|
}
|
|
996
1230
|
} else {
|
|
997
1231
|
// Validate all conditions
|
|
998
|
-
_this.
|
|
1232
|
+
_this.BmHg();
|
|
999
1233
|
}
|
|
1000
1234
|
});
|
|
1001
|
-
_defineProperty(this, "
|
|
1235
|
+
_defineProperty(this, "RbFI", function (index) {
|
|
1236
|
+
if (index < 0) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
_this.GuEG();
|
|
1240
|
+
});
|
|
1241
|
+
_defineProperty(this, "BmHg", function () {
|
|
1002
1242
|
// Check If Audience, Validity is satisfied or not
|
|
1003
1243
|
var userAttributes = Apxor.getController().getUserAttributes();
|
|
1004
1244
|
var sessionAttributes = Apxor.getController().getSessionAttributes();
|
|
1005
|
-
if (!_this.
|
|
1245
|
+
if (!_this.YTxk.validate() || !_this.fGtu.validate(userAttributes, sessionAttributes) || !_this.VUII.validate()) {
|
|
1006
1246
|
return;
|
|
1007
1247
|
}
|
|
1008
|
-
var length = _this.
|
|
1248
|
+
var length = _this.oWeW.length;
|
|
1009
1249
|
var isSatisfied = length < 1;
|
|
1010
1250
|
var combineOperator = "";
|
|
1011
1251
|
for (var index = 0; index < length; index++) {
|
|
1012
|
-
var validator = _this.
|
|
1013
|
-
var currentResult = validator.
|
|
1252
|
+
var validator = _this.oWeW[index];
|
|
1253
|
+
var currentResult = validator.HPUo;
|
|
1014
1254
|
if (combineOperator.trim() === "") {
|
|
1015
1255
|
isSatisfied = currentResult;
|
|
1016
1256
|
} else {
|
|
@@ -1023,47 +1263,92 @@
|
|
|
1023
1263
|
break;
|
|
1024
1264
|
}
|
|
1025
1265
|
}
|
|
1026
|
-
combineOperator = validator.
|
|
1266
|
+
combineOperator = validator.yHRM;
|
|
1027
1267
|
}
|
|
1028
1268
|
if (isSatisfied) {
|
|
1029
1269
|
console.debug("onCondition satisfied");
|
|
1030
1270
|
// Check if count reached it's maximum
|
|
1031
|
-
if (!_this.
|
|
1032
|
-
console.warn("Maximum limit reached", _this.
|
|
1271
|
+
if (!_this.CWOw.WTEf(_this.jaGt)) {
|
|
1272
|
+
console.warn("Maximum limit reached", _this.jaGt);
|
|
1033
1273
|
return;
|
|
1034
1274
|
}
|
|
1035
|
-
console.log("Dispatching event", _this.
|
|
1036
|
-
if (_this.
|
|
1037
|
-
Apxor.logEvent(APX_CONTEXT_EVALUATED, _objectSpread2(_objectSpread2({}, _this.
|
|
1038
|
-
message_name: _this.
|
|
1039
|
-
id: _this.
|
|
1275
|
+
console.log("Dispatching event", _this.ylID.pfyk);
|
|
1276
|
+
if (_this.ylID._only_context === true) {
|
|
1277
|
+
Apxor.logEvent(APX_CONTEXT_EVALUATED, _objectSpread2(_objectSpread2({}, _this.ylID._attr), {}, {
|
|
1278
|
+
message_name: _this.ylID.EDaN,
|
|
1279
|
+
id: _this.jaGt
|
|
1040
1280
|
}));
|
|
1041
1281
|
}
|
|
1042
1282
|
// Emit event
|
|
1043
|
-
Apxor.getController().dispatchEvent(_this.
|
|
1044
|
-
name: _this.
|
|
1283
|
+
Apxor.getController().dispatchEvent(_this.ylID.pfyk, {
|
|
1284
|
+
name: _this.ylID.pfyk,
|
|
1045
1285
|
additional_info: {
|
|
1046
|
-
uuid: _this.
|
|
1047
|
-
name: _this.
|
|
1286
|
+
uuid: _this.jaGt,
|
|
1287
|
+
name: _this.ylID.EDaN
|
|
1048
1288
|
}
|
|
1049
1289
|
});
|
|
1050
1290
|
}
|
|
1051
1291
|
});
|
|
1052
|
-
_defineProperty(this, "
|
|
1053
|
-
_this.
|
|
1292
|
+
_defineProperty(this, "GuEG", function () {
|
|
1293
|
+
var length = _this.bwHJ.length;
|
|
1294
|
+
var isSatisfied = length < 1;
|
|
1295
|
+
var combineOperator = "";
|
|
1296
|
+
for (var index = 0; index < length; index++) {
|
|
1297
|
+
var validator = _this.bwHJ[index];
|
|
1298
|
+
var currentResult = validator.HPUo;
|
|
1299
|
+
if (combineOperator.trim() === "") {
|
|
1300
|
+
isSatisfied = currentResult;
|
|
1301
|
+
} else {
|
|
1302
|
+
switch (combineOperator) {
|
|
1303
|
+
case "AND":
|
|
1304
|
+
isSatisfied = isSatisfied && currentResult;
|
|
1305
|
+
break;
|
|
1306
|
+
case "OR":
|
|
1307
|
+
isSatisfied = isSatisfied || currentResult;
|
|
1308
|
+
break;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
combineOperator = validator.mCal;
|
|
1312
|
+
}
|
|
1313
|
+
if (isSatisfied) {
|
|
1314
|
+
console.log("Dispatching event", _this.ylID.pfyk);
|
|
1315
|
+
Apxor.getController().persistTerminationInfoLocally(_this.jaGt);
|
|
1316
|
+
if (_this.ylID._only_context === true) {
|
|
1317
|
+
Apxor.logEvent(APX_CONTEXT_EVALUATED, _objectSpread2(_objectSpread2({}, _this.ylID._attr), {}, {
|
|
1318
|
+
message_name: _this.ylID.EDaN,
|
|
1319
|
+
id: _this.jaGt
|
|
1320
|
+
}));
|
|
1321
|
+
}
|
|
1322
|
+
// Emit event
|
|
1323
|
+
Apxor.getController().dispatchEvent(_this.ylID.pfyk, {
|
|
1324
|
+
name: _this.ylID.pfyk,
|
|
1325
|
+
additional_info: {
|
|
1326
|
+
uuid: _this.jaGt,
|
|
1327
|
+
name: _this.ylID.EDaN
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
});
|
|
1332
|
+
_defineProperty(this, "validateForTerminationAttributes", function () {
|
|
1333
|
+
var userAttributes = Apxor.getController().getUserAttributes();
|
|
1334
|
+
var sessionAttributes = Apxor.getController().getSessionAttributes();
|
|
1335
|
+
return _this.xoSz.validate(userAttributes, sessionAttributes);
|
|
1336
|
+
});
|
|
1337
|
+
_defineProperty(this, "oDrA", function () {
|
|
1338
|
+
_this.CWOw.oDrA();
|
|
1054
1339
|
});
|
|
1055
1340
|
_defineProperty(this, "getFrequencyCount", function () {
|
|
1056
|
-
return _this.
|
|
1341
|
+
return _this.CWOw.getFrequencyCount();
|
|
1057
1342
|
});
|
|
1058
|
-
_defineProperty(this, "
|
|
1059
|
-
return _this.
|
|
1343
|
+
_defineProperty(this, "XgXS", function () {
|
|
1344
|
+
return _this.CWOw.XbPF();
|
|
1060
1345
|
});
|
|
1061
1346
|
});
|
|
1062
1347
|
|
|
1063
1348
|
var ConfigLookup = /*#__PURE__*/_createClass(function ConfigLookup() {
|
|
1064
1349
|
var _this = this;
|
|
1065
1350
|
_classCallCheck(this, ConfigLookup);
|
|
1066
|
-
_defineProperty(this, "
|
|
1351
|
+
_defineProperty(this, "IZYQ", {});
|
|
1067
1352
|
_defineProperty(this, "parse", function () {
|
|
1068
1353
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
1069
1354
|
configs: []
|
|
@@ -1086,7 +1371,7 @@
|
|
|
1086
1371
|
var configId = _config._id;
|
|
1087
1372
|
var configItem = new ConfigItem();
|
|
1088
1373
|
if (configItem.parse(_config)) {
|
|
1089
|
-
_this.
|
|
1374
|
+
_this.IZYQ[configId] = configItem;
|
|
1090
1375
|
} else {
|
|
1091
1376
|
console.warn("Failed to parse cfg", configId);
|
|
1092
1377
|
}
|
|
@@ -1094,31 +1379,44 @@
|
|
|
1094
1379
|
}
|
|
1095
1380
|
});
|
|
1096
1381
|
_defineProperty(this, "validate", function (id, index) {
|
|
1097
|
-
if (_this.
|
|
1098
|
-
var configItem = _this.
|
|
1099
|
-
configItem.
|
|
1382
|
+
if (_this.IZYQ[id]) {
|
|
1383
|
+
var configItem = _this.IZYQ[id];
|
|
1384
|
+
configItem.Adtv(index);
|
|
1100
1385
|
}
|
|
1101
1386
|
});
|
|
1102
|
-
_defineProperty(this, "
|
|
1103
|
-
|
|
1104
|
-
|
|
1387
|
+
_defineProperty(this, "validateForTermination", function (id, index) {
|
|
1388
|
+
if (_this.IZYQ[id]) {
|
|
1389
|
+
var configItem = _this.IZYQ[id];
|
|
1390
|
+
configItem.RbFI(index);
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
_defineProperty(this, "validateForTerminationAttributes", function (id) {
|
|
1394
|
+
if (_this.IZYQ[id]) {
|
|
1395
|
+
var configItem = _this.IZYQ[id];
|
|
1396
|
+
return configItem.validateForTerminationAttributes();
|
|
1397
|
+
}
|
|
1398
|
+
return false;
|
|
1399
|
+
});
|
|
1400
|
+
_defineProperty(this, "oDrA", function (id) {
|
|
1401
|
+
var campiagnConfig = _this.IZYQ[id];
|
|
1402
|
+
campiagnConfig.oDrA();
|
|
1105
1403
|
});
|
|
1106
1404
|
_defineProperty(this, "getFrequencyCount", function (id) {
|
|
1107
|
-
var campiagnConfig = _this.
|
|
1405
|
+
var campiagnConfig = _this.IZYQ[id];
|
|
1108
1406
|
return campiagnConfig.getFrequencyCount();
|
|
1109
1407
|
});
|
|
1110
1408
|
_defineProperty(this, "resetFrequencyCounts", function () {
|
|
1111
|
-
var configs = _this.
|
|
1409
|
+
var configs = _this.IZYQ;
|
|
1112
1410
|
for (var configId in configs) {
|
|
1113
|
-
configs[configId].
|
|
1411
|
+
configs[configId].XgXS();
|
|
1114
1412
|
}
|
|
1115
1413
|
});
|
|
1116
|
-
_defineProperty(this, "
|
|
1414
|
+
_defineProperty(this, "NveP", function (campaignId) {
|
|
1117
1415
|
try {
|
|
1118
|
-
if (_this.
|
|
1119
|
-
var configItem = _this.
|
|
1120
|
-
if (configItem && configItem.
|
|
1121
|
-
return configItem.
|
|
1416
|
+
if (_this.IZYQ) {
|
|
1417
|
+
var configItem = _this.IZYQ[campaignId];
|
|
1418
|
+
if (configItem && configItem.ylID) {
|
|
1419
|
+
return configItem.ylID;
|
|
1122
1420
|
}
|
|
1123
1421
|
}
|
|
1124
1422
|
} catch (e) {
|
|
@@ -1130,46 +1428,46 @@
|
|
|
1130
1428
|
|
|
1131
1429
|
var APP_EVENT = "APP_EVENT";
|
|
1132
1430
|
var CLIENT_EVENT = "CLIENT_EVENT";
|
|
1133
|
-
var Logger$
|
|
1431
|
+
var Logger$9 = window.ApxorLogger;
|
|
1134
1432
|
var EventsListener = /*#__PURE__*/_createClass(function EventsListener() {
|
|
1135
1433
|
var _this = this;
|
|
1136
1434
|
_classCallCheck(this, EventsListener);
|
|
1137
|
-
_defineProperty(this, "
|
|
1138
|
-
_defineProperty(this, "
|
|
1139
|
-
_defineProperty(this, "
|
|
1435
|
+
_defineProperty(this, "FDcv", {});
|
|
1436
|
+
_defineProperty(this, "kJex", []);
|
|
1437
|
+
_defineProperty(this, "qMxr", false);
|
|
1140
1438
|
_defineProperty(this, "initialize", function () {
|
|
1141
1439
|
var controller = Apxor.getController();
|
|
1142
1440
|
controller.registerForEvent(APP_EVENT, function (event) {
|
|
1143
|
-
return _this.
|
|
1441
|
+
return _this.LtdS(event, "AE");
|
|
1144
1442
|
});
|
|
1145
1443
|
controller.registerForEvent(CLIENT_EVENT, function (event) {
|
|
1146
|
-
return _this.
|
|
1444
|
+
return _this.LtdS(event, "CE");
|
|
1147
1445
|
});
|
|
1148
1446
|
});
|
|
1149
|
-
_defineProperty(this, "
|
|
1447
|
+
_defineProperty(this, "zgeH", function () {
|
|
1150
1448
|
// Clear Buffer
|
|
1151
|
-
for (var item in _this.
|
|
1152
|
-
_this.
|
|
1449
|
+
for (var item in _this.kJex) {
|
|
1450
|
+
_this.rqKD(item.event, item.key, item.type);
|
|
1153
1451
|
}
|
|
1154
|
-
_this.
|
|
1452
|
+
_this.qMxr = true;
|
|
1155
1453
|
});
|
|
1156
|
-
_defineProperty(this, "
|
|
1454
|
+
_defineProperty(this, "Weok", function (event, callback) {
|
|
1157
1455
|
if (!isFunction(callback)) {
|
|
1158
1456
|
return;
|
|
1159
1457
|
}
|
|
1160
1458
|
var listeners;
|
|
1161
|
-
if (_this.
|
|
1162
|
-
listeners = _this.
|
|
1459
|
+
if (_this.FDcv[event]) {
|
|
1460
|
+
listeners = _this.FDcv[event];
|
|
1163
1461
|
} else {
|
|
1164
1462
|
listeners = [];
|
|
1165
1463
|
}
|
|
1166
1464
|
listeners.push(callback);
|
|
1167
|
-
_this.
|
|
1168
|
-
Logger$
|
|
1465
|
+
_this.FDcv[event] = listeners;
|
|
1466
|
+
Logger$9.debug("Listeners list: ", _this.FDcv);
|
|
1169
1467
|
});
|
|
1170
1468
|
_defineProperty(this, "unregisterFromEvent", function (event, callback) {
|
|
1171
|
-
if (_this.
|
|
1172
|
-
var listeners = _this.
|
|
1469
|
+
if (_this.FDcv[event]) {
|
|
1470
|
+
var listeners = _this.FDcv[event];
|
|
1173
1471
|
var updatedListeners = [];
|
|
1174
1472
|
for (var index = 0; index < listeners.length; index++) {
|
|
1175
1473
|
var listener = listeners[index];
|
|
@@ -1177,25 +1475,25 @@
|
|
|
1177
1475
|
updatedListeners.push(listener);
|
|
1178
1476
|
}
|
|
1179
1477
|
}
|
|
1180
|
-
_this.
|
|
1478
|
+
_this.FDcv[event] = updatedListeners;
|
|
1181
1479
|
}
|
|
1182
1480
|
});
|
|
1183
|
-
_defineProperty(this, "
|
|
1481
|
+
_defineProperty(this, "LtdS", function (event) {
|
|
1184
1482
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "AE";
|
|
1185
1483
|
var key = type + "___" + event.name;
|
|
1186
|
-
_this.
|
|
1484
|
+
_this.rqKD(event, key, type);
|
|
1187
1485
|
});
|
|
1188
|
-
_defineProperty(this, "
|
|
1189
|
-
if (!_this.
|
|
1190
|
-
_this.
|
|
1486
|
+
_defineProperty(this, "rqKD", function (event, key, type) {
|
|
1487
|
+
if (!_this.qMxr) {
|
|
1488
|
+
_this.kJex.push({
|
|
1191
1489
|
event: event,
|
|
1192
1490
|
key: key,
|
|
1193
1491
|
type: type
|
|
1194
1492
|
});
|
|
1195
1493
|
} else {
|
|
1196
|
-
Logger$
|
|
1197
|
-
if (_this.
|
|
1198
|
-
var listeners = _this.
|
|
1494
|
+
Logger$9.debug("Notifying listeners for event: " + event + ", " + key, _this.FDcv);
|
|
1495
|
+
if (_this.FDcv[key]) {
|
|
1496
|
+
var listeners = _this.FDcv[key];
|
|
1199
1497
|
var time = Apxor.getController().getSDKRunningTimeInSec();
|
|
1200
1498
|
for (var index = 0; index < listeners.length; index++) {
|
|
1201
1499
|
var listener = listeners[index];
|
|
@@ -1206,22 +1504,22 @@
|
|
|
1206
1504
|
});
|
|
1207
1505
|
});
|
|
1208
1506
|
|
|
1209
|
-
var Logger$
|
|
1507
|
+
var Logger$a = window.ApxorLogger;
|
|
1210
1508
|
var CE = /*#__PURE__*/function () {
|
|
1211
1509
|
function CE() {
|
|
1212
1510
|
var _this = this;
|
|
1213
1511
|
_classCallCheck(this, CE);
|
|
1214
|
-
_defineProperty(this, "
|
|
1215
|
-
_defineProperty(this, "
|
|
1216
|
-
_defineProperty(this, "
|
|
1217
|
-
_defineProperty(this, "
|
|
1218
|
-
_defineProperty(this, "
|
|
1512
|
+
_defineProperty(this, "EXbT", false);
|
|
1513
|
+
_defineProperty(this, "OqkB", null);
|
|
1514
|
+
_defineProperty(this, "wsiO", getDateInDDMMYYYY());
|
|
1515
|
+
_defineProperty(this, "DGNj", new EventsListener());
|
|
1516
|
+
_defineProperty(this, "nawG", Apxor.getSiteId());
|
|
1219
1517
|
_defineProperty(this, "_qeState", {});
|
|
1220
1518
|
_defineProperty(this, "getQeState", function () {
|
|
1221
1519
|
try {
|
|
1222
1520
|
var data = Apxor.getController().getFromStorage(QE_STATE);
|
|
1223
1521
|
if (data) {
|
|
1224
|
-
return JSON.parse(decode(_this.
|
|
1522
|
+
return JSON.parse(decode(_this.nawG, data));
|
|
1225
1523
|
} else {
|
|
1226
1524
|
_this._qeState = {};
|
|
1227
1525
|
return _this.setQeState();
|
|
@@ -1250,12 +1548,12 @@
|
|
|
1250
1548
|
return _this._qeState;
|
|
1251
1549
|
});
|
|
1252
1550
|
_defineProperty(this, "initialize", function () {
|
|
1253
|
-
if (!_this.
|
|
1254
|
-
_this.
|
|
1255
|
-
_this.
|
|
1256
|
-
_this.
|
|
1551
|
+
if (!_this.EXbT) {
|
|
1552
|
+
_this.EXbT = true;
|
|
1553
|
+
_this.OqkB = new ConfigLookup();
|
|
1554
|
+
_this.DGNj.initialize();
|
|
1257
1555
|
_this._qeState = _this.getQeState();
|
|
1258
|
-
Logger$
|
|
1556
|
+
Logger$a.info("QE Initialized..");
|
|
1259
1557
|
}
|
|
1260
1558
|
});
|
|
1261
1559
|
/**
|
|
@@ -1264,12 +1562,12 @@
|
|
|
1264
1562
|
* @param config
|
|
1265
1563
|
*/
|
|
1266
1564
|
_defineProperty(this, "parse", function (config) {
|
|
1267
|
-
if (!_this.
|
|
1268
|
-
Logger$
|
|
1565
|
+
if (!_this.TrIj()) {
|
|
1566
|
+
Logger$a.warn("Must call init first. Unable to proceed");
|
|
1269
1567
|
return;
|
|
1270
1568
|
}
|
|
1271
|
-
_this.
|
|
1272
|
-
_this.
|
|
1569
|
+
_this.OqkB.parse(config);
|
|
1570
|
+
_this.DGNj.zgeH();
|
|
1273
1571
|
});
|
|
1274
1572
|
/**
|
|
1275
1573
|
* Validates all conditions for given config ID
|
|
@@ -1278,10 +1576,19 @@
|
|
|
1278
1576
|
* @param index
|
|
1279
1577
|
*/
|
|
1280
1578
|
_defineProperty(this, "validate", function (id, index) {
|
|
1281
|
-
if (!_this.
|
|
1579
|
+
if (!_this.TrIj()) {
|
|
1282
1580
|
return;
|
|
1283
1581
|
}
|
|
1284
|
-
_this.
|
|
1582
|
+
_this.OqkB.validate(id, index);
|
|
1583
|
+
});
|
|
1584
|
+
_defineProperty(this, "validateForTermination", function (id, index) {
|
|
1585
|
+
if (!_this.TrIj()) {
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
_this.OqkB.validateForTermination(id, index);
|
|
1589
|
+
});
|
|
1590
|
+
_defineProperty(this, "validateForTerminationAttributes", function (user, session) {
|
|
1591
|
+
return _this.OqkB.validateForTerminationAttributes(user, session);
|
|
1285
1592
|
});
|
|
1286
1593
|
_defineProperty(this, "updateCount", function (id) {
|
|
1287
1594
|
try {
|
|
@@ -1290,22 +1597,22 @@
|
|
|
1290
1597
|
}
|
|
1291
1598
|
_this.incrementFrequencies(id);
|
|
1292
1599
|
_this.setQeState(id);
|
|
1293
|
-
_this.
|
|
1600
|
+
_this.OqkB.oDrA(id);
|
|
1294
1601
|
} catch (e) {
|
|
1295
1602
|
console.log("Could not update the count config:".concat(e));
|
|
1296
1603
|
}
|
|
1297
1604
|
});
|
|
1298
1605
|
_defineProperty(this, "resetFrequencyCounts", function () {
|
|
1299
|
-
_this.
|
|
1606
|
+
_this.OqkB.resetFrequencyCounts();
|
|
1300
1607
|
});
|
|
1301
1608
|
_defineProperty(this, "getFrequencyCount", function (id) {
|
|
1302
|
-
return _this.
|
|
1609
|
+
return _this.OqkB.getFrequencyCount(id);
|
|
1303
1610
|
});
|
|
1304
1611
|
_defineProperty(this, "registerForEvent", function (event, callback) {
|
|
1305
|
-
_this.
|
|
1612
|
+
_this.DGNj.Weok(event, callback);
|
|
1306
1613
|
});
|
|
1307
1614
|
_defineProperty(this, "unregisterFromEvent", function (event, callback) {
|
|
1308
|
-
_this.
|
|
1615
|
+
_this.DGNj.unregisterFromEvent(event, callback);
|
|
1309
1616
|
});
|
|
1310
1617
|
/**
|
|
1311
1618
|
* Fetches the config from Server
|
|
@@ -1318,14 +1625,14 @@
|
|
|
1318
1625
|
_defineProperty(this, "fetch", function (type, validateUrl, apiUrl, callback) {
|
|
1319
1626
|
Apxor.getController().fetchConfiguration(type, validateUrl, apiUrl, callback);
|
|
1320
1627
|
});
|
|
1321
|
-
_defineProperty(this, "
|
|
1322
|
-
return _this.
|
|
1628
|
+
_defineProperty(this, "TrIj", function () {
|
|
1629
|
+
return _this.EXbT;
|
|
1323
1630
|
});
|
|
1324
1631
|
_defineProperty(this, "getCampaignMetaFromQueryEngine", function (campaignId) {
|
|
1325
|
-
return _this.
|
|
1632
|
+
return _this.OqkB.NveP(campaignId);
|
|
1326
1633
|
});
|
|
1327
|
-
_defineProperty(this, "
|
|
1328
|
-
return _this.
|
|
1634
|
+
_defineProperty(this, "ZCjh", function () {
|
|
1635
|
+
return _this.wsiO;
|
|
1329
1636
|
});
|
|
1330
1637
|
if (!CE.instance) {
|
|
1331
1638
|
CE.instance = this;
|
|
@@ -1349,11 +1656,11 @@
|
|
|
1349
1656
|
OVERALL: 0,
|
|
1350
1657
|
DATES: {}
|
|
1351
1658
|
};
|
|
1352
|
-
if (this.
|
|
1659
|
+
if (this.wsiO) this._qeState[id].DATES[this.wsiO] = 0;
|
|
1353
1660
|
this.setQeState(id);
|
|
1354
1661
|
}
|
|
1355
1662
|
} catch (e) {
|
|
1356
|
-
Logger$
|
|
1663
|
+
Logger$a.error("Can not create the frequency count object:" + e);
|
|
1357
1664
|
}
|
|
1358
1665
|
}
|
|
1359
1666
|
}, {
|
|
@@ -1368,12 +1675,12 @@
|
|
|
1368
1675
|
|
|
1369
1676
|
// Increment the DATES count for this particular date by 1. If the date changes reset.
|
|
1370
1677
|
var currentDate = getDateInDDMMYYYY();
|
|
1371
|
-
if (currentDate !== this.
|
|
1372
|
-
this.
|
|
1678
|
+
if (currentDate !== this.wsiO || !(configFrequency.DATES && configFrequency.DATES[currentDate])) {
|
|
1679
|
+
this.wsiO = currentDate;
|
|
1373
1680
|
configFrequency.DATES = {};
|
|
1374
|
-
configFrequency.DATES[this.
|
|
1681
|
+
configFrequency.DATES[this.wsiO] = 0;
|
|
1375
1682
|
}
|
|
1376
|
-
configFrequency.DATES[this.
|
|
1683
|
+
configFrequency.DATES[this.wsiO] = configFrequency.DATES[this.wsiO] + 1;
|
|
1377
1684
|
}
|
|
1378
1685
|
}], [{
|
|
1379
1686
|
key: "getInstance",
|
|
@@ -1392,7 +1699,7 @@
|
|
|
1392
1699
|
|
|
1393
1700
|
/* eslint-disable no-empty */
|
|
1394
1701
|
|
|
1395
|
-
window.ceVersion =
|
|
1702
|
+
window.ceVersion = 140;
|
|
1396
1703
|
try {
|
|
1397
1704
|
if (exports !== undefined || exports !== null) {
|
|
1398
1705
|
exports["default"] = CE;
|