clarity-js 0.7.9 → 0.7.12

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.
@@ -45,6 +45,7 @@ var metadata$1 = /*#__PURE__*/Object.freeze({
45
45
  get id () { return id; },
46
46
  get metadata () { return metadata; },
47
47
  get save () { return save; },
48
+ get shortid () { return shortid; },
48
49
  get start () { return start$9; },
49
50
  get stop () { return stop$8; }
50
51
  });
@@ -138,7 +139,7 @@ function api(method) {
138
139
  }
139
140
 
140
141
  var startTime = 0;
141
- function start$G() {
142
+ function start$H() {
142
143
  startTime = performance.now();
143
144
  }
144
145
  function time(event) {
@@ -146,11 +147,11 @@ function time(event) {
146
147
  var ts = event && event.timeStamp > 0 ? event.timeStamp : performance.now();
147
148
  return Math.max(Math.round(ts - startTime), 0);
148
149
  }
149
- function stop$D() {
150
+ function stop$E() {
150
151
  startTime = 0;
151
152
  }
152
153
 
153
- var version$1 = "0.7.9";
154
+ var version$1 = "0.7.12";
154
155
 
155
156
  // tslint:disable: no-bitwise
156
157
  function hash (input, precision) {
@@ -351,18 +352,18 @@ function redact$1(value) {
351
352
  return array ? array.join("" /* Data.Constant.Empty */) : value;
352
353
  }
353
354
 
354
- var state$a = null;
355
+ var state$b = null;
355
356
  var buffer = null;
356
357
  var update$2 = false;
357
- function start$F() {
358
+ function start$G() {
358
359
  update$2 = false;
359
- reset$q();
360
+ reset$r();
360
361
  }
361
- function reset$q() {
362
+ function reset$r() {
362
363
  // Baseline state holds the previous values - if it is updated in the current payload,
363
364
  // reset the state to current value after sending the previous state
364
365
  if (update$2) {
365
- state$a = { time: time(), event: 4 /* Event.Baseline */, data: {
366
+ state$b = { time: time(), event: 4 /* Event.Baseline */, data: {
366
367
  visible: buffer.visible,
367
368
  docWidth: buffer.docWidth,
368
369
  docHeight: buffer.docHeight,
@@ -389,7 +390,7 @@ function reset$q() {
389
390
  activityTime: 0
390
391
  };
391
392
  }
392
- function track$7(event, x, y) {
393
+ function track$8(event, x, y) {
393
394
  switch (event) {
394
395
  case 8 /* Event.Document */:
395
396
  buffer.docWidth = x;
@@ -425,19 +426,19 @@ function compute$c() {
425
426
  encode$1(4 /* Event.Baseline */);
426
427
  }
427
428
  }
428
- function stop$C() {
429
- reset$q();
429
+ function stop$D() {
430
+ reset$r();
430
431
  }
431
432
 
432
433
  var baseline = /*#__PURE__*/Object.freeze({
433
434
  __proto__: null,
434
435
  activity: activity,
435
436
  compute: compute$c,
436
- reset: reset$q,
437
- start: start$F,
438
- get state () { return state$a; },
439
- stop: stop$C,
440
- track: track$7,
437
+ reset: reset$r,
438
+ start: start$G,
439
+ get state () { return state$b; },
440
+ stop: stop$D,
441
+ track: track$8,
441
442
  visibility: visibility
442
443
  });
443
444
 
@@ -457,12 +458,12 @@ function event(key, value) {
457
458
 
458
459
  var data$i = null;
459
460
  var updates$3 = null;
460
- function start$E() {
461
+ function start$F() {
461
462
  data$i = {};
462
463
  updates$3 = {};
463
464
  count$1(5 /* Metric.InvokeCount */);
464
465
  }
465
- function stop$B() {
466
+ function stop$C() {
466
467
  data$i = {};
467
468
  updates$3 = {};
468
469
  }
@@ -503,7 +504,7 @@ function max(metric, value) {
503
504
  function compute$b() {
504
505
  encode$1(0 /* Event.Metric */);
505
506
  }
506
- function reset$p() {
507
+ function reset$q() {
507
508
  updates$3 = {};
508
509
  }
509
510
 
@@ -518,11 +519,11 @@ var data$h;
518
519
  var last = 0;
519
520
  var interval = 0;
520
521
  var timeout$6 = null;
521
- function start$D() {
522
+ function start$E() {
522
523
  interval = 60000 /* Setting.PingInterval */;
523
524
  last = 0;
524
525
  }
525
- function reset$o() {
526
+ function reset$p() {
526
527
  if (timeout$6) {
527
528
  clearTimeout(timeout$6);
528
529
  }
@@ -540,7 +541,7 @@ function ping() {
540
541
  suspend();
541
542
  }
542
543
  }
543
- function stop$A() {
544
+ function stop$B() {
544
545
  clearTimeout(timeout$6);
545
546
  last = 0;
546
547
  interval = 0;
@@ -549,19 +550,19 @@ function stop$A() {
549
550
  var ping$1 = /*#__PURE__*/Object.freeze({
550
551
  __proto__: null,
551
552
  get data () { return data$h; },
552
- reset: reset$o,
553
- start: start$D,
554
- stop: stop$A
553
+ reset: reset$p,
554
+ start: start$E,
555
+ stop: stop$B
555
556
  });
556
557
 
557
558
  var data$g = null;
558
- function start$C() {
559
+ function start$D() {
559
560
  data$g = {};
560
561
  }
561
- function stop$z() {
562
+ function stop$A() {
562
563
  data$g = {};
563
564
  }
564
- function track$6(event, time) {
565
+ function track$7(event, time) {
565
566
  if (!(event in data$g)) {
566
567
  data$g[event] = [[time, 0]];
567
568
  }
@@ -581,7 +582,7 @@ function track$6(event, time) {
581
582
  function compute$a() {
582
583
  encode$1(36 /* Event.Summary */);
583
584
  }
584
- function reset$n() {
585
+ function reset$o() {
585
586
  data$g = {};
586
587
  }
587
588
 
@@ -589,14 +590,14 @@ var summary = /*#__PURE__*/Object.freeze({
589
590
  __proto__: null,
590
591
  compute: compute$a,
591
592
  get data () { return data$g; },
592
- reset: reset$n,
593
- start: start$C,
594
- stop: stop$z,
595
- track: track$6
593
+ reset: reset$o,
594
+ start: start$D,
595
+ stop: stop$A,
596
+ track: track$7
596
597
  });
597
598
 
598
599
  var data$f = null;
599
- function start$B() {
600
+ function start$C() {
600
601
  if (!config$1.lean && config$1.upgrade) {
601
602
  config$1.upgrade("Config" /* Constant.Config */);
602
603
  }
@@ -620,15 +621,15 @@ function upgrade(key) {
620
621
  encode$1(3 /* Event.Upgrade */);
621
622
  }
622
623
  }
623
- function stop$y() {
624
+ function stop$z() {
624
625
  data$f = null;
625
626
  }
626
627
 
627
628
  var upgrade$1 = /*#__PURE__*/Object.freeze({
628
629
  __proto__: null,
629
630
  get data () { return data$f; },
630
- start: start$B,
631
- stop: stop$y,
631
+ start: start$C,
632
+ stop: stop$z,
632
633
  upgrade: upgrade
633
634
  });
634
635
 
@@ -686,8 +687,8 @@ function __generator(thisArg, body) {
686
687
  }
687
688
 
688
689
  var data$e = null;
689
- function start$A() {
690
- reset$m();
690
+ function start$B() {
691
+ reset$n();
691
692
  }
692
693
  function set(variable, value) {
693
694
  var values = typeof value === "string" /* Constant.String */ ? [value] : value;
@@ -745,11 +746,11 @@ function log$2(variable, value) {
745
746
  function compute$9() {
746
747
  encode$1(34 /* Event.Variable */);
747
748
  }
748
- function reset$m() {
749
+ function reset$n() {
749
750
  data$e = {};
750
751
  }
751
- function stop$x() {
752
- reset$m();
752
+ function stop$y() {
753
+ reset$n();
753
754
  }
754
755
  function redact(input) {
755
756
  return input && input.length >= 5 /* Setting.WordLength */ ?
@@ -786,10 +787,10 @@ var variable = /*#__PURE__*/Object.freeze({
786
787
  compute: compute$9,
787
788
  get data () { return data$e; },
788
789
  identify: identify,
789
- reset: reset$m,
790
+ reset: reset$n,
790
791
  set: set,
791
- start: start$A,
792
- stop: stop$x
792
+ start: start$B,
793
+ stop: stop$y
793
794
  });
794
795
 
795
796
  var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
@@ -851,18 +852,18 @@ function read(stream) {
851
852
  }
852
853
 
853
854
  var modules$1 = [baseline, dimension, variable, limit, summary, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
854
- function start$z() {
855
+ function start$A() {
855
856
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
856
- start$E();
857
+ start$F();
857
858
  modules$1.forEach(function (x) { return measure(x.start)(); });
858
859
  }
859
- function stop$w() {
860
+ function stop$x() {
860
861
  // Stop modules in the reverse order of their initialization
861
862
  // The ordering below should respect inter-module dependency.
862
863
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
863
864
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
864
865
  modules$1.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
865
- stop$B();
866
+ stop$C();
866
867
  }
867
868
  function compute$8() {
868
869
  compute$9();
@@ -876,7 +877,7 @@ function compute$8() {
876
877
 
877
878
  var history$5 = [];
878
879
  var data$d;
879
- function start$y() {
880
+ function start$z() {
880
881
  history$5 = [];
881
882
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
882
883
  try {
@@ -900,7 +901,7 @@ function check$4(id, target, input) {
900
901
 
901
902
  var excludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat" /* Constant.ExcludeClassNames */.split("," /* Constant.Comma */);
902
903
  var selectorMap = {};
903
- function reset$l() {
904
+ function reset$m() {
904
905
  selectorMap = {};
905
906
  }
906
907
  function get$1(input, type) {
@@ -989,7 +990,7 @@ function filter(value) {
989
990
  var selector = /*#__PURE__*/Object.freeze({
990
991
  __proto__: null,
991
992
  get: get$1,
992
- reset: reset$l
993
+ reset: reset$m
993
994
  });
994
995
 
995
996
  var index = 1;
@@ -1008,14 +1009,14 @@ var idMap = null; // Maps node => id.
1008
1009
  var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
1009
1010
  var privacyMap = null; // Maps node => Privacy (enum)
1010
1011
  var fraudMap = null; // Maps node => FraudId (number)
1011
- function start$x() {
1012
- reset$k();
1012
+ function start$y() {
1013
+ reset$l();
1013
1014
  parse$1(document, true);
1014
1015
  }
1015
- function stop$v() {
1016
- reset$k();
1016
+ function stop$w() {
1017
+ reset$l();
1017
1018
  }
1018
- function reset$k() {
1019
+ function reset$l() {
1019
1020
  index = 1;
1020
1021
  nodes = [];
1021
1022
  values = [];
@@ -1031,7 +1032,7 @@ function reset$k() {
1031
1032
  iframeMap = new WeakMap();
1032
1033
  privacyMap = new WeakMap();
1033
1034
  fraudMap = new WeakMap();
1034
- reset$l();
1035
+ reset$m();
1035
1036
  }
1036
1037
  // We parse new root nodes for any regions or masked nodes in the beginning (document) and
1037
1038
  // later whenever there are new additions or modifications to DOM (mutations)
@@ -1104,7 +1105,7 @@ function add(node, parent, data, source) {
1104
1105
  privacy(node, values[id], parentValue);
1105
1106
  updateSelector(values[id]);
1106
1107
  size$1(values[id]);
1107
- track$5(id, source);
1108
+ track$6(id, source);
1108
1109
  }
1109
1110
  function update$1(node, parent, data, source) {
1110
1111
  var id = getId(node);
@@ -1154,7 +1155,7 @@ function update$1(node, parent, data, source) {
1154
1155
  }
1155
1156
  // Update selector
1156
1157
  updateSelector(value);
1157
- track$5(id, source, changed, parentChanged);
1158
+ track$6(id, source, changed, parentChanged);
1158
1159
  }
1159
1160
  }
1160
1161
  function sameorigin(node) {
@@ -1310,7 +1311,7 @@ function remove(id, source) {
1310
1311
  var value = values[id];
1311
1312
  value.metadata.active = false;
1312
1313
  value.parent = null;
1313
- track$5(id, source);
1314
+ track$6(id, source);
1314
1315
  }
1315
1316
  }
1316
1317
  function size$1(value) {
@@ -1329,7 +1330,7 @@ function getPreviousId(node) {
1329
1330
  }
1330
1331
  return id;
1331
1332
  }
1332
- function track$5(id, source, changed, parentChanged) {
1333
+ function track$6(id, source, changed, parentChanged) {
1333
1334
  if (changed === void 0) { changed = true; }
1334
1335
  if (parentChanged === void 0) { parentChanged = false; }
1335
1336
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -1358,8 +1359,8 @@ var dom = /*#__PURE__*/Object.freeze({
1358
1359
  lookup: lookup,
1359
1360
  parse: parse$1,
1360
1361
  sameorigin: sameorigin,
1361
- start: start$x,
1362
- stop: stop$v,
1362
+ start: start$y,
1363
+ stop: stop$w,
1363
1364
  update: update$1,
1364
1365
  updates: updates$2
1365
1366
  });
@@ -1387,7 +1388,7 @@ function resume$1() {
1387
1388
  }
1388
1389
  }
1389
1390
  }
1390
- function reset$j() {
1391
+ function reset$k() {
1391
1392
  tracker = {};
1392
1393
  queuedTasks = [];
1393
1394
  activeTask = null;
@@ -1448,7 +1449,7 @@ function run() {
1448
1449
  });
1449
1450
  }
1450
1451
  }
1451
- function state$9(timer) {
1452
+ function state$a(timer) {
1452
1453
  var id = key(timer);
1453
1454
  if (id in tracker) {
1454
1455
  var elapsed = performance.now() - tracker[id].start;
@@ -1457,7 +1458,7 @@ function state$9(timer) {
1457
1458
  // If this task is no longer being tracked, send stop message to the caller
1458
1459
  return 2 /* Task.Stop */;
1459
1460
  }
1460
- function start$w(timer) {
1461
+ function start$x(timer) {
1461
1462
  tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
1462
1463
  }
1463
1464
  function restart$2(timer) {
@@ -1465,12 +1466,12 @@ function restart$2(timer) {
1465
1466
  if (tracker && tracker[id]) {
1466
1467
  var c = tracker[id].calls;
1467
1468
  var y = tracker[id].yield;
1468
- start$w(timer);
1469
+ start$x(timer);
1469
1470
  tracker[id].calls = c + 1;
1470
1471
  tracker[id].yield = y;
1471
1472
  }
1472
1473
  }
1473
- function stop$u(timer) {
1474
+ function stop$v(timer) {
1474
1475
  var end = performance.now();
1475
1476
  var id = key(timer);
1476
1477
  var duration = end - tracker[id].start;
@@ -1490,7 +1491,7 @@ function suspend$1(timer) {
1490
1491
  case 0:
1491
1492
  id = key(timer);
1492
1493
  if (!(id in tracker)) return [3 /*break*/, 2];
1493
- stop$u(timer);
1494
+ stop$v(timer);
1494
1495
  _a = tracker[id];
1495
1496
  return [4 /*yield*/, wait()];
1496
1497
  case 1:
@@ -1530,8 +1531,8 @@ function wait() {
1530
1531
  // While it's not possible to build a perfect polyfill given the nature of this API, the following code attempts to get close.
1531
1532
  // Background context: requestAnimationFrame invokes the js code right before: style, layout and paint computation within the frame.
1532
1533
  // This means, that any code that runs as part of requestAnimationFrame will by default be blocking in nature. Not what we want.
1533
- // For non-blocking behavior, We need to know when browser has finished painiting. This can be accomplished in two different ways (hacks):
1534
- // (1) Use MessageChannel to pass the message, and browser will receive the message right after pain event has occured.
1534
+ // For non-blocking behavior, We need to know when browser has finished painting. This can be accomplished in two different ways (hacks):
1535
+ // (1) Use MessageChannel to pass the message, and browser will receive the message right after paint event has occured.
1535
1536
  // (2) Use setTimeout call within requestAnimationFrame. This also works, but there's a risk that browser may throttle setTimeout calls.
1536
1537
  // Given this information, we are currently using (1) from above. More information on (2) as well as some additional context is below:
1537
1538
  // https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Performance_best_practices_for_Firefox_fe_engineers
@@ -1603,11 +1604,11 @@ function tokenize (tokens) {
1603
1604
  }
1604
1605
 
1605
1606
  var data$c;
1606
- function reset$i() {
1607
+ function reset$j() {
1607
1608
  data$c = null;
1608
1609
  }
1609
- function start$v() {
1610
- reset$i();
1610
+ function start$w() {
1611
+ reset$j();
1611
1612
  compute$7();
1612
1613
  }
1613
1614
  function compute$7() {
@@ -1633,17 +1634,91 @@ function compute$7() {
1633
1634
  encode$4(8 /* Event.Document */);
1634
1635
  }
1635
1636
  }
1637
+ function stop$u() {
1638
+ reset$j();
1639
+ }
1640
+
1641
+ var state$9 = [];
1642
+ var animationPlay = null;
1643
+ var animationPause = null;
1644
+ var animationCancel = null;
1645
+ var animationFinish = null;
1646
+ var animationId = 'clarityAnimationId';
1647
+ var operationCount = 'clarityOperationCount';
1648
+ var maxOperations = 20;
1649
+ function start$v() {
1650
+ reset$i();
1651
+ overrideAnimationHelper(animationPlay, "play");
1652
+ overrideAnimationHelper(animationPause, "pause");
1653
+ overrideAnimationHelper(animationCancel, "cancel");
1654
+ overrideAnimationHelper(animationFinish, "finish");
1655
+ }
1656
+ function reset$i() {
1657
+ state$9 = [];
1658
+ }
1659
+ function track$5(time, id, operation, keyFrames, timing, targetId, timeline) {
1660
+ state$9.push({
1661
+ time: time,
1662
+ event: 44 /* Event.Animation */,
1663
+ data: {
1664
+ id: id,
1665
+ operation: operation,
1666
+ keyFrames: keyFrames,
1667
+ timing: timing,
1668
+ targetId: targetId,
1669
+ timeline: timeline
1670
+ }
1671
+ });
1672
+ encode$4(44 /* Event.Animation */);
1673
+ }
1636
1674
  function stop$t() {
1637
1675
  reset$i();
1676
+ }
1677
+ function overrideAnimationHelper(functionToOverride, name) {
1678
+ if (functionToOverride === null) {
1679
+ functionToOverride = Animation.prototype[name];
1680
+ Animation.prototype[name] = function () {
1681
+ if (active()) {
1682
+ if (!this[animationId]) {
1683
+ this[animationId] = shortid();
1684
+ this[operationCount] = 0;
1685
+ var keyframes = this.effect.getKeyframes();
1686
+ var timing = this.effect.getTiming();
1687
+ track$5(time(), this[animationId], 0 /* AnimationOperation.Create */, JSON.stringify(keyframes), JSON.stringify(timing), getId(this.effect.target));
1688
+ }
1689
+ if (this[operationCount]++ < maxOperations) {
1690
+ var operation = null;
1691
+ switch (name) {
1692
+ case "play":
1693
+ operation = 1 /* AnimationOperation.Play */;
1694
+ break;
1695
+ case "pause":
1696
+ operation = 2 /* AnimationOperation.Pause */;
1697
+ break;
1698
+ case "cancel":
1699
+ operation = 3 /* AnimationOperation.Cancel */;
1700
+ break;
1701
+ case "finish":
1702
+ operation = 4 /* AnimationOperation.Finish */;
1703
+ break;
1704
+ }
1705
+ if (operation) {
1706
+ track$5(time(), this[animationId], operation);
1707
+ }
1708
+ }
1709
+ }
1710
+ return functionToOverride.apply(this, arguments);
1711
+ };
1712
+ }
1638
1713
  }
1639
1714
 
1640
1715
  function encode$4 (type, timer, ts) {
1641
1716
  if (timer === void 0) { timer = null; }
1642
1717
  if (ts === void 0) { ts = null; }
1643
1718
  return __awaiter(this, void 0, void 0, function () {
1644
- var eventTime, tokens, _a, d, _i, _b, r, values, _c, values_1, value, state, data, active, suspend, privacy, mangle, keys, _d, keys_1, key, box, factor, attr;
1645
- return __generator(this, function (_e) {
1646
- switch (_e.label) {
1719
+ var eventTime, tokens, _a, d, _i, _b, r, _c, _d, entry, values, _e, values_1, value, state, data, active, suspend, privacy, mangle, keys, _f, keys_1, key, box, factor, attr;
1720
+ return __generator(this, function (_g) {
1721
+ switch (_g.label) {
1647
1722
  case 0:
1648
1723
  eventTime = ts || time();
1649
1724
  tokens = [eventTime, type];
@@ -1651,17 +1726,18 @@ function encode$4 (type, timer, ts) {
1651
1726
  switch (_a) {
1652
1727
  case 8 /* Event.Document */: return [3 /*break*/, 1];
1653
1728
  case 7 /* Event.Region */: return [3 /*break*/, 2];
1654
- case 5 /* Event.Discover */: return [3 /*break*/, 3];
1655
- case 6 /* Event.Mutation */: return [3 /*break*/, 3];
1729
+ case 44 /* Event.Animation */: return [3 /*break*/, 3];
1730
+ case 5 /* Event.Discover */: return [3 /*break*/, 4];
1731
+ case 6 /* Event.Mutation */: return [3 /*break*/, 4];
1656
1732
  }
1657
- return [3 /*break*/, 10];
1733
+ return [3 /*break*/, 11];
1658
1734
  case 1:
1659
1735
  d = data$c;
1660
1736
  tokens.push(d.width);
1661
1737
  tokens.push(d.height);
1662
- track$7(type, d.width, d.height);
1738
+ track$8(type, d.width, d.height);
1663
1739
  queue(tokens);
1664
- return [3 /*break*/, 10];
1740
+ return [3 /*break*/, 11];
1665
1741
  case 2:
1666
1742
  for (_i = 0, _b = state$8; _i < _b.length; _i++) {
1667
1743
  r = _b[_i];
@@ -1673,28 +1749,42 @@ function encode$4 (type, timer, ts) {
1673
1749
  queue(tokens);
1674
1750
  }
1675
1751
  reset$h();
1676
- return [3 /*break*/, 10];
1752
+ return [3 /*break*/, 11];
1677
1753
  case 3:
1754
+ for (_c = 0, _d = state$9; _c < _d.length; _c++) {
1755
+ entry = _d[_c];
1756
+ tokens = [entry.time, entry.event];
1757
+ tokens.push(entry.data.id);
1758
+ tokens.push(entry.data.operation);
1759
+ tokens.push(entry.data.keyFrames);
1760
+ tokens.push(entry.data.timing);
1761
+ tokens.push(entry.data.timeline);
1762
+ tokens.push(entry.data.targetId);
1763
+ queue(tokens);
1764
+ }
1765
+ reset$i();
1766
+ return [3 /*break*/, 11];
1767
+ case 4:
1678
1768
  // Check if we are operating within the context of the current page
1679
- if (state$9(timer) === 2 /* Task.Stop */) {
1680
- return [3 /*break*/, 10];
1769
+ if (state$a(timer) === 2 /* Task.Stop */) {
1770
+ return [3 /*break*/, 11];
1681
1771
  }
1682
1772
  values = updates$2();
1683
- if (!(values.length > 0)) return [3 /*break*/, 9];
1684
- _c = 0, values_1 = values;
1685
- _e.label = 4;
1686
- case 4:
1687
- if (!(_c < values_1.length)) return [3 /*break*/, 8];
1688
- value = values_1[_c];
1689
- state = state$9(timer);
1690
- if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 6];
1691
- return [4 /*yield*/, suspend$1(timer)];
1773
+ if (!(values.length > 0)) return [3 /*break*/, 10];
1774
+ _e = 0, values_1 = values;
1775
+ _g.label = 5;
1692
1776
  case 5:
1693
- state = _e.sent();
1694
- _e.label = 6;
1777
+ if (!(_e < values_1.length)) return [3 /*break*/, 9];
1778
+ value = values_1[_e];
1779
+ state = state$a(timer);
1780
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 7];
1781
+ return [4 /*yield*/, suspend$1(timer)];
1695
1782
  case 6:
1783
+ state = _g.sent();
1784
+ _g.label = 7;
1785
+ case 7:
1696
1786
  if (state === 2 /* Task.Stop */) {
1697
- return [3 /*break*/, 8];
1787
+ return [3 /*break*/, 9];
1698
1788
  }
1699
1789
  data = value.data;
1700
1790
  active = value.metadata.active;
@@ -1702,8 +1792,8 @@ function encode$4 (type, timer, ts) {
1702
1792
  privacy = value.metadata.privacy;
1703
1793
  mangle = shouldMangle(value);
1704
1794
  keys = active ? ["tag", "attributes", "value"] : ["tag"];
1705
- for (_d = 0, keys_1 = keys; _d < keys_1.length; _d++) {
1706
- key = keys_1[_d];
1795
+ for (_f = 0, keys_1 = keys; _f < keys_1.length; _f++) {
1796
+ key = keys_1[_f];
1707
1797
  if (data[key]) {
1708
1798
  switch (key) {
1709
1799
  case "tag":
@@ -1735,18 +1825,18 @@ function encode$4 (type, timer, ts) {
1735
1825
  }
1736
1826
  }
1737
1827
  }
1738
- _e.label = 7;
1739
- case 7:
1740
- _c++;
1741
- return [3 /*break*/, 4];
1828
+ _g.label = 8;
1742
1829
  case 8:
1830
+ _e++;
1831
+ return [3 /*break*/, 5];
1832
+ case 9:
1743
1833
  if (type === 6 /* Event.Mutation */) {
1744
1834
  activity(eventTime);
1745
1835
  }
1746
1836
  queue(tokenize(tokens), !config$1.lean);
1747
- _e.label = 9;
1748
- case 9: return [3 /*break*/, 10];
1749
- case 10: return [2 /*return*/];
1837
+ _g.label = 10;
1838
+ case 10: return [3 /*break*/, 11];
1839
+ case 11: return [2 /*return*/];
1750
1840
  }
1751
1841
  });
1752
1842
  });
@@ -1929,7 +2019,7 @@ function recompute$8(evt) {
1929
2019
  var element = target(evt);
1930
2020
  if (element) {
1931
2021
  var value = element.value;
1932
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$1.fraud ? hash(value, 24 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
2022
+ var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$1.fraud && "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.indexOf(element.type) === -1 ? hash(value, 24 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1933
2023
  state$7.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1934
2024
  schedule$1(encode$3.bind(this, 42 /* Event.Change */));
1935
2025
  }
@@ -2591,8 +2681,8 @@ function processNode (node, source) {
2591
2681
  var styleSheet = adoptedStyleSheets_1[_i];
2592
2682
  style += getCssRules(styleSheet);
2593
2683
  }
2594
- var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
2595
- dom[call](node, shadowRoot.host, fragementData, source);
2684
+ var fragmentData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
2685
+ dom[call](node, shadowRoot.host, fragmentData, source);
2596
2686
  }
2597
2687
  else {
2598
2688
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
@@ -2777,7 +2867,7 @@ function traverse (root, timer, source) {
2777
2867
  queue.push(next);
2778
2868
  next = next.nextSibling;
2779
2869
  }
2780
- state = state$9(timer);
2870
+ state = state$a(timer);
2781
2871
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
2782
2872
  return [4 /*yield*/, suspend$1(timer)];
2783
2873
  case 2:
@@ -2900,7 +2990,7 @@ function active$2() {
2900
2990
  function handle$1(m) {
2901
2991
  // Queue up mutation records for asynchronous processing
2902
2992
  var now = time();
2903
- track$6(6 /* Event.Mutation */, now);
2993
+ track$7(6 /* Event.Mutation */, now);
2904
2994
  mutations.push({ time: now, mutations: m });
2905
2995
  schedule$1(process$1, 1 /* Priority.High */).then(function () {
2906
2996
  setTimeout(compute$7);
@@ -2914,7 +3004,7 @@ function process$1() {
2914
3004
  switch (_b.label) {
2915
3005
  case 0:
2916
3006
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2917
- start$w(timer);
3007
+ start$x(timer);
2918
3008
  _b.label = 1;
2919
3009
  case 1:
2920
3010
  if (!(mutations.length > 0)) return [3 /*break*/, 8];
@@ -2925,7 +3015,7 @@ function process$1() {
2925
3015
  case 2:
2926
3016
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2927
3017
  mutation = _a[_i];
2928
- state = state$9(timer);
3018
+ state = state$a(timer);
2929
3019
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2930
3020
  return [4 /*yield*/, suspend$1(timer)];
2931
3021
  case 3:
@@ -2970,7 +3060,7 @@ function process$1() {
2970
3060
  _b.sent();
2971
3061
  return [3 /*break*/, 1];
2972
3062
  case 8:
2973
- stop$u(timer);
3063
+ stop$v(timer);
2974
3064
  return [2 /*return*/];
2975
3065
  }
2976
3066
  });
@@ -3033,7 +3123,7 @@ function processNodeList(list, source, timer) {
3033
3123
  traverse(list[i], timer, source);
3034
3124
  return [3 /*break*/, 5];
3035
3125
  case 2:
3036
- state = state$9(timer);
3126
+ state = state$a(timer);
3037
3127
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
3038
3128
  return [4 /*yield*/, suspend$1(timer)];
3039
3129
  case 3:
@@ -3150,7 +3240,7 @@ function encode$3 (type, ts) {
3150
3240
  tokens.push(entry.data.x);
3151
3241
  tokens.push(entry.data.y);
3152
3242
  queue(tokens);
3153
- track$7(entry.event, entry.data.x, entry.data.y);
3243
+ track$8(entry.event, entry.data.x, entry.data.y);
3154
3244
  }
3155
3245
  }
3156
3246
  reset$c();
@@ -3195,7 +3285,7 @@ function encode$3 (type, ts) {
3195
3285
  r = data$b;
3196
3286
  tokens.push(r.width);
3197
3287
  tokens.push(r.height);
3198
- track$7(type, r.width, r.height);
3288
+ track$8(type, r.width, r.height);
3199
3289
  reset$b();
3200
3290
  queue(tokens);
3201
3291
  break;
@@ -3239,7 +3329,7 @@ function encode$3 (type, ts) {
3239
3329
  tokens.push(entry.data.x);
3240
3330
  tokens.push(entry.data.y);
3241
3331
  queue(tokens);
3242
- track$7(entry.event, entry.data.x, entry.data.y);
3332
+ track$8(entry.event, entry.data.x, entry.data.y);
3243
3333
  }
3244
3334
  }
3245
3335
  reset$a();
@@ -3326,7 +3416,7 @@ function track$2(time, event, hash, x, y, reaction, context) {
3326
3416
  // Since timeline only keeps the data for configured time, we still want to continue tracking these values
3327
3417
  // as part of the baseline. For instance, in a scenario where last scroll happened 5s ago.
3328
3418
  // We would still need to capture the last scroll position as part of the baseline event, even when timeline will be empty.
3329
- track$7(event, x, y);
3419
+ track$8(event, x, y);
3330
3420
  }
3331
3421
  function compute$5() {
3332
3422
  var temp = [];
@@ -3403,7 +3493,7 @@ function queue(tokens, transmit) {
3403
3493
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3404
3494
  if (transmit && timeout === null) {
3405
3495
  if (type !== 25 /* Event.Ping */) {
3406
- reset$o();
3496
+ reset$p();
3407
3497
  }
3408
3498
  timeout = setTimeout(upload, gap);
3409
3499
  queuedTime = now;
@@ -3725,22 +3815,26 @@ var keys = new Set();
3725
3815
  var variables = {};
3726
3816
  var selectors = {};
3727
3817
  var hashes = {};
3818
+ var validation = {};
3728
3819
  function start$c() {
3729
3820
  reset$4();
3730
3821
  }
3731
3822
  // Input string is of the following form:
3732
- // EXTRACT 101 { "1": ".class1", "2": "~window.a.b", "3": "!abc"}
3733
- // Which will set up event 101 to grab the contents of the class1 selector into component 1,
3823
+ // EXTRACT 101|element { "1": ".class1", "2": "~window.a.b", "3": "!abc"}
3824
+ // if element is present on the page it will set up event 101 to grab the contents of the class1 selector into component 1,
3734
3825
  // the javascript evaluated contents of window.a.b into component 2,
3735
3826
  // and the contents of Clarity's hash abc into component 3
3736
3827
  function trigger$1(input) {
3737
3828
  try {
3738
3829
  var parts = input && input.length > 0 ? input.split(/ (.*)/) : ["" /* Constant.Empty */];
3739
- var key = parseInt(parts[0]);
3830
+ var keyparts = parts[0].split(/\|(.*)/);
3831
+ var key = parseInt(keyparts[0]);
3832
+ var element = keyparts.length > 1 ? keyparts[1] : "" /* Constant.Empty */;
3740
3833
  var values = parts.length > 1 ? JSON.parse(parts[1]) : {};
3741
3834
  variables[key] = {};
3742
3835
  selectors[key] = {};
3743
3836
  hashes[key] = {};
3837
+ validation[key] = element;
3744
3838
  for (var v in values) {
3745
3839
  // values is a set of strings for proper JSON parsing, but it's more efficient
3746
3840
  // to interact with them as numbers
@@ -3779,28 +3873,30 @@ function compute$4() {
3779
3873
  try {
3780
3874
  for (var v in variables) {
3781
3875
  var key = parseInt(v);
3782
- var variableData = variables[key];
3783
- for (var v_1 in variableData) {
3784
- var variableKey = parseInt(v_1);
3785
- var value = str(evaluate(clone(variableData[variableKey])));
3786
- if (value) {
3787
- update(key, variableKey, value);
3876
+ if (validation[key] == "" /* Constant.Empty */ || document.querySelector(validation[key])) {
3877
+ var variableData = variables[key];
3878
+ for (var v_1 in variableData) {
3879
+ var variableKey = parseInt(v_1);
3880
+ var value = str(evaluate(clone(variableData[variableKey])));
3881
+ if (value) {
3882
+ update(key, variableKey, value);
3883
+ }
3788
3884
  }
3789
- }
3790
- var selectorData = selectors[key];
3791
- for (var s in selectorData) {
3792
- var selectorKey = parseInt(s);
3793
- var nodes = document.querySelectorAll(selectorData[selectorKey]);
3794
- if (nodes) {
3795
- var text = Array.from(nodes).map(function (e) { return e.textContent; });
3796
- update(key, selectorKey, text.join("<SEP>" /* Constant.Seperator */).substring(0, 10000 /* Setting.ExtractLimit */));
3885
+ var selectorData = selectors[key];
3886
+ for (var s in selectorData) {
3887
+ var selectorKey = parseInt(s);
3888
+ var nodes = document.querySelectorAll(selectorData[selectorKey]);
3889
+ if (nodes) {
3890
+ var text = Array.from(nodes).map(function (e) { return e.textContent; });
3891
+ update(key, selectorKey, text.join("<SEP>" /* Constant.Seperator */).substring(0, 10000 /* Setting.ExtractLimit */));
3892
+ }
3893
+ }
3894
+ var hashData = hashes[key];
3895
+ for (var h in hashData) {
3896
+ var hashKey = parseInt(h);
3897
+ var content = hashText(hashData[hashKey]).trim().substring(0, 10000 /* Setting.ExtractLimit */);
3898
+ update(key, hashKey, content);
3797
3899
  }
3798
- }
3799
- var hashData = hashes[key];
3800
- for (var h in hashData) {
3801
- var hashKey = parseInt(h);
3802
- var content = hashText(hashData[hashKey]).trim().substring(0, 10000 /* Setting.ExtractLimit */);
3803
- update(key, hashKey, content);
3804
3900
  }
3805
3901
  }
3806
3902
  if (keys.size > 0) {
@@ -3901,7 +3997,7 @@ function encode$1 (event) {
3901
3997
  var tokens = [t, event];
3902
3998
  switch (event) {
3903
3999
  case 4 /* Event.Baseline */:
3904
- var b = state$a;
4000
+ var b = state$b;
3905
4001
  if (b) {
3906
4002
  tokens = [b.time, b.event];
3907
4003
  tokens.push(b.data.visible);
@@ -3916,7 +4012,7 @@ function encode$1 (event) {
3916
4012
  tokens.push(b.data.activityTime);
3917
4013
  queue(tokens, false);
3918
4014
  }
3919
- reset$q();
4015
+ reset$r();
3920
4016
  break;
3921
4017
  case 25 /* Event.Ping */:
3922
4018
  tokens.push(data$h.gap);
@@ -3949,7 +4045,7 @@ function encode$1 (event) {
3949
4045
  tokens.push(v);
3950
4046
  tokens.push(data$e[v]);
3951
4047
  }
3952
- reset$m();
4048
+ reset$n();
3953
4049
  queue(tokens, false);
3954
4050
  }
3955
4051
  break;
@@ -3964,7 +4060,7 @@ function encode$1 (event) {
3964
4060
  // However, for data over the wire, we round it off to milliseconds precision.
3965
4061
  tokens.push(Math.round(updates$3[m]));
3966
4062
  }
3967
- reset$p();
4063
+ reset$q();
3968
4064
  queue(tokens, false);
3969
4065
  }
3970
4066
  break;
@@ -3990,7 +4086,7 @@ function encode$1 (event) {
3990
4086
  tokens.push(key);
3991
4087
  tokens.push([].concat.apply([], data$g[e]));
3992
4088
  }
3993
- reset$n();
4089
+ reset$o();
3994
4090
  queue(tokens, false);
3995
4091
  }
3996
4092
  break;
@@ -4524,8 +4620,8 @@ function stop$6() {
4524
4620
  var status = false;
4525
4621
  function start$6() {
4526
4622
  status = true;
4527
- start$G();
4528
- reset$j();
4623
+ start$H();
4624
+ reset$k();
4529
4625
  reset$1();
4530
4626
  reset$2();
4531
4627
  start$7();
@@ -4534,8 +4630,8 @@ function stop$5() {
4534
4630
  stop$6();
4535
4631
  reset$2();
4536
4632
  reset$1();
4537
- reset$j();
4538
- stop$D();
4633
+ reset$k();
4634
+ stop$E();
4539
4635
  status = false;
4540
4636
  }
4541
4637
  function active() {
@@ -4589,7 +4685,7 @@ function restart() {
4589
4685
  }
4590
4686
 
4591
4687
  function start$5() {
4592
- start$y();
4688
+ start$z();
4593
4689
  start$e();
4594
4690
  start$d();
4595
4691
  }
@@ -4617,14 +4713,14 @@ function discover() {
4617
4713
  case 0:
4618
4714
  ts = time();
4619
4715
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4620
- start$w(timer);
4716
+ start$x(timer);
4621
4717
  return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4622
4718
  case 1:
4623
4719
  _a.sent();
4624
4720
  return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4625
4721
  case 2:
4626
4722
  _a.sent();
4627
- stop$u(timer);
4723
+ stop$v(timer);
4628
4724
  return [2 /*return*/];
4629
4725
  }
4630
4726
  });
@@ -4634,16 +4730,18 @@ function discover() {
4634
4730
  function start$3() {
4635
4731
  // The order below is important
4636
4732
  // and is determined by interdependencies of modules
4637
- start$v();
4733
+ start$w();
4638
4734
  start$u();
4639
- start$x();
4735
+ start$y();
4640
4736
  start$h();
4641
4737
  start$4();
4738
+ start$v();
4642
4739
  }
4643
4740
  function stop$3() {
4644
4741
  stop$s();
4645
- stop$v();
4742
+ stop$w();
4646
4743
  stop$f();
4744
+ stop$u();
4647
4745
  stop$t();
4648
4746
  }
4649
4747
 
@@ -4838,7 +4936,7 @@ function start(config$1) {
4838
4936
  if (check()) {
4839
4937
  config(config$1);
4840
4938
  start$6();
4841
- start$z();
4939
+ start$A();
4842
4940
  modules.forEach(function (x) { return measure(x.start)(); });
4843
4941
  // If it's an internal call to start, without explicit configuration,
4844
4942
  // re-process any newly accumulated items in the queue
@@ -4869,7 +4967,7 @@ function stop() {
4869
4967
  if (active()) {
4870
4968
  // Stop modules in the reverse order of their initialization and start queuing up items again
4871
4969
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
4872
- stop$w();
4970
+ stop$x();
4873
4971
  stop$5();
4874
4972
  setup();
4875
4973
  }