@gemx-dev/clarity-js 0.8.62 → 0.8.64

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
@@ -149,7 +149,7 @@ function process$8() {
149
149
  }
150
150
  }
151
151
 
152
- var config$2 = {
152
+ var config$3 = {
153
153
  projectId: null,
154
154
  delay: 1 * 1000 /* Time.Second */,
155
155
  lean: false,
@@ -174,6 +174,10 @@ var config$2 = {
174
174
  conversions: false,
175
175
  includeSubdomains: true,
176
176
  modules: [],
177
+ excludeClassNames: [],
178
+ externalSession: false,
179
+ userId: null,
180
+ sessionId: null,
177
181
  };
178
182
 
179
183
  function api(method) {
@@ -207,7 +211,7 @@ function stop$K() {
207
211
  startTime = 0;
208
212
  }
209
213
 
210
- var version$1 = "0.8.61";
214
+ var version$1 = "0.8.63";
211
215
 
212
216
  // tslint:disable: no-bitwise
213
217
  function hash (input, precision) {
@@ -330,7 +334,7 @@ function url$1(input, electron, truncate) {
330
334
  result = "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
331
335
  }
332
336
  else {
333
- var drop_1 = config$2.drop;
337
+ var drop_1 = config$3.drop;
334
338
  if (drop_1 && drop_1.length > 0 && input && input.indexOf("?") > 0) {
335
339
  var _a = input.split("?"), path = _a[0], query = _a[1];
336
340
  var swap_1 = "*na*" /* Data.Constant.Dropped */;
@@ -812,6 +816,16 @@ function __generator(thisArg, body) {
812
816
  } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
813
817
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
814
818
  }
819
+ }
820
+
821
+ function __spreadArray(to, from, pack) {
822
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
823
+ if (ar || !(i in from)) {
824
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
825
+ ar[i] = from[i];
826
+ }
827
+ }
828
+ return to.concat(ar || Array.prototype.slice.call(from));
815
829
  }
816
830
 
817
831
  var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
@@ -1242,7 +1256,7 @@ function getCookie(key, limit) {
1242
1256
  function setCookie(key, value, time) {
1243
1257
  // only write cookies if we are currently in a cookie writing mode (and they are supported)
1244
1258
  // OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
1245
- if ((config$2.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1259
+ if ((config$3.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1246
1260
  // Some browsers automatically url encode cookie values if they are not url encoded.
1247
1261
  // We therefore encode and decode cookie values ourselves.
1248
1262
  var encodedValue = encodeCookieValue(value);
@@ -1360,7 +1374,7 @@ function start$F() {
1360
1374
  }
1361
1375
  function check$5(id, target, input) {
1362
1376
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1363
- if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1377
+ if (config$3.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1364
1378
  data$f = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1365
1379
  // Only encode this event if we haven't already reported this hash
1366
1380
  if (history$5.indexOf(data$f.checksum) < 0) {
@@ -1381,7 +1395,7 @@ function recompute$8(evt) {
1381
1395
  var element = target(evt);
1382
1396
  if (element) {
1383
1397
  var value = element.value;
1384
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$2.fraud && "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1398
+ var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$3.fraud && "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1385
1399
  state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1386
1400
  schedule(encode$4.bind(this, 42 /* Event.Change */));
1387
1401
  }
@@ -2182,7 +2196,7 @@ var styleTimeMap = {};
2182
2196
  var documentNodes = [];
2183
2197
  var createdSheetIds = [];
2184
2198
  function proxyStyleRules$1(win) {
2185
- if ((config$2.lean && config$2.lite) || win === null || win === undefined) {
2199
+ if ((config$3.lean && config$3.lite) || win === null || win === undefined) {
2186
2200
  return;
2187
2201
  }
2188
2202
  win.clarityOverrides = win.clarityOverrides || {};
@@ -2221,7 +2235,7 @@ function start$q() {
2221
2235
  proxyStyleRules$1(window);
2222
2236
  }
2223
2237
  function checkDocumentStyles(documentNode, timestamp) {
2224
- if (config$2.lean && config$2.lite) {
2238
+ if (config$3.lean && config$3.lite) {
2225
2239
  return;
2226
2240
  }
2227
2241
  if (documentNodes.indexOf(documentNode) === -1) {
@@ -2608,7 +2622,7 @@ function encode$5 (type, timer, ts) {
2608
2622
  if (type === 6 /* Event.Mutation */) {
2609
2623
  activity(eventTime);
2610
2624
  }
2611
- queue(tokenize(tokens), !config$2.lean);
2625
+ queue(tokenize(tokens), !config$3.lean);
2612
2626
  _o.label = 11;
2613
2627
  case 11: return [3 /*break*/, 13];
2614
2628
  case 12:
@@ -2818,7 +2832,7 @@ function processMutation(timer, mutation, instance, timestamp) {
2818
2832
  return [2 /*return*/];
2819
2833
  }
2820
2834
  target = mutation.target;
2821
- type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
2835
+ type = config$3.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
2822
2836
  if (type && target && target.ownerDocument) {
2823
2837
  parse(target.ownerDocument);
2824
2838
  }
@@ -3522,10 +3536,15 @@ function getAttributes$1(element) {
3522
3536
  }
3523
3537
 
3524
3538
  var excludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat" /* Constant.ExcludeClassNames */.split("," /* Constant.Comma */);
3539
+ var extraExcludeClassNames = [];
3525
3540
  var selectorMap = {};
3526
3541
  function reset$8() {
3527
3542
  selectorMap = {};
3528
3543
  }
3544
+ function config$2(classNames) {
3545
+ extraExcludeClassNames = classNames || [];
3546
+ console.log("[Selector] config called \u2014 extraExcludeClassNames set to: [".concat(extraExcludeClassNames.join(', '), "]"));
3547
+ }
3529
3548
  function get$1(input, type) {
3530
3549
  var a = input.attributes;
3531
3550
  var prefix = input.prefix ? input.prefix[type] : null;
@@ -3548,7 +3567,13 @@ function get$1(input, type) {
3548
3567
  input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
3549
3568
  var selector = "".concat(prefix).concat(input.tag).concat(suffix);
3550
3569
  var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
3551
- var classes = input.tag !== "BODY" /* Constant.BodyTag */ && "class" /* Constant.Class */ in a && a["class" /* Constant.Class */].length > 0 ? a["class" /* Constant.Class */].trim().split(/\s+/).filter(function (c) { return filter(c); }).join("." /* Constant.Period */) : null;
3570
+ var rawClasses = "class" /* Constant.Class */ in a ? a["class" /* Constant.Class */].trim().split(/\s+/) : [];
3571
+ var filteredClasses = rawClasses.filter(function (c) { return filter(c); });
3572
+ var removedClasses = rawClasses.filter(function (c) { return !filter(c); });
3573
+ if (removedClasses.length > 0) {
3574
+ console.log("[Selector] tag=\"".concat(input.tag, "\" id=\"").concat(input.id, "\" \u2014 removed classes: [").concat(removedClasses.join(', '), "] | kept: [").concat(filteredClasses.join(', '), "] | extraExclude: [").concat(extraExcludeClassNames.join(', '), "]"));
3575
+ }
3576
+ var classes = input.tag !== "BODY" /* Constant.BodyTag */ && filteredClasses.length > 0 ? filteredClasses.join("." /* Constant.Period */) : null;
3552
3577
  if (classes && classes.length > 0) {
3553
3578
  if (type === 0 /* Selector.Alpha */) {
3554
3579
  // In Alpha mode, update selector to use class names, with relative positioning within the parent id container.
@@ -3561,16 +3586,19 @@ function get$1(input, type) {
3561
3586
  selectorMap[key].push(input.id);
3562
3587
  }
3563
3588
  selector = "".concat(key).concat("~" /* Constant.Tilde */).concat(selectorMap[key].indexOf(input.id));
3589
+ console.log("\uD83D\uDE80 \uD83D\uDC25 ~ get ~ selector:", selector);
3564
3590
  }
3565
3591
  else {
3566
3592
  // In Beta mode, we continue to look at query selectors in context of the full page
3567
3593
  selector = "".concat(prefix).concat(input.tag, ".").concat(classes).concat(suffix);
3594
+ console.log("\uD83D\uDE80 \uD83D\uDC25 ~ get ~ selector:", selector);
3568
3595
  }
3569
3596
  }
3570
3597
  // Update selector to use "id" field when available. There are two exceptions:
3571
3598
  // (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
3572
3599
  // (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
3573
3600
  selector = id && filter(id) ? "".concat(getDomPrefix(prefix)).concat("#" /* Constant.Hash */).concat(id) : selector;
3601
+ console.log("\uD83D\uDE80 \uD83D\uDC25 ~ get ~ selector:", selector);
3574
3602
  return selector;
3575
3603
  }
3576
3604
  }
@@ -3597,6 +3625,8 @@ function filter(value) {
3597
3625
  if (!value) {
3598
3626
  return false;
3599
3627
  } // Do not process empty strings
3628
+ var excludeClassNames = getExcludeClassNames();
3629
+ console.log("\uD83D\uDE80 \uD83D\uDC25 ~ filter ~ excludeClassNames:", excludeClassNames);
3600
3630
  if (excludeClassNames.some(function (x) { return value.toLowerCase().indexOf(x) >= 0; })) {
3601
3631
  return false;
3602
3632
  }
@@ -3608,9 +3638,15 @@ function filter(value) {
3608
3638
  }
3609
3639
  return true;
3610
3640
  }
3641
+ function getExcludeClassNames() {
3642
+ console.log("\uD83D\uDE80 \uD83D\uDC25 ~ getExcludeClassNames ~ extraExcludeClassNames:", extraExcludeClassNames);
3643
+ console.log("\uD83D\uDE80 \uD83D\uDC25 ~ getExcludeClassNames ~ excludeClassNames:", excludeClassNames);
3644
+ return __spreadArray(__spreadArray([], excludeClassNames, true), extraExcludeClassNames, true);
3645
+ }
3611
3646
 
3612
3647
  var selector = /*#__PURE__*/Object.freeze({
3613
3648
  __proto__: null,
3649
+ config: config$2,
3614
3650
  get: get$1,
3615
3651
  reset: reset$8
3616
3652
  });
@@ -3667,14 +3703,14 @@ function parse(root, init) {
3667
3703
  try {
3668
3704
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
3669
3705
  if (init) {
3670
- config$2.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3706
+ config$3.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3671
3707
  }
3672
3708
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
3673
3709
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
3674
3710
  if ("querySelectorAll" in root) {
3675
- config$2.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3676
- config$2.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3677
- config$2.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3711
+ config$3.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3712
+ config$3.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3713
+ config$3.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3678
3714
  unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
3679
3715
  }
3680
3716
  }
@@ -3705,7 +3741,7 @@ function add$1(node, parent, data, source) {
3705
3741
  var parentValue = null;
3706
3742
  var regionId = exists(node) ? id : null;
3707
3743
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
3708
- var privacyId = config$2.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
3744
+ var privacyId = config$3.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
3709
3745
  if (parentId >= 0 && values$1[parentId]) {
3710
3746
  parentValue = values$1[parentId];
3711
3747
  parentValue.children.push(id);
@@ -4009,7 +4045,7 @@ function getPreviousId(node) {
4009
4045
  function track$4(id, source, changed, parentChanged) {
4010
4046
  if (changed === void 0) { changed = true; }
4011
4047
  if (parentChanged === void 0) { parentChanged = false; }
4012
- if (config$2.lean && config$2.lite) {
4048
+ if (config$3.lean && config$3.lite) {
4013
4049
  return;
4014
4050
  }
4015
4051
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -4598,8 +4634,8 @@ var modules$1 = null;
4598
4634
  function start$i() {
4599
4635
  active$2 = true;
4600
4636
  modules$1 = new Set();
4601
- if (config$2.modules && config$2.modules.length > 0) {
4602
- config$2.modules.forEach(function (m) { event(m); });
4637
+ if (config$3.modules && config$3.modules.length > 0) {
4638
+ config$3.modules.forEach(function (m) { event(m); });
4603
4639
  }
4604
4640
  }
4605
4641
  function stop$g() {
@@ -4687,7 +4723,7 @@ function queue(tokens, transmit) {
4687
4723
  var now = time();
4688
4724
  var type = tokens.length > 1 ? tokens[1] : null;
4689
4725
  var event = JSON.stringify(tokens);
4690
- if (!config$2.lean) {
4726
+ if (!config$3.lean) {
4691
4727
  leanLimit = false;
4692
4728
  }
4693
4729
  else if (!leanLimit && playbackBytes + event.length > 10485760 /* Setting.PlaybackBytesLimit */) {
@@ -4763,7 +4799,7 @@ function upload(final) {
4763
4799
  return [2 /*return*/];
4764
4800
  }
4765
4801
  timeout = null;
4766
- sendPlaybackBytes = config$2.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
4802
+ sendPlaybackBytes = config$3.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
4767
4803
  if (sendPlaybackBytes) {
4768
4804
  max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
4769
4805
  }
@@ -4816,8 +4852,8 @@ function stringify(encoded) {
4816
4852
  function send(payload, zipped, sequence, beacon) {
4817
4853
  if (beacon === void 0) { beacon = false; }
4818
4854
  // Upload data if a valid URL is defined in the config
4819
- if (typeof config$2.upload === "string" /* Constant.String */) {
4820
- var url_1 = config$2.upload;
4855
+ if (typeof config$3.upload === "string" /* Constant.String */) {
4856
+ var url_1 = config$3.upload;
4821
4857
  var dispatched = false;
4822
4858
  // If it's the last payload, attempt to upload using sendBeacon first.
4823
4859
  // The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
@@ -4868,8 +4904,8 @@ function send(payload, zipped, sequence, beacon) {
4868
4904
  }
4869
4905
  }
4870
4906
  }
4871
- else if (config$2.upload) {
4872
- var callback = config$2.upload;
4907
+ else if (config$3.upload) {
4908
+ var callback = config$3.upload;
4873
4909
  callback(payload);
4874
4910
  done(sequence);
4875
4911
  }
@@ -4891,7 +4927,7 @@ function check$3(xhr, sequence) {
4891
4927
  // 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
4892
4928
  // In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
4893
4929
  if (xhr.status === 0) {
4894
- config$2.upload = config$2.fallback ? config$2.fallback : config$2.upload;
4930
+ config$3.upload = config$3.fallback ? config$3.fallback : config$3.upload;
4895
4931
  }
4896
4932
  // Capture the status code and number of attempts so we can report it back to the server
4897
4933
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
@@ -4938,8 +4974,8 @@ function done(sequence) {
4938
4974
  function delay() {
4939
4975
  // Progressively increase delay as we continue to send more payloads from the client to the server
4940
4976
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
4941
- var gap = config$2.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$2.delay;
4942
- return typeof config$2.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$2.delay;
4977
+ var gap = config$3.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$3.delay;
4978
+ return typeof config$3.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$3.delay;
4943
4979
  }
4944
4980
  function response(payload) {
4945
4981
  var lines = payload && payload.length > 0 ? payload.split("\n") : [];
@@ -4957,8 +4993,8 @@ function response(payload) {
4957
4993
  break;
4958
4994
  case "ACTION" /* Constant.Action */:
4959
4995
  // Invoke action callback, if configured and has a valid value
4960
- if (config$2.action && parts.length > 1) {
4961
- config$2.action(parts[1]);
4996
+ if (config$3.action && parts.length > 1) {
4997
+ config$3.action(parts[1]);
4962
4998
  }
4963
4999
  break;
4964
5000
  case "EXTRACT" /* Constant.Extract */:
@@ -4977,7 +5013,7 @@ function response(payload) {
4977
5013
  }
4978
5014
  break;
4979
5015
  case "SNAPSHOT" /* Constant.Snapshot */:
4980
- config$2.lean = false; // Disable lean mode to ensure we can send playback information to server.
5016
+ config$3.lean = false; // Disable lean mode to ensure we can send playback information to server.
4981
5017
  snapshot();
4982
5018
  break;
4983
5019
  }
@@ -5311,8 +5347,8 @@ function discover() {
5311
5347
 
5312
5348
  var data$6 = null;
5313
5349
  function start$c() {
5314
- if (!config$2.lean && config$2.upgrade) {
5315
- config$2.upgrade("Config" /* Constant.Config */);
5350
+ if (!config$3.lean && config$3.upgrade) {
5351
+ config$3.upgrade("Config" /* Constant.Config */);
5316
5352
  }
5317
5353
  data$6 = null;
5318
5354
  }
@@ -5322,18 +5358,18 @@ function start$c() {
5322
5358
  // and send all backed up layout events to the server.
5323
5359
  function upgrade(key) {
5324
5360
  // Upgrade only if Clarity was successfully activated on the page
5325
- if (active() && config$2.lean) {
5326
- config$2.lean = false;
5361
+ if (active() && config$3.lean) {
5362
+ config$3.lean = false;
5327
5363
  data$6 = { key: key };
5328
5364
  // Update metadata to track we have upgraded this session
5329
5365
  callback();
5330
5366
  save();
5331
5367
  // Callback upgrade handler, if configured
5332
- if (config$2.upgrade) {
5333
- config$2.upgrade(key);
5368
+ if (config$3.upgrade) {
5369
+ config$3.upgrade(key);
5334
5370
  }
5335
5371
  encode$1(3 /* Event.Upgrade */);
5336
- if (config$2.lite) {
5372
+ if (config$3.lite) {
5337
5373
  start$d();
5338
5374
  start$q();
5339
5375
  }
@@ -5621,7 +5657,7 @@ function compute$2() {
5621
5657
  if (updateConsent) {
5622
5658
  encode$1(47 /* Event.Consent */);
5623
5659
  updateConsent = false;
5624
- if (!config$2.track) {
5660
+ if (!config$3.track) {
5625
5661
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5626
5662
  if (ics === null || ics === void 0 ? void 0 : ics.usedUpdate) {
5627
5663
  processConsent();
@@ -5646,11 +5682,13 @@ function start$8() {
5646
5682
  // Populate ids for this page
5647
5683
  var s = session();
5648
5684
  var u = user();
5649
- var projectId = config$2.projectId || hash(location.host);
5650
- data$2 = { projectId: projectId, userId: u.id, sessionId: s.session, pageNum: s.count };
5685
+ var projectId = config$3.projectId || hash(location.host);
5686
+ var userId = config$3.externalSession && config$3.userId ? config$3.userId : u.id;
5687
+ var sessionId = config$3.externalSession && config$3.sessionId ? config$3.sessionId : s.session;
5688
+ data$2 = { projectId: projectId, userId: userId, sessionId: sessionId, pageNum: s.count };
5651
5689
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
5652
- config$2.lean = config$2.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$2.lean;
5653
- 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;
5690
+ config$3.lean = config$3.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$3.lean;
5691
+ 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;
5654
5692
  // Log page metadata as dimensions
5655
5693
  log(0 /* Dimension.UserAgent */, ua);
5656
5694
  log(3 /* Dimension.PageTitle */, title);
@@ -5688,7 +5726,7 @@ function start$8() {
5688
5726
  max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
5689
5727
  }
5690
5728
  // Read cookies specified in configuration
5691
- for (var _i = 0, _d = config$2.cookies; _i < _d.length; _i++) {
5729
+ for (var _i = 0, _d = config$3.cookies; _i < _d.length; _i++) {
5692
5730
  var key = _d[_i];
5693
5731
  var value = getCookie(key);
5694
5732
  if (value) {
@@ -5700,14 +5738,16 @@ function start$8() {
5700
5738
  if (consentStatus === null) {
5701
5739
  consentStatus = {
5702
5740
  source: u.consent ? 6 /* ConsentSource.Cookie */ : 0 /* ConsentSource.Implicit */,
5703
- ad_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5704
- analytics_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5741
+ ad_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5742
+ analytics_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
5705
5743
  };
5706
5744
  }
5707
5745
  var consent = getConsentData(consentStatus);
5708
5746
  config$1(consent);
5709
- // Track ids using a cookie if configuration allows it
5710
- track(u);
5747
+ // Track ids using a cookie if configuration allows it, skip if using external session
5748
+ if (!config$3.externalSession) {
5749
+ track(u);
5750
+ }
5711
5751
  }
5712
5752
  function userAgentData() {
5713
5753
  var uaData = navigator["userAgentData"];
@@ -5733,14 +5773,14 @@ function metadata(cb, wait, recall, consentInfo) {
5733
5773
  if (wait === void 0) { wait = true; }
5734
5774
  if (recall === void 0) { recall = false; }
5735
5775
  if (consentInfo === void 0) { consentInfo = false; }
5736
- var upgraded = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5776
+ var upgraded = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5737
5777
  var called = false;
5738
5778
  // if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
5739
5779
  // directly execute the callback in addition to adding to our list as we only process callbacks at the moment
5740
5780
  // we go through the upgrading flow.
5741
5781
  if (data$2 && (upgraded || wait === false)) {
5742
5782
  // Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
5743
- cb(data$2, !config$2.lean, consentInfo ? consentStatus : undefined);
5783
+ cb(data$2, !config$3.lean, consentInfo ? consentStatus : undefined);
5744
5784
  called = true;
5745
5785
  }
5746
5786
  if (recall || !called) {
@@ -5780,15 +5820,15 @@ function consentv2(consentState, source) {
5780
5820
  consentStatus = updatedStatus;
5781
5821
  callback(true);
5782
5822
  var consentData = getConsentData(consentStatus);
5783
- if (!consentData.analytics_Storage && config$2.track) {
5784
- config$2.track = false;
5823
+ if (!consentData.analytics_Storage && config$3.track) {
5824
+ config$3.track = false;
5785
5825
  clear(true);
5786
5826
  stop();
5787
5827
  window.setTimeout(start, 250 /* Setting.RestartDelay */);
5788
5828
  return;
5789
5829
  }
5790
5830
  if (active() && consentData.analytics_Storage) {
5791
- config$2.track = true;
5831
+ config$3.track = true;
5792
5832
  track(user(), 1 /* BooleanFlag.True */);
5793
5833
  save();
5794
5834
  }
@@ -5819,7 +5859,7 @@ function clear(all) {
5819
5859
  }
5820
5860
  function tab() {
5821
5861
  var id = shortid();
5822
- if (config$2.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
5862
+ if (config$3.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
5823
5863
  var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
5824
5864
  id = value ? value : id;
5825
5865
  sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
@@ -5828,15 +5868,15 @@ function tab() {
5828
5868
  }
5829
5869
  function callback(consentUpdate) {
5830
5870
  if (consentUpdate === void 0) { consentUpdate = false; }
5831
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5871
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5832
5872
  processCallback(upgrade, consentUpdate);
5833
5873
  }
5834
5874
  function save() {
5835
- if (!data$2 || !config$2.track)
5875
+ if (!data$2 || !config$3.track || config$3.externalSession)
5836
5876
  return;
5837
5877
  var ts = Math.round(Date.now());
5838
- var upload = config$2.upload && typeof config$2.upload === "string" /* Constant.String */ ? config$2.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
5839
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5878
+ var upload = config$3.upload && typeof config$3.upload === "string" /* Constant.String */ ? config$3.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
5879
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
5840
5880
  setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join(COOKIE_SEP), 1 /* Setting.SessionExpire */);
5841
5881
  }
5842
5882
  function processCallback(upgrade, consentUpdate) {
@@ -5847,7 +5887,7 @@ function processCallback(upgrade, consentUpdate) {
5847
5887
  if (cb.callback &&
5848
5888
  ((!cb.called && !consentUpdate) || (cb.consentInfo && consentUpdate)) && //If consentUpdate is true, we only call the callback if it has consentInfo
5849
5889
  (!cb.wait || upgrade)) {
5850
- cb.callback(data$2, !config$2.lean, cb.consentInfo ? consentStatus : undefined);
5890
+ cb.callback(data$2, !config$3.lean, cb.consentInfo ? consentStatus : undefined);
5851
5891
  cb.called = true;
5852
5892
  if (!cb.recall) {
5853
5893
  callbacks.splice(i, 1);
@@ -5865,7 +5905,7 @@ function track(u, consent) {
5865
5905
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
5866
5906
  var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
5867
5907
  // If DOB is not set in the user object, use the date set in the config as a DOB
5868
- var dob = u.dob === 0 ? (config$2.dob === null ? 0 : config$2.dob) : u.dob;
5908
+ var dob = u.dob === 0 ? (config$3.dob === null ? 0 : config$3.dob) : u.dob;
5869
5909
  // To avoid cookie churn, write user id cookie only once every day
5870
5910
  if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
5871
5911
  var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
@@ -5881,7 +5921,7 @@ function shortid() {
5881
5921
  }
5882
5922
  function session() {
5883
5923
  var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
5884
- var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
5924
+ var value = getCookie("_clsk" /* Constant.SessionKey */, !config$3.includeSubdomains);
5885
5925
  if (value) {
5886
5926
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
5887
5927
  var parts = value.includes("^" /* Constant.Caret */) ? value.split("^" /* Constant.Caret */) : value.split("|" /* Constant.Pipe */);
@@ -5902,7 +5942,7 @@ function num(string, base) {
5902
5942
  }
5903
5943
  function user() {
5904
5944
  var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
5905
- var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
5945
+ var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$3.includeSubdomains);
5906
5946
  if (cookie && cookie.length > 0) {
5907
5947
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
5908
5948
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
@@ -5922,9 +5962,9 @@ function user() {
5922
5962
  output.dob = num(parts[4]);
5923
5963
  }
5924
5964
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
5925
- config$2.track = config$2.track || output.consent === 1 /* BooleanFlag.True */;
5965
+ config$3.track = config$3.track || output.consent === 1 /* BooleanFlag.True */;
5926
5966
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
5927
- output.id = config$2.track ? parts[0] : output.id;
5967
+ output.id = config$3.track ? parts[0] : output.id;
5928
5968
  }
5929
5969
  return output;
5930
5970
  }
@@ -5981,7 +6021,7 @@ function reset$2() {
5981
6021
  function report(e) {
5982
6022
  // Do not report the same message twice for the same page
5983
6023
  if (history$1 && history$1.indexOf(e.message) === -1) {
5984
- var url = config$2.report;
6024
+ var url = config$3.report;
5985
6025
  if (url && url.length > 0 && data$1) {
5986
6026
  var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
5987
6027
  if (e.message) {
@@ -6166,8 +6206,8 @@ function config(override) {
6166
6206
  return false;
6167
6207
  }
6168
6208
  for (var key in override) {
6169
- if (key in config$2) {
6170
- config$2[key] = override[key];
6209
+ if (key in config$3) {
6210
+ config$3[key] = override[key];
6171
6211
  }
6172
6212
  }
6173
6213
  return true;
@@ -6209,12 +6249,14 @@ var diagnostic = /*#__PURE__*/Object.freeze({
6209
6249
  });
6210
6250
 
6211
6251
  function start$3() {
6212
- // The order below is important
6252
+ // The order below is important
6213
6253
  // and is determined by interdependencies of modules
6254
+ config$2(config$3.excludeClassNames || []);
6255
+ console.log("\uD83D\uDE80 \uD83D\uDC25 ~ start ~ config:", config$3);
6214
6256
  start$n();
6215
6257
  start$k();
6216
6258
  start$l();
6217
- if (config$2.delayDom) {
6259
+ if (config$3.delayDom) {
6218
6260
  // Lazy load layout module as part of page load time performance improvements experiment
6219
6261
  bind(window, 'load', function () {
6220
6262
  start$m();
@@ -6463,7 +6505,7 @@ function process(entries) {
6463
6505
  case "resource" /* Constant.Resource */:
6464
6506
  var name_1 = entry.name;
6465
6507
  log(4 /* Dimension.NetworkHosts */, host(name_1));
6466
- if (name_1 === config$2.upload || name_1 === config$2.fallback) {
6508
+ if (name_1 === config$3.upload || name_1 === config$3.fallback) {
6467
6509
  max(28 /* Metric.UploadTime */, entry.duration);
6468
6510
  }
6469
6511
  break;