@tracelog/lib 2.0.3-rc.73.7 → 2.1.0-rc.74.2
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.
Potentially problematic release.
This version of @tracelog/lib might be problematic. Click here for more details.
- package/dist/browser/tracelog.esm.js +550 -504
- 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 +56 -2
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +34 -0
- package/dist/public-api.d.ts +34 -0
- package/dist/public-api.js +56 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const Or = 9e5;
|
|
2
2
|
const Pr = 120, Dr = 8192, Vr = 10, kr = 10, Ur = 20, xr = 1;
|
|
3
|
-
const Hr = 1e3,
|
|
4
|
-
const w = "data-tlog",
|
|
3
|
+
const Hr = 1e3, $r = 500, Fr = 100;
|
|
4
|
+
const w = "data-tlog", st = [
|
|
5
5
|
"button",
|
|
6
6
|
"a",
|
|
7
7
|
'input[type="button"]',
|
|
@@ -78,15 +78,15 @@ const m = {
|
|
|
78
78
|
/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
|
79
79
|
/<embed\b[^>]*>/gi,
|
|
80
80
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
81
|
-
], I = "tlog", x = `${I}:qa_mode`, Te = `${I}:uid`, xe = "tlog_mode", _e = "qa", ve = "qa_off", lt = (
|
|
82
|
-
var k = /* @__PURE__ */ ((
|
|
81
|
+
], I = "tlog", x = `${I}:qa_mode`, Te = `${I}:uid`, xe = "tlog_mode", _e = "qa", ve = "qa_off", lt = (n) => n ? `${I}:${n}:queue` : `${I}:queue`, ct = (n) => n ? `${I}:${n}:session` : `${I}:session`, ut = (n) => n ? `${I}:${n}:broadcast` : `${I}:broadcast`, Ie = (n, e) => `${I}:${n}:session_counts:${e}`, we = 10080 * 60 * 1e3, ye = `${I}:session_counts_last_cleanup`, be = 3600 * 1e3;
|
|
82
|
+
var k = /* @__PURE__ */ ((n) => (n.Localhost = "localhost:8080", n.Fail = "localhost:9999", n))(k || {}), L = /* @__PURE__ */ ((n) => (n.Mobile = "mobile", n.Tablet = "tablet", n.Desktop = "desktop", n.Unknown = "unknown", n))(L || {}), se = /* @__PURE__ */ ((n) => (n.EVENT = "event", n.QUEUE = "queue", n))(se || {});
|
|
83
83
|
class N extends Error {
|
|
84
84
|
constructor(e, t) {
|
|
85
85
|
super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, N);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
var d = /* @__PURE__ */ ((
|
|
89
|
-
const Br = (
|
|
88
|
+
var d = /* @__PURE__ */ ((n) => (n.PAGE_VIEW = "page_view", n.CLICK = "click", n.SCROLL = "scroll", n.SESSION_START = "session_start", n.CUSTOM = "custom", n.WEB_VITALS = "web_vitals", n.ERROR = "error", n.VIEWPORT_VISIBLE = "viewport_visible", n))(d || {}), X = /* @__PURE__ */ ((n) => (n.UP = "up", n.DOWN = "down", n))(X || {}), U = /* @__PURE__ */ ((n) => (n.JS_ERROR = "js_error", n.PROMISE_REJECTION = "promise_rejection", n))(U || {}), j = /* @__PURE__ */ ((n) => (n.QA = "qa", n))(j || {});
|
|
89
|
+
const Br = (n) => n.type === d.SCROLL && "scroll_data" in n && n.scroll_data.is_primary === !0, Wr = (n) => n.type === d.SCROLL && "scroll_data" in n && n.scroll_data.is_primary === !1;
|
|
90
90
|
class H extends Error {
|
|
91
91
|
constructor(e, t, r) {
|
|
92
92
|
super(e), this.errorCode = t, this.layer = r, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
@@ -117,25 +117,25 @@ class Gr extends H {
|
|
|
117
117
|
super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
const He = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;",
|
|
120
|
+
const He = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", $e = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", ht = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", ft = (n, e) => {
|
|
121
121
|
if (e) {
|
|
122
122
|
if (e instanceof Error) {
|
|
123
123
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
|
|
124
|
-
return `[TraceLog] ${
|
|
124
|
+
return `[TraceLog] ${n}: ${t}`;
|
|
125
125
|
}
|
|
126
126
|
if (e instanceof Error)
|
|
127
|
-
return `[TraceLog] ${
|
|
127
|
+
return `[TraceLog] ${n}: ${e.message}`;
|
|
128
128
|
if (typeof e == "string")
|
|
129
|
-
return `[TraceLog] ${
|
|
129
|
+
return `[TraceLog] ${n}: ${e}`;
|
|
130
130
|
if (typeof e == "object")
|
|
131
131
|
try {
|
|
132
|
-
return `[TraceLog] ${
|
|
132
|
+
return `[TraceLog] ${n}: ${JSON.stringify(e)}`;
|
|
133
133
|
} catch {
|
|
134
|
-
return `[TraceLog] ${
|
|
134
|
+
return `[TraceLog] ${n}: [Unable to serialize error]`;
|
|
135
135
|
}
|
|
136
|
-
return `[TraceLog] ${
|
|
136
|
+
return `[TraceLog] ${n}: ${String(e)}`;
|
|
137
137
|
}
|
|
138
|
-
return `[TraceLog] ${
|
|
138
|
+
return `[TraceLog] ${n}`;
|
|
139
139
|
}, mt = () => {
|
|
140
140
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
141
141
|
return !1;
|
|
@@ -144,34 +144,34 @@ const He = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
144
144
|
} catch {
|
|
145
145
|
return !1;
|
|
146
146
|
}
|
|
147
|
-
}, a = (
|
|
148
|
-
const { error: r, data:
|
|
147
|
+
}, a = (n, e, t) => {
|
|
148
|
+
const { error: r, data: s, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ? ft(e, r) : `[TraceLog] ${e}`, u = n === "error" ? "error" : n === "warn" ? "warn" : "log";
|
|
149
149
|
if (!gt(l, i))
|
|
150
150
|
return;
|
|
151
|
-
const g = Et(l, o), E =
|
|
151
|
+
const g = Et(l, o), E = s !== void 0 ? ie(s) : void 0;
|
|
152
152
|
St(u, c, g, E);
|
|
153
|
-
}, gt = (
|
|
154
|
-
const
|
|
155
|
-
r !== void 0 ?
|
|
156
|
-
}, ie = (
|
|
153
|
+
}, gt = (n, e) => n === "critical" ? !0 : n === "qa" || e ? mt() : !1, Et = (n, e) => e !== void 0 && e !== "" ? e : n === "critical" ? ht : "", St = (n, e, t, r) => {
|
|
154
|
+
const s = t !== void 0 && t !== "", i = s ? `%c${e}` : e;
|
|
155
|
+
r !== void 0 ? s ? console[n](i, t, r) : console[n](i, r) : s ? console[n](i, t) : console[n](i);
|
|
156
|
+
}, ie = (n) => {
|
|
157
157
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
158
|
-
for (const [r,
|
|
158
|
+
for (const [r, s] of Object.entries(n)) {
|
|
159
159
|
const i = r.toLowerCase();
|
|
160
160
|
if (t.some((o) => i.includes(o))) {
|
|
161
161
|
e[r] = "[REDACTED]";
|
|
162
162
|
continue;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
s !== null && typeof s == "object" && !Array.isArray(s) ? e[r] = ie(s) : Array.isArray(s) ? e[r] = s.map(
|
|
165
165
|
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ? ie(o) : o
|
|
166
|
-
) : e[r] =
|
|
166
|
+
) : e[r] = s;
|
|
167
167
|
}
|
|
168
168
|
return e;
|
|
169
169
|
};
|
|
170
|
-
let oe,
|
|
170
|
+
let oe, Fe;
|
|
171
171
|
const pt = () => {
|
|
172
|
-
typeof window < "u" && !oe && (oe = window.matchMedia("(pointer: coarse)"),
|
|
173
|
-
}, K = "Unknown", Tt = (
|
|
174
|
-
const e =
|
|
172
|
+
typeof window < "u" && !oe && (oe = window.matchMedia("(pointer: coarse)"), Fe = window.matchMedia("(hover: none)"));
|
|
173
|
+
}, K = "Unknown", Tt = (n) => {
|
|
174
|
+
const e = n.userAgentData?.platform;
|
|
175
175
|
if (e != null && e !== "") {
|
|
176
176
|
if (/windows/i.test(e)) return "Windows";
|
|
177
177
|
if (/macos/i.test(e)) return "macOS";
|
|
@@ -182,12 +182,12 @@ const pt = () => {
|
|
|
182
182
|
}
|
|
183
183
|
const t = navigator.userAgent;
|
|
184
184
|
return /Windows/i.test(t) ? "Windows" : /iPhone|iPad|iPod/i.test(t) ? "iOS" : /Mac OS X|Macintosh/i.test(t) ? "macOS" : /Android/i.test(t) ? "Android" : /CrOS/i.test(t) ? "ChromeOS" : /Linux/i.test(t) ? "Linux" : K;
|
|
185
|
-
}, _t = (
|
|
186
|
-
const e =
|
|
185
|
+
}, _t = (n) => {
|
|
186
|
+
const e = n.userAgentData?.brands;
|
|
187
187
|
if (e != null && e.length > 0) {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
const i =
|
|
188
|
+
const s = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
|
|
189
|
+
if (s != null) {
|
|
190
|
+
const i = s.brand;
|
|
191
191
|
return /google chrome/i.test(i) ? "Chrome" : /microsoft edge/i.test(i) ? "Edge" : /opera/i.test(i) ? "Opera" : i;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -195,27 +195,27 @@ const pt = () => {
|
|
|
195
195
|
return /Edg\//i.test(t) ? "Edge" : /OPR\//i.test(t) ? "Opera" : /Chrome/i.test(t) ? "Chrome" : /Firefox/i.test(t) ? "Firefox" : /Safari/i.test(t) && !/Chrome/i.test(t) ? "Safari" : K;
|
|
196
196
|
}, vt = () => {
|
|
197
197
|
try {
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
const c =
|
|
201
|
-
return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet :
|
|
198
|
+
const n = navigator;
|
|
199
|
+
if (n.userAgentData != null && typeof n.userAgentData.mobile == "boolean") {
|
|
200
|
+
const c = n.userAgentData.platform;
|
|
201
|
+
return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet : n.userAgentData.mobile ? L.Mobile : L.Desktop;
|
|
202
202
|
}
|
|
203
203
|
pt();
|
|
204
|
-
const e = window.innerWidth, t = oe?.matches ?? !1, r =
|
|
205
|
-
return e <= 767 || o &&
|
|
206
|
-
} catch (
|
|
207
|
-
return a("debug", "Device detection failed, defaulting to desktop", { error:
|
|
204
|
+
const e = window.innerWidth, t = oe?.matches ?? !1, r = Fe?.matches ?? !1, s = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), l = /tablet|ipad|android(?!.*mobile)/.test(i);
|
|
205
|
+
return e <= 767 || o && s ? L.Mobile : e >= 768 && e <= 1024 || l || t && r && s ? L.Tablet : L.Desktop;
|
|
206
|
+
} catch (n) {
|
|
207
|
+
return a("debug", "Device detection failed, defaulting to desktop", { error: n }), L.Desktop;
|
|
208
208
|
}
|
|
209
209
|
}, It = () => {
|
|
210
210
|
try {
|
|
211
|
-
const
|
|
211
|
+
const n = navigator;
|
|
212
212
|
return {
|
|
213
213
|
type: vt(),
|
|
214
|
-
os: Tt(
|
|
215
|
-
browser: _t(
|
|
214
|
+
os: Tt(n),
|
|
215
|
+
browser: _t(n)
|
|
216
216
|
};
|
|
217
|
-
} catch (
|
|
218
|
-
return a("debug", "Device info detection failed, using defaults", { error:
|
|
217
|
+
} catch (n) {
|
|
218
|
+
return a("debug", "Device info detection failed, using defaults", { error: n }), {
|
|
219
219
|
type: L.Desktop,
|
|
220
220
|
os: K,
|
|
221
221
|
browser: K
|
|
@@ -272,8 +272,8 @@ const pt = () => {
|
|
|
272
272
|
TTFB: 1800,
|
|
273
273
|
// Poor: > 1800ms
|
|
274
274
|
LONG_TASK: 50
|
|
275
|
-
}, ae = "needs-improvement", Ne = (
|
|
276
|
-
switch (
|
|
275
|
+
}, ae = "needs-improvement", Ne = (n = ae) => {
|
|
276
|
+
switch (n) {
|
|
277
277
|
case "all":
|
|
278
278
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
|
|
279
279
|
// Track everything
|
|
@@ -284,11 +284,11 @@ const pt = () => {
|
|
|
284
284
|
default:
|
|
285
285
|
return Re;
|
|
286
286
|
}
|
|
287
|
-
}, Mt = 1e3, Ct = 50, Rt = "2.0
|
|
287
|
+
}, Mt = 1e3, Ct = 50, Rt = "2.1.0", Nt = Rt, Ge = () => typeof window < "u" && typeof sessionStorage < "u", Ot = () => {
|
|
288
288
|
try {
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
const e =
|
|
289
|
+
const n = new URLSearchParams(window.location.search);
|
|
290
|
+
n.delete(xe);
|
|
291
|
+
const e = n.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
|
|
292
292
|
window.history.replaceState({}, "", t);
|
|
293
293
|
} catch {
|
|
294
294
|
}
|
|
@@ -303,56 +303,56 @@ const pt = () => {
|
|
|
303
303
|
style: He
|
|
304
304
|
})) : e === ve && (r = !1, sessionStorage.setItem(x, "false"), a("info", "QA Mode DISABLED", {
|
|
305
305
|
visibility: "qa",
|
|
306
|
-
style:
|
|
306
|
+
style: $e
|
|
307
307
|
})), (e === _e || e === ve) && Ot(), r ?? t === "true";
|
|
308
308
|
} catch {
|
|
309
309
|
return !1;
|
|
310
310
|
}
|
|
311
|
-
}, Dt = (
|
|
311
|
+
}, Dt = (n) => {
|
|
312
312
|
if (Ge())
|
|
313
313
|
try {
|
|
314
|
-
sessionStorage.setItem(x,
|
|
314
|
+
sessionStorage.setItem(x, n ? "true" : "false"), a("info", n ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
315
315
|
visibility: "qa",
|
|
316
|
-
style:
|
|
316
|
+
style: n ? He : $e
|
|
317
317
|
});
|
|
318
318
|
} catch {
|
|
319
319
|
a("debug", "Cannot set QA mode: sessionStorage unavailable");
|
|
320
320
|
}
|
|
321
321
|
}, Oe = () => {
|
|
322
|
-
const
|
|
322
|
+
const n = new URLSearchParams(window.location.search), e = {};
|
|
323
323
|
return it.forEach((r) => {
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
324
|
+
const s = n.get(r);
|
|
325
|
+
if (s) {
|
|
326
326
|
const i = r.split("utm_")[1];
|
|
327
|
-
e[i] =
|
|
327
|
+
e[i] = s;
|
|
328
328
|
}
|
|
329
329
|
}), Object.keys(e).length ? e : void 0;
|
|
330
|
-
}, Vt = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (
|
|
330
|
+
}, Vt = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (n) => {
|
|
331
331
|
const e = Math.random() * 16 | 0;
|
|
332
|
-
return (
|
|
332
|
+
return (n === "x" ? e : e & 3 | 8).toString(16);
|
|
333
333
|
});
|
|
334
334
|
let B = 0, W = 0;
|
|
335
335
|
const kt = () => {
|
|
336
|
-
let
|
|
337
|
-
|
|
336
|
+
let n = Date.now();
|
|
337
|
+
n < W && (n = W), n === W ? B = (B + 1) % 1e3 : B = 0, W = n;
|
|
338
338
|
const e = B.toString().padStart(3, "0");
|
|
339
339
|
let t = "";
|
|
340
340
|
try {
|
|
341
341
|
if (typeof crypto < "u" && crypto.getRandomValues) {
|
|
342
342
|
const r = crypto.getRandomValues(new Uint8Array(3));
|
|
343
|
-
r && (t = Array.from(r, (
|
|
343
|
+
r && (t = Array.from(r, (s) => s.toString(16).padStart(2, "0")).join(""));
|
|
344
344
|
}
|
|
345
345
|
} catch {
|
|
346
346
|
}
|
|
347
|
-
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${
|
|
348
|
-
}, Xe = (
|
|
347
|
+
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${n}-${e}-${t}`;
|
|
348
|
+
}, Xe = (n, e = !1) => {
|
|
349
349
|
try {
|
|
350
|
-
const t = new URL(
|
|
351
|
-
return r || e &&
|
|
350
|
+
const t = new URL(n), r = t.protocol === "https:", s = t.protocol === "http:";
|
|
351
|
+
return r || e && s;
|
|
352
352
|
} catch {
|
|
353
353
|
return !1;
|
|
354
354
|
}
|
|
355
|
-
}, Ut = (
|
|
355
|
+
}, Ut = (n) => {
|
|
356
356
|
try {
|
|
357
357
|
const t = new URL(window.location.href).hostname;
|
|
358
358
|
if (!t || typeof t != "string")
|
|
@@ -366,70 +366,70 @@ const kt = () => {
|
|
|
366
366
|
throw new Error("Invalid hostname structure");
|
|
367
367
|
if (r.length === 1)
|
|
368
368
|
throw new Error("Single-part domain not supported for SaaS integration");
|
|
369
|
-
let
|
|
370
|
-
if (r.length === 2 ?
|
|
369
|
+
let s;
|
|
370
|
+
if (r.length === 2 ? s = r.join(".") : s = r.slice(-2).join("."), !s || s.split(".").length < 2)
|
|
371
371
|
throw new Error("Invalid domain structure for SaaS");
|
|
372
|
-
const i = `https://${
|
|
372
|
+
const i = `https://${n}.${s}/collect`;
|
|
373
373
|
if (!Xe(i))
|
|
374
374
|
throw new Error("Generated URL failed validation");
|
|
375
375
|
return i;
|
|
376
376
|
} catch (e) {
|
|
377
377
|
throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
|
|
378
378
|
}
|
|
379
|
-
}, xt = (
|
|
379
|
+
}, xt = (n) => {
|
|
380
380
|
const e = {};
|
|
381
|
-
|
|
382
|
-
const t =
|
|
381
|
+
n.integrations?.tracelog?.projectId && (e.saas = Ut(n.integrations.tracelog.projectId));
|
|
382
|
+
const t = n.integrations?.custom?.collectApiUrl;
|
|
383
383
|
if (t) {
|
|
384
|
-
const r =
|
|
384
|
+
const r = n.integrations?.custom?.allowHttp ?? !1;
|
|
385
385
|
if (!Xe(t, r))
|
|
386
386
|
throw new Error("Invalid custom API URL");
|
|
387
387
|
e.custom = t;
|
|
388
388
|
}
|
|
389
389
|
return e;
|
|
390
|
-
}, le = (
|
|
391
|
-
if (!
|
|
392
|
-
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof
|
|
390
|
+
}, le = (n, e = []) => {
|
|
391
|
+
if (!n || typeof n != "string")
|
|
392
|
+
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof n } }), n || "";
|
|
393
393
|
try {
|
|
394
|
-
const t = new URL(
|
|
394
|
+
const t = new URL(n), r = t.searchParams, s = [.../* @__PURE__ */ new Set([...ot, ...e])];
|
|
395
395
|
let i = !1;
|
|
396
396
|
const o = [];
|
|
397
|
-
return
|
|
397
|
+
return s.forEach((c) => {
|
|
398
398
|
r.has(c) && (r.delete(c), i = !0, o.push(c));
|
|
399
|
-
}), !i &&
|
|
399
|
+
}), !i && n.includes("?") ? n : (t.search = r.toString(), t.toString());
|
|
400
400
|
} catch (t) {
|
|
401
|
-
return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength:
|
|
401
|
+
return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: n?.length } }), n;
|
|
402
402
|
}
|
|
403
|
-
}, Pe = (
|
|
404
|
-
if (!
|
|
403
|
+
}, Pe = (n) => {
|
|
404
|
+
if (!n || typeof n != "string" || n.trim().length === 0)
|
|
405
405
|
return "";
|
|
406
|
-
let e =
|
|
407
|
-
|
|
406
|
+
let e = n;
|
|
407
|
+
n.length > 1e3 && (e = n.slice(0, Math.max(0, 1e3)));
|
|
408
408
|
let t = 0;
|
|
409
|
-
for (const
|
|
409
|
+
for (const s of at) {
|
|
410
410
|
const i = e;
|
|
411
|
-
e = e.replace(
|
|
411
|
+
e = e.replace(s, ""), i !== e && t++;
|
|
412
412
|
}
|
|
413
413
|
return t > 0 && a("warn", "XSS patterns detected and removed", {
|
|
414
414
|
data: {
|
|
415
415
|
patternMatches: t,
|
|
416
|
-
valueLength:
|
|
416
|
+
valueLength: n.length
|
|
417
417
|
}
|
|
418
418
|
}), e = e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'").replaceAll("/", "/"), e.trim();
|
|
419
|
-
}, ce = (
|
|
420
|
-
if (e > 3 ||
|
|
419
|
+
}, ce = (n, e = 0) => {
|
|
420
|
+
if (e > 3 || n == null)
|
|
421
421
|
return null;
|
|
422
|
-
if (typeof
|
|
423
|
-
return Pe(
|
|
424
|
-
if (typeof
|
|
425
|
-
return !Number.isFinite(
|
|
426
|
-
if (typeof
|
|
427
|
-
return
|
|
428
|
-
if (Array.isArray(
|
|
429
|
-
return
|
|
430
|
-
if (typeof
|
|
431
|
-
const t = {},
|
|
432
|
-
for (const [i, o] of
|
|
422
|
+
if (typeof n == "string")
|
|
423
|
+
return Pe(n);
|
|
424
|
+
if (typeof n == "number")
|
|
425
|
+
return !Number.isFinite(n) || n < -Number.MAX_SAFE_INTEGER || n > Number.MAX_SAFE_INTEGER ? 0 : n;
|
|
426
|
+
if (typeof n == "boolean")
|
|
427
|
+
return n;
|
|
428
|
+
if (Array.isArray(n))
|
|
429
|
+
return n.slice(0, 100).map((s) => ce(s, e + 1)).filter((s) => s !== null);
|
|
430
|
+
if (typeof n == "object") {
|
|
431
|
+
const t = {}, s = Object.entries(n).slice(0, 20);
|
|
432
|
+
for (const [i, o] of s) {
|
|
433
433
|
const l = Pe(i);
|
|
434
434
|
if (l) {
|
|
435
435
|
const c = ce(o, e + 1);
|
|
@@ -439,72 +439,72 @@ const kt = () => {
|
|
|
439
439
|
return t;
|
|
440
440
|
}
|
|
441
441
|
return null;
|
|
442
|
-
}, Ht = (
|
|
443
|
-
if (typeof
|
|
442
|
+
}, Ht = (n) => {
|
|
443
|
+
if (typeof n != "object" || n === null)
|
|
444
444
|
return {};
|
|
445
445
|
try {
|
|
446
|
-
const e = ce(
|
|
446
|
+
const e = ce(n);
|
|
447
447
|
return typeof e == "object" && e !== null ? e : {};
|
|
448
448
|
} catch (e) {
|
|
449
449
|
const t = e instanceof Error ? e.message : String(e);
|
|
450
450
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
451
451
|
}
|
|
452
|
-
},
|
|
453
|
-
if (
|
|
452
|
+
}, $t = (n) => {
|
|
453
|
+
if (n !== void 0 && (n === null || typeof n != "object"))
|
|
454
454
|
throw new h("Configuration must be an object", "config");
|
|
455
|
-
if (
|
|
456
|
-
if (
|
|
455
|
+
if (n) {
|
|
456
|
+
if (n.sessionTimeout !== void 0 && (typeof n.sessionTimeout != "number" || n.sessionTimeout < 3e4 || n.sessionTimeout > 864e5))
|
|
457
457
|
throw new dt(m.INVALID_SESSION_TIMEOUT, "config");
|
|
458
|
-
if (
|
|
458
|
+
if (n.globalMetadata !== void 0 && (typeof n.globalMetadata != "object" || n.globalMetadata === null))
|
|
459
459
|
throw new h(m.INVALID_GLOBAL_METADATA, "config");
|
|
460
|
-
if (
|
|
461
|
-
if (!Array.isArray(
|
|
460
|
+
if (n.integrations && Bt(n.integrations), n.sensitiveQueryParams !== void 0) {
|
|
461
|
+
if (!Array.isArray(n.sensitiveQueryParams))
|
|
462
462
|
throw new h(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
463
|
-
for (const e of
|
|
463
|
+
for (const e of n.sensitiveQueryParams)
|
|
464
464
|
if (typeof e != "string")
|
|
465
465
|
throw new h("All sensitive query params must be strings", "config");
|
|
466
466
|
}
|
|
467
|
-
if (
|
|
467
|
+
if (n.errorSampling !== void 0 && (typeof n.errorSampling != "number" || n.errorSampling < 0 || n.errorSampling > 1))
|
|
468
468
|
throw new Ae(m.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
469
|
-
if (
|
|
469
|
+
if (n.samplingRate !== void 0 && (typeof n.samplingRate != "number" || n.samplingRate < 0 || n.samplingRate > 1))
|
|
470
470
|
throw new Ae(m.INVALID_SAMPLING_RATE, "config");
|
|
471
|
-
if (
|
|
472
|
-
if (typeof
|
|
471
|
+
if (n.primaryScrollSelector !== void 0) {
|
|
472
|
+
if (typeof n.primaryScrollSelector != "string" || !n.primaryScrollSelector.trim())
|
|
473
473
|
throw new h(m.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
474
|
-
if (
|
|
474
|
+
if (n.primaryScrollSelector !== "window")
|
|
475
475
|
try {
|
|
476
|
-
document.querySelector(
|
|
476
|
+
document.querySelector(n.primaryScrollSelector);
|
|
477
477
|
} catch {
|
|
478
478
|
throw new h(
|
|
479
|
-
`${m.INVALID_PRIMARY_SCROLL_SELECTOR_SYNTAX}: "${
|
|
479
|
+
`${m.INVALID_PRIMARY_SCROLL_SELECTOR_SYNTAX}: "${n.primaryScrollSelector}"`,
|
|
480
480
|
"config"
|
|
481
481
|
);
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
484
|
+
if (n.pageViewThrottleMs !== void 0 && (typeof n.pageViewThrottleMs != "number" || n.pageViewThrottleMs < 0))
|
|
485
485
|
throw new h(m.INVALID_PAGE_VIEW_THROTTLE, "config");
|
|
486
|
-
if (
|
|
486
|
+
if (n.clickThrottleMs !== void 0 && (typeof n.clickThrottleMs != "number" || n.clickThrottleMs < 0))
|
|
487
487
|
throw new h(m.INVALID_CLICK_THROTTLE, "config");
|
|
488
|
-
if (
|
|
488
|
+
if (n.maxSameEventPerMinute !== void 0 && (typeof n.maxSameEventPerMinute != "number" || n.maxSameEventPerMinute <= 0))
|
|
489
489
|
throw new h(m.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
|
|
490
|
-
if (
|
|
491
|
-
if (typeof
|
|
490
|
+
if (n.viewport !== void 0 && Ft(n.viewport), n.webVitalsMode !== void 0) {
|
|
491
|
+
if (typeof n.webVitalsMode != "string")
|
|
492
492
|
throw new h(
|
|
493
|
-
`Invalid webVitalsMode type: ${typeof
|
|
493
|
+
`Invalid webVitalsMode type: ${typeof n.webVitalsMode}. Must be a string`,
|
|
494
494
|
"config"
|
|
495
495
|
);
|
|
496
496
|
const e = ["all", "needs-improvement", "poor"];
|
|
497
|
-
if (!e.includes(
|
|
497
|
+
if (!e.includes(n.webVitalsMode))
|
|
498
498
|
throw new h(
|
|
499
|
-
`Invalid webVitalsMode: "${
|
|
499
|
+
`Invalid webVitalsMode: "${n.webVitalsMode}". Must be one of: ${e.join(", ")}`,
|
|
500
500
|
"config"
|
|
501
501
|
);
|
|
502
502
|
}
|
|
503
|
-
if (
|
|
504
|
-
if (typeof
|
|
503
|
+
if (n.webVitalsThresholds !== void 0) {
|
|
504
|
+
if (typeof n.webVitalsThresholds != "object" || n.webVitalsThresholds === null || Array.isArray(n.webVitalsThresholds))
|
|
505
505
|
throw new h("webVitalsThresholds must be an object", "config");
|
|
506
506
|
const e = ["LCP", "FCP", "CLS", "INP", "TTFB", "LONG_TASK"];
|
|
507
|
-
for (const [t, r] of Object.entries(
|
|
507
|
+
for (const [t, r] of Object.entries(n.webVitalsThresholds)) {
|
|
508
508
|
if (!e.includes(t))
|
|
509
509
|
throw new h(
|
|
510
510
|
`Invalid Web Vitals threshold key: "${t}". Must be one of: ${e.join(", ")}`,
|
|
@@ -518,15 +518,15 @@ const kt = () => {
|
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
},
|
|
522
|
-
if (typeof
|
|
521
|
+
}, Ft = (n) => {
|
|
522
|
+
if (typeof n != "object" || n === null)
|
|
523
523
|
throw new h(m.INVALID_VIEWPORT_CONFIG, "config");
|
|
524
|
-
if (!
|
|
524
|
+
if (!n.elements || !Array.isArray(n.elements))
|
|
525
525
|
throw new h(m.INVALID_VIEWPORT_ELEMENTS, "config");
|
|
526
|
-
if (
|
|
526
|
+
if (n.elements.length === 0)
|
|
527
527
|
throw new h(m.INVALID_VIEWPORT_ELEMENTS, "config");
|
|
528
528
|
const e = /* @__PURE__ */ new Set();
|
|
529
|
-
for (const t of
|
|
529
|
+
for (const t of n.elements) {
|
|
530
530
|
if (!t.selector || typeof t.selector != "string" || !t.selector.trim())
|
|
531
531
|
throw new h(m.INVALID_VIEWPORT_ELEMENT, "config");
|
|
532
532
|
const r = t.selector.trim();
|
|
@@ -540,45 +540,45 @@ const kt = () => {
|
|
|
540
540
|
if (t.name !== void 0 && (typeof t.name != "string" || !t.name.trim()))
|
|
541
541
|
throw new h(m.INVALID_VIEWPORT_ELEMENT_NAME, "config");
|
|
542
542
|
}
|
|
543
|
-
if (
|
|
543
|
+
if (n.threshold !== void 0 && (typeof n.threshold != "number" || n.threshold < 0 || n.threshold > 1))
|
|
544
544
|
throw new h(m.INVALID_VIEWPORT_THRESHOLD, "config");
|
|
545
|
-
if (
|
|
545
|
+
if (n.minDwellTime !== void 0 && (typeof n.minDwellTime != "number" || n.minDwellTime < 0))
|
|
546
546
|
throw new h(m.INVALID_VIEWPORT_MIN_DWELL_TIME, "config");
|
|
547
|
-
if (
|
|
547
|
+
if (n.cooldownPeriod !== void 0 && (typeof n.cooldownPeriod != "number" || n.cooldownPeriod < 0))
|
|
548
548
|
throw new h(m.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
549
|
-
if (
|
|
549
|
+
if (n.maxTrackedElements !== void 0 && (typeof n.maxTrackedElements != "number" || n.maxTrackedElements <= 0))
|
|
550
550
|
throw new h(m.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
551
|
-
}, Bt = (
|
|
552
|
-
if (
|
|
553
|
-
if (
|
|
551
|
+
}, Bt = (n) => {
|
|
552
|
+
if (n) {
|
|
553
|
+
if (n.tracelog && (!n.tracelog.projectId || typeof n.tracelog.projectId != "string" || n.tracelog.projectId.trim() === ""))
|
|
554
554
|
throw new V(m.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
555
|
-
if (
|
|
556
|
-
if (!
|
|
555
|
+
if (n.custom) {
|
|
556
|
+
if (!n.custom.collectApiUrl || typeof n.custom.collectApiUrl != "string" || n.custom.collectApiUrl.trim() === "")
|
|
557
557
|
throw new V(m.INVALID_CUSTOM_API_URL, "config");
|
|
558
|
-
if (
|
|
558
|
+
if (n.custom.allowHttp !== void 0 && typeof n.custom.allowHttp != "boolean")
|
|
559
559
|
throw new V("allowHttp must be a boolean", "config");
|
|
560
|
-
const e =
|
|
560
|
+
const e = n.custom.collectApiUrl.trim();
|
|
561
561
|
if (!e.startsWith("http://") && !e.startsWith("https://"))
|
|
562
562
|
throw new V('Custom API URL must start with "http://" or "https://"', "config");
|
|
563
|
-
if (!(
|
|
563
|
+
if (!(n.custom.allowHttp ?? !1) && e.startsWith("http://"))
|
|
564
564
|
throw new V(
|
|
565
565
|
"Custom API URL must use HTTPS in production. Set allowHttp: true in integration config to allow HTTP (not recommended)",
|
|
566
566
|
"config"
|
|
567
567
|
);
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
}, Wt = (
|
|
571
|
-
|
|
570
|
+
}, Wt = (n) => {
|
|
571
|
+
$t(n);
|
|
572
572
|
const e = {
|
|
573
|
-
...
|
|
574
|
-
sessionTimeout:
|
|
575
|
-
globalMetadata:
|
|
576
|
-
sensitiveQueryParams:
|
|
577
|
-
errorSampling:
|
|
578
|
-
samplingRate:
|
|
579
|
-
pageViewThrottleMs:
|
|
580
|
-
clickThrottleMs:
|
|
581
|
-
maxSameEventPerMinute:
|
|
573
|
+
...n ?? {},
|
|
574
|
+
sessionTimeout: n?.sessionTimeout ?? 9e5,
|
|
575
|
+
globalMetadata: n?.globalMetadata ?? {},
|
|
576
|
+
sensitiveQueryParams: n?.sensitiveQueryParams ?? [],
|
|
577
|
+
errorSampling: n?.errorSampling ?? We,
|
|
578
|
+
samplingRate: n?.samplingRate ?? 1,
|
|
579
|
+
pageViewThrottleMs: n?.pageViewThrottleMs ?? 1e3,
|
|
580
|
+
clickThrottleMs: n?.clickThrottleMs ?? 300,
|
|
581
|
+
maxSameEventPerMinute: n?.maxSameEventPerMinute ?? 60
|
|
582
582
|
};
|
|
583
583
|
return e.integrations?.custom && (e.integrations.custom = {
|
|
584
584
|
...e.integrations.custom,
|
|
@@ -590,11 +590,11 @@ const kt = () => {
|
|
|
590
590
|
cooldownPeriod: e.viewport.cooldownPeriod ?? 6e4,
|
|
591
591
|
maxTrackedElements: e.viewport.maxTrackedElements ?? 100
|
|
592
592
|
}), e;
|
|
593
|
-
}, Gt = (
|
|
594
|
-
if (typeof
|
|
593
|
+
}, Gt = (n) => {
|
|
594
|
+
if (typeof n == "string")
|
|
595
595
|
return !0;
|
|
596
|
-
if (typeof
|
|
597
|
-
const e = Object.entries(
|
|
596
|
+
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
597
|
+
const e = Object.entries(n);
|
|
598
598
|
if (e.length > 20)
|
|
599
599
|
return !1;
|
|
600
600
|
for (const [, t] of e) {
|
|
@@ -607,10 +607,10 @@ const kt = () => {
|
|
|
607
607
|
return !0;
|
|
608
608
|
}
|
|
609
609
|
return !1;
|
|
610
|
-
}, Qe = (
|
|
611
|
-
if (typeof
|
|
610
|
+
}, Qe = (n, e = 0) => {
|
|
611
|
+
if (typeof n != "object" || n === null || e > 1)
|
|
612
612
|
return !1;
|
|
613
|
-
for (const t of Object.values(
|
|
613
|
+
for (const t of Object.values(n)) {
|
|
614
614
|
if (t == null)
|
|
615
615
|
continue;
|
|
616
616
|
const r = typeof t;
|
|
@@ -634,27 +634,27 @@ const kt = () => {
|
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
return !0;
|
|
637
|
-
}, Xt = (
|
|
637
|
+
}, Xt = (n) => typeof n != "string" ? {
|
|
638
638
|
valid: !1,
|
|
639
639
|
error: "Event name must be a string"
|
|
640
|
-
} :
|
|
640
|
+
} : n.length === 0 ? {
|
|
641
641
|
valid: !1,
|
|
642
642
|
error: "Event name cannot be empty"
|
|
643
|
-
} :
|
|
643
|
+
} : n.length > 120 ? {
|
|
644
644
|
valid: !1,
|
|
645
645
|
error: "Event name is too long (max 120 characters)"
|
|
646
|
-
} :
|
|
646
|
+
} : n.includes("<") || n.includes(">") || n.includes("&") ? {
|
|
647
647
|
valid: !1,
|
|
648
648
|
error: "Event name contains invalid characters"
|
|
649
|
-
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(
|
|
649
|
+
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(n.toLowerCase()) ? {
|
|
650
650
|
valid: !1,
|
|
651
651
|
error: "Event name cannot be a reserved word"
|
|
652
|
-
} : { valid: !0 }, De = (
|
|
653
|
-
const r = Ht(e),
|
|
652
|
+
} : { valid: !0 }, De = (n, e, t) => {
|
|
653
|
+
const r = Ht(e), s = t && t === "customEvent" ? `${t} "${n}" metadata error` : `${n} metadata error`;
|
|
654
654
|
if (!Qe(r))
|
|
655
655
|
return {
|
|
656
656
|
valid: !1,
|
|
657
|
-
error: `${
|
|
657
|
+
error: `${s}: object has invalid types. Valid types are string, number, boolean or string arrays.`
|
|
658
658
|
};
|
|
659
659
|
let i;
|
|
660
660
|
try {
|
|
@@ -662,58 +662,58 @@ const kt = () => {
|
|
|
662
662
|
} catch {
|
|
663
663
|
return {
|
|
664
664
|
valid: !1,
|
|
665
|
-
error: `${
|
|
665
|
+
error: `${s}: object contains circular references or cannot be serialized.`
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
668
|
if (i.length > 8192)
|
|
669
669
|
return {
|
|
670
670
|
valid: !1,
|
|
671
|
-
error: `${
|
|
671
|
+
error: `${s}: object is too large (max ${8192 / 1024} KB).`
|
|
672
672
|
};
|
|
673
673
|
if (Object.keys(r).length > 10)
|
|
674
674
|
return {
|
|
675
675
|
valid: !1,
|
|
676
|
-
error: `${
|
|
676
|
+
error: `${s}: object has too many keys (max 10 keys).`
|
|
677
677
|
};
|
|
678
678
|
for (const [l, c] of Object.entries(r)) {
|
|
679
679
|
if (Array.isArray(c)) {
|
|
680
680
|
if (c.length > 10)
|
|
681
681
|
return {
|
|
682
682
|
valid: !1,
|
|
683
|
-
error: `${
|
|
683
|
+
error: `${s}: array property "${l}" is too large (max 10 items).`
|
|
684
684
|
};
|
|
685
685
|
for (const u of c)
|
|
686
686
|
if (typeof u == "string" && u.length > 500)
|
|
687
687
|
return {
|
|
688
688
|
valid: !1,
|
|
689
|
-
error: `${
|
|
689
|
+
error: `${s}: array property "${l}" contains strings that are too long (max 500 characters).`
|
|
690
690
|
};
|
|
691
691
|
}
|
|
692
692
|
if (typeof c == "string" && c.length > 1e3)
|
|
693
693
|
return {
|
|
694
694
|
valid: !1,
|
|
695
|
-
error: `${
|
|
695
|
+
error: `${s}: property "${l}" is too long (max 1000 characters).`
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
698
|
return {
|
|
699
699
|
valid: !0,
|
|
700
700
|
sanitizedMetadata: r
|
|
701
701
|
};
|
|
702
|
-
}, ze = (
|
|
702
|
+
}, ze = (n, e, t) => {
|
|
703
703
|
if (Array.isArray(e)) {
|
|
704
|
-
const r = [],
|
|
704
|
+
const r = [], s = t && t === "customEvent" ? `${t} "${n}" metadata error` : `${n} metadata error`;
|
|
705
705
|
for (let i = 0; i < e.length; i++) {
|
|
706
706
|
const o = e[i];
|
|
707
707
|
if (typeof o != "object" || o === null || Array.isArray(o))
|
|
708
708
|
return {
|
|
709
709
|
valid: !1,
|
|
710
|
-
error: `${
|
|
710
|
+
error: `${s}: array item at index ${i} must be an object.`
|
|
711
711
|
};
|
|
712
|
-
const l = De(
|
|
712
|
+
const l = De(n, o, t);
|
|
713
713
|
if (!l.valid)
|
|
714
714
|
return {
|
|
715
715
|
valid: !1,
|
|
716
|
-
error: `${
|
|
716
|
+
error: `${s}: array item at index ${i} is invalid: ${l.error}`
|
|
717
717
|
};
|
|
718
718
|
l.sanitizedMetadata && r.push(l.sanitizedMetadata);
|
|
719
719
|
}
|
|
@@ -722,19 +722,19 @@ const kt = () => {
|
|
|
722
722
|
sanitizedMetadata: r
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
|
-
return De(
|
|
726
|
-
}, Qt = (
|
|
727
|
-
const t = Xt(
|
|
725
|
+
return De(n, e, t);
|
|
726
|
+
}, Qt = (n, e) => {
|
|
727
|
+
const t = Xt(n);
|
|
728
728
|
if (!t.valid)
|
|
729
729
|
return a("error", "Event name validation failed", {
|
|
730
|
-
data: { eventName:
|
|
730
|
+
data: { eventName: n, error: t.error }
|
|
731
731
|
}), t;
|
|
732
732
|
if (!e)
|
|
733
733
|
return { valid: !0 };
|
|
734
|
-
const r = ze(
|
|
734
|
+
const r = ze(n, e, "customEvent");
|
|
735
735
|
return r.valid || a("error", "Event metadata validation failed", {
|
|
736
736
|
data: {
|
|
737
|
-
eventName:
|
|
737
|
+
eventName: n,
|
|
738
738
|
error: r.error
|
|
739
739
|
}
|
|
740
740
|
}), r;
|
|
@@ -792,8 +792,8 @@ class zt {
|
|
|
792
792
|
off(e, t) {
|
|
793
793
|
const r = this.listeners.get(e);
|
|
794
794
|
if (r) {
|
|
795
|
-
const
|
|
796
|
-
|
|
795
|
+
const s = r.indexOf(t);
|
|
796
|
+
s > -1 && r.splice(s, 1);
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
799
|
/**
|
|
@@ -826,8 +826,8 @@ class zt {
|
|
|
826
826
|
*/
|
|
827
827
|
emit(e, t) {
|
|
828
828
|
const r = this.listeners.get(e);
|
|
829
|
-
r && r.forEach((
|
|
830
|
-
|
|
829
|
+
r && r.forEach((s) => {
|
|
830
|
+
s(t);
|
|
831
831
|
});
|
|
832
832
|
}
|
|
833
833
|
/**
|
|
@@ -856,34 +856,34 @@ class zt {
|
|
|
856
856
|
this.listeners.clear();
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
|
-
function je(
|
|
859
|
+
function je(n, e, t) {
|
|
860
860
|
try {
|
|
861
|
-
const r = e(
|
|
862
|
-
return r === null ? null : typeof r == "object" && r !== null && "type" in r ? r : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`),
|
|
861
|
+
const r = e(n);
|
|
862
|
+
return r === null ? null : typeof r == "object" && r !== null && "type" in r ? r : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), n);
|
|
863
863
|
} catch (r) {
|
|
864
864
|
return a("error", `beforeSend transformer threw error, using original event [${t}]`, {
|
|
865
865
|
error: r,
|
|
866
866
|
visibility: "critical"
|
|
867
|
-
}),
|
|
867
|
+
}), n;
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
function jt(
|
|
871
|
-
return
|
|
870
|
+
function jt(n, e, t) {
|
|
871
|
+
return n.map((r) => je(r, e, t)).filter((r) => r !== null);
|
|
872
872
|
}
|
|
873
|
-
function Ke(
|
|
873
|
+
function Ke(n, e, t) {
|
|
874
874
|
try {
|
|
875
|
-
const r = e(
|
|
875
|
+
const r = e(n);
|
|
876
876
|
return r === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
|
|
877
|
-
data: { eventCount:
|
|
877
|
+
data: { eventCount: n.events.length }
|
|
878
878
|
}), null) : typeof r == "object" && r !== null && Array.isArray(r.events) ? r : (a("warn", `beforeBatch transformer returned invalid data, using original [${t}]`, {
|
|
879
|
-
data: { eventCount:
|
|
880
|
-
}),
|
|
879
|
+
data: { eventCount: n.events.length }
|
|
880
|
+
}), n);
|
|
881
881
|
} catch (r) {
|
|
882
882
|
return a("error", `beforeBatch transformer threw error, using original batch [${t}]`, {
|
|
883
883
|
error: r,
|
|
884
|
-
data: { eventCount:
|
|
884
|
+
data: { eventCount: n.events.length },
|
|
885
885
|
visibility: "critical"
|
|
886
|
-
}),
|
|
886
|
+
}), n;
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
889
|
const te = {};
|
|
@@ -966,10 +966,10 @@ class Ve extends _ {
|
|
|
966
966
|
* @param transformers - Optional event transformation hooks
|
|
967
967
|
* @throws Error if integrationId and apiUrl are not both provided or both undefined
|
|
968
968
|
*/
|
|
969
|
-
constructor(e, t, r,
|
|
969
|
+
constructor(e, t, r, s = {}) {
|
|
970
970
|
if (super(), t && !r || !t && r)
|
|
971
971
|
throw new Error("SenderManager: integrationId and apiUrl must either both be provided or both be undefined");
|
|
972
|
-
this.storeManager = e, this.integrationId = t, this.apiUrl = r, this.transformers =
|
|
972
|
+
this.storeManager = e, this.integrationId = t, this.apiUrl = r, this.transformers = s;
|
|
973
973
|
}
|
|
974
974
|
/**
|
|
975
975
|
* Get the integration ID for this sender
|
|
@@ -1247,8 +1247,8 @@ class Ve extends _ {
|
|
|
1247
1247
|
* @returns Promise that resolves after calculated delay
|
|
1248
1248
|
*/
|
|
1249
1249
|
async backoffDelay(e) {
|
|
1250
|
-
const t = 100 * Math.pow(2, e), r = Math.random() * 100,
|
|
1251
|
-
return new Promise((i) => setTimeout(i,
|
|
1250
|
+
const t = 100 * Math.pow(2, e), r = Math.random() * 100, s = t + r;
|
|
1251
|
+
return new Promise((i) => setTimeout(i, s));
|
|
1252
1252
|
}
|
|
1253
1253
|
/**
|
|
1254
1254
|
* Sends event queue with automatic retry logic for transient failures.
|
|
@@ -1301,10 +1301,10 @@ class Ve extends _ {
|
|
|
1301
1301
|
return a("debug", `Success mode: simulating successful send${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1302
1302
|
data: { events: r.events.length }
|
|
1303
1303
|
}), !0;
|
|
1304
|
-
const { url:
|
|
1304
|
+
const { url: s, payload: i } = this.prepareRequest(r);
|
|
1305
1305
|
for (let o = 1; o <= 3; o++)
|
|
1306
1306
|
try {
|
|
1307
|
-
return (await this.sendWithTimeout(
|
|
1307
|
+
return (await this.sendWithTimeout(s, i)).ok ? (o > 1 && a(
|
|
1308
1308
|
"info",
|
|
1309
1309
|
`Send succeeded after ${o - 1} retry attempt(s)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
|
|
1310
1310
|
{
|
|
@@ -1322,7 +1322,7 @@ class Ve extends _ {
|
|
|
1322
1322
|
error: l,
|
|
1323
1323
|
data: {
|
|
1324
1324
|
events: e.events.length,
|
|
1325
|
-
url:
|
|
1325
|
+
url: s.replace(/\/\/[^/]+/, "//[DOMAIN]"),
|
|
1326
1326
|
attempt: o,
|
|
1327
1327
|
maxAttempts: 3
|
|
1328
1328
|
}
|
|
@@ -1359,7 +1359,7 @@ class Ve extends _ {
|
|
|
1359
1359
|
async sendWithTimeout(e, t) {
|
|
1360
1360
|
const r = new AbortController();
|
|
1361
1361
|
this.pendingControllers.add(r);
|
|
1362
|
-
const
|
|
1362
|
+
const s = setTimeout(() => {
|
|
1363
1363
|
r.abort();
|
|
1364
1364
|
}, 15e3);
|
|
1365
1365
|
try {
|
|
@@ -1377,7 +1377,7 @@ class Ve extends _ {
|
|
|
1377
1377
|
throw i.status >= 400 && i.status < 500 && i.status !== 408 && i.status !== 429 ? new N(`HTTP ${i.status}: ${i.statusText}`, i.status) : new Error(`HTTP ${i.status}: ${i.statusText}`);
|
|
1378
1378
|
return i;
|
|
1379
1379
|
} finally {
|
|
1380
|
-
clearTimeout(
|
|
1380
|
+
clearTimeout(s), this.pendingControllers.delete(r);
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
/**
|
|
@@ -1407,7 +1407,7 @@ class Ve extends _ {
|
|
|
1407
1407
|
const r = this.applyBeforeBatchTransformer(t);
|
|
1408
1408
|
if (!r)
|
|
1409
1409
|
return !0;
|
|
1410
|
-
const { url:
|
|
1410
|
+
const { url: s, payload: i } = this.prepareRequest(r);
|
|
1411
1411
|
if (i.length > 65536)
|
|
1412
1412
|
return a(
|
|
1413
1413
|
"warn",
|
|
@@ -1426,7 +1426,7 @@ class Ve extends _ {
|
|
|
1426
1426
|
"warn",
|
|
1427
1427
|
`sendBeacon not available, persisting events for recovery${this.integrationId ? ` [${this.integrationId}]` : ""}`
|
|
1428
1428
|
), this.persistEvents(r), !1;
|
|
1429
|
-
const l = navigator.sendBeacon(
|
|
1429
|
+
const l = navigator.sendBeacon(s, o);
|
|
1430
1430
|
return l || (a(
|
|
1431
1431
|
"warn",
|
|
1432
1432
|
`sendBeacon rejected request, persisting events for recovery${this.integrationId ? ` [${this.integrationId}]` : ""}`
|
|
@@ -1551,8 +1551,8 @@ class Ve extends _ {
|
|
|
1551
1551
|
const r = {
|
|
1552
1552
|
...e,
|
|
1553
1553
|
timestamp: Date.now()
|
|
1554
|
-
},
|
|
1555
|
-
return this.storeManager.setItem(
|
|
1554
|
+
}, s = this.getQueueStorageKey();
|
|
1555
|
+
return this.storeManager.setItem(s, JSON.stringify(r)), !!this.storeManager.getItem(s);
|
|
1556
1556
|
} catch (t) {
|
|
1557
1557
|
return a("debug", `Failed to persist events${this.integrationId ? ` [${this.integrationId}]` : ""}`, { error: t }), !1;
|
|
1558
1558
|
}
|
|
@@ -1711,10 +1711,10 @@ class Kt extends _ {
|
|
|
1711
1711
|
* ```
|
|
1712
1712
|
*/
|
|
1713
1713
|
validateTimestamp(e) {
|
|
1714
|
-
const r = this.now(),
|
|
1715
|
-
return
|
|
1714
|
+
const r = this.now(), s = e - r;
|
|
1715
|
+
return s > 12e4 ? {
|
|
1716
1716
|
valid: !1,
|
|
1717
|
-
error: `Timestamp is ${(
|
|
1717
|
+
error: `Timestamp is ${(s / 1e3 / 60).toFixed(2)} minutes in the future (max allowed: 2 minutes)`
|
|
1718
1718
|
} : { valid: !0 };
|
|
1719
1719
|
}
|
|
1720
1720
|
/**
|
|
@@ -1768,8 +1768,8 @@ class Yt extends _ {
|
|
|
1768
1768
|
*/
|
|
1769
1769
|
constructor(e, t = null, r = {}) {
|
|
1770
1770
|
super(), this.emitter = t, this.transformers = r, this.timeManager = new Kt(), this.dataSenders = [];
|
|
1771
|
-
const
|
|
1772
|
-
|
|
1771
|
+
const s = this.get("collectApiUrls");
|
|
1772
|
+
s?.saas && this.dataSenders.push(new Ve(e, "saas", s.saas, r)), s?.custom && this.dataSenders.push(new Ve(e, "custom", s.custom, r)), this.saveSessionCountsDebounced = this.debounce((i) => {
|
|
1773
1773
|
this.saveSessionCounts(i);
|
|
1774
1774
|
}, 500), this.cleanupExpiredSessionCounts();
|
|
1775
1775
|
}
|
|
@@ -1800,9 +1800,9 @@ class Yt extends _ {
|
|
|
1800
1800
|
async recoverPersistedEvents() {
|
|
1801
1801
|
const e = this.dataSenders.map(
|
|
1802
1802
|
async (t) => t.recoverPersistedEvents({
|
|
1803
|
-
onSuccess: (r,
|
|
1804
|
-
if (
|
|
1805
|
-
const o =
|
|
1803
|
+
onSuccess: (r, s, i) => {
|
|
1804
|
+
if (s && s.length > 0) {
|
|
1805
|
+
const o = s.map((l) => l.id);
|
|
1806
1806
|
this.removeProcessedEvents(o), i && this.emitEventsQueue(i);
|
|
1807
1807
|
}
|
|
1808
1808
|
},
|
|
@@ -1876,7 +1876,7 @@ class Yt extends _ {
|
|
|
1876
1876
|
type: e,
|
|
1877
1877
|
page_url: t,
|
|
1878
1878
|
from_page_url: r,
|
|
1879
|
-
scroll_data:
|
|
1879
|
+
scroll_data: s,
|
|
1880
1880
|
click_data: i,
|
|
1881
1881
|
custom_event: o,
|
|
1882
1882
|
web_vitals: l,
|
|
@@ -1896,7 +1896,7 @@ class Yt extends _ {
|
|
|
1896
1896
|
type: e,
|
|
1897
1897
|
page_url: t,
|
|
1898
1898
|
from_page_url: r,
|
|
1899
|
-
scroll_data:
|
|
1899
|
+
scroll_data: s,
|
|
1900
1900
|
click_data: i,
|
|
1901
1901
|
custom_event: o,
|
|
1902
1902
|
web_vitals: l,
|
|
@@ -1944,11 +1944,11 @@ class Yt extends _ {
|
|
|
1944
1944
|
if (!this.checkPerEventRateLimit(o.name, T))
|
|
1945
1945
|
return;
|
|
1946
1946
|
}
|
|
1947
|
-
const
|
|
1947
|
+
const F = p === d.SESSION_START, nt = t || this.get("pageUrl"), D = this.buildEventPayload({
|
|
1948
1948
|
type: p,
|
|
1949
|
-
page_url:
|
|
1949
|
+
page_url: nt,
|
|
1950
1950
|
from_page_url: r,
|
|
1951
|
-
scroll_data:
|
|
1951
|
+
scroll_data: s,
|
|
1952
1952
|
click_data: i,
|
|
1953
1953
|
custom_event: o,
|
|
1954
1954
|
web_vitals: l,
|
|
@@ -1957,7 +1957,7 @@ class Yt extends _ {
|
|
|
1957
1957
|
page_view: S
|
|
1958
1958
|
});
|
|
1959
1959
|
if (D && !(!E && !this.shouldSample())) {
|
|
1960
|
-
if (
|
|
1960
|
+
if (F) {
|
|
1961
1961
|
const T = this.get("sessionId");
|
|
1962
1962
|
if (!T) {
|
|
1963
1963
|
a("error", "Session start event requires sessionId - event will be ignored");
|
|
@@ -2246,13 +2246,13 @@ class Yt extends _ {
|
|
|
2246
2246
|
flushEvents(e) {
|
|
2247
2247
|
if (this.eventsQueue.length === 0)
|
|
2248
2248
|
return e ? !0 : Promise.resolve(!0);
|
|
2249
|
-
const t = this.buildEventsPayload(), r = [...this.eventsQueue],
|
|
2249
|
+
const t = this.buildEventsPayload(), r = [...this.eventsQueue], s = r.map((i) => i.id);
|
|
2250
2250
|
if (this.dataSenders.length === 0)
|
|
2251
|
-
return this.removeProcessedEvents(
|
|
2251
|
+
return this.removeProcessedEvents(s), this.clearSendInterval(), this.emitEventsQueue(t), e ? !0 : Promise.resolve(!0);
|
|
2252
2252
|
if (e) {
|
|
2253
2253
|
const o = this.dataSenders.map((l) => l.sendEventsQueueSync(t)).some((l) => l);
|
|
2254
|
-
return o ? (this.removeProcessedEvents(
|
|
2255
|
-
data: { eventCount:
|
|
2254
|
+
return o ? (this.removeProcessedEvents(s), this.clearSendInterval(), this.emitEventsQueue(t)) : (this.clearSendInterval(), a("debug", "Sync flush complete failure, events kept in queue for retry", {
|
|
2255
|
+
data: { eventCount: s.length }
|
|
2256
2256
|
})), o;
|
|
2257
2257
|
} else {
|
|
2258
2258
|
const i = this.dataSenders.map(
|
|
@@ -2265,7 +2265,7 @@ class Yt extends _ {
|
|
|
2265
2265
|
);
|
|
2266
2266
|
return Promise.allSettled(i).then((o) => {
|
|
2267
2267
|
const l = o.some((c) => this.isSuccessfulResult(c));
|
|
2268
|
-
return l ? (this.removeProcessedEvents(
|
|
2268
|
+
return l ? (this.removeProcessedEvents(s), this.clearSendInterval(), this.emitEventsQueue(t)) : a("debug", "Async flush complete failure, events kept in queue for retry", {
|
|
2269
2269
|
data: { eventCount: r.length }
|
|
2270
2270
|
}), l;
|
|
2271
2271
|
});
|
|
@@ -2279,14 +2279,14 @@ class Yt extends _ {
|
|
|
2279
2279
|
this.emitEventsQueue(e);
|
|
2280
2280
|
return;
|
|
2281
2281
|
}
|
|
2282
|
-
const t = [...this.eventsQueue], r = t.map((l) => l.id),
|
|
2282
|
+
const t = [...this.eventsQueue], r = t.map((l) => l.id), s = this.dataSenders.map(
|
|
2283
2283
|
async (l) => l.sendEventsQueue(e, {
|
|
2284
2284
|
onSuccess: () => {
|
|
2285
2285
|
},
|
|
2286
2286
|
onFailure: () => {
|
|
2287
2287
|
}
|
|
2288
2288
|
})
|
|
2289
|
-
), i = await Promise.allSettled(
|
|
2289
|
+
), i = await Promise.allSettled(s);
|
|
2290
2290
|
if (i.some((l) => this.isSuccessfulResult(l))) {
|
|
2291
2291
|
this.removeProcessedEvents(r), this.emitEventsQueue(e);
|
|
2292
2292
|
const l = i.filter((c) => !this.isSuccessfulResult(c)).length;
|
|
@@ -2306,7 +2306,7 @@ class Yt extends _ {
|
|
|
2306
2306
|
e.has(u) || t.push(u), e.set(u, c);
|
|
2307
2307
|
}
|
|
2308
2308
|
const r = 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);
|
|
2309
|
-
let
|
|
2309
|
+
let s = {
|
|
2310
2310
|
user_id: this.get("userId"),
|
|
2311
2311
|
session_id: this.get("sessionId"),
|
|
2312
2312
|
device: this.get("device"),
|
|
@@ -2315,13 +2315,13 @@ class Yt extends _ {
|
|
|
2315
2315
|
};
|
|
2316
2316
|
const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
|
|
2317
2317
|
if (!o && l) {
|
|
2318
|
-
const c = Ke(
|
|
2319
|
-
c !== null && (
|
|
2318
|
+
const c = Ke(s, l, "EventManager");
|
|
2319
|
+
c !== null && (s = c);
|
|
2320
2320
|
}
|
|
2321
|
-
return
|
|
2321
|
+
return s;
|
|
2322
2322
|
}
|
|
2323
2323
|
buildEventPayload(e) {
|
|
2324
|
-
const t = e.type === d.SESSION_START, r = e.page_url ?? this.get("pageUrl"),
|
|
2324
|
+
const t = e.type === d.SESSION_START, r = e.page_url ?? this.get("pageUrl"), s = this.timeManager.now(), i = this.timeManager.validateTimestamp(s);
|
|
2325
2325
|
i.valid || a("warn", "Event timestamp validation failed", {
|
|
2326
2326
|
data: { type: e.type, error: i.error }
|
|
2327
2327
|
});
|
|
@@ -2329,8 +2329,8 @@ class Yt extends _ {
|
|
|
2329
2329
|
id: kt(),
|
|
2330
2330
|
type: e.type,
|
|
2331
2331
|
page_url: r,
|
|
2332
|
-
timestamp:
|
|
2333
|
-
...t && { referrer:
|
|
2332
|
+
timestamp: s,
|
|
2333
|
+
...t && { referrer: this.getExternalReferrer() },
|
|
2334
2334
|
...e.from_page_url && { from_page_url: e.from_page_url },
|
|
2335
2335
|
...e.scroll_data && { scroll_data: e.scroll_data },
|
|
2336
2336
|
...e.click_data && { click_data: e.click_data },
|
|
@@ -2343,23 +2343,23 @@ class Yt extends _ {
|
|
|
2343
2343
|
};
|
|
2344
2344
|
const l = this.get("collectApiUrls"), c = !!l?.custom, u = !!l?.saas, S = c || u, g = c && u, E = this.transformers.beforeSend;
|
|
2345
2345
|
if (E && (!S || c && !g)) {
|
|
2346
|
-
const
|
|
2347
|
-
if (
|
|
2346
|
+
const F = je(o, E, "EventManager");
|
|
2347
|
+
if (F === null)
|
|
2348
2348
|
return null;
|
|
2349
|
-
o =
|
|
2349
|
+
o = F;
|
|
2350
2350
|
}
|
|
2351
2351
|
return o;
|
|
2352
2352
|
}
|
|
2353
2353
|
isDuplicateEvent(e) {
|
|
2354
|
-
const t = Date.now(), r = this.createEventFingerprint(e),
|
|
2355
|
-
return
|
|
2354
|
+
const t = Date.now(), r = this.createEventFingerprint(e), s = this.recentEventFingerprints.get(r);
|
|
2355
|
+
return s && t - s < 1e3 ? (this.recentEventFingerprints.set(r, t), !0) : (this.recentEventFingerprints.set(r, t), this.recentEventFingerprints.size > 1500 && this.pruneOldFingerprints(), this.recentEventFingerprints.size > 3e3 && (this.recentEventFingerprints.clear(), this.recentEventFingerprints.set(r, t), a("debug", "Event fingerprint cache exceeded hard limit, cleared", {
|
|
2356
2356
|
data: { hardLimit: 3e3 }
|
|
2357
2357
|
})), !1);
|
|
2358
2358
|
}
|
|
2359
2359
|
pruneOldFingerprints() {
|
|
2360
2360
|
const e = Date.now(), t = 1e3 * 10;
|
|
2361
|
-
for (const [r,
|
|
2362
|
-
e -
|
|
2361
|
+
for (const [r, s] of this.recentEventFingerprints.entries())
|
|
2362
|
+
e - s > t && this.recentEventFingerprints.delete(r);
|
|
2363
2363
|
a("debug", "Pruned old event fingerprints", {
|
|
2364
2364
|
data: {
|
|
2365
2365
|
remaining: this.recentEventFingerprints.size,
|
|
@@ -2370,8 +2370,8 @@ class Yt extends _ {
|
|
|
2370
2370
|
createEventFingerprint(e) {
|
|
2371
2371
|
let t = `${e.type}_${e.page_url}`;
|
|
2372
2372
|
if (e.click_data) {
|
|
2373
|
-
const r = Math.round((e.click_data.x || 0) / 10) * 10,
|
|
2374
|
-
t += `_click_${r}_${
|
|
2373
|
+
const r = Math.round((e.click_data.x || 0) / 10) * 10, s = Math.round((e.click_data.y || 0) / 10) * 10;
|
|
2374
|
+
t += `_click_${r}_${s}`;
|
|
2375
2375
|
}
|
|
2376
2376
|
return e.scroll_data && (t += `_scroll_${e.scroll_data.depth}_${e.scroll_data.direction}`), e.custom_event && (t += `_custom_${e.custom_event.name}`), e.web_vitals && (t += `_vitals_${e.web_vitals.type}`), e.error_data && (t += `_error_${e.error_data.type}_${e.error_data.message}`), t;
|
|
2377
2377
|
}
|
|
@@ -2380,7 +2380,7 @@ class Yt extends _ {
|
|
|
2380
2380
|
}
|
|
2381
2381
|
addToQueue(e) {
|
|
2382
2382
|
if (this.emitEvent(e), this.eventsQueue.push(e), this.eventsQueue.length > 100) {
|
|
2383
|
-
const t = this.eventsQueue.findIndex((
|
|
2383
|
+
const t = this.eventsQueue.findIndex((s) => s.type !== d.SESSION_START), r = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();
|
|
2384
2384
|
a("warn", "Event queue overflow, oldest non-critical event removed", {
|
|
2385
2385
|
data: {
|
|
2386
2386
|
maxLength: 100,
|
|
@@ -2429,10 +2429,10 @@ class Yt extends _ {
|
|
|
2429
2429
|
this.eventsQueue = this.eventsQueue.filter((r) => !t.has(r.id));
|
|
2430
2430
|
}
|
|
2431
2431
|
emitEvent(e) {
|
|
2432
|
-
this.emitter && this.emitter.emit(
|
|
2432
|
+
this.emitter && this.emitter.emit(se.EVENT, e);
|
|
2433
2433
|
}
|
|
2434
2434
|
emitEventsQueue(e) {
|
|
2435
|
-
this.emitter && this.emitter.emit(
|
|
2435
|
+
this.emitter && this.emitter.emit(se.QUEUE, e);
|
|
2436
2436
|
}
|
|
2437
2437
|
/**
|
|
2438
2438
|
* Creates a debounced version of a function that delays execution until after
|
|
@@ -2456,9 +2456,9 @@ class Yt extends _ {
|
|
|
2456
2456
|
*/
|
|
2457
2457
|
debounce(e, t) {
|
|
2458
2458
|
let r = null;
|
|
2459
|
-
return ((...
|
|
2459
|
+
return ((...s) => {
|
|
2460
2460
|
r !== null && clearTimeout(r), r = setTimeout(() => {
|
|
2461
|
-
e(...
|
|
2461
|
+
e(...s), r = null;
|
|
2462
2462
|
}, t);
|
|
2463
2463
|
});
|
|
2464
2464
|
}
|
|
@@ -2510,10 +2510,10 @@ class Yt extends _ {
|
|
|
2510
2510
|
return this.getInitialCounts();
|
|
2511
2511
|
const t = this.get("userId") || "anonymous", r = Ie(t, e);
|
|
2512
2512
|
try {
|
|
2513
|
-
const
|
|
2514
|
-
if (!
|
|
2513
|
+
const s = localStorage.getItem(r);
|
|
2514
|
+
if (!s)
|
|
2515
2515
|
return this.getInitialCounts();
|
|
2516
|
-
const i = JSON.parse(
|
|
2516
|
+
const i = JSON.parse(s);
|
|
2517
2517
|
return i._timestamp && Date.now() - i._timestamp > we ? (a("debug", "Session counts expired, clearing", {
|
|
2518
2518
|
data: { sessionId: e, age: Date.now() - i._timestamp }
|
|
2519
2519
|
}), localStorage.removeItem(r), 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" ? {
|
|
@@ -2528,9 +2528,9 @@ class Yt extends _ {
|
|
|
2528
2528
|
}), localStorage.removeItem(r), a("debug", "Session counts removed due to invalid/corrupted data", {
|
|
2529
2529
|
data: { sessionId: e, parsed: i }
|
|
2530
2530
|
}), this.getInitialCounts());
|
|
2531
|
-
} catch (
|
|
2531
|
+
} catch (s) {
|
|
2532
2532
|
return a("warn", "Failed to load session counts from localStorage", {
|
|
2533
|
-
error:
|
|
2533
|
+
error: s,
|
|
2534
2534
|
data: { sessionId: e }
|
|
2535
2535
|
}), this.getInitialCounts();
|
|
2536
2536
|
}
|
|
@@ -2569,7 +2569,7 @@ class Yt extends _ {
|
|
|
2569
2569
|
return;
|
|
2570
2570
|
}
|
|
2571
2571
|
}
|
|
2572
|
-
const t = this.get("userId") || "anonymous", r = `${I}:${t}:session_counts:`,
|
|
2572
|
+
const t = this.get("userId") || "anonymous", r = `${I}:${t}:session_counts:`, s = [];
|
|
2573
2573
|
for (let i = 0; i < localStorage.length; i++) {
|
|
2574
2574
|
const o = localStorage.key(i);
|
|
2575
2575
|
if (o?.startsWith(r))
|
|
@@ -2577,18 +2577,64 @@ class Yt extends _ {
|
|
|
2577
2577
|
const l = localStorage.getItem(o);
|
|
2578
2578
|
if (l) {
|
|
2579
2579
|
const c = JSON.parse(l);
|
|
2580
|
-
c._timestamp && Date.now() - c._timestamp > we &&
|
|
2580
|
+
c._timestamp && Date.now() - c._timestamp > we && s.push(o);
|
|
2581
2581
|
}
|
|
2582
2582
|
} catch {
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
|
-
|
|
2585
|
+
s.forEach((i) => {
|
|
2586
2586
|
localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
|
|
2587
|
-
}),
|
|
2587
|
+
}), s.length > 0 && a("info", `Cleaned up ${s.length} expired session counts entries`), localStorage.setItem(ye, Date.now().toString());
|
|
2588
2588
|
} catch (e) {
|
|
2589
2589
|
a("warn", "Failed to cleanup expired session counts", { error: e });
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
|
+
/**
|
|
2593
|
+
* Returns the referrer if it's external, or 'Direct' if internal/empty.
|
|
2594
|
+
*
|
|
2595
|
+
* **Purpose**: Filter out internal referrers (same domain) to ensure
|
|
2596
|
+
* accurate traffic source attribution. Internal referrers occur when:
|
|
2597
|
+
* - Session expires and user navigates within the same site
|
|
2598
|
+
* - User opens new tab from an internal link
|
|
2599
|
+
* - Page refresh after session timeout
|
|
2600
|
+
*
|
|
2601
|
+
* **Logic**:
|
|
2602
|
+
* - Empty referrer → 'Direct'
|
|
2603
|
+
* - Referrer from same domain or subdomain → 'Direct' (internal navigation)
|
|
2604
|
+
* - External referrer → Returns original referrer
|
|
2605
|
+
*
|
|
2606
|
+
* **Subdomain Detection**:
|
|
2607
|
+
* - `www.example.com` → `example.com` ✓ (internal)
|
|
2608
|
+
* - `blog.example.com` → `example.com` ✓ (internal)
|
|
2609
|
+
* - `example.com` → `www.example.com` ✓ (internal)
|
|
2610
|
+
*
|
|
2611
|
+
* @returns External referrer URL or 'Direct'
|
|
2612
|
+
*
|
|
2613
|
+
* @internal
|
|
2614
|
+
*/
|
|
2615
|
+
getExternalReferrer() {
|
|
2616
|
+
const e = document.referrer;
|
|
2617
|
+
if (!e)
|
|
2618
|
+
return "Direct";
|
|
2619
|
+
try {
|
|
2620
|
+
const t = new URL(e).hostname.toLowerCase(), r = window.location.hostname.toLowerCase();
|
|
2621
|
+
return this.isSameDomain(t, r) ? "Direct" : e;
|
|
2622
|
+
} catch {
|
|
2623
|
+
return e || "Direct";
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
/**
|
|
2627
|
+
* Checks if two hostnames belong to the same domain (including subdomains).
|
|
2628
|
+
*
|
|
2629
|
+
* @param hostname1 - First hostname (e.g., 'www.example.com')
|
|
2630
|
+
* @param hostname2 - Second hostname (e.g., 'example.com')
|
|
2631
|
+
* @returns true if same domain or subdomain relationship exists
|
|
2632
|
+
*
|
|
2633
|
+
* @internal
|
|
2634
|
+
*/
|
|
2635
|
+
isSameDomain(e, t) {
|
|
2636
|
+
return e === t ? !0 : e.endsWith(`.${t}`) || t.endsWith(`.${e}`);
|
|
2637
|
+
}
|
|
2592
2638
|
/**
|
|
2593
2639
|
* Persists current session event counts to localStorage (debounced).
|
|
2594
2640
|
*
|
|
@@ -2620,15 +2666,15 @@ class Yt extends _ {
|
|
|
2620
2666
|
saveSessionCounts(e) {
|
|
2621
2667
|
const t = this.get("userId") || "anonymous", r = Ie(t, e);
|
|
2622
2668
|
try {
|
|
2623
|
-
const
|
|
2669
|
+
const s = {
|
|
2624
2670
|
...this.sessionEventCounts,
|
|
2625
2671
|
_timestamp: Date.now(),
|
|
2626
2672
|
_version: 1
|
|
2627
2673
|
};
|
|
2628
|
-
localStorage.setItem(r, JSON.stringify(
|
|
2629
|
-
} catch (
|
|
2674
|
+
localStorage.setItem(r, JSON.stringify(s));
|
|
2675
|
+
} catch (s) {
|
|
2630
2676
|
a("warn", "Failed to persist session counts to localStorage", {
|
|
2631
|
-
error:
|
|
2677
|
+
error: s,
|
|
2632
2678
|
data: { sessionId: e }
|
|
2633
2679
|
});
|
|
2634
2680
|
}
|
|
@@ -2686,8 +2732,8 @@ class Zt extends _ {
|
|
|
2686
2732
|
}
|
|
2687
2733
|
const e = this.getProjectId();
|
|
2688
2734
|
this.broadcastChannel = new BroadcastChannel(ut(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2689
|
-
const { action: r, sessionId:
|
|
2690
|
-
o === e && (r === "session_start" &&
|
|
2735
|
+
const { action: r, sessionId: s, timestamp: i, projectId: o } = t.data ?? {};
|
|
2736
|
+
o === e && (r === "session_start" && s && typeof i == "number" && i > Date.now() - 5e3 ? (this.set("sessionId", s), this.persistSession(s, i), this.isTracking && this.setupSessionTimeout()) : r && r !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: r } }));
|
|
2691
2737
|
};
|
|
2692
2738
|
}
|
|
2693
2739
|
shareSession(e) {
|
|
@@ -3052,8 +3098,8 @@ class tr extends _ {
|
|
|
3052
3098
|
const e = window.location.href, t = le(e, this.get("config").sensitiveQueryParams);
|
|
3053
3099
|
if (this.get("pageUrl") === t)
|
|
3054
3100
|
return;
|
|
3055
|
-
const r = Date.now(),
|
|
3056
|
-
if (r - this.lastPageViewTime <
|
|
3101
|
+
const r = Date.now(), s = this.get("config").pageViewThrottleMs ?? 1e3;
|
|
3102
|
+
if (r - this.lastPageViewTime < s)
|
|
3057
3103
|
return;
|
|
3058
3104
|
this.lastPageViewTime = r, this.onTrack();
|
|
3059
3105
|
const i = this.get("pageUrl");
|
|
@@ -3075,9 +3121,9 @@ class tr extends _ {
|
|
|
3075
3121
|
}), this.onTrack();
|
|
3076
3122
|
}
|
|
3077
3123
|
extractPageViewData() {
|
|
3078
|
-
const { pathname: e, search: t, hash: r } = window.location, { referrer:
|
|
3079
|
-
return !
|
|
3080
|
-
...
|
|
3124
|
+
const { pathname: e, search: t, hash: r } = window.location, { referrer: s } = document, { title: i } = document;
|
|
3125
|
+
return !s && !i && !e && !t && !r ? void 0 : {
|
|
3126
|
+
...s && { referrer: s },
|
|
3081
3127
|
...i && { title: i },
|
|
3082
3128
|
...e && { pathname: e },
|
|
3083
3129
|
...t && { search: t },
|
|
@@ -3108,17 +3154,17 @@ class rr extends _ {
|
|
|
3108
3154
|
*/
|
|
3109
3155
|
startTracking() {
|
|
3110
3156
|
this.clickHandler || (this.clickHandler = (e) => {
|
|
3111
|
-
const t = e, r = t.target,
|
|
3112
|
-
if (!
|
|
3157
|
+
const t = e, r = t.target, s = typeof HTMLElement < "u" && r instanceof HTMLElement ? r : typeof HTMLElement < "u" && r instanceof Node && r.parentElement instanceof HTMLElement ? r.parentElement : null;
|
|
3158
|
+
if (!s) {
|
|
3113
3159
|
a("debug", "Click target not found or not an element");
|
|
3114
3160
|
return;
|
|
3115
3161
|
}
|
|
3116
|
-
if (this.shouldIgnoreElement(
|
|
3162
|
+
if (this.shouldIgnoreElement(s))
|
|
3117
3163
|
return;
|
|
3118
3164
|
const i = this.get("config")?.clickThrottleMs ?? 300;
|
|
3119
|
-
if (i > 0 && !this.checkClickThrottle(
|
|
3165
|
+
if (i > 0 && !this.checkClickThrottle(s, i))
|
|
3120
3166
|
return;
|
|
3121
|
-
const o = this.findTrackingElement(
|
|
3167
|
+
const o = this.findTrackingElement(s), l = this.getRelevantClickElement(s), c = this.calculateClickCoordinates(t, s);
|
|
3122
3168
|
if (o) {
|
|
3123
3169
|
const S = this.extractTrackingData(o);
|
|
3124
3170
|
if (S) {
|
|
@@ -3132,7 +3178,7 @@ class rr extends _ {
|
|
|
3132
3178
|
});
|
|
3133
3179
|
}
|
|
3134
3180
|
}
|
|
3135
|
-
const u = this.generateClickData(
|
|
3181
|
+
const u = this.generateClickData(s, l, c);
|
|
3136
3182
|
this.eventManager.track({
|
|
3137
3183
|
type: d.CLICK,
|
|
3138
3184
|
click_data: u
|
|
@@ -3156,15 +3202,15 @@ class rr extends _ {
|
|
|
3156
3202
|
* Returns true if the click should be tracked, false if throttled
|
|
3157
3203
|
*/
|
|
3158
3204
|
checkClickThrottle(e, t) {
|
|
3159
|
-
const r = this.getElementSignature(e),
|
|
3160
|
-
this.pruneThrottleCache(
|
|
3205
|
+
const r = this.getElementSignature(e), s = Date.now();
|
|
3206
|
+
this.pruneThrottleCache(s);
|
|
3161
3207
|
const i = this.lastClickTimes.get(r);
|
|
3162
|
-
return i !== void 0 &&
|
|
3208
|
+
return i !== void 0 && s - i < t ? (a("debug", "ClickHandler: Click suppressed by throttle", {
|
|
3163
3209
|
data: {
|
|
3164
3210
|
signature: r,
|
|
3165
|
-
throttleRemaining: t - (
|
|
3211
|
+
throttleRemaining: t - (s - i)
|
|
3166
3212
|
}
|
|
3167
|
-
}), !1) : (this.lastClickTimes.set(r,
|
|
3213
|
+
}), !1) : (this.lastClickTimes.set(r, s), !0);
|
|
3168
3214
|
}
|
|
3169
3215
|
/**
|
|
3170
3216
|
* Prunes stale entries from the throttle cache to prevent memory leaks
|
|
@@ -3176,10 +3222,10 @@ class rr extends _ {
|
|
|
3176
3222
|
return;
|
|
3177
3223
|
this.lastPruneTime = e;
|
|
3178
3224
|
const t = e - 3e5;
|
|
3179
|
-
for (const [r,
|
|
3180
|
-
|
|
3225
|
+
for (const [r, s] of this.lastClickTimes.entries())
|
|
3226
|
+
s < t && this.lastClickTimes.delete(r);
|
|
3181
3227
|
if (this.lastClickTimes.size > 1e3) {
|
|
3182
|
-
const r = Array.from(this.lastClickTimes.entries()).sort((o, l) => o[1] - l[1]),
|
|
3228
|
+
const r = Array.from(this.lastClickTimes.entries()).sort((o, l) => o[1] - l[1]), s = this.lastClickTimes.size - 1e3, i = r.slice(0, s);
|
|
3183
3229
|
for (const [o] of i)
|
|
3184
3230
|
this.lastClickTimes.delete(o);
|
|
3185
3231
|
a("debug", "ClickHandler: Pruned throttle cache", {
|
|
@@ -3210,12 +3256,12 @@ class rr extends _ {
|
|
|
3210
3256
|
const t = [];
|
|
3211
3257
|
let r = e;
|
|
3212
3258
|
for (; r && r !== document.body; ) {
|
|
3213
|
-
let
|
|
3259
|
+
let s = r.tagName.toLowerCase();
|
|
3214
3260
|
if (r.className) {
|
|
3215
3261
|
const i = r.className.split(" ")[0];
|
|
3216
|
-
i && (
|
|
3262
|
+
i && (s += `.${i}`);
|
|
3217
3263
|
}
|
|
3218
|
-
t.unshift(
|
|
3264
|
+
t.unshift(s), r = r.parentElement;
|
|
3219
3265
|
}
|
|
3220
3266
|
return t.join(">") || "unknown";
|
|
3221
3267
|
}
|
|
@@ -3223,7 +3269,7 @@ class rr extends _ {
|
|
|
3223
3269
|
return e.hasAttribute(`${w}-name`) ? e : e.closest(`[${w}-name]`);
|
|
3224
3270
|
}
|
|
3225
3271
|
getRelevantClickElement(e) {
|
|
3226
|
-
for (const t of
|
|
3272
|
+
for (const t of st)
|
|
3227
3273
|
try {
|
|
3228
3274
|
if (e.matches(t))
|
|
3229
3275
|
return e;
|
|
@@ -3251,8 +3297,8 @@ class rr extends _ {
|
|
|
3251
3297
|
return Math.max(0, Math.min(1, Number(e.toFixed(3))));
|
|
3252
3298
|
}
|
|
3253
3299
|
calculateClickCoordinates(e, t) {
|
|
3254
|
-
const r = t.getBoundingClientRect(),
|
|
3255
|
-
return { x:
|
|
3300
|
+
const r = t.getBoundingClientRect(), s = e.clientX, i = e.clientY, o = r.width > 0 ? this.clamp((s - r.left) / r.width) : 0, l = r.height > 0 ? this.clamp((i - r.top) / r.height) : 0;
|
|
3301
|
+
return { x: s, y: i, relativeX: o, relativeY: l };
|
|
3256
3302
|
}
|
|
3257
3303
|
extractTrackingData(e) {
|
|
3258
3304
|
const t = e.getAttribute(`${w}-name`), r = e.getAttribute(`${w}-value`);
|
|
@@ -3264,9 +3310,9 @@ class rr extends _ {
|
|
|
3264
3310
|
};
|
|
3265
3311
|
}
|
|
3266
3312
|
generateClickData(e, t, r) {
|
|
3267
|
-
const { x:
|
|
3313
|
+
const { x: s, y: i, relativeX: o, relativeY: l } = r, c = this.getRelevantText(e, t), u = this.extractElementAttributes(t);
|
|
3268
3314
|
return {
|
|
3269
|
-
x:
|
|
3315
|
+
x: s,
|
|
3270
3316
|
y: i,
|
|
3271
3317
|
relativeX: o,
|
|
3272
3318
|
relativeY: l,
|
|
@@ -3304,17 +3350,17 @@ class rr extends _ {
|
|
|
3304
3350
|
sanitizeText(e) {
|
|
3305
3351
|
let t = e;
|
|
3306
3352
|
for (const r of Be) {
|
|
3307
|
-
const
|
|
3308
|
-
t = t.replace(
|
|
3353
|
+
const s = new RegExp(r.source, r.flags);
|
|
3354
|
+
t = t.replace(s, "[REDACTED]");
|
|
3309
3355
|
}
|
|
3310
3356
|
return t;
|
|
3311
3357
|
}
|
|
3312
3358
|
getRelevantText(e, t) {
|
|
3313
|
-
const r = e.textContent?.trim() ?? "",
|
|
3314
|
-
if (!r && !
|
|
3359
|
+
const r = e.textContent?.trim() ?? "", s = t.textContent?.trim() ?? "";
|
|
3360
|
+
if (!r && !s)
|
|
3315
3361
|
return "";
|
|
3316
3362
|
let i = "";
|
|
3317
|
-
return r && r.length <= 255 ? i = r :
|
|
3363
|
+
return r && r.length <= 255 ? i = r : s.length <= 255 ? i = s : i = s.slice(0, 252) + "...", this.sanitizeText(i);
|
|
3318
3364
|
}
|
|
3319
3365
|
extractElementAttributes(e) {
|
|
3320
3366
|
const t = [
|
|
@@ -3329,9 +3375,9 @@ class rr extends _ {
|
|
|
3329
3375
|
"alt",
|
|
3330
3376
|
"role"
|
|
3331
3377
|
], r = {};
|
|
3332
|
-
for (const
|
|
3333
|
-
const i = e.getAttribute(
|
|
3334
|
-
i && (r[
|
|
3378
|
+
for (const s of t) {
|
|
3379
|
+
const i = e.getAttribute(s);
|
|
3380
|
+
i && (r[s] = i);
|
|
3335
3381
|
}
|
|
3336
3382
|
return r;
|
|
3337
3383
|
}
|
|
@@ -3342,7 +3388,7 @@ class rr extends _ {
|
|
|
3342
3388
|
};
|
|
3343
3389
|
}
|
|
3344
3390
|
}
|
|
3345
|
-
class
|
|
3391
|
+
class nr extends _ {
|
|
3346
3392
|
eventManager;
|
|
3347
3393
|
containers = [];
|
|
3348
3394
|
limitWarningLogged = !1;
|
|
@@ -3389,8 +3435,8 @@ class sr extends _ {
|
|
|
3389
3435
|
const t = this.findScrollableElements();
|
|
3390
3436
|
if (this.isWindowScrollable() && this.setupScrollContainer(window, "window"), t.length > 0) {
|
|
3391
3437
|
for (const r of t) {
|
|
3392
|
-
const
|
|
3393
|
-
this.setupScrollContainer(r,
|
|
3438
|
+
const s = this.getElementSelector(r);
|
|
3439
|
+
this.setupScrollContainer(r, s);
|
|
3394
3440
|
}
|
|
3395
3441
|
this.applyPrimaryScrollSelectorIfConfigured();
|
|
3396
3442
|
return;
|
|
@@ -3411,8 +3457,8 @@ class sr extends _ {
|
|
|
3411
3457
|
if (!document.body)
|
|
3412
3458
|
return [];
|
|
3413
3459
|
const e = [], t = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, {
|
|
3414
|
-
acceptNode: (
|
|
3415
|
-
const i =
|
|
3460
|
+
acceptNode: (s) => {
|
|
3461
|
+
const i = s;
|
|
3416
3462
|
if (!i.isConnected || !i.offsetParent)
|
|
3417
3463
|
return NodeFilter.FILTER_SKIP;
|
|
3418
3464
|
const o = getComputedStyle(i);
|
|
@@ -3421,8 +3467,8 @@ class sr extends _ {
|
|
|
3421
3467
|
});
|
|
3422
3468
|
let r;
|
|
3423
3469
|
for (; (r = t.nextNode()) && e.length < 10; ) {
|
|
3424
|
-
const
|
|
3425
|
-
this.isElementScrollable(
|
|
3470
|
+
const s = r;
|
|
3471
|
+
this.isElementScrollable(s) && e.push(s);
|
|
3426
3472
|
}
|
|
3427
3473
|
return e;
|
|
3428
3474
|
}
|
|
@@ -3433,7 +3479,7 @@ class sr extends _ {
|
|
|
3433
3479
|
if (t.id)
|
|
3434
3480
|
return `#${t.id}`;
|
|
3435
3481
|
if (t.className && typeof t.className == "string") {
|
|
3436
|
-
const r = t.className.split(" ").filter((
|
|
3482
|
+
const r = t.className.split(" ").filter((s) => s.trim())[0];
|
|
3437
3483
|
if (r)
|
|
3438
3484
|
return `.${r}`;
|
|
3439
3485
|
}
|
|
@@ -3445,15 +3491,15 @@ class sr extends _ {
|
|
|
3445
3491
|
setupScrollContainer(e, t) {
|
|
3446
3492
|
if (this.containers.some((u) => u.element === e) || e !== window && !this.isElementScrollable(e))
|
|
3447
3493
|
return;
|
|
3448
|
-
const
|
|
3449
|
-
|
|
3494
|
+
const s = this.getScrollTop(e), i = this.calculateScrollDepth(
|
|
3495
|
+
s,
|
|
3450
3496
|
this.getScrollHeight(e),
|
|
3451
3497
|
this.getViewportHeight(e)
|
|
3452
3498
|
), o = this.determineIfPrimary(e), l = {
|
|
3453
3499
|
element: e,
|
|
3454
3500
|
selector: t,
|
|
3455
3501
|
isPrimary: o,
|
|
3456
|
-
lastScrollPos:
|
|
3502
|
+
lastScrollPos: s,
|
|
3457
3503
|
lastDepth: i,
|
|
3458
3504
|
lastDirection: X.DOWN,
|
|
3459
3505
|
lastEventTime: 0,
|
|
@@ -3477,8 +3523,8 @@ class sr extends _ {
|
|
|
3477
3523
|
if (!this.shouldEmitScrollEvent(e, t, r))
|
|
3478
3524
|
return;
|
|
3479
3525
|
e.lastEventTime = r, e.lastDepth = t.depth, e.lastDirection = t.direction;
|
|
3480
|
-
const
|
|
3481
|
-
this.set("scrollEventCount",
|
|
3526
|
+
const s = this.get("scrollEventCount") ?? 0;
|
|
3527
|
+
this.set("scrollEventCount", s + 1), this.eventManager.track({
|
|
3482
3528
|
type: d.SCROLL,
|
|
3483
3529
|
scroll_data: {
|
|
3484
3530
|
...t,
|
|
@@ -3519,16 +3565,16 @@ class sr extends _ {
|
|
|
3519
3565
|
calculateScrollDepth(e, t, r) {
|
|
3520
3566
|
if (t <= r)
|
|
3521
3567
|
return 0;
|
|
3522
|
-
const
|
|
3523
|
-
return Math.min(100, Math.max(0, Math.floor(e /
|
|
3568
|
+
const s = t - r;
|
|
3569
|
+
return Math.min(100, Math.max(0, Math.floor(e / s * 100)));
|
|
3524
3570
|
}
|
|
3525
3571
|
calculateScrollData(e) {
|
|
3526
|
-
const { element: t, lastScrollPos: r, lastEventTime:
|
|
3572
|
+
const { element: t, lastScrollPos: r, lastEventTime: s } = e, i = this.getScrollTop(t), o = Date.now(), l = Math.abs(i - r);
|
|
3527
3573
|
if (l < 10 || t === window && !this.isWindowScrollable())
|
|
3528
3574
|
return null;
|
|
3529
3575
|
const c = this.getViewportHeight(t), u = this.getScrollHeight(t), S = this.getScrollDirection(i, r), g = this.calculateScrollDepth(i, u, c);
|
|
3530
3576
|
let E;
|
|
3531
|
-
|
|
3577
|
+
s > 0 ? E = o - s : e.firstScrollEventTime !== null ? E = o - e.firstScrollEventTime : E = 250;
|
|
3532
3578
|
const p = Math.round(l / E * 1e3);
|
|
3533
3579
|
return g > e.maxDepthReached && (e.maxDepthReached = g), e.lastScrollPos = i, {
|
|
3534
3580
|
depth: g,
|
|
@@ -3547,30 +3593,30 @@ class sr extends _ {
|
|
|
3547
3593
|
return e === window ? document.documentElement.scrollHeight : e.scrollHeight;
|
|
3548
3594
|
}
|
|
3549
3595
|
isElementScrollable(e) {
|
|
3550
|
-
const t = getComputedStyle(e), r = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflow === "auto" || t.overflow === "scroll",
|
|
3551
|
-
return r &&
|
|
3596
|
+
const t = getComputedStyle(e), r = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflow === "auto" || t.overflow === "scroll", s = e.scrollHeight > e.clientHeight;
|
|
3597
|
+
return r && s;
|
|
3552
3598
|
}
|
|
3553
3599
|
applyPrimaryScrollSelector(e) {
|
|
3554
3600
|
let t;
|
|
3555
3601
|
if (e === "window")
|
|
3556
3602
|
t = window;
|
|
3557
3603
|
else {
|
|
3558
|
-
const
|
|
3559
|
-
if (!(
|
|
3604
|
+
const s = document.querySelector(e);
|
|
3605
|
+
if (!(s instanceof HTMLElement)) {
|
|
3560
3606
|
a("debug", `Selector "${e}" did not match an HTMLElement`);
|
|
3561
3607
|
return;
|
|
3562
3608
|
}
|
|
3563
|
-
t =
|
|
3609
|
+
t = s;
|
|
3564
3610
|
}
|
|
3565
|
-
this.containers.forEach((
|
|
3566
|
-
this.updateContainerPrimary(
|
|
3567
|
-
}), !this.containers.some((
|
|
3611
|
+
this.containers.forEach((s) => {
|
|
3612
|
+
this.updateContainerPrimary(s, s.element === t);
|
|
3613
|
+
}), !this.containers.some((s) => s.element === t) && t instanceof HTMLElement && this.isElementScrollable(t) && this.setupScrollContainer(t, e);
|
|
3568
3614
|
}
|
|
3569
3615
|
updateContainerPrimary(e, t) {
|
|
3570
3616
|
e.isPrimary = t;
|
|
3571
3617
|
}
|
|
3572
3618
|
}
|
|
3573
|
-
class
|
|
3619
|
+
class sr extends _ {
|
|
3574
3620
|
eventManager;
|
|
3575
3621
|
trackedElements = /* @__PURE__ */ new Map();
|
|
3576
3622
|
observer = null;
|
|
@@ -3622,8 +3668,8 @@ class nr extends _ {
|
|
|
3622
3668
|
let t = this.trackedElements.size;
|
|
3623
3669
|
for (const r of this.config.elements)
|
|
3624
3670
|
try {
|
|
3625
|
-
const
|
|
3626
|
-
for (const i of Array.from(
|
|
3671
|
+
const s = document.querySelectorAll(r.selector);
|
|
3672
|
+
for (const i of Array.from(s)) {
|
|
3627
3673
|
if (t >= e) {
|
|
3628
3674
|
a("debug", "ViewportHandler: Maximum tracked elements reached", {
|
|
3629
3675
|
data: {
|
|
@@ -3644,8 +3690,8 @@ class nr extends _ {
|
|
|
3644
3690
|
lastFiredTime: null
|
|
3645
3691
|
}), this.observer?.observe(i), t++);
|
|
3646
3692
|
}
|
|
3647
|
-
} catch (
|
|
3648
|
-
a("debug", `ViewportHandler: Invalid selector "${r.selector}"`, { error:
|
|
3693
|
+
} catch (s) {
|
|
3694
|
+
a("debug", `ViewportHandler: Invalid selector "${r.selector}"`, { error: s });
|
|
3649
3695
|
}
|
|
3650
3696
|
a("debug", "ViewportHandler: Elements tracked", {
|
|
3651
3697
|
data: { count: t, limit: e }
|
|
@@ -3658,11 +3704,11 @@ class nr extends _ {
|
|
|
3658
3704
|
if (!this.config) return;
|
|
3659
3705
|
const t = this.config.minDwellTime ?? 1e3;
|
|
3660
3706
|
for (const r of e) {
|
|
3661
|
-
const
|
|
3662
|
-
|
|
3707
|
+
const s = this.trackedElements.get(r.target);
|
|
3708
|
+
s && (r.isIntersecting ? s.startTime === null && (s.startTime = performance.now(), s.timeoutId = window.setTimeout(() => {
|
|
3663
3709
|
const i = Math.round(r.intersectionRatio * 100) / 100;
|
|
3664
|
-
this.fireViewportEvent(
|
|
3665
|
-
}, t)) :
|
|
3710
|
+
this.fireViewportEvent(s, i);
|
|
3711
|
+
}, t)) : s.startTime !== null && (s.timeoutId !== null && (window.clearTimeout(s.timeoutId), s.timeoutId = null), s.startTime = null));
|
|
3666
3712
|
}
|
|
3667
3713
|
};
|
|
3668
3714
|
/**
|
|
@@ -3673,12 +3719,12 @@ class nr extends _ {
|
|
|
3673
3719
|
const r = Math.round(performance.now() - e.startTime);
|
|
3674
3720
|
if (e.element.hasAttribute(`${w}-ignore`))
|
|
3675
3721
|
return;
|
|
3676
|
-
const
|
|
3677
|
-
if (e.lastFiredTime !== null && i - e.lastFiredTime <
|
|
3722
|
+
const s = this.config?.cooldownPeriod ?? 6e4, i = Date.now();
|
|
3723
|
+
if (e.lastFiredTime !== null && i - e.lastFiredTime < s) {
|
|
3678
3724
|
a("debug", "ViewportHandler: Event suppressed by cooldown period", {
|
|
3679
3725
|
data: {
|
|
3680
3726
|
selector: e.selector,
|
|
3681
|
-
cooldownRemaining:
|
|
3727
|
+
cooldownRemaining: s - (i - e.lastFiredTime)
|
|
3682
3728
|
}
|
|
3683
3729
|
}), e.startTime = null, e.timeoutId = null;
|
|
3684
3730
|
return;
|
|
@@ -3723,8 +3769,8 @@ class nr extends _ {
|
|
|
3723
3769
|
cleanupRemovedNodes(e) {
|
|
3724
3770
|
e.forEach((t) => {
|
|
3725
3771
|
if (t.nodeType !== 1) return;
|
|
3726
|
-
const r = t,
|
|
3727
|
-
|
|
3772
|
+
const r = t, s = this.trackedElements.get(r);
|
|
3773
|
+
s && (s.timeoutId !== null && window.clearTimeout(s.timeoutId), this.observer?.unobserve(r), this.trackedElements.delete(r)), Array.from(this.trackedElements.keys()).filter((o) => r.contains(o)).forEach((o) => {
|
|
3728
3774
|
const l = this.trackedElements.get(o);
|
|
3729
3775
|
l && l.timeoutId !== null && window.clearTimeout(l.timeoutId), this.observer?.unobserve(o), this.trackedElements.delete(o);
|
|
3730
3776
|
});
|
|
@@ -3911,8 +3957,8 @@ class ir {
|
|
|
3911
3957
|
} catch {
|
|
3912
3958
|
}
|
|
3913
3959
|
}), !0;
|
|
3914
|
-
const r = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"],
|
|
3915
|
-
return
|
|
3960
|
+
const r = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"], s = e.filter((i) => !r.some((o) => i.startsWith(o)));
|
|
3961
|
+
return s.length > 0 ? (s.slice(0, 5).forEach((o) => {
|
|
3916
3962
|
try {
|
|
3917
3963
|
this.storage.removeItem(o);
|
|
3918
3964
|
} catch {
|
|
@@ -4067,7 +4113,7 @@ class or extends _ {
|
|
|
4067
4113
|
this.reportTTFB(), this.safeObserve(
|
|
4068
4114
|
"largest-contentful-paint",
|
|
4069
4115
|
(r) => {
|
|
4070
|
-
const
|
|
4116
|
+
const s = r.getEntries(), i = s[s.length - 1];
|
|
4071
4117
|
i && this.sendVital({ type: "LCP", value: Number(i.startTime.toFixed(2)) });
|
|
4072
4118
|
},
|
|
4073
4119
|
{ type: "largest-contentful-paint", buffered: !0 },
|
|
@@ -4077,8 +4123,8 @@ class or extends _ {
|
|
|
4077
4123
|
this.safeObserve(
|
|
4078
4124
|
"layout-shift",
|
|
4079
4125
|
(r) => {
|
|
4080
|
-
const
|
|
4081
|
-
|
|
4126
|
+
const s = this.getNavigationId();
|
|
4127
|
+
s !== t && (e = 0, t = s);
|
|
4082
4128
|
const i = r.getEntries();
|
|
4083
4129
|
for (const o of i) {
|
|
4084
4130
|
if (o.hadRecentInput === !0)
|
|
@@ -4092,32 +4138,32 @@ class or extends _ {
|
|
|
4092
4138
|
), this.safeObserve(
|
|
4093
4139
|
"paint",
|
|
4094
4140
|
(r) => {
|
|
4095
|
-
for (const
|
|
4096
|
-
|
|
4141
|
+
for (const s of r.getEntries())
|
|
4142
|
+
s.name === "first-contentful-paint" && this.sendVital({ type: "FCP", value: Number(s.startTime.toFixed(2)) });
|
|
4097
4143
|
},
|
|
4098
4144
|
{ type: "paint", buffered: !0 },
|
|
4099
4145
|
!0
|
|
4100
4146
|
), this.safeObserve(
|
|
4101
4147
|
"event",
|
|
4102
4148
|
(r) => {
|
|
4103
|
-
let
|
|
4149
|
+
let s = 0;
|
|
4104
4150
|
const i = r.getEntries();
|
|
4105
4151
|
for (const o of i) {
|
|
4106
4152
|
const l = (o.processingEnd ?? 0) - (o.startTime ?? 0);
|
|
4107
|
-
|
|
4153
|
+
s = Math.max(s, l);
|
|
4108
4154
|
}
|
|
4109
|
-
|
|
4155
|
+
s > 0 && this.sendVital({ type: "INP", value: Number(s.toFixed(2)) });
|
|
4110
4156
|
},
|
|
4111
4157
|
{ type: "event", buffered: !0 }
|
|
4112
4158
|
);
|
|
4113
4159
|
}
|
|
4114
4160
|
async initWebVitals() {
|
|
4115
4161
|
try {
|
|
4116
|
-
const { onLCP: e, onCLS: t, onFCP: r, onTTFB:
|
|
4162
|
+
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: s, onINP: i } = await Promise.resolve().then(() => Nr), o = (l) => (c) => {
|
|
4117
4163
|
const u = Number(c.value.toFixed(2));
|
|
4118
4164
|
this.sendVital({ type: l, value: u });
|
|
4119
4165
|
};
|
|
4120
|
-
e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), r(o("FCP"), { reportAllChanges: !1 }),
|
|
4166
|
+
e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), r(o("FCP"), { reportAllChanges: !1 }), s(o("TTFB"), { reportAllChanges: !1 }), i(o("INP"), { reportAllChanges: !1 });
|
|
4121
4167
|
} catch (e) {
|
|
4122
4168
|
a("debug", "Failed to load web-vitals library, using fallback", { error: e }), this.observeWebVitalsFallback();
|
|
4123
4169
|
}
|
|
@@ -4139,8 +4185,8 @@ class or extends _ {
|
|
|
4139
4185
|
(e) => {
|
|
4140
4186
|
const t = e.getEntries();
|
|
4141
4187
|
for (const r of t) {
|
|
4142
|
-
const
|
|
4143
|
-
i - this.lastLongTaskSentAt >= Mt && (this.shouldSendVital("LONG_TASK",
|
|
4188
|
+
const s = Number(r.duration.toFixed(2)), i = Date.now();
|
|
4189
|
+
i - this.lastLongTaskSentAt >= Mt && (this.shouldSendVital("LONG_TASK", s) && this.trackWebVital("LONG_TASK", s), this.lastLongTaskSentAt = i);
|
|
4144
4190
|
}
|
|
4145
4191
|
},
|
|
4146
4192
|
{ type: "longtask", buffered: !0 }
|
|
@@ -4202,8 +4248,8 @@ class or extends _ {
|
|
|
4202
4248
|
const e = performance.getEntriesByType("navigation")[0];
|
|
4203
4249
|
if (!e)
|
|
4204
4250
|
return null;
|
|
4205
|
-
const t = e.startTime || performance.now(), r = ++this.navigationCounter,
|
|
4206
|
-
return r > 1 ? `${
|
|
4251
|
+
const t = e.startTime || performance.now(), r = ++this.navigationCounter, s = `${t.toFixed(2)}_${window.location.pathname}`;
|
|
4252
|
+
return r > 1 ? `${s}_${r}` : s;
|
|
4207
4253
|
} catch (e) {
|
|
4208
4254
|
return a("debug", "Failed to get navigation ID", { error: e }), null;
|
|
4209
4255
|
}
|
|
@@ -4213,7 +4259,7 @@ class or extends _ {
|
|
|
4213
4259
|
const t = PerformanceObserver.supportedEntryTypes;
|
|
4214
4260
|
return !t || t.includes(e);
|
|
4215
4261
|
}
|
|
4216
|
-
safeObserve(e, t, r,
|
|
4262
|
+
safeObserve(e, t, r, s = !1) {
|
|
4217
4263
|
try {
|
|
4218
4264
|
if (!this.isObserverSupported(e))
|
|
4219
4265
|
return !1;
|
|
@@ -4226,13 +4272,13 @@ class or extends _ {
|
|
|
4226
4272
|
data: { type: e }
|
|
4227
4273
|
});
|
|
4228
4274
|
}
|
|
4229
|
-
if (
|
|
4275
|
+
if (s)
|
|
4230
4276
|
try {
|
|
4231
4277
|
l.disconnect();
|
|
4232
4278
|
} catch {
|
|
4233
4279
|
}
|
|
4234
4280
|
});
|
|
4235
|
-
return i.observe(r ?? { type: e, buffered: !0 }),
|
|
4281
|
+
return i.observe(r ?? { type: e, buffered: !0 }), s || this.observers.push(i), !0;
|
|
4236
4282
|
} catch (i) {
|
|
4237
4283
|
return a("debug", "Failed to create performance observer", {
|
|
4238
4284
|
error: i,
|
|
@@ -4336,24 +4382,24 @@ class ar extends _ {
|
|
|
4336
4382
|
sanitize(e) {
|
|
4337
4383
|
let t = e.length > Le ? e.slice(0, Le) + "..." : e;
|
|
4338
4384
|
for (const r of Be) {
|
|
4339
|
-
const
|
|
4340
|
-
t = t.replace(
|
|
4385
|
+
const s = new RegExp(r.source, r.flags);
|
|
4386
|
+
t = t.replace(s, "[REDACTED]");
|
|
4341
4387
|
}
|
|
4342
4388
|
return t;
|
|
4343
4389
|
}
|
|
4344
4390
|
shouldSuppressError(e, t) {
|
|
4345
|
-
const r = Date.now(),
|
|
4346
|
-
return i && r - i < Me ? (this.recentErrors.set(
|
|
4391
|
+
const r = Date.now(), s = `${e}:${t}`, i = this.recentErrors.get(s);
|
|
4392
|
+
return i && r - i < Me ? (this.recentErrors.set(s, r), !0) : (this.recentErrors.set(s, r), this.recentErrors.size > wt ? (this.recentErrors.clear(), this.recentErrors.set(s, r), !1) : (this.recentErrors.size > Q && this.pruneOldErrors(), !1));
|
|
4347
4393
|
}
|
|
4348
4394
|
pruneOldErrors() {
|
|
4349
4395
|
const e = Date.now();
|
|
4350
|
-
for (const [
|
|
4351
|
-
e - i > Me && this.recentErrors.delete(
|
|
4396
|
+
for (const [s, i] of this.recentErrors.entries())
|
|
4397
|
+
e - i > Me && this.recentErrors.delete(s);
|
|
4352
4398
|
if (this.recentErrors.size <= Q)
|
|
4353
4399
|
return;
|
|
4354
|
-
const t = Array.from(this.recentErrors.entries()).sort((
|
|
4355
|
-
for (let
|
|
4356
|
-
const i = t[
|
|
4400
|
+
const t = Array.from(this.recentErrors.entries()).sort((s, i) => s[1] - i[1]), r = this.recentErrors.size - Q;
|
|
4401
|
+
for (let s = 0; s < r; s += 1) {
|
|
4402
|
+
const i = t[s];
|
|
4357
4403
|
i && this.recentErrors.delete(i[0]);
|
|
4358
4404
|
}
|
|
4359
4405
|
}
|
|
@@ -4403,8 +4449,8 @@ class lr extends _ {
|
|
|
4403
4449
|
}
|
|
4404
4450
|
let r = t;
|
|
4405
4451
|
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
4406
|
-
const { valid:
|
|
4407
|
-
if (!
|
|
4452
|
+
const { valid: s, error: i, sanitizedMetadata: o } = Qt(e, r);
|
|
4453
|
+
if (!s) {
|
|
4408
4454
|
if (this.get("mode") === j.QA)
|
|
4409
4455
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
|
|
4410
4456
|
return;
|
|
@@ -4455,8 +4501,8 @@ class lr extends _ {
|
|
|
4455
4501
|
this.set("userId", t);
|
|
4456
4502
|
const r = xt(e);
|
|
4457
4503
|
this.set("collectApiUrls", r);
|
|
4458
|
-
const
|
|
4459
|
-
this.set("device",
|
|
4504
|
+
const s = It();
|
|
4505
|
+
this.set("device", s);
|
|
4460
4506
|
const i = le(window.location.href, e.sensitiveQueryParams);
|
|
4461
4507
|
this.set("pageUrl", i), Pt() && this.set("mode", j.QA);
|
|
4462
4508
|
}
|
|
@@ -4517,11 +4563,11 @@ class lr extends _ {
|
|
|
4517
4563
|
const t = this.validateGlobalMetadata(e);
|
|
4518
4564
|
if (!t.valid)
|
|
4519
4565
|
throw new Error(`[TraceLog] Invalid global metadata: ${t.error}`);
|
|
4520
|
-
const
|
|
4566
|
+
const s = {
|
|
4521
4567
|
...this.get("config"),
|
|
4522
4568
|
globalMetadata: e
|
|
4523
4569
|
};
|
|
4524
|
-
this.set("config",
|
|
4570
|
+
this.set("config", s), a("debug", "Global metadata updated (replaced)", { data: { keys: Object.keys(e) } });
|
|
4525
4571
|
}
|
|
4526
4572
|
/**
|
|
4527
4573
|
* Merges new metadata with existing global metadata.
|
|
@@ -4554,35 +4600,35 @@ class lr extends _ {
|
|
|
4554
4600
|
this.set("suppressNextScroll", !1);
|
|
4555
4601
|
}, 500);
|
|
4556
4602
|
};
|
|
4557
|
-
this.handlers.pageView = new tr(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new rr(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new
|
|
4603
|
+
this.handlers.pageView = new tr(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new rr(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new nr(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new or(this.managers.event), this.handlers.performance.startTracking().catch((r) => {
|
|
4558
4604
|
a("warn", "Failed to start performance tracking", { error: r });
|
|
4559
|
-
}), this.handlers.error = new ar(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new
|
|
4605
|
+
}), this.handlers.error = new ar(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new sr(this.managers.event), this.handlers.viewport.startTracking());
|
|
4560
4606
|
}
|
|
4561
4607
|
}
|
|
4562
4608
|
const R = [], M = [];
|
|
4563
4609
|
let f = null, C = !1, v = !1;
|
|
4564
|
-
const cr = async (
|
|
4610
|
+
const cr = async (n) => {
|
|
4565
4611
|
if (!(typeof window > "u" || typeof document > "u") && (v = !1, window.__traceLogDisabled !== !0 && !f && !C)) {
|
|
4566
4612
|
C = !0;
|
|
4567
4613
|
try {
|
|
4568
|
-
const e = Wt(
|
|
4614
|
+
const e = Wt(n ?? {}), t = new lr();
|
|
4569
4615
|
try {
|
|
4570
4616
|
R.forEach(({ event: i, callback: o }) => {
|
|
4571
4617
|
t.on(i, o);
|
|
4572
4618
|
}), R.length = 0, M.forEach(({ hook: i, fn: o }) => {
|
|
4573
4619
|
i === "beforeSend" ? t.setTransformer("beforeSend", o) : t.setTransformer("beforeBatch", o);
|
|
4574
4620
|
}), M.length = 0;
|
|
4575
|
-
const r = t.init(e),
|
|
4621
|
+
const r = t.init(e), s = new Promise((i, o) => {
|
|
4576
4622
|
setTimeout(() => {
|
|
4577
4623
|
o(new Error("[TraceLog] Initialization timeout after 10000ms"));
|
|
4578
4624
|
}, 1e4);
|
|
4579
4625
|
});
|
|
4580
|
-
await Promise.race([r,
|
|
4626
|
+
await Promise.race([r, s]), f = t;
|
|
4581
4627
|
} catch (r) {
|
|
4582
4628
|
try {
|
|
4583
4629
|
t.destroy(!0);
|
|
4584
|
-
} catch (
|
|
4585
|
-
a("error", "Failed to cleanup partially initialized app", { error:
|
|
4630
|
+
} catch (s) {
|
|
4631
|
+
a("error", "Failed to cleanup partially initialized app", { error: s });
|
|
4586
4632
|
}
|
|
4587
4633
|
throw r;
|
|
4588
4634
|
}
|
|
@@ -4592,56 +4638,56 @@ const cr = async (s) => {
|
|
|
4592
4638
|
C = !1;
|
|
4593
4639
|
}
|
|
4594
4640
|
}
|
|
4595
|
-
}, ur = (
|
|
4641
|
+
}, ur = (n, e) => {
|
|
4596
4642
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4597
4643
|
if (!f)
|
|
4598
4644
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
4599
4645
|
if (v)
|
|
4600
4646
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
4601
|
-
f.sendCustomEvent(
|
|
4647
|
+
f.sendCustomEvent(n, e);
|
|
4602
4648
|
}
|
|
4603
|
-
}, dr = (
|
|
4649
|
+
}, dr = (n, e) => {
|
|
4604
4650
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4605
4651
|
if (!f || C) {
|
|
4606
|
-
R.push({ event:
|
|
4652
|
+
R.push({ event: n, callback: e });
|
|
4607
4653
|
return;
|
|
4608
4654
|
}
|
|
4609
|
-
f.on(
|
|
4655
|
+
f.on(n, e);
|
|
4610
4656
|
}
|
|
4611
|
-
}, hr = (
|
|
4657
|
+
}, hr = (n, e) => {
|
|
4612
4658
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4613
4659
|
if (!f) {
|
|
4614
|
-
const t = R.findIndex((r) => r.event ===
|
|
4660
|
+
const t = R.findIndex((r) => r.event === n && r.callback === e);
|
|
4615
4661
|
t !== -1 && R.splice(t, 1);
|
|
4616
4662
|
return;
|
|
4617
4663
|
}
|
|
4618
|
-
f.off(
|
|
4664
|
+
f.off(n, e);
|
|
4619
4665
|
}
|
|
4620
4666
|
};
|
|
4621
|
-
function fr(
|
|
4667
|
+
function fr(n, e) {
|
|
4622
4668
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4623
4669
|
if (typeof e != "function")
|
|
4624
4670
|
throw new Error(`[TraceLog] Transformer must be a function, received: ${typeof e}`);
|
|
4625
4671
|
if (!f || C) {
|
|
4626
|
-
const t = M.findIndex((r) => r.hook ===
|
|
4627
|
-
t !== -1 && M.splice(t, 1), M.push({ hook:
|
|
4672
|
+
const t = M.findIndex((r) => r.hook === n);
|
|
4673
|
+
t !== -1 && M.splice(t, 1), M.push({ hook: n, fn: e });
|
|
4628
4674
|
return;
|
|
4629
4675
|
}
|
|
4630
4676
|
if (v)
|
|
4631
4677
|
throw new Error("[TraceLog] Cannot set transformers while TraceLog is being destroyed");
|
|
4632
|
-
|
|
4678
|
+
n === "beforeSend" ? f.setTransformer("beforeSend", e) : f.setTransformer("beforeBatch", e);
|
|
4633
4679
|
}
|
|
4634
4680
|
}
|
|
4635
|
-
const mr = (
|
|
4681
|
+
const mr = (n) => {
|
|
4636
4682
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4637
4683
|
if (!f) {
|
|
4638
|
-
const e = M.findIndex((t) => t.hook ===
|
|
4684
|
+
const e = M.findIndex((t) => t.hook === n);
|
|
4639
4685
|
e !== -1 && M.splice(e, 1);
|
|
4640
4686
|
return;
|
|
4641
4687
|
}
|
|
4642
4688
|
if (v)
|
|
4643
4689
|
throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
|
|
4644
|
-
f.removeTransformer(
|
|
4690
|
+
f.removeTransformer(n);
|
|
4645
4691
|
}
|
|
4646
4692
|
}, gr = () => typeof window > "u" || typeof document > "u" ? !1 : f !== null, Er = () => {
|
|
4647
4693
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
@@ -4654,27 +4700,27 @@ const mr = (s) => {
|
|
|
4654
4700
|
v = !0;
|
|
4655
4701
|
try {
|
|
4656
4702
|
f.destroy(), f = null, C = !1, R.length = 0, M.length = 0, v = !1;
|
|
4657
|
-
} catch (
|
|
4658
|
-
f = null, C = !1, R.length = 0, M.length = 0, v = !1, a("warn", "Error during destroy, forced cleanup completed", { error:
|
|
4703
|
+
} catch (n) {
|
|
4704
|
+
f = null, C = !1, R.length = 0, M.length = 0, v = !1, a("warn", "Error during destroy, forced cleanup completed", { error: n });
|
|
4659
4705
|
}
|
|
4660
4706
|
}
|
|
4661
|
-
}, Sr = (
|
|
4662
|
-
typeof window > "u" || typeof document > "u" || Dt(
|
|
4663
|
-
}, pr = (
|
|
4707
|
+
}, Sr = (n) => {
|
|
4708
|
+
typeof window > "u" || typeof document > "u" || Dt(n);
|
|
4709
|
+
}, pr = (n) => {
|
|
4664
4710
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4665
4711
|
if (!f)
|
|
4666
4712
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
4667
4713
|
if (v)
|
|
4668
4714
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
4669
|
-
f.updateGlobalMetadata(
|
|
4715
|
+
f.updateGlobalMetadata(n);
|
|
4670
4716
|
}
|
|
4671
|
-
}, Tr = (
|
|
4717
|
+
}, Tr = (n) => {
|
|
4672
4718
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4673
4719
|
if (!f)
|
|
4674
4720
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
4675
4721
|
if (v)
|
|
4676
4722
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
4677
|
-
f.mergeGlobalMetadata(
|
|
4723
|
+
f.mergeGlobalMetadata(n);
|
|
4678
4724
|
}
|
|
4679
4725
|
}, Qr = {
|
|
4680
4726
|
init: cr,
|
|
@@ -4689,57 +4735,57 @@ const mr = (s) => {
|
|
|
4689
4735
|
updateGlobalMetadata: pr,
|
|
4690
4736
|
mergeGlobalMetadata: Tr
|
|
4691
4737
|
};
|
|
4692
|
-
var ue, Ye = -1, P = function(
|
|
4738
|
+
var ue, Ye = -1, P = function(n) {
|
|
4693
4739
|
addEventListener("pageshow", (function(e) {
|
|
4694
|
-
e.persisted && (Ye = e.timeStamp,
|
|
4740
|
+
e.persisted && (Ye = e.timeStamp, n(e));
|
|
4695
4741
|
}), !0);
|
|
4696
4742
|
}, Ee = function() {
|
|
4697
|
-
var
|
|
4698
|
-
if (
|
|
4743
|
+
var n = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
4744
|
+
if (n && n.responseStart > 0 && n.responseStart < performance.now()) return n;
|
|
4699
4745
|
}, q = function() {
|
|
4700
|
-
var
|
|
4701
|
-
return
|
|
4702
|
-
}, b = function(
|
|
4746
|
+
var n = Ee();
|
|
4747
|
+
return n && n.activationStart || 0;
|
|
4748
|
+
}, b = function(n, e) {
|
|
4703
4749
|
var t = Ee(), r = "navigate";
|
|
4704
|
-
return Ye >= 0 ? r = "back-forward-cache" : t && (document.prerendering || q() > 0 ? r = "prerender" : document.wasDiscarded ? r = "restore" : t.type && (r = t.type.replace(/_/g, "-"))), { name:
|
|
4705
|
-
},
|
|
4750
|
+
return Ye >= 0 ? r = "back-forward-cache" : t && (document.prerendering || q() > 0 ? r = "prerender" : document.wasDiscarded ? r = "restore" : t.type && (r = t.type.replace(/_/g, "-"))), { name: n, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: r };
|
|
4751
|
+
}, $ = function(n, e, t) {
|
|
4706
4752
|
try {
|
|
4707
|
-
if (PerformanceObserver.supportedEntryTypes.includes(
|
|
4708
|
-
var r = new PerformanceObserver((function(
|
|
4753
|
+
if (PerformanceObserver.supportedEntryTypes.includes(n)) {
|
|
4754
|
+
var r = new PerformanceObserver((function(s) {
|
|
4709
4755
|
Promise.resolve().then((function() {
|
|
4710
|
-
e(
|
|
4756
|
+
e(s.getEntries());
|
|
4711
4757
|
}));
|
|
4712
4758
|
}));
|
|
4713
|
-
return r.observe(Object.assign({ type:
|
|
4759
|
+
return r.observe(Object.assign({ type: n, buffered: !0 }, t || {})), r;
|
|
4714
4760
|
}
|
|
4715
4761
|
} catch {
|
|
4716
4762
|
}
|
|
4717
|
-
}, A = function(
|
|
4718
|
-
var
|
|
4763
|
+
}, A = function(n, e, t, r) {
|
|
4764
|
+
var s, i;
|
|
4719
4765
|
return function(o) {
|
|
4720
|
-
e.value >= 0 && (o || r) && ((i = e.value - (
|
|
4766
|
+
e.value >= 0 && (o || r) && ((i = e.value - (s || 0)) || s === void 0) && (s = e.value, e.delta = i, e.rating = (function(l, c) {
|
|
4721
4767
|
return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
|
|
4722
|
-
})(e.value, t),
|
|
4768
|
+
})(e.value, t), n(e));
|
|
4723
4769
|
};
|
|
4724
|
-
}, Se = function(
|
|
4770
|
+
}, Se = function(n) {
|
|
4725
4771
|
requestAnimationFrame((function() {
|
|
4726
4772
|
return requestAnimationFrame((function() {
|
|
4727
|
-
return
|
|
4773
|
+
return n();
|
|
4728
4774
|
}));
|
|
4729
4775
|
}));
|
|
4730
|
-
}, J = function(
|
|
4776
|
+
}, J = function(n) {
|
|
4731
4777
|
document.addEventListener("visibilitychange", (function() {
|
|
4732
|
-
document.visibilityState === "hidden" &&
|
|
4778
|
+
document.visibilityState === "hidden" && n();
|
|
4733
4779
|
}));
|
|
4734
|
-
}, pe = function(
|
|
4780
|
+
}, pe = function(n) {
|
|
4735
4781
|
var e = !1;
|
|
4736
4782
|
return function() {
|
|
4737
|
-
e || (
|
|
4783
|
+
e || (n(), e = !0);
|
|
4738
4784
|
};
|
|
4739
4785
|
}, O = -1, ke = function() {
|
|
4740
4786
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
4741
|
-
}, Y = function(
|
|
4742
|
-
document.visibilityState === "hidden" && O > -1 && (O =
|
|
4787
|
+
}, Y = function(n) {
|
|
4788
|
+
document.visibilityState === "hidden" && O > -1 && (O = n.type === "visibilitychange" ? n.timeStamp : 0, _r());
|
|
4743
4789
|
}, Ue = function() {
|
|
4744
4790
|
addEventListener("visibilitychange", Y, !0), addEventListener("prerenderingchange", Y, !0);
|
|
4745
4791
|
}, _r = function() {
|
|
@@ -4752,126 +4798,126 @@ var ue, Ye = -1, P = function(s) {
|
|
|
4752
4798
|
}))), { get firstHiddenTime() {
|
|
4753
4799
|
return O;
|
|
4754
4800
|
} };
|
|
4755
|
-
}, Z = function(
|
|
4801
|
+
}, Z = function(n) {
|
|
4756
4802
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
4757
|
-
return
|
|
4758
|
-
}), !0) :
|
|
4759
|
-
}, de = [1800, 3e3], Je = function(
|
|
4803
|
+
return n();
|
|
4804
|
+
}), !0) : n();
|
|
4805
|
+
}, de = [1800, 3e3], Je = function(n, e) {
|
|
4760
4806
|
e = e || {}, Z((function() {
|
|
4761
|
-
var t, r = qe(),
|
|
4807
|
+
var t, r = qe(), s = b("FCP"), i = $("paint", (function(o) {
|
|
4762
4808
|
o.forEach((function(l) {
|
|
4763
|
-
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (
|
|
4809
|
+
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (s.value = Math.max(l.startTime - q(), 0), s.entries.push(l), t(!0)));
|
|
4764
4810
|
}));
|
|
4765
4811
|
}));
|
|
4766
|
-
i && (t = A(
|
|
4767
|
-
|
|
4768
|
-
|
|
4812
|
+
i && (t = A(n, s, de, e.reportAllChanges), P((function(o) {
|
|
4813
|
+
s = b("FCP"), t = A(n, s, de, e.reportAllChanges), Se((function() {
|
|
4814
|
+
s.value = performance.now() - o.timeStamp, t(!0);
|
|
4769
4815
|
}));
|
|
4770
4816
|
})));
|
|
4771
4817
|
}));
|
|
4772
|
-
}, he = [0.1, 0.25], vr = function(
|
|
4818
|
+
}, he = [0.1, 0.25], vr = function(n, e) {
|
|
4773
4819
|
e = e || {}, Je(pe((function() {
|
|
4774
|
-
var t, r = b("CLS", 0),
|
|
4820
|
+
var t, r = b("CLS", 0), s = 0, i = [], o = function(c) {
|
|
4775
4821
|
c.forEach((function(u) {
|
|
4776
4822
|
if (!u.hadRecentInput) {
|
|
4777
4823
|
var S = i[0], g = i[i.length - 1];
|
|
4778
|
-
|
|
4824
|
+
s && u.startTime - g.startTime < 1e3 && u.startTime - S.startTime < 5e3 ? (s += u.value, i.push(u)) : (s = u.value, i = [u]);
|
|
4779
4825
|
}
|
|
4780
|
-
})),
|
|
4781
|
-
}, l =
|
|
4782
|
-
l && (t = A(
|
|
4826
|
+
})), s > r.value && (r.value = s, r.entries = i, t());
|
|
4827
|
+
}, l = $("layout-shift", o);
|
|
4828
|
+
l && (t = A(n, r, he, e.reportAllChanges), J((function() {
|
|
4783
4829
|
o(l.takeRecords()), t(!0);
|
|
4784
4830
|
})), P((function() {
|
|
4785
|
-
|
|
4831
|
+
s = 0, r = b("CLS", 0), t = A(n, r, he, e.reportAllChanges), Se((function() {
|
|
4786
4832
|
return t();
|
|
4787
4833
|
}));
|
|
4788
4834
|
})), setTimeout(t, 0));
|
|
4789
4835
|
})));
|
|
4790
|
-
}, Ze = 0, re = 1 / 0, G = 0, Ir = function(
|
|
4791
|
-
|
|
4836
|
+
}, Ze = 0, re = 1 / 0, G = 0, Ir = function(n) {
|
|
4837
|
+
n.forEach((function(e) {
|
|
4792
4838
|
e.interactionId && (re = Math.min(re, e.interactionId), G = Math.max(G, e.interactionId), Ze = G ? (G - re) / 7 + 1 : 0);
|
|
4793
4839
|
}));
|
|
4794
4840
|
}, et = function() {
|
|
4795
4841
|
return ue ? Ze : performance.interactionCount || 0;
|
|
4796
4842
|
}, wr = function() {
|
|
4797
|
-
"interactionCount" in performance || ue || (ue =
|
|
4843
|
+
"interactionCount" in performance || ue || (ue = $("event", Ir, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
4798
4844
|
}, y = [], z = /* @__PURE__ */ new Map(), tt = 0, yr = function() {
|
|
4799
|
-
var
|
|
4800
|
-
return y[
|
|
4801
|
-
}, br = [], Ar = function(
|
|
4802
|
-
if (br.forEach((function(
|
|
4803
|
-
return n
|
|
4804
|
-
})),
|
|
4805
|
-
var e = y[y.length - 1], t = z.get(
|
|
4806
|
-
if (t || y.length < 10 ||
|
|
4807
|
-
if (t)
|
|
4845
|
+
var n = Math.min(y.length - 1, Math.floor((et() - tt) / 50));
|
|
4846
|
+
return y[n];
|
|
4847
|
+
}, br = [], Ar = function(n) {
|
|
4848
|
+
if (br.forEach((function(s) {
|
|
4849
|
+
return s(n);
|
|
4850
|
+
})), n.interactionId || n.entryType === "first-input") {
|
|
4851
|
+
var e = y[y.length - 1], t = z.get(n.interactionId);
|
|
4852
|
+
if (t || y.length < 10 || n.duration > e.latency) {
|
|
4853
|
+
if (t) n.duration > t.latency ? (t.entries = [n], t.latency = n.duration) : n.duration === t.latency && n.startTime === t.entries[0].startTime && t.entries.push(n);
|
|
4808
4854
|
else {
|
|
4809
|
-
var r = { id:
|
|
4855
|
+
var r = { id: n.interactionId, latency: n.duration, entries: [n] };
|
|
4810
4856
|
z.set(r.id, r), y.push(r);
|
|
4811
4857
|
}
|
|
4812
|
-
y.sort((function(
|
|
4813
|
-
return i.latency -
|
|
4814
|
-
})), y.length > 10 && y.splice(10).forEach((function(
|
|
4815
|
-
return z.delete(
|
|
4858
|
+
y.sort((function(s, i) {
|
|
4859
|
+
return i.latency - s.latency;
|
|
4860
|
+
})), y.length > 10 && y.splice(10).forEach((function(s) {
|
|
4861
|
+
return z.delete(s.id);
|
|
4816
4862
|
}));
|
|
4817
4863
|
}
|
|
4818
4864
|
}
|
|
4819
|
-
}, rt = function(
|
|
4865
|
+
}, rt = function(n) {
|
|
4820
4866
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
4821
|
-
return
|
|
4822
|
-
}, fe = [200, 500], Lr = function(
|
|
4867
|
+
return n = pe(n), document.visibilityState === "hidden" ? n() : (t = e(n), J(n)), t;
|
|
4868
|
+
}, fe = [200, 500], Lr = function(n, e) {
|
|
4823
4869
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, Z((function() {
|
|
4824
4870
|
var t;
|
|
4825
4871
|
wr();
|
|
4826
|
-
var r,
|
|
4872
|
+
var r, s = b("INP"), i = function(l) {
|
|
4827
4873
|
rt((function() {
|
|
4828
4874
|
l.forEach(Ar);
|
|
4829
4875
|
var c = yr();
|
|
4830
|
-
c && c.latency !==
|
|
4876
|
+
c && c.latency !== s.value && (s.value = c.latency, s.entries = c.entries, r());
|
|
4831
4877
|
}));
|
|
4832
|
-
}, o =
|
|
4833
|
-
r = A(
|
|
4878
|
+
}, o = $("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
4879
|
+
r = A(n, s, fe, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), J((function() {
|
|
4834
4880
|
i(o.takeRecords()), r(!0);
|
|
4835
4881
|
})), P((function() {
|
|
4836
|
-
tt = et(), y.length = 0, z.clear(),
|
|
4882
|
+
tt = et(), y.length = 0, z.clear(), s = b("INP"), r = A(n, s, fe, e.reportAllChanges);
|
|
4837
4883
|
})));
|
|
4838
4884
|
})));
|
|
4839
|
-
}, me = [2500, 4e3],
|
|
4885
|
+
}, me = [2500, 4e3], ne = {}, Mr = function(n, e) {
|
|
4840
4886
|
e = e || {}, Z((function() {
|
|
4841
|
-
var t, r = qe(),
|
|
4887
|
+
var t, r = qe(), s = b("LCP"), i = function(c) {
|
|
4842
4888
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
4843
|
-
u.startTime < r.firstHiddenTime && (
|
|
4889
|
+
u.startTime < r.firstHiddenTime && (s.value = Math.max(u.startTime - q(), 0), s.entries = [u], t());
|
|
4844
4890
|
}));
|
|
4845
|
-
}, o =
|
|
4891
|
+
}, o = $("largest-contentful-paint", i);
|
|
4846
4892
|
if (o) {
|
|
4847
|
-
t = A(
|
|
4893
|
+
t = A(n, s, me, e.reportAllChanges);
|
|
4848
4894
|
var l = pe((function() {
|
|
4849
|
-
|
|
4895
|
+
ne[s.id] || (i(o.takeRecords()), o.disconnect(), ne[s.id] = !0, t(!0));
|
|
4850
4896
|
}));
|
|
4851
4897
|
["keydown", "click"].forEach((function(c) {
|
|
4852
4898
|
addEventListener(c, (function() {
|
|
4853
4899
|
return rt(l);
|
|
4854
4900
|
}), { once: !0, capture: !0 });
|
|
4855
4901
|
})), J(l), P((function(c) {
|
|
4856
|
-
|
|
4857
|
-
|
|
4902
|
+
s = b("LCP"), t = A(n, s, me, e.reportAllChanges), Se((function() {
|
|
4903
|
+
s.value = performance.now() - c.timeStamp, ne[s.id] = !0, t(!0);
|
|
4858
4904
|
}));
|
|
4859
4905
|
}));
|
|
4860
4906
|
}
|
|
4861
4907
|
}));
|
|
4862
|
-
}, ge = [800, 1800], Cr = function
|
|
4908
|
+
}, ge = [800, 1800], Cr = function n(e) {
|
|
4863
4909
|
document.prerendering ? Z((function() {
|
|
4864
|
-
return
|
|
4910
|
+
return n(e);
|
|
4865
4911
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
4866
|
-
return
|
|
4912
|
+
return n(e);
|
|
4867
4913
|
}), !0) : setTimeout(e, 0);
|
|
4868
|
-
}, Rr = function(
|
|
4914
|
+
}, Rr = function(n, e) {
|
|
4869
4915
|
e = e || {};
|
|
4870
|
-
var t = b("TTFB"), r = A(
|
|
4916
|
+
var t = b("TTFB"), r = A(n, t, ge, e.reportAllChanges);
|
|
4871
4917
|
Cr((function() {
|
|
4872
|
-
var
|
|
4873
|
-
|
|
4874
|
-
t = b("TTFB", 0), (r = A(
|
|
4918
|
+
var s = Ee();
|
|
4919
|
+
s && (t.value = Math.max(s.responseStart - q(), 0), t.entries = [s], r(!0), P((function() {
|
|
4920
|
+
t = b("TTFB", 0), (r = A(n, t, ge, e.reportAllChanges))(!0);
|
|
4875
4921
|
})));
|
|
4876
4922
|
}));
|
|
4877
4923
|
};
|
|
@@ -4893,12 +4939,12 @@ export {
|
|
|
4893
4939
|
Or as DEFAULT_SESSION_TIMEOUT,
|
|
4894
4940
|
ae as DEFAULT_WEB_VITALS_MODE,
|
|
4895
4941
|
L as DeviceType,
|
|
4896
|
-
|
|
4942
|
+
se as EmitterEvent,
|
|
4897
4943
|
U as ErrorType,
|
|
4898
4944
|
d as EventType,
|
|
4899
4945
|
Gr as InitializationTimeoutError,
|
|
4900
4946
|
V as IntegrationValidationError,
|
|
4901
|
-
|
|
4947
|
+
Fr as MAX_ARRAY_LENGTH,
|
|
4902
4948
|
kr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
4903
4949
|
Vr as MAX_CUSTOM_EVENT_KEYS,
|
|
4904
4950
|
Pr as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
@@ -4906,7 +4952,7 @@ export {
|
|
|
4906
4952
|
xr as MAX_METADATA_NESTING_DEPTH,
|
|
4907
4953
|
Ur as MAX_NESTED_OBJECT_KEYS,
|
|
4908
4954
|
Hr as MAX_STRING_LENGTH,
|
|
4909
|
-
|
|
4955
|
+
$r as MAX_STRING_LENGTH_IN_ARRAY,
|
|
4910
4956
|
j as Mode,
|
|
4911
4957
|
Be as PII_PATTERNS,
|
|
4912
4958
|
N as PermanentError,
|