@tracelog/lib 2.1.0-rc.74.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/tracelog.esm.js +504 -550
- 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 +2 -56
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +0 -34
- package/dist/public-api.d.ts +0 -34
- package/dist/public-api.js +2 -56
- 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, Fr = 500, $r = 100;
|
|
4
|
+
const w = "data-tlog", nt = [
|
|
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 = (s) => s ? `${I}:${s}:queue` : `${I}:queue`, ct = (s) => s ? `${I}:${s}:session` : `${I}:session`, ut = (s) => s ? `${I}:${s}:broadcast` : `${I}:broadcast`, Ie = (s, e) => `${I}:${s}:session_counts:${e}`, we = 10080 * 60 * 1e3, ye = `${I}:session_counts_last_cleanup`, be = 3600 * 1e3;
|
|
82
|
+
var k = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(k || {}), L = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(L || {}), ne = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(ne || {});
|
|
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__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s.VIEWPORT_VISIBLE = "viewport_visible", s))(d || {}), X = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(X || {}), U = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(U || {}), j = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(j || {});
|
|
89
|
+
const Br = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !0, Wr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.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;", Fe = "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 = (s, 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] ${s}: ${t}`;
|
|
125
125
|
}
|
|
126
126
|
if (e instanceof Error)
|
|
127
|
-
return `[TraceLog] ${
|
|
127
|
+
return `[TraceLog] ${s}: ${e.message}`;
|
|
128
128
|
if (typeof e == "string")
|
|
129
|
-
return `[TraceLog] ${
|
|
129
|
+
return `[TraceLog] ${s}: ${e}`;
|
|
130
130
|
if (typeof e == "object")
|
|
131
131
|
try {
|
|
132
|
-
return `[TraceLog] ${
|
|
132
|
+
return `[TraceLog] ${s}: ${JSON.stringify(e)}`;
|
|
133
133
|
} catch {
|
|
134
|
-
return `[TraceLog] ${
|
|
134
|
+
return `[TraceLog] ${s}: [Unable to serialize error]`;
|
|
135
135
|
}
|
|
136
|
-
return `[TraceLog] ${
|
|
136
|
+
return `[TraceLog] ${s}: ${String(e)}`;
|
|
137
137
|
}
|
|
138
|
-
return `[TraceLog] ${
|
|
138
|
+
return `[TraceLog] ${s}`;
|
|
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 = (s, e, t) => {
|
|
148
|
+
const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ? ft(e, r) : `[TraceLog] ${e}`, u = s === "error" ? "error" : s === "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 = n !== void 0 ? ie(n) : void 0;
|
|
152
152
|
St(u, c, g, E);
|
|
153
|
-
}, gt = (
|
|
154
|
-
const
|
|
155
|
-
r !== void 0 ?
|
|
156
|
-
}, ie = (
|
|
153
|
+
}, gt = (s, e) => s === "critical" ? !0 : s === "qa" || e ? mt() : !1, Et = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? ht : "", St = (s, e, t, r) => {
|
|
154
|
+
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
155
|
+
r !== void 0 ? n ? console[s](i, t, r) : console[s](i, r) : n ? console[s](i, t) : console[s](i);
|
|
156
|
+
}, ie = (s) => {
|
|
157
157
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
158
|
-
for (const [r,
|
|
158
|
+
for (const [r, n] of Object.entries(s)) {
|
|
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
|
+
n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] = ie(n) : Array.isArray(n) ? e[r] = n.map(
|
|
165
165
|
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ? ie(o) : o
|
|
166
|
-
) : e[r] =
|
|
166
|
+
) : e[r] = n;
|
|
167
167
|
}
|
|
168
168
|
return e;
|
|
169
169
|
};
|
|
170
|
-
let oe,
|
|
170
|
+
let oe, $e;
|
|
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)"), $e = window.matchMedia("(hover: none)"));
|
|
173
|
+
}, K = "Unknown", Tt = (s) => {
|
|
174
|
+
const e = s.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 = (s) => {
|
|
186
|
+
const e = s.userAgentData?.brands;
|
|
187
187
|
if (e != null && e.length > 0) {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
const i =
|
|
188
|
+
const n = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
|
|
189
|
+
if (n != null) {
|
|
190
|
+
const i = n.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 s = navigator;
|
|
199
|
+
if (s.userAgentData != null && typeof s.userAgentData.mobile == "boolean") {
|
|
200
|
+
const c = s.userAgentData.platform;
|
|
201
|
+
return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet : s.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 = $e?.matches ?? !1, n = "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 && n ? L.Mobile : e >= 768 && e <= 1024 || l || t && r && n ? L.Tablet : L.Desktop;
|
|
206
|
+
} catch (s) {
|
|
207
|
+
return a("debug", "Device detection failed, defaulting to desktop", { error: s }), L.Desktop;
|
|
208
208
|
}
|
|
209
209
|
}, It = () => {
|
|
210
210
|
try {
|
|
211
|
-
const
|
|
211
|
+
const s = navigator;
|
|
212
212
|
return {
|
|
213
213
|
type: vt(),
|
|
214
|
-
os: Tt(
|
|
215
|
-
browser: _t(
|
|
214
|
+
os: Tt(s),
|
|
215
|
+
browser: _t(s)
|
|
216
216
|
};
|
|
217
|
-
} catch (
|
|
218
|
-
return a("debug", "Device info detection failed, using defaults", { error:
|
|
217
|
+
} catch (s) {
|
|
218
|
+
return a("debug", "Device info detection failed, using defaults", { error: s }), {
|
|
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 = (s = ae) => {
|
|
276
|
+
switch (s) {
|
|
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.
|
|
287
|
+
}, Mt = 1e3, Ct = 50, Rt = "2.0.3", Nt = Rt, Ge = () => typeof window < "u" && typeof sessionStorage < "u", Ot = () => {
|
|
288
288
|
try {
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
const e =
|
|
289
|
+
const s = new URLSearchParams(window.location.search);
|
|
290
|
+
s.delete(xe);
|
|
291
|
+
const e = s.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: Fe
|
|
307
307
|
})), (e === _e || e === ve) && Ot(), r ?? t === "true";
|
|
308
308
|
} catch {
|
|
309
309
|
return !1;
|
|
310
310
|
}
|
|
311
|
-
}, Dt = (
|
|
311
|
+
}, Dt = (s) => {
|
|
312
312
|
if (Ge())
|
|
313
313
|
try {
|
|
314
|
-
sessionStorage.setItem(x,
|
|
314
|
+
sessionStorage.setItem(x, s ? "true" : "false"), a("info", s ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
315
315
|
visibility: "qa",
|
|
316
|
-
style:
|
|
316
|
+
style: s ? He : Fe
|
|
317
317
|
});
|
|
318
318
|
} catch {
|
|
319
319
|
a("debug", "Cannot set QA mode: sessionStorage unavailable");
|
|
320
320
|
}
|
|
321
321
|
}, Oe = () => {
|
|
322
|
-
const
|
|
322
|
+
const s = new URLSearchParams(window.location.search), e = {};
|
|
323
323
|
return it.forEach((r) => {
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
324
|
+
const n = s.get(r);
|
|
325
|
+
if (n) {
|
|
326
326
|
const i = r.split("utm_")[1];
|
|
327
|
-
e[i] =
|
|
327
|
+
e[i] = n;
|
|
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, (s) => {
|
|
331
331
|
const e = Math.random() * 16 | 0;
|
|
332
|
-
return (
|
|
332
|
+
return (s === "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 s = Date.now();
|
|
337
|
+
s < W && (s = W), s === W ? B = (B + 1) % 1e3 : B = 0, W = s;
|
|
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, (n) => n.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")), `${s}-${e}-${t}`;
|
|
348
|
+
}, Xe = (s, e = !1) => {
|
|
349
349
|
try {
|
|
350
|
-
const t = new URL(
|
|
351
|
-
return r || e &&
|
|
350
|
+
const t = new URL(s), r = t.protocol === "https:", n = t.protocol === "http:";
|
|
351
|
+
return r || e && n;
|
|
352
352
|
} catch {
|
|
353
353
|
return !1;
|
|
354
354
|
}
|
|
355
|
-
}, Ut = (
|
|
355
|
+
}, Ut = (s) => {
|
|
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 n;
|
|
370
|
+
if (r.length === 2 ? n = r.join(".") : n = r.slice(-2).join("."), !n || n.split(".").length < 2)
|
|
371
371
|
throw new Error("Invalid domain structure for SaaS");
|
|
372
|
-
const i = `https://${
|
|
372
|
+
const i = `https://${s}.${n}/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 = (s) => {
|
|
380
380
|
const e = {};
|
|
381
|
-
|
|
382
|
-
const t =
|
|
381
|
+
s.integrations?.tracelog?.projectId && (e.saas = Ut(s.integrations.tracelog.projectId));
|
|
382
|
+
const t = s.integrations?.custom?.collectApiUrl;
|
|
383
383
|
if (t) {
|
|
384
|
-
const r =
|
|
384
|
+
const r = s.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 = (s, e = []) => {
|
|
391
|
+
if (!s || typeof s != "string")
|
|
392
|
+
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof s } }), s || "";
|
|
393
393
|
try {
|
|
394
|
-
const t = new URL(
|
|
394
|
+
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...ot, ...e])];
|
|
395
395
|
let i = !1;
|
|
396
396
|
const o = [];
|
|
397
|
-
return
|
|
397
|
+
return n.forEach((c) => {
|
|
398
398
|
r.has(c) && (r.delete(c), i = !0, o.push(c));
|
|
399
|
-
}), !i &&
|
|
399
|
+
}), !i && s.includes("?") ? s : (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: s?.length } }), s;
|
|
402
402
|
}
|
|
403
|
-
}, Pe = (
|
|
404
|
-
if (!
|
|
403
|
+
}, Pe = (s) => {
|
|
404
|
+
if (!s || typeof s != "string" || s.trim().length === 0)
|
|
405
405
|
return "";
|
|
406
|
-
let e =
|
|
407
|
-
|
|
406
|
+
let e = s;
|
|
407
|
+
s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
|
|
408
408
|
let t = 0;
|
|
409
|
-
for (const
|
|
409
|
+
for (const n of at) {
|
|
410
410
|
const i = e;
|
|
411
|
-
e = e.replace(
|
|
411
|
+
e = e.replace(n, ""), 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: s.length
|
|
417
417
|
}
|
|
418
418
|
}), e = e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'").replaceAll("/", "/"), e.trim();
|
|
419
|
-
}, ce = (
|
|
420
|
-
if (e > 3 ||
|
|
419
|
+
}, ce = (s, e = 0) => {
|
|
420
|
+
if (e > 3 || s == 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 s == "string")
|
|
423
|
+
return Pe(s);
|
|
424
|
+
if (typeof s == "number")
|
|
425
|
+
return !Number.isFinite(s) || s < -Number.MAX_SAFE_INTEGER || s > Number.MAX_SAFE_INTEGER ? 0 : s;
|
|
426
|
+
if (typeof s == "boolean")
|
|
427
|
+
return s;
|
|
428
|
+
if (Array.isArray(s))
|
|
429
|
+
return s.slice(0, 100).map((n) => ce(n, e + 1)).filter((n) => n !== null);
|
|
430
|
+
if (typeof s == "object") {
|
|
431
|
+
const t = {}, n = Object.entries(s).slice(0, 20);
|
|
432
|
+
for (const [i, o] of n) {
|
|
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 = (s) => {
|
|
443
|
+
if (typeof s != "object" || s === null)
|
|
444
444
|
return {};
|
|
445
445
|
try {
|
|
446
|
-
const e = ce(
|
|
446
|
+
const e = ce(s);
|
|
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
|
+
}, Ft = (s) => {
|
|
453
|
+
if (s !== void 0 && (s === null || typeof s != "object"))
|
|
454
454
|
throw new h("Configuration must be an object", "config");
|
|
455
|
-
if (
|
|
456
|
-
if (
|
|
455
|
+
if (s) {
|
|
456
|
+
if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
|
|
457
457
|
throw new dt(m.INVALID_SESSION_TIMEOUT, "config");
|
|
458
|
-
if (
|
|
458
|
+
if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
|
|
459
459
|
throw new h(m.INVALID_GLOBAL_METADATA, "config");
|
|
460
|
-
if (
|
|
461
|
-
if (!Array.isArray(
|
|
460
|
+
if (s.integrations && Bt(s.integrations), s.sensitiveQueryParams !== void 0) {
|
|
461
|
+
if (!Array.isArray(s.sensitiveQueryParams))
|
|
462
462
|
throw new h(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
463
|
-
for (const e of
|
|
463
|
+
for (const e of s.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 (s.errorSampling !== void 0 && (typeof s.errorSampling != "number" || s.errorSampling < 0 || s.errorSampling > 1))
|
|
468
468
|
throw new Ae(m.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
469
|
-
if (
|
|
469
|
+
if (s.samplingRate !== void 0 && (typeof s.samplingRate != "number" || s.samplingRate < 0 || s.samplingRate > 1))
|
|
470
470
|
throw new Ae(m.INVALID_SAMPLING_RATE, "config");
|
|
471
|
-
if (
|
|
472
|
-
if (typeof
|
|
471
|
+
if (s.primaryScrollSelector !== void 0) {
|
|
472
|
+
if (typeof s.primaryScrollSelector != "string" || !s.primaryScrollSelector.trim())
|
|
473
473
|
throw new h(m.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
474
|
-
if (
|
|
474
|
+
if (s.primaryScrollSelector !== "window")
|
|
475
475
|
try {
|
|
476
|
-
document.querySelector(
|
|
476
|
+
document.querySelector(s.primaryScrollSelector);
|
|
477
477
|
} catch {
|
|
478
478
|
throw new h(
|
|
479
|
-
`${m.INVALID_PRIMARY_SCROLL_SELECTOR_SYNTAX}: "${
|
|
479
|
+
`${m.INVALID_PRIMARY_SCROLL_SELECTOR_SYNTAX}: "${s.primaryScrollSelector}"`,
|
|
480
480
|
"config"
|
|
481
481
|
);
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
484
|
+
if (s.pageViewThrottleMs !== void 0 && (typeof s.pageViewThrottleMs != "number" || s.pageViewThrottleMs < 0))
|
|
485
485
|
throw new h(m.INVALID_PAGE_VIEW_THROTTLE, "config");
|
|
486
|
-
if (
|
|
486
|
+
if (s.clickThrottleMs !== void 0 && (typeof s.clickThrottleMs != "number" || s.clickThrottleMs < 0))
|
|
487
487
|
throw new h(m.INVALID_CLICK_THROTTLE, "config");
|
|
488
|
-
if (
|
|
488
|
+
if (s.maxSameEventPerMinute !== void 0 && (typeof s.maxSameEventPerMinute != "number" || s.maxSameEventPerMinute <= 0))
|
|
489
489
|
throw new h(m.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
|
|
490
|
-
if (
|
|
491
|
-
if (typeof
|
|
490
|
+
if (s.viewport !== void 0 && $t(s.viewport), s.webVitalsMode !== void 0) {
|
|
491
|
+
if (typeof s.webVitalsMode != "string")
|
|
492
492
|
throw new h(
|
|
493
|
-
`Invalid webVitalsMode type: ${typeof
|
|
493
|
+
`Invalid webVitalsMode type: ${typeof s.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(s.webVitalsMode))
|
|
498
498
|
throw new h(
|
|
499
|
-
`Invalid webVitalsMode: "${
|
|
499
|
+
`Invalid webVitalsMode: "${s.webVitalsMode}". Must be one of: ${e.join(", ")}`,
|
|
500
500
|
"config"
|
|
501
501
|
);
|
|
502
502
|
}
|
|
503
|
-
if (
|
|
504
|
-
if (typeof
|
|
503
|
+
if (s.webVitalsThresholds !== void 0) {
|
|
504
|
+
if (typeof s.webVitalsThresholds != "object" || s.webVitalsThresholds === null || Array.isArray(s.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(s.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
|
+
}, $t = (s) => {
|
|
522
|
+
if (typeof s != "object" || s === null)
|
|
523
523
|
throw new h(m.INVALID_VIEWPORT_CONFIG, "config");
|
|
524
|
-
if (!
|
|
524
|
+
if (!s.elements || !Array.isArray(s.elements))
|
|
525
525
|
throw new h(m.INVALID_VIEWPORT_ELEMENTS, "config");
|
|
526
|
-
if (
|
|
526
|
+
if (s.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 s.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 (s.threshold !== void 0 && (typeof s.threshold != "number" || s.threshold < 0 || s.threshold > 1))
|
|
544
544
|
throw new h(m.INVALID_VIEWPORT_THRESHOLD, "config");
|
|
545
|
-
if (
|
|
545
|
+
if (s.minDwellTime !== void 0 && (typeof s.minDwellTime != "number" || s.minDwellTime < 0))
|
|
546
546
|
throw new h(m.INVALID_VIEWPORT_MIN_DWELL_TIME, "config");
|
|
547
|
-
if (
|
|
547
|
+
if (s.cooldownPeriod !== void 0 && (typeof s.cooldownPeriod != "number" || s.cooldownPeriod < 0))
|
|
548
548
|
throw new h(m.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
549
|
-
if (
|
|
549
|
+
if (s.maxTrackedElements !== void 0 && (typeof s.maxTrackedElements != "number" || s.maxTrackedElements <= 0))
|
|
550
550
|
throw new h(m.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
551
|
-
}, Bt = (
|
|
552
|
-
if (
|
|
553
|
-
if (
|
|
551
|
+
}, Bt = (s) => {
|
|
552
|
+
if (s) {
|
|
553
|
+
if (s.tracelog && (!s.tracelog.projectId || typeof s.tracelog.projectId != "string" || s.tracelog.projectId.trim() === ""))
|
|
554
554
|
throw new V(m.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
555
|
-
if (
|
|
556
|
-
if (!
|
|
555
|
+
if (s.custom) {
|
|
556
|
+
if (!s.custom.collectApiUrl || typeof s.custom.collectApiUrl != "string" || s.custom.collectApiUrl.trim() === "")
|
|
557
557
|
throw new V(m.INVALID_CUSTOM_API_URL, "config");
|
|
558
|
-
if (
|
|
558
|
+
if (s.custom.allowHttp !== void 0 && typeof s.custom.allowHttp != "boolean")
|
|
559
559
|
throw new V("allowHttp must be a boolean", "config");
|
|
560
|
-
const e =
|
|
560
|
+
const e = s.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 (!(s.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 = (s) => {
|
|
571
|
+
Ft(s);
|
|
572
572
|
const e = {
|
|
573
|
-
...
|
|
574
|
-
sessionTimeout:
|
|
575
|
-
globalMetadata:
|
|
576
|
-
sensitiveQueryParams:
|
|
577
|
-
errorSampling:
|
|
578
|
-
samplingRate:
|
|
579
|
-
pageViewThrottleMs:
|
|
580
|
-
clickThrottleMs:
|
|
581
|
-
maxSameEventPerMinute:
|
|
573
|
+
...s ?? {},
|
|
574
|
+
sessionTimeout: s?.sessionTimeout ?? 9e5,
|
|
575
|
+
globalMetadata: s?.globalMetadata ?? {},
|
|
576
|
+
sensitiveQueryParams: s?.sensitiveQueryParams ?? [],
|
|
577
|
+
errorSampling: s?.errorSampling ?? We,
|
|
578
|
+
samplingRate: s?.samplingRate ?? 1,
|
|
579
|
+
pageViewThrottleMs: s?.pageViewThrottleMs ?? 1e3,
|
|
580
|
+
clickThrottleMs: s?.clickThrottleMs ?? 300,
|
|
581
|
+
maxSameEventPerMinute: s?.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 = (s) => {
|
|
594
|
+
if (typeof s == "string")
|
|
595
595
|
return !0;
|
|
596
|
-
if (typeof
|
|
597
|
-
const e = Object.entries(
|
|
596
|
+
if (typeof s == "object" && s !== null && !Array.isArray(s)) {
|
|
597
|
+
const e = Object.entries(s);
|
|
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 = (s, e = 0) => {
|
|
611
|
+
if (typeof s != "object" || s === null || e > 1)
|
|
612
612
|
return !1;
|
|
613
|
-
for (const t of Object.values(
|
|
613
|
+
for (const t of Object.values(s)) {
|
|
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 = (s) => typeof s != "string" ? {
|
|
638
638
|
valid: !1,
|
|
639
639
|
error: "Event name must be a string"
|
|
640
|
-
} :
|
|
640
|
+
} : s.length === 0 ? {
|
|
641
641
|
valid: !1,
|
|
642
642
|
error: "Event name cannot be empty"
|
|
643
|
-
} :
|
|
643
|
+
} : s.length > 120 ? {
|
|
644
644
|
valid: !1,
|
|
645
645
|
error: "Event name is too long (max 120 characters)"
|
|
646
|
-
} :
|
|
646
|
+
} : s.includes("<") || s.includes(">") || s.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(s.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 = (s, e, t) => {
|
|
653
|
+
const r = Ht(e), n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
654
654
|
if (!Qe(r))
|
|
655
655
|
return {
|
|
656
656
|
valid: !1,
|
|
657
|
-
error: `${
|
|
657
|
+
error: `${n}: 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: `${n}: 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: `${n}: 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: `${n}: 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: `${n}: 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: `${n}: 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: `${n}: 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 = (s, e, t) => {
|
|
703
703
|
if (Array.isArray(e)) {
|
|
704
|
-
const r = [],
|
|
704
|
+
const r = [], n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} 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: `${n}: array item at index ${i} must be an object.`
|
|
711
711
|
};
|
|
712
|
-
const l = De(
|
|
712
|
+
const l = De(s, o, t);
|
|
713
713
|
if (!l.valid)
|
|
714
714
|
return {
|
|
715
715
|
valid: !1,
|
|
716
|
-
error: `${
|
|
716
|
+
error: `${n}: 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(s, e, t);
|
|
726
|
+
}, Qt = (s, e) => {
|
|
727
|
+
const t = Xt(s);
|
|
728
728
|
if (!t.valid)
|
|
729
729
|
return a("error", "Event name validation failed", {
|
|
730
|
-
data: { eventName:
|
|
730
|
+
data: { eventName: s, error: t.error }
|
|
731
731
|
}), t;
|
|
732
732
|
if (!e)
|
|
733
733
|
return { valid: !0 };
|
|
734
|
-
const r = ze(
|
|
734
|
+
const r = ze(s, e, "customEvent");
|
|
735
735
|
return r.valid || a("error", "Event metadata validation failed", {
|
|
736
736
|
data: {
|
|
737
|
-
eventName:
|
|
737
|
+
eventName: s,
|
|
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 n = r.indexOf(t);
|
|
796
|
+
n > -1 && r.splice(n, 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((n) => {
|
|
830
|
+
n(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(s, 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(s);
|
|
862
|
+
return r === null ? null : typeof r == "object" && r !== null && "type" in r ? r : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), s);
|
|
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
|
+
}), s;
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
function jt(
|
|
871
|
-
return
|
|
870
|
+
function jt(s, e, t) {
|
|
871
|
+
return s.map((r) => je(r, e, t)).filter((r) => r !== null);
|
|
872
872
|
}
|
|
873
|
-
function Ke(
|
|
873
|
+
function Ke(s, e, t) {
|
|
874
874
|
try {
|
|
875
|
-
const r = e(
|
|
875
|
+
const r = e(s);
|
|
876
876
|
return r === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
|
|
877
|
-
data: { eventCount:
|
|
877
|
+
data: { eventCount: s.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: s.events.length }
|
|
880
|
+
}), s);
|
|
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: s.events.length },
|
|
885
885
|
visibility: "critical"
|
|
886
|
-
}),
|
|
886
|
+
}), s;
|
|
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, n = {}) {
|
|
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 = n;
|
|
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, n = t + r;
|
|
1251
|
+
return new Promise((i) => setTimeout(i, n));
|
|
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: n, 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(n, 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: n.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 n = 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(n), 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: n, 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(n, 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
|
+
}, n = this.getQueueStorageKey();
|
|
1555
|
+
return this.storeManager.setItem(n, JSON.stringify(r)), !!this.storeManager.getItem(n);
|
|
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(), n = e - r;
|
|
1715
|
+
return n > 12e4 ? {
|
|
1716
1716
|
valid: !1,
|
|
1717
|
-
error: `Timestamp is ${(
|
|
1717
|
+
error: `Timestamp is ${(n / 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 n = this.get("collectApiUrls");
|
|
1772
|
+
n?.saas && this.dataSenders.push(new Ve(e, "saas", n.saas, r)), n?.custom && this.dataSenders.push(new Ve(e, "custom", n.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, n, i) => {
|
|
1804
|
+
if (n && n.length > 0) {
|
|
1805
|
+
const o = n.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: n,
|
|
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: n,
|
|
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 $ = p === d.SESSION_START, st = t || this.get("pageUrl"), D = this.buildEventPayload({
|
|
1948
1948
|
type: p,
|
|
1949
|
-
page_url:
|
|
1949
|
+
page_url: st,
|
|
1950
1950
|
from_page_url: r,
|
|
1951
|
-
scroll_data:
|
|
1951
|
+
scroll_data: n,
|
|
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 ($) {
|
|
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], n = r.map((i) => i.id);
|
|
2250
2250
|
if (this.dataSenders.length === 0)
|
|
2251
|
-
return this.removeProcessedEvents(
|
|
2251
|
+
return this.removeProcessedEvents(n), 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(n), this.clearSendInterval(), this.emitEventsQueue(t)) : (this.clearSendInterval(), a("debug", "Sync flush complete failure, events kept in queue for retry", {
|
|
2255
|
+
data: { eventCount: n.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(n), 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), n = 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(n);
|
|
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 n = {
|
|
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(n, l, "EventManager");
|
|
2319
|
+
c !== null && (n = c);
|
|
2320
2320
|
}
|
|
2321
|
-
return
|
|
2321
|
+
return n;
|
|
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"), n = this.timeManager.now(), i = this.timeManager.validateTimestamp(n);
|
|
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: n,
|
|
2333
|
+
...t && { referrer: document.referrer || "Direct" },
|
|
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 $ = je(o, E, "EventManager");
|
|
2347
|
+
if ($ === null)
|
|
2348
2348
|
return null;
|
|
2349
|
-
o =
|
|
2349
|
+
o = $;
|
|
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), n = this.recentEventFingerprints.get(r);
|
|
2355
|
+
return n && t - n < 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, n] of this.recentEventFingerprints.entries())
|
|
2362
|
+
e - n > 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, n = Math.round((e.click_data.y || 0) / 10) * 10;
|
|
2374
|
+
t += `_click_${r}_${n}`;
|
|
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((n) => n.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(ne.EVENT, e);
|
|
2433
2433
|
}
|
|
2434
2434
|
emitEventsQueue(e) {
|
|
2435
|
-
this.emitter && this.emitter.emit(
|
|
2435
|
+
this.emitter && this.emitter.emit(ne.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 ((...n) => {
|
|
2460
2460
|
r !== null && clearTimeout(r), r = setTimeout(() => {
|
|
2461
|
-
e(...
|
|
2461
|
+
e(...n), 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 n = localStorage.getItem(r);
|
|
2514
|
+
if (!n)
|
|
2515
2515
|
return this.getInitialCounts();
|
|
2516
|
-
const i = JSON.parse(
|
|
2516
|
+
const i = JSON.parse(n);
|
|
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 (n) {
|
|
2532
2532
|
return a("warn", "Failed to load session counts from localStorage", {
|
|
2533
|
-
error:
|
|
2533
|
+
error: n,
|
|
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:`, n = [];
|
|
2573
2573
|
for (let i = 0; i < localStorage.length; i++) {
|
|
2574
2574
|
const o = localStorage.key(i);
|
|
2575
2575
|
if (o?.startsWith(r))
|
|
@@ -2577,64 +2577,18 @@ 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 && n.push(o);
|
|
2581
2581
|
}
|
|
2582
2582
|
} catch {
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
|
-
|
|
2585
|
+
n.forEach((i) => {
|
|
2586
2586
|
localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
|
|
2587
|
-
}),
|
|
2587
|
+
}), n.length > 0 && a("info", `Cleaned up ${n.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
|
-
}
|
|
2638
2592
|
/**
|
|
2639
2593
|
* Persists current session event counts to localStorage (debounced).
|
|
2640
2594
|
*
|
|
@@ -2666,15 +2620,15 @@ class Yt extends _ {
|
|
|
2666
2620
|
saveSessionCounts(e) {
|
|
2667
2621
|
const t = this.get("userId") || "anonymous", r = Ie(t, e);
|
|
2668
2622
|
try {
|
|
2669
|
-
const
|
|
2623
|
+
const n = {
|
|
2670
2624
|
...this.sessionEventCounts,
|
|
2671
2625
|
_timestamp: Date.now(),
|
|
2672
2626
|
_version: 1
|
|
2673
2627
|
};
|
|
2674
|
-
localStorage.setItem(r, JSON.stringify(
|
|
2675
|
-
} catch (
|
|
2628
|
+
localStorage.setItem(r, JSON.stringify(n));
|
|
2629
|
+
} catch (n) {
|
|
2676
2630
|
a("warn", "Failed to persist session counts to localStorage", {
|
|
2677
|
-
error:
|
|
2631
|
+
error: n,
|
|
2678
2632
|
data: { sessionId: e }
|
|
2679
2633
|
});
|
|
2680
2634
|
}
|
|
@@ -2732,8 +2686,8 @@ class Zt extends _ {
|
|
|
2732
2686
|
}
|
|
2733
2687
|
const e = this.getProjectId();
|
|
2734
2688
|
this.broadcastChannel = new BroadcastChannel(ut(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2735
|
-
const { action: r, sessionId:
|
|
2736
|
-
o === e && (r === "session_start" &&
|
|
2689
|
+
const { action: r, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
|
|
2690
|
+
o === e && (r === "session_start" && n && typeof i == "number" && i > Date.now() - 5e3 ? (this.set("sessionId", n), this.persistSession(n, i), this.isTracking && this.setupSessionTimeout()) : r && r !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: r } }));
|
|
2737
2691
|
};
|
|
2738
2692
|
}
|
|
2739
2693
|
shareSession(e) {
|
|
@@ -3098,8 +3052,8 @@ class tr extends _ {
|
|
|
3098
3052
|
const e = window.location.href, t = le(e, this.get("config").sensitiveQueryParams);
|
|
3099
3053
|
if (this.get("pageUrl") === t)
|
|
3100
3054
|
return;
|
|
3101
|
-
const r = Date.now(),
|
|
3102
|
-
if (r - this.lastPageViewTime <
|
|
3055
|
+
const r = Date.now(), n = this.get("config").pageViewThrottleMs ?? 1e3;
|
|
3056
|
+
if (r - this.lastPageViewTime < n)
|
|
3103
3057
|
return;
|
|
3104
3058
|
this.lastPageViewTime = r, this.onTrack();
|
|
3105
3059
|
const i = this.get("pageUrl");
|
|
@@ -3121,9 +3075,9 @@ class tr extends _ {
|
|
|
3121
3075
|
}), this.onTrack();
|
|
3122
3076
|
}
|
|
3123
3077
|
extractPageViewData() {
|
|
3124
|
-
const { pathname: e, search: t, hash: r } = window.location, { referrer:
|
|
3125
|
-
return !
|
|
3126
|
-
...
|
|
3078
|
+
const { pathname: e, search: t, hash: r } = window.location, { referrer: n } = document, { title: i } = document;
|
|
3079
|
+
return !n && !i && !e && !t && !r ? void 0 : {
|
|
3080
|
+
...n && { referrer: n },
|
|
3127
3081
|
...i && { title: i },
|
|
3128
3082
|
...e && { pathname: e },
|
|
3129
3083
|
...t && { search: t },
|
|
@@ -3154,17 +3108,17 @@ class rr extends _ {
|
|
|
3154
3108
|
*/
|
|
3155
3109
|
startTracking() {
|
|
3156
3110
|
this.clickHandler || (this.clickHandler = (e) => {
|
|
3157
|
-
const t = e, r = t.target,
|
|
3158
|
-
if (!
|
|
3111
|
+
const t = e, r = t.target, n = typeof HTMLElement < "u" && r instanceof HTMLElement ? r : typeof HTMLElement < "u" && r instanceof Node && r.parentElement instanceof HTMLElement ? r.parentElement : null;
|
|
3112
|
+
if (!n) {
|
|
3159
3113
|
a("debug", "Click target not found or not an element");
|
|
3160
3114
|
return;
|
|
3161
3115
|
}
|
|
3162
|
-
if (this.shouldIgnoreElement(
|
|
3116
|
+
if (this.shouldIgnoreElement(n))
|
|
3163
3117
|
return;
|
|
3164
3118
|
const i = this.get("config")?.clickThrottleMs ?? 300;
|
|
3165
|
-
if (i > 0 && !this.checkClickThrottle(
|
|
3119
|
+
if (i > 0 && !this.checkClickThrottle(n, i))
|
|
3166
3120
|
return;
|
|
3167
|
-
const o = this.findTrackingElement(
|
|
3121
|
+
const o = this.findTrackingElement(n), l = this.getRelevantClickElement(n), c = this.calculateClickCoordinates(t, n);
|
|
3168
3122
|
if (o) {
|
|
3169
3123
|
const S = this.extractTrackingData(o);
|
|
3170
3124
|
if (S) {
|
|
@@ -3178,7 +3132,7 @@ class rr extends _ {
|
|
|
3178
3132
|
});
|
|
3179
3133
|
}
|
|
3180
3134
|
}
|
|
3181
|
-
const u = this.generateClickData(
|
|
3135
|
+
const u = this.generateClickData(n, l, c);
|
|
3182
3136
|
this.eventManager.track({
|
|
3183
3137
|
type: d.CLICK,
|
|
3184
3138
|
click_data: u
|
|
@@ -3202,15 +3156,15 @@ class rr extends _ {
|
|
|
3202
3156
|
* Returns true if the click should be tracked, false if throttled
|
|
3203
3157
|
*/
|
|
3204
3158
|
checkClickThrottle(e, t) {
|
|
3205
|
-
const r = this.getElementSignature(e),
|
|
3206
|
-
this.pruneThrottleCache(
|
|
3159
|
+
const r = this.getElementSignature(e), n = Date.now();
|
|
3160
|
+
this.pruneThrottleCache(n);
|
|
3207
3161
|
const i = this.lastClickTimes.get(r);
|
|
3208
|
-
return i !== void 0 &&
|
|
3162
|
+
return i !== void 0 && n - i < t ? (a("debug", "ClickHandler: Click suppressed by throttle", {
|
|
3209
3163
|
data: {
|
|
3210
3164
|
signature: r,
|
|
3211
|
-
throttleRemaining: t - (
|
|
3165
|
+
throttleRemaining: t - (n - i)
|
|
3212
3166
|
}
|
|
3213
|
-
}), !1) : (this.lastClickTimes.set(r,
|
|
3167
|
+
}), !1) : (this.lastClickTimes.set(r, n), !0);
|
|
3214
3168
|
}
|
|
3215
3169
|
/**
|
|
3216
3170
|
* Prunes stale entries from the throttle cache to prevent memory leaks
|
|
@@ -3222,10 +3176,10 @@ class rr extends _ {
|
|
|
3222
3176
|
return;
|
|
3223
3177
|
this.lastPruneTime = e;
|
|
3224
3178
|
const t = e - 3e5;
|
|
3225
|
-
for (const [r,
|
|
3226
|
-
|
|
3179
|
+
for (const [r, n] of this.lastClickTimes.entries())
|
|
3180
|
+
n < t && this.lastClickTimes.delete(r);
|
|
3227
3181
|
if (this.lastClickTimes.size > 1e3) {
|
|
3228
|
-
const r = Array.from(this.lastClickTimes.entries()).sort((o, l) => o[1] - l[1]),
|
|
3182
|
+
const r = Array.from(this.lastClickTimes.entries()).sort((o, l) => o[1] - l[1]), n = this.lastClickTimes.size - 1e3, i = r.slice(0, n);
|
|
3229
3183
|
for (const [o] of i)
|
|
3230
3184
|
this.lastClickTimes.delete(o);
|
|
3231
3185
|
a("debug", "ClickHandler: Pruned throttle cache", {
|
|
@@ -3256,12 +3210,12 @@ class rr extends _ {
|
|
|
3256
3210
|
const t = [];
|
|
3257
3211
|
let r = e;
|
|
3258
3212
|
for (; r && r !== document.body; ) {
|
|
3259
|
-
let
|
|
3213
|
+
let n = r.tagName.toLowerCase();
|
|
3260
3214
|
if (r.className) {
|
|
3261
3215
|
const i = r.className.split(" ")[0];
|
|
3262
|
-
i && (
|
|
3216
|
+
i && (n += `.${i}`);
|
|
3263
3217
|
}
|
|
3264
|
-
t.unshift(
|
|
3218
|
+
t.unshift(n), r = r.parentElement;
|
|
3265
3219
|
}
|
|
3266
3220
|
return t.join(">") || "unknown";
|
|
3267
3221
|
}
|
|
@@ -3269,7 +3223,7 @@ class rr extends _ {
|
|
|
3269
3223
|
return e.hasAttribute(`${w}-name`) ? e : e.closest(`[${w}-name]`);
|
|
3270
3224
|
}
|
|
3271
3225
|
getRelevantClickElement(e) {
|
|
3272
|
-
for (const t of
|
|
3226
|
+
for (const t of nt)
|
|
3273
3227
|
try {
|
|
3274
3228
|
if (e.matches(t))
|
|
3275
3229
|
return e;
|
|
@@ -3297,8 +3251,8 @@ class rr extends _ {
|
|
|
3297
3251
|
return Math.max(0, Math.min(1, Number(e.toFixed(3))));
|
|
3298
3252
|
}
|
|
3299
3253
|
calculateClickCoordinates(e, t) {
|
|
3300
|
-
const r = t.getBoundingClientRect(),
|
|
3301
|
-
return { x:
|
|
3254
|
+
const r = t.getBoundingClientRect(), n = e.clientX, i = e.clientY, o = r.width > 0 ? this.clamp((n - r.left) / r.width) : 0, l = r.height > 0 ? this.clamp((i - r.top) / r.height) : 0;
|
|
3255
|
+
return { x: n, y: i, relativeX: o, relativeY: l };
|
|
3302
3256
|
}
|
|
3303
3257
|
extractTrackingData(e) {
|
|
3304
3258
|
const t = e.getAttribute(`${w}-name`), r = e.getAttribute(`${w}-value`);
|
|
@@ -3310,9 +3264,9 @@ class rr extends _ {
|
|
|
3310
3264
|
};
|
|
3311
3265
|
}
|
|
3312
3266
|
generateClickData(e, t, r) {
|
|
3313
|
-
const { x:
|
|
3267
|
+
const { x: n, y: i, relativeX: o, relativeY: l } = r, c = this.getRelevantText(e, t), u = this.extractElementAttributes(t);
|
|
3314
3268
|
return {
|
|
3315
|
-
x:
|
|
3269
|
+
x: n,
|
|
3316
3270
|
y: i,
|
|
3317
3271
|
relativeX: o,
|
|
3318
3272
|
relativeY: l,
|
|
@@ -3350,17 +3304,17 @@ class rr extends _ {
|
|
|
3350
3304
|
sanitizeText(e) {
|
|
3351
3305
|
let t = e;
|
|
3352
3306
|
for (const r of Be) {
|
|
3353
|
-
const
|
|
3354
|
-
t = t.replace(
|
|
3307
|
+
const n = new RegExp(r.source, r.flags);
|
|
3308
|
+
t = t.replace(n, "[REDACTED]");
|
|
3355
3309
|
}
|
|
3356
3310
|
return t;
|
|
3357
3311
|
}
|
|
3358
3312
|
getRelevantText(e, t) {
|
|
3359
|
-
const r = e.textContent?.trim() ?? "",
|
|
3360
|
-
if (!r && !
|
|
3313
|
+
const r = e.textContent?.trim() ?? "", n = t.textContent?.trim() ?? "";
|
|
3314
|
+
if (!r && !n)
|
|
3361
3315
|
return "";
|
|
3362
3316
|
let i = "";
|
|
3363
|
-
return r && r.length <= 255 ? i = r :
|
|
3317
|
+
return r && r.length <= 255 ? i = r : n.length <= 255 ? i = n : i = n.slice(0, 252) + "...", this.sanitizeText(i);
|
|
3364
3318
|
}
|
|
3365
3319
|
extractElementAttributes(e) {
|
|
3366
3320
|
const t = [
|
|
@@ -3375,9 +3329,9 @@ class rr extends _ {
|
|
|
3375
3329
|
"alt",
|
|
3376
3330
|
"role"
|
|
3377
3331
|
], r = {};
|
|
3378
|
-
for (const
|
|
3379
|
-
const i = e.getAttribute(
|
|
3380
|
-
i && (r[
|
|
3332
|
+
for (const n of t) {
|
|
3333
|
+
const i = e.getAttribute(n);
|
|
3334
|
+
i && (r[n] = i);
|
|
3381
3335
|
}
|
|
3382
3336
|
return r;
|
|
3383
3337
|
}
|
|
@@ -3388,7 +3342,7 @@ class rr extends _ {
|
|
|
3388
3342
|
};
|
|
3389
3343
|
}
|
|
3390
3344
|
}
|
|
3391
|
-
class
|
|
3345
|
+
class sr extends _ {
|
|
3392
3346
|
eventManager;
|
|
3393
3347
|
containers = [];
|
|
3394
3348
|
limitWarningLogged = !1;
|
|
@@ -3435,8 +3389,8 @@ class nr extends _ {
|
|
|
3435
3389
|
const t = this.findScrollableElements();
|
|
3436
3390
|
if (this.isWindowScrollable() && this.setupScrollContainer(window, "window"), t.length > 0) {
|
|
3437
3391
|
for (const r of t) {
|
|
3438
|
-
const
|
|
3439
|
-
this.setupScrollContainer(r,
|
|
3392
|
+
const n = this.getElementSelector(r);
|
|
3393
|
+
this.setupScrollContainer(r, n);
|
|
3440
3394
|
}
|
|
3441
3395
|
this.applyPrimaryScrollSelectorIfConfigured();
|
|
3442
3396
|
return;
|
|
@@ -3457,8 +3411,8 @@ class nr extends _ {
|
|
|
3457
3411
|
if (!document.body)
|
|
3458
3412
|
return [];
|
|
3459
3413
|
const e = [], t = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, {
|
|
3460
|
-
acceptNode: (
|
|
3461
|
-
const i =
|
|
3414
|
+
acceptNode: (n) => {
|
|
3415
|
+
const i = n;
|
|
3462
3416
|
if (!i.isConnected || !i.offsetParent)
|
|
3463
3417
|
return NodeFilter.FILTER_SKIP;
|
|
3464
3418
|
const o = getComputedStyle(i);
|
|
@@ -3467,8 +3421,8 @@ class nr extends _ {
|
|
|
3467
3421
|
});
|
|
3468
3422
|
let r;
|
|
3469
3423
|
for (; (r = t.nextNode()) && e.length < 10; ) {
|
|
3470
|
-
const
|
|
3471
|
-
this.isElementScrollable(
|
|
3424
|
+
const n = r;
|
|
3425
|
+
this.isElementScrollable(n) && e.push(n);
|
|
3472
3426
|
}
|
|
3473
3427
|
return e;
|
|
3474
3428
|
}
|
|
@@ -3479,7 +3433,7 @@ class nr extends _ {
|
|
|
3479
3433
|
if (t.id)
|
|
3480
3434
|
return `#${t.id}`;
|
|
3481
3435
|
if (t.className && typeof t.className == "string") {
|
|
3482
|
-
const r = t.className.split(" ").filter((
|
|
3436
|
+
const r = t.className.split(" ").filter((n) => n.trim())[0];
|
|
3483
3437
|
if (r)
|
|
3484
3438
|
return `.${r}`;
|
|
3485
3439
|
}
|
|
@@ -3491,15 +3445,15 @@ class nr extends _ {
|
|
|
3491
3445
|
setupScrollContainer(e, t) {
|
|
3492
3446
|
if (this.containers.some((u) => u.element === e) || e !== window && !this.isElementScrollable(e))
|
|
3493
3447
|
return;
|
|
3494
|
-
const
|
|
3495
|
-
|
|
3448
|
+
const n = this.getScrollTop(e), i = this.calculateScrollDepth(
|
|
3449
|
+
n,
|
|
3496
3450
|
this.getScrollHeight(e),
|
|
3497
3451
|
this.getViewportHeight(e)
|
|
3498
3452
|
), o = this.determineIfPrimary(e), l = {
|
|
3499
3453
|
element: e,
|
|
3500
3454
|
selector: t,
|
|
3501
3455
|
isPrimary: o,
|
|
3502
|
-
lastScrollPos:
|
|
3456
|
+
lastScrollPos: n,
|
|
3503
3457
|
lastDepth: i,
|
|
3504
3458
|
lastDirection: X.DOWN,
|
|
3505
3459
|
lastEventTime: 0,
|
|
@@ -3523,8 +3477,8 @@ class nr extends _ {
|
|
|
3523
3477
|
if (!this.shouldEmitScrollEvent(e, t, r))
|
|
3524
3478
|
return;
|
|
3525
3479
|
e.lastEventTime = r, e.lastDepth = t.depth, e.lastDirection = t.direction;
|
|
3526
|
-
const
|
|
3527
|
-
this.set("scrollEventCount",
|
|
3480
|
+
const n = this.get("scrollEventCount") ?? 0;
|
|
3481
|
+
this.set("scrollEventCount", n + 1), this.eventManager.track({
|
|
3528
3482
|
type: d.SCROLL,
|
|
3529
3483
|
scroll_data: {
|
|
3530
3484
|
...t,
|
|
@@ -3565,16 +3519,16 @@ class nr extends _ {
|
|
|
3565
3519
|
calculateScrollDepth(e, t, r) {
|
|
3566
3520
|
if (t <= r)
|
|
3567
3521
|
return 0;
|
|
3568
|
-
const
|
|
3569
|
-
return Math.min(100, Math.max(0, Math.floor(e /
|
|
3522
|
+
const n = t - r;
|
|
3523
|
+
return Math.min(100, Math.max(0, Math.floor(e / n * 100)));
|
|
3570
3524
|
}
|
|
3571
3525
|
calculateScrollData(e) {
|
|
3572
|
-
const { element: t, lastScrollPos: r, lastEventTime:
|
|
3526
|
+
const { element: t, lastScrollPos: r, lastEventTime: n } = e, i = this.getScrollTop(t), o = Date.now(), l = Math.abs(i - r);
|
|
3573
3527
|
if (l < 10 || t === window && !this.isWindowScrollable())
|
|
3574
3528
|
return null;
|
|
3575
3529
|
const c = this.getViewportHeight(t), u = this.getScrollHeight(t), S = this.getScrollDirection(i, r), g = this.calculateScrollDepth(i, u, c);
|
|
3576
3530
|
let E;
|
|
3577
|
-
|
|
3531
|
+
n > 0 ? E = o - n : e.firstScrollEventTime !== null ? E = o - e.firstScrollEventTime : E = 250;
|
|
3578
3532
|
const p = Math.round(l / E * 1e3);
|
|
3579
3533
|
return g > e.maxDepthReached && (e.maxDepthReached = g), e.lastScrollPos = i, {
|
|
3580
3534
|
depth: g,
|
|
@@ -3593,30 +3547,30 @@ class nr extends _ {
|
|
|
3593
3547
|
return e === window ? document.documentElement.scrollHeight : e.scrollHeight;
|
|
3594
3548
|
}
|
|
3595
3549
|
isElementScrollable(e) {
|
|
3596
|
-
const t = getComputedStyle(e), r = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflow === "auto" || t.overflow === "scroll",
|
|
3597
|
-
return r &&
|
|
3550
|
+
const t = getComputedStyle(e), r = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflow === "auto" || t.overflow === "scroll", n = e.scrollHeight > e.clientHeight;
|
|
3551
|
+
return r && n;
|
|
3598
3552
|
}
|
|
3599
3553
|
applyPrimaryScrollSelector(e) {
|
|
3600
3554
|
let t;
|
|
3601
3555
|
if (e === "window")
|
|
3602
3556
|
t = window;
|
|
3603
3557
|
else {
|
|
3604
|
-
const
|
|
3605
|
-
if (!(
|
|
3558
|
+
const n = document.querySelector(e);
|
|
3559
|
+
if (!(n instanceof HTMLElement)) {
|
|
3606
3560
|
a("debug", `Selector "${e}" did not match an HTMLElement`);
|
|
3607
3561
|
return;
|
|
3608
3562
|
}
|
|
3609
|
-
t =
|
|
3563
|
+
t = n;
|
|
3610
3564
|
}
|
|
3611
|
-
this.containers.forEach((
|
|
3612
|
-
this.updateContainerPrimary(
|
|
3613
|
-
}), !this.containers.some((
|
|
3565
|
+
this.containers.forEach((n) => {
|
|
3566
|
+
this.updateContainerPrimary(n, n.element === t);
|
|
3567
|
+
}), !this.containers.some((n) => n.element === t) && t instanceof HTMLElement && this.isElementScrollable(t) && this.setupScrollContainer(t, e);
|
|
3614
3568
|
}
|
|
3615
3569
|
updateContainerPrimary(e, t) {
|
|
3616
3570
|
e.isPrimary = t;
|
|
3617
3571
|
}
|
|
3618
3572
|
}
|
|
3619
|
-
class
|
|
3573
|
+
class nr extends _ {
|
|
3620
3574
|
eventManager;
|
|
3621
3575
|
trackedElements = /* @__PURE__ */ new Map();
|
|
3622
3576
|
observer = null;
|
|
@@ -3668,8 +3622,8 @@ class sr extends _ {
|
|
|
3668
3622
|
let t = this.trackedElements.size;
|
|
3669
3623
|
for (const r of this.config.elements)
|
|
3670
3624
|
try {
|
|
3671
|
-
const
|
|
3672
|
-
for (const i of Array.from(
|
|
3625
|
+
const n = document.querySelectorAll(r.selector);
|
|
3626
|
+
for (const i of Array.from(n)) {
|
|
3673
3627
|
if (t >= e) {
|
|
3674
3628
|
a("debug", "ViewportHandler: Maximum tracked elements reached", {
|
|
3675
3629
|
data: {
|
|
@@ -3690,8 +3644,8 @@ class sr extends _ {
|
|
|
3690
3644
|
lastFiredTime: null
|
|
3691
3645
|
}), this.observer?.observe(i), t++);
|
|
3692
3646
|
}
|
|
3693
|
-
} catch (
|
|
3694
|
-
a("debug", `ViewportHandler: Invalid selector "${r.selector}"`, { error:
|
|
3647
|
+
} catch (n) {
|
|
3648
|
+
a("debug", `ViewportHandler: Invalid selector "${r.selector}"`, { error: n });
|
|
3695
3649
|
}
|
|
3696
3650
|
a("debug", "ViewportHandler: Elements tracked", {
|
|
3697
3651
|
data: { count: t, limit: e }
|
|
@@ -3704,11 +3658,11 @@ class sr extends _ {
|
|
|
3704
3658
|
if (!this.config) return;
|
|
3705
3659
|
const t = this.config.minDwellTime ?? 1e3;
|
|
3706
3660
|
for (const r of e) {
|
|
3707
|
-
const
|
|
3708
|
-
|
|
3661
|
+
const n = this.trackedElements.get(r.target);
|
|
3662
|
+
n && (r.isIntersecting ? n.startTime === null && (n.startTime = performance.now(), n.timeoutId = window.setTimeout(() => {
|
|
3709
3663
|
const i = Math.round(r.intersectionRatio * 100) / 100;
|
|
3710
|
-
this.fireViewportEvent(
|
|
3711
|
-
}, t)) :
|
|
3664
|
+
this.fireViewportEvent(n, i);
|
|
3665
|
+
}, t)) : n.startTime !== null && (n.timeoutId !== null && (window.clearTimeout(n.timeoutId), n.timeoutId = null), n.startTime = null));
|
|
3712
3666
|
}
|
|
3713
3667
|
};
|
|
3714
3668
|
/**
|
|
@@ -3719,12 +3673,12 @@ class sr extends _ {
|
|
|
3719
3673
|
const r = Math.round(performance.now() - e.startTime);
|
|
3720
3674
|
if (e.element.hasAttribute(`${w}-ignore`))
|
|
3721
3675
|
return;
|
|
3722
|
-
const
|
|
3723
|
-
if (e.lastFiredTime !== null && i - e.lastFiredTime <
|
|
3676
|
+
const n = this.config?.cooldownPeriod ?? 6e4, i = Date.now();
|
|
3677
|
+
if (e.lastFiredTime !== null && i - e.lastFiredTime < n) {
|
|
3724
3678
|
a("debug", "ViewportHandler: Event suppressed by cooldown period", {
|
|
3725
3679
|
data: {
|
|
3726
3680
|
selector: e.selector,
|
|
3727
|
-
cooldownRemaining:
|
|
3681
|
+
cooldownRemaining: n - (i - e.lastFiredTime)
|
|
3728
3682
|
}
|
|
3729
3683
|
}), e.startTime = null, e.timeoutId = null;
|
|
3730
3684
|
return;
|
|
@@ -3769,8 +3723,8 @@ class sr extends _ {
|
|
|
3769
3723
|
cleanupRemovedNodes(e) {
|
|
3770
3724
|
e.forEach((t) => {
|
|
3771
3725
|
if (t.nodeType !== 1) return;
|
|
3772
|
-
const r = t,
|
|
3773
|
-
|
|
3726
|
+
const r = t, n = this.trackedElements.get(r);
|
|
3727
|
+
n && (n.timeoutId !== null && window.clearTimeout(n.timeoutId), this.observer?.unobserve(r), this.trackedElements.delete(r)), Array.from(this.trackedElements.keys()).filter((o) => r.contains(o)).forEach((o) => {
|
|
3774
3728
|
const l = this.trackedElements.get(o);
|
|
3775
3729
|
l && l.timeoutId !== null && window.clearTimeout(l.timeoutId), this.observer?.unobserve(o), this.trackedElements.delete(o);
|
|
3776
3730
|
});
|
|
@@ -3957,8 +3911,8 @@ class ir {
|
|
|
3957
3911
|
} catch {
|
|
3958
3912
|
}
|
|
3959
3913
|
}), !0;
|
|
3960
|
-
const r = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"],
|
|
3961
|
-
return
|
|
3914
|
+
const r = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"], n = e.filter((i) => !r.some((o) => i.startsWith(o)));
|
|
3915
|
+
return n.length > 0 ? (n.slice(0, 5).forEach((o) => {
|
|
3962
3916
|
try {
|
|
3963
3917
|
this.storage.removeItem(o);
|
|
3964
3918
|
} catch {
|
|
@@ -4113,7 +4067,7 @@ class or extends _ {
|
|
|
4113
4067
|
this.reportTTFB(), this.safeObserve(
|
|
4114
4068
|
"largest-contentful-paint",
|
|
4115
4069
|
(r) => {
|
|
4116
|
-
const
|
|
4070
|
+
const n = r.getEntries(), i = n[n.length - 1];
|
|
4117
4071
|
i && this.sendVital({ type: "LCP", value: Number(i.startTime.toFixed(2)) });
|
|
4118
4072
|
},
|
|
4119
4073
|
{ type: "largest-contentful-paint", buffered: !0 },
|
|
@@ -4123,8 +4077,8 @@ class or extends _ {
|
|
|
4123
4077
|
this.safeObserve(
|
|
4124
4078
|
"layout-shift",
|
|
4125
4079
|
(r) => {
|
|
4126
|
-
const
|
|
4127
|
-
|
|
4080
|
+
const n = this.getNavigationId();
|
|
4081
|
+
n !== t && (e = 0, t = n);
|
|
4128
4082
|
const i = r.getEntries();
|
|
4129
4083
|
for (const o of i) {
|
|
4130
4084
|
if (o.hadRecentInput === !0)
|
|
@@ -4138,32 +4092,32 @@ class or extends _ {
|
|
|
4138
4092
|
), this.safeObserve(
|
|
4139
4093
|
"paint",
|
|
4140
4094
|
(r) => {
|
|
4141
|
-
for (const
|
|
4142
|
-
|
|
4095
|
+
for (const n of r.getEntries())
|
|
4096
|
+
n.name === "first-contentful-paint" && this.sendVital({ type: "FCP", value: Number(n.startTime.toFixed(2)) });
|
|
4143
4097
|
},
|
|
4144
4098
|
{ type: "paint", buffered: !0 },
|
|
4145
4099
|
!0
|
|
4146
4100
|
), this.safeObserve(
|
|
4147
4101
|
"event",
|
|
4148
4102
|
(r) => {
|
|
4149
|
-
let
|
|
4103
|
+
let n = 0;
|
|
4150
4104
|
const i = r.getEntries();
|
|
4151
4105
|
for (const o of i) {
|
|
4152
4106
|
const l = (o.processingEnd ?? 0) - (o.startTime ?? 0);
|
|
4153
|
-
|
|
4107
|
+
n = Math.max(n, l);
|
|
4154
4108
|
}
|
|
4155
|
-
|
|
4109
|
+
n > 0 && this.sendVital({ type: "INP", value: Number(n.toFixed(2)) });
|
|
4156
4110
|
},
|
|
4157
4111
|
{ type: "event", buffered: !0 }
|
|
4158
4112
|
);
|
|
4159
4113
|
}
|
|
4160
4114
|
async initWebVitals() {
|
|
4161
4115
|
try {
|
|
4162
|
-
const { onLCP: e, onCLS: t, onFCP: r, onTTFB:
|
|
4116
|
+
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => Nr), o = (l) => (c) => {
|
|
4163
4117
|
const u = Number(c.value.toFixed(2));
|
|
4164
4118
|
this.sendVital({ type: l, value: u });
|
|
4165
4119
|
};
|
|
4166
|
-
e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), r(o("FCP"), { reportAllChanges: !1 }),
|
|
4120
|
+
e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), r(o("FCP"), { reportAllChanges: !1 }), n(o("TTFB"), { reportAllChanges: !1 }), i(o("INP"), { reportAllChanges: !1 });
|
|
4167
4121
|
} catch (e) {
|
|
4168
4122
|
a("debug", "Failed to load web-vitals library, using fallback", { error: e }), this.observeWebVitalsFallback();
|
|
4169
4123
|
}
|
|
@@ -4185,8 +4139,8 @@ class or extends _ {
|
|
|
4185
4139
|
(e) => {
|
|
4186
4140
|
const t = e.getEntries();
|
|
4187
4141
|
for (const r of t) {
|
|
4188
|
-
const
|
|
4189
|
-
i - this.lastLongTaskSentAt >= Mt && (this.shouldSendVital("LONG_TASK",
|
|
4142
|
+
const n = Number(r.duration.toFixed(2)), i = Date.now();
|
|
4143
|
+
i - this.lastLongTaskSentAt >= Mt && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
4190
4144
|
}
|
|
4191
4145
|
},
|
|
4192
4146
|
{ type: "longtask", buffered: !0 }
|
|
@@ -4248,8 +4202,8 @@ class or extends _ {
|
|
|
4248
4202
|
const e = performance.getEntriesByType("navigation")[0];
|
|
4249
4203
|
if (!e)
|
|
4250
4204
|
return null;
|
|
4251
|
-
const t = e.startTime || performance.now(), r = ++this.navigationCounter,
|
|
4252
|
-
return r > 1 ? `${
|
|
4205
|
+
const t = e.startTime || performance.now(), r = ++this.navigationCounter, n = `${t.toFixed(2)}_${window.location.pathname}`;
|
|
4206
|
+
return r > 1 ? `${n}_${r}` : n;
|
|
4253
4207
|
} catch (e) {
|
|
4254
4208
|
return a("debug", "Failed to get navigation ID", { error: e }), null;
|
|
4255
4209
|
}
|
|
@@ -4259,7 +4213,7 @@ class or extends _ {
|
|
|
4259
4213
|
const t = PerformanceObserver.supportedEntryTypes;
|
|
4260
4214
|
return !t || t.includes(e);
|
|
4261
4215
|
}
|
|
4262
|
-
safeObserve(e, t, r,
|
|
4216
|
+
safeObserve(e, t, r, n = !1) {
|
|
4263
4217
|
try {
|
|
4264
4218
|
if (!this.isObserverSupported(e))
|
|
4265
4219
|
return !1;
|
|
@@ -4272,13 +4226,13 @@ class or extends _ {
|
|
|
4272
4226
|
data: { type: e }
|
|
4273
4227
|
});
|
|
4274
4228
|
}
|
|
4275
|
-
if (
|
|
4229
|
+
if (n)
|
|
4276
4230
|
try {
|
|
4277
4231
|
l.disconnect();
|
|
4278
4232
|
} catch {
|
|
4279
4233
|
}
|
|
4280
4234
|
});
|
|
4281
|
-
return i.observe(r ?? { type: e, buffered: !0 }),
|
|
4235
|
+
return i.observe(r ?? { type: e, buffered: !0 }), n || this.observers.push(i), !0;
|
|
4282
4236
|
} catch (i) {
|
|
4283
4237
|
return a("debug", "Failed to create performance observer", {
|
|
4284
4238
|
error: i,
|
|
@@ -4382,24 +4336,24 @@ class ar extends _ {
|
|
|
4382
4336
|
sanitize(e) {
|
|
4383
4337
|
let t = e.length > Le ? e.slice(0, Le) + "..." : e;
|
|
4384
4338
|
for (const r of Be) {
|
|
4385
|
-
const
|
|
4386
|
-
t = t.replace(
|
|
4339
|
+
const n = new RegExp(r.source, r.flags);
|
|
4340
|
+
t = t.replace(n, "[REDACTED]");
|
|
4387
4341
|
}
|
|
4388
4342
|
return t;
|
|
4389
4343
|
}
|
|
4390
4344
|
shouldSuppressError(e, t) {
|
|
4391
|
-
const r = Date.now(),
|
|
4392
|
-
return i && r - i < Me ? (this.recentErrors.set(
|
|
4345
|
+
const r = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
4346
|
+
return i && r - i < Me ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size > wt ? (this.recentErrors.clear(), this.recentErrors.set(n, r), !1) : (this.recentErrors.size > Q && this.pruneOldErrors(), !1));
|
|
4393
4347
|
}
|
|
4394
4348
|
pruneOldErrors() {
|
|
4395
4349
|
const e = Date.now();
|
|
4396
|
-
for (const [
|
|
4397
|
-
e - i > Me && this.recentErrors.delete(
|
|
4350
|
+
for (const [n, i] of this.recentErrors.entries())
|
|
4351
|
+
e - i > Me && this.recentErrors.delete(n);
|
|
4398
4352
|
if (this.recentErrors.size <= Q)
|
|
4399
4353
|
return;
|
|
4400
|
-
const t = Array.from(this.recentErrors.entries()).sort((
|
|
4401
|
-
for (let
|
|
4402
|
-
const i = t[
|
|
4354
|
+
const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), r = this.recentErrors.size - Q;
|
|
4355
|
+
for (let n = 0; n < r; n += 1) {
|
|
4356
|
+
const i = t[n];
|
|
4403
4357
|
i && this.recentErrors.delete(i[0]);
|
|
4404
4358
|
}
|
|
4405
4359
|
}
|
|
@@ -4449,8 +4403,8 @@ class lr extends _ {
|
|
|
4449
4403
|
}
|
|
4450
4404
|
let r = t;
|
|
4451
4405
|
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
4452
|
-
const { valid:
|
|
4453
|
-
if (!
|
|
4406
|
+
const { valid: n, error: i, sanitizedMetadata: o } = Qt(e, r);
|
|
4407
|
+
if (!n) {
|
|
4454
4408
|
if (this.get("mode") === j.QA)
|
|
4455
4409
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
|
|
4456
4410
|
return;
|
|
@@ -4501,8 +4455,8 @@ class lr extends _ {
|
|
|
4501
4455
|
this.set("userId", t);
|
|
4502
4456
|
const r = xt(e);
|
|
4503
4457
|
this.set("collectApiUrls", r);
|
|
4504
|
-
const
|
|
4505
|
-
this.set("device",
|
|
4458
|
+
const n = It();
|
|
4459
|
+
this.set("device", n);
|
|
4506
4460
|
const i = le(window.location.href, e.sensitiveQueryParams);
|
|
4507
4461
|
this.set("pageUrl", i), Pt() && this.set("mode", j.QA);
|
|
4508
4462
|
}
|
|
@@ -4563,11 +4517,11 @@ class lr extends _ {
|
|
|
4563
4517
|
const t = this.validateGlobalMetadata(e);
|
|
4564
4518
|
if (!t.valid)
|
|
4565
4519
|
throw new Error(`[TraceLog] Invalid global metadata: ${t.error}`);
|
|
4566
|
-
const
|
|
4520
|
+
const n = {
|
|
4567
4521
|
...this.get("config"),
|
|
4568
4522
|
globalMetadata: e
|
|
4569
4523
|
};
|
|
4570
|
-
this.set("config",
|
|
4524
|
+
this.set("config", n), a("debug", "Global metadata updated (replaced)", { data: { keys: Object.keys(e) } });
|
|
4571
4525
|
}
|
|
4572
4526
|
/**
|
|
4573
4527
|
* Merges new metadata with existing global metadata.
|
|
@@ -4600,35 +4554,35 @@ class lr extends _ {
|
|
|
4600
4554
|
this.set("suppressNextScroll", !1);
|
|
4601
4555
|
}, 500);
|
|
4602
4556
|
};
|
|
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
|
|
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 sr(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new or(this.managers.event), this.handlers.performance.startTracking().catch((r) => {
|
|
4604
4558
|
a("warn", "Failed to start performance tracking", { error: r });
|
|
4605
|
-
}), this.handlers.error = new ar(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new
|
|
4559
|
+
}), this.handlers.error = new ar(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new nr(this.managers.event), this.handlers.viewport.startTracking());
|
|
4606
4560
|
}
|
|
4607
4561
|
}
|
|
4608
4562
|
const R = [], M = [];
|
|
4609
4563
|
let f = null, C = !1, v = !1;
|
|
4610
|
-
const cr = async (
|
|
4564
|
+
const cr = async (s) => {
|
|
4611
4565
|
if (!(typeof window > "u" || typeof document > "u") && (v = !1, window.__traceLogDisabled !== !0 && !f && !C)) {
|
|
4612
4566
|
C = !0;
|
|
4613
4567
|
try {
|
|
4614
|
-
const e = Wt(
|
|
4568
|
+
const e = Wt(s ?? {}), t = new lr();
|
|
4615
4569
|
try {
|
|
4616
4570
|
R.forEach(({ event: i, callback: o }) => {
|
|
4617
4571
|
t.on(i, o);
|
|
4618
4572
|
}), R.length = 0, M.forEach(({ hook: i, fn: o }) => {
|
|
4619
4573
|
i === "beforeSend" ? t.setTransformer("beforeSend", o) : t.setTransformer("beforeBatch", o);
|
|
4620
4574
|
}), M.length = 0;
|
|
4621
|
-
const r = t.init(e),
|
|
4575
|
+
const r = t.init(e), n = new Promise((i, o) => {
|
|
4622
4576
|
setTimeout(() => {
|
|
4623
4577
|
o(new Error("[TraceLog] Initialization timeout after 10000ms"));
|
|
4624
4578
|
}, 1e4);
|
|
4625
4579
|
});
|
|
4626
|
-
await Promise.race([r,
|
|
4580
|
+
await Promise.race([r, n]), f = t;
|
|
4627
4581
|
} catch (r) {
|
|
4628
4582
|
try {
|
|
4629
4583
|
t.destroy(!0);
|
|
4630
|
-
} catch (
|
|
4631
|
-
a("error", "Failed to cleanup partially initialized app", { error:
|
|
4584
|
+
} catch (n) {
|
|
4585
|
+
a("error", "Failed to cleanup partially initialized app", { error: n });
|
|
4632
4586
|
}
|
|
4633
4587
|
throw r;
|
|
4634
4588
|
}
|
|
@@ -4638,56 +4592,56 @@ const cr = async (n) => {
|
|
|
4638
4592
|
C = !1;
|
|
4639
4593
|
}
|
|
4640
4594
|
}
|
|
4641
|
-
}, ur = (
|
|
4595
|
+
}, ur = (s, e) => {
|
|
4642
4596
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4643
4597
|
if (!f)
|
|
4644
4598
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
4645
4599
|
if (v)
|
|
4646
4600
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
4647
|
-
f.sendCustomEvent(
|
|
4601
|
+
f.sendCustomEvent(s, e);
|
|
4648
4602
|
}
|
|
4649
|
-
}, dr = (
|
|
4603
|
+
}, dr = (s, e) => {
|
|
4650
4604
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4651
4605
|
if (!f || C) {
|
|
4652
|
-
R.push({ event:
|
|
4606
|
+
R.push({ event: s, callback: e });
|
|
4653
4607
|
return;
|
|
4654
4608
|
}
|
|
4655
|
-
f.on(
|
|
4609
|
+
f.on(s, e);
|
|
4656
4610
|
}
|
|
4657
|
-
}, hr = (
|
|
4611
|
+
}, hr = (s, e) => {
|
|
4658
4612
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4659
4613
|
if (!f) {
|
|
4660
|
-
const t = R.findIndex((r) => r.event ===
|
|
4614
|
+
const t = R.findIndex((r) => r.event === s && r.callback === e);
|
|
4661
4615
|
t !== -1 && R.splice(t, 1);
|
|
4662
4616
|
return;
|
|
4663
4617
|
}
|
|
4664
|
-
f.off(
|
|
4618
|
+
f.off(s, e);
|
|
4665
4619
|
}
|
|
4666
4620
|
};
|
|
4667
|
-
function fr(
|
|
4621
|
+
function fr(s, e) {
|
|
4668
4622
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4669
4623
|
if (typeof e != "function")
|
|
4670
4624
|
throw new Error(`[TraceLog] Transformer must be a function, received: ${typeof e}`);
|
|
4671
4625
|
if (!f || C) {
|
|
4672
|
-
const t = M.findIndex((r) => r.hook ===
|
|
4673
|
-
t !== -1 && M.splice(t, 1), M.push({ hook:
|
|
4626
|
+
const t = M.findIndex((r) => r.hook === s);
|
|
4627
|
+
t !== -1 && M.splice(t, 1), M.push({ hook: s, fn: e });
|
|
4674
4628
|
return;
|
|
4675
4629
|
}
|
|
4676
4630
|
if (v)
|
|
4677
4631
|
throw new Error("[TraceLog] Cannot set transformers while TraceLog is being destroyed");
|
|
4678
|
-
|
|
4632
|
+
s === "beforeSend" ? f.setTransformer("beforeSend", e) : f.setTransformer("beforeBatch", e);
|
|
4679
4633
|
}
|
|
4680
4634
|
}
|
|
4681
|
-
const mr = (
|
|
4635
|
+
const mr = (s) => {
|
|
4682
4636
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4683
4637
|
if (!f) {
|
|
4684
|
-
const e = M.findIndex((t) => t.hook ===
|
|
4638
|
+
const e = M.findIndex((t) => t.hook === s);
|
|
4685
4639
|
e !== -1 && M.splice(e, 1);
|
|
4686
4640
|
return;
|
|
4687
4641
|
}
|
|
4688
4642
|
if (v)
|
|
4689
4643
|
throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
|
|
4690
|
-
f.removeTransformer(
|
|
4644
|
+
f.removeTransformer(s);
|
|
4691
4645
|
}
|
|
4692
4646
|
}, gr = () => typeof window > "u" || typeof document > "u" ? !1 : f !== null, Er = () => {
|
|
4693
4647
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
@@ -4700,27 +4654,27 @@ const mr = (n) => {
|
|
|
4700
4654
|
v = !0;
|
|
4701
4655
|
try {
|
|
4702
4656
|
f.destroy(), f = null, C = !1, R.length = 0, M.length = 0, v = !1;
|
|
4703
|
-
} catch (
|
|
4704
|
-
f = null, C = !1, R.length = 0, M.length = 0, v = !1, a("warn", "Error during destroy, forced cleanup completed", { error:
|
|
4657
|
+
} catch (s) {
|
|
4658
|
+
f = null, C = !1, R.length = 0, M.length = 0, v = !1, a("warn", "Error during destroy, forced cleanup completed", { error: s });
|
|
4705
4659
|
}
|
|
4706
4660
|
}
|
|
4707
|
-
}, Sr = (
|
|
4708
|
-
typeof window > "u" || typeof document > "u" || Dt(
|
|
4709
|
-
}, pr = (
|
|
4661
|
+
}, Sr = (s) => {
|
|
4662
|
+
typeof window > "u" || typeof document > "u" || Dt(s);
|
|
4663
|
+
}, pr = (s) => {
|
|
4710
4664
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4711
4665
|
if (!f)
|
|
4712
4666
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
4713
4667
|
if (v)
|
|
4714
4668
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
4715
|
-
f.updateGlobalMetadata(
|
|
4669
|
+
f.updateGlobalMetadata(s);
|
|
4716
4670
|
}
|
|
4717
|
-
}, Tr = (
|
|
4671
|
+
}, Tr = (s) => {
|
|
4718
4672
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4719
4673
|
if (!f)
|
|
4720
4674
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
4721
4675
|
if (v)
|
|
4722
4676
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
4723
|
-
f.mergeGlobalMetadata(
|
|
4677
|
+
f.mergeGlobalMetadata(s);
|
|
4724
4678
|
}
|
|
4725
4679
|
}, Qr = {
|
|
4726
4680
|
init: cr,
|
|
@@ -4735,57 +4689,57 @@ const mr = (n) => {
|
|
|
4735
4689
|
updateGlobalMetadata: pr,
|
|
4736
4690
|
mergeGlobalMetadata: Tr
|
|
4737
4691
|
};
|
|
4738
|
-
var ue, Ye = -1, P = function(
|
|
4692
|
+
var ue, Ye = -1, P = function(s) {
|
|
4739
4693
|
addEventListener("pageshow", (function(e) {
|
|
4740
|
-
e.persisted && (Ye = e.timeStamp,
|
|
4694
|
+
e.persisted && (Ye = e.timeStamp, s(e));
|
|
4741
4695
|
}), !0);
|
|
4742
4696
|
}, Ee = function() {
|
|
4743
|
-
var
|
|
4744
|
-
if (
|
|
4697
|
+
var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
4698
|
+
if (s && s.responseStart > 0 && s.responseStart < performance.now()) return s;
|
|
4745
4699
|
}, q = function() {
|
|
4746
|
-
var
|
|
4747
|
-
return
|
|
4748
|
-
}, b = function(
|
|
4700
|
+
var s = Ee();
|
|
4701
|
+
return s && s.activationStart || 0;
|
|
4702
|
+
}, b = function(s, e) {
|
|
4749
4703
|
var t = Ee(), r = "navigate";
|
|
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:
|
|
4751
|
-
},
|
|
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: s, 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 };
|
|
4705
|
+
}, F = function(s, e, t) {
|
|
4752
4706
|
try {
|
|
4753
|
-
if (PerformanceObserver.supportedEntryTypes.includes(
|
|
4754
|
-
var r = new PerformanceObserver((function(
|
|
4707
|
+
if (PerformanceObserver.supportedEntryTypes.includes(s)) {
|
|
4708
|
+
var r = new PerformanceObserver((function(n) {
|
|
4755
4709
|
Promise.resolve().then((function() {
|
|
4756
|
-
e(
|
|
4710
|
+
e(n.getEntries());
|
|
4757
4711
|
}));
|
|
4758
4712
|
}));
|
|
4759
|
-
return r.observe(Object.assign({ type:
|
|
4713
|
+
return r.observe(Object.assign({ type: s, buffered: !0 }, t || {})), r;
|
|
4760
4714
|
}
|
|
4761
4715
|
} catch {
|
|
4762
4716
|
}
|
|
4763
|
-
}, A = function(
|
|
4764
|
-
var
|
|
4717
|
+
}, A = function(s, e, t, r) {
|
|
4718
|
+
var n, i;
|
|
4765
4719
|
return function(o) {
|
|
4766
|
-
e.value >= 0 && (o || r) && ((i = e.value - (
|
|
4720
|
+
e.value >= 0 && (o || r) && ((i = e.value - (n || 0)) || n === void 0) && (n = e.value, e.delta = i, e.rating = (function(l, c) {
|
|
4767
4721
|
return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
|
|
4768
|
-
})(e.value, t),
|
|
4722
|
+
})(e.value, t), s(e));
|
|
4769
4723
|
};
|
|
4770
|
-
}, Se = function(
|
|
4724
|
+
}, Se = function(s) {
|
|
4771
4725
|
requestAnimationFrame((function() {
|
|
4772
4726
|
return requestAnimationFrame((function() {
|
|
4773
|
-
return
|
|
4727
|
+
return s();
|
|
4774
4728
|
}));
|
|
4775
4729
|
}));
|
|
4776
|
-
}, J = function(
|
|
4730
|
+
}, J = function(s) {
|
|
4777
4731
|
document.addEventListener("visibilitychange", (function() {
|
|
4778
|
-
document.visibilityState === "hidden" &&
|
|
4732
|
+
document.visibilityState === "hidden" && s();
|
|
4779
4733
|
}));
|
|
4780
|
-
}, pe = function(
|
|
4734
|
+
}, pe = function(s) {
|
|
4781
4735
|
var e = !1;
|
|
4782
4736
|
return function() {
|
|
4783
|
-
e || (
|
|
4737
|
+
e || (s(), e = !0);
|
|
4784
4738
|
};
|
|
4785
4739
|
}, O = -1, ke = function() {
|
|
4786
4740
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
4787
|
-
}, Y = function(
|
|
4788
|
-
document.visibilityState === "hidden" && O > -1 && (O =
|
|
4741
|
+
}, Y = function(s) {
|
|
4742
|
+
document.visibilityState === "hidden" && O > -1 && (O = s.type === "visibilitychange" ? s.timeStamp : 0, _r());
|
|
4789
4743
|
}, Ue = function() {
|
|
4790
4744
|
addEventListener("visibilitychange", Y, !0), addEventListener("prerenderingchange", Y, !0);
|
|
4791
4745
|
}, _r = function() {
|
|
@@ -4798,126 +4752,126 @@ var ue, Ye = -1, P = function(n) {
|
|
|
4798
4752
|
}))), { get firstHiddenTime() {
|
|
4799
4753
|
return O;
|
|
4800
4754
|
} };
|
|
4801
|
-
}, Z = function(
|
|
4755
|
+
}, Z = function(s) {
|
|
4802
4756
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
4803
|
-
return
|
|
4804
|
-
}), !0) :
|
|
4805
|
-
}, de = [1800, 3e3], Je = function(
|
|
4757
|
+
return s();
|
|
4758
|
+
}), !0) : s();
|
|
4759
|
+
}, de = [1800, 3e3], Je = function(s, e) {
|
|
4806
4760
|
e = e || {}, Z((function() {
|
|
4807
|
-
var t, r = qe(),
|
|
4761
|
+
var t, r = qe(), n = b("FCP"), i = F("paint", (function(o) {
|
|
4808
4762
|
o.forEach((function(l) {
|
|
4809
|
-
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (
|
|
4763
|
+
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime - q(), 0), n.entries.push(l), t(!0)));
|
|
4810
4764
|
}));
|
|
4811
4765
|
}));
|
|
4812
|
-
i && (t = A(
|
|
4813
|
-
|
|
4814
|
-
|
|
4766
|
+
i && (t = A(s, n, de, e.reportAllChanges), P((function(o) {
|
|
4767
|
+
n = b("FCP"), t = A(s, n, de, e.reportAllChanges), Se((function() {
|
|
4768
|
+
n.value = performance.now() - o.timeStamp, t(!0);
|
|
4815
4769
|
}));
|
|
4816
4770
|
})));
|
|
4817
4771
|
}));
|
|
4818
|
-
}, he = [0.1, 0.25], vr = function(
|
|
4772
|
+
}, he = [0.1, 0.25], vr = function(s, e) {
|
|
4819
4773
|
e = e || {}, Je(pe((function() {
|
|
4820
|
-
var t, r = b("CLS", 0),
|
|
4774
|
+
var t, r = b("CLS", 0), n = 0, i = [], o = function(c) {
|
|
4821
4775
|
c.forEach((function(u) {
|
|
4822
4776
|
if (!u.hadRecentInput) {
|
|
4823
4777
|
var S = i[0], g = i[i.length - 1];
|
|
4824
|
-
|
|
4778
|
+
n && u.startTime - g.startTime < 1e3 && u.startTime - S.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
|
|
4825
4779
|
}
|
|
4826
|
-
})),
|
|
4827
|
-
}, l =
|
|
4828
|
-
l && (t = A(
|
|
4780
|
+
})), n > r.value && (r.value = n, r.entries = i, t());
|
|
4781
|
+
}, l = F("layout-shift", o);
|
|
4782
|
+
l && (t = A(s, r, he, e.reportAllChanges), J((function() {
|
|
4829
4783
|
o(l.takeRecords()), t(!0);
|
|
4830
4784
|
})), P((function() {
|
|
4831
|
-
|
|
4785
|
+
n = 0, r = b("CLS", 0), t = A(s, r, he, e.reportAllChanges), Se((function() {
|
|
4832
4786
|
return t();
|
|
4833
4787
|
}));
|
|
4834
4788
|
})), setTimeout(t, 0));
|
|
4835
4789
|
})));
|
|
4836
|
-
}, Ze = 0, re = 1 / 0, G = 0, Ir = function(
|
|
4837
|
-
|
|
4790
|
+
}, Ze = 0, re = 1 / 0, G = 0, Ir = function(s) {
|
|
4791
|
+
s.forEach((function(e) {
|
|
4838
4792
|
e.interactionId && (re = Math.min(re, e.interactionId), G = Math.max(G, e.interactionId), Ze = G ? (G - re) / 7 + 1 : 0);
|
|
4839
4793
|
}));
|
|
4840
4794
|
}, et = function() {
|
|
4841
4795
|
return ue ? Ze : performance.interactionCount || 0;
|
|
4842
4796
|
}, wr = function() {
|
|
4843
|
-
"interactionCount" in performance || ue || (ue =
|
|
4797
|
+
"interactionCount" in performance || ue || (ue = F("event", Ir, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
4844
4798
|
}, y = [], z = /* @__PURE__ */ new Map(), tt = 0, yr = function() {
|
|
4845
|
-
var
|
|
4846
|
-
return y[
|
|
4847
|
-
}, br = [], Ar = function(
|
|
4848
|
-
if (br.forEach((function(
|
|
4849
|
-
return s
|
|
4850
|
-
})),
|
|
4851
|
-
var e = y[y.length - 1], t = z.get(
|
|
4852
|
-
if (t || y.length < 10 ||
|
|
4853
|
-
if (t)
|
|
4799
|
+
var s = Math.min(y.length - 1, Math.floor((et() - tt) / 50));
|
|
4800
|
+
return y[s];
|
|
4801
|
+
}, br = [], Ar = function(s) {
|
|
4802
|
+
if (br.forEach((function(n) {
|
|
4803
|
+
return n(s);
|
|
4804
|
+
})), s.interactionId || s.entryType === "first-input") {
|
|
4805
|
+
var e = y[y.length - 1], t = z.get(s.interactionId);
|
|
4806
|
+
if (t || y.length < 10 || s.duration > e.latency) {
|
|
4807
|
+
if (t) s.duration > t.latency ? (t.entries = [s], t.latency = s.duration) : s.duration === t.latency && s.startTime === t.entries[0].startTime && t.entries.push(s);
|
|
4854
4808
|
else {
|
|
4855
|
-
var r = { id:
|
|
4809
|
+
var r = { id: s.interactionId, latency: s.duration, entries: [s] };
|
|
4856
4810
|
z.set(r.id, r), y.push(r);
|
|
4857
4811
|
}
|
|
4858
|
-
y.sort((function(
|
|
4859
|
-
return i.latency -
|
|
4860
|
-
})), y.length > 10 && y.splice(10).forEach((function(
|
|
4861
|
-
return z.delete(
|
|
4812
|
+
y.sort((function(n, i) {
|
|
4813
|
+
return i.latency - n.latency;
|
|
4814
|
+
})), y.length > 10 && y.splice(10).forEach((function(n) {
|
|
4815
|
+
return z.delete(n.id);
|
|
4862
4816
|
}));
|
|
4863
4817
|
}
|
|
4864
4818
|
}
|
|
4865
|
-
}, rt = function(
|
|
4819
|
+
}, rt = function(s) {
|
|
4866
4820
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
4867
|
-
return
|
|
4868
|
-
}, fe = [200, 500], Lr = function(
|
|
4821
|
+
return s = pe(s), document.visibilityState === "hidden" ? s() : (t = e(s), J(s)), t;
|
|
4822
|
+
}, fe = [200, 500], Lr = function(s, e) {
|
|
4869
4823
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, Z((function() {
|
|
4870
4824
|
var t;
|
|
4871
4825
|
wr();
|
|
4872
|
-
var r,
|
|
4826
|
+
var r, n = b("INP"), i = function(l) {
|
|
4873
4827
|
rt((function() {
|
|
4874
4828
|
l.forEach(Ar);
|
|
4875
4829
|
var c = yr();
|
|
4876
|
-
c && c.latency !==
|
|
4830
|
+
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, r());
|
|
4877
4831
|
}));
|
|
4878
|
-
}, o =
|
|
4879
|
-
r = A(
|
|
4832
|
+
}, o = F("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
4833
|
+
r = A(s, n, fe, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), J((function() {
|
|
4880
4834
|
i(o.takeRecords()), r(!0);
|
|
4881
4835
|
})), P((function() {
|
|
4882
|
-
tt = et(), y.length = 0, z.clear(),
|
|
4836
|
+
tt = et(), y.length = 0, z.clear(), n = b("INP"), r = A(s, n, fe, e.reportAllChanges);
|
|
4883
4837
|
})));
|
|
4884
4838
|
})));
|
|
4885
|
-
}, me = [2500, 4e3],
|
|
4839
|
+
}, me = [2500, 4e3], se = {}, Mr = function(s, e) {
|
|
4886
4840
|
e = e || {}, Z((function() {
|
|
4887
|
-
var t, r = qe(),
|
|
4841
|
+
var t, r = qe(), n = b("LCP"), i = function(c) {
|
|
4888
4842
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
4889
|
-
u.startTime < r.firstHiddenTime && (
|
|
4843
|
+
u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime - q(), 0), n.entries = [u], t());
|
|
4890
4844
|
}));
|
|
4891
|
-
}, o =
|
|
4845
|
+
}, o = F("largest-contentful-paint", i);
|
|
4892
4846
|
if (o) {
|
|
4893
|
-
t = A(
|
|
4847
|
+
t = A(s, n, me, e.reportAllChanges);
|
|
4894
4848
|
var l = pe((function() {
|
|
4895
|
-
|
|
4849
|
+
se[n.id] || (i(o.takeRecords()), o.disconnect(), se[n.id] = !0, t(!0));
|
|
4896
4850
|
}));
|
|
4897
4851
|
["keydown", "click"].forEach((function(c) {
|
|
4898
4852
|
addEventListener(c, (function() {
|
|
4899
4853
|
return rt(l);
|
|
4900
4854
|
}), { once: !0, capture: !0 });
|
|
4901
4855
|
})), J(l), P((function(c) {
|
|
4902
|
-
|
|
4903
|
-
|
|
4856
|
+
n = b("LCP"), t = A(s, n, me, e.reportAllChanges), Se((function() {
|
|
4857
|
+
n.value = performance.now() - c.timeStamp, se[n.id] = !0, t(!0);
|
|
4904
4858
|
}));
|
|
4905
4859
|
}));
|
|
4906
4860
|
}
|
|
4907
4861
|
}));
|
|
4908
|
-
}, ge = [800, 1800], Cr = function
|
|
4862
|
+
}, ge = [800, 1800], Cr = function s(e) {
|
|
4909
4863
|
document.prerendering ? Z((function() {
|
|
4910
|
-
return
|
|
4864
|
+
return s(e);
|
|
4911
4865
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
4912
|
-
return
|
|
4866
|
+
return s(e);
|
|
4913
4867
|
}), !0) : setTimeout(e, 0);
|
|
4914
|
-
}, Rr = function(
|
|
4868
|
+
}, Rr = function(s, e) {
|
|
4915
4869
|
e = e || {};
|
|
4916
|
-
var t = b("TTFB"), r = A(
|
|
4870
|
+
var t = b("TTFB"), r = A(s, t, ge, e.reportAllChanges);
|
|
4917
4871
|
Cr((function() {
|
|
4918
|
-
var
|
|
4919
|
-
|
|
4920
|
-
t = b("TTFB", 0), (r = A(
|
|
4872
|
+
var n = Ee();
|
|
4873
|
+
n && (t.value = Math.max(n.responseStart - q(), 0), t.entries = [n], r(!0), P((function() {
|
|
4874
|
+
t = b("TTFB", 0), (r = A(s, t, ge, e.reportAllChanges))(!0);
|
|
4921
4875
|
})));
|
|
4922
4876
|
}));
|
|
4923
4877
|
};
|
|
@@ -4939,12 +4893,12 @@ export {
|
|
|
4939
4893
|
Or as DEFAULT_SESSION_TIMEOUT,
|
|
4940
4894
|
ae as DEFAULT_WEB_VITALS_MODE,
|
|
4941
4895
|
L as DeviceType,
|
|
4942
|
-
|
|
4896
|
+
ne as EmitterEvent,
|
|
4943
4897
|
U as ErrorType,
|
|
4944
4898
|
d as EventType,
|
|
4945
4899
|
Gr as InitializationTimeoutError,
|
|
4946
4900
|
V as IntegrationValidationError,
|
|
4947
|
-
|
|
4901
|
+
$r as MAX_ARRAY_LENGTH,
|
|
4948
4902
|
kr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
4949
4903
|
Vr as MAX_CUSTOM_EVENT_KEYS,
|
|
4950
4904
|
Pr as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
@@ -4952,7 +4906,7 @@ export {
|
|
|
4952
4906
|
xr as MAX_METADATA_NESTING_DEPTH,
|
|
4953
4907
|
Ur as MAX_NESTED_OBJECT_KEYS,
|
|
4954
4908
|
Hr as MAX_STRING_LENGTH,
|
|
4955
|
-
|
|
4909
|
+
Fr as MAX_STRING_LENGTH_IN_ARRAY,
|
|
4956
4910
|
j as Mode,
|
|
4957
4911
|
Be as PII_PATTERNS,
|
|
4958
4912
|
N as PermanentError,
|