clarity-js 0.7.10 → 0.7.13

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.10";
154
+ var version$1 = "0.7.13";
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,44 +426,48 @@ 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
 
444
445
  var data$j = null;
445
- function event(key, value) {
446
+ // custom events allow 2 parameters or 1 parameter to be passed. If 2 are passed we
447
+ // consider it a key value pair. If only 1 is passed we only consider the event to have a value.
448
+ function event(a, b) {
446
449
  if (active() &&
447
- key &&
448
- value &&
449
- typeof key === "string" /* Constant.String */ &&
450
- typeof value === "string" /* Constant.String */ &&
451
- key.length < 255 &&
452
- value.length < 255) {
453
- data$j = { key: key, value: value };
450
+ a &&
451
+ typeof a === "string" /* Constant.String */ &&
452
+ a.length < 255) {
453
+ if (b && typeof b === "string" /* Constant.String */ && b.length < 255) {
454
+ data$j = { key: a, value: b };
455
+ }
456
+ else {
457
+ data$j = { value: a };
458
+ }
454
459
  encode$1(24 /* Event.Custom */);
455
460
  }
456
461
  }
457
462
 
458
463
  var data$i = null;
459
464
  var updates$3 = null;
460
- function start$E() {
465
+ function start$F() {
461
466
  data$i = {};
462
467
  updates$3 = {};
463
468
  count$1(5 /* Metric.InvokeCount */);
464
469
  }
465
- function stop$B() {
470
+ function stop$C() {
466
471
  data$i = {};
467
472
  updates$3 = {};
468
473
  }
@@ -503,7 +508,7 @@ function max(metric, value) {
503
508
  function compute$b() {
504
509
  encode$1(0 /* Event.Metric */);
505
510
  }
506
- function reset$p() {
511
+ function reset$q() {
507
512
  updates$3 = {};
508
513
  }
509
514
 
@@ -518,11 +523,11 @@ var data$h;
518
523
  var last = 0;
519
524
  var interval = 0;
520
525
  var timeout$6 = null;
521
- function start$D() {
526
+ function start$E() {
522
527
  interval = 60000 /* Setting.PingInterval */;
523
528
  last = 0;
524
529
  }
525
- function reset$o() {
530
+ function reset$p() {
526
531
  if (timeout$6) {
527
532
  clearTimeout(timeout$6);
528
533
  }
@@ -540,7 +545,7 @@ function ping() {
540
545
  suspend();
541
546
  }
542
547
  }
543
- function stop$A() {
548
+ function stop$B() {
544
549
  clearTimeout(timeout$6);
545
550
  last = 0;
546
551
  interval = 0;
@@ -549,19 +554,19 @@ function stop$A() {
549
554
  var ping$1 = /*#__PURE__*/Object.freeze({
550
555
  __proto__: null,
551
556
  get data () { return data$h; },
552
- reset: reset$o,
553
- start: start$D,
554
- stop: stop$A
557
+ reset: reset$p,
558
+ start: start$E,
559
+ stop: stop$B
555
560
  });
556
561
 
557
562
  var data$g = null;
558
- function start$C() {
563
+ function start$D() {
559
564
  data$g = {};
560
565
  }
561
- function stop$z() {
566
+ function stop$A() {
562
567
  data$g = {};
563
568
  }
564
- function track$6(event, time) {
569
+ function track$7(event, time) {
565
570
  if (!(event in data$g)) {
566
571
  data$g[event] = [[time, 0]];
567
572
  }
@@ -581,7 +586,7 @@ function track$6(event, time) {
581
586
  function compute$a() {
582
587
  encode$1(36 /* Event.Summary */);
583
588
  }
584
- function reset$n() {
589
+ function reset$o() {
585
590
  data$g = {};
586
591
  }
587
592
 
@@ -589,14 +594,14 @@ var summary = /*#__PURE__*/Object.freeze({
589
594
  __proto__: null,
590
595
  compute: compute$a,
591
596
  get data () { return data$g; },
592
- reset: reset$n,
593
- start: start$C,
594
- stop: stop$z,
595
- track: track$6
597
+ reset: reset$o,
598
+ start: start$D,
599
+ stop: stop$A,
600
+ track: track$7
596
601
  });
597
602
 
598
603
  var data$f = null;
599
- function start$B() {
604
+ function start$C() {
600
605
  if (!config$1.lean && config$1.upgrade) {
601
606
  config$1.upgrade("Config" /* Constant.Config */);
602
607
  }
@@ -620,15 +625,15 @@ function upgrade(key) {
620
625
  encode$1(3 /* Event.Upgrade */);
621
626
  }
622
627
  }
623
- function stop$y() {
628
+ function stop$z() {
624
629
  data$f = null;
625
630
  }
626
631
 
627
632
  var upgrade$1 = /*#__PURE__*/Object.freeze({
628
633
  __proto__: null,
629
634
  get data () { return data$f; },
630
- start: start$B,
631
- stop: stop$y,
635
+ start: start$C,
636
+ stop: stop$z,
632
637
  upgrade: upgrade
633
638
  });
634
639
 
@@ -686,8 +691,8 @@ function __generator(thisArg, body) {
686
691
  }
687
692
 
688
693
  var data$e = null;
689
- function start$A() {
690
- reset$m();
694
+ function start$B() {
695
+ reset$n();
691
696
  }
692
697
  function set(variable, value) {
693
698
  var values = typeof value === "string" /* Constant.String */ ? [value] : value;
@@ -745,11 +750,11 @@ function log$2(variable, value) {
745
750
  function compute$9() {
746
751
  encode$1(34 /* Event.Variable */);
747
752
  }
748
- function reset$m() {
753
+ function reset$n() {
749
754
  data$e = {};
750
755
  }
751
- function stop$x() {
752
- reset$m();
756
+ function stop$y() {
757
+ reset$n();
753
758
  }
754
759
  function redact(input) {
755
760
  return input && input.length >= 5 /* Setting.WordLength */ ?
@@ -786,10 +791,10 @@ var variable = /*#__PURE__*/Object.freeze({
786
791
  compute: compute$9,
787
792
  get data () { return data$e; },
788
793
  identify: identify,
789
- reset: reset$m,
794
+ reset: reset$n,
790
795
  set: set,
791
- start: start$A,
792
- stop: stop$x
796
+ start: start$B,
797
+ stop: stop$y
793
798
  });
794
799
 
795
800
  var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
@@ -851,18 +856,18 @@ function read(stream) {
851
856
  }
852
857
 
853
858
  var modules$1 = [baseline, dimension, variable, limit, summary, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
854
- function start$z() {
859
+ function start$A() {
855
860
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
856
- start$E();
861
+ start$F();
857
862
  modules$1.forEach(function (x) { return measure(x.start)(); });
858
863
  }
859
- function stop$w() {
864
+ function stop$x() {
860
865
  // Stop modules in the reverse order of their initialization
861
866
  // The ordering below should respect inter-module dependency.
862
867
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
863
868
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
864
869
  modules$1.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
865
- stop$B();
870
+ stop$C();
866
871
  }
867
872
  function compute$8() {
868
873
  compute$9();
@@ -876,7 +881,7 @@ function compute$8() {
876
881
 
877
882
  var history$5 = [];
878
883
  var data$d;
879
- function start$y() {
884
+ function start$z() {
880
885
  history$5 = [];
881
886
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
882
887
  try {
@@ -900,7 +905,7 @@ function check$4(id, target, input) {
900
905
 
901
906
  var excludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat" /* Constant.ExcludeClassNames */.split("," /* Constant.Comma */);
902
907
  var selectorMap = {};
903
- function reset$l() {
908
+ function reset$m() {
904
909
  selectorMap = {};
905
910
  }
906
911
  function get$1(input, type) {
@@ -989,11 +994,11 @@ function filter(value) {
989
994
  var selector = /*#__PURE__*/Object.freeze({
990
995
  __proto__: null,
991
996
  get: get$1,
992
- reset: reset$l
997
+ reset: reset$m
993
998
  });
994
999
 
995
1000
  var index = 1;
996
- var nodes = [];
1001
+ var nodesMap = null; // Maps id => node to retrieve further node details using id.
997
1002
  var values = [];
998
1003
  var updateMap = [];
999
1004
  var hashMap = {};
@@ -1008,16 +1013,15 @@ var idMap = null; // Maps node => id.
1008
1013
  var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
1009
1014
  var privacyMap = null; // Maps node => Privacy (enum)
1010
1015
  var fraudMap = null; // Maps node => FraudId (number)
1011
- function start$x() {
1012
- reset$k();
1016
+ function start$y() {
1017
+ reset$l();
1013
1018
  parse$1(document, true);
1014
1019
  }
1015
- function stop$v() {
1016
- reset$k();
1020
+ function stop$w() {
1021
+ reset$l();
1017
1022
  }
1018
- function reset$k() {
1023
+ function reset$l() {
1019
1024
  index = 1;
1020
- nodes = [];
1021
1025
  values = [];
1022
1026
  updateMap = [];
1023
1027
  hashMap = {};
@@ -1027,11 +1031,12 @@ function reset$k() {
1027
1031
  maskExclude = "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.split("," /* Constant.Comma */);
1028
1032
  maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
1029
1033
  maskTags = "INPUT,SELECT,TEXTAREA" /* Mask.Tags */.split("," /* Constant.Comma */);
1034
+ nodesMap = new Map();
1030
1035
  idMap = new WeakMap();
1031
1036
  iframeMap = new WeakMap();
1032
1037
  privacyMap = new WeakMap();
1033
1038
  fraudMap = new WeakMap();
1034
- reset$l();
1039
+ reset$m();
1035
1040
  }
1036
1041
  // We parse new root nodes for any regions or masked nodes in the beginning (document) and
1037
1042
  // later whenever there are new additions or modifications to DOM (mutations)
@@ -1089,7 +1094,7 @@ function add(node, parent, data, source) {
1089
1094
  observe$c(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
1090
1095
  regionId = id;
1091
1096
  }
1092
- nodes[id] = node;
1097
+ nodesMap.set(id, node);
1093
1098
  values[id] = {
1094
1099
  id: id,
1095
1100
  parent: parentId,
@@ -1104,7 +1109,7 @@ function add(node, parent, data, source) {
1104
1109
  privacy(node, values[id], parentValue);
1105
1110
  updateSelector(values[id]);
1106
1111
  size$1(values[id]);
1107
- track$5(id, source);
1112
+ track$6(id, source);
1108
1113
  }
1109
1114
  function update$1(node, parent, data, source) {
1110
1115
  var id = getId(node);
@@ -1154,7 +1159,7 @@ function update$1(node, parent, data, source) {
1154
1159
  }
1155
1160
  // Update selector
1156
1161
  updateSelector(value);
1157
- track$5(id, source, changed, parentChanged);
1162
+ track$6(id, source, changed, parentChanged);
1158
1163
  }
1159
1164
  }
1160
1165
  function sameorigin(node) {
@@ -1273,10 +1278,7 @@ function hashText(hash) {
1273
1278
  return node !== null && node.textContent !== null ? node.textContent.substr(0, 25 /* Setting.ClickText */) : '';
1274
1279
  }
1275
1280
  function getNode(id) {
1276
- if (id in nodes) {
1277
- return nodes[id];
1278
- }
1279
- return null;
1281
+ return nodesMap.has(id) ? nodesMap.get(id) : null;
1280
1282
  }
1281
1283
  function getValue(id) {
1282
1284
  if (id in values) {
@@ -1292,7 +1294,7 @@ function lookup(hash) {
1292
1294
  return hash in hashMap ? hashMap[hash] : null;
1293
1295
  }
1294
1296
  function has(node) {
1295
- return getId(node) in nodes;
1297
+ return nodesMap.has(getId(node));
1296
1298
  }
1297
1299
  function updates$2() {
1298
1300
  var output = [];
@@ -1310,7 +1312,19 @@ function remove(id, source) {
1310
1312
  var value = values[id];
1311
1313
  value.metadata.active = false;
1312
1314
  value.parent = null;
1313
- track$5(id, source);
1315
+ track$6(id, source);
1316
+ // Clean up node references for removed nodes
1317
+ removeNodeFromNodesMap(id);
1318
+ }
1319
+ }
1320
+ function removeNodeFromNodesMap(id) {
1321
+ nodesMap.delete(id);
1322
+ var value = id in values ? values[id] : null;
1323
+ if (value && value.children) {
1324
+ for (var _i = 0, _a = value.children; _i < _a.length; _i++) {
1325
+ var childId = _a[_i];
1326
+ removeNodeFromNodesMap(childId);
1327
+ }
1314
1328
  }
1315
1329
  }
1316
1330
  function size$1(value) {
@@ -1329,7 +1343,7 @@ function getPreviousId(node) {
1329
1343
  }
1330
1344
  return id;
1331
1345
  }
1332
- function track$5(id, source, changed, parentChanged) {
1346
+ function track$6(id, source, changed, parentChanged) {
1333
1347
  if (changed === void 0) { changed = true; }
1334
1348
  if (parentChanged === void 0) { parentChanged = false; }
1335
1349
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -1358,8 +1372,8 @@ var dom = /*#__PURE__*/Object.freeze({
1358
1372
  lookup: lookup,
1359
1373
  parse: parse$1,
1360
1374
  sameorigin: sameorigin,
1361
- start: start$x,
1362
- stop: stop$v,
1375
+ start: start$y,
1376
+ stop: stop$w,
1363
1377
  update: update$1,
1364
1378
  updates: updates$2
1365
1379
  });
@@ -1387,7 +1401,7 @@ function resume$1() {
1387
1401
  }
1388
1402
  }
1389
1403
  }
1390
- function reset$j() {
1404
+ function reset$k() {
1391
1405
  tracker = {};
1392
1406
  queuedTasks = [];
1393
1407
  activeTask = null;
@@ -1448,7 +1462,7 @@ function run() {
1448
1462
  });
1449
1463
  }
1450
1464
  }
1451
- function state$9(timer) {
1465
+ function state$a(timer) {
1452
1466
  var id = key(timer);
1453
1467
  if (id in tracker) {
1454
1468
  var elapsed = performance.now() - tracker[id].start;
@@ -1457,7 +1471,7 @@ function state$9(timer) {
1457
1471
  // If this task is no longer being tracked, send stop message to the caller
1458
1472
  return 2 /* Task.Stop */;
1459
1473
  }
1460
- function start$w(timer) {
1474
+ function start$x(timer) {
1461
1475
  tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
1462
1476
  }
1463
1477
  function restart$2(timer) {
@@ -1465,12 +1479,12 @@ function restart$2(timer) {
1465
1479
  if (tracker && tracker[id]) {
1466
1480
  var c = tracker[id].calls;
1467
1481
  var y = tracker[id].yield;
1468
- start$w(timer);
1482
+ start$x(timer);
1469
1483
  tracker[id].calls = c + 1;
1470
1484
  tracker[id].yield = y;
1471
1485
  }
1472
1486
  }
1473
- function stop$u(timer) {
1487
+ function stop$v(timer) {
1474
1488
  var end = performance.now();
1475
1489
  var id = key(timer);
1476
1490
  var duration = end - tracker[id].start;
@@ -1490,7 +1504,7 @@ function suspend$1(timer) {
1490
1504
  case 0:
1491
1505
  id = key(timer);
1492
1506
  if (!(id in tracker)) return [3 /*break*/, 2];
1493
- stop$u(timer);
1507
+ stop$v(timer);
1494
1508
  _a = tracker[id];
1495
1509
  return [4 /*yield*/, wait()];
1496
1510
  case 1:
@@ -1530,8 +1544,8 @@ function wait() {
1530
1544
  // While it's not possible to build a perfect polyfill given the nature of this API, the following code attempts to get close.
1531
1545
  // Background context: requestAnimationFrame invokes the js code right before: style, layout and paint computation within the frame.
1532
1546
  // 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.
1547
+ // For non-blocking behavior, We need to know when browser has finished painting. This can be accomplished in two different ways (hacks):
1548
+ // (1) Use MessageChannel to pass the message, and browser will receive the message right after paint event has occured.
1535
1549
  // (2) Use setTimeout call within requestAnimationFrame. This also works, but there's a risk that browser may throttle setTimeout calls.
1536
1550
  // Given this information, we are currently using (1) from above. More information on (2) as well as some additional context is below:
1537
1551
  // https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Performance_best_practices_for_Firefox_fe_engineers
@@ -1603,11 +1617,11 @@ function tokenize (tokens) {
1603
1617
  }
1604
1618
 
1605
1619
  var data$c;
1606
- function reset$i() {
1620
+ function reset$j() {
1607
1621
  data$c = null;
1608
1622
  }
1609
- function start$v() {
1610
- reset$i();
1623
+ function start$w() {
1624
+ reset$j();
1611
1625
  compute$7();
1612
1626
  }
1613
1627
  function compute$7() {
@@ -1633,17 +1647,96 @@ function compute$7() {
1633
1647
  encode$4(8 /* Event.Document */);
1634
1648
  }
1635
1649
  }
1650
+ function stop$u() {
1651
+ reset$j();
1652
+ }
1653
+
1654
+ var state$9 = [];
1655
+ var animationPlay = null;
1656
+ var animationPause = null;
1657
+ var animationCancel = null;
1658
+ var animationFinish = null;
1659
+ var animationId = 'clarityAnimationId';
1660
+ var operationCount = 'clarityOperationCount';
1661
+ var maxOperations = 20;
1662
+ function start$v() {
1663
+ if (window["Animation"] &&
1664
+ window["KeyframeEffect"] &&
1665
+ window["KeyframeEffect"].prototype.getKeyframes &&
1666
+ window["KeyframeEffect"].prototype.getTiming) {
1667
+ reset$i();
1668
+ overrideAnimationHelper(animationPlay, "play");
1669
+ overrideAnimationHelper(animationPause, "pause");
1670
+ overrideAnimationHelper(animationCancel, "cancel");
1671
+ overrideAnimationHelper(animationFinish, "finish");
1672
+ }
1673
+ }
1674
+ function reset$i() {
1675
+ state$9 = [];
1676
+ }
1677
+ function track$5(time, id, operation, keyFrames, timing, targetId, timeline) {
1678
+ state$9.push({
1679
+ time: time,
1680
+ event: 44 /* Event.Animation */,
1681
+ data: {
1682
+ id: id,
1683
+ operation: operation,
1684
+ keyFrames: keyFrames,
1685
+ timing: timing,
1686
+ targetId: targetId,
1687
+ timeline: timeline
1688
+ }
1689
+ });
1690
+ encode$4(44 /* Event.Animation */);
1691
+ }
1636
1692
  function stop$t() {
1637
1693
  reset$i();
1694
+ }
1695
+ function overrideAnimationHelper(functionToOverride, name) {
1696
+ if (functionToOverride === null) {
1697
+ functionToOverride = Animation.prototype[name];
1698
+ Animation.prototype[name] = function () {
1699
+ if (active()) {
1700
+ if (!this[animationId]) {
1701
+ this[animationId] = shortid();
1702
+ this[operationCount] = 0;
1703
+ var keyframes = this.effect.getKeyframes();
1704
+ var timing = this.effect.getTiming();
1705
+ track$5(time(), this[animationId], 0 /* AnimationOperation.Create */, JSON.stringify(keyframes), JSON.stringify(timing), getId(this.effect.target));
1706
+ }
1707
+ if (this[operationCount]++ < maxOperations) {
1708
+ var operation = null;
1709
+ switch (name) {
1710
+ case "play":
1711
+ operation = 1 /* AnimationOperation.Play */;
1712
+ break;
1713
+ case "pause":
1714
+ operation = 2 /* AnimationOperation.Pause */;
1715
+ break;
1716
+ case "cancel":
1717
+ operation = 3 /* AnimationOperation.Cancel */;
1718
+ break;
1719
+ case "finish":
1720
+ operation = 4 /* AnimationOperation.Finish */;
1721
+ break;
1722
+ }
1723
+ if (operation) {
1724
+ track$5(time(), this[animationId], operation);
1725
+ }
1726
+ }
1727
+ }
1728
+ return functionToOverride.apply(this, arguments);
1729
+ };
1730
+ }
1638
1731
  }
1639
1732
 
1640
1733
  function encode$4 (type, timer, ts) {
1641
1734
  if (timer === void 0) { timer = null; }
1642
1735
  if (ts === void 0) { ts = null; }
1643
1736
  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) {
1737
+ 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;
1738
+ return __generator(this, function (_g) {
1739
+ switch (_g.label) {
1647
1740
  case 0:
1648
1741
  eventTime = ts || time();
1649
1742
  tokens = [eventTime, type];
@@ -1651,17 +1744,18 @@ function encode$4 (type, timer, ts) {
1651
1744
  switch (_a) {
1652
1745
  case 8 /* Event.Document */: return [3 /*break*/, 1];
1653
1746
  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];
1747
+ case 44 /* Event.Animation */: return [3 /*break*/, 3];
1748
+ case 5 /* Event.Discover */: return [3 /*break*/, 4];
1749
+ case 6 /* Event.Mutation */: return [3 /*break*/, 4];
1656
1750
  }
1657
- return [3 /*break*/, 10];
1751
+ return [3 /*break*/, 11];
1658
1752
  case 1:
1659
1753
  d = data$c;
1660
1754
  tokens.push(d.width);
1661
1755
  tokens.push(d.height);
1662
- track$7(type, d.width, d.height);
1756
+ track$8(type, d.width, d.height);
1663
1757
  queue(tokens);
1664
- return [3 /*break*/, 10];
1758
+ return [3 /*break*/, 11];
1665
1759
  case 2:
1666
1760
  for (_i = 0, _b = state$8; _i < _b.length; _i++) {
1667
1761
  r = _b[_i];
@@ -1673,28 +1767,42 @@ function encode$4 (type, timer, ts) {
1673
1767
  queue(tokens);
1674
1768
  }
1675
1769
  reset$h();
1676
- return [3 /*break*/, 10];
1770
+ return [3 /*break*/, 11];
1677
1771
  case 3:
1772
+ for (_c = 0, _d = state$9; _c < _d.length; _c++) {
1773
+ entry = _d[_c];
1774
+ tokens = [entry.time, entry.event];
1775
+ tokens.push(entry.data.id);
1776
+ tokens.push(entry.data.operation);
1777
+ tokens.push(entry.data.keyFrames);
1778
+ tokens.push(entry.data.timing);
1779
+ tokens.push(entry.data.timeline);
1780
+ tokens.push(entry.data.targetId);
1781
+ queue(tokens);
1782
+ }
1783
+ reset$i();
1784
+ return [3 /*break*/, 11];
1785
+ case 4:
1678
1786
  // 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];
1787
+ if (state$a(timer) === 2 /* Task.Stop */) {
1788
+ return [3 /*break*/, 11];
1681
1789
  }
1682
1790
  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)];
1791
+ if (!(values.length > 0)) return [3 /*break*/, 10];
1792
+ _e = 0, values_1 = values;
1793
+ _g.label = 5;
1692
1794
  case 5:
1693
- state = _e.sent();
1694
- _e.label = 6;
1795
+ if (!(_e < values_1.length)) return [3 /*break*/, 9];
1796
+ value = values_1[_e];
1797
+ state = state$a(timer);
1798
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 7];
1799
+ return [4 /*yield*/, suspend$1(timer)];
1695
1800
  case 6:
1801
+ state = _g.sent();
1802
+ _g.label = 7;
1803
+ case 7:
1696
1804
  if (state === 2 /* Task.Stop */) {
1697
- return [3 /*break*/, 8];
1805
+ return [3 /*break*/, 9];
1698
1806
  }
1699
1807
  data = value.data;
1700
1808
  active = value.metadata.active;
@@ -1702,8 +1810,8 @@ function encode$4 (type, timer, ts) {
1702
1810
  privacy = value.metadata.privacy;
1703
1811
  mangle = shouldMangle(value);
1704
1812
  keys = active ? ["tag", "attributes", "value"] : ["tag"];
1705
- for (_d = 0, keys_1 = keys; _d < keys_1.length; _d++) {
1706
- key = keys_1[_d];
1813
+ for (_f = 0, keys_1 = keys; _f < keys_1.length; _f++) {
1814
+ key = keys_1[_f];
1707
1815
  if (data[key]) {
1708
1816
  switch (key) {
1709
1817
  case "tag":
@@ -1735,18 +1843,18 @@ function encode$4 (type, timer, ts) {
1735
1843
  }
1736
1844
  }
1737
1845
  }
1738
- _e.label = 7;
1739
- case 7:
1740
- _c++;
1741
- return [3 /*break*/, 4];
1846
+ _g.label = 8;
1742
1847
  case 8:
1848
+ _e++;
1849
+ return [3 /*break*/, 5];
1850
+ case 9:
1743
1851
  if (type === 6 /* Event.Mutation */) {
1744
1852
  activity(eventTime);
1745
1853
  }
1746
1854
  queue(tokenize(tokens), !config$1.lean);
1747
- _e.label = 9;
1748
- case 9: return [3 /*break*/, 10];
1749
- case 10: return [2 /*return*/];
1855
+ _g.label = 10;
1856
+ case 10: return [3 /*break*/, 11];
1857
+ case 11: return [2 /*return*/];
1750
1858
  }
1751
1859
  });
1752
1860
  });
@@ -1929,7 +2037,7 @@ function recompute$8(evt) {
1929
2037
  var element = target(evt);
1930
2038
  if (element) {
1931
2039
  var value = element.value;
1932
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$1.fraud ? hash(value, 24 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
2040
+ 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
2041
  state$7.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1934
2042
  schedule$1(encode$3.bind(this, 42 /* Event.Change */));
1935
2043
  }
@@ -2591,8 +2699,8 @@ function processNode (node, source) {
2591
2699
  var styleSheet = adoptedStyleSheets_1[_i];
2592
2700
  style += getCssRules(styleSheet);
2593
2701
  }
2594
- var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
2595
- dom[call](node, shadowRoot.host, fragementData, source);
2702
+ var fragmentData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
2703
+ dom[call](node, shadowRoot.host, fragmentData, source);
2596
2704
  }
2597
2705
  else {
2598
2706
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
@@ -2777,7 +2885,7 @@ function traverse (root, timer, source) {
2777
2885
  queue.push(next);
2778
2886
  next = next.nextSibling;
2779
2887
  }
2780
- state = state$9(timer);
2888
+ state = state$a(timer);
2781
2889
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
2782
2890
  return [4 /*yield*/, suspend$1(timer)];
2783
2891
  case 2:
@@ -2900,7 +3008,7 @@ function active$2() {
2900
3008
  function handle$1(m) {
2901
3009
  // Queue up mutation records for asynchronous processing
2902
3010
  var now = time();
2903
- track$6(6 /* Event.Mutation */, now);
3011
+ track$7(6 /* Event.Mutation */, now);
2904
3012
  mutations.push({ time: now, mutations: m });
2905
3013
  schedule$1(process$1, 1 /* Priority.High */).then(function () {
2906
3014
  setTimeout(compute$7);
@@ -2914,7 +3022,7 @@ function process$1() {
2914
3022
  switch (_b.label) {
2915
3023
  case 0:
2916
3024
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2917
- start$w(timer);
3025
+ start$x(timer);
2918
3026
  _b.label = 1;
2919
3027
  case 1:
2920
3028
  if (!(mutations.length > 0)) return [3 /*break*/, 8];
@@ -2925,7 +3033,7 @@ function process$1() {
2925
3033
  case 2:
2926
3034
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2927
3035
  mutation = _a[_i];
2928
- state = state$9(timer);
3036
+ state = state$a(timer);
2929
3037
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2930
3038
  return [4 /*yield*/, suspend$1(timer)];
2931
3039
  case 3:
@@ -2970,7 +3078,7 @@ function process$1() {
2970
3078
  _b.sent();
2971
3079
  return [3 /*break*/, 1];
2972
3080
  case 8:
2973
- stop$u(timer);
3081
+ stop$v(timer);
2974
3082
  return [2 /*return*/];
2975
3083
  }
2976
3084
  });
@@ -3033,7 +3141,7 @@ function processNodeList(list, source, timer) {
3033
3141
  traverse(list[i], timer, source);
3034
3142
  return [3 /*break*/, 5];
3035
3143
  case 2:
3036
- state = state$9(timer);
3144
+ state = state$a(timer);
3037
3145
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
3038
3146
  return [4 /*yield*/, suspend$1(timer)];
3039
3147
  case 3:
@@ -3150,7 +3258,7 @@ function encode$3 (type, ts) {
3150
3258
  tokens.push(entry.data.x);
3151
3259
  tokens.push(entry.data.y);
3152
3260
  queue(tokens);
3153
- track$7(entry.event, entry.data.x, entry.data.y);
3261
+ track$8(entry.event, entry.data.x, entry.data.y);
3154
3262
  }
3155
3263
  }
3156
3264
  reset$c();
@@ -3195,7 +3303,7 @@ function encode$3 (type, ts) {
3195
3303
  r = data$b;
3196
3304
  tokens.push(r.width);
3197
3305
  tokens.push(r.height);
3198
- track$7(type, r.width, r.height);
3306
+ track$8(type, r.width, r.height);
3199
3307
  reset$b();
3200
3308
  queue(tokens);
3201
3309
  break;
@@ -3239,7 +3347,7 @@ function encode$3 (type, ts) {
3239
3347
  tokens.push(entry.data.x);
3240
3348
  tokens.push(entry.data.y);
3241
3349
  queue(tokens);
3242
- track$7(entry.event, entry.data.x, entry.data.y);
3350
+ track$8(entry.event, entry.data.x, entry.data.y);
3243
3351
  }
3244
3352
  }
3245
3353
  reset$a();
@@ -3326,7 +3434,7 @@ function track$2(time, event, hash, x, y, reaction, context) {
3326
3434
  // Since timeline only keeps the data for configured time, we still want to continue tracking these values
3327
3435
  // as part of the baseline. For instance, in a scenario where last scroll happened 5s ago.
3328
3436
  // 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);
3437
+ track$8(event, x, y);
3330
3438
  }
3331
3439
  function compute$5() {
3332
3440
  var temp = [];
@@ -3403,7 +3511,7 @@ function queue(tokens, transmit) {
3403
3511
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3404
3512
  if (transmit && timeout === null) {
3405
3513
  if (type !== 25 /* Event.Ping */) {
3406
- reset$o();
3514
+ reset$p();
3407
3515
  }
3408
3516
  timeout = setTimeout(upload, gap);
3409
3517
  queuedTime = now;
@@ -3907,7 +4015,7 @@ function encode$1 (event) {
3907
4015
  var tokens = [t, event];
3908
4016
  switch (event) {
3909
4017
  case 4 /* Event.Baseline */:
3910
- var b = state$a;
4018
+ var b = state$b;
3911
4019
  if (b) {
3912
4020
  tokens = [b.time, b.event];
3913
4021
  tokens.push(b.data.visible);
@@ -3922,7 +4030,7 @@ function encode$1 (event) {
3922
4030
  tokens.push(b.data.activityTime);
3923
4031
  queue(tokens, false);
3924
4032
  }
3925
- reset$q();
4033
+ reset$r();
3926
4034
  break;
3927
4035
  case 25 /* Event.Ping */:
3928
4036
  tokens.push(data$h.gap);
@@ -3943,7 +4051,8 @@ function encode$1 (event) {
3943
4051
  queue(tokens, false);
3944
4052
  break;
3945
4053
  case 24 /* Event.Custom */:
3946
- tokens.push(data$j.key);
4054
+ // not all custom events have a key - if it wasn't passed server handles just value
4055
+ data$j.key && tokens.push(data$j.key);
3947
4056
  tokens.push(data$j.value);
3948
4057
  queue(tokens);
3949
4058
  break;
@@ -3955,7 +4064,7 @@ function encode$1 (event) {
3955
4064
  tokens.push(v);
3956
4065
  tokens.push(data$e[v]);
3957
4066
  }
3958
- reset$m();
4067
+ reset$n();
3959
4068
  queue(tokens, false);
3960
4069
  }
3961
4070
  break;
@@ -3970,7 +4079,7 @@ function encode$1 (event) {
3970
4079
  // However, for data over the wire, we round it off to milliseconds precision.
3971
4080
  tokens.push(Math.round(updates$3[m]));
3972
4081
  }
3973
- reset$p();
4082
+ reset$q();
3974
4083
  queue(tokens, false);
3975
4084
  }
3976
4085
  break;
@@ -3996,7 +4105,7 @@ function encode$1 (event) {
3996
4105
  tokens.push(key);
3997
4106
  tokens.push([].concat.apply([], data$g[e]));
3998
4107
  }
3999
- reset$n();
4108
+ reset$o();
4000
4109
  queue(tokens, false);
4001
4110
  }
4002
4111
  break;
@@ -4530,8 +4639,8 @@ function stop$6() {
4530
4639
  var status = false;
4531
4640
  function start$6() {
4532
4641
  status = true;
4533
- start$G();
4534
- reset$j();
4642
+ start$H();
4643
+ reset$k();
4535
4644
  reset$1();
4536
4645
  reset$2();
4537
4646
  start$7();
@@ -4540,8 +4649,8 @@ function stop$5() {
4540
4649
  stop$6();
4541
4650
  reset$2();
4542
4651
  reset$1();
4543
- reset$j();
4544
- stop$D();
4652
+ reset$k();
4653
+ stop$E();
4545
4654
  status = false;
4546
4655
  }
4547
4656
  function active() {
@@ -4595,7 +4704,7 @@ function restart() {
4595
4704
  }
4596
4705
 
4597
4706
  function start$5() {
4598
- start$y();
4707
+ start$z();
4599
4708
  start$e();
4600
4709
  start$d();
4601
4710
  }
@@ -4623,14 +4732,14 @@ function discover() {
4623
4732
  case 0:
4624
4733
  ts = time();
4625
4734
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4626
- start$w(timer);
4735
+ start$x(timer);
4627
4736
  return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4628
4737
  case 1:
4629
4738
  _a.sent();
4630
4739
  return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4631
4740
  case 2:
4632
4741
  _a.sent();
4633
- stop$u(timer);
4742
+ stop$v(timer);
4634
4743
  return [2 /*return*/];
4635
4744
  }
4636
4745
  });
@@ -4640,16 +4749,18 @@ function discover() {
4640
4749
  function start$3() {
4641
4750
  // The order below is important
4642
4751
  // and is determined by interdependencies of modules
4643
- start$v();
4752
+ start$w();
4644
4753
  start$u();
4645
- start$x();
4754
+ start$y();
4646
4755
  start$h();
4647
4756
  start$4();
4757
+ start$v();
4648
4758
  }
4649
4759
  function stop$3() {
4650
4760
  stop$s();
4651
- stop$v();
4761
+ stop$w();
4652
4762
  stop$f();
4763
+ stop$u();
4653
4764
  stop$t();
4654
4765
  }
4655
4766
 
@@ -4844,7 +4955,7 @@ function start(config$1) {
4844
4955
  if (check()) {
4845
4956
  config(config$1);
4846
4957
  start$6();
4847
- start$z();
4958
+ start$A();
4848
4959
  modules.forEach(function (x) { return measure(x.start)(); });
4849
4960
  // If it's an internal call to start, without explicit configuration,
4850
4961
  // re-process any newly accumulated items in the queue
@@ -4875,7 +4986,7 @@ function stop() {
4875
4986
  if (active()) {
4876
4987
  // Stop modules in the reverse order of their initialization and start queuing up items again
4877
4988
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
4878
- stop$w();
4989
+ stop$x();
4879
4990
  stop$5();
4880
4991
  setup();
4881
4992
  }