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.
package/build/clarity.js CHANGED
@@ -47,6 +47,7 @@ var metadata$1 = /*#__PURE__*/Object.freeze({
47
47
  get id () { return id; },
48
48
  get metadata () { return metadata; },
49
49
  get save () { return save; },
50
+ get shortid () { return shortid; },
50
51
  get start () { return start$9; },
51
52
  get stop () { return stop$8; }
52
53
  });
@@ -140,7 +141,7 @@ function api(method) {
140
141
  }
141
142
 
142
143
  var startTime = 0;
143
- function start$G() {
144
+ function start$H() {
144
145
  startTime = performance.now();
145
146
  }
146
147
  function time(event) {
@@ -148,11 +149,11 @@ function time(event) {
148
149
  var ts = event && event.timeStamp > 0 ? event.timeStamp : performance.now();
149
150
  return Math.max(Math.round(ts - startTime), 0);
150
151
  }
151
- function stop$D() {
152
+ function stop$E() {
152
153
  startTime = 0;
153
154
  }
154
155
 
155
- var version$1 = "0.7.10";
156
+ var version$1 = "0.7.13";
156
157
 
157
158
  // tslint:disable: no-bitwise
158
159
  function hash (input, precision) {
@@ -353,18 +354,18 @@ function redact$1(value) {
353
354
  return array ? array.join("" /* Data.Constant.Empty */) : value;
354
355
  }
355
356
 
356
- var state$a = null;
357
+ var state$b = null;
357
358
  var buffer = null;
358
359
  var update$2 = false;
359
- function start$F() {
360
+ function start$G() {
360
361
  update$2 = false;
361
- reset$q();
362
+ reset$r();
362
363
  }
363
- function reset$q() {
364
+ function reset$r() {
364
365
  // Baseline state holds the previous values - if it is updated in the current payload,
365
366
  // reset the state to current value after sending the previous state
366
367
  if (update$2) {
367
- state$a = { time: time(), event: 4 /* Event.Baseline */, data: {
368
+ state$b = { time: time(), event: 4 /* Event.Baseline */, data: {
368
369
  visible: buffer.visible,
369
370
  docWidth: buffer.docWidth,
370
371
  docHeight: buffer.docHeight,
@@ -391,7 +392,7 @@ function reset$q() {
391
392
  activityTime: 0
392
393
  };
393
394
  }
394
- function track$7(event, x, y) {
395
+ function track$8(event, x, y) {
395
396
  switch (event) {
396
397
  case 8 /* Event.Document */:
397
398
  buffer.docWidth = x;
@@ -427,44 +428,48 @@ function compute$c() {
427
428
  encode$1(4 /* Event.Baseline */);
428
429
  }
429
430
  }
430
- function stop$C() {
431
- reset$q();
431
+ function stop$D() {
432
+ reset$r();
432
433
  }
433
434
 
434
435
  var baseline = /*#__PURE__*/Object.freeze({
435
436
  __proto__: null,
436
437
  activity: activity,
437
438
  compute: compute$c,
438
- reset: reset$q,
439
- start: start$F,
440
- get state () { return state$a; },
441
- stop: stop$C,
442
- track: track$7,
439
+ reset: reset$r,
440
+ start: start$G,
441
+ get state () { return state$b; },
442
+ stop: stop$D,
443
+ track: track$8,
443
444
  visibility: visibility
444
445
  });
445
446
 
446
447
  var data$j = null;
447
- function event(key, value) {
448
+ // custom events allow 2 parameters or 1 parameter to be passed. If 2 are passed we
449
+ // consider it a key value pair. If only 1 is passed we only consider the event to have a value.
450
+ function event(a, b) {
448
451
  if (active() &&
449
- key &&
450
- value &&
451
- typeof key === "string" /* Constant.String */ &&
452
- typeof value === "string" /* Constant.String */ &&
453
- key.length < 255 &&
454
- value.length < 255) {
455
- data$j = { key: key, value: value };
452
+ a &&
453
+ typeof a === "string" /* Constant.String */ &&
454
+ a.length < 255) {
455
+ if (b && typeof b === "string" /* Constant.String */ && b.length < 255) {
456
+ data$j = { key: a, value: b };
457
+ }
458
+ else {
459
+ data$j = { value: a };
460
+ }
456
461
  encode$1(24 /* Event.Custom */);
457
462
  }
458
463
  }
459
464
 
460
465
  var data$i = null;
461
466
  var updates$3 = null;
462
- function start$E() {
467
+ function start$F() {
463
468
  data$i = {};
464
469
  updates$3 = {};
465
470
  count$1(5 /* Metric.InvokeCount */);
466
471
  }
467
- function stop$B() {
472
+ function stop$C() {
468
473
  data$i = {};
469
474
  updates$3 = {};
470
475
  }
@@ -505,7 +510,7 @@ function max(metric, value) {
505
510
  function compute$b() {
506
511
  encode$1(0 /* Event.Metric */);
507
512
  }
508
- function reset$p() {
513
+ function reset$q() {
509
514
  updates$3 = {};
510
515
  }
511
516
 
@@ -520,11 +525,11 @@ var data$h;
520
525
  var last = 0;
521
526
  var interval = 0;
522
527
  var timeout$6 = null;
523
- function start$D() {
528
+ function start$E() {
524
529
  interval = 60000 /* Setting.PingInterval */;
525
530
  last = 0;
526
531
  }
527
- function reset$o() {
532
+ function reset$p() {
528
533
  if (timeout$6) {
529
534
  clearTimeout(timeout$6);
530
535
  }
@@ -542,7 +547,7 @@ function ping() {
542
547
  suspend();
543
548
  }
544
549
  }
545
- function stop$A() {
550
+ function stop$B() {
546
551
  clearTimeout(timeout$6);
547
552
  last = 0;
548
553
  interval = 0;
@@ -551,19 +556,19 @@ function stop$A() {
551
556
  var ping$1 = /*#__PURE__*/Object.freeze({
552
557
  __proto__: null,
553
558
  get data () { return data$h; },
554
- reset: reset$o,
555
- start: start$D,
556
- stop: stop$A
559
+ reset: reset$p,
560
+ start: start$E,
561
+ stop: stop$B
557
562
  });
558
563
 
559
564
  var data$g = null;
560
- function start$C() {
565
+ function start$D() {
561
566
  data$g = {};
562
567
  }
563
- function stop$z() {
568
+ function stop$A() {
564
569
  data$g = {};
565
570
  }
566
- function track$6(event, time) {
571
+ function track$7(event, time) {
567
572
  if (!(event in data$g)) {
568
573
  data$g[event] = [[time, 0]];
569
574
  }
@@ -583,7 +588,7 @@ function track$6(event, time) {
583
588
  function compute$a() {
584
589
  encode$1(36 /* Event.Summary */);
585
590
  }
586
- function reset$n() {
591
+ function reset$o() {
587
592
  data$g = {};
588
593
  }
589
594
 
@@ -591,14 +596,14 @@ var summary = /*#__PURE__*/Object.freeze({
591
596
  __proto__: null,
592
597
  compute: compute$a,
593
598
  get data () { return data$g; },
594
- reset: reset$n,
595
- start: start$C,
596
- stop: stop$z,
597
- track: track$6
599
+ reset: reset$o,
600
+ start: start$D,
601
+ stop: stop$A,
602
+ track: track$7
598
603
  });
599
604
 
600
605
  var data$f = null;
601
- function start$B() {
606
+ function start$C() {
602
607
  if (!config$1.lean && config$1.upgrade) {
603
608
  config$1.upgrade("Config" /* Constant.Config */);
604
609
  }
@@ -622,15 +627,15 @@ function upgrade(key) {
622
627
  encode$1(3 /* Event.Upgrade */);
623
628
  }
624
629
  }
625
- function stop$y() {
630
+ function stop$z() {
626
631
  data$f = null;
627
632
  }
628
633
 
629
634
  var upgrade$1 = /*#__PURE__*/Object.freeze({
630
635
  __proto__: null,
631
636
  get data () { return data$f; },
632
- start: start$B,
633
- stop: stop$y,
637
+ start: start$C,
638
+ stop: stop$z,
634
639
  upgrade: upgrade
635
640
  });
636
641
 
@@ -688,8 +693,8 @@ function __generator(thisArg, body) {
688
693
  }
689
694
 
690
695
  var data$e = null;
691
- function start$A() {
692
- reset$m();
696
+ function start$B() {
697
+ reset$n();
693
698
  }
694
699
  function set(variable, value) {
695
700
  var values = typeof value === "string" /* Constant.String */ ? [value] : value;
@@ -747,11 +752,11 @@ function log$2(variable, value) {
747
752
  function compute$9() {
748
753
  encode$1(34 /* Event.Variable */);
749
754
  }
750
- function reset$m() {
755
+ function reset$n() {
751
756
  data$e = {};
752
757
  }
753
- function stop$x() {
754
- reset$m();
758
+ function stop$y() {
759
+ reset$n();
755
760
  }
756
761
  function redact(input) {
757
762
  return input && input.length >= 5 /* Setting.WordLength */ ?
@@ -788,10 +793,10 @@ var variable = /*#__PURE__*/Object.freeze({
788
793
  compute: compute$9,
789
794
  get data () { return data$e; },
790
795
  identify: identify,
791
- reset: reset$m,
796
+ reset: reset$n,
792
797
  set: set,
793
- start: start$A,
794
- stop: stop$x
798
+ start: start$B,
799
+ stop: stop$y
795
800
  });
796
801
 
797
802
  var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
@@ -853,18 +858,18 @@ function read(stream) {
853
858
  }
854
859
 
855
860
  var modules$1 = [baseline, dimension, variable, limit, summary, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
856
- function start$z() {
861
+ function start$A() {
857
862
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
858
- start$E();
863
+ start$F();
859
864
  modules$1.forEach(function (x) { return measure(x.start)(); });
860
865
  }
861
- function stop$w() {
866
+ function stop$x() {
862
867
  // Stop modules in the reverse order of their initialization
863
868
  // The ordering below should respect inter-module dependency.
864
869
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
865
870
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
866
871
  modules$1.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
867
- stop$B();
872
+ stop$C();
868
873
  }
869
874
  function compute$8() {
870
875
  compute$9();
@@ -878,7 +883,7 @@ function compute$8() {
878
883
 
879
884
  var history$5 = [];
880
885
  var data$d;
881
- function start$y() {
886
+ function start$z() {
882
887
  history$5 = [];
883
888
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
884
889
  try {
@@ -902,7 +907,7 @@ function check$4(id, target, input) {
902
907
 
903
908
  var excludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat" /* Constant.ExcludeClassNames */.split("," /* Constant.Comma */);
904
909
  var selectorMap = {};
905
- function reset$l() {
910
+ function reset$m() {
906
911
  selectorMap = {};
907
912
  }
908
913
  function get$1(input, type) {
@@ -991,11 +996,11 @@ function filter(value) {
991
996
  var selector = /*#__PURE__*/Object.freeze({
992
997
  __proto__: null,
993
998
  get: get$1,
994
- reset: reset$l
999
+ reset: reset$m
995
1000
  });
996
1001
 
997
1002
  var index = 1;
998
- var nodes = [];
1003
+ var nodesMap = null; // Maps id => node to retrieve further node details using id.
999
1004
  var values = [];
1000
1005
  var updateMap = [];
1001
1006
  var hashMap = {};
@@ -1010,16 +1015,15 @@ var idMap = null; // Maps node => id.
1010
1015
  var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
1011
1016
  var privacyMap = null; // Maps node => Privacy (enum)
1012
1017
  var fraudMap = null; // Maps node => FraudId (number)
1013
- function start$x() {
1014
- reset$k();
1018
+ function start$y() {
1019
+ reset$l();
1015
1020
  parse$1(document, true);
1016
1021
  }
1017
- function stop$v() {
1018
- reset$k();
1022
+ function stop$w() {
1023
+ reset$l();
1019
1024
  }
1020
- function reset$k() {
1025
+ function reset$l() {
1021
1026
  index = 1;
1022
- nodes = [];
1023
1027
  values = [];
1024
1028
  updateMap = [];
1025
1029
  hashMap = {};
@@ -1029,11 +1033,12 @@ function reset$k() {
1029
1033
  maskExclude = "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.split("," /* Constant.Comma */);
1030
1034
  maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
1031
1035
  maskTags = "INPUT,SELECT,TEXTAREA" /* Mask.Tags */.split("," /* Constant.Comma */);
1036
+ nodesMap = new Map();
1032
1037
  idMap = new WeakMap();
1033
1038
  iframeMap = new WeakMap();
1034
1039
  privacyMap = new WeakMap();
1035
1040
  fraudMap = new WeakMap();
1036
- reset$l();
1041
+ reset$m();
1037
1042
  }
1038
1043
  // We parse new root nodes for any regions or masked nodes in the beginning (document) and
1039
1044
  // later whenever there are new additions or modifications to DOM (mutations)
@@ -1091,7 +1096,7 @@ function add(node, parent, data, source) {
1091
1096
  observe$c(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
1092
1097
  regionId = id;
1093
1098
  }
1094
- nodes[id] = node;
1099
+ nodesMap.set(id, node);
1095
1100
  values[id] = {
1096
1101
  id: id,
1097
1102
  parent: parentId,
@@ -1106,7 +1111,7 @@ function add(node, parent, data, source) {
1106
1111
  privacy(node, values[id], parentValue);
1107
1112
  updateSelector(values[id]);
1108
1113
  size$1(values[id]);
1109
- track$5(id, source);
1114
+ track$6(id, source);
1110
1115
  }
1111
1116
  function update$1(node, parent, data, source) {
1112
1117
  var id = getId(node);
@@ -1156,7 +1161,7 @@ function update$1(node, parent, data, source) {
1156
1161
  }
1157
1162
  // Update selector
1158
1163
  updateSelector(value);
1159
- track$5(id, source, changed, parentChanged);
1164
+ track$6(id, source, changed, parentChanged);
1160
1165
  }
1161
1166
  }
1162
1167
  function sameorigin(node) {
@@ -1275,10 +1280,7 @@ function hashText(hash) {
1275
1280
  return node !== null && node.textContent !== null ? node.textContent.substr(0, 25 /* Setting.ClickText */) : '';
1276
1281
  }
1277
1282
  function getNode(id) {
1278
- if (id in nodes) {
1279
- return nodes[id];
1280
- }
1281
- return null;
1283
+ return nodesMap.has(id) ? nodesMap.get(id) : null;
1282
1284
  }
1283
1285
  function getValue(id) {
1284
1286
  if (id in values) {
@@ -1294,7 +1296,7 @@ function lookup(hash) {
1294
1296
  return hash in hashMap ? hashMap[hash] : null;
1295
1297
  }
1296
1298
  function has(node) {
1297
- return getId(node) in nodes;
1299
+ return nodesMap.has(getId(node));
1298
1300
  }
1299
1301
  function updates$2() {
1300
1302
  var output = [];
@@ -1312,7 +1314,19 @@ function remove(id, source) {
1312
1314
  var value = values[id];
1313
1315
  value.metadata.active = false;
1314
1316
  value.parent = null;
1315
- track$5(id, source);
1317
+ track$6(id, source);
1318
+ // Clean up node references for removed nodes
1319
+ removeNodeFromNodesMap(id);
1320
+ }
1321
+ }
1322
+ function removeNodeFromNodesMap(id) {
1323
+ nodesMap.delete(id);
1324
+ var value = id in values ? values[id] : null;
1325
+ if (value && value.children) {
1326
+ for (var _i = 0, _a = value.children; _i < _a.length; _i++) {
1327
+ var childId = _a[_i];
1328
+ removeNodeFromNodesMap(childId);
1329
+ }
1316
1330
  }
1317
1331
  }
1318
1332
  function size$1(value) {
@@ -1331,7 +1345,7 @@ function getPreviousId(node) {
1331
1345
  }
1332
1346
  return id;
1333
1347
  }
1334
- function track$5(id, source, changed, parentChanged) {
1348
+ function track$6(id, source, changed, parentChanged) {
1335
1349
  if (changed === void 0) { changed = true; }
1336
1350
  if (parentChanged === void 0) { parentChanged = false; }
1337
1351
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -1360,8 +1374,8 @@ var dom = /*#__PURE__*/Object.freeze({
1360
1374
  lookup: lookup,
1361
1375
  parse: parse$1,
1362
1376
  sameorigin: sameorigin,
1363
- start: start$x,
1364
- stop: stop$v,
1377
+ start: start$y,
1378
+ stop: stop$w,
1365
1379
  update: update$1,
1366
1380
  updates: updates$2
1367
1381
  });
@@ -1389,7 +1403,7 @@ function resume$1() {
1389
1403
  }
1390
1404
  }
1391
1405
  }
1392
- function reset$j() {
1406
+ function reset$k() {
1393
1407
  tracker = {};
1394
1408
  queuedTasks = [];
1395
1409
  activeTask = null;
@@ -1450,7 +1464,7 @@ function run() {
1450
1464
  });
1451
1465
  }
1452
1466
  }
1453
- function state$9(timer) {
1467
+ function state$a(timer) {
1454
1468
  var id = key(timer);
1455
1469
  if (id in tracker) {
1456
1470
  var elapsed = performance.now() - tracker[id].start;
@@ -1459,7 +1473,7 @@ function state$9(timer) {
1459
1473
  // If this task is no longer being tracked, send stop message to the caller
1460
1474
  return 2 /* Task.Stop */;
1461
1475
  }
1462
- function start$w(timer) {
1476
+ function start$x(timer) {
1463
1477
  tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
1464
1478
  }
1465
1479
  function restart$2(timer) {
@@ -1467,12 +1481,12 @@ function restart$2(timer) {
1467
1481
  if (tracker && tracker[id]) {
1468
1482
  var c = tracker[id].calls;
1469
1483
  var y = tracker[id].yield;
1470
- start$w(timer);
1484
+ start$x(timer);
1471
1485
  tracker[id].calls = c + 1;
1472
1486
  tracker[id].yield = y;
1473
1487
  }
1474
1488
  }
1475
- function stop$u(timer) {
1489
+ function stop$v(timer) {
1476
1490
  var end = performance.now();
1477
1491
  var id = key(timer);
1478
1492
  var duration = end - tracker[id].start;
@@ -1492,7 +1506,7 @@ function suspend$1(timer) {
1492
1506
  case 0:
1493
1507
  id = key(timer);
1494
1508
  if (!(id in tracker)) return [3 /*break*/, 2];
1495
- stop$u(timer);
1509
+ stop$v(timer);
1496
1510
  _a = tracker[id];
1497
1511
  return [4 /*yield*/, wait()];
1498
1512
  case 1:
@@ -1532,8 +1546,8 @@ function wait() {
1532
1546
  // While it's not possible to build a perfect polyfill given the nature of this API, the following code attempts to get close.
1533
1547
  // Background context: requestAnimationFrame invokes the js code right before: style, layout and paint computation within the frame.
1534
1548
  // This means, that any code that runs as part of requestAnimationFrame will by default be blocking in nature. Not what we want.
1535
- // For non-blocking behavior, We need to know when browser has finished painiting. This can be accomplished in two different ways (hacks):
1536
- // (1) Use MessageChannel to pass the message, and browser will receive the message right after pain event has occured.
1549
+ // For non-blocking behavior, We need to know when browser has finished painting. This can be accomplished in two different ways (hacks):
1550
+ // (1) Use MessageChannel to pass the message, and browser will receive the message right after paint event has occured.
1537
1551
  // (2) Use setTimeout call within requestAnimationFrame. This also works, but there's a risk that browser may throttle setTimeout calls.
1538
1552
  // Given this information, we are currently using (1) from above. More information on (2) as well as some additional context is below:
1539
1553
  // https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Performance_best_practices_for_Firefox_fe_engineers
@@ -1605,11 +1619,11 @@ function tokenize (tokens) {
1605
1619
  }
1606
1620
 
1607
1621
  var data$c;
1608
- function reset$i() {
1622
+ function reset$j() {
1609
1623
  data$c = null;
1610
1624
  }
1611
- function start$v() {
1612
- reset$i();
1625
+ function start$w() {
1626
+ reset$j();
1613
1627
  compute$7();
1614
1628
  }
1615
1629
  function compute$7() {
@@ -1635,17 +1649,96 @@ function compute$7() {
1635
1649
  encode$4(8 /* Event.Document */);
1636
1650
  }
1637
1651
  }
1652
+ function stop$u() {
1653
+ reset$j();
1654
+ }
1655
+
1656
+ var state$9 = [];
1657
+ var animationPlay = null;
1658
+ var animationPause = null;
1659
+ var animationCancel = null;
1660
+ var animationFinish = null;
1661
+ var animationId = 'clarityAnimationId';
1662
+ var operationCount = 'clarityOperationCount';
1663
+ var maxOperations = 20;
1664
+ function start$v() {
1665
+ if (window["Animation"] &&
1666
+ window["KeyframeEffect"] &&
1667
+ window["KeyframeEffect"].prototype.getKeyframes &&
1668
+ window["KeyframeEffect"].prototype.getTiming) {
1669
+ reset$i();
1670
+ overrideAnimationHelper(animationPlay, "play");
1671
+ overrideAnimationHelper(animationPause, "pause");
1672
+ overrideAnimationHelper(animationCancel, "cancel");
1673
+ overrideAnimationHelper(animationFinish, "finish");
1674
+ }
1675
+ }
1676
+ function reset$i() {
1677
+ state$9 = [];
1678
+ }
1679
+ function track$5(time, id, operation, keyFrames, timing, targetId, timeline) {
1680
+ state$9.push({
1681
+ time: time,
1682
+ event: 44 /* Event.Animation */,
1683
+ data: {
1684
+ id: id,
1685
+ operation: operation,
1686
+ keyFrames: keyFrames,
1687
+ timing: timing,
1688
+ targetId: targetId,
1689
+ timeline: timeline
1690
+ }
1691
+ });
1692
+ encode$4(44 /* Event.Animation */);
1693
+ }
1638
1694
  function stop$t() {
1639
1695
  reset$i();
1696
+ }
1697
+ function overrideAnimationHelper(functionToOverride, name) {
1698
+ if (functionToOverride === null) {
1699
+ functionToOverride = Animation.prototype[name];
1700
+ Animation.prototype[name] = function () {
1701
+ if (active()) {
1702
+ if (!this[animationId]) {
1703
+ this[animationId] = shortid();
1704
+ this[operationCount] = 0;
1705
+ var keyframes = this.effect.getKeyframes();
1706
+ var timing = this.effect.getTiming();
1707
+ track$5(time(), this[animationId], 0 /* AnimationOperation.Create */, JSON.stringify(keyframes), JSON.stringify(timing), getId(this.effect.target));
1708
+ }
1709
+ if (this[operationCount]++ < maxOperations) {
1710
+ var operation = null;
1711
+ switch (name) {
1712
+ case "play":
1713
+ operation = 1 /* AnimationOperation.Play */;
1714
+ break;
1715
+ case "pause":
1716
+ operation = 2 /* AnimationOperation.Pause */;
1717
+ break;
1718
+ case "cancel":
1719
+ operation = 3 /* AnimationOperation.Cancel */;
1720
+ break;
1721
+ case "finish":
1722
+ operation = 4 /* AnimationOperation.Finish */;
1723
+ break;
1724
+ }
1725
+ if (operation) {
1726
+ track$5(time(), this[animationId], operation);
1727
+ }
1728
+ }
1729
+ }
1730
+ return functionToOverride.apply(this, arguments);
1731
+ };
1732
+ }
1640
1733
  }
1641
1734
 
1642
1735
  function encode$4 (type, timer, ts) {
1643
1736
  if (timer === void 0) { timer = null; }
1644
1737
  if (ts === void 0) { ts = null; }
1645
1738
  return __awaiter(this, void 0, void 0, function () {
1646
- 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;
1647
- return __generator(this, function (_e) {
1648
- switch (_e.label) {
1739
+ 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;
1740
+ return __generator(this, function (_g) {
1741
+ switch (_g.label) {
1649
1742
  case 0:
1650
1743
  eventTime = ts || time();
1651
1744
  tokens = [eventTime, type];
@@ -1653,17 +1746,18 @@ function encode$4 (type, timer, ts) {
1653
1746
  switch (_a) {
1654
1747
  case 8 /* Event.Document */: return [3 /*break*/, 1];
1655
1748
  case 7 /* Event.Region */: return [3 /*break*/, 2];
1656
- case 5 /* Event.Discover */: return [3 /*break*/, 3];
1657
- case 6 /* Event.Mutation */: return [3 /*break*/, 3];
1749
+ case 44 /* Event.Animation */: return [3 /*break*/, 3];
1750
+ case 5 /* Event.Discover */: return [3 /*break*/, 4];
1751
+ case 6 /* Event.Mutation */: return [3 /*break*/, 4];
1658
1752
  }
1659
- return [3 /*break*/, 10];
1753
+ return [3 /*break*/, 11];
1660
1754
  case 1:
1661
1755
  d = data$c;
1662
1756
  tokens.push(d.width);
1663
1757
  tokens.push(d.height);
1664
- track$7(type, d.width, d.height);
1758
+ track$8(type, d.width, d.height);
1665
1759
  queue(tokens);
1666
- return [3 /*break*/, 10];
1760
+ return [3 /*break*/, 11];
1667
1761
  case 2:
1668
1762
  for (_i = 0, _b = state$8; _i < _b.length; _i++) {
1669
1763
  r = _b[_i];
@@ -1675,28 +1769,42 @@ function encode$4 (type, timer, ts) {
1675
1769
  queue(tokens);
1676
1770
  }
1677
1771
  reset$h();
1678
- return [3 /*break*/, 10];
1772
+ return [3 /*break*/, 11];
1679
1773
  case 3:
1774
+ for (_c = 0, _d = state$9; _c < _d.length; _c++) {
1775
+ entry = _d[_c];
1776
+ tokens = [entry.time, entry.event];
1777
+ tokens.push(entry.data.id);
1778
+ tokens.push(entry.data.operation);
1779
+ tokens.push(entry.data.keyFrames);
1780
+ tokens.push(entry.data.timing);
1781
+ tokens.push(entry.data.timeline);
1782
+ tokens.push(entry.data.targetId);
1783
+ queue(tokens);
1784
+ }
1785
+ reset$i();
1786
+ return [3 /*break*/, 11];
1787
+ case 4:
1680
1788
  // Check if we are operating within the context of the current page
1681
- if (state$9(timer) === 2 /* Task.Stop */) {
1682
- return [3 /*break*/, 10];
1789
+ if (state$a(timer) === 2 /* Task.Stop */) {
1790
+ return [3 /*break*/, 11];
1683
1791
  }
1684
1792
  values = updates$2();
1685
- if (!(values.length > 0)) return [3 /*break*/, 9];
1686
- _c = 0, values_1 = values;
1687
- _e.label = 4;
1688
- case 4:
1689
- if (!(_c < values_1.length)) return [3 /*break*/, 8];
1690
- value = values_1[_c];
1691
- state = state$9(timer);
1692
- if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 6];
1693
- return [4 /*yield*/, suspend$1(timer)];
1793
+ if (!(values.length > 0)) return [3 /*break*/, 10];
1794
+ _e = 0, values_1 = values;
1795
+ _g.label = 5;
1694
1796
  case 5:
1695
- state = _e.sent();
1696
- _e.label = 6;
1797
+ if (!(_e < values_1.length)) return [3 /*break*/, 9];
1798
+ value = values_1[_e];
1799
+ state = state$a(timer);
1800
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 7];
1801
+ return [4 /*yield*/, suspend$1(timer)];
1697
1802
  case 6:
1803
+ state = _g.sent();
1804
+ _g.label = 7;
1805
+ case 7:
1698
1806
  if (state === 2 /* Task.Stop */) {
1699
- return [3 /*break*/, 8];
1807
+ return [3 /*break*/, 9];
1700
1808
  }
1701
1809
  data = value.data;
1702
1810
  active = value.metadata.active;
@@ -1704,8 +1812,8 @@ function encode$4 (type, timer, ts) {
1704
1812
  privacy = value.metadata.privacy;
1705
1813
  mangle = shouldMangle(value);
1706
1814
  keys = active ? ["tag", "attributes", "value"] : ["tag"];
1707
- for (_d = 0, keys_1 = keys; _d < keys_1.length; _d++) {
1708
- key = keys_1[_d];
1815
+ for (_f = 0, keys_1 = keys; _f < keys_1.length; _f++) {
1816
+ key = keys_1[_f];
1709
1817
  if (data[key]) {
1710
1818
  switch (key) {
1711
1819
  case "tag":
@@ -1737,18 +1845,18 @@ function encode$4 (type, timer, ts) {
1737
1845
  }
1738
1846
  }
1739
1847
  }
1740
- _e.label = 7;
1741
- case 7:
1742
- _c++;
1743
- return [3 /*break*/, 4];
1848
+ _g.label = 8;
1744
1849
  case 8:
1850
+ _e++;
1851
+ return [3 /*break*/, 5];
1852
+ case 9:
1745
1853
  if (type === 6 /* Event.Mutation */) {
1746
1854
  activity(eventTime);
1747
1855
  }
1748
1856
  queue(tokenize(tokens), !config$1.lean);
1749
- _e.label = 9;
1750
- case 9: return [3 /*break*/, 10];
1751
- case 10: return [2 /*return*/];
1857
+ _g.label = 10;
1858
+ case 10: return [3 /*break*/, 11];
1859
+ case 11: return [2 /*return*/];
1752
1860
  }
1753
1861
  });
1754
1862
  });
@@ -1931,7 +2039,7 @@ function recompute$8(evt) {
1931
2039
  var element = target(evt);
1932
2040
  if (element) {
1933
2041
  var value = element.value;
1934
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$1.fraud ? hash(value, 24 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
2042
+ 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 */;
1935
2043
  state$7.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1936
2044
  schedule$1(encode$3.bind(this, 42 /* Event.Change */));
1937
2045
  }
@@ -2593,8 +2701,8 @@ function processNode (node, source) {
2593
2701
  var styleSheet = adoptedStyleSheets_1[_i];
2594
2702
  style += getCssRules(styleSheet);
2595
2703
  }
2596
- var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
2597
- dom[call](node, shadowRoot.host, fragementData, source);
2704
+ var fragmentData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
2705
+ dom[call](node, shadowRoot.host, fragmentData, source);
2598
2706
  }
2599
2707
  else {
2600
2708
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
@@ -2779,7 +2887,7 @@ function traverse (root, timer, source) {
2779
2887
  queue.push(next);
2780
2888
  next = next.nextSibling;
2781
2889
  }
2782
- state = state$9(timer);
2890
+ state = state$a(timer);
2783
2891
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
2784
2892
  return [4 /*yield*/, suspend$1(timer)];
2785
2893
  case 2:
@@ -2902,7 +3010,7 @@ function active$2() {
2902
3010
  function handle$1(m) {
2903
3011
  // Queue up mutation records for asynchronous processing
2904
3012
  var now = time();
2905
- track$6(6 /* Event.Mutation */, now);
3013
+ track$7(6 /* Event.Mutation */, now);
2906
3014
  mutations.push({ time: now, mutations: m });
2907
3015
  schedule$1(process$1, 1 /* Priority.High */).then(function () {
2908
3016
  setTimeout(compute$7);
@@ -2916,7 +3024,7 @@ function process$1() {
2916
3024
  switch (_b.label) {
2917
3025
  case 0:
2918
3026
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2919
- start$w(timer);
3027
+ start$x(timer);
2920
3028
  _b.label = 1;
2921
3029
  case 1:
2922
3030
  if (!(mutations.length > 0)) return [3 /*break*/, 8];
@@ -2927,7 +3035,7 @@ function process$1() {
2927
3035
  case 2:
2928
3036
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2929
3037
  mutation = _a[_i];
2930
- state = state$9(timer);
3038
+ state = state$a(timer);
2931
3039
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2932
3040
  return [4 /*yield*/, suspend$1(timer)];
2933
3041
  case 3:
@@ -2972,7 +3080,7 @@ function process$1() {
2972
3080
  _b.sent();
2973
3081
  return [3 /*break*/, 1];
2974
3082
  case 8:
2975
- stop$u(timer);
3083
+ stop$v(timer);
2976
3084
  return [2 /*return*/];
2977
3085
  }
2978
3086
  });
@@ -3035,7 +3143,7 @@ function processNodeList(list, source, timer) {
3035
3143
  traverse(list[i], timer, source);
3036
3144
  return [3 /*break*/, 5];
3037
3145
  case 2:
3038
- state = state$9(timer);
3146
+ state = state$a(timer);
3039
3147
  if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
3040
3148
  return [4 /*yield*/, suspend$1(timer)];
3041
3149
  case 3:
@@ -3152,7 +3260,7 @@ function encode$3 (type, ts) {
3152
3260
  tokens.push(entry.data.x);
3153
3261
  tokens.push(entry.data.y);
3154
3262
  queue(tokens);
3155
- track$7(entry.event, entry.data.x, entry.data.y);
3263
+ track$8(entry.event, entry.data.x, entry.data.y);
3156
3264
  }
3157
3265
  }
3158
3266
  reset$c();
@@ -3197,7 +3305,7 @@ function encode$3 (type, ts) {
3197
3305
  r = data$b;
3198
3306
  tokens.push(r.width);
3199
3307
  tokens.push(r.height);
3200
- track$7(type, r.width, r.height);
3308
+ track$8(type, r.width, r.height);
3201
3309
  reset$b();
3202
3310
  queue(tokens);
3203
3311
  break;
@@ -3241,7 +3349,7 @@ function encode$3 (type, ts) {
3241
3349
  tokens.push(entry.data.x);
3242
3350
  tokens.push(entry.data.y);
3243
3351
  queue(tokens);
3244
- track$7(entry.event, entry.data.x, entry.data.y);
3352
+ track$8(entry.event, entry.data.x, entry.data.y);
3245
3353
  }
3246
3354
  }
3247
3355
  reset$a();
@@ -3328,7 +3436,7 @@ function track$2(time, event, hash, x, y, reaction, context) {
3328
3436
  // Since timeline only keeps the data for configured time, we still want to continue tracking these values
3329
3437
  // as part of the baseline. For instance, in a scenario where last scroll happened 5s ago.
3330
3438
  // We would still need to capture the last scroll position as part of the baseline event, even when timeline will be empty.
3331
- track$7(event, x, y);
3439
+ track$8(event, x, y);
3332
3440
  }
3333
3441
  function compute$5() {
3334
3442
  var temp = [];
@@ -3405,7 +3513,7 @@ function queue(tokens, transmit) {
3405
3513
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3406
3514
  if (transmit && timeout === null) {
3407
3515
  if (type !== 25 /* Event.Ping */) {
3408
- reset$o();
3516
+ reset$p();
3409
3517
  }
3410
3518
  timeout = setTimeout(upload, gap);
3411
3519
  queuedTime = now;
@@ -3909,7 +4017,7 @@ function encode$1 (event) {
3909
4017
  var tokens = [t, event];
3910
4018
  switch (event) {
3911
4019
  case 4 /* Event.Baseline */:
3912
- var b = state$a;
4020
+ var b = state$b;
3913
4021
  if (b) {
3914
4022
  tokens = [b.time, b.event];
3915
4023
  tokens.push(b.data.visible);
@@ -3924,7 +4032,7 @@ function encode$1 (event) {
3924
4032
  tokens.push(b.data.activityTime);
3925
4033
  queue(tokens, false);
3926
4034
  }
3927
- reset$q();
4035
+ reset$r();
3928
4036
  break;
3929
4037
  case 25 /* Event.Ping */:
3930
4038
  tokens.push(data$h.gap);
@@ -3945,7 +4053,8 @@ function encode$1 (event) {
3945
4053
  queue(tokens, false);
3946
4054
  break;
3947
4055
  case 24 /* Event.Custom */:
3948
- tokens.push(data$j.key);
4056
+ // not all custom events have a key - if it wasn't passed server handles just value
4057
+ data$j.key && tokens.push(data$j.key);
3949
4058
  tokens.push(data$j.value);
3950
4059
  queue(tokens);
3951
4060
  break;
@@ -3957,7 +4066,7 @@ function encode$1 (event) {
3957
4066
  tokens.push(v);
3958
4067
  tokens.push(data$e[v]);
3959
4068
  }
3960
- reset$m();
4069
+ reset$n();
3961
4070
  queue(tokens, false);
3962
4071
  }
3963
4072
  break;
@@ -3972,7 +4081,7 @@ function encode$1 (event) {
3972
4081
  // However, for data over the wire, we round it off to milliseconds precision.
3973
4082
  tokens.push(Math.round(updates$3[m]));
3974
4083
  }
3975
- reset$p();
4084
+ reset$q();
3976
4085
  queue(tokens, false);
3977
4086
  }
3978
4087
  break;
@@ -3998,7 +4107,7 @@ function encode$1 (event) {
3998
4107
  tokens.push(key);
3999
4108
  tokens.push([].concat.apply([], data$g[e]));
4000
4109
  }
4001
- reset$n();
4110
+ reset$o();
4002
4111
  queue(tokens, false);
4003
4112
  }
4004
4113
  break;
@@ -4532,8 +4641,8 @@ function stop$6() {
4532
4641
  var status = false;
4533
4642
  function start$6() {
4534
4643
  status = true;
4535
- start$G();
4536
- reset$j();
4644
+ start$H();
4645
+ reset$k();
4537
4646
  reset$1();
4538
4647
  reset$2();
4539
4648
  start$7();
@@ -4542,8 +4651,8 @@ function stop$5() {
4542
4651
  stop$6();
4543
4652
  reset$2();
4544
4653
  reset$1();
4545
- reset$j();
4546
- stop$D();
4654
+ reset$k();
4655
+ stop$E();
4547
4656
  status = false;
4548
4657
  }
4549
4658
  function active() {
@@ -4597,7 +4706,7 @@ function restart() {
4597
4706
  }
4598
4707
 
4599
4708
  function start$5() {
4600
- start$y();
4709
+ start$z();
4601
4710
  start$e();
4602
4711
  start$d();
4603
4712
  }
@@ -4625,14 +4734,14 @@ function discover() {
4625
4734
  case 0:
4626
4735
  ts = time();
4627
4736
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4628
- start$w(timer);
4737
+ start$x(timer);
4629
4738
  return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4630
4739
  case 1:
4631
4740
  _a.sent();
4632
4741
  return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4633
4742
  case 2:
4634
4743
  _a.sent();
4635
- stop$u(timer);
4744
+ stop$v(timer);
4636
4745
  return [2 /*return*/];
4637
4746
  }
4638
4747
  });
@@ -4642,16 +4751,18 @@ function discover() {
4642
4751
  function start$3() {
4643
4752
  // The order below is important
4644
4753
  // and is determined by interdependencies of modules
4645
- start$v();
4754
+ start$w();
4646
4755
  start$u();
4647
- start$x();
4756
+ start$y();
4648
4757
  start$h();
4649
4758
  start$4();
4759
+ start$v();
4650
4760
  }
4651
4761
  function stop$3() {
4652
4762
  stop$s();
4653
- stop$v();
4763
+ stop$w();
4654
4764
  stop$f();
4765
+ stop$u();
4655
4766
  stop$t();
4656
4767
  }
4657
4768
 
@@ -4846,7 +4957,7 @@ function start(config$1) {
4846
4957
  if (check()) {
4847
4958
  config(config$1);
4848
4959
  start$6();
4849
- start$z();
4960
+ start$A();
4850
4961
  modules.forEach(function (x) { return measure(x.start)(); });
4851
4962
  // If it's an internal call to start, without explicit configuration,
4852
4963
  // re-process any newly accumulated items in the queue
@@ -4877,7 +4988,7 @@ function stop() {
4877
4988
  if (active()) {
4878
4989
  // Stop modules in the reverse order of their initialization and start queuing up items again
4879
4990
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
4880
- stop$w();
4991
+ stop$x();
4881
4992
  stop$5();
4882
4993
  setup();
4883
4994
  }