@gemx-dev/clarity-js 0.8.63 → 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.extended.js +1 -1
- package/build/clarity.js +87 -72
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +87 -72
- package/package.json +1 -1
- package/src/core/version.ts +1 -1
- package/src/layout/index.ts +2 -1
- package/src/layout/selector.ts +19 -3
package/build/clarity.js
CHANGED
|
@@ -149,7 +149,7 @@ function process$8() {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
var config$
|
|
152
|
+
var config$3 = {
|
|
153
153
|
projectId: null,
|
|
154
154
|
delay: 1 * 1000 /* Time.Second */,
|
|
155
155
|
lean: false,
|
|
@@ -334,7 +334,7 @@ function url$1(input, electron, truncate) {
|
|
|
334
334
|
result = "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
|
|
335
335
|
}
|
|
336
336
|
else {
|
|
337
|
-
var drop_1 = config$
|
|
337
|
+
var drop_1 = config$3.drop;
|
|
338
338
|
if (drop_1 && drop_1.length > 0 && input && input.indexOf("?") > 0) {
|
|
339
339
|
var _a = input.split("?"), path = _a[0], query = _a[1];
|
|
340
340
|
var swap_1 = "*na*" /* Data.Constant.Dropped */;
|
|
@@ -1256,7 +1256,7 @@ function getCookie(key, limit) {
|
|
|
1256
1256
|
function setCookie(key, value, time) {
|
|
1257
1257
|
// only write cookies if we are currently in a cookie writing mode (and they are supported)
|
|
1258
1258
|
// OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
|
|
1259
|
-
if ((config$
|
|
1259
|
+
if ((config$3.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
|
|
1260
1260
|
// Some browsers automatically url encode cookie values if they are not url encoded.
|
|
1261
1261
|
// We therefore encode and decode cookie values ourselves.
|
|
1262
1262
|
var encodedValue = encodeCookieValue(value);
|
|
@@ -1374,7 +1374,7 @@ function start$F() {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
function check$5(id, target, input) {
|
|
1376
1376
|
// Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
|
|
1377
|
-
if (config$
|
|
1377
|
+
if (config$3.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
|
|
1378
1378
|
data$f = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
|
|
1379
1379
|
// Only encode this event if we haven't already reported this hash
|
|
1380
1380
|
if (history$5.indexOf(data$f.checksum) < 0) {
|
|
@@ -1395,7 +1395,7 @@ function recompute$8(evt) {
|
|
|
1395
1395
|
var element = target(evt);
|
|
1396
1396
|
if (element) {
|
|
1397
1397
|
var value = element.value;
|
|
1398
|
-
var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$
|
|
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 */;
|
|
1399
1399
|
state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
|
|
1400
1400
|
schedule(encode$4.bind(this, 42 /* Event.Change */));
|
|
1401
1401
|
}
|
|
@@ -2196,7 +2196,7 @@ var styleTimeMap = {};
|
|
|
2196
2196
|
var documentNodes = [];
|
|
2197
2197
|
var createdSheetIds = [];
|
|
2198
2198
|
function proxyStyleRules$1(win) {
|
|
2199
|
-
if ((config$
|
|
2199
|
+
if ((config$3.lean && config$3.lite) || win === null || win === undefined) {
|
|
2200
2200
|
return;
|
|
2201
2201
|
}
|
|
2202
2202
|
win.clarityOverrides = win.clarityOverrides || {};
|
|
@@ -2235,7 +2235,7 @@ function start$q() {
|
|
|
2235
2235
|
proxyStyleRules$1(window);
|
|
2236
2236
|
}
|
|
2237
2237
|
function checkDocumentStyles(documentNode, timestamp) {
|
|
2238
|
-
if (config$
|
|
2238
|
+
if (config$3.lean && config$3.lite) {
|
|
2239
2239
|
return;
|
|
2240
2240
|
}
|
|
2241
2241
|
if (documentNodes.indexOf(documentNode) === -1) {
|
|
@@ -2622,7 +2622,7 @@ function encode$5 (type, timer, ts) {
|
|
|
2622
2622
|
if (type === 6 /* Event.Mutation */) {
|
|
2623
2623
|
activity(eventTime);
|
|
2624
2624
|
}
|
|
2625
|
-
queue(tokenize(tokens), !config$
|
|
2625
|
+
queue(tokenize(tokens), !config$3.lean);
|
|
2626
2626
|
_o.label = 11;
|
|
2627
2627
|
case 11: return [3 /*break*/, 13];
|
|
2628
2628
|
case 12:
|
|
@@ -2832,7 +2832,7 @@ function processMutation(timer, mutation, instance, timestamp) {
|
|
|
2832
2832
|
return [2 /*return*/];
|
|
2833
2833
|
}
|
|
2834
2834
|
target = mutation.target;
|
|
2835
|
-
type = config$
|
|
2835
|
+
type = config$3.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
|
|
2836
2836
|
if (type && target && target.ownerDocument) {
|
|
2837
2837
|
parse(target.ownerDocument);
|
|
2838
2838
|
}
|
|
@@ -3541,8 +3541,9 @@ var selectorMap = {};
|
|
|
3541
3541
|
function reset$8() {
|
|
3542
3542
|
selectorMap = {};
|
|
3543
3543
|
}
|
|
3544
|
-
function
|
|
3544
|
+
function config$2(classNames) {
|
|
3545
3545
|
extraExcludeClassNames = classNames || [];
|
|
3546
|
+
console.log("[Selector] config called \u2014 extraExcludeClassNames set to: [".concat(extraExcludeClassNames.join(', '), "]"));
|
|
3546
3547
|
}
|
|
3547
3548
|
function get$1(input, type) {
|
|
3548
3549
|
var a = input.attributes;
|
|
@@ -3566,7 +3567,13 @@ function get$1(input, type) {
|
|
|
3566
3567
|
input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
|
|
3567
3568
|
var selector = "".concat(prefix).concat(input.tag).concat(suffix);
|
|
3568
3569
|
var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
|
|
3569
|
-
var
|
|
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;
|
|
3570
3577
|
if (classes && classes.length > 0) {
|
|
3571
3578
|
if (type === 0 /* Selector.Alpha */) {
|
|
3572
3579
|
// In Alpha mode, update selector to use class names, with relative positioning within the parent id container.
|
|
@@ -3579,16 +3586,19 @@ function get$1(input, type) {
|
|
|
3579
3586
|
selectorMap[key].push(input.id);
|
|
3580
3587
|
}
|
|
3581
3588
|
selector = "".concat(key).concat("~" /* Constant.Tilde */).concat(selectorMap[key].indexOf(input.id));
|
|
3589
|
+
console.log("\uD83D\uDE80 \uD83D\uDC25 ~ get ~ selector:", selector);
|
|
3582
3590
|
}
|
|
3583
3591
|
else {
|
|
3584
3592
|
// In Beta mode, we continue to look at query selectors in context of the full page
|
|
3585
3593
|
selector = "".concat(prefix).concat(input.tag, ".").concat(classes).concat(suffix);
|
|
3594
|
+
console.log("\uD83D\uDE80 \uD83D\uDC25 ~ get ~ selector:", selector);
|
|
3586
3595
|
}
|
|
3587
3596
|
}
|
|
3588
3597
|
// Update selector to use "id" field when available. There are two exceptions:
|
|
3589
3598
|
// (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
|
|
3590
3599
|
// (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
|
|
3591
3600
|
selector = id && filter(id) ? "".concat(getDomPrefix(prefix)).concat("#" /* Constant.Hash */).concat(id) : selector;
|
|
3601
|
+
console.log("\uD83D\uDE80 \uD83D\uDC25 ~ get ~ selector:", selector);
|
|
3592
3602
|
return selector;
|
|
3593
3603
|
}
|
|
3594
3604
|
}
|
|
@@ -3615,7 +3625,9 @@ function filter(value) {
|
|
|
3615
3625
|
if (!value) {
|
|
3616
3626
|
return false;
|
|
3617
3627
|
} // Do not process empty strings
|
|
3618
|
-
|
|
3628
|
+
var excludeClassNames = getExcludeClassNames();
|
|
3629
|
+
console.log("\uD83D\uDE80 \uD83D\uDC25 ~ filter ~ excludeClassNames:", excludeClassNames);
|
|
3630
|
+
if (excludeClassNames.some(function (x) { return value.toLowerCase().indexOf(x) >= 0; })) {
|
|
3619
3631
|
return false;
|
|
3620
3632
|
}
|
|
3621
3633
|
for (var i = 0; i < value.length; i++) {
|
|
@@ -3627,12 +3639,14 @@ function filter(value) {
|
|
|
3627
3639
|
return true;
|
|
3628
3640
|
}
|
|
3629
3641
|
function getExcludeClassNames() {
|
|
3642
|
+
console.log("\uD83D\uDE80 \uD83D\uDC25 ~ getExcludeClassNames ~ extraExcludeClassNames:", extraExcludeClassNames);
|
|
3643
|
+
console.log("\uD83D\uDE80 \uD83D\uDC25 ~ getExcludeClassNames ~ excludeClassNames:", excludeClassNames);
|
|
3630
3644
|
return __spreadArray(__spreadArray([], excludeClassNames, true), extraExcludeClassNames, true);
|
|
3631
3645
|
}
|
|
3632
3646
|
|
|
3633
3647
|
var selector = /*#__PURE__*/Object.freeze({
|
|
3634
3648
|
__proto__: null,
|
|
3635
|
-
|
|
3649
|
+
config: config$2,
|
|
3636
3650
|
get: get$1,
|
|
3637
3651
|
reset: reset$8
|
|
3638
3652
|
});
|
|
@@ -3689,14 +3703,14 @@ function parse(root, init) {
|
|
|
3689
3703
|
try {
|
|
3690
3704
|
// Parse unmask configuration into separate query selectors and override tokens as part of initialization
|
|
3691
3705
|
if (init) {
|
|
3692
|
-
config$
|
|
3706
|
+
config$3.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
|
|
3693
3707
|
}
|
|
3694
3708
|
// Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
|
|
3695
3709
|
// We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
|
|
3696
3710
|
if ("querySelectorAll" in root) {
|
|
3697
|
-
config$
|
|
3698
|
-
config$
|
|
3699
|
-
config$
|
|
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
|
|
3700
3714
|
unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
|
|
3701
3715
|
}
|
|
3702
3716
|
}
|
|
@@ -3727,7 +3741,7 @@ function add$1(node, parent, data, source) {
|
|
|
3727
3741
|
var parentValue = null;
|
|
3728
3742
|
var regionId = exists(node) ? id : null;
|
|
3729
3743
|
var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
|
|
3730
|
-
var privacyId = config$
|
|
3744
|
+
var privacyId = config$3.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
|
|
3731
3745
|
if (parentId >= 0 && values$1[parentId]) {
|
|
3732
3746
|
parentValue = values$1[parentId];
|
|
3733
3747
|
parentValue.children.push(id);
|
|
@@ -4031,7 +4045,7 @@ function getPreviousId(node) {
|
|
|
4031
4045
|
function track$4(id, source, changed, parentChanged) {
|
|
4032
4046
|
if (changed === void 0) { changed = true; }
|
|
4033
4047
|
if (parentChanged === void 0) { parentChanged = false; }
|
|
4034
|
-
if (config$
|
|
4048
|
+
if (config$3.lean && config$3.lite) {
|
|
4035
4049
|
return;
|
|
4036
4050
|
}
|
|
4037
4051
|
// Keep track of the order in which mutations happened, they may not be sequential
|
|
@@ -4620,8 +4634,8 @@ var modules$1 = null;
|
|
|
4620
4634
|
function start$i() {
|
|
4621
4635
|
active$2 = true;
|
|
4622
4636
|
modules$1 = new Set();
|
|
4623
|
-
if (config$
|
|
4624
|
-
config$
|
|
4637
|
+
if (config$3.modules && config$3.modules.length > 0) {
|
|
4638
|
+
config$3.modules.forEach(function (m) { event(m); });
|
|
4625
4639
|
}
|
|
4626
4640
|
}
|
|
4627
4641
|
function stop$g() {
|
|
@@ -4709,7 +4723,7 @@ function queue(tokens, transmit) {
|
|
|
4709
4723
|
var now = time();
|
|
4710
4724
|
var type = tokens.length > 1 ? tokens[1] : null;
|
|
4711
4725
|
var event = JSON.stringify(tokens);
|
|
4712
|
-
if (!config$
|
|
4726
|
+
if (!config$3.lean) {
|
|
4713
4727
|
leanLimit = false;
|
|
4714
4728
|
}
|
|
4715
4729
|
else if (!leanLimit && playbackBytes + event.length > 10485760 /* Setting.PlaybackBytesLimit */) {
|
|
@@ -4785,7 +4799,7 @@ function upload(final) {
|
|
|
4785
4799
|
return [2 /*return*/];
|
|
4786
4800
|
}
|
|
4787
4801
|
timeout = null;
|
|
4788
|
-
sendPlaybackBytes = config$
|
|
4802
|
+
sendPlaybackBytes = config$3.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
|
|
4789
4803
|
if (sendPlaybackBytes) {
|
|
4790
4804
|
max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
|
|
4791
4805
|
}
|
|
@@ -4838,8 +4852,8 @@ function stringify(encoded) {
|
|
|
4838
4852
|
function send(payload, zipped, sequence, beacon) {
|
|
4839
4853
|
if (beacon === void 0) { beacon = false; }
|
|
4840
4854
|
// Upload data if a valid URL is defined in the config
|
|
4841
|
-
if (typeof config$
|
|
4842
|
-
var url_1 = config$
|
|
4855
|
+
if (typeof config$3.upload === "string" /* Constant.String */) {
|
|
4856
|
+
var url_1 = config$3.upload;
|
|
4843
4857
|
var dispatched = false;
|
|
4844
4858
|
// If it's the last payload, attempt to upload using sendBeacon first.
|
|
4845
4859
|
// The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
|
|
@@ -4890,8 +4904,8 @@ function send(payload, zipped, sequence, beacon) {
|
|
|
4890
4904
|
}
|
|
4891
4905
|
}
|
|
4892
4906
|
}
|
|
4893
|
-
else if (config$
|
|
4894
|
-
var callback = config$
|
|
4907
|
+
else if (config$3.upload) {
|
|
4908
|
+
var callback = config$3.upload;
|
|
4895
4909
|
callback(payload);
|
|
4896
4910
|
done(sequence);
|
|
4897
4911
|
}
|
|
@@ -4913,7 +4927,7 @@ function check$3(xhr, sequence) {
|
|
|
4913
4927
|
// 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
|
|
4914
4928
|
// In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
|
|
4915
4929
|
if (xhr.status === 0) {
|
|
4916
|
-
config$
|
|
4930
|
+
config$3.upload = config$3.fallback ? config$3.fallback : config$3.upload;
|
|
4917
4931
|
}
|
|
4918
4932
|
// Capture the status code and number of attempts so we can report it back to the server
|
|
4919
4933
|
track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
|
|
@@ -4960,8 +4974,8 @@ function done(sequence) {
|
|
|
4960
4974
|
function delay() {
|
|
4961
4975
|
// Progressively increase delay as we continue to send more payloads from the client to the server
|
|
4962
4976
|
// If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
|
|
4963
|
-
var gap = config$
|
|
4964
|
-
return typeof config$
|
|
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;
|
|
4965
4979
|
}
|
|
4966
4980
|
function response(payload) {
|
|
4967
4981
|
var lines = payload && payload.length > 0 ? payload.split("\n") : [];
|
|
@@ -4979,8 +4993,8 @@ function response(payload) {
|
|
|
4979
4993
|
break;
|
|
4980
4994
|
case "ACTION" /* Constant.Action */:
|
|
4981
4995
|
// Invoke action callback, if configured and has a valid value
|
|
4982
|
-
if (config$
|
|
4983
|
-
config$
|
|
4996
|
+
if (config$3.action && parts.length > 1) {
|
|
4997
|
+
config$3.action(parts[1]);
|
|
4984
4998
|
}
|
|
4985
4999
|
break;
|
|
4986
5000
|
case "EXTRACT" /* Constant.Extract */:
|
|
@@ -4999,7 +5013,7 @@ function response(payload) {
|
|
|
4999
5013
|
}
|
|
5000
5014
|
break;
|
|
5001
5015
|
case "SNAPSHOT" /* Constant.Snapshot */:
|
|
5002
|
-
config$
|
|
5016
|
+
config$3.lean = false; // Disable lean mode to ensure we can send playback information to server.
|
|
5003
5017
|
snapshot();
|
|
5004
5018
|
break;
|
|
5005
5019
|
}
|
|
@@ -5333,8 +5347,8 @@ function discover() {
|
|
|
5333
5347
|
|
|
5334
5348
|
var data$6 = null;
|
|
5335
5349
|
function start$c() {
|
|
5336
|
-
if (!config$
|
|
5337
|
-
config$
|
|
5350
|
+
if (!config$3.lean && config$3.upgrade) {
|
|
5351
|
+
config$3.upgrade("Config" /* Constant.Config */);
|
|
5338
5352
|
}
|
|
5339
5353
|
data$6 = null;
|
|
5340
5354
|
}
|
|
@@ -5344,18 +5358,18 @@ function start$c() {
|
|
|
5344
5358
|
// and send all backed up layout events to the server.
|
|
5345
5359
|
function upgrade(key) {
|
|
5346
5360
|
// Upgrade only if Clarity was successfully activated on the page
|
|
5347
|
-
if (active() && config$
|
|
5348
|
-
config$
|
|
5361
|
+
if (active() && config$3.lean) {
|
|
5362
|
+
config$3.lean = false;
|
|
5349
5363
|
data$6 = { key: key };
|
|
5350
5364
|
// Update metadata to track we have upgraded this session
|
|
5351
5365
|
callback();
|
|
5352
5366
|
save();
|
|
5353
5367
|
// Callback upgrade handler, if configured
|
|
5354
|
-
if (config$
|
|
5355
|
-
config$
|
|
5368
|
+
if (config$3.upgrade) {
|
|
5369
|
+
config$3.upgrade(key);
|
|
5356
5370
|
}
|
|
5357
5371
|
encode$1(3 /* Event.Upgrade */);
|
|
5358
|
-
if (config$
|
|
5372
|
+
if (config$3.lite) {
|
|
5359
5373
|
start$d();
|
|
5360
5374
|
start$q();
|
|
5361
5375
|
}
|
|
@@ -5643,7 +5657,7 @@ function compute$2() {
|
|
|
5643
5657
|
if (updateConsent) {
|
|
5644
5658
|
encode$1(47 /* Event.Consent */);
|
|
5645
5659
|
updateConsent = false;
|
|
5646
|
-
if (!config$
|
|
5660
|
+
if (!config$3.track) {
|
|
5647
5661
|
var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
|
|
5648
5662
|
if (ics === null || ics === void 0 ? void 0 : ics.usedUpdate) {
|
|
5649
5663
|
processConsent();
|
|
@@ -5668,13 +5682,13 @@ function start$8() {
|
|
|
5668
5682
|
// Populate ids for this page
|
|
5669
5683
|
var s = session();
|
|
5670
5684
|
var u = user();
|
|
5671
|
-
var projectId = config$
|
|
5672
|
-
var userId = config$
|
|
5673
|
-
var sessionId = config$
|
|
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;
|
|
5674
5688
|
data$2 = { projectId: projectId, userId: userId, sessionId: sessionId, pageNum: s.count };
|
|
5675
5689
|
// Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
|
|
5676
|
-
config$
|
|
5677
|
-
config$
|
|
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;
|
|
5678
5692
|
// Log page metadata as dimensions
|
|
5679
5693
|
log(0 /* Dimension.UserAgent */, ua);
|
|
5680
5694
|
log(3 /* Dimension.PageTitle */, title);
|
|
@@ -5712,7 +5726,7 @@ function start$8() {
|
|
|
5712
5726
|
max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
|
|
5713
5727
|
}
|
|
5714
5728
|
// Read cookies specified in configuration
|
|
5715
|
-
for (var _i = 0, _d = config$
|
|
5729
|
+
for (var _i = 0, _d = config$3.cookies; _i < _d.length; _i++) {
|
|
5716
5730
|
var key = _d[_i];
|
|
5717
5731
|
var value = getCookie(key);
|
|
5718
5732
|
if (value) {
|
|
@@ -5724,14 +5738,14 @@ function start$8() {
|
|
|
5724
5738
|
if (consentStatus === null) {
|
|
5725
5739
|
consentStatus = {
|
|
5726
5740
|
source: u.consent ? 6 /* ConsentSource.Cookie */ : 0 /* ConsentSource.Implicit */,
|
|
5727
|
-
ad_Storage: config$
|
|
5728
|
-
analytics_Storage: config$
|
|
5741
|
+
ad_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
|
|
5742
|
+
analytics_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
|
|
5729
5743
|
};
|
|
5730
5744
|
}
|
|
5731
5745
|
var consent = getConsentData(consentStatus);
|
|
5732
5746
|
config$1(consent);
|
|
5733
5747
|
// Track ids using a cookie if configuration allows it, skip if using external session
|
|
5734
|
-
if (!config$
|
|
5748
|
+
if (!config$3.externalSession) {
|
|
5735
5749
|
track(u);
|
|
5736
5750
|
}
|
|
5737
5751
|
}
|
|
@@ -5759,14 +5773,14 @@ function metadata(cb, wait, recall, consentInfo) {
|
|
|
5759
5773
|
if (wait === void 0) { wait = true; }
|
|
5760
5774
|
if (recall === void 0) { recall = false; }
|
|
5761
5775
|
if (consentInfo === void 0) { consentInfo = false; }
|
|
5762
|
-
var upgraded = config$
|
|
5776
|
+
var upgraded = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
|
|
5763
5777
|
var called = false;
|
|
5764
5778
|
// if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
|
|
5765
5779
|
// directly execute the callback in addition to adding to our list as we only process callbacks at the moment
|
|
5766
5780
|
// we go through the upgrading flow.
|
|
5767
5781
|
if (data$2 && (upgraded || wait === false)) {
|
|
5768
5782
|
// Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
|
|
5769
|
-
cb(data$2, !config$
|
|
5783
|
+
cb(data$2, !config$3.lean, consentInfo ? consentStatus : undefined);
|
|
5770
5784
|
called = true;
|
|
5771
5785
|
}
|
|
5772
5786
|
if (recall || !called) {
|
|
@@ -5806,15 +5820,15 @@ function consentv2(consentState, source) {
|
|
|
5806
5820
|
consentStatus = updatedStatus;
|
|
5807
5821
|
callback(true);
|
|
5808
5822
|
var consentData = getConsentData(consentStatus);
|
|
5809
|
-
if (!consentData.analytics_Storage && config$
|
|
5810
|
-
config$
|
|
5823
|
+
if (!consentData.analytics_Storage && config$3.track) {
|
|
5824
|
+
config$3.track = false;
|
|
5811
5825
|
clear(true);
|
|
5812
5826
|
stop();
|
|
5813
5827
|
window.setTimeout(start, 250 /* Setting.RestartDelay */);
|
|
5814
5828
|
return;
|
|
5815
5829
|
}
|
|
5816
5830
|
if (active() && consentData.analytics_Storage) {
|
|
5817
|
-
config$
|
|
5831
|
+
config$3.track = true;
|
|
5818
5832
|
track(user(), 1 /* BooleanFlag.True */);
|
|
5819
5833
|
save();
|
|
5820
5834
|
}
|
|
@@ -5845,7 +5859,7 @@ function clear(all) {
|
|
|
5845
5859
|
}
|
|
5846
5860
|
function tab() {
|
|
5847
5861
|
var id = shortid();
|
|
5848
|
-
if (config$
|
|
5862
|
+
if (config$3.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
|
|
5849
5863
|
var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
|
|
5850
5864
|
id = value ? value : id;
|
|
5851
5865
|
sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
|
|
@@ -5854,15 +5868,15 @@ function tab() {
|
|
|
5854
5868
|
}
|
|
5855
5869
|
function callback(consentUpdate) {
|
|
5856
5870
|
if (consentUpdate === void 0) { consentUpdate = false; }
|
|
5857
|
-
var upgrade = config$
|
|
5871
|
+
var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
|
|
5858
5872
|
processCallback(upgrade, consentUpdate);
|
|
5859
5873
|
}
|
|
5860
5874
|
function save() {
|
|
5861
|
-
if (!data$2 || !config$
|
|
5875
|
+
if (!data$2 || !config$3.track || config$3.externalSession)
|
|
5862
5876
|
return;
|
|
5863
5877
|
var ts = Math.round(Date.now());
|
|
5864
|
-
var upload = config$
|
|
5865
|
-
var upgrade = config$
|
|
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 */;
|
|
5866
5880
|
setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join(COOKIE_SEP), 1 /* Setting.SessionExpire */);
|
|
5867
5881
|
}
|
|
5868
5882
|
function processCallback(upgrade, consentUpdate) {
|
|
@@ -5873,7 +5887,7 @@ function processCallback(upgrade, consentUpdate) {
|
|
|
5873
5887
|
if (cb.callback &&
|
|
5874
5888
|
((!cb.called && !consentUpdate) || (cb.consentInfo && consentUpdate)) && //If consentUpdate is true, we only call the callback if it has consentInfo
|
|
5875
5889
|
(!cb.wait || upgrade)) {
|
|
5876
|
-
cb.callback(data$2, !config$
|
|
5890
|
+
cb.callback(data$2, !config$3.lean, cb.consentInfo ? consentStatus : undefined);
|
|
5877
5891
|
cb.called = true;
|
|
5878
5892
|
if (!cb.recall) {
|
|
5879
5893
|
callbacks.splice(i, 1);
|
|
@@ -5891,7 +5905,7 @@ function track(u, consent) {
|
|
|
5891
5905
|
// E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
|
|
5892
5906
|
var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
|
|
5893
5907
|
// If DOB is not set in the user object, use the date set in the config as a DOB
|
|
5894
|
-
var dob = u.dob === 0 ? (config$
|
|
5908
|
+
var dob = u.dob === 0 ? (config$3.dob === null ? 0 : config$3.dob) : u.dob;
|
|
5895
5909
|
// To avoid cookie churn, write user id cookie only once every day
|
|
5896
5910
|
if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
|
|
5897
5911
|
var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
|
|
@@ -5907,7 +5921,7 @@ function shortid() {
|
|
|
5907
5921
|
}
|
|
5908
5922
|
function session() {
|
|
5909
5923
|
var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
|
|
5910
|
-
var value = getCookie("_clsk" /* Constant.SessionKey */, !config$
|
|
5924
|
+
var value = getCookie("_clsk" /* Constant.SessionKey */, !config$3.includeSubdomains);
|
|
5911
5925
|
if (value) {
|
|
5912
5926
|
// Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
|
|
5913
5927
|
var parts = value.includes("^" /* Constant.Caret */) ? value.split("^" /* Constant.Caret */) : value.split("|" /* Constant.Pipe */);
|
|
@@ -5928,7 +5942,7 @@ function num(string, base) {
|
|
|
5928
5942
|
}
|
|
5929
5943
|
function user() {
|
|
5930
5944
|
var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
|
|
5931
|
-
var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$
|
|
5945
|
+
var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$3.includeSubdomains);
|
|
5932
5946
|
if (cookie && cookie.length > 0) {
|
|
5933
5947
|
// Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
|
|
5934
5948
|
// Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
|
|
@@ -5948,9 +5962,9 @@ function user() {
|
|
|
5948
5962
|
output.dob = num(parts[4]);
|
|
5949
5963
|
}
|
|
5950
5964
|
// Set track configuration to true for this user if we have explicit consent, regardless of project setting
|
|
5951
|
-
config$
|
|
5965
|
+
config$3.track = config$3.track || output.consent === 1 /* BooleanFlag.True */;
|
|
5952
5966
|
// Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
|
|
5953
|
-
output.id = config$
|
|
5967
|
+
output.id = config$3.track ? parts[0] : output.id;
|
|
5954
5968
|
}
|
|
5955
5969
|
return output;
|
|
5956
5970
|
}
|
|
@@ -6007,7 +6021,7 @@ function reset$2() {
|
|
|
6007
6021
|
function report(e) {
|
|
6008
6022
|
// Do not report the same message twice for the same page
|
|
6009
6023
|
if (history$1 && history$1.indexOf(e.message) === -1) {
|
|
6010
|
-
var url = config$
|
|
6024
|
+
var url = config$3.report;
|
|
6011
6025
|
if (url && url.length > 0 && data$1) {
|
|
6012
6026
|
var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
|
|
6013
6027
|
if (e.message) {
|
|
@@ -6192,8 +6206,8 @@ function config(override) {
|
|
|
6192
6206
|
return false;
|
|
6193
6207
|
}
|
|
6194
6208
|
for (var key in override) {
|
|
6195
|
-
if (key in config$
|
|
6196
|
-
config$
|
|
6209
|
+
if (key in config$3) {
|
|
6210
|
+
config$3[key] = override[key];
|
|
6197
6211
|
}
|
|
6198
6212
|
}
|
|
6199
6213
|
return true;
|
|
@@ -6237,11 +6251,12 @@ var diagnostic = /*#__PURE__*/Object.freeze({
|
|
|
6237
6251
|
function start$3() {
|
|
6238
6252
|
// The order below is important
|
|
6239
6253
|
// and is determined by interdependencies of modules
|
|
6240
|
-
|
|
6254
|
+
config$2(config$3.excludeClassNames || []);
|
|
6255
|
+
console.log("\uD83D\uDE80 \uD83D\uDC25 ~ start ~ config:", config$3);
|
|
6241
6256
|
start$n();
|
|
6242
6257
|
start$k();
|
|
6243
6258
|
start$l();
|
|
6244
|
-
if (config$
|
|
6259
|
+
if (config$3.delayDom) {
|
|
6245
6260
|
// Lazy load layout module as part of page load time performance improvements experiment
|
|
6246
6261
|
bind(window, 'load', function () {
|
|
6247
6262
|
start$m();
|
|
@@ -6490,7 +6505,7 @@ function process(entries) {
|
|
|
6490
6505
|
case "resource" /* Constant.Resource */:
|
|
6491
6506
|
var name_1 = entry.name;
|
|
6492
6507
|
log(4 /* Dimension.NetworkHosts */, host(name_1));
|
|
6493
|
-
if (name_1 === config$
|
|
6508
|
+
if (name_1 === config$3.upload || name_1 === config$3.fallback) {
|
|
6494
6509
|
max(28 /* Metric.UploadTime */, entry.duration);
|
|
6495
6510
|
}
|
|
6496
6511
|
break;
|