@gemx-dev/clarity-js 0.8.80 → 0.8.82

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
@@ -102,7 +102,7 @@ var clarity = /*#__PURE__*/Object.freeze({
102
102
  get register () { return register; },
103
103
  get resume () { return resume; },
104
104
  get schedule () { return schedule; },
105
- get set () { return set; },
105
+ get set () { return set$1; },
106
106
  get signal () { return signal; },
107
107
  get start () { return start; },
108
108
  get stop () { return stop; },
@@ -149,7 +149,7 @@ function process$8() {
149
149
  }
150
150
  }
151
151
 
152
- var config$3 = {
152
+ var config$2 = {
153
153
  projectId: null,
154
154
  delay: 1 * 1000 /* Time.Second */,
155
155
  lean: false,
@@ -175,7 +175,6 @@ var config$3 = {
175
175
  includeSubdomains: true,
176
176
  modules: [],
177
177
  diagnostics: false,
178
- excludeClassNames: [],
179
178
  externalSession: false,
180
179
  userId: null,
181
180
  sessionId: null,
@@ -192,7 +191,7 @@ var startTime = 0;
192
191
  function computeStartTime() {
193
192
  return performance.now() + performance.timeOrigin;
194
193
  }
195
- function start$O() {
194
+ function start$P() {
196
195
  startTime = computeStartTime();
197
196
  }
198
197
  // event.timestamp is number of milliseconds elapsed since the document was loaded
@@ -208,11 +207,11 @@ function time(event) {
208
207
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
209
208
  return Math.max(Math.round(ts + origin - baseline), 0);
210
209
  }
211
- function stop$K() {
210
+ function stop$L() {
212
211
  startTime = 0;
213
212
  }
214
213
 
215
- var version$1 = "0.8.80";
214
+ var version$1 = "0.8.82";
216
215
 
217
216
  // tslint:disable: no-bitwise
218
217
  function hash (input, precision) {
@@ -332,7 +331,7 @@ function url$1(input, electron, truncate) {
332
331
  result = "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
333
332
  }
334
333
  else {
335
- var drop_1 = config$3.drop;
334
+ var drop_1 = config$2.drop;
336
335
  if (drop_1 && drop_1.length > 0 && input && input.indexOf("?") > 0) {
337
336
  var _a = input.split("?"), path = _a[0], query = _a[1];
338
337
  var swap_1 = "*na*" /* Data.Constant.Dropped */;
@@ -432,7 +431,7 @@ function redact$1(value) {
432
431
  var state$b = null;
433
432
  var buffer = null;
434
433
  var update$2 = false;
435
- function start$N() {
434
+ function start$O() {
436
435
  update$2 = false;
437
436
  reset$u();
438
437
  }
@@ -575,7 +574,7 @@ function compute$g() {
575
574
  encode$1(4 /* Event.Baseline */);
576
575
  }
577
576
  }
578
- function stop$J() {
577
+ function stop$K() {
579
578
  reset$u();
580
579
  }
581
580
 
@@ -585,9 +584,9 @@ var baseline = /*#__PURE__*/Object.freeze({
585
584
  compute: compute$g,
586
585
  dynamic: dynamic$1,
587
586
  reset: reset$u,
588
- start: start$N,
587
+ start: start$O,
589
588
  get state () { return state$b; },
590
- stop: stop$J,
589
+ stop: stop$K,
591
590
  track: track$8,
592
591
  visibility: visibility
593
592
  });
@@ -612,12 +611,12 @@ function event$1(a, b) {
612
611
 
613
612
  var data$k = null;
614
613
  var updates$3 = null;
615
- function start$M() {
614
+ function start$N() {
616
615
  data$k = {};
617
616
  updates$3 = {};
618
617
  count$1(5 /* Metric.InvokeCount */);
619
618
  }
620
- function stop$I() {
619
+ function stop$J() {
621
620
  data$k = {};
622
621
  updates$3 = {};
623
622
  }
@@ -673,7 +672,7 @@ var data$j;
673
672
  var last = 0;
674
673
  var interval = 0;
675
674
  var timeout$7 = null;
676
- function start$L() {
675
+ function start$M() {
677
676
  interval = 60000 /* Setting.PingInterval */;
678
677
  last = 0;
679
678
  }
@@ -695,7 +694,7 @@ function ping() {
695
694
  suspend();
696
695
  }
697
696
  }
698
- function stop$H() {
697
+ function stop$I() {
699
698
  clearTimeout$1(timeout$7);
700
699
  last = 0;
701
700
  interval = 0;
@@ -705,15 +704,15 @@ var ping$1 = /*#__PURE__*/Object.freeze({
705
704
  __proto__: null,
706
705
  get data () { return data$j; },
707
706
  reset: reset$s,
708
- start: start$L,
709
- stop: stop$H
707
+ start: start$M,
708
+ stop: stop$I
710
709
  });
711
710
 
712
711
  var data$i = null;
713
- function start$K() {
712
+ function start$L() {
714
713
  data$i = {};
715
714
  }
716
- function stop$G() {
715
+ function stop$H() {
717
716
  data$i = {};
718
717
  }
719
718
  function track$7(event, time) {
@@ -745,8 +744,8 @@ var summary = /*#__PURE__*/Object.freeze({
745
744
  compute: compute$e,
746
745
  get data () { return data$i; },
747
746
  reset: reset$r,
748
- start: start$K,
749
- stop: stop$G,
747
+ start: start$L,
748
+ stop: stop$H,
750
749
  track: track$7
751
750
  });
752
751
 
@@ -885,10 +884,10 @@ function read(stream) {
885
884
  }
886
885
 
887
886
  var data$h = null;
888
- function start$J() {
887
+ function start$K() {
889
888
  reset$q();
890
889
  }
891
- function set(variable, value) {
890
+ function set$1(variable, value) {
892
891
  var values = typeof value === "string" /* Constant.String */ ? [value] : value;
893
892
  log$2(variable, values);
894
893
  }
@@ -947,7 +946,7 @@ function compute$d() {
947
946
  function reset$q() {
948
947
  data$h = {};
949
948
  }
950
- function stop$F() {
949
+ function stop$G() {
951
950
  reset$q();
952
951
  }
953
952
  function redact(input) {
@@ -986,9 +985,9 @@ var variable = /*#__PURE__*/Object.freeze({
986
985
  get data () { return data$h; },
987
986
  identify: identify,
988
987
  reset: reset$q,
989
- set: set,
990
- start: start$J,
991
- stop: stop$F
988
+ set: set$1,
989
+ start: start$K,
990
+ stop: stop$G
992
991
  });
993
992
 
994
993
  var data$g = {};
@@ -997,7 +996,7 @@ var variables = {};
997
996
  var selectors = {};
998
997
  var hashes = {};
999
998
  var validation = {};
1000
- function start$I() {
999
+ function start$J() {
1001
1000
  reset$p();
1002
1001
  }
1003
1002
  // Input string is of the following form:
@@ -1113,7 +1112,7 @@ function update$1(key, subkey, value) {
1113
1112
  }
1114
1113
  return;
1115
1114
  }
1116
- function stop$E() {
1115
+ function stop$F() {
1117
1116
  reset$p();
1118
1117
  }
1119
1118
  function parse$1(variable) {
@@ -1186,8 +1185,8 @@ var extract = /*#__PURE__*/Object.freeze({
1186
1185
  data: data$g,
1187
1186
  keys: keys,
1188
1187
  reset: reset$p,
1189
- start: start$I,
1190
- stop: stop$E,
1188
+ start: start$J,
1189
+ stop: stop$F,
1191
1190
  trigger: trigger$2,
1192
1191
  update: update$1
1193
1192
  });
@@ -1215,10 +1214,10 @@ function decodeCookieValue(value) {
1215
1214
 
1216
1215
  var rootDomain = null;
1217
1216
  var COOKIE_SEP = "^" /* Constant.Caret */;
1218
- function start$H() {
1217
+ function start$I() {
1219
1218
  rootDomain = null;
1220
1219
  }
1221
- function stop$D() {
1220
+ function stop$E() {
1222
1221
  rootDomain = null;
1223
1222
  }
1224
1223
  function getCookie(key, limit) {
@@ -1254,7 +1253,7 @@ function getCookie(key, limit) {
1254
1253
  function setCookie(key, value, time) {
1255
1254
  // only write cookies if we are currently in a cookie writing mode (and they are supported)
1256
1255
  // OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
1257
- if ((config$3.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1256
+ if ((config$2.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1258
1257
  // Some browsers automatically url encode cookie values if they are not url encoded.
1259
1258
  // We therefore encode and decode cookie values ourselves.
1260
1259
  var encodedValue = encodeCookieValue(value);
@@ -1300,6 +1299,34 @@ var cookie = /*#__PURE__*/Object.freeze({
1300
1299
  COOKIE_SEP: COOKIE_SEP,
1301
1300
  getCookie: getCookie,
1302
1301
  setCookie: setCookie,
1302
+ start: start$I,
1303
+ stop: stop$E
1304
+ });
1305
+
1306
+ var defaultConfig = {
1307
+ excludeClassNames: [],
1308
+ };
1309
+ var _config = __assign({}, defaultConfig);
1310
+ function start$H() {
1311
+ var _a, _b;
1312
+ _config = {
1313
+ excludeClassNames: ((_b = (_a = window === null || window === void 0 ? void 0 : window.GemXHeatmap) === null || _a === void 0 ? void 0 : _a.excludeClassNames) !== null && _b !== void 0 ? _b : []),
1314
+ };
1315
+ }
1316
+ function stop$D() {
1317
+ _config = __assign({}, defaultConfig);
1318
+ }
1319
+ function set(config) {
1320
+ _config = __assign(__assign({}, _config), config);
1321
+ }
1322
+ function get$2() {
1323
+ return _config;
1324
+ }
1325
+
1326
+ var gemx = /*#__PURE__*/Object.freeze({
1327
+ __proto__: null,
1328
+ get: get$2,
1329
+ set: set,
1303
1330
  start: start$H,
1304
1331
  stop: stop$D
1305
1332
  });
@@ -1332,10 +1359,10 @@ function signalsEvent(signalsPayload) {
1332
1359
  }
1333
1360
  }
1334
1361
 
1335
- var modules$2 = [baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1362
+ var modules$2 = [gemx, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1336
1363
  function start$G() {
1337
1364
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1338
- start$M();
1365
+ start$N();
1339
1366
  modules$2.forEach(function (x) { return measure(x.start)(); });
1340
1367
  }
1341
1368
  function stop$C() {
@@ -1344,7 +1371,7 @@ function stop$C() {
1344
1371
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1345
1372
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1346
1373
  modules$2.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1347
- stop$I();
1374
+ stop$J();
1348
1375
  }
1349
1376
  function compute$b() {
1350
1377
  compute$d();
@@ -1372,7 +1399,7 @@ function start$F() {
1372
1399
  }
1373
1400
  function check$5(id, target, input) {
1374
1401
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1375
- if (config$3.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1402
+ if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1376
1403
  data$f = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1377
1404
  // Only encode this event if we haven't already reported this hash
1378
1405
  if (history$5.indexOf(data$f.checksum) < 0) {
@@ -1405,7 +1432,7 @@ function recompute$8(evt) {
1405
1432
  var element = target(evt);
1406
1433
  if (element) {
1407
1434
  var value = element.value;
1408
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$3.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1435
+ var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$2.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1409
1436
  state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1410
1437
  schedule(encode$4.bind(this, 42 /* Event.Change */));
1411
1438
  }
@@ -1474,7 +1501,7 @@ function handler$4(event, root, evt) {
1474
1501
  // Check for null values before processing this event
1475
1502
  if (x !== null && y !== null) {
1476
1503
  var textInfo = text(t);
1477
- if (config$3.diagnostics) {
1504
+ if (config$2.diagnostics) {
1478
1505
  var el = t;
1479
1506
  console.log("[clarity:click] text debug", {
1480
1507
  tag: el === null || el === void 0 ? void 0 : el.tagName,
@@ -1511,7 +1538,7 @@ function handler$4(event, root, evt) {
1511
1538
  tag: getElementAttribute(t, "tagName").substring(0, 10 /* Setting.ClickTag */),
1512
1539
  class: getElementAttribute(t, "className").substring(0, 50 /* Setting.ClickClass */),
1513
1540
  id: getElementAttribute(t, "id").substring(0, 25 /* Setting.ClickId */),
1514
- source: config$3.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1541
+ source: config$2.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1515
1542
  }
1516
1543
  });
1517
1544
  schedule(encode$4.bind(this, event));
@@ -2297,7 +2324,7 @@ var styleTimeMap = {};
2297
2324
  var documentNodes = [];
2298
2325
  var createdSheetIds = [];
2299
2326
  function proxyStyleRules$1(win) {
2300
- if ((config$3.lean && config$3.lite) || win === null || win === undefined) {
2327
+ if ((config$2.lean && config$2.lite) || win === null || win === undefined) {
2301
2328
  return;
2302
2329
  }
2303
2330
  win.clarityOverrides = win.clarityOverrides || {};
@@ -2336,7 +2363,7 @@ function start$q() {
2336
2363
  proxyStyleRules$1(window);
2337
2364
  }
2338
2365
  function checkDocumentStyles(documentNode, timestamp) {
2339
- if (config$3.lean && config$3.lite) {
2366
+ if (config$2.lean && config$2.lite) {
2340
2367
  return;
2341
2368
  }
2342
2369
  if (documentNodes.indexOf(documentNode) === -1) {
@@ -2729,7 +2756,7 @@ function encode$5 (type, timer, ts) {
2729
2756
  if (type === 6 /* Event.Mutation */) {
2730
2757
  activity(eventTime);
2731
2758
  }
2732
- queue(tokenize(tokens), !config$3.lean);
2759
+ queue(tokenize(tokens), !config$2.lean);
2733
2760
  _o.label = 11;
2734
2761
  case 11: return [3 /*break*/, 13];
2735
2762
  case 12:
@@ -2942,7 +2969,7 @@ function processMutation(timer, mutation, instance, timestamp) {
2942
2969
  return [2 /*return*/];
2943
2970
  }
2944
2971
  target = mutation.target;
2945
- type = config$3.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
2972
+ type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
2946
2973
  if (type && target && target.ownerDocument) {
2947
2974
  parse(target.ownerDocument);
2948
2975
  }
@@ -3646,14 +3673,10 @@ function getAttributes$1(element) {
3646
3673
  }
3647
3674
 
3648
3675
  var excludeClassNames = ExcludeClassNamesList;
3649
- var extraExcludeClassNames = [];
3650
3676
  var selectorMap = {};
3651
3677
  function reset$8() {
3652
3678
  selectorMap = {};
3653
3679
  }
3654
- function config$2(classNames) {
3655
- extraExcludeClassNames = classNames || [];
3656
- }
3657
3680
  function get$1(input, type) {
3658
3681
  var a = input.attributes;
3659
3682
  var prefix = input.prefix ? input.prefix[type] : null;
@@ -3744,12 +3767,13 @@ function filter(value) {
3744
3767
  return true;
3745
3768
  }
3746
3769
  function getExcludeClassNames() {
3747
- return __spreadArray(__spreadArray([], excludeClassNames, true), extraExcludeClassNames, true);
3770
+ var clarityConfig = excludeClassNames;
3771
+ var gemxStoreConfig = get$2().excludeClassNames;
3772
+ return __spreadArray(__spreadArray([], clarityConfig, true), gemxStoreConfig, true);
3748
3773
  }
3749
3774
 
3750
3775
  var selector = /*#__PURE__*/Object.freeze({
3751
3776
  __proto__: null,
3752
- config: config$2,
3753
3777
  get: get$1,
3754
3778
  reset: reset$8
3755
3779
  });
@@ -3806,14 +3830,14 @@ function parse(root, init) {
3806
3830
  try {
3807
3831
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
3808
3832
  if (init) {
3809
- config$3.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3833
+ config$2.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3810
3834
  }
3811
3835
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
3812
3836
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
3813
3837
  if ("querySelectorAll" in root) {
3814
- config$3.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3815
- config$3.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3816
- config$3.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3838
+ config$2.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3839
+ config$2.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3840
+ config$2.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3817
3841
  unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
3818
3842
  }
3819
3843
  }
@@ -3844,7 +3868,7 @@ function add$1(node, parent, data, source) {
3844
3868
  var parentValue = null;
3845
3869
  var regionId = exists(node) ? id : null;
3846
3870
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
3847
- var privacyId = config$3.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
3871
+ var privacyId = config$2.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
3848
3872
  if (parentId >= 0 && values$1[parentId]) {
3849
3873
  parentValue = values$1[parentId];
3850
3874
  parentValue.children.push(id);
@@ -4148,7 +4172,7 @@ function getPreviousId(node) {
4148
4172
  function track$4(id, source, changed, parentChanged) {
4149
4173
  if (changed === void 0) { changed = true; }
4150
4174
  if (parentChanged === void 0) { parentChanged = false; }
4151
- if (config$3.lean && config$3.lite) {
4175
+ if (config$2.lean && config$2.lite) {
4152
4176
  return;
4153
4177
  }
4154
4178
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -4322,6 +4346,10 @@ function metadata$2(node, event, text) {
4322
4346
  var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */ };
4323
4347
  if (node) {
4324
4348
  var value = get(node);
4349
+ console.log("[GemX - Target - Metadata]", {
4350
+ selector: value.selector,
4351
+ hash: value.hash,
4352
+ });
4325
4353
  if (value !== null) {
4326
4354
  var metadata_1 = value.metadata;
4327
4355
  output.id = value.id;
@@ -4384,6 +4412,10 @@ function encode$4 (type, ts) {
4384
4412
  cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
4385
4413
  tokens = [entry.time, entry.event];
4386
4414
  cHash = cTarget.hash ? cTarget.hash.join("." /* Constant.Dot */) : "" /* Constant.Empty */;
4415
+ console.log("[GemX - Interaction - Encode]", {
4416
+ cHash: cHash,
4417
+ cTarget: cTarget,
4418
+ });
4387
4419
  tokens.push(cTarget.id);
4388
4420
  tokens.push(entry.data.x);
4389
4421
  tokens.push(entry.data.y);
@@ -4741,8 +4773,8 @@ var modules$1 = null;
4741
4773
  function start$i() {
4742
4774
  active$2 = true;
4743
4775
  modules$1 = new Set();
4744
- if (config$3.modules && config$3.modules.length > 0) {
4745
- config$3.modules.forEach(function (m) { event(m); });
4776
+ if (config$2.modules && config$2.modules.length > 0) {
4777
+ config$2.modules.forEach(function (m) { event(m); });
4746
4778
  }
4747
4779
  }
4748
4780
  function stop$g() {
@@ -4830,7 +4862,7 @@ function queue(tokens, transmit) {
4830
4862
  var now = time();
4831
4863
  var type = tokens.length > 1 ? tokens[1] : null;
4832
4864
  var event = JSON.stringify(tokens);
4833
- if (!config$3.lean) {
4865
+ if (!config$2.lean) {
4834
4866
  leanLimit = false;
4835
4867
  }
4836
4868
  else if (!leanLimit && playbackBytes + event.length > 10485760 /* Setting.PlaybackBytesLimit */) {
@@ -4906,7 +4938,7 @@ function upload(final) {
4906
4938
  return [2 /*return*/];
4907
4939
  }
4908
4940
  timeout = null;
4909
- sendPlaybackBytes = config$3.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
4941
+ sendPlaybackBytes = config$2.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
4910
4942
  if (sendPlaybackBytes) {
4911
4943
  max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
4912
4944
  }
@@ -4959,8 +4991,8 @@ function stringify(encoded) {
4959
4991
  function send(payload, zipped, sequence, beacon) {
4960
4992
  if (beacon === void 0) { beacon = false; }
4961
4993
  // Upload data if a valid URL is defined in the config
4962
- if (typeof config$3.upload === "string" /* Constant.String */) {
4963
- var url_1 = config$3.upload;
4994
+ if (typeof config$2.upload === "string" /* Constant.String */) {
4995
+ var url_1 = config$2.upload;
4964
4996
  var dispatched = false;
4965
4997
  // If it's the last payload, attempt to upload using sendBeacon first.
4966
4998
  // The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
@@ -5011,8 +5043,8 @@ function send(payload, zipped, sequence, beacon) {
5011
5043
  }
5012
5044
  }
5013
5045
  }
5014
- else if (config$3.upload) {
5015
- var callback = config$3.upload;
5046
+ else if (config$2.upload) {
5047
+ var callback = config$2.upload;
5016
5048
  callback(payload);
5017
5049
  done(sequence);
5018
5050
  }
@@ -5034,7 +5066,7 @@ function check$3(xhr, sequence) {
5034
5066
  // 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
5035
5067
  // In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
5036
5068
  if (xhr.status === 0) {
5037
- config$3.upload = config$3.fallback ? config$3.fallback : config$3.upload;
5069
+ config$2.upload = config$2.fallback ? config$2.fallback : config$2.upload;
5038
5070
  }
5039
5071
  // Capture the status code and number of attempts so we can report it back to the server
5040
5072
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
@@ -5081,8 +5113,8 @@ function done(sequence) {
5081
5113
  function delay() {
5082
5114
  // Progressively increase delay as we continue to send more payloads from the client to the server
5083
5115
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
5084
- var gap = config$3.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$3.delay;
5085
- return typeof config$3.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$3.delay;
5116
+ var gap = config$2.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$2.delay;
5117
+ return typeof config$2.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$2.delay;
5086
5118
  }
5087
5119
  function response(payload) {
5088
5120
  var lines = payload && payload.length > 0 ? payload.split("\n") : [];
@@ -5100,8 +5132,8 @@ function response(payload) {
5100
5132
  break;
5101
5133
  case "ACTION" /* Constant.Action */:
5102
5134
  // Invoke action callback, if configured and has a valid value
5103
- if (config$3.action && parts.length > 1) {
5104
- config$3.action(parts[1]);
5135
+ if (config$2.action && parts.length > 1) {
5136
+ config$2.action(parts[1]);
5105
5137
  }
5106
5138
  break;
5107
5139
  case "EXTRACT" /* Constant.Extract */:
@@ -5120,7 +5152,7 @@ function response(payload) {
5120
5152
  }
5121
5153
  break;
5122
5154
  case "SNAPSHOT" /* Constant.Snapshot */:
5123
- config$3.lean = false; // Disable lean mode to ensure we can send playback information to server.
5155
+ config$2.lean = false; // Disable lean mode to ensure we can send playback information to server.
5124
5156
  snapshot();
5125
5157
  break;
5126
5158
  }
@@ -5454,8 +5486,8 @@ function discover() {
5454
5486
 
5455
5487
  var data$6 = null;
5456
5488
  function start$c() {
5457
- if (!config$3.lean && config$3.upgrade) {
5458
- config$3.upgrade("Config" /* Constant.Config */);
5489
+ if (!config$2.lean && config$2.upgrade) {
5490
+ config$2.upgrade("Config" /* Constant.Config */);
5459
5491
  }
5460
5492
  data$6 = null;
5461
5493
  }
@@ -5465,18 +5497,18 @@ function start$c() {
5465
5497
  // and send all backed up layout events to the server.
5466
5498
  function upgrade(key) {
5467
5499
  // Upgrade only if Clarity was successfully activated on the page
5468
- if (active() && config$3.lean) {
5469
- config$3.lean = false;
5500
+ if (active() && config$2.lean) {
5501
+ config$2.lean = false;
5470
5502
  data$6 = { key: key };
5471
5503
  // Update metadata to track we have upgraded this session
5472
5504
  callback();
5473
5505
  save();
5474
5506
  // Callback upgrade handler, if configured
5475
- if (config$3.upgrade) {
5476
- config$3.upgrade(key);
5507
+ if (config$2.upgrade) {
5508
+ config$2.upgrade(key);
5477
5509
  }
5478
5510
  encode$1(3 /* Event.Upgrade */);
5479
- if (config$3.lite) {
5511
+ if (config$2.lite) {
5480
5512
  start$d();
5481
5513
  start$q();
5482
5514
  }
@@ -5770,7 +5802,7 @@ function compute$2() {
5770
5802
  if (updateConsent) {
5771
5803
  encode$1(47 /* Event.Consent */);
5772
5804
  updateConsent = false;
5773
- if (!config$3.track) {
5805
+ if (!config$2.track) {
5774
5806
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5775
5807
  if (ics === null || ics === void 0 ? void 0 : ics.usedUpdate) {
5776
5808
  processConsent();
@@ -5796,13 +5828,13 @@ function start$8() {
5796
5828
  // Populate ids for this page
5797
5829
  var s = session();
5798
5830
  var u = user();
5799
- var projectId = config$3.projectId || hash(location.host);
5800
- var userId = config$3.externalSession && config$3.userId ? config$3.userId : u.id;
5801
- var sessionId = config$3.externalSession && config$3.sessionId ? config$3.sessionId : s.session;
5831
+ var projectId = config$2.projectId || hash(location.host);
5832
+ var userId = config$2.externalSession && config$2.userId ? config$2.userId : u.id;
5833
+ var sessionId = config$2.externalSession && config$2.sessionId ? config$2.sessionId : s.session;
5802
5834
  data$2 = { projectId: projectId, userId: userId, sessionId: sessionId, pageNum: s.count };
5803
5835
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
5804
- config$3.lean = config$3.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$3.lean;
5805
- config$3.upload = config$3.track && typeof config$3.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$3.upload;
5836
+ config$2.lean = config$2.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$2.lean;
5837
+ config$2.upload = config$2.track && typeof config$2.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$2.upload;
5806
5838
  // Log page metadata as dimensions
5807
5839
  log(0 /* Dimension.UserAgent */, ua);
5808
5840
  log(3 /* Dimension.PageTitle */, title);
@@ -5844,15 +5876,15 @@ function start$8() {
5844
5876
  if (consentStatus === null) {
5845
5877
  consentStatus = {
5846
5878
  source: u.consent ? 6 /* ConsentSource.Cookie */ : 0 /* ConsentSource.Implicit */,
5847
- ad_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5848
- analytics_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5879
+ ad_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5880
+ analytics_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5849
5881
  };
5850
5882
  }
5851
5883
  logCookies();
5852
5884
  var consent = getConsentData(consentStatus);
5853
5885
  config$1(consent);
5854
5886
  // Track ids using a cookie if configuration allows it, skip if using external session
5855
- if (!config$3.externalSession) {
5887
+ if (!config$2.externalSession) {
5856
5888
  track(u);
5857
5889
  }
5858
5890
  }
@@ -5877,11 +5909,11 @@ function logCookies() {
5877
5909
  if (cookiesLogged || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.analytics_Storage) !== "granted" /* Constant.Granted */ || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.ad_Storage) !== "granted" /* Constant.Granted */) {
5878
5910
  return;
5879
5911
  }
5880
- for (var _i = 0, _a = config$3.cookies; _i < _a.length; _i++) {
5912
+ for (var _i = 0, _a = config$2.cookies; _i < _a.length; _i++) {
5881
5913
  var key = _a[_i];
5882
5914
  var value = getCookie(key);
5883
5915
  if (value) {
5884
- set(key, value);
5916
+ set$1(key, value);
5885
5917
  }
5886
5918
  }
5887
5919
  cookiesLogged = true;
@@ -5897,14 +5929,14 @@ function metadata(cb, wait, recall, consentInfo) {
5897
5929
  if (wait === void 0) { wait = true; }
5898
5930
  if (recall === void 0) { recall = false; }
5899
5931
  if (consentInfo === void 0) { consentInfo = false; }
5900
- var upgraded = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5932
+ var upgraded = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5901
5933
  var called = false;
5902
5934
  // if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
5903
5935
  // directly execute the callback in addition to adding to our list as we only process callbacks at the moment
5904
5936
  // we go through the upgrading flow.
5905
5937
  if (data$2 && (upgraded || wait === false)) {
5906
5938
  // Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
5907
- cb(data$2, !config$3.lean, consentInfo ? consentStatus : undefined);
5939
+ cb(data$2, !config$2.lean, consentInfo ? consentStatus : undefined);
5908
5940
  called = true;
5909
5941
  }
5910
5942
  if (recall || !called) {
@@ -5947,15 +5979,15 @@ function consentv2(consentState, source) {
5947
5979
  consentStatus = updatedStatus;
5948
5980
  callback(true);
5949
5981
  var consentData = getConsentData(consentStatus);
5950
- if (!consentData.analytics_Storage && config$3.track) {
5951
- config$3.track = false;
5982
+ if (!consentData.analytics_Storage && config$2.track) {
5983
+ config$2.track = false;
5952
5984
  clear(true);
5953
5985
  stop();
5954
5986
  window.setTimeout(start, 250 /* Setting.RestartDelay */);
5955
5987
  return;
5956
5988
  }
5957
5989
  if (active() && consentData.analytics_Storage) {
5958
- config$3.track = true;
5990
+ config$2.track = true;
5959
5991
  track(user(), 1 /* BooleanFlag.True */);
5960
5992
  save();
5961
5993
  }
@@ -5987,7 +6019,7 @@ function clear(all) {
5987
6019
  }
5988
6020
  function tab() {
5989
6021
  var id = shortid();
5990
- if (config$3.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6022
+ if (config$2.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
5991
6023
  var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
5992
6024
  id = value ? value : id;
5993
6025
  sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
@@ -5996,15 +6028,15 @@ function tab() {
5996
6028
  }
5997
6029
  function callback(consentUpdate) {
5998
6030
  if (consentUpdate === void 0) { consentUpdate = false; }
5999
- var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6031
+ var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6000
6032
  processCallback(upgrade, consentUpdate);
6001
6033
  }
6002
6034
  function save() {
6003
- if (!data$2 || !config$3.track || config$3.externalSession)
6035
+ if (!data$2 || !config$2.track || config$2.externalSession)
6004
6036
  return;
6005
6037
  var ts = Math.round(Date.now());
6006
- var upload = config$3.upload && typeof config$3.upload === "string" /* Constant.String */ ? config$3.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6007
- var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6038
+ var upload = config$2.upload && typeof config$2.upload === "string" /* Constant.String */ ? config$2.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6039
+ var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6008
6040
  setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join(COOKIE_SEP), 1 /* Setting.SessionExpire */);
6009
6041
  }
6010
6042
  function processCallback(upgrade, consentUpdate) {
@@ -6015,7 +6047,7 @@ function processCallback(upgrade, consentUpdate) {
6015
6047
  if (cb.callback &&
6016
6048
  ((!cb.called && !consentUpdate) || (cb.consentInfo && consentUpdate)) && //If consentUpdate is true, we only call the callback if it has consentInfo
6017
6049
  (!cb.wait || upgrade)) {
6018
- cb.callback(data$2, !config$3.lean, cb.consentInfo ? consentStatus : undefined);
6050
+ cb.callback(data$2, !config$2.lean, cb.consentInfo ? consentStatus : undefined);
6019
6051
  cb.called = true;
6020
6052
  if (!cb.recall) {
6021
6053
  callbacks.splice(i, 1);
@@ -6033,7 +6065,7 @@ function track(u, consent) {
6033
6065
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
6034
6066
  var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
6035
6067
  // If DOB is not set in the user object, use the date set in the config as a DOB
6036
- var dob = u.dob === 0 ? (config$3.dob === null ? 0 : config$3.dob) : u.dob;
6068
+ var dob = u.dob === 0 ? (config$2.dob === null ? 0 : config$2.dob) : u.dob;
6037
6069
  // To avoid cookie churn, write user id cookie only once every day
6038
6070
  if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
6039
6071
  var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
@@ -6049,7 +6081,7 @@ function shortid() {
6049
6081
  }
6050
6082
  function session() {
6051
6083
  var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
6052
- var value = getCookie("_clsk" /* Constant.SessionKey */, !config$3.includeSubdomains);
6084
+ var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
6053
6085
  if (value) {
6054
6086
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
6055
6087
  var parts = value.includes("^" /* Constant.Caret */) ? value.split("^" /* Constant.Caret */) : value.split("|" /* Constant.Pipe */);
@@ -6070,7 +6102,7 @@ function num(string, base) {
6070
6102
  }
6071
6103
  function user() {
6072
6104
  var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
6073
- var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$3.includeSubdomains);
6105
+ var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
6074
6106
  if (cookie && cookie.length > 0) {
6075
6107
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
6076
6108
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
@@ -6090,9 +6122,9 @@ function user() {
6090
6122
  output.dob = num(parts[4]);
6091
6123
  }
6092
6124
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
6093
- config$3.track = config$3.track || output.consent === 1 /* BooleanFlag.True */;
6125
+ config$2.track = config$2.track || output.consent === 1 /* BooleanFlag.True */;
6094
6126
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
6095
- output.id = config$3.track ? parts[0] : output.id;
6127
+ output.id = config$2.track ? parts[0] : output.id;
6096
6128
  }
6097
6129
  return output;
6098
6130
  }
@@ -6149,7 +6181,7 @@ function reset$2() {
6149
6181
  function report(e) {
6150
6182
  // Do not report the same message twice for the same page
6151
6183
  if (history$1 && history$1.indexOf(e.message) === -1) {
6152
- var url = config$3.report;
6184
+ var url = config$2.report;
6153
6185
  if (url && url.length > 0 && data$1) {
6154
6186
  var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
6155
6187
  if (e.message) {
@@ -6309,7 +6341,7 @@ function stop$6() {
6309
6341
  var status = false;
6310
6342
  function start$5() {
6311
6343
  status = true;
6312
- start$O();
6344
+ start$P();
6313
6345
  reset$4();
6314
6346
  reset$1();
6315
6347
  reset$2();
@@ -6320,7 +6352,7 @@ function stop$5() {
6320
6352
  reset$2();
6321
6353
  reset$1();
6322
6354
  reset$4();
6323
- stop$K();
6355
+ stop$L();
6324
6356
  status = false;
6325
6357
  }
6326
6358
  function active() {
@@ -6348,8 +6380,8 @@ function config(override) {
6348
6380
  return false;
6349
6381
  }
6350
6382
  for (var key in override) {
6351
- if (key in config$3) {
6352
- config$3[key] = override[key];
6383
+ if (key in config$2) {
6384
+ config$2[key] = override[key];
6353
6385
  }
6354
6386
  }
6355
6387
  return true;
@@ -6393,11 +6425,10 @@ var diagnostic = /*#__PURE__*/Object.freeze({
6393
6425
  function start$3() {
6394
6426
  // The order below is important
6395
6427
  // and is determined by interdependencies of modules
6396
- config$2(config$3.excludeClassNames || []);
6397
6428
  start$n();
6398
6429
  start$k();
6399
6430
  start$l();
6400
- if (config$3.delayDom) {
6431
+ if (config$2.delayDom) {
6401
6432
  // Lazy load layout module as part of page load time performance improvements experiment
6402
6433
  bind(window, 'load', function () {
6403
6434
  start$m();
@@ -6648,7 +6679,7 @@ function process(entries) {
6648
6679
  case "resource" /* Constant.Resource */:
6649
6680
  var name_1 = entry.name;
6650
6681
  log(4 /* Dimension.NetworkHosts */, host(name_1));
6651
- if (name_1 === config$3.upload || name_1 === config$3.fallback) {
6682
+ if (name_1 === config$2.upload || name_1 === config$2.fallback) {
6652
6683
  max(28 /* Metric.UploadTime */, entry.duration);
6653
6684
  }
6654
6685
  break;
@@ -6758,7 +6789,7 @@ function stop() {
6758
6789
  }
6759
6790
  }
6760
6791
 
6761
- var helper = { hash: hash, selector: selector, get: get, getNode: getNode, lookup: lookup };
6792
+ var helper = { hash: hash, selector: selector, gemx: gemx, get: get, getNode: getNode, lookup: lookup };
6762
6793
  var version = version$1;
6763
6794
 
6764
6795
  exports.clarity = clarity;