@gemx-dev/clarity-js 0.8.67 → 0.8.68
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.insight.js +1 -1
- package/build/clarity.js +181 -63
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +181 -63
- package/build/clarity.performance.js +1 -1
- package/package.json +1 -1
- package/src/core/config.ts +1 -0
- package/src/core/history.ts +28 -17
- package/src/core/scrub.ts +1 -4
- package/src/core/version.ts +1 -1
- package/src/data/consent.ts +9 -4
- package/src/data/dimension.ts +1 -1
- package/src/data/encode.ts +4 -4
- package/src/data/metadata.ts +21 -7
- package/src/insight/encode.ts +5 -2
- package/src/interaction/change.ts +3 -3
- package/src/interaction/click.ts +73 -6
- package/src/interaction/encode.ts +1 -0
- package/src/layout/constants.ts +13 -0
- package/src/layout/custom.ts +14 -9
- package/src/layout/dom.ts +10 -9
- package/src/layout/encode.ts +5 -2
- package/src/layout/index.ts +4 -2
- package/src/layout/mutation.ts +5 -5
- package/src/layout/selector.ts +2 -1
- package/test/consentv2.test.ts +160 -15
- package/types/core.d.ts +1 -0
- package/types/data.d.ts +1 -0
- package/types/interaction.d.ts +9 -0
- package/types/layout.d.ts +1 -8
- package/types/performance.d.ts +3 -0
package/build/clarity.module.js
CHANGED
|
@@ -172,6 +172,7 @@ var config$3 = {
|
|
|
172
172
|
conversions: false,
|
|
173
173
|
includeSubdomains: true,
|
|
174
174
|
modules: [],
|
|
175
|
+
diagnostics: false,
|
|
175
176
|
excludeClassNames: [],
|
|
176
177
|
externalSession: false,
|
|
177
178
|
userId: null,
|
|
@@ -209,7 +210,7 @@ function stop$K() {
|
|
|
209
210
|
startTime = 0;
|
|
210
211
|
}
|
|
211
212
|
|
|
212
|
-
var version$1 = "0.8.
|
|
213
|
+
var version$1 = "0.8.68";
|
|
213
214
|
|
|
214
215
|
// tslint:disable: no-bitwise
|
|
215
216
|
function hash (input, precision) {
|
|
@@ -272,10 +273,7 @@ function text$1(value, hint, privacy, mangle, type) {
|
|
|
272
273
|
case "href":
|
|
273
274
|
case "xlink:href":
|
|
274
275
|
if (privacy === 3 /* Privacy.TextImage */) {
|
|
275
|
-
|
|
276
|
-
return 'blob:';
|
|
277
|
-
}
|
|
278
|
-
return "" /* Data.Constant.Empty */;
|
|
276
|
+
return (value === null || value === void 0 ? void 0 : value.startsWith('blob:')) ? 'blob:' : "" /* Data.Constant.Empty */;
|
|
279
277
|
}
|
|
280
278
|
return value;
|
|
281
279
|
case "value":
|
|
@@ -1382,6 +1380,18 @@ function check$5(id, target, input) {
|
|
|
1382
1380
|
}
|
|
1383
1381
|
}
|
|
1384
1382
|
|
|
1383
|
+
/**
|
|
1384
|
+
* Pre-computed arrays for better minification and performance
|
|
1385
|
+
* These replace comma-separated strings that were previously split at runtime
|
|
1386
|
+
*/
|
|
1387
|
+
// Pre-computed mask arrays (replaces Mask.Text.split(), etc.)
|
|
1388
|
+
var MaskTextList = ["address", "password", "contact"];
|
|
1389
|
+
var MaskDisableList = ["radio", "checkbox", "range", "button", "reset", "submit"];
|
|
1390
|
+
var MaskExcludeList = ["password", "secret", "pass", "social", "ssn", "code", "hidden"];
|
|
1391
|
+
var MaskTagsList = ["INPUT", "SELECT", "TEXTAREA"];
|
|
1392
|
+
// Pre-computed exclude class names (replaces Constant.ExcludeClassNames.split())
|
|
1393
|
+
var ExcludeClassNamesList = ["load", "active", "fixed", "visible", "focus", "show", "collaps", "animat"];
|
|
1394
|
+
|
|
1385
1395
|
var state$a = [];
|
|
1386
1396
|
function start$E() {
|
|
1387
1397
|
reset$o();
|
|
@@ -1393,7 +1403,7 @@ function recompute$8(evt) {
|
|
|
1393
1403
|
var element = target(evt);
|
|
1394
1404
|
if (element) {
|
|
1395
1405
|
var value = element.value;
|
|
1396
|
-
var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$3.fraud &&
|
|
1406
|
+
var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$3.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
|
|
1397
1407
|
state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
|
|
1398
1408
|
schedule(encode$4.bind(this, 42 /* Event.Change */));
|
|
1399
1409
|
}
|
|
@@ -1422,6 +1432,7 @@ function offset(element) {
|
|
|
1422
1432
|
}
|
|
1423
1433
|
|
|
1424
1434
|
var UserInputTags = ["input", "textarea", "radio", "button", "canvas", "select"];
|
|
1435
|
+
var VM_PATTERN = /VM\d/;
|
|
1425
1436
|
var state$9 = [];
|
|
1426
1437
|
function start$D() {
|
|
1427
1438
|
reset$n();
|
|
@@ -1454,8 +1465,9 @@ function handler$4(event, root, evt) {
|
|
|
1454
1465
|
x = Math.round(l.x + (l.w / 2));
|
|
1455
1466
|
y = Math.round(l.y + (l.h / 2));
|
|
1456
1467
|
}
|
|
1457
|
-
var
|
|
1458
|
-
var
|
|
1468
|
+
var relativeCoords = computeRelativeCoordinates(t, x, y, l);
|
|
1469
|
+
var eX = relativeCoords.eX;
|
|
1470
|
+
var eY = relativeCoords.eY;
|
|
1459
1471
|
// Check for null values before processing this event
|
|
1460
1472
|
if (x !== null && y !== null) {
|
|
1461
1473
|
var textInfo = text(t);
|
|
@@ -1481,6 +1493,7 @@ function handler$4(event, root, evt) {
|
|
|
1481
1493
|
tag: getElementAttribute(t, "tagName").substring(0, 10 /* Setting.ClickTag */),
|
|
1482
1494
|
class: getElementAttribute(t, "className").substring(0, 50 /* Setting.ClickClass */),
|
|
1483
1495
|
id: getElementAttribute(t, "id").substring(0, 25 /* Setting.ClickId */),
|
|
1496
|
+
source: config$3.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
|
|
1484
1497
|
}
|
|
1485
1498
|
});
|
|
1486
1499
|
schedule(encode$4.bind(this, event));
|
|
@@ -1532,7 +1545,9 @@ function getElementAttribute(element, attribute) {
|
|
|
1532
1545
|
}
|
|
1533
1546
|
function layout$1(element) {
|
|
1534
1547
|
var box = null;
|
|
1535
|
-
var
|
|
1548
|
+
var doc = element.ownerDocument || document;
|
|
1549
|
+
var de = doc.documentElement;
|
|
1550
|
+
var win = doc.defaultView || window;
|
|
1536
1551
|
if (typeof element.getBoundingClientRect === "function") {
|
|
1537
1552
|
// getBoundingClientRect returns rectangle relative positioning to viewport
|
|
1538
1553
|
var rect = element.getBoundingClientRect();
|
|
@@ -1541,16 +1556,46 @@ function layout$1(element) {
|
|
|
1541
1556
|
// Also: using Math.floor() instead of Math.round() because in Edge,
|
|
1542
1557
|
// getBoundingClientRect returns partial pixel values (e.g. 162.5px) and Chrome already
|
|
1543
1558
|
// floors the value (e.g. 162px). This keeps consistent behavior across browsers.
|
|
1559
|
+
var scrollLeft = "pageXOffset" in win ? win.pageXOffset : de.scrollLeft;
|
|
1560
|
+
var scrollTop = "pageYOffset" in win ? win.pageYOffset : de.scrollTop;
|
|
1544
1561
|
box = {
|
|
1545
|
-
x: Math.floor(rect.left +
|
|
1546
|
-
y: Math.floor(rect.top +
|
|
1562
|
+
x: Math.floor(rect.left + scrollLeft),
|
|
1563
|
+
y: Math.floor(rect.top + scrollTop),
|
|
1547
1564
|
w: Math.floor(rect.width),
|
|
1548
1565
|
h: Math.floor(rect.height)
|
|
1549
1566
|
};
|
|
1567
|
+
// If this element is inside an iframe, add the iframe's offset to get parent-page coordinates
|
|
1568
|
+
var frame = iframe(doc);
|
|
1569
|
+
if (frame) {
|
|
1570
|
+
var distance = offset(frame);
|
|
1571
|
+
box.x += Math.round(distance.x);
|
|
1572
|
+
box.y += Math.round(distance.y);
|
|
1573
|
+
}
|
|
1550
1574
|
}
|
|
1551
1575
|
}
|
|
1552
1576
|
return box;
|
|
1553
1577
|
}
|
|
1578
|
+
function computeRelativeCoordinates(element, x, y, l) {
|
|
1579
|
+
if (!l)
|
|
1580
|
+
return { eX: 0, eY: 0 };
|
|
1581
|
+
var box = l;
|
|
1582
|
+
var el = element;
|
|
1583
|
+
var eX = Math.max(Math.floor(((x - box.x) / box.w) * 32767 /* Setting.ClickPrecision */), 0);
|
|
1584
|
+
var eY = Math.max(Math.floor(((y - box.y) / box.h) * 32767 /* Setting.ClickPrecision */), 0);
|
|
1585
|
+
// Walk up parent chain if coords exceed bounds (can happen with CSS-rendered text)
|
|
1586
|
+
// Cap iterations to prevent performance issues with deeply nested DOM
|
|
1587
|
+
var iterations = 0;
|
|
1588
|
+
while ((eX > 32767 /* Setting.ClickPrecision */ || eY > 32767 /* Setting.ClickPrecision */) && el.parentElement && iterations < 10 /* Setting.ClickParentTraversal */) {
|
|
1589
|
+
el = el.parentElement;
|
|
1590
|
+
iterations++;
|
|
1591
|
+
box = layout$1(el);
|
|
1592
|
+
if (!box)
|
|
1593
|
+
continue;
|
|
1594
|
+
eX = Math.max(Math.floor(((x - box.x) / box.w) * 32767 /* Setting.ClickPrecision */), 0);
|
|
1595
|
+
eY = Math.max(Math.floor(((y - box.y) / box.h) * 32767 /* Setting.ClickPrecision */), 0);
|
|
1596
|
+
}
|
|
1597
|
+
return { eX: eX, eY: eY };
|
|
1598
|
+
}
|
|
1554
1599
|
function context(a) {
|
|
1555
1600
|
if (a && a.hasAttribute("target" /* Constant.Target */)) {
|
|
1556
1601
|
switch (a.getAttribute("target" /* Constant.Target */)) {
|
|
@@ -1561,6 +1606,29 @@ function context(a) {
|
|
|
1561
1606
|
}
|
|
1562
1607
|
return 0 /* BrowsingContext.Self */;
|
|
1563
1608
|
}
|
|
1609
|
+
function source() {
|
|
1610
|
+
source.dn = 1 /* FunctionNames.ClickSource */;
|
|
1611
|
+
try {
|
|
1612
|
+
var stack = new Error().stack || "";
|
|
1613
|
+
var origin_1 = location.origin;
|
|
1614
|
+
var result = 4 /* ClickSource.Unknown */;
|
|
1615
|
+
for (var _i = 0, _a = stack.split("\n"); _i < _a.length; _i++) {
|
|
1616
|
+
var line = _a[_i];
|
|
1617
|
+
if (line.indexOf("://") >= 0) {
|
|
1618
|
+
result = line.indexOf("extension") < 0 && line.indexOf(origin_1) >= 0
|
|
1619
|
+
? 1 /* ClickSource.FirstParty */
|
|
1620
|
+
: 2 /* ClickSource.ThirdParty */;
|
|
1621
|
+
}
|
|
1622
|
+
else if (line.indexOf("eval") >= 0 || line.indexOf("Function") >= 0 || line.indexOf("<a") >= 0 || VM_PATTERN.test(line)) {
|
|
1623
|
+
result = 3 /* ClickSource.Eval */;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
return result;
|
|
1627
|
+
}
|
|
1628
|
+
catch (_b) {
|
|
1629
|
+
return 4 /* ClickSource.Unknown */;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1564
1632
|
function reset$n() {
|
|
1565
1633
|
state$9 = [];
|
|
1566
1634
|
}
|
|
@@ -2456,15 +2524,21 @@ function check$4(tag) {
|
|
|
2456
2524
|
}
|
|
2457
2525
|
function start$o() {
|
|
2458
2526
|
var _a;
|
|
2459
|
-
window
|
|
2460
|
-
|
|
2461
|
-
window.clarityOverrides
|
|
2462
|
-
window.customElements.define
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2527
|
+
// Wrap in try-catch to handle Safari iOS where window properties or customElements.define may be readonly
|
|
2528
|
+
try {
|
|
2529
|
+
window.clarityOverrides = window.clarityOverrides || {};
|
|
2530
|
+
if (((_a = window.customElements) === null || _a === void 0 ? void 0 : _a.define) && !window.clarityOverrides.define) {
|
|
2531
|
+
window.clarityOverrides.define = window.customElements.define;
|
|
2532
|
+
window.customElements.define = function () {
|
|
2533
|
+
if (active()) {
|
|
2534
|
+
register$1(arguments[0]);
|
|
2535
|
+
}
|
|
2536
|
+
return window.clarityOverrides.define.apply(this, arguments);
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
catch (e) {
|
|
2541
|
+
// customElements.define or window properties are readonly in this environment (e.g., Safari iOS WKWebView)
|
|
2468
2542
|
}
|
|
2469
2543
|
}
|
|
2470
2544
|
function reset$a() {
|
|
@@ -2601,7 +2675,7 @@ function encode$5 (type, timer, ts) {
|
|
|
2601
2675
|
case "attributes":
|
|
2602
2676
|
for (attr in data[key]) {
|
|
2603
2677
|
if (data[key][attr] !== undefined) {
|
|
2604
|
-
tokens.push(attribute$1(attr, data[key][attr], privacy));
|
|
2678
|
+
tokens.push(attribute$1(attr, data[key][attr], privacy, data.tag));
|
|
2605
2679
|
}
|
|
2606
2680
|
}
|
|
2607
2681
|
break;
|
|
@@ -2651,7 +2725,10 @@ function size(value) {
|
|
|
2651
2725
|
function str(input) {
|
|
2652
2726
|
return input.toString(36);
|
|
2653
2727
|
}
|
|
2654
|
-
function attribute$1(key, value, privacy) {
|
|
2728
|
+
function attribute$1(key, value, privacy, tag) {
|
|
2729
|
+
if (key === "href" /* Constant.Href */ && tag === "LINK" /* Constant.LinkTag */) {
|
|
2730
|
+
return "".concat(key, "=").concat(value);
|
|
2731
|
+
}
|
|
2655
2732
|
return "".concat(key, "=").concat(text$1(value, key.indexOf("data-" /* Constant.DataAttribute */) === 0 ? "data-" /* Constant.DataAttribute */ : key, privacy));
|
|
2656
2733
|
}
|
|
2657
2734
|
|
|
@@ -3080,7 +3157,7 @@ function proxyStyleRules(win) {
|
|
|
3080
3157
|
// by injecting CSS using insertRule API vs. appending text node. A side effect of
|
|
3081
3158
|
// using javascript API is that it doesn't trigger DOM mutation and therefore we
|
|
3082
3159
|
// need to override the insertRule API and listen for changes manually.
|
|
3083
|
-
if (win.clarityOverrides.InsertRule === undefined) {
|
|
3160
|
+
if ("CSSStyleSheet" in win && win.CSSStyleSheet && win.CSSStyleSheet.prototype && win.clarityOverrides.InsertRule === undefined) {
|
|
3084
3161
|
win.clarityOverrides.InsertRule = win.CSSStyleSheet.prototype.insertRule;
|
|
3085
3162
|
win.CSSStyleSheet.prototype.insertRule = function () {
|
|
3086
3163
|
if (active()) {
|
|
@@ -3089,7 +3166,7 @@ function proxyStyleRules(win) {
|
|
|
3089
3166
|
return win.clarityOverrides.InsertRule.apply(this, arguments);
|
|
3090
3167
|
};
|
|
3091
3168
|
}
|
|
3092
|
-
if ("CSSMediaRule" in win && win.clarityOverrides.MediaInsertRule === undefined) {
|
|
3169
|
+
if ("CSSMediaRule" in win && win.CSSMediaRule && win.CSSMediaRule.prototype && win.clarityOverrides.MediaInsertRule === undefined) {
|
|
3093
3170
|
win.clarityOverrides.MediaInsertRule = win.CSSMediaRule.prototype.insertRule;
|
|
3094
3171
|
win.CSSMediaRule.prototype.insertRule = function () {
|
|
3095
3172
|
if (active()) {
|
|
@@ -3098,7 +3175,7 @@ function proxyStyleRules(win) {
|
|
|
3098
3175
|
return win.clarityOverrides.MediaInsertRule.apply(this, arguments);
|
|
3099
3176
|
};
|
|
3100
3177
|
}
|
|
3101
|
-
if (win.clarityOverrides.DeleteRule === undefined) {
|
|
3178
|
+
if ("CSSStyleSheet" in win && win.CSSStyleSheet && win.CSSStyleSheet.prototype && win.clarityOverrides.DeleteRule === undefined) {
|
|
3102
3179
|
win.clarityOverrides.DeleteRule = win.CSSStyleSheet.prototype.deleteRule;
|
|
3103
3180
|
win.CSSStyleSheet.prototype.deleteRule = function () {
|
|
3104
3181
|
if (active()) {
|
|
@@ -3107,7 +3184,7 @@ function proxyStyleRules(win) {
|
|
|
3107
3184
|
return win.clarityOverrides.DeleteRule.apply(this, arguments);
|
|
3108
3185
|
};
|
|
3109
3186
|
}
|
|
3110
|
-
if ("CSSMediaRule" in win && win.clarityOverrides.MediaDeleteRule === undefined) {
|
|
3187
|
+
if ("CSSMediaRule" in win && win.CSSMediaRule && win.CSSMediaRule.prototype && win.clarityOverrides.MediaDeleteRule === undefined) {
|
|
3111
3188
|
win.clarityOverrides.MediaDeleteRule = win.CSSMediaRule.prototype.deleteRule;
|
|
3112
3189
|
win.CSSMediaRule.prototype.deleteRule = function () {
|
|
3113
3190
|
if (active()) {
|
|
@@ -3119,7 +3196,7 @@ function proxyStyleRules(win) {
|
|
|
3119
3196
|
// Add a hook to attachShadow API calls
|
|
3120
3197
|
// In case we are unable to add a hook and browser throws an exception,
|
|
3121
3198
|
// reset attachShadow variable and resume processing like before
|
|
3122
|
-
if (win.clarityOverrides.AttachShadow === undefined) {
|
|
3199
|
+
if ("Element" in win && win.Element && win.Element.prototype && win.clarityOverrides.AttachShadow === undefined) {
|
|
3123
3200
|
win.clarityOverrides.AttachShadow = win.Element.prototype.attachShadow;
|
|
3124
3201
|
try {
|
|
3125
3202
|
win.Element.prototype.attachShadow = function () {
|
|
@@ -3533,7 +3610,7 @@ function getAttributes$1(element) {
|
|
|
3533
3610
|
return output;
|
|
3534
3611
|
}
|
|
3535
3612
|
|
|
3536
|
-
var excludeClassNames =
|
|
3613
|
+
var excludeClassNames = ExcludeClassNamesList;
|
|
3537
3614
|
var extraExcludeClassNames = [];
|
|
3538
3615
|
var selectorMap = {};
|
|
3539
3616
|
function reset$8() {
|
|
@@ -3674,10 +3751,10 @@ function reset$7() {
|
|
|
3674
3751
|
hashMap = {};
|
|
3675
3752
|
override = [];
|
|
3676
3753
|
unmask = [];
|
|
3677
|
-
maskText =
|
|
3678
|
-
maskExclude =
|
|
3679
|
-
maskDisable =
|
|
3680
|
-
maskTags =
|
|
3754
|
+
maskText = MaskTextList;
|
|
3755
|
+
maskExclude = MaskExcludeList;
|
|
3756
|
+
maskDisable = MaskDisableList;
|
|
3757
|
+
maskTags = MaskTagsList;
|
|
3681
3758
|
nodesMap = new Map();
|
|
3682
3759
|
idMap$1 = new WeakMap();
|
|
3683
3760
|
iframeMap = new WeakMap();
|
|
@@ -4291,6 +4368,7 @@ function encode$4 (type, ts) {
|
|
|
4291
4368
|
tokens.push(entry.data.tag);
|
|
4292
4369
|
tokens.push(entry.data.class);
|
|
4293
4370
|
tokens.push(entry.data.id);
|
|
4371
|
+
tokens.push(entry.data.source);
|
|
4294
4372
|
queue(tokens);
|
|
4295
4373
|
track$2(entry.time, entry.event, cHash, entry.data.x, entry.data.y, entry.data.reaction, entry.data.context);
|
|
4296
4374
|
}
|
|
@@ -4526,7 +4604,7 @@ function encode$3 (type) {
|
|
|
4526
4604
|
case "attributes":
|
|
4527
4605
|
for (attr in data[key]) {
|
|
4528
4606
|
if (data[key][attr] !== undefined) {
|
|
4529
|
-
tokens.push(attribute(attr, data[key][attr], privacy));
|
|
4607
|
+
tokens.push(attribute(attr, data[key][attr], privacy, data.tag));
|
|
4530
4608
|
}
|
|
4531
4609
|
}
|
|
4532
4610
|
break;
|
|
@@ -4545,7 +4623,10 @@ function encode$3 (type) {
|
|
|
4545
4623
|
});
|
|
4546
4624
|
});
|
|
4547
4625
|
}
|
|
4548
|
-
function attribute(key, value, privacy) {
|
|
4626
|
+
function attribute(key, value, privacy, tag) {
|
|
4627
|
+
if (key === "href" /* Constant.Href */ && tag === "LINK" /* Constant.LinkTag */) {
|
|
4628
|
+
return "".concat(key, "=").concat(value);
|
|
4629
|
+
}
|
|
4549
4630
|
return "".concat(key, "=").concat(text$1(value, key.indexOf("data-" /* Constant.DataAttribute */) === 0 ? "data-" /* Constant.DataAttribute */ : key, privacy));
|
|
4550
4631
|
}
|
|
4551
4632
|
|
|
@@ -5615,10 +5696,16 @@ function processConsent() {
|
|
|
5615
5696
|
if (!(ics === null || ics === void 0 ? void 0 : ics.getConsentState)) {
|
|
5616
5697
|
return;
|
|
5617
5698
|
}
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5699
|
+
try {
|
|
5700
|
+
var analytics_storage = ics.getConsentState("analytics_storage" /* Constant.AnalyticsStorage */);
|
|
5701
|
+
var ad_storage = ics.getConsentState("ad_storage" /* Constant.AdStorage */);
|
|
5702
|
+
var consentState = getGcmConsentState({ ad_Storage: ad_storage, analytics_Storage: analytics_storage });
|
|
5703
|
+
consentv2(consentState);
|
|
5704
|
+
}
|
|
5705
|
+
catch (_b) {
|
|
5706
|
+
// Handle GTM errors gracefully (e.g., misconfigured consent initialization)
|
|
5707
|
+
return;
|
|
5708
|
+
}
|
|
5622
5709
|
}
|
|
5623
5710
|
function getGcmConsentState(googleConsent) {
|
|
5624
5711
|
var consentState = {
|
|
@@ -5662,6 +5749,7 @@ var data$2 = null;
|
|
|
5662
5749
|
var callbacks = [];
|
|
5663
5750
|
var electron = 0 /* BooleanFlag.False */;
|
|
5664
5751
|
var consentStatus = null;
|
|
5752
|
+
var cookiesLogged = false;
|
|
5665
5753
|
var defaultStatus = { source: 7 /* ConsentSource.Default */, ad_Storage: "denied" /* Constant.Denied */, analytics_Storage: "denied" /* Constant.Denied */ };
|
|
5666
5754
|
function start$8() {
|
|
5667
5755
|
var _a, _b, _c;
|
|
@@ -5717,14 +5805,6 @@ function start$8() {
|
|
|
5717
5805
|
max(15 /* Metric.ScreenHeight */, Math.round(screen.height));
|
|
5718
5806
|
max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
|
|
5719
5807
|
}
|
|
5720
|
-
// Read cookies specified in configuration
|
|
5721
|
-
for (var _i = 0, _d = config$3.cookies; _i < _d.length; _i++) {
|
|
5722
|
-
var key = _d[_i];
|
|
5723
|
-
var value = getCookie(key);
|
|
5724
|
-
if (value) {
|
|
5725
|
-
set(key, value);
|
|
5726
|
-
}
|
|
5727
|
-
}
|
|
5728
5808
|
// Track consent config
|
|
5729
5809
|
// If consent status is not already set, initialize it based on project configuration. Otherwise, use the existing consent status.
|
|
5730
5810
|
if (consentStatus === null) {
|
|
@@ -5734,6 +5814,7 @@ function start$8() {
|
|
|
5734
5814
|
analytics_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
|
|
5735
5815
|
};
|
|
5736
5816
|
}
|
|
5817
|
+
logCookies();
|
|
5737
5818
|
var consent = getConsentData(consentStatus);
|
|
5738
5819
|
config$1(consent);
|
|
5739
5820
|
// Track ids using a cookie if configuration allows it, skip if using external session
|
|
@@ -5757,8 +5838,25 @@ function userAgentData() {
|
|
|
5757
5838
|
log(22 /* Dimension.Platform */, navigator.platform);
|
|
5758
5839
|
}
|
|
5759
5840
|
}
|
|
5841
|
+
function logCookies() {
|
|
5842
|
+
// Only log cookies if both analytics_Storage and ad_Storage are granted, and we haven't already logged them
|
|
5843
|
+
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 */) {
|
|
5844
|
+
return;
|
|
5845
|
+
}
|
|
5846
|
+
for (var _i = 0, _a = config$3.cookies; _i < _a.length; _i++) {
|
|
5847
|
+
var key = _a[_i];
|
|
5848
|
+
var value = getCookie(key);
|
|
5849
|
+
if (value) {
|
|
5850
|
+
set(key, value);
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5853
|
+
cookiesLogged = true;
|
|
5854
|
+
}
|
|
5760
5855
|
function stop$8() {
|
|
5761
5856
|
data$2 = null;
|
|
5857
|
+
// Reset cookiesLogged so cookies are re-logged on restart. Each session generates new metadata
|
|
5858
|
+
// (sessionId, pageNum), and cookie values need to be recorded in the new session's data stream.
|
|
5859
|
+
cookiesLogged = false;
|
|
5762
5860
|
callbacks.forEach(function (cb) { cb.called = false; });
|
|
5763
5861
|
}
|
|
5764
5862
|
function metadata(cb, wait, recall, consentInfo) {
|
|
@@ -5790,12 +5888,15 @@ function consent(status) {
|
|
|
5790
5888
|
return;
|
|
5791
5889
|
}
|
|
5792
5890
|
consentv2({ source: 4 /* ConsentSource.APIv1 */, ad_Storage: "granted" /* Constant.Granted */, analytics_Storage: "granted" /* Constant.Granted */ });
|
|
5793
|
-
consent$1();
|
|
5794
5891
|
}
|
|
5795
5892
|
function consentv2(consentState, source) {
|
|
5796
5893
|
var _a;
|
|
5797
5894
|
if (consentState === void 0) { consentState = defaultStatus; }
|
|
5798
5895
|
if (source === void 0) { source = 5 /* ConsentSource.APIv2 */; }
|
|
5896
|
+
// Guard against calling consent API when Clarity hasn't started (e.g., due to GPC)
|
|
5897
|
+
if (!active()) {
|
|
5898
|
+
return;
|
|
5899
|
+
}
|
|
5799
5900
|
var updatedStatus = {
|
|
5800
5901
|
source: (_a = consentState.source) !== null && _a !== void 0 ? _a : source,
|
|
5801
5902
|
ad_Storage: normalizeConsent(consentState.ad_Storage, consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.ad_Storage),
|
|
@@ -5824,6 +5925,7 @@ function consentv2(consentState, source) {
|
|
|
5824
5925
|
track(user(), 1 /* BooleanFlag.True */);
|
|
5825
5926
|
save();
|
|
5826
5927
|
}
|
|
5928
|
+
logCookies();
|
|
5827
5929
|
trackConsentv2(consentData);
|
|
5828
5930
|
consent$1();
|
|
5829
5931
|
}
|
|
@@ -6109,24 +6211,38 @@ function start$6() {
|
|
|
6109
6211
|
count = 0;
|
|
6110
6212
|
bind(window, "popstate", compute$1);
|
|
6111
6213
|
// Add a proxy to history.pushState function
|
|
6214
|
+
// Wrap in try-catch to handle Safari iOS where history methods may be readonly
|
|
6112
6215
|
if (pushState === null) {
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
pushState
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6216
|
+
try {
|
|
6217
|
+
pushState = history.pushState;
|
|
6218
|
+
history.pushState = function () {
|
|
6219
|
+
pushState.apply(this, arguments);
|
|
6220
|
+
if (active() && check$1()) {
|
|
6221
|
+
compute$1();
|
|
6222
|
+
}
|
|
6223
|
+
};
|
|
6224
|
+
}
|
|
6225
|
+
catch (e) {
|
|
6226
|
+
// history.pushState is readonly in this environment (e.g., Safari iOS WKWebView)
|
|
6227
|
+
pushState = null;
|
|
6228
|
+
}
|
|
6120
6229
|
}
|
|
6121
6230
|
// Add a proxy to history.replaceState function
|
|
6231
|
+
// Wrap in try-catch to handle Safari iOS where history methods may be readonly
|
|
6122
6232
|
if (replaceState === null) {
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
replaceState
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6233
|
+
try {
|
|
6234
|
+
replaceState = history.replaceState;
|
|
6235
|
+
history.replaceState = function () {
|
|
6236
|
+
replaceState.apply(this, arguments);
|
|
6237
|
+
if (active() && check$1()) {
|
|
6238
|
+
compute$1();
|
|
6239
|
+
}
|
|
6240
|
+
};
|
|
6241
|
+
}
|
|
6242
|
+
catch (e) {
|
|
6243
|
+
// history.replaceState is readonly in this environment (e.g., Safari iOS WKWebView)
|
|
6244
|
+
replaceState = null;
|
|
6245
|
+
}
|
|
6130
6246
|
}
|
|
6131
6247
|
}
|
|
6132
6248
|
function check$1() {
|
|
@@ -6248,7 +6364,7 @@ function start$3() {
|
|
|
6248
6364
|
start$k();
|
|
6249
6365
|
start$l();
|
|
6250
6366
|
if (config$3.delayDom) {
|
|
6251
|
-
// Lazy load layout module as part of page load time performance improvements experiment
|
|
6367
|
+
// Lazy load layout module as part of page load time performance improvements experiment
|
|
6252
6368
|
bind(window, 'load', function () {
|
|
6253
6369
|
start$m();
|
|
6254
6370
|
});
|
|
@@ -6256,10 +6372,12 @@ function start$3() {
|
|
|
6256
6372
|
else {
|
|
6257
6373
|
start$m();
|
|
6258
6374
|
}
|
|
6375
|
+
// IMPORTANT: Start custom element detection BEFORE discover
|
|
6376
|
+
// This ensures pre-existing custom elements are registered before DOM traversal
|
|
6377
|
+
start$o();
|
|
6259
6378
|
start$d();
|
|
6260
6379
|
start$q();
|
|
6261
6380
|
start$p();
|
|
6262
|
-
start$o();
|
|
6263
6381
|
}
|
|
6264
6382
|
function stop$3() {
|
|
6265
6383
|
stop$i();
|