@tracelog/lib 2.8.2-rc.102.4 → 2.8.2-rc.102.6
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/dist/browser/tracelog.esm.js +142 -136
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +1 -1
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +1 -1
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.js +1 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const ur = 9e5;
|
|
2
|
+
const dr = 120, hr = 49152, fr = 100, mr = 500, gr = 200;
|
|
3
3
|
const Er = 1e3, pr = 500, Sr = 1e3;
|
|
4
4
|
const b = "data-tlog", bt = [
|
|
5
5
|
"button",
|
|
@@ -97,8 +97,8 @@ class ne extends Error {
|
|
|
97
97
|
super(e), this.name = "TimeoutError", Error.captureStackTrace && Error.captureStackTrace(this, ne);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
var
|
|
101
|
-
const Tr = (r) => r.type ===
|
|
100
|
+
var d = /* @__PURE__ */ ((r) => (r.PAGE_VIEW = "page_view", r.CLICK = "click", r.SCROLL = "scroll", r.SESSION_START = "session_start", r.CUSTOM = "custom", r.WEB_VITALS = "web_vitals", r.ERROR = "error", r.VIEWPORT_VISIBLE = "viewport_visible", r))(d || {}), Z = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(Z || {}), B = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(B || {}), ie = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(ie || {});
|
|
101
|
+
const Tr = (r) => r.type === d.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !0, Ir = (r) => r.type === d.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !1;
|
|
102
102
|
class j extends Error {
|
|
103
103
|
constructor(e, t, s) {
|
|
104
104
|
super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
@@ -160,11 +160,11 @@ const nt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
160
160
|
return !1;
|
|
161
161
|
}
|
|
162
162
|
}, a = (r, e, t) => {
|
|
163
|
-
const { error: s, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = s ? Dt(e, s) : `[TraceLog] ${e}`,
|
|
163
|
+
const { error: s, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = s ? Dt(e, s) : `[TraceLog] ${e}`, u = r === "error" ? "error" : r === "warn" ? "warn" : "log";
|
|
164
164
|
if (!Vt(l, i))
|
|
165
165
|
return;
|
|
166
166
|
const g = Ut(l, o), T = n !== void 0 ? Ie(n) : void 0;
|
|
167
|
-
Ht(
|
|
167
|
+
Ht(u, c, g, T);
|
|
168
168
|
}, Vt = (r, e) => r === "critical" ? !0 : r === "qa" || e ? kt() : !1, Ut = (r, e) => e !== void 0 && e !== "" ? e : r === "critical" ? Pt : "", Ht = (r, e, t, s) => {
|
|
169
169
|
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
170
170
|
s !== void 0 ? n ? console[r](i, t, s) : console[r](i, s) : n ? console[r](i, t) : console[r](i);
|
|
@@ -372,7 +372,7 @@ const Ft = () => {
|
|
|
372
372
|
e[i] = n;
|
|
373
373
|
}
|
|
374
374
|
}), Object.keys(e).length ? e : void 0;
|
|
375
|
-
},
|
|
375
|
+
}, ut = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
|
|
376
376
|
const e = Math.random() * 16 | 0;
|
|
377
377
|
return (r === "x" ? e : e & 3 | 8).toString(16);
|
|
378
378
|
});
|
|
@@ -390,7 +390,7 @@ const ns = () => {
|
|
|
390
390
|
} catch {
|
|
391
391
|
}
|
|
392
392
|
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${r}-${e}-${t}`;
|
|
393
|
-
},
|
|
393
|
+
}, dt = (r, e = !1) => {
|
|
394
394
|
try {
|
|
395
395
|
const t = new URL(r), s = t.protocol === "https:", n = t.protocol === "http:";
|
|
396
396
|
return s || e && n;
|
|
@@ -415,7 +415,7 @@ const ns = () => {
|
|
|
415
415
|
if (s.length === 2 ? n = s.join(".") : n = s.slice(-2).join("."), !n || n.split(".").length < 2)
|
|
416
416
|
throw new Error("Invalid domain structure for SaaS");
|
|
417
417
|
const i = `https://${r}.${n}/collect`;
|
|
418
|
-
if (!
|
|
418
|
+
if (!dt(i))
|
|
419
419
|
throw new Error("Generated URL failed validation");
|
|
420
420
|
return i;
|
|
421
421
|
} catch (e) {
|
|
@@ -427,7 +427,7 @@ const ns = () => {
|
|
|
427
427
|
const t = r.integrations?.custom?.collectApiUrl;
|
|
428
428
|
if (t) {
|
|
429
429
|
const s = r.integrations?.custom?.allowHttp ?? !1;
|
|
430
|
-
if (!
|
|
430
|
+
if (!dt(t, s))
|
|
431
431
|
throw new Error("Invalid custom API URL");
|
|
432
432
|
e.custom = t;
|
|
433
433
|
}
|
|
@@ -504,7 +504,7 @@ const ns = () => {
|
|
|
504
504
|
throw new Ot(E.INVALID_SESSION_TIMEOUT, "config");
|
|
505
505
|
if (r.globalMetadata !== void 0 && (typeof r.globalMetadata != "object" || r.globalMetadata === null))
|
|
506
506
|
throw new m(E.INVALID_GLOBAL_METADATA, "config");
|
|
507
|
-
if (r.integrations &&
|
|
507
|
+
if (r.integrations && us(r.integrations), r.sensitiveQueryParams !== void 0) {
|
|
508
508
|
if (!Array.isArray(r.sensitiveQueryParams))
|
|
509
509
|
throw new m(E.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
510
510
|
for (const e of r.sensitiveQueryParams)
|
|
@@ -597,7 +597,7 @@ const ns = () => {
|
|
|
597
597
|
throw new m(E.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
598
598
|
if (r.maxTrackedElements !== void 0 && (typeof r.maxTrackedElements != "number" || r.maxTrackedElements <= 0))
|
|
599
599
|
throw new m(E.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
600
|
-
},
|
|
600
|
+
}, us = (r) => {
|
|
601
601
|
if (r) {
|
|
602
602
|
if (r.tracelog && (!r.tracelog.projectId || typeof r.tracelog.projectId != "string" || r.tracelog.projectId.trim() === ""))
|
|
603
603
|
throw new N(E.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
@@ -620,7 +620,7 @@ const ns = () => {
|
|
|
620
620
|
if (r.tracelog?.shopify !== void 0 && typeof r.tracelog.shopify != "boolean")
|
|
621
621
|
throw new N("tracelog.shopify must be a boolean", "config");
|
|
622
622
|
}
|
|
623
|
-
},
|
|
623
|
+
}, ds = (r) => {
|
|
624
624
|
ls(r);
|
|
625
625
|
const e = {
|
|
626
626
|
...r ?? {},
|
|
@@ -696,21 +696,21 @@ const ns = () => {
|
|
|
696
696
|
valid: !1,
|
|
697
697
|
error: `${n}: object has too many keys (max 100 keys).`
|
|
698
698
|
};
|
|
699
|
-
for (const [c,
|
|
700
|
-
if (Array.isArray(
|
|
701
|
-
if (
|
|
699
|
+
for (const [c, u] of Object.entries(s)) {
|
|
700
|
+
if (Array.isArray(u)) {
|
|
701
|
+
if (u.length > 500)
|
|
702
702
|
return {
|
|
703
703
|
valid: !1,
|
|
704
704
|
error: `${n}: array property "${c}" is too large (max 500 items).`
|
|
705
705
|
};
|
|
706
|
-
for (const f of
|
|
706
|
+
for (const f of u)
|
|
707
707
|
if (typeof f == "string" && f.length > 500)
|
|
708
708
|
return {
|
|
709
709
|
valid: !1,
|
|
710
710
|
error: `${n}: array property "${c}" contains strings that are too long (max 500 characters).`
|
|
711
711
|
};
|
|
712
712
|
}
|
|
713
|
-
if (typeof
|
|
713
|
+
if (typeof u == "string" && u.length > 1e3)
|
|
714
714
|
return {
|
|
715
715
|
valid: !1,
|
|
716
716
|
error: `${n}: property "${c}" is too long (max 1000 characters).`
|
|
@@ -1411,50 +1411,50 @@ class Ze extends _ {
|
|
|
1411
1411
|
data: { events: n.events.length }
|
|
1412
1412
|
}), !0;
|
|
1413
1413
|
if (this.consecutiveNetworkFailures >= 3) {
|
|
1414
|
-
const
|
|
1415
|
-
if (
|
|
1414
|
+
const u = Date.now() - this.circuitOpenedAt;
|
|
1415
|
+
if (u < 12e4)
|
|
1416
1416
|
return a("debug", `Network circuit open, skipping send${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1417
1417
|
data: {
|
|
1418
1418
|
consecutiveNetworkFailures: this.consecutiveNetworkFailures,
|
|
1419
|
-
cooldownRemainingMs: 12e4 -
|
|
1419
|
+
cooldownRemainingMs: 12e4 - u
|
|
1420
1420
|
}
|
|
1421
1421
|
}), !1;
|
|
1422
1422
|
}
|
|
1423
1423
|
const { url: i, payload: o } = this.prepareRequest(n);
|
|
1424
1424
|
let l = !0, c = !1;
|
|
1425
|
-
for (let
|
|
1425
|
+
for (let u = 1; u <= 3; u++)
|
|
1426
1426
|
try {
|
|
1427
|
-
return (await this.sendWithTimeout(i, o)).ok ? (
|
|
1427
|
+
return (await this.sendWithTimeout(i, o)).ok ? (u > 1 && a(
|
|
1428
1428
|
"info",
|
|
1429
|
-
`Send succeeded after ${
|
|
1429
|
+
`Send succeeded after ${u - 1} retry attempt(s)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
|
|
1430
1430
|
{
|
|
1431
|
-
data: { events: n.events.length, attempt:
|
|
1431
|
+
data: { events: n.events.length, attempt: u }
|
|
1432
1432
|
}
|
|
1433
1433
|
), this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, !0) : !1;
|
|
1434
1434
|
} catch (f) {
|
|
1435
|
-
const g =
|
|
1435
|
+
const g = u === 3;
|
|
1436
1436
|
if (f instanceof O)
|
|
1437
1437
|
throw this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, f;
|
|
1438
1438
|
if (f instanceof re) {
|
|
1439
1439
|
this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, l = !1, c = !0, a("warn", `Rate limited, skipping retries${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1440
|
-
data: { events: e.events.length, attempt:
|
|
1440
|
+
data: { events: e.events.length, attempt: u }
|
|
1441
1441
|
});
|
|
1442
1442
|
break;
|
|
1443
1443
|
}
|
|
1444
1444
|
if (f instanceof ne || (l = !1), f instanceof TypeError || (c = !0), a(
|
|
1445
1445
|
g ? "error" : "warn",
|
|
1446
|
-
`Send attempt ${
|
|
1446
|
+
`Send attempt ${u} failed${this.integrationId ? ` [${this.integrationId}]` : ""}${g ? " (all retries exhausted)" : ", will retry"}`,
|
|
1447
1447
|
{
|
|
1448
1448
|
error: f,
|
|
1449
1449
|
data: {
|
|
1450
1450
|
events: e.events.length,
|
|
1451
1451
|
url: i.replace(/\/\/[^/]+/, "//[DOMAIN]"),
|
|
1452
|
-
attempt:
|
|
1452
|
+
attempt: u,
|
|
1453
1453
|
maxAttempts: 3
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
1456
|
), !g) {
|
|
1457
|
-
await this.backoffDelay(
|
|
1457
|
+
await this.backoffDelay(u);
|
|
1458
1458
|
continue;
|
|
1459
1459
|
}
|
|
1460
1460
|
return l ? (a(
|
|
@@ -1567,11 +1567,11 @@ class Ze extends _ {
|
|
|
1567
1567
|
"warn",
|
|
1568
1568
|
`sendBeacon not available, persisting events for recovery${this.integrationId ? ` [${this.integrationId}]` : ""}`
|
|
1569
1569
|
), this.persistEvents(t), !1;
|
|
1570
|
-
const
|
|
1571
|
-
return
|
|
1570
|
+
const u = navigator.sendBeacon(o, c);
|
|
1571
|
+
return u || (a(
|
|
1572
1572
|
"warn",
|
|
1573
1573
|
`sendBeacon rejected request, persisting events for recovery${this.integrationId ? ` [${this.integrationId}]` : ""}`
|
|
1574
|
-
), this.persistEvents(t)),
|
|
1574
|
+
), this.persistEvents(t)), u;
|
|
1575
1575
|
}
|
|
1576
1576
|
/**
|
|
1577
1577
|
* Prepares request by enriching payload with metadata and serializing to JSON.
|
|
@@ -1621,23 +1621,29 @@ class Ze extends _ {
|
|
|
1621
1621
|
};
|
|
1622
1622
|
}
|
|
1623
1623
|
/**
|
|
1624
|
-
* Deterministic 32-bit FNV-1a hash of sorted event IDs
|
|
1624
|
+
* Deterministic 32-bit FNV-1a hash of sorted event IDs, salted with
|
|
1625
|
+
* `user_id` and `session_id`.
|
|
1625
1626
|
*
|
|
1626
1627
|
* **Purpose**: Produces the same idempotency token for the same set of events
|
|
1627
1628
|
* across retries, so the backend's success cache catches in-session retries
|
|
1628
1629
|
* before any MongoDB work. Replaces a random token that caused the API to
|
|
1629
1630
|
* treat retried batches as new and emit `high_duplicate_rate` warnings.
|
|
1630
1631
|
*
|
|
1632
|
+
* **Salting**: Scoping the hash by `user_id` + `session_id` ensures that
|
|
1633
|
+
* batches from different users/sessions cannot share a token even if their
|
|
1634
|
+
* event IDs hypothetically collided, eliminating cross-scope dedup risk
|
|
1635
|
+
* regardless of how the backend keys its success cache.
|
|
1636
|
+
*
|
|
1631
1637
|
* @param body - Event queue whose events determine the token
|
|
1632
1638
|
* @returns 8-char hex string
|
|
1633
1639
|
* @private
|
|
1634
1640
|
*/
|
|
1635
1641
|
computeContentToken(e) {
|
|
1636
|
-
const t = e.events.map((
|
|
1637
|
-
let
|
|
1638
|
-
for (let
|
|
1639
|
-
|
|
1640
|
-
return
|
|
1642
|
+
const t = e.events.map((i) => i.id).sort().join(","), s = `${e.user_id}|${e.session_id}|${t}`;
|
|
1643
|
+
let n = 2166136261;
|
|
1644
|
+
for (let i = 0; i < s.length; i++)
|
|
1645
|
+
n ^= s.charCodeAt(i), n = Math.imul(n, 16777619) >>> 0;
|
|
1646
|
+
return n.toString(16).padStart(8, "0");
|
|
1641
1647
|
}
|
|
1642
1648
|
/**
|
|
1643
1649
|
* Retrieves persisted events from localStorage with error recovery.
|
|
@@ -1924,7 +1930,7 @@ class ps extends _ {
|
|
|
1924
1930
|
};
|
|
1925
1931
|
}
|
|
1926
1932
|
}
|
|
1927
|
-
const Ss = new Set(Object.values(
|
|
1933
|
+
const Ss = new Set(Object.values(d));
|
|
1928
1934
|
class Ts extends _ {
|
|
1929
1935
|
dataSenders;
|
|
1930
1936
|
emitter;
|
|
@@ -1942,11 +1948,11 @@ class Ts extends _ {
|
|
|
1942
1948
|
lastSessionId = null;
|
|
1943
1949
|
sessionEventCounts = {
|
|
1944
1950
|
total: 0,
|
|
1945
|
-
[
|
|
1946
|
-
[
|
|
1947
|
-
[
|
|
1948
|
-
[
|
|
1949
|
-
[
|
|
1951
|
+
[d.CLICK]: 0,
|
|
1952
|
+
[d.PAGE_VIEW]: 0,
|
|
1953
|
+
[d.CUSTOM]: 0,
|
|
1954
|
+
[d.VIEWPORT_VISIBLE]: 0,
|
|
1955
|
+
[d.SCROLL]: 0
|
|
1950
1956
|
};
|
|
1951
1957
|
saveSessionCountsDebounced = null;
|
|
1952
1958
|
/**
|
|
@@ -2088,7 +2094,7 @@ class Ts extends _ {
|
|
|
2088
2094
|
custom_event: o,
|
|
2089
2095
|
web_vitals: l,
|
|
2090
2096
|
error_data: c,
|
|
2091
|
-
viewport_data:
|
|
2097
|
+
viewport_data: u,
|
|
2092
2098
|
page_view: f
|
|
2093
2099
|
}) {
|
|
2094
2100
|
if (!e) {
|
|
@@ -2114,13 +2120,13 @@ class Ts extends _ {
|
|
|
2114
2120
|
custom_event: o,
|
|
2115
2121
|
web_vitals: l,
|
|
2116
2122
|
error_data: c,
|
|
2117
|
-
viewport_data:
|
|
2123
|
+
viewport_data: u,
|
|
2118
2124
|
page_view: f
|
|
2119
2125
|
});
|
|
2120
2126
|
return;
|
|
2121
2127
|
}
|
|
2122
2128
|
this.lastSessionId !== g && (this.lastSessionId = g, this.sessionEventCounts = this.loadSessionCounts(g));
|
|
2123
|
-
const T = e ===
|
|
2129
|
+
const T = e === d.SESSION_START;
|
|
2124
2130
|
if (T && a("debug", "Processing SESSION_START event", {
|
|
2125
2131
|
data: { sessionId: g }
|
|
2126
2132
|
}), !T && !this.checkRateLimit())
|
|
@@ -2152,12 +2158,12 @@ class Ts extends _ {
|
|
|
2152
2158
|
}
|
|
2153
2159
|
}
|
|
2154
2160
|
}
|
|
2155
|
-
if (p ===
|
|
2161
|
+
if (p === d.CUSTOM && o?.name) {
|
|
2156
2162
|
const v = this.get("config")?.maxSameEventPerMinute ?? 60;
|
|
2157
2163
|
if (!this.checkPerEventRateLimit(o.name, v))
|
|
2158
2164
|
return;
|
|
2159
2165
|
}
|
|
2160
|
-
const Ve = p ===
|
|
2166
|
+
const Ve = p === d.SESSION_START, K = t || this.get("pageUrl"), x = this.buildEventPayload({
|
|
2161
2167
|
type: p,
|
|
2162
2168
|
page_url: K,
|
|
2163
2169
|
from_page_url: s,
|
|
@@ -2166,7 +2172,7 @@ class Ts extends _ {
|
|
|
2166
2172
|
custom_event: o,
|
|
2167
2173
|
web_vitals: l,
|
|
2168
2174
|
error_data: c,
|
|
2169
|
-
viewport_data:
|
|
2175
|
+
viewport_data: u,
|
|
2170
2176
|
page_view: f
|
|
2171
2177
|
});
|
|
2172
2178
|
if (x && !(!T && !this.shouldSample())) {
|
|
@@ -2186,7 +2192,7 @@ class Ts extends _ {
|
|
|
2186
2192
|
}
|
|
2187
2193
|
if (!this.isDuplicateEvent(x)) {
|
|
2188
2194
|
if (this.get("mode") === ie.QA) {
|
|
2189
|
-
if (p ===
|
|
2195
|
+
if (p === d.CUSTOM && o) {
|
|
2190
2196
|
a("info", `Custom Event: ${o.name}`, {
|
|
2191
2197
|
visibility: "qa",
|
|
2192
2198
|
data: {
|
|
@@ -2196,16 +2202,16 @@ class Ts extends _ {
|
|
|
2196
2202
|
}), this.emitEvent(x);
|
|
2197
2203
|
return;
|
|
2198
2204
|
}
|
|
2199
|
-
if (p ===
|
|
2200
|
-
const v =
|
|
2205
|
+
if (p === d.VIEWPORT_VISIBLE && u) {
|
|
2206
|
+
const v = u.name || u.id || u.selector;
|
|
2201
2207
|
a("info", `Viewport Visible: ${v}`, {
|
|
2202
2208
|
visibility: "qa",
|
|
2203
2209
|
data: {
|
|
2204
|
-
selector:
|
|
2205
|
-
...
|
|
2206
|
-
...
|
|
2207
|
-
visibilityRatio:
|
|
2208
|
-
dwellTime:
|
|
2210
|
+
selector: u.selector,
|
|
2211
|
+
...u.name && { name: u.name },
|
|
2212
|
+
...u.id && { id: u.id },
|
|
2213
|
+
visibilityRatio: u.visibilityRatio,
|
|
2214
|
+
dwellTime: u.dwellTime
|
|
2209
2215
|
}
|
|
2210
2216
|
}), this.emitEvent(x);
|
|
2211
2217
|
return;
|
|
@@ -2258,11 +2264,11 @@ class Ts extends _ {
|
|
|
2258
2264
|
const e = this.get("sessionId");
|
|
2259
2265
|
e && this.saveSessionCounts(e), this.eventsQueue = [], this.pendingEventsBuffer = [], this.recentEventFingerprints.clear(), this.rateLimitCounter = 0, this.rateLimitWindowStart = 0, this.perEventRateLimits.clear(), this.sessionEventCounts = {
|
|
2260
2266
|
total: 0,
|
|
2261
|
-
[
|
|
2262
|
-
[
|
|
2263
|
-
[
|
|
2264
|
-
[
|
|
2265
|
-
[
|
|
2267
|
+
[d.CLICK]: 0,
|
|
2268
|
+
[d.PAGE_VIEW]: 0,
|
|
2269
|
+
[d.CUSTOM]: 0,
|
|
2270
|
+
[d.VIEWPORT_VISIBLE]: 0,
|
|
2271
|
+
[d.SCROLL]: 0
|
|
2266
2272
|
}, this.lastSessionId = null, this.set("hasStartSession", !1), this.dataSenders.forEach((t) => {
|
|
2267
2273
|
t.stop();
|
|
2268
2274
|
});
|
|
@@ -2546,10 +2552,10 @@ class Ts extends _ {
|
|
|
2546
2552
|
buildEventsPayload() {
|
|
2547
2553
|
const e = /* @__PURE__ */ new Map(), t = [];
|
|
2548
2554
|
for (const c of this.eventsQueue) {
|
|
2549
|
-
const
|
|
2550
|
-
e.has(
|
|
2555
|
+
const u = this.createEventSignature(c);
|
|
2556
|
+
e.has(u) || t.push(u), e.set(u, c);
|
|
2551
2557
|
}
|
|
2552
|
-
const s = t.map((c) => e.get(c)).filter((c) => !!c).sort((c,
|
|
2558
|
+
const s = t.map((c) => e.get(c)).filter((c) => !!c).sort((c, u) => c.type === d.SESSION_START && u.type !== d.SESSION_START ? -1 : u.type === d.SESSION_START && c.type !== d.SESSION_START ? 1 : c.timestamp - u.timestamp);
|
|
2553
2559
|
let n = {
|
|
2554
2560
|
user_id: this.get("userId"),
|
|
2555
2561
|
session_id: this.get("sessionId"),
|
|
@@ -2587,8 +2593,8 @@ class Ts extends _ {
|
|
|
2587
2593
|
...e.page_view && { page_view: e.page_view },
|
|
2588
2594
|
...o && { utm: o }
|
|
2589
2595
|
};
|
|
2590
|
-
const c = this.get("collectApiUrls"),
|
|
2591
|
-
if (p && (!g ||
|
|
2596
|
+
const c = this.get("collectApiUrls"), u = !!c?.custom, f = !!c?.saas, g = u || f, T = u && f, p = this.transformers.beforeSend;
|
|
2597
|
+
if (p && (!g || u && !T)) {
|
|
2592
2598
|
const K = mt(l, p, "EventManager");
|
|
2593
2599
|
if (K === null)
|
|
2594
2600
|
return null;
|
|
@@ -2630,13 +2636,13 @@ class Ts extends _ {
|
|
|
2630
2636
|
}
|
|
2631
2637
|
addToQueue(e) {
|
|
2632
2638
|
if (this.emitEvent(e), this.eventsQueue.push(e), this.eventsQueue.length > 100) {
|
|
2633
|
-
const t = this.eventsQueue.findIndex((n) => n.type !==
|
|
2639
|
+
const t = this.eventsQueue.findIndex((n) => n.type !== d.SESSION_START), s = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();
|
|
2634
2640
|
a("warn", "Event queue overflow, oldest non-critical event removed", {
|
|
2635
2641
|
data: {
|
|
2636
2642
|
maxLength: 100,
|
|
2637
2643
|
currentLength: this.eventsQueue.length,
|
|
2638
2644
|
removedEventType: s?.type,
|
|
2639
|
-
wasCritical: s?.type ===
|
|
2645
|
+
wasCritical: s?.type === d.SESSION_START
|
|
2640
2646
|
}
|
|
2641
2647
|
});
|
|
2642
2648
|
}
|
|
@@ -2675,11 +2681,11 @@ class Ts extends _ {
|
|
|
2675
2681
|
}
|
|
2676
2682
|
getTypeLimitForEvent(e) {
|
|
2677
2683
|
return {
|
|
2678
|
-
[
|
|
2679
|
-
[
|
|
2680
|
-
[
|
|
2681
|
-
[
|
|
2682
|
-
[
|
|
2684
|
+
[d.CLICK]: 500,
|
|
2685
|
+
[d.PAGE_VIEW]: 100,
|
|
2686
|
+
[d.CUSTOM]: 500,
|
|
2687
|
+
[d.VIEWPORT_VISIBLE]: 200,
|
|
2688
|
+
[d.SCROLL]: 120
|
|
2683
2689
|
}[e] ?? null;
|
|
2684
2690
|
}
|
|
2685
2691
|
removeProcessedEvents(e) {
|
|
@@ -2733,11 +2739,11 @@ class Ts extends _ {
|
|
|
2733
2739
|
getInitialCounts() {
|
|
2734
2740
|
return {
|
|
2735
2741
|
total: 0,
|
|
2736
|
-
[
|
|
2737
|
-
[
|
|
2738
|
-
[
|
|
2739
|
-
[
|
|
2740
|
-
[
|
|
2742
|
+
[d.CLICK]: 0,
|
|
2743
|
+
[d.PAGE_VIEW]: 0,
|
|
2744
|
+
[d.CUSTOM]: 0,
|
|
2745
|
+
[d.VIEWPORT_VISIBLE]: 0,
|
|
2746
|
+
[d.SCROLL]: 0
|
|
2741
2747
|
};
|
|
2742
2748
|
}
|
|
2743
2749
|
/**
|
|
@@ -2774,13 +2780,13 @@ class Ts extends _ {
|
|
|
2774
2780
|
const i = JSON.parse(n);
|
|
2775
2781
|
return i._timestamp && Date.now() - i._timestamp > xe ? (a("debug", "Session counts expired, clearing", {
|
|
2776
2782
|
data: { sessionId: e, age: Date.now() - i._timestamp }
|
|
2777
|
-
}), localStorage.removeItem(s), this.getInitialCounts()) : typeof i.total == "number" && typeof i[
|
|
2783
|
+
}), localStorage.removeItem(s), this.getInitialCounts()) : typeof i.total == "number" && typeof i[d.CLICK] == "number" && typeof i[d.PAGE_VIEW] == "number" && typeof i[d.CUSTOM] == "number" && typeof i[d.VIEWPORT_VISIBLE] == "number" && typeof i[d.SCROLL] == "number" ? {
|
|
2778
2784
|
total: i.total,
|
|
2779
|
-
[
|
|
2780
|
-
[
|
|
2781
|
-
[
|
|
2782
|
-
[
|
|
2783
|
-
[
|
|
2785
|
+
[d.CLICK]: i[d.CLICK],
|
|
2786
|
+
[d.PAGE_VIEW]: i[d.PAGE_VIEW],
|
|
2787
|
+
[d.CUSTOM]: i[d.CUSTOM],
|
|
2788
|
+
[d.VIEWPORT_VISIBLE]: i[d.VIEWPORT_VISIBLE],
|
|
2789
|
+
[d.SCROLL]: i[d.SCROLL]
|
|
2784
2790
|
} : (a("warn", "Invalid session counts structure in localStorage, resetting", {
|
|
2785
2791
|
data: { sessionId: e, parsed: i }
|
|
2786
2792
|
}), localStorage.removeItem(s), a("debug", "Session counts removed due to invalid/corrupted data", {
|
|
@@ -2913,7 +2919,7 @@ class Is {
|
|
|
2913
2919
|
const t = e.getItem(Te);
|
|
2914
2920
|
if (t)
|
|
2915
2921
|
return t;
|
|
2916
|
-
const s =
|
|
2922
|
+
const s = ut();
|
|
2917
2923
|
return e.setItem(Te, s), s;
|
|
2918
2924
|
}
|
|
2919
2925
|
}
|
|
@@ -3093,7 +3099,7 @@ class _s extends _ {
|
|
|
3093
3099
|
}) : (a("debug", "Emitting SESSION_START event", {
|
|
3094
3100
|
data: { sessionId: t }
|
|
3095
3101
|
}), this.eventManager.track({
|
|
3096
|
-
type:
|
|
3102
|
+
type: d.SESSION_START
|
|
3097
3103
|
})), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
|
|
3098
3104
|
} catch (i) {
|
|
3099
3105
|
throw this.isTracking = !1, this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.set("sessionId", null), i;
|
|
@@ -3132,7 +3138,7 @@ class _s extends _ {
|
|
|
3132
3138
|
a("debug", "Renewing session after timeout", {
|
|
3133
3139
|
data: { newSessionId: e }
|
|
3134
3140
|
}), this.set("sessionId", e), this.set("sessionReferrer", t), this.set("sessionUtm", s), this.persistSession(e, Date.now(), t, s), this.cleanupCrossTabSync(), this.initCrossTabSync(), this.shareSession(e), this.eventManager.track({
|
|
3135
|
-
type:
|
|
3141
|
+
type: d.SESSION_START
|
|
3136
3142
|
}), this.eventManager.flushPendingEvents(), this.setupSessionTimeout();
|
|
3137
3143
|
}
|
|
3138
3144
|
cleanupActivityListeners() {
|
|
@@ -3388,7 +3394,7 @@ class ws extends _ {
|
|
|
3388
3394
|
this.set("pageUrl", t);
|
|
3389
3395
|
const o = this.extractPageViewData();
|
|
3390
3396
|
this.eventManager.track({
|
|
3391
|
-
type:
|
|
3397
|
+
type: d.PAGE_VIEW,
|
|
3392
3398
|
page_url: this.get("pageUrl"),
|
|
3393
3399
|
from_page_url: i,
|
|
3394
3400
|
...o && { page_view: o }
|
|
@@ -3397,7 +3403,7 @@ class ws extends _ {
|
|
|
3397
3403
|
trackInitialPageView() {
|
|
3398
3404
|
const e = ye(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
|
|
3399
3405
|
this.lastPageViewTime = Date.now(), this.eventManager.track({
|
|
3400
|
-
type:
|
|
3406
|
+
type: d.PAGE_VIEW,
|
|
3401
3407
|
page_url: e,
|
|
3402
3408
|
...t && { page_view: t }
|
|
3403
3409
|
}), this.onTrack();
|
|
@@ -3452,7 +3458,7 @@ class bs extends _ {
|
|
|
3452
3458
|
if (f) {
|
|
3453
3459
|
const g = this.createCustomEventData(f);
|
|
3454
3460
|
this.eventManager.track({
|
|
3455
|
-
type:
|
|
3461
|
+
type: d.CUSTOM,
|
|
3456
3462
|
custom_event: {
|
|
3457
3463
|
name: g.name,
|
|
3458
3464
|
...g.value && { metadata: { value: g.value } }
|
|
@@ -3460,10 +3466,10 @@ class bs extends _ {
|
|
|
3460
3466
|
});
|
|
3461
3467
|
}
|
|
3462
3468
|
}
|
|
3463
|
-
const
|
|
3469
|
+
const u = this.generateClickData(n, l, c);
|
|
3464
3470
|
this.eventManager.track({
|
|
3465
|
-
type:
|
|
3466
|
-
click_data:
|
|
3471
|
+
type: d.CLICK,
|
|
3472
|
+
click_data: u
|
|
3467
3473
|
});
|
|
3468
3474
|
}, window.addEventListener("click", this.clickHandler, !0));
|
|
3469
3475
|
}
|
|
@@ -3592,7 +3598,7 @@ class bs extends _ {
|
|
|
3592
3598
|
};
|
|
3593
3599
|
}
|
|
3594
3600
|
generateClickData(e, t, s) {
|
|
3595
|
-
const { x: n, y: i, relativeX: o, relativeY: l } = s, c = this.getRelevantText(e, t),
|
|
3601
|
+
const { x: n, y: i, relativeX: o, relativeY: l } = s, c = this.getRelevantText(e, t), u = this.extractElementAttributes(t);
|
|
3596
3602
|
return {
|
|
3597
3603
|
x: n,
|
|
3598
3604
|
y: i,
|
|
@@ -3602,12 +3608,12 @@ class bs extends _ {
|
|
|
3602
3608
|
...t.id && { id: t.id },
|
|
3603
3609
|
...t.className && { class: t.className },
|
|
3604
3610
|
...c && { text: c },
|
|
3605
|
-
...
|
|
3606
|
-
...
|
|
3607
|
-
...
|
|
3608
|
-
...
|
|
3609
|
-
...
|
|
3610
|
-
...Object.keys(
|
|
3611
|
+
...u.href && { href: u.href },
|
|
3612
|
+
...u.title && { title: u.title },
|
|
3613
|
+
...u.alt && { alt: u.alt },
|
|
3614
|
+
...u.role && { role: u.role },
|
|
3615
|
+
...u["aria-label"] && { ariaLabel: u["aria-label"] },
|
|
3616
|
+
...Object.keys(u).length > 0 && { dataAttributes: u }
|
|
3611
3617
|
};
|
|
3612
3618
|
}
|
|
3613
3619
|
/**
|
|
@@ -3771,7 +3777,7 @@ class As extends _ {
|
|
|
3771
3777
|
return this.isWindowScrollable() ? e === window : this.containers.length === 0;
|
|
3772
3778
|
}
|
|
3773
3779
|
setupScrollContainer(e, t) {
|
|
3774
|
-
if (this.containers.some((
|
|
3780
|
+
if (this.containers.some((u) => u.element === e) || e !== window && !this.isElementScrollable(e))
|
|
3775
3781
|
return;
|
|
3776
3782
|
const n = this.getScrollTop(e), i = this.calculateScrollDepth(
|
|
3777
3783
|
n,
|
|
@@ -3791,10 +3797,10 @@ class As extends _ {
|
|
|
3791
3797
|
listener: null
|
|
3792
3798
|
}, c = () => {
|
|
3793
3799
|
this.get("suppressNextScroll") || (l.firstScrollEventTime === null && (l.firstScrollEventTime = Date.now()), this.clearContainerTimer(l), l.debounceTimer = window.setTimeout(() => {
|
|
3794
|
-
const
|
|
3795
|
-
if (
|
|
3800
|
+
const u = this.calculateScrollData(l);
|
|
3801
|
+
if (u) {
|
|
3796
3802
|
const f = Date.now();
|
|
3797
|
-
this.processScrollEvent(l,
|
|
3803
|
+
this.processScrollEvent(l, u, f);
|
|
3798
3804
|
}
|
|
3799
3805
|
l.debounceTimer = null;
|
|
3800
3806
|
}, 250));
|
|
@@ -3807,7 +3813,7 @@ class As extends _ {
|
|
|
3807
3813
|
e.lastEventTime = s, e.lastDepth = t.depth, e.lastDirection = t.direction;
|
|
3808
3814
|
const n = this.get("scrollEventCount") ?? 0;
|
|
3809
3815
|
this.set("scrollEventCount", n + 1), this.eventManager.track({
|
|
3810
|
-
type:
|
|
3816
|
+
type: d.SCROLL,
|
|
3811
3817
|
scroll_data: {
|
|
3812
3818
|
...t,
|
|
3813
3819
|
container_selector: e.selector,
|
|
@@ -3854,7 +3860,7 @@ class As extends _ {
|
|
|
3854
3860
|
const { element: t, lastScrollPos: s, lastEventTime: n } = e, i = this.getScrollTop(t), o = Date.now(), l = Math.abs(i - s);
|
|
3855
3861
|
if (l < 10 || t === window && !this.isWindowScrollable())
|
|
3856
3862
|
return null;
|
|
3857
|
-
const c = this.getViewportHeight(t),
|
|
3863
|
+
const c = this.getViewportHeight(t), u = this.getScrollHeight(t), f = this.getScrollDirection(i, s), g = this.calculateScrollDepth(i, u, c);
|
|
3858
3864
|
let T;
|
|
3859
3865
|
n > 0 ? T = o - n : e.firstScrollEventTime !== null ? T = o - e.firstScrollEventTime : T = 250;
|
|
3860
3866
|
const p = Math.round(l / T * 1e3);
|
|
@@ -4019,7 +4025,7 @@ class Ls extends _ {
|
|
|
4019
4025
|
...e.name !== void 0 && { name: e.name }
|
|
4020
4026
|
};
|
|
4021
4027
|
this.eventManager.track({
|
|
4022
|
-
type:
|
|
4028
|
+
type: d.VIEWPORT_VISIBLE,
|
|
4023
4029
|
viewport_data: o
|
|
4024
4030
|
}), e.startTime = null, e.timeoutId = null, e.lastFiredTime = i;
|
|
4025
4031
|
}
|
|
@@ -4485,8 +4491,8 @@ class Ns extends _ {
|
|
|
4485
4491
|
async initWebVitals() {
|
|
4486
4492
|
try {
|
|
4487
4493
|
const { onLCP: e, onCLS: t, onFCP: s, onTTFB: n, onINP: i } = await Promise.resolve().then(() => cr), o = (l) => (c) => {
|
|
4488
|
-
const
|
|
4489
|
-
this.sendVital({ type: l, value:
|
|
4494
|
+
const u = Number(c.value.toFixed(2));
|
|
4495
|
+
this.sendVital({ type: l, value: u });
|
|
4490
4496
|
};
|
|
4491
4497
|
e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), s(o("FCP"), { reportAllChanges: !1 }), n(o("TTFB"), { reportAllChanges: !1 }), i(o("INP"), { reportAllChanges: !1 });
|
|
4492
4498
|
} catch (e) {
|
|
@@ -4540,7 +4546,7 @@ class Ns extends _ {
|
|
|
4540
4546
|
return;
|
|
4541
4547
|
}
|
|
4542
4548
|
this.eventManager.track({
|
|
4543
|
-
type:
|
|
4549
|
+
type: d.WEB_VITALS,
|
|
4544
4550
|
web_vitals: {
|
|
4545
4551
|
type: e,
|
|
4546
4552
|
value: t
|
|
@@ -4672,7 +4678,7 @@ class ae extends _ {
|
|
|
4672
4678
|
return;
|
|
4673
4679
|
const s = typeof e.error?.stack == "string" ? this.truncateStack(e.error.stack) : void 0;
|
|
4674
4680
|
this.eventManager.track({
|
|
4675
|
-
type:
|
|
4681
|
+
type: d.ERROR,
|
|
4676
4682
|
error_data: {
|
|
4677
4683
|
type: B.JS_ERROR,
|
|
4678
4684
|
message: t,
|
|
@@ -4691,7 +4697,7 @@ class ae extends _ {
|
|
|
4691
4697
|
return;
|
|
4692
4698
|
const n = e.reason instanceof Error && typeof e.reason.stack == "string" ? this.truncateStack(e.reason.stack) : void 0;
|
|
4693
4699
|
this.eventManager.track({
|
|
4694
|
-
type:
|
|
4700
|
+
type: d.ERROR,
|
|
4695
4701
|
error_data: {
|
|
4696
4702
|
type: B.PROMISE_REJECTION,
|
|
4697
4703
|
message: s,
|
|
@@ -4813,7 +4819,7 @@ class Os extends _ {
|
|
|
4813
4819
|
return;
|
|
4814
4820
|
}
|
|
4815
4821
|
this.managers.event.track({
|
|
4816
|
-
type:
|
|
4822
|
+
type: d.CUSTOM,
|
|
4817
4823
|
custom_event: {
|
|
4818
4824
|
name: e,
|
|
4819
4825
|
...o && { metadata: o }
|
|
@@ -5019,7 +5025,7 @@ class Os extends _ {
|
|
|
5019
5025
|
*/
|
|
5020
5026
|
async resetIdentity() {
|
|
5021
5027
|
await this.managers.event?.flushImmediately(), this.set("identity", void 0), this.clearPersistedIdentity();
|
|
5022
|
-
const e =
|
|
5028
|
+
const e = ut();
|
|
5023
5029
|
this.managers.storage.setItem(Te, e), this.set("userId", e), this.set("hasStartSession", !1), this.set("sessionId", null), this.handlers.session?.stopTracking(), this.handlers.session?.startTracking(), a("debug", "Identity reset, new UUID generated");
|
|
5024
5030
|
}
|
|
5025
5031
|
/**
|
|
@@ -5123,7 +5129,7 @@ class Os extends _ {
|
|
|
5123
5129
|
}), this.handlers.error = new ae(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new Ls(this.managers.event), this.handlers.viewport.startTracking()), e.integrations?.tracelog?.shopify) {
|
|
5124
5130
|
const s = new Cs();
|
|
5125
5131
|
s.activate(), this.integrationInstances.shopifyCartLinker = s, this.emitter.on(se.EVENT, (n) => {
|
|
5126
|
-
n.type ===
|
|
5132
|
+
n.type === d.SESSION_START && s.onSessionChange();
|
|
5127
5133
|
});
|
|
5128
5134
|
}
|
|
5129
5135
|
}
|
|
@@ -5132,7 +5138,7 @@ const k = [], M = [];
|
|
|
5132
5138
|
let D = null, h = null, R = !1, S = !1, P = null;
|
|
5133
5139
|
const Ps = async (r) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (S = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : h ? { sessionId: h.getSessionId() ?? "" } : (R && P || (R = !0, P = (async () => {
|
|
5134
5140
|
try {
|
|
5135
|
-
const e =
|
|
5141
|
+
const e = ds(r ?? {}), t = new Os();
|
|
5136
5142
|
try {
|
|
5137
5143
|
k.forEach(({ event: o, callback: l }) => {
|
|
5138
5144
|
t.on(o, l);
|
|
@@ -5330,12 +5336,12 @@ var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
|
5330
5336
|
}, Pe = function() {
|
|
5331
5337
|
var r = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
5332
5338
|
if (r && r.responseStart > 0 && r.responseStart < performance.now()) return r;
|
|
5333
|
-
},
|
|
5339
|
+
}, ue = function() {
|
|
5334
5340
|
var r = Pe();
|
|
5335
5341
|
return r && r.activationStart || 0;
|
|
5336
5342
|
}, y = function(r, e) {
|
|
5337
5343
|
var t = Pe(), s = "navigate";
|
|
5338
|
-
return pt >= 0 ? s = "back-forward-cache" : t && (document.prerendering ||
|
|
5344
|
+
return pt >= 0 ? s = "back-forward-cache" : t && (document.prerendering || ue() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
|
|
5339
5345
|
}, F = function(r, e, t) {
|
|
5340
5346
|
try {
|
|
5341
5347
|
if (PerformanceObserver.supportedEntryTypes.includes(r)) {
|
|
@@ -5365,7 +5371,7 @@ var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
|
5365
5371
|
document.addEventListener("visibilitychange", (function() {
|
|
5366
5372
|
document.visibilityState === "hidden" && r();
|
|
5367
5373
|
}));
|
|
5368
|
-
},
|
|
5374
|
+
}, de = function(r) {
|
|
5369
5375
|
var e = !1;
|
|
5370
5376
|
return function() {
|
|
5371
5377
|
e || (r(), e = !0);
|
|
@@ -5394,7 +5400,7 @@ var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
|
5394
5400
|
e = e || {}, Q((function() {
|
|
5395
5401
|
var t, s = ke(), n = y("FCP"), i = F("paint", (function(o) {
|
|
5396
5402
|
o.forEach((function(l) {
|
|
5397
|
-
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime -
|
|
5403
|
+
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime - ue(), 0), n.entries.push(l), t(!0)));
|
|
5398
5404
|
}));
|
|
5399
5405
|
}));
|
|
5400
5406
|
i && (t = w(r, n, Le, e.reportAllChanges), V((function(o) {
|
|
@@ -5404,12 +5410,12 @@ var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
|
5404
5410
|
})));
|
|
5405
5411
|
}));
|
|
5406
5412
|
}, Me = [0.1, 0.25], Ys = function(r, e) {
|
|
5407
|
-
e = e || {}, St(
|
|
5413
|
+
e = e || {}, St(de((function() {
|
|
5408
5414
|
var t, s = y("CLS", 0), n = 0, i = [], o = function(c) {
|
|
5409
|
-
c.forEach((function(
|
|
5410
|
-
if (!
|
|
5415
|
+
c.forEach((function(u) {
|
|
5416
|
+
if (!u.hadRecentInput) {
|
|
5411
5417
|
var f = i[0], g = i[i.length - 1];
|
|
5412
|
-
n &&
|
|
5418
|
+
n && u.startTime - g.startTime < 1e3 && u.startTime - f.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
|
|
5413
5419
|
}
|
|
5414
5420
|
})), n > s.value && (s.value = n, s.entries = i, t());
|
|
5415
5421
|
}, l = F("layout-shift", o);
|
|
@@ -5452,7 +5458,7 @@ var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
|
5452
5458
|
}
|
|
5453
5459
|
}, _t = function(r) {
|
|
5454
5460
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
5455
|
-
return r =
|
|
5461
|
+
return r = de(r), document.visibilityState === "hidden" ? r() : (t = e(r), z(r)), t;
|
|
5456
5462
|
}, Ce = [200, 500], sr = function(r, e) {
|
|
5457
5463
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, Q((function() {
|
|
5458
5464
|
var t;
|
|
@@ -5473,13 +5479,13 @@ var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
|
5473
5479
|
}, Re = [2500, 4e3], Se = {}, rr = function(r, e) {
|
|
5474
5480
|
e = e || {}, Q((function() {
|
|
5475
5481
|
var t, s = ke(), n = y("LCP"), i = function(c) {
|
|
5476
|
-
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(
|
|
5477
|
-
|
|
5482
|
+
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
5483
|
+
u.startTime < s.firstHiddenTime && (n.value = Math.max(u.startTime - ue(), 0), n.entries = [u], t());
|
|
5478
5484
|
}));
|
|
5479
5485
|
}, o = F("largest-contentful-paint", i);
|
|
5480
5486
|
if (o) {
|
|
5481
5487
|
t = w(r, n, Re, e.reportAllChanges);
|
|
5482
|
-
var l =
|
|
5488
|
+
var l = de((function() {
|
|
5483
5489
|
Se[n.id] || (i(o.takeRecords()), o.disconnect(), Se[n.id] = !0, t(!0));
|
|
5484
5490
|
}));
|
|
5485
5491
|
["keydown", "click"].forEach((function(c) {
|
|
@@ -5504,7 +5510,7 @@ var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
|
5504
5510
|
var t = y("TTFB"), s = w(r, t, Ne, e.reportAllChanges);
|
|
5505
5511
|
nr((function() {
|
|
5506
5512
|
var n = Pe();
|
|
5507
|
-
n && (t.value = Math.max(n.responseStart -
|
|
5513
|
+
n && (t.value = Math.max(n.responseStart - ue(), 0), t.entries = [n], s(!0), V((function() {
|
|
5508
5514
|
t = y("TTFB", 0), (s = w(r, t, Ne, e.reportAllChanges))(!0);
|
|
5509
5515
|
})));
|
|
5510
5516
|
}));
|
|
@@ -5542,7 +5548,7 @@ var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
|
5542
5548
|
}, o = function(c) {
|
|
5543
5549
|
c.forEach(i);
|
|
5544
5550
|
}, l = F("first-input", o);
|
|
5545
|
-
t = w(r, n, Oe, e.reportAllChanges), l && (z(
|
|
5551
|
+
t = w(r, n, Oe, e.reportAllChanges), l && (z(de((function() {
|
|
5546
5552
|
o(l.takeRecords()), l.disconnect();
|
|
5547
5553
|
}))), V((function() {
|
|
5548
5554
|
var c;
|
|
@@ -5567,18 +5573,18 @@ const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5567
5573
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5568
5574
|
export {
|
|
5569
5575
|
m as AppConfigValidationError,
|
|
5570
|
-
|
|
5576
|
+
ur as DEFAULT_SESSION_TIMEOUT,
|
|
5571
5577
|
_e as DEFAULT_WEB_VITALS_MODE,
|
|
5572
5578
|
L as DeviceType,
|
|
5573
5579
|
se as EmitterEvent,
|
|
5574
5580
|
B as ErrorType,
|
|
5575
|
-
|
|
5581
|
+
d as EventType,
|
|
5576
5582
|
vr as InitializationTimeoutError,
|
|
5577
5583
|
N as IntegrationValidationError,
|
|
5578
5584
|
Sr as MAX_ARRAY_LENGTH,
|
|
5579
5585
|
mr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
5580
5586
|
fr as MAX_CUSTOM_EVENT_KEYS,
|
|
5581
|
-
|
|
5587
|
+
dr as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
5582
5588
|
hr as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
5583
5589
|
gr as MAX_NESTED_OBJECT_KEYS,
|
|
5584
5590
|
Er as MAX_STRING_LENGTH,
|