@tracelog/lib 2.7.1-rc.96.3 → 2.7.1-rc.96.5
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 +305 -301
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +2 -2
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +2 -2
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +2 -1
- package/dist/public-api.d.ts +2 -1
- package/dist/public-api.js +2 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const as = 9e5;
|
|
2
2
|
const ls = 120, cs = 49152, us = 100, ds = 500, hs = 200;
|
|
3
3
|
const fs = 1e3, ms = 500, gs = 1e3;
|
|
4
|
-
const b = "data-tlog",
|
|
4
|
+
const b = "data-tlog", wt = [
|
|
5
5
|
"button",
|
|
6
6
|
"a",
|
|
7
7
|
'input[type="button"]',
|
|
@@ -33,7 +33,7 @@ const b = "data-tlog", yt = [
|
|
|
33
33
|
".menu-item",
|
|
34
34
|
"[data-testid]",
|
|
35
35
|
'[tabindex="0"]'
|
|
36
|
-
],
|
|
36
|
+
], bt = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], At = [
|
|
37
37
|
"token",
|
|
38
38
|
"auth",
|
|
39
39
|
"key",
|
|
@@ -72,15 +72,15 @@ const m = {
|
|
|
72
72
|
INVALID_VIEWPORT_COOLDOWN_PERIOD: "Viewport cooldownPeriod must be a non-negative number",
|
|
73
73
|
INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS: "Viewport maxTrackedElements must be a positive number",
|
|
74
74
|
INVALID_SEND_INTERVAL: "Send interval must be between 1000ms (1 second) and 60000ms (60 seconds)"
|
|
75
|
-
},
|
|
75
|
+
}, Lt = [
|
|
76
76
|
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
77
77
|
/javascript:/gi,
|
|
78
78
|
/on\w+\s*=/gi,
|
|
79
79
|
/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
|
80
80
|
/<embed\b[^>]*>/gi,
|
|
81
81
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
82
|
-
], I = "tlog",
|
|
83
|
-
var B = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(B || {}), L = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(L || {}),
|
|
82
|
+
], I = "tlog", G = `${I}:qa_mode`, Se = `${I}:uid`, rt = "tlog_mode", Ve = "qa", Ue = "qa_off", Mt = (s) => s ? `${I}:${s}:queue` : `${I}:queue`, Ct = (s) => s ? `${I}:${s}:session` : `${I}:session`, Rt = (s) => s ? `${I}:${s}:broadcast` : `${I}:broadcast`, He = (s, e) => `${I}:${s}:session_counts:${e}`, Fe = 10080 * 60 * 1e3, xe = `${I}:session_counts_last_cleanup`, $e = 3600 * 1e3, de = (s) => s ? `${I}:${s}:identity` : `${I}:identity`, H = `${I}:pending_identity`;
|
|
83
|
+
var B = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(B || {}), L = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(L || {}), pe = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(pe || {});
|
|
84
84
|
class N extends Error {
|
|
85
85
|
constructor(e, t) {
|
|
86
86
|
super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, N);
|
|
@@ -103,12 +103,12 @@ class f extends z {
|
|
|
103
103
|
super(e, "APP_CONFIG_INVALID", t);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
class
|
|
106
|
+
class Nt extends z {
|
|
107
107
|
constructor(e, t = "config") {
|
|
108
108
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
class
|
|
111
|
+
class Be extends z {
|
|
112
112
|
constructor(e, t = "config") {
|
|
113
113
|
super(e, "SAMPLING_RATE_INVALID", t);
|
|
114
114
|
}
|
|
@@ -123,7 +123,7 @@ class ps extends z {
|
|
|
123
123
|
super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
const
|
|
126
|
+
const st = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", nt = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Ot = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Pt = (s, e) => {
|
|
127
127
|
if (e) {
|
|
128
128
|
if (e instanceof Error) {
|
|
129
129
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
|
|
@@ -142,24 +142,24 @@ const rt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
142
142
|
return `[TraceLog] ${s}: ${String(e)}`;
|
|
143
143
|
}
|
|
144
144
|
return `[TraceLog] ${s}`;
|
|
145
|
-
},
|
|
145
|
+
}, Dt = () => {
|
|
146
146
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
147
147
|
return !1;
|
|
148
148
|
try {
|
|
149
|
-
return sessionStorage.getItem(
|
|
149
|
+
return sessionStorage.getItem(G) === "true";
|
|
150
150
|
} catch {
|
|
151
151
|
return !1;
|
|
152
152
|
}
|
|
153
153
|
}, a = (s, e, t) => {
|
|
154
|
-
const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ?
|
|
155
|
-
if (!
|
|
154
|
+
const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ? Pt(e, r) : `[TraceLog] ${e}`, u = s === "error" ? "error" : s === "warn" ? "warn" : "log";
|
|
155
|
+
if (!kt(l, i))
|
|
156
156
|
return;
|
|
157
|
-
const E =
|
|
158
|
-
|
|
159
|
-
},
|
|
157
|
+
const E = Vt(l, o), T = n !== void 0 ? Te(n) : void 0;
|
|
158
|
+
Ut(u, c, E, T);
|
|
159
|
+
}, kt = (s, e) => s === "critical" ? !0 : s === "qa" || e ? Dt() : !1, Vt = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? Ot : "", Ut = (s, e, t, r) => {
|
|
160
160
|
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
161
161
|
r !== void 0 ? n ? console[s](i, t, r) : console[s](i, r) : n ? console[s](i, t) : console[s](i);
|
|
162
|
-
},
|
|
162
|
+
}, Te = (s) => {
|
|
163
163
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
164
164
|
for (const [r, n] of Object.entries(s)) {
|
|
165
165
|
const i = r.toLowerCase();
|
|
@@ -167,16 +167,16 @@ const rt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
167
167
|
e[r] = "[REDACTED]";
|
|
168
168
|
continue;
|
|
169
169
|
}
|
|
170
|
-
n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] =
|
|
171
|
-
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ?
|
|
170
|
+
n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] = Te(n) : Array.isArray(n) ? e[r] = n.map(
|
|
171
|
+
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ? Te(o) : o
|
|
172
172
|
) : e[r] = n;
|
|
173
173
|
}
|
|
174
174
|
return e;
|
|
175
175
|
};
|
|
176
|
-
let
|
|
177
|
-
const
|
|
178
|
-
typeof window < "u" && !
|
|
179
|
-
}, ne = "Unknown",
|
|
176
|
+
let Ie, it;
|
|
177
|
+
const Ht = () => {
|
|
178
|
+
typeof window < "u" && !Ie && (Ie = window.matchMedia("(pointer: coarse)"), it = window.matchMedia("(hover: none)"));
|
|
179
|
+
}, ne = "Unknown", Ft = (s) => {
|
|
180
180
|
const e = s.userAgentData?.platform;
|
|
181
181
|
if (e != null && e !== "") {
|
|
182
182
|
if (/windows/i.test(e)) return "Windows";
|
|
@@ -199,25 +199,25 @@ const Ut = () => {
|
|
|
199
199
|
}
|
|
200
200
|
const t = navigator.userAgent;
|
|
201
201
|
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" : ne;
|
|
202
|
-
},
|
|
202
|
+
}, $t = () => {
|
|
203
203
|
try {
|
|
204
204
|
const s = navigator;
|
|
205
205
|
if (s.userAgentData != null && typeof s.userAgentData.mobile == "boolean") {
|
|
206
206
|
const c = s.userAgentData.platform;
|
|
207
207
|
return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet : s.userAgentData.mobile ? L.Mobile : L.Desktop;
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
const e = window.innerWidth, t =
|
|
209
|
+
Ht();
|
|
210
|
+
const e = window.innerWidth, t = Ie?.matches ?? !1, r = it?.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);
|
|
211
211
|
return e <= 767 || o && n ? L.Mobile : e >= 768 && e <= 1024 || l || t && r && n ? L.Tablet : L.Desktop;
|
|
212
212
|
} catch (s) {
|
|
213
213
|
return a("debug", "Device detection failed, defaulting to desktop", { error: s }), L.Desktop;
|
|
214
214
|
}
|
|
215
|
-
},
|
|
215
|
+
}, Bt = () => {
|
|
216
216
|
try {
|
|
217
217
|
const s = navigator;
|
|
218
218
|
return {
|
|
219
|
-
type:
|
|
220
|
-
os:
|
|
219
|
+
type: $t(),
|
|
220
|
+
os: Ft(s),
|
|
221
221
|
browser: xt(s)
|
|
222
222
|
};
|
|
223
223
|
} catch (s) {
|
|
@@ -227,7 +227,7 @@ const Ut = () => {
|
|
|
227
227
|
browser: ne
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
|
-
},
|
|
230
|
+
}, ot = [
|
|
231
231
|
// Email addresses
|
|
232
232
|
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
|
|
233
233
|
// US Phone numbers (various formats)
|
|
@@ -241,8 +241,10 @@ const Ut = () => {
|
|
|
241
241
|
// Bearer tokens (JWT-like patterns - matches complete and partial tokens)
|
|
242
242
|
/Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
|
|
243
243
|
// Passwords in connection strings (protocol://user:password@host)
|
|
244
|
-
/:\/\/[^:/]+:([^@]+)@/gi
|
|
245
|
-
|
|
244
|
+
/:\/\/[^:/]+:([^@]+)@/gi,
|
|
245
|
+
// Sensitive URL query parameters (token=, key=, password=, auth=, secret=, api_key=)
|
|
246
|
+
/[?&](token|key|password|passwd|auth|secret|api_key|apikey|access_token)=[^&\s]+/gi
|
|
247
|
+
], We = 500, Xe = 2e3, Ge = 5e3, te = 50, Wt = te * 2, at = 1, Xt = 1e3, Gt = 10, je = 5e3, jt = 6e4, Ts = {
|
|
246
248
|
LCP: 2500,
|
|
247
249
|
// Good: ≤ 2.5s
|
|
248
250
|
FCP: 1800,
|
|
@@ -254,7 +256,7 @@ const Ut = () => {
|
|
|
254
256
|
TTFB: 800,
|
|
255
257
|
// Good: ≤ 800ms
|
|
256
258
|
LONG_TASK: 50
|
|
257
|
-
},
|
|
259
|
+
}, ze = {
|
|
258
260
|
LCP: 2500,
|
|
259
261
|
// Needs improvement: > 2.5s (same as good boundary)
|
|
260
262
|
FCP: 1800,
|
|
@@ -266,7 +268,7 @@ const Ut = () => {
|
|
|
266
268
|
TTFB: 800,
|
|
267
269
|
// Needs improvement: > 800ms
|
|
268
270
|
LONG_TASK: 50
|
|
269
|
-
},
|
|
271
|
+
}, zt = {
|
|
270
272
|
LCP: 4e3,
|
|
271
273
|
// Poor: > 4s
|
|
272
274
|
FCP: 3e3,
|
|
@@ -278,53 +280,53 @@ const Ut = () => {
|
|
|
278
280
|
TTFB: 1800,
|
|
279
281
|
// Poor: > 1800ms
|
|
280
282
|
LONG_TASK: 50
|
|
281
|
-
},
|
|
283
|
+
}, ve = "needs-improvement", Qe = (s = ve) => {
|
|
282
284
|
switch (s) {
|
|
283
285
|
case "all":
|
|
284
286
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
|
|
285
287
|
// Track everything
|
|
286
288
|
case "needs-improvement":
|
|
287
|
-
return
|
|
289
|
+
return ze;
|
|
288
290
|
case "poor":
|
|
289
|
-
return
|
|
291
|
+
return zt;
|
|
290
292
|
default:
|
|
291
|
-
return
|
|
293
|
+
return ze;
|
|
292
294
|
}
|
|
293
|
-
},
|
|
295
|
+
}, Qt = 1e3, Kt = 50, Yt = "2.7.1", qt = Yt, lt = () => typeof window < "u" && typeof sessionStorage < "u", Jt = () => {
|
|
294
296
|
try {
|
|
295
297
|
const s = new URLSearchParams(window.location.search);
|
|
296
|
-
s.delete(
|
|
298
|
+
s.delete(rt);
|
|
297
299
|
const e = s.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
|
|
298
300
|
window.history.replaceState({}, "", t);
|
|
299
301
|
} catch {
|
|
300
302
|
}
|
|
301
|
-
},
|
|
302
|
-
if (!
|
|
303
|
+
}, Zt = () => {
|
|
304
|
+
if (!lt())
|
|
303
305
|
return !1;
|
|
304
306
|
try {
|
|
305
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
307
|
+
const e = new URLSearchParams(window.location.search).get(rt), t = sessionStorage.getItem(G);
|
|
306
308
|
let r = null;
|
|
307
|
-
return e ===
|
|
308
|
-
visibility: "qa",
|
|
309
|
-
style: rt
|
|
310
|
-
})) : e === Ve && (r = !1, sessionStorage.setItem(X, "false"), a("info", "QA Mode DISABLED", {
|
|
309
|
+
return e === Ve ? (r = !0, sessionStorage.setItem(G, "true"), a("info", "QA Mode ACTIVE", {
|
|
311
310
|
visibility: "qa",
|
|
312
311
|
style: st
|
|
313
|
-
}))
|
|
312
|
+
})) : e === Ue && (r = !1, sessionStorage.setItem(G, "false"), a("info", "QA Mode DISABLED", {
|
|
313
|
+
visibility: "qa",
|
|
314
|
+
style: nt
|
|
315
|
+
})), (e === Ve || e === Ue) && Jt(), r ?? t === "true";
|
|
314
316
|
} catch {
|
|
315
317
|
return !1;
|
|
316
318
|
}
|
|
317
|
-
},
|
|
318
|
-
if (
|
|
319
|
+
}, er = (s) => {
|
|
320
|
+
if (lt())
|
|
319
321
|
try {
|
|
320
|
-
sessionStorage.setItem(
|
|
322
|
+
sessionStorage.setItem(G, s ? "true" : "false"), a("info", s ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
321
323
|
visibility: "qa",
|
|
322
|
-
style: s ?
|
|
324
|
+
style: s ? st : nt
|
|
323
325
|
});
|
|
324
326
|
} catch {
|
|
325
327
|
a("debug", "Cannot set QA mode: sessionStorage unavailable");
|
|
326
328
|
}
|
|
327
|
-
},
|
|
329
|
+
}, tr = [
|
|
328
330
|
"co.uk",
|
|
329
331
|
"org.uk",
|
|
330
332
|
"com.au",
|
|
@@ -336,37 +338,37 @@ const Ut = () => {
|
|
|
336
338
|
"co.in",
|
|
337
339
|
"com.cn",
|
|
338
340
|
"co.za"
|
|
339
|
-
],
|
|
341
|
+
], Ke = (s) => {
|
|
340
342
|
const e = s.toLowerCase().split(".");
|
|
341
343
|
if (e.length <= 2)
|
|
342
344
|
return s.toLowerCase();
|
|
343
345
|
const t = e.slice(-2).join(".");
|
|
344
|
-
return
|
|
345
|
-
},
|
|
346
|
+
return tr.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
347
|
+
}, rr = (s, e) => s === e ? !0 : Ke(s) === Ke(e), he = () => {
|
|
346
348
|
const s = document.referrer;
|
|
347
349
|
if (!s)
|
|
348
350
|
return "Direct";
|
|
349
351
|
try {
|
|
350
352
|
const e = new URL(s).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
|
|
351
|
-
return
|
|
353
|
+
return rr(e, t) ? "Direct" : s;
|
|
352
354
|
} catch (e) {
|
|
353
355
|
return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: s } }), s;
|
|
354
356
|
}
|
|
355
|
-
},
|
|
357
|
+
}, fe = () => {
|
|
356
358
|
const s = new URLSearchParams(window.location.search), e = {};
|
|
357
|
-
return
|
|
359
|
+
return bt.forEach((r) => {
|
|
358
360
|
const n = s.get(r);
|
|
359
361
|
if (n) {
|
|
360
362
|
const i = r.split("utm_")[1];
|
|
361
363
|
e[i] = n;
|
|
362
364
|
}
|
|
363
365
|
}), Object.keys(e).length ? e : void 0;
|
|
364
|
-
},
|
|
366
|
+
}, ct = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (s) => {
|
|
365
367
|
const e = Math.random() * 16 | 0;
|
|
366
368
|
return (s === "x" ? e : e & 3 | 8).toString(16);
|
|
367
369
|
});
|
|
368
370
|
let q = 0, J = 0;
|
|
369
|
-
const
|
|
371
|
+
const sr = () => {
|
|
370
372
|
let s = Date.now();
|
|
371
373
|
s < J && (s = J), s === J ? q = (q + 1) % 1e3 : q = 0, J = s;
|
|
372
374
|
const e = q.toString().padStart(3, "0");
|
|
@@ -379,14 +381,14 @@ const rr = () => {
|
|
|
379
381
|
} catch {
|
|
380
382
|
}
|
|
381
383
|
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${s}-${e}-${t}`;
|
|
382
|
-
},
|
|
384
|
+
}, ut = (s, e = !1) => {
|
|
383
385
|
try {
|
|
384
386
|
const t = new URL(s), r = t.protocol === "https:", n = t.protocol === "http:";
|
|
385
387
|
return r || e && n;
|
|
386
388
|
} catch {
|
|
387
389
|
return !1;
|
|
388
390
|
}
|
|
389
|
-
},
|
|
391
|
+
}, nr = (s) => {
|
|
390
392
|
try {
|
|
391
393
|
const t = new URL(window.location.href).hostname;
|
|
392
394
|
if (!t || typeof t != "string")
|
|
@@ -404,28 +406,28 @@ const rr = () => {
|
|
|
404
406
|
if (r.length === 2 ? n = r.join(".") : n = r.slice(-2).join("."), !n || n.split(".").length < 2)
|
|
405
407
|
throw new Error("Invalid domain structure for SaaS");
|
|
406
408
|
const i = `https://${s}.${n}/collect`;
|
|
407
|
-
if (!
|
|
409
|
+
if (!ut(i))
|
|
408
410
|
throw new Error("Generated URL failed validation");
|
|
409
411
|
return i;
|
|
410
412
|
} catch (e) {
|
|
411
413
|
throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
|
|
412
414
|
}
|
|
413
|
-
},
|
|
415
|
+
}, ir = (s) => {
|
|
414
416
|
const e = {};
|
|
415
|
-
s.integrations?.tracelog?.projectId && (e.saas =
|
|
417
|
+
s.integrations?.tracelog?.projectId && (e.saas = nr(s.integrations.tracelog.projectId));
|
|
416
418
|
const t = s.integrations?.custom?.collectApiUrl;
|
|
417
419
|
if (t) {
|
|
418
420
|
const r = s.integrations?.custom?.allowHttp ?? !1;
|
|
419
|
-
if (!
|
|
421
|
+
if (!ut(t, r))
|
|
420
422
|
throw new Error("Invalid custom API URL");
|
|
421
423
|
e.custom = t;
|
|
422
424
|
}
|
|
423
425
|
return e;
|
|
424
|
-
},
|
|
426
|
+
}, _e = (s, e = []) => {
|
|
425
427
|
if (!s || typeof s != "string")
|
|
426
428
|
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof s } }), s || "";
|
|
427
429
|
try {
|
|
428
|
-
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...
|
|
430
|
+
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...At, ...e])];
|
|
429
431
|
let i = !1;
|
|
430
432
|
const o = [];
|
|
431
433
|
return n.forEach((c) => {
|
|
@@ -434,13 +436,13 @@ const rr = () => {
|
|
|
434
436
|
} catch (t) {
|
|
435
437
|
return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: s?.length } }), s;
|
|
436
438
|
}
|
|
437
|
-
},
|
|
439
|
+
}, Ye = (s) => {
|
|
438
440
|
if (!s || typeof s != "string" || s.trim().length === 0)
|
|
439
441
|
return "";
|
|
440
442
|
let e = s;
|
|
441
443
|
s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
|
|
442
444
|
let t = 0;
|
|
443
|
-
for (const n of
|
|
445
|
+
for (const n of Lt) {
|
|
444
446
|
const i = e;
|
|
445
447
|
e = e.replace(n, ""), i !== e && t++;
|
|
446
448
|
}
|
|
@@ -450,11 +452,11 @@ const rr = () => {
|
|
|
450
452
|
valueLength: s.length
|
|
451
453
|
}
|
|
452
454
|
}), e.trim();
|
|
453
|
-
},
|
|
455
|
+
}, ye = (s, e = 0) => {
|
|
454
456
|
if (s == null)
|
|
455
457
|
return null;
|
|
456
458
|
if (typeof s == "string")
|
|
457
|
-
return
|
|
459
|
+
return Ye(s);
|
|
458
460
|
if (typeof s == "number")
|
|
459
461
|
return !Number.isFinite(s) || s < -Number.MAX_SAFE_INTEGER || s > Number.MAX_SAFE_INTEGER ? 0 : s;
|
|
460
462
|
if (typeof s == "boolean")
|
|
@@ -462,38 +464,38 @@ const rr = () => {
|
|
|
462
464
|
if (e > 10)
|
|
463
465
|
return null;
|
|
464
466
|
if (Array.isArray(s))
|
|
465
|
-
return s.slice(0, 1e3).map((n) =>
|
|
467
|
+
return s.slice(0, 1e3).map((n) => ye(n, e + 1)).filter((n) => n !== null);
|
|
466
468
|
if (typeof s == "object") {
|
|
467
469
|
const t = {}, n = Object.entries(s).slice(0, 200);
|
|
468
470
|
for (const [i, o] of n) {
|
|
469
|
-
const l =
|
|
471
|
+
const l = Ye(i);
|
|
470
472
|
if (l) {
|
|
471
|
-
const c =
|
|
473
|
+
const c = ye(o, e + 1);
|
|
472
474
|
c !== null && (t[l] = c);
|
|
473
475
|
}
|
|
474
476
|
}
|
|
475
477
|
return t;
|
|
476
478
|
}
|
|
477
479
|
return null;
|
|
478
|
-
},
|
|
480
|
+
}, or = (s) => {
|
|
479
481
|
if (typeof s != "object" || s === null)
|
|
480
482
|
return {};
|
|
481
483
|
try {
|
|
482
|
-
const e =
|
|
484
|
+
const e = ye(s);
|
|
483
485
|
return typeof e == "object" && e !== null ? e : {};
|
|
484
486
|
} catch (e) {
|
|
485
487
|
const t = e instanceof Error ? e.message : String(e);
|
|
486
488
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
487
489
|
}
|
|
488
|
-
},
|
|
490
|
+
}, ar = (s) => {
|
|
489
491
|
if (s !== void 0 && (s === null || typeof s != "object"))
|
|
490
492
|
throw new f("Configuration must be an object", "config");
|
|
491
493
|
if (s) {
|
|
492
494
|
if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
|
|
493
|
-
throw new
|
|
495
|
+
throw new Nt(m.INVALID_SESSION_TIMEOUT, "config");
|
|
494
496
|
if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
|
|
495
497
|
throw new f(m.INVALID_GLOBAL_METADATA, "config");
|
|
496
|
-
if (s.integrations &&
|
|
498
|
+
if (s.integrations && cr(s.integrations), s.sensitiveQueryParams !== void 0) {
|
|
497
499
|
if (!Array.isArray(s.sensitiveQueryParams))
|
|
498
500
|
throw new f(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
499
501
|
for (const e of s.sensitiveQueryParams)
|
|
@@ -501,9 +503,9 @@ const rr = () => {
|
|
|
501
503
|
throw new f("All sensitive query params must be strings", "config");
|
|
502
504
|
}
|
|
503
505
|
if (s.errorSampling !== void 0 && (typeof s.errorSampling != "number" || s.errorSampling < 0 || s.errorSampling > 1))
|
|
504
|
-
throw new
|
|
506
|
+
throw new Be(m.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
505
507
|
if (s.samplingRate !== void 0 && (typeof s.samplingRate != "number" || s.samplingRate < 0 || s.samplingRate > 1))
|
|
506
|
-
throw new
|
|
508
|
+
throw new Be(m.INVALID_SAMPLING_RATE, "config");
|
|
507
509
|
if (s.primaryScrollSelector !== void 0) {
|
|
508
510
|
if (typeof s.primaryScrollSelector != "string" || !s.primaryScrollSelector.trim())
|
|
509
511
|
throw new f(m.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
@@ -525,7 +527,7 @@ const rr = () => {
|
|
|
525
527
|
throw new f(m.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
|
|
526
528
|
if (s.sendIntervalMs !== void 0 && (!Number.isFinite(s.sendIntervalMs) || s.sendIntervalMs < 1e3 || s.sendIntervalMs > 6e4))
|
|
527
529
|
throw new f(m.INVALID_SEND_INTERVAL, "config");
|
|
528
|
-
if (s.viewport !== void 0 &&
|
|
530
|
+
if (s.viewport !== void 0 && lr(s.viewport), s.webVitalsMode !== void 0) {
|
|
529
531
|
if (typeof s.webVitalsMode != "string")
|
|
530
532
|
throw new f(
|
|
531
533
|
`Invalid webVitalsMode type: ${typeof s.webVitalsMode}. Must be a string`,
|
|
@@ -556,7 +558,7 @@ const rr = () => {
|
|
|
556
558
|
}
|
|
557
559
|
}
|
|
558
560
|
}
|
|
559
|
-
},
|
|
561
|
+
}, lr = (s) => {
|
|
560
562
|
if (typeof s != "object" || s === null)
|
|
561
563
|
throw new f(m.INVALID_VIEWPORT_CONFIG, "config");
|
|
562
564
|
if (!s.elements || !Array.isArray(s.elements))
|
|
@@ -586,7 +588,7 @@ const rr = () => {
|
|
|
586
588
|
throw new f(m.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
587
589
|
if (s.maxTrackedElements !== void 0 && (typeof s.maxTrackedElements != "number" || s.maxTrackedElements <= 0))
|
|
588
590
|
throw new f(m.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
589
|
-
},
|
|
591
|
+
}, cr = (s) => {
|
|
590
592
|
if (s) {
|
|
591
593
|
if (s.tracelog && (!s.tracelog.projectId || typeof s.tracelog.projectId != "string" || s.tracelog.projectId.trim() === ""))
|
|
592
594
|
throw new U(m.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
@@ -607,14 +609,14 @@ const rr = () => {
|
|
|
607
609
|
throw new U('fetchCredentials must be "include", "same-origin", or "omit"', "config");
|
|
608
610
|
}
|
|
609
611
|
}
|
|
610
|
-
},
|
|
611
|
-
|
|
612
|
+
}, ur = (s) => {
|
|
613
|
+
ar(s);
|
|
612
614
|
const e = {
|
|
613
615
|
...s ?? {},
|
|
614
616
|
sessionTimeout: s?.sessionTimeout ?? 9e5,
|
|
615
617
|
globalMetadata: s?.globalMetadata ?? {},
|
|
616
618
|
sensitiveQueryParams: s?.sensitiveQueryParams ?? [],
|
|
617
|
-
errorSampling: s?.errorSampling ??
|
|
619
|
+
errorSampling: s?.errorSampling ?? at,
|
|
618
620
|
samplingRate: s?.samplingRate ?? 1,
|
|
619
621
|
pageViewThrottleMs: s?.pageViewThrottleMs ?? 1e3,
|
|
620
622
|
clickThrottleMs: s?.clickThrottleMs ?? 300,
|
|
@@ -631,18 +633,18 @@ const rr = () => {
|
|
|
631
633
|
cooldownPeriod: e.viewport.cooldownPeriod ?? 6e4,
|
|
632
634
|
maxTrackedElements: e.viewport.maxTrackedElements ?? 100
|
|
633
635
|
}), e;
|
|
634
|
-
},
|
|
636
|
+
}, we = (s, e = /* @__PURE__ */ new Set()) => {
|
|
635
637
|
if (s == null)
|
|
636
638
|
return !0;
|
|
637
639
|
const t = typeof s;
|
|
638
|
-
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(s) ? !1 : (e.add(s), Array.isArray(s) ? s.every((r) =>
|
|
639
|
-
},
|
|
640
|
+
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(s) ? !1 : (e.add(s), Array.isArray(s) ? s.every((r) => we(r, e)) : t === "object" ? Object.values(s).every((r) => we(r, e)) : !1);
|
|
641
|
+
}, dr = (s) => typeof s != "object" || s === null ? !1 : we(s), dt = (s) => {
|
|
640
642
|
if (typeof s != "object" || s === null || Array.isArray(s)) return;
|
|
641
643
|
const e = {};
|
|
642
644
|
for (const [t, r] of Object.entries(s))
|
|
643
645
|
typeof r == "string" && (e[t] = r);
|
|
644
646
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
645
|
-
},
|
|
647
|
+
}, hr = (s) => typeof s != "string" ? {
|
|
646
648
|
valid: !1,
|
|
647
649
|
error: "Event name must be a string"
|
|
648
650
|
} : s.length === 0 ? {
|
|
@@ -657,9 +659,9 @@ const rr = () => {
|
|
|
657
659
|
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(s.toLowerCase()) ? {
|
|
658
660
|
valid: !1,
|
|
659
661
|
error: "Event name cannot be a reserved word"
|
|
660
|
-
} : { valid: !0 },
|
|
661
|
-
const r =
|
|
662
|
-
if (!
|
|
662
|
+
} : { valid: !0 }, qe = (s, e, t) => {
|
|
663
|
+
const r = or(e), n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
664
|
+
if (!dr(r))
|
|
663
665
|
return {
|
|
664
666
|
valid: !1,
|
|
665
667
|
error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
|
|
@@ -707,7 +709,7 @@ const rr = () => {
|
|
|
707
709
|
valid: !0,
|
|
708
710
|
sanitizedMetadata: r
|
|
709
711
|
};
|
|
710
|
-
},
|
|
712
|
+
}, ht = (s, e, t) => {
|
|
711
713
|
if (Array.isArray(e)) {
|
|
712
714
|
const r = [], n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
713
715
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -717,7 +719,7 @@ const rr = () => {
|
|
|
717
719
|
valid: !1,
|
|
718
720
|
error: `${n}: array item at index ${i} must be an object.`
|
|
719
721
|
};
|
|
720
|
-
const l =
|
|
722
|
+
const l = qe(s, o, t);
|
|
721
723
|
if (!l.valid)
|
|
722
724
|
return {
|
|
723
725
|
valid: !1,
|
|
@@ -730,16 +732,16 @@ const rr = () => {
|
|
|
730
732
|
sanitizedMetadata: r
|
|
731
733
|
};
|
|
732
734
|
}
|
|
733
|
-
return
|
|
734
|
-
},
|
|
735
|
-
const t =
|
|
735
|
+
return qe(s, e, t);
|
|
736
|
+
}, fr = (s, e) => {
|
|
737
|
+
const t = hr(s);
|
|
736
738
|
if (!t.valid)
|
|
737
739
|
return a("error", "Event name validation failed", {
|
|
738
740
|
data: { eventName: s, error: t.error }
|
|
739
741
|
}), t;
|
|
740
742
|
if (!e)
|
|
741
743
|
return { valid: !0 };
|
|
742
|
-
const r =
|
|
744
|
+
const r = ht(s, e, "customEvent");
|
|
743
745
|
return r.valid || a("error", "Event metadata validation failed", {
|
|
744
746
|
data: {
|
|
745
747
|
eventName: s,
|
|
@@ -747,7 +749,7 @@ const rr = () => {
|
|
|
747
749
|
}
|
|
748
750
|
}), r;
|
|
749
751
|
};
|
|
750
|
-
class
|
|
752
|
+
class mr {
|
|
751
753
|
listeners = /* @__PURE__ */ new Map();
|
|
752
754
|
/**
|
|
753
755
|
* Subscribes to an event channel
|
|
@@ -864,7 +866,7 @@ class fr {
|
|
|
864
866
|
this.listeners.clear();
|
|
865
867
|
}
|
|
866
868
|
}
|
|
867
|
-
function
|
|
869
|
+
function ft(s, e, t) {
|
|
868
870
|
try {
|
|
869
871
|
const r = e(s);
|
|
870
872
|
return r === null ? null : typeof r == "object" && r !== null && "type" in r ? r : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), s);
|
|
@@ -875,10 +877,10 @@ function ht(s, e, t) {
|
|
|
875
877
|
}), s;
|
|
876
878
|
}
|
|
877
879
|
}
|
|
878
|
-
function
|
|
879
|
-
return s.map((r) =>
|
|
880
|
+
function gr(s, e, t) {
|
|
881
|
+
return s.map((r) => ft(r, e, t)).filter((r) => r !== null);
|
|
880
882
|
}
|
|
881
|
-
function
|
|
883
|
+
function mt(s, e, t) {
|
|
882
884
|
try {
|
|
883
885
|
const r = e(s);
|
|
884
886
|
return r === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
|
|
@@ -894,7 +896,7 @@ function ft(s, e, t) {
|
|
|
894
896
|
}), s;
|
|
895
897
|
}
|
|
896
898
|
}
|
|
897
|
-
const
|
|
899
|
+
const me = { config: {} };
|
|
898
900
|
class w {
|
|
899
901
|
/**
|
|
900
902
|
* Retrieves a value from global state.
|
|
@@ -913,7 +915,7 @@ class w {
|
|
|
913
915
|
* ```
|
|
914
916
|
*/
|
|
915
917
|
get(e) {
|
|
916
|
-
return
|
|
918
|
+
return me[e];
|
|
917
919
|
}
|
|
918
920
|
/**
|
|
919
921
|
* Sets a value in global state.
|
|
@@ -933,7 +935,7 @@ class w {
|
|
|
933
935
|
* ```
|
|
934
936
|
*/
|
|
935
937
|
set(e, t) {
|
|
936
|
-
|
|
938
|
+
me[e] = t;
|
|
937
939
|
}
|
|
938
940
|
/**
|
|
939
941
|
* Returns an immutable snapshot of the entire global state.
|
|
@@ -950,10 +952,10 @@ class w {
|
|
|
950
952
|
* ```
|
|
951
953
|
*/
|
|
952
954
|
getState() {
|
|
953
|
-
return { ...
|
|
955
|
+
return { ...me };
|
|
954
956
|
}
|
|
955
957
|
}
|
|
956
|
-
class
|
|
958
|
+
class Je extends w {
|
|
957
959
|
storeManager;
|
|
958
960
|
integrationId;
|
|
959
961
|
apiUrl;
|
|
@@ -1038,7 +1040,7 @@ class qe extends w {
|
|
|
1038
1040
|
return { ...this.staticHeaders, ...e };
|
|
1039
1041
|
}
|
|
1040
1042
|
getQueueStorageKey() {
|
|
1041
|
-
const e = this.get("userId") || "anonymous", t =
|
|
1043
|
+
const e = this.get("userId") || "anonymous", t = Mt(e);
|
|
1042
1044
|
return this.integrationId ? `${t}:${this.integrationId}` : t;
|
|
1043
1045
|
}
|
|
1044
1046
|
/**
|
|
@@ -1268,7 +1270,7 @@ class qe extends w {
|
|
|
1268
1270
|
const t = this.transformers.beforeSend;
|
|
1269
1271
|
if (!t)
|
|
1270
1272
|
return e;
|
|
1271
|
-
const r =
|
|
1273
|
+
const r = gr(
|
|
1272
1274
|
e.events,
|
|
1273
1275
|
t,
|
|
1274
1276
|
this.integrationId || "SenderManager"
|
|
@@ -1313,7 +1315,7 @@ class qe extends w {
|
|
|
1313
1315
|
if (this.integrationId === "saas")
|
|
1314
1316
|
return e;
|
|
1315
1317
|
const t = this.transformers.beforeBatch;
|
|
1316
|
-
return t ?
|
|
1318
|
+
return t ? mt(e, t, this.integrationId || "SenderManager") : e;
|
|
1317
1319
|
}
|
|
1318
1320
|
/**
|
|
1319
1321
|
* Calculates exponential backoff delay with jitter for retry attempts.
|
|
@@ -1569,7 +1571,7 @@ class qe extends w {
|
|
|
1569
1571
|
_metadata: {
|
|
1570
1572
|
referer: typeof window < "u" ? window.location.href : void 0,
|
|
1571
1573
|
timestamp: t,
|
|
1572
|
-
client_version:
|
|
1574
|
+
client_version: qt
|
|
1573
1575
|
}
|
|
1574
1576
|
};
|
|
1575
1577
|
return {
|
|
@@ -1708,12 +1710,12 @@ class qe extends w {
|
|
|
1708
1710
|
}
|
|
1709
1711
|
logPermanentError(e, t) {
|
|
1710
1712
|
const r = Date.now();
|
|
1711
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >=
|
|
1713
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >= jt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1712
1714
|
data: { status: t.statusCode, message: t.message }
|
|
1713
1715
|
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: r });
|
|
1714
1716
|
}
|
|
1715
1717
|
}
|
|
1716
|
-
class
|
|
1718
|
+
class Er extends w {
|
|
1717
1719
|
bootTime;
|
|
1718
1720
|
bootTimestamp;
|
|
1719
1721
|
hasPerformanceNow;
|
|
@@ -1862,8 +1864,8 @@ class gr extends w {
|
|
|
1862
1864
|
};
|
|
1863
1865
|
}
|
|
1864
1866
|
}
|
|
1865
|
-
const
|
|
1866
|
-
class
|
|
1867
|
+
const Sr = new Set(Object.values(d));
|
|
1868
|
+
class pr extends w {
|
|
1867
1869
|
dataSenders;
|
|
1868
1870
|
emitter;
|
|
1869
1871
|
transformers;
|
|
@@ -1902,10 +1904,10 @@ class Sr extends w {
|
|
|
1902
1904
|
* @param fetchCredentials - Fetch credentials mode for custom backend. @default 'include'
|
|
1903
1905
|
*/
|
|
1904
1906
|
constructor(e, t = null, r = {}, n = {}, i, o = "include") {
|
|
1905
|
-
super(), this.emitter = t, this.transformers = r, this.timeManager = new
|
|
1907
|
+
super(), this.emitter = t, this.transformers = r, this.timeManager = new Er(), this.dataSenders = [];
|
|
1906
1908
|
const l = this.get("collectApiUrls");
|
|
1907
|
-
l?.saas && this.dataSenders.push(new
|
|
1908
|
-
new
|
|
1909
|
+
l?.saas && this.dataSenders.push(new Je(e, "saas", l.saas, r)), l?.custom && this.dataSenders.push(
|
|
1910
|
+
new Je(
|
|
1909
1911
|
e,
|
|
1910
1912
|
"custom",
|
|
1911
1913
|
l.custom,
|
|
@@ -2033,7 +2035,7 @@ class Sr extends w {
|
|
|
2033
2035
|
a("error", "Event type is required - event will be ignored");
|
|
2034
2036
|
return;
|
|
2035
2037
|
}
|
|
2036
|
-
if (!
|
|
2038
|
+
if (!Sr.has(e)) {
|
|
2037
2039
|
a("error", "Invalid event type - event will be ignored", {
|
|
2038
2040
|
data: { type: e }
|
|
2039
2041
|
});
|
|
@@ -2077,12 +2079,12 @@ class Sr extends w {
|
|
|
2077
2079
|
}
|
|
2078
2080
|
const v = this.getTypeLimitForEvent(S);
|
|
2079
2081
|
if (v) {
|
|
2080
|
-
const
|
|
2081
|
-
if (
|
|
2082
|
+
const ue = this.sessionEventCounts[S];
|
|
2083
|
+
if (ue !== void 0 && ue >= v) {
|
|
2082
2084
|
a("warn", "Session event type limit reached", {
|
|
2083
2085
|
data: {
|
|
2084
2086
|
type: S,
|
|
2085
|
-
count:
|
|
2087
|
+
count: ue,
|
|
2086
2088
|
limit: v
|
|
2087
2089
|
}
|
|
2088
2090
|
});
|
|
@@ -2095,7 +2097,7 @@ class Sr extends w {
|
|
|
2095
2097
|
if (!this.checkPerEventRateLimit(o.name, v))
|
|
2096
2098
|
return;
|
|
2097
2099
|
}
|
|
2098
|
-
const
|
|
2100
|
+
const ke = S === d.SESSION_START, Y = t || this.get("pageUrl"), $ = this.buildEventPayload({
|
|
2099
2101
|
type: S,
|
|
2100
2102
|
page_url: Y,
|
|
2101
2103
|
from_page_url: r,
|
|
@@ -2108,7 +2110,7 @@ class Sr extends w {
|
|
|
2108
2110
|
page_view: g
|
|
2109
2111
|
});
|
|
2110
2112
|
if ($ && !(!T && !this.shouldSample())) {
|
|
2111
|
-
if (
|
|
2113
|
+
if (ke) {
|
|
2112
2114
|
const v = this.get("sessionId");
|
|
2113
2115
|
if (!v) {
|
|
2114
2116
|
a("error", "Session start event requires sessionId - event will be ignored");
|
|
@@ -2491,7 +2493,7 @@ class Sr extends w {
|
|
|
2491
2493
|
};
|
|
2492
2494
|
const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
|
|
2493
2495
|
if (!o && l) {
|
|
2494
|
-
const c =
|
|
2496
|
+
const c = mt(n, l, "EventManager");
|
|
2495
2497
|
c !== null && (n = c);
|
|
2496
2498
|
}
|
|
2497
2499
|
return n;
|
|
@@ -2503,7 +2505,7 @@ class Sr extends w {
|
|
|
2503
2505
|
});
|
|
2504
2506
|
const i = this.get("sessionReferrer"), o = this.get("sessionUtm");
|
|
2505
2507
|
let l = {
|
|
2506
|
-
id:
|
|
2508
|
+
id: sr(),
|
|
2507
2509
|
type: e.type,
|
|
2508
2510
|
page_url: t,
|
|
2509
2511
|
timestamp: r,
|
|
@@ -2520,7 +2522,7 @@ class Sr extends w {
|
|
|
2520
2522
|
};
|
|
2521
2523
|
const c = this.get("collectApiUrls"), u = !!c?.custom, g = !!c?.saas, E = u || g, T = u && g, S = this.transformers.beforeSend;
|
|
2522
2524
|
if (S && (!E || u && !T)) {
|
|
2523
|
-
const Y =
|
|
2525
|
+
const Y = ft(l, S, "EventManager");
|
|
2524
2526
|
if (Y === null)
|
|
2525
2527
|
return null;
|
|
2526
2528
|
l = Y;
|
|
@@ -2618,10 +2620,10 @@ class Sr extends w {
|
|
|
2618
2620
|
this.eventsQueue = this.eventsQueue.filter((r) => !t.has(r.id));
|
|
2619
2621
|
}
|
|
2620
2622
|
emitEvent(e) {
|
|
2621
|
-
this.emitter && this.emitter.emit(
|
|
2623
|
+
this.emitter && this.emitter.emit(pe.EVENT, e);
|
|
2622
2624
|
}
|
|
2623
2625
|
emitEventsQueue(e) {
|
|
2624
|
-
this.emitter && this.emitter.emit(
|
|
2626
|
+
this.emitter && this.emitter.emit(pe.QUEUE, e);
|
|
2625
2627
|
}
|
|
2626
2628
|
/**
|
|
2627
2629
|
* Creates a debounced version of a function that delays execution until after
|
|
@@ -2697,13 +2699,13 @@ class Sr extends w {
|
|
|
2697
2699
|
loadSessionCounts(e) {
|
|
2698
2700
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
2699
2701
|
return this.getInitialCounts();
|
|
2700
|
-
const t = this.get("userId") || "anonymous", r =
|
|
2702
|
+
const t = this.get("userId") || "anonymous", r = He(t, e);
|
|
2701
2703
|
try {
|
|
2702
2704
|
const n = localStorage.getItem(r);
|
|
2703
2705
|
if (!n)
|
|
2704
2706
|
return this.getInitialCounts();
|
|
2705
2707
|
const i = JSON.parse(n);
|
|
2706
|
-
return i._timestamp && Date.now() - i._timestamp >
|
|
2708
|
+
return i._timestamp && Date.now() - i._timestamp > Fe ? (a("debug", "Session counts expired, clearing", {
|
|
2707
2709
|
data: { sessionId: e, age: Date.now() - i._timestamp }
|
|
2708
2710
|
}), 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" ? {
|
|
2709
2711
|
total: i.total,
|
|
@@ -2751,9 +2753,9 @@ class Sr extends w {
|
|
|
2751
2753
|
const e = localStorage.getItem(xe);
|
|
2752
2754
|
if (e) {
|
|
2753
2755
|
const i = Date.now() - parseInt(e, 10);
|
|
2754
|
-
if (i <
|
|
2756
|
+
if (i < $e) {
|
|
2755
2757
|
a("debug", "Skipping session counts cleanup (throttled)", {
|
|
2756
|
-
data: { timeSinceLastCleanup: i, throttleMs:
|
|
2758
|
+
data: { timeSinceLastCleanup: i, throttleMs: $e }
|
|
2757
2759
|
});
|
|
2758
2760
|
return;
|
|
2759
2761
|
}
|
|
@@ -2766,7 +2768,7 @@ class Sr extends w {
|
|
|
2766
2768
|
const l = localStorage.getItem(o);
|
|
2767
2769
|
if (l) {
|
|
2768
2770
|
const c = JSON.parse(l);
|
|
2769
|
-
c._timestamp && Date.now() - c._timestamp >
|
|
2771
|
+
c._timestamp && Date.now() - c._timestamp > Fe && n.push(o);
|
|
2770
2772
|
}
|
|
2771
2773
|
} catch {
|
|
2772
2774
|
}
|
|
@@ -2807,7 +2809,7 @@ class Sr extends w {
|
|
|
2807
2809
|
* @internal
|
|
2808
2810
|
*/
|
|
2809
2811
|
saveSessionCounts(e) {
|
|
2810
|
-
const t = this.get("userId") || "anonymous", r =
|
|
2812
|
+
const t = this.get("userId") || "anonymous", r = He(t, e);
|
|
2811
2813
|
try {
|
|
2812
2814
|
const n = {
|
|
2813
2815
|
...this.sessionEventCounts,
|
|
@@ -2823,7 +2825,7 @@ class Sr extends w {
|
|
|
2823
2825
|
}
|
|
2824
2826
|
}
|
|
2825
2827
|
}
|
|
2826
|
-
class
|
|
2828
|
+
class Tr {
|
|
2827
2829
|
/**
|
|
2828
2830
|
* Gets or creates a unique user ID.
|
|
2829
2831
|
*
|
|
@@ -2841,15 +2843,15 @@ class pr {
|
|
|
2841
2843
|
* @returns Persistent unique user ID (UUID v4 format)
|
|
2842
2844
|
*/
|
|
2843
2845
|
static getId(e) {
|
|
2844
|
-
const t = e.getItem(
|
|
2846
|
+
const t = e.getItem(Se);
|
|
2845
2847
|
if (t)
|
|
2846
2848
|
return t;
|
|
2847
|
-
const r =
|
|
2848
|
-
return e.setItem(
|
|
2849
|
+
const r = ct();
|
|
2850
|
+
return e.setItem(Se, r), r;
|
|
2849
2851
|
}
|
|
2850
2852
|
}
|
|
2851
|
-
const
|
|
2852
|
-
class
|
|
2853
|
+
const Ir = /^\d{13}-[a-z0-9]{9}$/;
|
|
2854
|
+
class vr extends w {
|
|
2853
2855
|
storageManager;
|
|
2854
2856
|
eventManager;
|
|
2855
2857
|
projectId;
|
|
@@ -2875,7 +2877,7 @@ class Ir extends w {
|
|
|
2875
2877
|
return;
|
|
2876
2878
|
}
|
|
2877
2879
|
const e = this.getProjectId();
|
|
2878
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
2880
|
+
this.broadcastChannel = new BroadcastChannel(Rt(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2879
2881
|
const { action: r, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
|
|
2880
2882
|
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 } }));
|
|
2881
2883
|
};
|
|
@@ -2895,7 +2897,7 @@ class Ir extends w {
|
|
|
2895
2897
|
const e = this.loadStoredSession();
|
|
2896
2898
|
if (!e)
|
|
2897
2899
|
return null;
|
|
2898
|
-
if (!
|
|
2900
|
+
if (!Ir.test(e.id))
|
|
2899
2901
|
return a("warn", "Invalid session ID format recovered from storage, clearing", {
|
|
2900
2902
|
data: { sessionId: e.id }
|
|
2901
2903
|
}), this.clearStoredSession(), null;
|
|
@@ -2940,7 +2942,7 @@ class Ir extends w {
|
|
|
2940
2942
|
this.storageManager.setItem(t, r), this.storageManager.setSessionItem(t, r);
|
|
2941
2943
|
}
|
|
2942
2944
|
getSessionStorageKey() {
|
|
2943
|
-
return
|
|
2945
|
+
return Ct(this.getProjectId());
|
|
2944
2946
|
}
|
|
2945
2947
|
getProjectId() {
|
|
2946
2948
|
return this.projectId;
|
|
@@ -3006,9 +3008,9 @@ class Ir extends w {
|
|
|
3006
3008
|
let r, n;
|
|
3007
3009
|
if (e) {
|
|
3008
3010
|
const i = this.loadStoredSession();
|
|
3009
|
-
r = i?.referrer ??
|
|
3011
|
+
r = i?.referrer ?? he(), n = i?.utm ?? fe();
|
|
3010
3012
|
} else
|
|
3011
|
-
r =
|
|
3013
|
+
r = he(), n = fe();
|
|
3012
3014
|
a("debug", "Session tracking initialized", {
|
|
3013
3015
|
data: {
|
|
3014
3016
|
sessionId: t,
|
|
@@ -3059,7 +3061,7 @@ class Ir extends w {
|
|
|
3059
3061
|
*/
|
|
3060
3062
|
renewSession() {
|
|
3061
3063
|
this.needsRenewal = !1;
|
|
3062
|
-
const e = this.generateSessionId(), t =
|
|
3064
|
+
const e = this.generateSessionId(), t = he(), r = fe();
|
|
3063
3065
|
a("debug", "Renewing session after timeout", {
|
|
3064
3066
|
data: { newSessionId: e }
|
|
3065
3067
|
}), this.set("sessionId", e), this.set("sessionReferrer", t), this.set("sessionUtm", r), this.persistSession(e, Date.now(), t, r), this.cleanupCrossTabSync(), this.initCrossTabSync(), this.shareSession(e), this.eventManager.track({
|
|
@@ -3180,7 +3182,7 @@ class Ir extends w {
|
|
|
3180
3182
|
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
|
|
3181
3183
|
}
|
|
3182
3184
|
}
|
|
3183
|
-
class
|
|
3185
|
+
class _r extends w {
|
|
3184
3186
|
eventManager;
|
|
3185
3187
|
storageManager;
|
|
3186
3188
|
sessionManager = null;
|
|
@@ -3215,7 +3217,7 @@ class vr extends w {
|
|
|
3215
3217
|
}
|
|
3216
3218
|
const t = this.get("config")?.integrations?.tracelog?.projectId ?? "custom";
|
|
3217
3219
|
try {
|
|
3218
|
-
this.sessionManager = new
|
|
3220
|
+
this.sessionManager = new vr(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
|
|
3219
3221
|
} catch (r) {
|
|
3220
3222
|
if (this.sessionManager) {
|
|
3221
3223
|
try {
|
|
@@ -3268,7 +3270,7 @@ class vr extends w {
|
|
|
3268
3270
|
this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
|
|
3269
3271
|
}
|
|
3270
3272
|
}
|
|
3271
|
-
class
|
|
3273
|
+
class yr extends w {
|
|
3272
3274
|
eventManager;
|
|
3273
3275
|
onTrack;
|
|
3274
3276
|
originalPushState;
|
|
@@ -3308,7 +3310,7 @@ class _r extends w {
|
|
|
3308
3310
|
};
|
|
3309
3311
|
}
|
|
3310
3312
|
trackCurrentPage = () => {
|
|
3311
|
-
const e = window.location.href, t =
|
|
3313
|
+
const e = window.location.href, t = _e(e, this.get("config").sensitiveQueryParams);
|
|
3312
3314
|
if (this.get("pageUrl") === t)
|
|
3313
3315
|
return;
|
|
3314
3316
|
const r = Date.now(), n = this.get("config").pageViewThrottleMs ?? 1e3;
|
|
@@ -3326,7 +3328,7 @@ class _r extends w {
|
|
|
3326
3328
|
});
|
|
3327
3329
|
};
|
|
3328
3330
|
trackInitialPageView() {
|
|
3329
|
-
const e =
|
|
3331
|
+
const e = _e(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
|
|
3330
3332
|
this.lastPageViewTime = Date.now(), this.eventManager.track({
|
|
3331
3333
|
type: d.PAGE_VIEW,
|
|
3332
3334
|
page_url: e,
|
|
@@ -3344,7 +3346,7 @@ class _r extends w {
|
|
|
3344
3346
|
};
|
|
3345
3347
|
}
|
|
3346
3348
|
}
|
|
3347
|
-
class
|
|
3349
|
+
class wr extends w {
|
|
3348
3350
|
eventManager;
|
|
3349
3351
|
lastClickTimes = /* @__PURE__ */ new Map();
|
|
3350
3352
|
clickHandler;
|
|
@@ -3482,7 +3484,7 @@ class yr extends w {
|
|
|
3482
3484
|
return e.hasAttribute(`${b}-name`) ? e : e.closest(`[${b}-name]`);
|
|
3483
3485
|
}
|
|
3484
3486
|
getRelevantClickElement(e) {
|
|
3485
|
-
for (const t of
|
|
3487
|
+
for (const t of wt)
|
|
3486
3488
|
try {
|
|
3487
3489
|
if (e.matches(t))
|
|
3488
3490
|
return e;
|
|
@@ -3562,7 +3564,7 @@ class yr extends w {
|
|
|
3562
3564
|
*/
|
|
3563
3565
|
sanitizeText(e) {
|
|
3564
3566
|
let t = e;
|
|
3565
|
-
for (const r of
|
|
3567
|
+
for (const r of ot) {
|
|
3566
3568
|
const n = new RegExp(r.source, r.flags);
|
|
3567
3569
|
t = t.replace(n, "[REDACTED]");
|
|
3568
3570
|
}
|
|
@@ -3601,7 +3603,7 @@ class yr extends w {
|
|
|
3601
3603
|
};
|
|
3602
3604
|
}
|
|
3603
3605
|
}
|
|
3604
|
-
class
|
|
3606
|
+
class br extends w {
|
|
3605
3607
|
eventManager;
|
|
3606
3608
|
containers = [];
|
|
3607
3609
|
limitWarningLogged = !1;
|
|
@@ -3829,7 +3831,7 @@ class wr extends w {
|
|
|
3829
3831
|
e.isPrimary = t;
|
|
3830
3832
|
}
|
|
3831
3833
|
}
|
|
3832
|
-
class
|
|
3834
|
+
class Ar extends w {
|
|
3833
3835
|
eventManager;
|
|
3834
3836
|
trackedElements = /* @__PURE__ */ new Map();
|
|
3835
3837
|
observer = null;
|
|
@@ -3990,7 +3992,7 @@ class br extends w {
|
|
|
3990
3992
|
});
|
|
3991
3993
|
}
|
|
3992
3994
|
}
|
|
3993
|
-
class
|
|
3995
|
+
class Lr {
|
|
3994
3996
|
storage;
|
|
3995
3997
|
sessionStorageRef;
|
|
3996
3998
|
fallbackStorage = /* @__PURE__ */ new Map();
|
|
@@ -4273,7 +4275,7 @@ class Ar {
|
|
|
4273
4275
|
this.fallbackSessionStorage.delete(e);
|
|
4274
4276
|
}
|
|
4275
4277
|
}
|
|
4276
|
-
class
|
|
4278
|
+
class Mr extends w {
|
|
4277
4279
|
eventManager;
|
|
4278
4280
|
reportedByNav = /* @__PURE__ */ new Map();
|
|
4279
4281
|
navigationHistory = [];
|
|
@@ -4284,7 +4286,7 @@ class Lr extends w {
|
|
|
4284
4286
|
navigationCounter = 0;
|
|
4285
4287
|
// Counter for handling simultaneous navigations edge case
|
|
4286
4288
|
constructor(e) {
|
|
4287
|
-
super(), this.eventManager = e, this.vitalThresholds =
|
|
4289
|
+
super(), this.eventManager = e, this.vitalThresholds = Qe(ve);
|
|
4288
4290
|
}
|
|
4289
4291
|
/**
|
|
4290
4292
|
* Starts tracking Web Vitals and performance metrics.
|
|
@@ -4301,8 +4303,8 @@ class Lr extends w {
|
|
|
4301
4303
|
* @returns Promise that resolves when tracking is initialized
|
|
4302
4304
|
*/
|
|
4303
4305
|
async startTracking() {
|
|
4304
|
-
const e = this.get("config"), t = e?.webVitalsMode ??
|
|
4305
|
-
this.vitalThresholds =
|
|
4306
|
+
const e = this.get("config"), t = e?.webVitalsMode ?? ve;
|
|
4307
|
+
this.vitalThresholds = Qe(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
|
|
4306
4308
|
}
|
|
4307
4309
|
/**
|
|
4308
4310
|
* Stops tracking Web Vitals and cleans up resources.
|
|
@@ -4399,7 +4401,7 @@ class Lr extends w {
|
|
|
4399
4401
|
const t = e.getEntries();
|
|
4400
4402
|
for (const r of t) {
|
|
4401
4403
|
const n = Number(r.duration.toFixed(2)), i = Date.now();
|
|
4402
|
-
i - this.lastLongTaskSentAt >=
|
|
4404
|
+
i - this.lastLongTaskSentAt >= Qt && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
4403
4405
|
}
|
|
4404
4406
|
},
|
|
4405
4407
|
{ type: "longtask", buffered: !0 }
|
|
@@ -4415,7 +4417,7 @@ class Lr extends w {
|
|
|
4415
4417
|
return;
|
|
4416
4418
|
if (r)
|
|
4417
4419
|
r.add(e.type);
|
|
4418
|
-
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length >
|
|
4420
|
+
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Kt) {
|
|
4419
4421
|
const i = this.navigationHistory.shift();
|
|
4420
4422
|
i && this.reportedByNav.delete(i);
|
|
4421
4423
|
}
|
|
@@ -4506,7 +4508,7 @@ class Lr extends w {
|
|
|
4506
4508
|
return !(typeof r == "number" && t <= r);
|
|
4507
4509
|
}
|
|
4508
4510
|
}
|
|
4509
|
-
class
|
|
4511
|
+
class ie extends w {
|
|
4510
4512
|
eventManager;
|
|
4511
4513
|
recentErrors = /* @__PURE__ */ new Map();
|
|
4512
4514
|
errorBurstCounter = 0;
|
|
@@ -4542,14 +4544,14 @@ class Mr extends w {
|
|
|
4542
4544
|
const e = Date.now();
|
|
4543
4545
|
if (e < this.burstBackoffUntil)
|
|
4544
4546
|
return !1;
|
|
4545
|
-
if (e - this.burstWindowStart >
|
|
4546
|
-
return this.burstBackoffUntil = e +
|
|
4547
|
+
if (e - this.burstWindowStart > Xt && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Gt)
|
|
4548
|
+
return this.burstBackoffUntil = e + je, a("debug", "Error burst detected - entering cooldown", {
|
|
4547
4549
|
data: {
|
|
4548
4550
|
errorsInWindow: this.errorBurstCounter,
|
|
4549
|
-
cooldownMs:
|
|
4551
|
+
cooldownMs: je
|
|
4550
4552
|
}
|
|
4551
4553
|
}), !1;
|
|
4552
|
-
const r = this.get("config")
|
|
4554
|
+
const r = this.get("config").errorSampling ?? at;
|
|
4553
4555
|
return Math.random() < r;
|
|
4554
4556
|
}
|
|
4555
4557
|
handleError = (e) => {
|
|
@@ -4577,7 +4579,7 @@ class Mr extends w {
|
|
|
4577
4579
|
const t = this.extractRejectionMessage(e.reason), r = this.sanitize(t);
|
|
4578
4580
|
if (this.shouldSuppressError(W.PROMISE_REJECTION, r))
|
|
4579
4581
|
return;
|
|
4580
|
-
const n = e.reason instanceof Error && e.reason.stack
|
|
4582
|
+
const n = e.reason instanceof Error && typeof e.reason.stack == "string" ? this.truncateStack(e.reason.stack) : void 0;
|
|
4581
4583
|
this.eventManager.track({
|
|
4582
4584
|
type: d.ERROR,
|
|
4583
4585
|
error_data: {
|
|
@@ -4591,7 +4593,7 @@ class Mr extends w {
|
|
|
4591
4593
|
if (e == null) return "Unknown rejection";
|
|
4592
4594
|
if (typeof e == "string") return e;
|
|
4593
4595
|
if (e instanceof Error)
|
|
4594
|
-
return e.
|
|
4596
|
+
return e.message;
|
|
4595
4597
|
if (typeof e == "object" && "message" in e)
|
|
4596
4598
|
return String(e.message);
|
|
4597
4599
|
try {
|
|
@@ -4601,12 +4603,12 @@ class Mr extends w {
|
|
|
4601
4603
|
}
|
|
4602
4604
|
}
|
|
4603
4605
|
sanitize(e) {
|
|
4604
|
-
const t = e.length >
|
|
4606
|
+
const t = e.length > We ? e.slice(0, We) + "..." : e;
|
|
4605
4607
|
return this.sanitizePii(t);
|
|
4606
4608
|
}
|
|
4607
4609
|
sanitizePii(e) {
|
|
4608
4610
|
let t = e;
|
|
4609
|
-
for (const r of
|
|
4611
|
+
for (const r of ot) {
|
|
4610
4612
|
const n = new RegExp(r.source, r.flags);
|
|
4611
4613
|
t = t.replace(n, "[REDACTED]");
|
|
4612
4614
|
}
|
|
@@ -4614,12 +4616,14 @@ class Mr extends w {
|
|
|
4614
4616
|
}
|
|
4615
4617
|
shouldSuppressError(e, t) {
|
|
4616
4618
|
const r = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
4617
|
-
return i !== void 0 && r - i < Ge ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size >
|
|
4619
|
+
return i !== void 0 && r - i < Ge ? (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 > te && this.pruneOldErrors(), !1));
|
|
4618
4620
|
}
|
|
4619
|
-
|
|
4620
|
-
const t = e.length <= We ? e : e.slice(0, We) + `
|
|
4621
|
+
static TRUNCATION_SUFFIX = `
|
|
4621
4622
|
...truncated`;
|
|
4622
|
-
|
|
4623
|
+
truncateStack(e) {
|
|
4624
|
+
if (e.length <= Xe) return this.sanitizePii(e);
|
|
4625
|
+
const t = Xe - ie.TRUNCATION_SUFFIX.length, r = e.slice(0, t) + ie.TRUNCATION_SUFFIX;
|
|
4626
|
+
return this.sanitizePii(r);
|
|
4623
4627
|
}
|
|
4624
4628
|
pruneOldErrors() {
|
|
4625
4629
|
const e = Date.now();
|
|
@@ -4638,7 +4642,7 @@ class Cr extends w {
|
|
|
4638
4642
|
isInitialized = !1;
|
|
4639
4643
|
suppressNextScrollTimer = null;
|
|
4640
4644
|
pageUnloadHandler = null;
|
|
4641
|
-
emitter = new
|
|
4645
|
+
emitter = new mr();
|
|
4642
4646
|
transformers = {};
|
|
4643
4647
|
customHeadersProvider;
|
|
4644
4648
|
managers = {};
|
|
@@ -4656,11 +4660,11 @@ class Cr extends w {
|
|
|
4656
4660
|
async init(e = {}) {
|
|
4657
4661
|
if (this.isInitialized)
|
|
4658
4662
|
return { sessionId: this.get("sessionId") ?? "" };
|
|
4659
|
-
this.managers.storage = new
|
|
4663
|
+
this.managers.storage = new Lr();
|
|
4660
4664
|
try {
|
|
4661
4665
|
this.setupState(e);
|
|
4662
4666
|
const t = e.integrations?.custom?.headers ?? {}, r = e.integrations?.custom?.fetchCredentials ?? "include";
|
|
4663
|
-
return this.managers.event = new
|
|
4667
|
+
return this.managers.event = new pr(
|
|
4664
4668
|
this.managers.storage,
|
|
4665
4669
|
this.emitter,
|
|
4666
4670
|
this.transformers,
|
|
@@ -4690,7 +4694,7 @@ class Cr extends w {
|
|
|
4690
4694
|
}
|
|
4691
4695
|
let r = t;
|
|
4692
4696
|
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
4693
|
-
const { valid: n, error: i, sanitizedMetadata: o } =
|
|
4697
|
+
const { valid: n, error: i, sanitizedMetadata: o } = fr(e, r);
|
|
4694
4698
|
if (!n) {
|
|
4695
4699
|
if (this.get("mode") === se.QA)
|
|
4696
4700
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
|
|
@@ -4760,14 +4764,14 @@ class Cr extends w {
|
|
|
4760
4764
|
}
|
|
4761
4765
|
setupState(e = {}) {
|
|
4762
4766
|
this.set("config", e);
|
|
4763
|
-
const t =
|
|
4767
|
+
const t = Tr.getId(this.managers.storage);
|
|
4764
4768
|
this.set("userId", t);
|
|
4765
|
-
const r =
|
|
4769
|
+
const r = ir(e);
|
|
4766
4770
|
this.set("collectApiUrls", r);
|
|
4767
|
-
const n =
|
|
4771
|
+
const n = Bt();
|
|
4768
4772
|
this.set("device", n);
|
|
4769
|
-
const i =
|
|
4770
|
-
this.set("pageUrl", i),
|
|
4773
|
+
const i = _e(window.location.href, e.sensitiveQueryParams);
|
|
4774
|
+
this.set("pageUrl", i), Zt() && this.set("mode", se.QA);
|
|
4771
4775
|
}
|
|
4772
4776
|
/**
|
|
4773
4777
|
* Returns the current configuration object.
|
|
@@ -4818,7 +4822,7 @@ class Cr extends w {
|
|
|
4818
4822
|
valid: !1,
|
|
4819
4823
|
error: "Global metadata must be a plain object"
|
|
4820
4824
|
};
|
|
4821
|
-
const t =
|
|
4825
|
+
const t = ht("Global", e, "globalMetadata");
|
|
4822
4826
|
return t.valid ? { valid: !0 } : {
|
|
4823
4827
|
valid: !1,
|
|
4824
4828
|
error: t.error
|
|
@@ -4885,7 +4889,7 @@ class Cr extends w {
|
|
|
4885
4889
|
a("warn", "identify() userId exceeds 256 characters", { data: { length: e.trim().length } });
|
|
4886
4890
|
return;
|
|
4887
4891
|
}
|
|
4888
|
-
const r = e.trim(), n =
|
|
4892
|
+
const r = e.trim(), n = dt(t), i = {
|
|
4889
4893
|
userId: r,
|
|
4890
4894
|
...n ? { traits: n } : {}
|
|
4891
4895
|
};
|
|
@@ -4904,8 +4908,8 @@ class Cr extends w {
|
|
|
4904
4908
|
*/
|
|
4905
4909
|
async resetIdentity() {
|
|
4906
4910
|
await this.managers.event?.flushImmediately(), this.set("identity", void 0), this.clearPersistedIdentity();
|
|
4907
|
-
const e =
|
|
4908
|
-
this.managers.storage.setItem(
|
|
4911
|
+
const e = ct();
|
|
4912
|
+
this.managers.storage.setItem(Se, e), this.set("userId", e), this.set("hasStartSession", !1), this.set("sessionId", null), this.handlers.session?.stopTracking(), this.handlers.session?.startTracking(), a("debug", "Identity reset, new UUID generated");
|
|
4909
4913
|
}
|
|
4910
4914
|
/**
|
|
4911
4915
|
* Returns the project ID used for identity storage scoping.
|
|
@@ -4919,7 +4923,7 @@ class Cr extends w {
|
|
|
4919
4923
|
*/
|
|
4920
4924
|
persistIdentity(e) {
|
|
4921
4925
|
try {
|
|
4922
|
-
const t = this.getProjectId(), r =
|
|
4926
|
+
const t = this.getProjectId(), r = de(t);
|
|
4923
4927
|
this.managers.storage.setItem(r, JSON.stringify(e));
|
|
4924
4928
|
} catch {
|
|
4925
4929
|
a("debug", "Failed to persist identity to localStorage");
|
|
@@ -4930,7 +4934,7 @@ class Cr extends w {
|
|
|
4930
4934
|
* Also migrates pending identity (set before init) to the project-scoped key.
|
|
4931
4935
|
*/
|
|
4932
4936
|
loadPersistedIdentity() {
|
|
4933
|
-
const e = this.managers.storage, t = this.getProjectId(), r =
|
|
4937
|
+
const e = this.managers.storage, t = this.getProjectId(), r = de(t);
|
|
4934
4938
|
try {
|
|
4935
4939
|
const n = e.getItem(H);
|
|
4936
4940
|
if (n) {
|
|
@@ -4982,7 +4986,7 @@ class Cr extends w {
|
|
|
4982
4986
|
clearPersistedIdentity() {
|
|
4983
4987
|
try {
|
|
4984
4988
|
const e = this.managers.storage, t = this.getProjectId();
|
|
4985
|
-
e.removeItem(
|
|
4989
|
+
e.removeItem(de(t)), e.removeItem(H);
|
|
4986
4990
|
} catch {
|
|
4987
4991
|
a("debug", "Failed to clear persisted identity");
|
|
4988
4992
|
}
|
|
@@ -4994,7 +4998,7 @@ class Cr extends w {
|
|
|
4994
4998
|
}
|
|
4995
4999
|
initializeHandlers() {
|
|
4996
5000
|
const e = this.get("config");
|
|
4997
|
-
this.handlers.session = new
|
|
5001
|
+
this.handlers.session = new _r(
|
|
4998
5002
|
this.managers.storage,
|
|
4999
5003
|
this.managers.event
|
|
5000
5004
|
), this.handlers.session.startTracking();
|
|
@@ -5003,16 +5007,16 @@ class Cr extends w {
|
|
|
5003
5007
|
this.set("suppressNextScroll", !1);
|
|
5004
5008
|
}, 500);
|
|
5005
5009
|
};
|
|
5006
|
-
this.handlers.pageView = new
|
|
5010
|
+
this.handlers.pageView = new yr(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new wr(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new br(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new Mr(this.managers.event), this.handlers.performance.startTracking().catch((r) => {
|
|
5007
5011
|
a("warn", "Failed to start performance tracking", { error: r });
|
|
5008
|
-
}), this.handlers.error = new
|
|
5012
|
+
}), this.handlers.error = new ie(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new Ar(this.managers.event), this.handlers.viewport.startTracking());
|
|
5009
5013
|
}
|
|
5010
5014
|
}
|
|
5011
5015
|
const k = [], M = [];
|
|
5012
5016
|
let D = null, h = null, R = !1, p = !1, P = null;
|
|
5013
5017
|
const Rr = async (s) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (p = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : h ? { sessionId: h.getSessionId() ?? "" } : (R && P || (R = !0, P = (async () => {
|
|
5014
5018
|
try {
|
|
5015
|
-
const e =
|
|
5019
|
+
const e = ur(s ?? {}), t = new Cr();
|
|
5016
5020
|
try {
|
|
5017
5021
|
k.forEach(({ event: o, callback: l }) => {
|
|
5018
5022
|
t.on(o, l);
|
|
@@ -5111,7 +5115,7 @@ const kr = (s) => {
|
|
|
5111
5115
|
throw new Error("[TraceLog] Cannot remove custom headers while TraceLog is being destroyed");
|
|
5112
5116
|
h.removeCustomHeaders();
|
|
5113
5117
|
}
|
|
5114
|
-
}, Hr = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null,
|
|
5118
|
+
}, Hr = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, Fr = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), xr = () => {
|
|
5115
5119
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5116
5120
|
if (p)
|
|
5117
5121
|
throw new Error("[TraceLog] Destroy operation already in progress");
|
|
@@ -5127,7 +5131,7 @@ const kr = (s) => {
|
|
|
5127
5131
|
}
|
|
5128
5132
|
}
|
|
5129
5133
|
}, $r = (s) => {
|
|
5130
|
-
typeof window > "u" || typeof document > "u" ||
|
|
5134
|
+
typeof window > "u" || typeof document > "u" || er(s);
|
|
5131
5135
|
}, Br = (s) => {
|
|
5132
5136
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5133
5137
|
if (!h)
|
|
@@ -5144,7 +5148,7 @@ const kr = (s) => {
|
|
|
5144
5148
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5145
5149
|
h.mergeGlobalMetadata(s);
|
|
5146
5150
|
}
|
|
5147
|
-
},
|
|
5151
|
+
}, Xr = (s, e) => {
|
|
5148
5152
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5149
5153
|
if (!s || typeof s != "string" || s.trim().length === 0) {
|
|
5150
5154
|
a("warn", "identify() called with invalid userId");
|
|
@@ -5163,7 +5167,7 @@ const kr = (s) => {
|
|
|
5163
5167
|
return;
|
|
5164
5168
|
}
|
|
5165
5169
|
try {
|
|
5166
|
-
const t =
|
|
5170
|
+
const t = dt(e), r = {
|
|
5167
5171
|
userId: s.trim(),
|
|
5168
5172
|
...t ? { traits: t } : {}
|
|
5169
5173
|
};
|
|
@@ -5172,7 +5176,7 @@ const kr = (s) => {
|
|
|
5172
5176
|
a("debug", "Failed to persist pre-init identity");
|
|
5173
5177
|
}
|
|
5174
5178
|
}
|
|
5175
|
-
},
|
|
5179
|
+
}, Gr = async () => {
|
|
5176
5180
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5177
5181
|
if (!h) {
|
|
5178
5182
|
try {
|
|
@@ -5195,28 +5199,28 @@ const kr = (s) => {
|
|
|
5195
5199
|
setCustomHeaders: Vr,
|
|
5196
5200
|
removeCustomHeaders: Ur,
|
|
5197
5201
|
isInitialized: Hr,
|
|
5198
|
-
getSessionId:
|
|
5199
|
-
destroy:
|
|
5202
|
+
getSessionId: Fr,
|
|
5203
|
+
destroy: xr,
|
|
5200
5204
|
setQaMode: $r,
|
|
5201
5205
|
updateGlobalMetadata: Br,
|
|
5202
5206
|
mergeGlobalMetadata: Wr,
|
|
5203
|
-
identify:
|
|
5204
|
-
resetIdentity:
|
|
5207
|
+
identify: Xr,
|
|
5208
|
+
resetIdentity: Gr
|
|
5205
5209
|
};
|
|
5206
|
-
var
|
|
5210
|
+
var be, C, j, gt, oe, Et = -1, V = function(s) {
|
|
5207
5211
|
addEventListener("pageshow", (function(e) {
|
|
5208
|
-
e.persisted && (
|
|
5212
|
+
e.persisted && (Et = e.timeStamp, s(e));
|
|
5209
5213
|
}), !0);
|
|
5210
|
-
},
|
|
5214
|
+
}, Oe = function() {
|
|
5211
5215
|
var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
5212
5216
|
if (s && s.responseStart > 0 && s.responseStart < performance.now()) return s;
|
|
5213
|
-
},
|
|
5214
|
-
var s =
|
|
5217
|
+
}, le = function() {
|
|
5218
|
+
var s = Oe();
|
|
5215
5219
|
return s && s.activationStart || 0;
|
|
5216
5220
|
}, _ = function(s, e) {
|
|
5217
|
-
var t =
|
|
5218
|
-
return
|
|
5219
|
-
},
|
|
5221
|
+
var t = Oe(), r = "navigate";
|
|
5222
|
+
return Et >= 0 ? r = "back-forward-cache" : t && (document.prerendering || le() > 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 };
|
|
5223
|
+
}, x = function(s, e, t) {
|
|
5220
5224
|
try {
|
|
5221
5225
|
if (PerformanceObserver.supportedEntryTypes.includes(s)) {
|
|
5222
5226
|
var r = new PerformanceObserver((function(n) {
|
|
@@ -5235,7 +5239,7 @@ var we, C, j, mt, ie, gt = -1, V = function(s) {
|
|
|
5235
5239
|
return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
|
|
5236
5240
|
})(e.value, t), s(e));
|
|
5237
5241
|
};
|
|
5238
|
-
},
|
|
5242
|
+
}, Pe = function(s) {
|
|
5239
5243
|
requestAnimationFrame((function() {
|
|
5240
5244
|
return requestAnimationFrame((function() {
|
|
5241
5245
|
return s();
|
|
@@ -5245,46 +5249,46 @@ var we, C, j, mt, ie, gt = -1, V = function(s) {
|
|
|
5245
5249
|
document.addEventListener("visibilitychange", (function() {
|
|
5246
5250
|
document.visibilityState === "hidden" && s();
|
|
5247
5251
|
}));
|
|
5248
|
-
},
|
|
5252
|
+
}, ce = function(s) {
|
|
5249
5253
|
var e = !1;
|
|
5250
5254
|
return function() {
|
|
5251
5255
|
e || (s(), e = !0);
|
|
5252
5256
|
};
|
|
5253
|
-
},
|
|
5257
|
+
}, F = -1, Ze = function() {
|
|
5254
5258
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
5255
|
-
},
|
|
5256
|
-
document.visibilityState === "hidden" &&
|
|
5257
|
-
},
|
|
5258
|
-
addEventListener("visibilitychange",
|
|
5259
|
+
}, ae = function(s) {
|
|
5260
|
+
document.visibilityState === "hidden" && F > -1 && (F = s.type === "visibilitychange" ? s.timeStamp : 0, jr());
|
|
5261
|
+
}, et = function() {
|
|
5262
|
+
addEventListener("visibilitychange", ae, !0), addEventListener("prerenderingchange", ae, !0);
|
|
5259
5263
|
}, jr = function() {
|
|
5260
|
-
removeEventListener("visibilitychange",
|
|
5261
|
-
},
|
|
5262
|
-
return
|
|
5264
|
+
removeEventListener("visibilitychange", ae, !0), removeEventListener("prerenderingchange", ae, !0);
|
|
5265
|
+
}, De = function() {
|
|
5266
|
+
return F < 0 && (F = Ze(), et(), V((function() {
|
|
5263
5267
|
setTimeout((function() {
|
|
5264
|
-
|
|
5268
|
+
F = Ze(), et();
|
|
5265
5269
|
}), 0);
|
|
5266
5270
|
}))), { get firstHiddenTime() {
|
|
5267
|
-
return
|
|
5271
|
+
return F;
|
|
5268
5272
|
} };
|
|
5269
5273
|
}, K = function(s) {
|
|
5270
5274
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
5271
5275
|
return s();
|
|
5272
5276
|
}), !0) : s();
|
|
5273
|
-
},
|
|
5277
|
+
}, Ae = [1800, 3e3], St = function(s, e) {
|
|
5274
5278
|
e = e || {}, K((function() {
|
|
5275
|
-
var t, r =
|
|
5279
|
+
var t, r = De(), n = _("FCP"), i = x("paint", (function(o) {
|
|
5276
5280
|
o.forEach((function(l) {
|
|
5277
|
-
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime -
|
|
5281
|
+
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime - le(), 0), n.entries.push(l), t(!0)));
|
|
5278
5282
|
}));
|
|
5279
5283
|
}));
|
|
5280
|
-
i && (t = y(s, n,
|
|
5281
|
-
n = _("FCP"), t = y(s, n,
|
|
5284
|
+
i && (t = y(s, n, Ae, e.reportAllChanges), V((function(o) {
|
|
5285
|
+
n = _("FCP"), t = y(s, n, Ae, e.reportAllChanges), Pe((function() {
|
|
5282
5286
|
n.value = performance.now() - o.timeStamp, t(!0);
|
|
5283
5287
|
}));
|
|
5284
5288
|
})));
|
|
5285
5289
|
}));
|
|
5286
|
-
},
|
|
5287
|
-
e = e || {},
|
|
5290
|
+
}, Le = [0.1, 0.25], zr = function(s, e) {
|
|
5291
|
+
e = e || {}, St(ce((function() {
|
|
5288
5292
|
var t, r = _("CLS", 0), n = 0, i = [], o = function(c) {
|
|
5289
5293
|
c.forEach((function(u) {
|
|
5290
5294
|
if (!u.hadRecentInput) {
|
|
@@ -5292,25 +5296,25 @@ var we, C, j, mt, ie, gt = -1, V = function(s) {
|
|
|
5292
5296
|
n && u.startTime - E.startTime < 1e3 && u.startTime - g.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
|
|
5293
5297
|
}
|
|
5294
5298
|
})), n > r.value && (r.value = n, r.entries = i, t());
|
|
5295
|
-
}, l =
|
|
5296
|
-
l && (t = y(s, r,
|
|
5299
|
+
}, l = x("layout-shift", o);
|
|
5300
|
+
l && (t = y(s, r, Le, e.reportAllChanges), Q((function() {
|
|
5297
5301
|
o(l.takeRecords()), t(!0);
|
|
5298
5302
|
})), V((function() {
|
|
5299
|
-
n = 0, r = _("CLS", 0), t = y(s, r,
|
|
5303
|
+
n = 0, r = _("CLS", 0), t = y(s, r, Le, e.reportAllChanges), Pe((function() {
|
|
5300
5304
|
return t();
|
|
5301
5305
|
}));
|
|
5302
5306
|
})), setTimeout(t, 0));
|
|
5303
5307
|
})));
|
|
5304
|
-
},
|
|
5308
|
+
}, pt = 0, ge = 1 / 0, Z = 0, Qr = function(s) {
|
|
5305
5309
|
s.forEach((function(e) {
|
|
5306
|
-
e.interactionId && (
|
|
5310
|
+
e.interactionId && (ge = Math.min(ge, e.interactionId), Z = Math.max(Z, e.interactionId), pt = Z ? (Z - ge) / 7 + 1 : 0);
|
|
5307
5311
|
}));
|
|
5308
|
-
},
|
|
5309
|
-
return
|
|
5312
|
+
}, Tt = function() {
|
|
5313
|
+
return be ? pt : performance.interactionCount || 0;
|
|
5310
5314
|
}, Kr = function() {
|
|
5311
|
-
"interactionCount" in performance ||
|
|
5312
|
-
}, A = [], re = /* @__PURE__ */ new Map(),
|
|
5313
|
-
var s = Math.min(A.length - 1, Math.floor((
|
|
5315
|
+
"interactionCount" in performance || be || (be = x("event", Qr, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
5316
|
+
}, A = [], re = /* @__PURE__ */ new Map(), It = 0, Yr = function() {
|
|
5317
|
+
var s = Math.min(A.length - 1, Math.floor((Tt() - It) / 50));
|
|
5314
5318
|
return A[s];
|
|
5315
5319
|
}, qr = [], Jr = function(s) {
|
|
5316
5320
|
if (qr.forEach((function(n) {
|
|
@@ -5330,50 +5334,50 @@ var we, C, j, mt, ie, gt = -1, V = function(s) {
|
|
|
5330
5334
|
}));
|
|
5331
5335
|
}
|
|
5332
5336
|
}
|
|
5333
|
-
},
|
|
5337
|
+
}, vt = function(s) {
|
|
5334
5338
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
5335
|
-
return s =
|
|
5336
|
-
},
|
|
5339
|
+
return s = ce(s), document.visibilityState === "hidden" ? s() : (t = e(s), Q(s)), t;
|
|
5340
|
+
}, Me = [200, 500], Zr = function(s, e) {
|
|
5337
5341
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, K((function() {
|
|
5338
5342
|
var t;
|
|
5339
5343
|
Kr();
|
|
5340
5344
|
var r, n = _("INP"), i = function(l) {
|
|
5341
|
-
|
|
5345
|
+
vt((function() {
|
|
5342
5346
|
l.forEach(Jr);
|
|
5343
5347
|
var c = Yr();
|
|
5344
5348
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, r());
|
|
5345
5349
|
}));
|
|
5346
|
-
}, o =
|
|
5347
|
-
r = y(s, n,
|
|
5350
|
+
}, o = x("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
5351
|
+
r = y(s, n, Me, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), Q((function() {
|
|
5348
5352
|
i(o.takeRecords()), r(!0);
|
|
5349
5353
|
})), V((function() {
|
|
5350
|
-
|
|
5354
|
+
It = Tt(), A.length = 0, re.clear(), n = _("INP"), r = y(s, n, Me, e.reportAllChanges);
|
|
5351
5355
|
})));
|
|
5352
5356
|
})));
|
|
5353
|
-
},
|
|
5357
|
+
}, Ce = [2500, 4e3], Ee = {}, es = function(s, e) {
|
|
5354
5358
|
e = e || {}, K((function() {
|
|
5355
|
-
var t, r =
|
|
5359
|
+
var t, r = De(), n = _("LCP"), i = function(c) {
|
|
5356
5360
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
5357
|
-
u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime -
|
|
5361
|
+
u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime - le(), 0), n.entries = [u], t());
|
|
5358
5362
|
}));
|
|
5359
|
-
}, o =
|
|
5363
|
+
}, o = x("largest-contentful-paint", i);
|
|
5360
5364
|
if (o) {
|
|
5361
|
-
t = y(s, n,
|
|
5362
|
-
var l =
|
|
5363
|
-
|
|
5365
|
+
t = y(s, n, Ce, e.reportAllChanges);
|
|
5366
|
+
var l = ce((function() {
|
|
5367
|
+
Ee[n.id] || (i(o.takeRecords()), o.disconnect(), Ee[n.id] = !0, t(!0));
|
|
5364
5368
|
}));
|
|
5365
5369
|
["keydown", "click"].forEach((function(c) {
|
|
5366
5370
|
addEventListener(c, (function() {
|
|
5367
|
-
return
|
|
5371
|
+
return vt(l);
|
|
5368
5372
|
}), { once: !0, capture: !0 });
|
|
5369
5373
|
})), Q(l), V((function(c) {
|
|
5370
|
-
n = _("LCP"), t = y(s, n,
|
|
5371
|
-
n.value = performance.now() - c.timeStamp,
|
|
5374
|
+
n = _("LCP"), t = y(s, n, Ce, e.reportAllChanges), Pe((function() {
|
|
5375
|
+
n.value = performance.now() - c.timeStamp, Ee[n.id] = !0, t(!0);
|
|
5372
5376
|
}));
|
|
5373
5377
|
}));
|
|
5374
5378
|
}
|
|
5375
5379
|
}));
|
|
5376
|
-
},
|
|
5380
|
+
}, Re = [800, 1800], ts = function s(e) {
|
|
5377
5381
|
document.prerendering ? K((function() {
|
|
5378
5382
|
return s(e);
|
|
5379
5383
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
@@ -5381,65 +5385,65 @@ var we, C, j, mt, ie, gt = -1, V = function(s) {
|
|
|
5381
5385
|
}), !0) : setTimeout(e, 0);
|
|
5382
5386
|
}, rs = function(s, e) {
|
|
5383
5387
|
e = e || {};
|
|
5384
|
-
var t = _("TTFB"), r = y(s, t,
|
|
5388
|
+
var t = _("TTFB"), r = y(s, t, Re, e.reportAllChanges);
|
|
5385
5389
|
ts((function() {
|
|
5386
|
-
var n =
|
|
5387
|
-
n && (t.value = Math.max(n.responseStart -
|
|
5388
|
-
t = _("TTFB", 0), (r = y(s, t,
|
|
5390
|
+
var n = Oe();
|
|
5391
|
+
n && (t.value = Math.max(n.responseStart - le(), 0), t.entries = [n], r(!0), V((function() {
|
|
5392
|
+
t = _("TTFB", 0), (r = y(s, t, Re, e.reportAllChanges))(!0);
|
|
5389
5393
|
})));
|
|
5390
5394
|
}));
|
|
5391
|
-
},
|
|
5392
|
-
C || (C = e, j = s,
|
|
5393
|
-
},
|
|
5394
|
-
if (j >= 0 && j <
|
|
5395
|
+
}, X = { passive: !0, capture: !0 }, ss = /* @__PURE__ */ new Date(), tt = function(s, e) {
|
|
5396
|
+
C || (C = e, j = s, gt = /* @__PURE__ */ new Date(), yt(removeEventListener), _t());
|
|
5397
|
+
}, _t = function() {
|
|
5398
|
+
if (j >= 0 && j < gt - ss) {
|
|
5395
5399
|
var s = { entryType: "first-input", name: C.type, target: C.target, cancelable: C.cancelable, startTime: C.timeStamp, processingStart: C.timeStamp + j };
|
|
5396
|
-
|
|
5400
|
+
oe.forEach((function(e) {
|
|
5397
5401
|
e(s);
|
|
5398
|
-
})),
|
|
5402
|
+
})), oe = [];
|
|
5399
5403
|
}
|
|
5400
5404
|
}, ns = function(s) {
|
|
5401
5405
|
if (s.cancelable) {
|
|
5402
5406
|
var e = (s.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - s.timeStamp;
|
|
5403
5407
|
s.type == "pointerdown" ? (function(t, r) {
|
|
5404
5408
|
var n = function() {
|
|
5405
|
-
|
|
5409
|
+
tt(t, r), o();
|
|
5406
5410
|
}, i = function() {
|
|
5407
5411
|
o();
|
|
5408
5412
|
}, o = function() {
|
|
5409
|
-
removeEventListener("pointerup", n,
|
|
5413
|
+
removeEventListener("pointerup", n, X), removeEventListener("pointercancel", i, X);
|
|
5410
5414
|
};
|
|
5411
|
-
addEventListener("pointerup", n,
|
|
5412
|
-
})(e, s) :
|
|
5415
|
+
addEventListener("pointerup", n, X), addEventListener("pointercancel", i, X);
|
|
5416
|
+
})(e, s) : tt(e, s);
|
|
5413
5417
|
}
|
|
5414
|
-
},
|
|
5418
|
+
}, yt = function(s) {
|
|
5415
5419
|
["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
|
|
5416
|
-
return s(e, ns,
|
|
5420
|
+
return s(e, ns, X);
|
|
5417
5421
|
}));
|
|
5418
|
-
},
|
|
5422
|
+
}, Ne = [100, 300], is = function(s, e) {
|
|
5419
5423
|
e = e || {}, K((function() {
|
|
5420
|
-
var t, r =
|
|
5424
|
+
var t, r = De(), n = _("FID"), i = function(c) {
|
|
5421
5425
|
c.startTime < r.firstHiddenTime && (n.value = c.processingStart - c.startTime, n.entries.push(c), t(!0));
|
|
5422
5426
|
}, o = function(c) {
|
|
5423
5427
|
c.forEach(i);
|
|
5424
|
-
}, l =
|
|
5425
|
-
t = y(s, n,
|
|
5428
|
+
}, l = x("first-input", o);
|
|
5429
|
+
t = y(s, n, Ne, e.reportAllChanges), l && (Q(ce((function() {
|
|
5426
5430
|
o(l.takeRecords()), l.disconnect();
|
|
5427
5431
|
}))), V((function() {
|
|
5428
5432
|
var c;
|
|
5429
|
-
n = _("FID"), t = y(s, n,
|
|
5433
|
+
n = _("FID"), t = y(s, n, Ne, e.reportAllChanges), oe = [], j = -1, C = null, yt(addEventListener), c = i, oe.push(c), _t();
|
|
5430
5434
|
})));
|
|
5431
5435
|
}));
|
|
5432
5436
|
};
|
|
5433
5437
|
const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5434
5438
|
__proto__: null,
|
|
5435
|
-
CLSThresholds:
|
|
5436
|
-
FCPThresholds:
|
|
5437
|
-
FIDThresholds:
|
|
5438
|
-
INPThresholds:
|
|
5439
|
-
LCPThresholds:
|
|
5440
|
-
TTFBThresholds:
|
|
5439
|
+
CLSThresholds: Le,
|
|
5440
|
+
FCPThresholds: Ae,
|
|
5441
|
+
FIDThresholds: Ne,
|
|
5442
|
+
INPThresholds: Me,
|
|
5443
|
+
LCPThresholds: Ce,
|
|
5444
|
+
TTFBThresholds: Re,
|
|
5441
5445
|
onCLS: zr,
|
|
5442
|
-
onFCP:
|
|
5446
|
+
onFCP: St,
|
|
5443
5447
|
onFID: is,
|
|
5444
5448
|
onINP: Zr,
|
|
5445
5449
|
onLCP: es,
|
|
@@ -5448,9 +5452,9 @@ const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5448
5452
|
export {
|
|
5449
5453
|
f as AppConfigValidationError,
|
|
5450
5454
|
as as DEFAULT_SESSION_TIMEOUT,
|
|
5451
|
-
|
|
5455
|
+
ve as DEFAULT_WEB_VITALS_MODE,
|
|
5452
5456
|
L as DeviceType,
|
|
5453
|
-
|
|
5457
|
+
pe as EmitterEvent,
|
|
5454
5458
|
W as ErrorType,
|
|
5455
5459
|
d as EventType,
|
|
5456
5460
|
ps as InitializationTimeoutError,
|
|
@@ -5464,18 +5468,18 @@ export {
|
|
|
5464
5468
|
fs as MAX_STRING_LENGTH,
|
|
5465
5469
|
ms as MAX_STRING_LENGTH_IN_ARRAY,
|
|
5466
5470
|
se as Mode,
|
|
5467
|
-
|
|
5471
|
+
ot as PII_PATTERNS,
|
|
5468
5472
|
N as PermanentError,
|
|
5469
|
-
|
|
5473
|
+
Be as SamplingRateValidationError,
|
|
5470
5474
|
ee as ScrollDirection,
|
|
5471
|
-
|
|
5475
|
+
Nt as SessionTimeoutValidationError,
|
|
5472
5476
|
B as SpecialApiUrl,
|
|
5473
5477
|
O as TimeoutError,
|
|
5474
5478
|
z as TraceLogValidationError,
|
|
5475
5479
|
Ts as WEB_VITALS_GOOD_THRESHOLDS,
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5480
|
+
ze as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
5481
|
+
zt as WEB_VITALS_POOR_THRESHOLDS,
|
|
5482
|
+
Qe as getWebVitalsThresholds,
|
|
5479
5483
|
Es as isPrimaryScrollEvent,
|
|
5480
5484
|
Ss as isSecondaryScrollEvent,
|
|
5481
5485
|
Is as tracelog
|