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