@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.
@@ -100,7 +100,7 @@ var clarity = /*#__PURE__*/Object.freeze({
100
100
  get register () { return register; },
101
101
  get resume () { return resume; },
102
102
  get schedule () { return schedule; },
103
- get set () { return set; },
103
+ get set () { return set$1; },
104
104
  get signal () { return signal; },
105
105
  get start () { return start; },
106
106
  get stop () { return stop; },
@@ -147,7 +147,7 @@ function process$8() {
147
147
  }
148
148
  }
149
149
 
150
- var config$3 = {
150
+ var config$2 = {
151
151
  projectId: null,
152
152
  delay: 1 * 1000 /* Time.Second */,
153
153
  lean: false,
@@ -173,7 +173,6 @@ var config$3 = {
173
173
  includeSubdomains: true,
174
174
  modules: [],
175
175
  diagnostics: false,
176
- excludeClassNames: [],
177
176
  externalSession: false,
178
177
  userId: null,
179
178
  sessionId: null,
@@ -190,7 +189,7 @@ var startTime = 0;
190
189
  function computeStartTime() {
191
190
  return performance.now() + performance.timeOrigin;
192
191
  }
193
- function start$O() {
192
+ function start$P() {
194
193
  startTime = computeStartTime();
195
194
  }
196
195
  // event.timestamp is number of milliseconds elapsed since the document was loaded
@@ -206,11 +205,11 @@ function time(event) {
206
205
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
207
206
  return Math.max(Math.round(ts + origin - baseline), 0);
208
207
  }
209
- function stop$K() {
208
+ function stop$L() {
210
209
  startTime = 0;
211
210
  }
212
211
 
213
- var version$1 = "0.8.80";
212
+ var version$1 = "0.8.82";
214
213
 
215
214
  // tslint:disable: no-bitwise
216
215
  function hash (input, precision) {
@@ -330,7 +329,7 @@ function url$1(input, electron, truncate) {
330
329
  result = "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
331
330
  }
332
331
  else {
333
- var drop_1 = config$3.drop;
332
+ var drop_1 = config$2.drop;
334
333
  if (drop_1 && drop_1.length > 0 && input && input.indexOf("?") > 0) {
335
334
  var _a = input.split("?"), path = _a[0], query = _a[1];
336
335
  var swap_1 = "*na*" /* Data.Constant.Dropped */;
@@ -430,7 +429,7 @@ function redact$1(value) {
430
429
  var state$b = null;
431
430
  var buffer = null;
432
431
  var update$2 = false;
433
- function start$N() {
432
+ function start$O() {
434
433
  update$2 = false;
435
434
  reset$u();
436
435
  }
@@ -573,7 +572,7 @@ function compute$g() {
573
572
  encode$1(4 /* Event.Baseline */);
574
573
  }
575
574
  }
576
- function stop$J() {
575
+ function stop$K() {
577
576
  reset$u();
578
577
  }
579
578
 
@@ -583,9 +582,9 @@ var baseline = /*#__PURE__*/Object.freeze({
583
582
  compute: compute$g,
584
583
  dynamic: dynamic$1,
585
584
  reset: reset$u,
586
- start: start$N,
585
+ start: start$O,
587
586
  get state () { return state$b; },
588
- stop: stop$J,
587
+ stop: stop$K,
589
588
  track: track$8,
590
589
  visibility: visibility
591
590
  });
@@ -610,12 +609,12 @@ function event$1(a, b) {
610
609
 
611
610
  var data$k = null;
612
611
  var updates$3 = null;
613
- function start$M() {
612
+ function start$N() {
614
613
  data$k = {};
615
614
  updates$3 = {};
616
615
  count$1(5 /* Metric.InvokeCount */);
617
616
  }
618
- function stop$I() {
617
+ function stop$J() {
619
618
  data$k = {};
620
619
  updates$3 = {};
621
620
  }
@@ -671,7 +670,7 @@ var data$j;
671
670
  var last = 0;
672
671
  var interval = 0;
673
672
  var timeout$7 = null;
674
- function start$L() {
673
+ function start$M() {
675
674
  interval = 60000 /* Setting.PingInterval */;
676
675
  last = 0;
677
676
  }
@@ -693,7 +692,7 @@ function ping() {
693
692
  suspend();
694
693
  }
695
694
  }
696
- function stop$H() {
695
+ function stop$I() {
697
696
  clearTimeout$1(timeout$7);
698
697
  last = 0;
699
698
  interval = 0;
@@ -703,15 +702,15 @@ var ping$1 = /*#__PURE__*/Object.freeze({
703
702
  __proto__: null,
704
703
  get data () { return data$j; },
705
704
  reset: reset$s,
706
- start: start$L,
707
- stop: stop$H
705
+ start: start$M,
706
+ stop: stop$I
708
707
  });
709
708
 
710
709
  var data$i = null;
711
- function start$K() {
710
+ function start$L() {
712
711
  data$i = {};
713
712
  }
714
- function stop$G() {
713
+ function stop$H() {
715
714
  data$i = {};
716
715
  }
717
716
  function track$7(event, time) {
@@ -743,8 +742,8 @@ var summary = /*#__PURE__*/Object.freeze({
743
742
  compute: compute$e,
744
743
  get data () { return data$i; },
745
744
  reset: reset$r,
746
- start: start$K,
747
- stop: stop$G,
745
+ start: start$L,
746
+ stop: stop$H,
748
747
  track: track$7
749
748
  });
750
749
 
@@ -883,10 +882,10 @@ function read(stream) {
883
882
  }
884
883
 
885
884
  var data$h = null;
886
- function start$J() {
885
+ function start$K() {
887
886
  reset$q();
888
887
  }
889
- function set(variable, value) {
888
+ function set$1(variable, value) {
890
889
  var values = typeof value === "string" /* Constant.String */ ? [value] : value;
891
890
  log$2(variable, values);
892
891
  }
@@ -945,7 +944,7 @@ function compute$d() {
945
944
  function reset$q() {
946
945
  data$h = {};
947
946
  }
948
- function stop$F() {
947
+ function stop$G() {
949
948
  reset$q();
950
949
  }
951
950
  function redact(input) {
@@ -984,9 +983,9 @@ var variable = /*#__PURE__*/Object.freeze({
984
983
  get data () { return data$h; },
985
984
  identify: identify,
986
985
  reset: reset$q,
987
- set: set,
988
- start: start$J,
989
- stop: stop$F
986
+ set: set$1,
987
+ start: start$K,
988
+ stop: stop$G
990
989
  });
991
990
 
992
991
  var data$g = {};
@@ -995,7 +994,7 @@ var variables = {};
995
994
  var selectors = {};
996
995
  var hashes = {};
997
996
  var validation = {};
998
- function start$I() {
997
+ function start$J() {
999
998
  reset$p();
1000
999
  }
1001
1000
  // Input string is of the following form:
@@ -1111,7 +1110,7 @@ function update$1(key, subkey, value) {
1111
1110
  }
1112
1111
  return;
1113
1112
  }
1114
- function stop$E() {
1113
+ function stop$F() {
1115
1114
  reset$p();
1116
1115
  }
1117
1116
  function parse$1(variable) {
@@ -1184,8 +1183,8 @@ var extract = /*#__PURE__*/Object.freeze({
1184
1183
  data: data$g,
1185
1184
  keys: keys,
1186
1185
  reset: reset$p,
1187
- start: start$I,
1188
- stop: stop$E,
1186
+ start: start$J,
1187
+ stop: stop$F,
1189
1188
  trigger: trigger$2,
1190
1189
  update: update$1
1191
1190
  });
@@ -1213,10 +1212,10 @@ function decodeCookieValue(value) {
1213
1212
 
1214
1213
  var rootDomain = null;
1215
1214
  var COOKIE_SEP = "^" /* Constant.Caret */;
1216
- function start$H() {
1215
+ function start$I() {
1217
1216
  rootDomain = null;
1218
1217
  }
1219
- function stop$D() {
1218
+ function stop$E() {
1220
1219
  rootDomain = null;
1221
1220
  }
1222
1221
  function getCookie(key, limit) {
@@ -1252,7 +1251,7 @@ function getCookie(key, limit) {
1252
1251
  function setCookie(key, value, time) {
1253
1252
  // only write cookies if we are currently in a cookie writing mode (and they are supported)
1254
1253
  // OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
1255
- if ((config$3.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1254
+ if ((config$2.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1256
1255
  // Some browsers automatically url encode cookie values if they are not url encoded.
1257
1256
  // We therefore encode and decode cookie values ourselves.
1258
1257
  var encodedValue = encodeCookieValue(value);
@@ -1298,6 +1297,34 @@ var cookie = /*#__PURE__*/Object.freeze({
1298
1297
  COOKIE_SEP: COOKIE_SEP,
1299
1298
  getCookie: getCookie,
1300
1299
  setCookie: setCookie,
1300
+ start: start$I,
1301
+ stop: stop$E
1302
+ });
1303
+
1304
+ var defaultConfig = {
1305
+ excludeClassNames: [],
1306
+ };
1307
+ var _config = __assign({}, defaultConfig);
1308
+ function start$H() {
1309
+ var _a, _b;
1310
+ _config = {
1311
+ 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 : []),
1312
+ };
1313
+ }
1314
+ function stop$D() {
1315
+ _config = __assign({}, defaultConfig);
1316
+ }
1317
+ function set(config) {
1318
+ _config = __assign(__assign({}, _config), config);
1319
+ }
1320
+ function get$2() {
1321
+ return _config;
1322
+ }
1323
+
1324
+ var gemx = /*#__PURE__*/Object.freeze({
1325
+ __proto__: null,
1326
+ get: get$2,
1327
+ set: set,
1301
1328
  start: start$H,
1302
1329
  stop: stop$D
1303
1330
  });
@@ -1330,10 +1357,10 @@ function signalsEvent(signalsPayload) {
1330
1357
  }
1331
1358
  }
1332
1359
 
1333
- var modules$2 = [baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1360
+ var modules$2 = [gemx, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1334
1361
  function start$G() {
1335
1362
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1336
- start$M();
1363
+ start$N();
1337
1364
  modules$2.forEach(function (x) { return measure(x.start)(); });
1338
1365
  }
1339
1366
  function stop$C() {
@@ -1342,7 +1369,7 @@ function stop$C() {
1342
1369
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1343
1370
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1344
1371
  modules$2.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1345
- stop$I();
1372
+ stop$J();
1346
1373
  }
1347
1374
  function compute$b() {
1348
1375
  compute$d();
@@ -1370,7 +1397,7 @@ function start$F() {
1370
1397
  }
1371
1398
  function check$5(id, target, input) {
1372
1399
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1373
- if (config$3.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1400
+ if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1374
1401
  data$f = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1375
1402
  // Only encode this event if we haven't already reported this hash
1376
1403
  if (history$5.indexOf(data$f.checksum) < 0) {
@@ -1403,7 +1430,7 @@ function recompute$8(evt) {
1403
1430
  var element = target(evt);
1404
1431
  if (element) {
1405
1432
  var value = element.value;
1406
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$3.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1433
+ var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$2.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1407
1434
  state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1408
1435
  schedule(encode$4.bind(this, 42 /* Event.Change */));
1409
1436
  }
@@ -1472,7 +1499,7 @@ function handler$4(event, root, evt) {
1472
1499
  // Check for null values before processing this event
1473
1500
  if (x !== null && y !== null) {
1474
1501
  var textInfo = text(t);
1475
- if (config$3.diagnostics) {
1502
+ if (config$2.diagnostics) {
1476
1503
  var el = t;
1477
1504
  console.log("[clarity:click] text debug", {
1478
1505
  tag: el === null || el === void 0 ? void 0 : el.tagName,
@@ -1509,7 +1536,7 @@ function handler$4(event, root, evt) {
1509
1536
  tag: getElementAttribute(t, "tagName").substring(0, 10 /* Setting.ClickTag */),
1510
1537
  class: getElementAttribute(t, "className").substring(0, 50 /* Setting.ClickClass */),
1511
1538
  id: getElementAttribute(t, "id").substring(0, 25 /* Setting.ClickId */),
1512
- source: config$3.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1539
+ source: config$2.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1513
1540
  }
1514
1541
  });
1515
1542
  schedule(encode$4.bind(this, event));
@@ -2295,7 +2322,7 @@ var styleTimeMap = {};
2295
2322
  var documentNodes = [];
2296
2323
  var createdSheetIds = [];
2297
2324
  function proxyStyleRules$1(win) {
2298
- if ((config$3.lean && config$3.lite) || win === null || win === undefined) {
2325
+ if ((config$2.lean && config$2.lite) || win === null || win === undefined) {
2299
2326
  return;
2300
2327
  }
2301
2328
  win.clarityOverrides = win.clarityOverrides || {};
@@ -2334,7 +2361,7 @@ function start$q() {
2334
2361
  proxyStyleRules$1(window);
2335
2362
  }
2336
2363
  function checkDocumentStyles(documentNode, timestamp) {
2337
- if (config$3.lean && config$3.lite) {
2364
+ if (config$2.lean && config$2.lite) {
2338
2365
  return;
2339
2366
  }
2340
2367
  if (documentNodes.indexOf(documentNode) === -1) {
@@ -2727,7 +2754,7 @@ function encode$5 (type, timer, ts) {
2727
2754
  if (type === 6 /* Event.Mutation */) {
2728
2755
  activity(eventTime);
2729
2756
  }
2730
- queue(tokenize(tokens), !config$3.lean);
2757
+ queue(tokenize(tokens), !config$2.lean);
2731
2758
  _o.label = 11;
2732
2759
  case 11: return [3 /*break*/, 13];
2733
2760
  case 12:
@@ -2940,7 +2967,7 @@ function processMutation(timer, mutation, instance, timestamp) {
2940
2967
  return [2 /*return*/];
2941
2968
  }
2942
2969
  target = mutation.target;
2943
- type = config$3.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
2970
+ type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
2944
2971
  if (type && target && target.ownerDocument) {
2945
2972
  parse(target.ownerDocument);
2946
2973
  }
@@ -3644,14 +3671,10 @@ function getAttributes$1(element) {
3644
3671
  }
3645
3672
 
3646
3673
  var excludeClassNames = ExcludeClassNamesList;
3647
- var extraExcludeClassNames = [];
3648
3674
  var selectorMap = {};
3649
3675
  function reset$8() {
3650
3676
  selectorMap = {};
3651
3677
  }
3652
- function config$2(classNames) {
3653
- extraExcludeClassNames = classNames || [];
3654
- }
3655
3678
  function get$1(input, type) {
3656
3679
  var a = input.attributes;
3657
3680
  var prefix = input.prefix ? input.prefix[type] : null;
@@ -3742,12 +3765,13 @@ function filter(value) {
3742
3765
  return true;
3743
3766
  }
3744
3767
  function getExcludeClassNames() {
3745
- return __spreadArray(__spreadArray([], excludeClassNames, true), extraExcludeClassNames, true);
3768
+ var clarityConfig = excludeClassNames;
3769
+ var gemxStoreConfig = get$2().excludeClassNames;
3770
+ return __spreadArray(__spreadArray([], clarityConfig, true), gemxStoreConfig, true);
3746
3771
  }
3747
3772
 
3748
3773
  var selector = /*#__PURE__*/Object.freeze({
3749
3774
  __proto__: null,
3750
- config: config$2,
3751
3775
  get: get$1,
3752
3776
  reset: reset$8
3753
3777
  });
@@ -3804,14 +3828,14 @@ function parse(root, init) {
3804
3828
  try {
3805
3829
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
3806
3830
  if (init) {
3807
- config$3.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3831
+ config$2.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3808
3832
  }
3809
3833
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
3810
3834
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
3811
3835
  if ("querySelectorAll" in root) {
3812
- config$3.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3813
- config$3.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3814
- config$3.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3836
+ config$2.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3837
+ config$2.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3838
+ config$2.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3815
3839
  unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
3816
3840
  }
3817
3841
  }
@@ -3842,7 +3866,7 @@ function add$1(node, parent, data, source) {
3842
3866
  var parentValue = null;
3843
3867
  var regionId = exists(node) ? id : null;
3844
3868
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
3845
- var privacyId = config$3.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
3869
+ var privacyId = config$2.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
3846
3870
  if (parentId >= 0 && values$1[parentId]) {
3847
3871
  parentValue = values$1[parentId];
3848
3872
  parentValue.children.push(id);
@@ -4146,7 +4170,7 @@ function getPreviousId(node) {
4146
4170
  function track$4(id, source, changed, parentChanged) {
4147
4171
  if (changed === void 0) { changed = true; }
4148
4172
  if (parentChanged === void 0) { parentChanged = false; }
4149
- if (config$3.lean && config$3.lite) {
4173
+ if (config$2.lean && config$2.lite) {
4150
4174
  return;
4151
4175
  }
4152
4176
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -4320,6 +4344,10 @@ function metadata$2(node, event, text) {
4320
4344
  var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */ };
4321
4345
  if (node) {
4322
4346
  var value = get(node);
4347
+ console.log("[GemX - Target - Metadata]", {
4348
+ selector: value.selector,
4349
+ hash: value.hash,
4350
+ });
4323
4351
  if (value !== null) {
4324
4352
  var metadata_1 = value.metadata;
4325
4353
  output.id = value.id;
@@ -4382,6 +4410,10 @@ function encode$4 (type, ts) {
4382
4410
  cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
4383
4411
  tokens = [entry.time, entry.event];
4384
4412
  cHash = cTarget.hash ? cTarget.hash.join("." /* Constant.Dot */) : "" /* Constant.Empty */;
4413
+ console.log("[GemX - Interaction - Encode]", {
4414
+ cHash: cHash,
4415
+ cTarget: cTarget,
4416
+ });
4385
4417
  tokens.push(cTarget.id);
4386
4418
  tokens.push(entry.data.x);
4387
4419
  tokens.push(entry.data.y);
@@ -4739,8 +4771,8 @@ var modules$1 = null;
4739
4771
  function start$i() {
4740
4772
  active$2 = true;
4741
4773
  modules$1 = new Set();
4742
- if (config$3.modules && config$3.modules.length > 0) {
4743
- config$3.modules.forEach(function (m) { event(m); });
4774
+ if (config$2.modules && config$2.modules.length > 0) {
4775
+ config$2.modules.forEach(function (m) { event(m); });
4744
4776
  }
4745
4777
  }
4746
4778
  function stop$g() {
@@ -4828,7 +4860,7 @@ function queue(tokens, transmit) {
4828
4860
  var now = time();
4829
4861
  var type = tokens.length > 1 ? tokens[1] : null;
4830
4862
  var event = JSON.stringify(tokens);
4831
- if (!config$3.lean) {
4863
+ if (!config$2.lean) {
4832
4864
  leanLimit = false;
4833
4865
  }
4834
4866
  else if (!leanLimit && playbackBytes + event.length > 10485760 /* Setting.PlaybackBytesLimit */) {
@@ -4904,7 +4936,7 @@ function upload(final) {
4904
4936
  return [2 /*return*/];
4905
4937
  }
4906
4938
  timeout = null;
4907
- sendPlaybackBytes = config$3.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
4939
+ sendPlaybackBytes = config$2.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
4908
4940
  if (sendPlaybackBytes) {
4909
4941
  max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
4910
4942
  }
@@ -4957,8 +4989,8 @@ function stringify(encoded) {
4957
4989
  function send(payload, zipped, sequence, beacon) {
4958
4990
  if (beacon === void 0) { beacon = false; }
4959
4991
  // Upload data if a valid URL is defined in the config
4960
- if (typeof config$3.upload === "string" /* Constant.String */) {
4961
- var url_1 = config$3.upload;
4992
+ if (typeof config$2.upload === "string" /* Constant.String */) {
4993
+ var url_1 = config$2.upload;
4962
4994
  var dispatched = false;
4963
4995
  // If it's the last payload, attempt to upload using sendBeacon first.
4964
4996
  // The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
@@ -5009,8 +5041,8 @@ function send(payload, zipped, sequence, beacon) {
5009
5041
  }
5010
5042
  }
5011
5043
  }
5012
- else if (config$3.upload) {
5013
- var callback = config$3.upload;
5044
+ else if (config$2.upload) {
5045
+ var callback = config$2.upload;
5014
5046
  callback(payload);
5015
5047
  done(sequence);
5016
5048
  }
@@ -5032,7 +5064,7 @@ function check$3(xhr, sequence) {
5032
5064
  // 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
5033
5065
  // In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
5034
5066
  if (xhr.status === 0) {
5035
- config$3.upload = config$3.fallback ? config$3.fallback : config$3.upload;
5067
+ config$2.upload = config$2.fallback ? config$2.fallback : config$2.upload;
5036
5068
  }
5037
5069
  // Capture the status code and number of attempts so we can report it back to the server
5038
5070
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
@@ -5079,8 +5111,8 @@ function done(sequence) {
5079
5111
  function delay() {
5080
5112
  // Progressively increase delay as we continue to send more payloads from the client to the server
5081
5113
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
5082
- var gap = config$3.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$3.delay;
5083
- return typeof config$3.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$3.delay;
5114
+ var gap = config$2.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$2.delay;
5115
+ return typeof config$2.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$2.delay;
5084
5116
  }
5085
5117
  function response(payload) {
5086
5118
  var lines = payload && payload.length > 0 ? payload.split("\n") : [];
@@ -5098,8 +5130,8 @@ function response(payload) {
5098
5130
  break;
5099
5131
  case "ACTION" /* Constant.Action */:
5100
5132
  // Invoke action callback, if configured and has a valid value
5101
- if (config$3.action && parts.length > 1) {
5102
- config$3.action(parts[1]);
5133
+ if (config$2.action && parts.length > 1) {
5134
+ config$2.action(parts[1]);
5103
5135
  }
5104
5136
  break;
5105
5137
  case "EXTRACT" /* Constant.Extract */:
@@ -5118,7 +5150,7 @@ function response(payload) {
5118
5150
  }
5119
5151
  break;
5120
5152
  case "SNAPSHOT" /* Constant.Snapshot */:
5121
- config$3.lean = false; // Disable lean mode to ensure we can send playback information to server.
5153
+ config$2.lean = false; // Disable lean mode to ensure we can send playback information to server.
5122
5154
  snapshot();
5123
5155
  break;
5124
5156
  }
@@ -5452,8 +5484,8 @@ function discover() {
5452
5484
 
5453
5485
  var data$6 = null;
5454
5486
  function start$c() {
5455
- if (!config$3.lean && config$3.upgrade) {
5456
- config$3.upgrade("Config" /* Constant.Config */);
5487
+ if (!config$2.lean && config$2.upgrade) {
5488
+ config$2.upgrade("Config" /* Constant.Config */);
5457
5489
  }
5458
5490
  data$6 = null;
5459
5491
  }
@@ -5463,18 +5495,18 @@ function start$c() {
5463
5495
  // and send all backed up layout events to the server.
5464
5496
  function upgrade(key) {
5465
5497
  // Upgrade only if Clarity was successfully activated on the page
5466
- if (active() && config$3.lean) {
5467
- config$3.lean = false;
5498
+ if (active() && config$2.lean) {
5499
+ config$2.lean = false;
5468
5500
  data$6 = { key: key };
5469
5501
  // Update metadata to track we have upgraded this session
5470
5502
  callback();
5471
5503
  save();
5472
5504
  // Callback upgrade handler, if configured
5473
- if (config$3.upgrade) {
5474
- config$3.upgrade(key);
5505
+ if (config$2.upgrade) {
5506
+ config$2.upgrade(key);
5475
5507
  }
5476
5508
  encode$1(3 /* Event.Upgrade */);
5477
- if (config$3.lite) {
5509
+ if (config$2.lite) {
5478
5510
  start$d();
5479
5511
  start$q();
5480
5512
  }
@@ -5768,7 +5800,7 @@ function compute$2() {
5768
5800
  if (updateConsent) {
5769
5801
  encode$1(47 /* Event.Consent */);
5770
5802
  updateConsent = false;
5771
- if (!config$3.track) {
5803
+ if (!config$2.track) {
5772
5804
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5773
5805
  if (ics === null || ics === void 0 ? void 0 : ics.usedUpdate) {
5774
5806
  processConsent();
@@ -5794,13 +5826,13 @@ function start$8() {
5794
5826
  // Populate ids for this page
5795
5827
  var s = session();
5796
5828
  var u = user();
5797
- var projectId = config$3.projectId || hash(location.host);
5798
- var userId = config$3.externalSession && config$3.userId ? config$3.userId : u.id;
5799
- var sessionId = config$3.externalSession && config$3.sessionId ? config$3.sessionId : s.session;
5829
+ var projectId = config$2.projectId || hash(location.host);
5830
+ var userId = config$2.externalSession && config$2.userId ? config$2.userId : u.id;
5831
+ var sessionId = config$2.externalSession && config$2.sessionId ? config$2.sessionId : s.session;
5800
5832
  data$2 = { projectId: projectId, userId: userId, sessionId: sessionId, pageNum: s.count };
5801
5833
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
5802
- config$3.lean = config$3.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$3.lean;
5803
- 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;
5834
+ config$2.lean = config$2.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$2.lean;
5835
+ 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;
5804
5836
  // Log page metadata as dimensions
5805
5837
  log(0 /* Dimension.UserAgent */, ua);
5806
5838
  log(3 /* Dimension.PageTitle */, title);
@@ -5842,15 +5874,15 @@ function start$8() {
5842
5874
  if (consentStatus === null) {
5843
5875
  consentStatus = {
5844
5876
  source: u.consent ? 6 /* ConsentSource.Cookie */ : 0 /* ConsentSource.Implicit */,
5845
- ad_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5846
- analytics_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5877
+ ad_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5878
+ analytics_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5847
5879
  };
5848
5880
  }
5849
5881
  logCookies();
5850
5882
  var consent = getConsentData(consentStatus);
5851
5883
  config$1(consent);
5852
5884
  // Track ids using a cookie if configuration allows it, skip if using external session
5853
- if (!config$3.externalSession) {
5885
+ if (!config$2.externalSession) {
5854
5886
  track(u);
5855
5887
  }
5856
5888
  }
@@ -5875,11 +5907,11 @@ function logCookies() {
5875
5907
  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 */) {
5876
5908
  return;
5877
5909
  }
5878
- for (var _i = 0, _a = config$3.cookies; _i < _a.length; _i++) {
5910
+ for (var _i = 0, _a = config$2.cookies; _i < _a.length; _i++) {
5879
5911
  var key = _a[_i];
5880
5912
  var value = getCookie(key);
5881
5913
  if (value) {
5882
- set(key, value);
5914
+ set$1(key, value);
5883
5915
  }
5884
5916
  }
5885
5917
  cookiesLogged = true;
@@ -5895,14 +5927,14 @@ function metadata(cb, wait, recall, consentInfo) {
5895
5927
  if (wait === void 0) { wait = true; }
5896
5928
  if (recall === void 0) { recall = false; }
5897
5929
  if (consentInfo === void 0) { consentInfo = false; }
5898
- var upgraded = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5930
+ var upgraded = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5899
5931
  var called = false;
5900
5932
  // if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
5901
5933
  // directly execute the callback in addition to adding to our list as we only process callbacks at the moment
5902
5934
  // we go through the upgrading flow.
5903
5935
  if (data$2 && (upgraded || wait === false)) {
5904
5936
  // Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
5905
- cb(data$2, !config$3.lean, consentInfo ? consentStatus : undefined);
5937
+ cb(data$2, !config$2.lean, consentInfo ? consentStatus : undefined);
5906
5938
  called = true;
5907
5939
  }
5908
5940
  if (recall || !called) {
@@ -5945,15 +5977,15 @@ function consentv2(consentState, source) {
5945
5977
  consentStatus = updatedStatus;
5946
5978
  callback(true);
5947
5979
  var consentData = getConsentData(consentStatus);
5948
- if (!consentData.analytics_Storage && config$3.track) {
5949
- config$3.track = false;
5980
+ if (!consentData.analytics_Storage && config$2.track) {
5981
+ config$2.track = false;
5950
5982
  clear(true);
5951
5983
  stop();
5952
5984
  window.setTimeout(start, 250 /* Setting.RestartDelay */);
5953
5985
  return;
5954
5986
  }
5955
5987
  if (active() && consentData.analytics_Storage) {
5956
- config$3.track = true;
5988
+ config$2.track = true;
5957
5989
  track(user(), 1 /* BooleanFlag.True */);
5958
5990
  save();
5959
5991
  }
@@ -5985,7 +6017,7 @@ function clear(all) {
5985
6017
  }
5986
6018
  function tab() {
5987
6019
  var id = shortid();
5988
- if (config$3.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6020
+ if (config$2.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
5989
6021
  var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
5990
6022
  id = value ? value : id;
5991
6023
  sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
@@ -5994,15 +6026,15 @@ function tab() {
5994
6026
  }
5995
6027
  function callback(consentUpdate) {
5996
6028
  if (consentUpdate === void 0) { consentUpdate = false; }
5997
- var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6029
+ var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5998
6030
  processCallback(upgrade, consentUpdate);
5999
6031
  }
6000
6032
  function save() {
6001
- if (!data$2 || !config$3.track || config$3.externalSession)
6033
+ if (!data$2 || !config$2.track || config$2.externalSession)
6002
6034
  return;
6003
6035
  var ts = Math.round(Date.now());
6004
- var upload = config$3.upload && typeof config$3.upload === "string" /* Constant.String */ ? config$3.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6005
- var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6036
+ var upload = config$2.upload && typeof config$2.upload === "string" /* Constant.String */ ? config$2.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6037
+ var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6006
6038
  setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join(COOKIE_SEP), 1 /* Setting.SessionExpire */);
6007
6039
  }
6008
6040
  function processCallback(upgrade, consentUpdate) {
@@ -6013,7 +6045,7 @@ function processCallback(upgrade, consentUpdate) {
6013
6045
  if (cb.callback &&
6014
6046
  ((!cb.called && !consentUpdate) || (cb.consentInfo && consentUpdate)) && //If consentUpdate is true, we only call the callback if it has consentInfo
6015
6047
  (!cb.wait || upgrade)) {
6016
- cb.callback(data$2, !config$3.lean, cb.consentInfo ? consentStatus : undefined);
6048
+ cb.callback(data$2, !config$2.lean, cb.consentInfo ? consentStatus : undefined);
6017
6049
  cb.called = true;
6018
6050
  if (!cb.recall) {
6019
6051
  callbacks.splice(i, 1);
@@ -6031,7 +6063,7 @@ function track(u, consent) {
6031
6063
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
6032
6064
  var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
6033
6065
  // If DOB is not set in the user object, use the date set in the config as a DOB
6034
- var dob = u.dob === 0 ? (config$3.dob === null ? 0 : config$3.dob) : u.dob;
6066
+ var dob = u.dob === 0 ? (config$2.dob === null ? 0 : config$2.dob) : u.dob;
6035
6067
  // To avoid cookie churn, write user id cookie only once every day
6036
6068
  if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
6037
6069
  var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
@@ -6047,7 +6079,7 @@ function shortid() {
6047
6079
  }
6048
6080
  function session() {
6049
6081
  var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
6050
- var value = getCookie("_clsk" /* Constant.SessionKey */, !config$3.includeSubdomains);
6082
+ var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
6051
6083
  if (value) {
6052
6084
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
6053
6085
  var parts = value.includes("^" /* Constant.Caret */) ? value.split("^" /* Constant.Caret */) : value.split("|" /* Constant.Pipe */);
@@ -6068,7 +6100,7 @@ function num(string, base) {
6068
6100
  }
6069
6101
  function user() {
6070
6102
  var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
6071
- var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$3.includeSubdomains);
6103
+ var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
6072
6104
  if (cookie && cookie.length > 0) {
6073
6105
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
6074
6106
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
@@ -6088,9 +6120,9 @@ function user() {
6088
6120
  output.dob = num(parts[4]);
6089
6121
  }
6090
6122
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
6091
- config$3.track = config$3.track || output.consent === 1 /* BooleanFlag.True */;
6123
+ config$2.track = config$2.track || output.consent === 1 /* BooleanFlag.True */;
6092
6124
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
6093
- output.id = config$3.track ? parts[0] : output.id;
6125
+ output.id = config$2.track ? parts[0] : output.id;
6094
6126
  }
6095
6127
  return output;
6096
6128
  }
@@ -6147,7 +6179,7 @@ function reset$2() {
6147
6179
  function report(e) {
6148
6180
  // Do not report the same message twice for the same page
6149
6181
  if (history$1 && history$1.indexOf(e.message) === -1) {
6150
- var url = config$3.report;
6182
+ var url = config$2.report;
6151
6183
  if (url && url.length > 0 && data$1) {
6152
6184
  var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
6153
6185
  if (e.message) {
@@ -6307,7 +6339,7 @@ function stop$6() {
6307
6339
  var status = false;
6308
6340
  function start$5() {
6309
6341
  status = true;
6310
- start$O();
6342
+ start$P();
6311
6343
  reset$4();
6312
6344
  reset$1();
6313
6345
  reset$2();
@@ -6318,7 +6350,7 @@ function stop$5() {
6318
6350
  reset$2();
6319
6351
  reset$1();
6320
6352
  reset$4();
6321
- stop$K();
6353
+ stop$L();
6322
6354
  status = false;
6323
6355
  }
6324
6356
  function active() {
@@ -6346,8 +6378,8 @@ function config(override) {
6346
6378
  return false;
6347
6379
  }
6348
6380
  for (var key in override) {
6349
- if (key in config$3) {
6350
- config$3[key] = override[key];
6381
+ if (key in config$2) {
6382
+ config$2[key] = override[key];
6351
6383
  }
6352
6384
  }
6353
6385
  return true;
@@ -6391,11 +6423,10 @@ var diagnostic = /*#__PURE__*/Object.freeze({
6391
6423
  function start$3() {
6392
6424
  // The order below is important
6393
6425
  // and is determined by interdependencies of modules
6394
- config$2(config$3.excludeClassNames || []);
6395
6426
  start$n();
6396
6427
  start$k();
6397
6428
  start$l();
6398
- if (config$3.delayDom) {
6429
+ if (config$2.delayDom) {
6399
6430
  // Lazy load layout module as part of page load time performance improvements experiment
6400
6431
  bind(window, 'load', function () {
6401
6432
  start$m();
@@ -6646,7 +6677,7 @@ function process(entries) {
6646
6677
  case "resource" /* Constant.Resource */:
6647
6678
  var name_1 = entry.name;
6648
6679
  log(4 /* Dimension.NetworkHosts */, host(name_1));
6649
- if (name_1 === config$3.upload || name_1 === config$3.fallback) {
6680
+ if (name_1 === config$2.upload || name_1 === config$2.fallback) {
6650
6681
  max(28 /* Metric.UploadTime */, entry.duration);
6651
6682
  }
6652
6683
  break;
@@ -6756,7 +6787,7 @@ function stop() {
6756
6787
  }
6757
6788
  }
6758
6789
 
6759
- var helper = { hash: hash, selector: selector, get: get, getNode: getNode, lookup: lookup };
6790
+ var helper = { hash: hash, selector: selector, gemx: gemx, get: get, getNode: getNode, lookup: lookup };
6760
6791
  var version = version$1;
6761
6792
 
6762
6793
  export { clarity, helper, version };