@tracelog/lib 2.6.2-rc.94.6 → 2.6.2-rc.94.7
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 +221 -213
- 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 -2
- package/dist/public-api.cjs.map +1 -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
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const b = "data-tlog",
|
|
1
|
+
const os = 9e5;
|
|
2
|
+
const as = 120, ls = 8192, cs = 10, us = 10, ds = 20;
|
|
3
|
+
const hs = 1e3, fs = 500, ms = 100;
|
|
4
|
+
const b = "data-tlog", _t = [
|
|
5
5
|
"button",
|
|
6
6
|
"a",
|
|
7
7
|
'input[type="button"]',
|
|
@@ -33,7 +33,7 @@ const b = "data-tlog", vt = [
|
|
|
33
33
|
".menu-item",
|
|
34
34
|
"[data-testid]",
|
|
35
35
|
'[tabindex="0"]'
|
|
36
|
-
],
|
|
36
|
+
], yt = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], wt = [
|
|
37
37
|
"token",
|
|
38
38
|
"auth",
|
|
39
39
|
"key",
|
|
@@ -72,14 +72,14 @@ 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
|
+
}, bt = [
|
|
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", X = `${I}:qa_mode`, Ee = `${I}:uid`, et = "tlog_mode", Ve = "qa", ke = "qa_off",
|
|
82
|
+
], I = "tlog", X = `${I}:qa_mode`, Ee = `${I}:uid`, et = "tlog_mode", Ve = "qa", ke = "qa_off", At = (s) => s ? `${I}:${s}:queue` : `${I}:queue`, Lt = (s) => s ? `${I}:${s}:session` : `${I}:session`, Mt = (s) => s ? `${I}:${s}:broadcast` : `${I}:broadcast`, Ue = (s, e) => `${I}:${s}:session_counts:${e}`, He = 10080 * 60 * 1e3, xe = `${I}:session_counts_last_cleanup`, Fe = 3600 * 1e3, ue = (s) => s ? `${I}:${s}:identity` : `${I}:identity`, H = `${I}:pending_identity`;
|
|
83
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 || {}), Se = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(Se || {});
|
|
84
84
|
class N extends Error {
|
|
85
85
|
constructor(e, t) {
|
|
@@ -92,7 +92,7 @@ class O extends Error {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
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 || {}), ee = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(ee || {}), W = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(W || {}), se = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(se || {});
|
|
95
|
-
const
|
|
95
|
+
const gs = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !0, Es = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !1;
|
|
96
96
|
class Q extends Error {
|
|
97
97
|
constructor(e, t, r) {
|
|
98
98
|
super(e), this.errorCode = t, this.layer = r, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
@@ -103,7 +103,7 @@ class f extends Q {
|
|
|
103
103
|
super(e, "APP_CONFIG_INVALID", t);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
class
|
|
106
|
+
class Ct extends Q {
|
|
107
107
|
constructor(e, t = "config") {
|
|
108
108
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
109
109
|
}
|
|
@@ -118,12 +118,12 @@ class U extends Q {
|
|
|
118
118
|
super(e, "INTEGRATION_INVALID", t);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
class
|
|
121
|
+
class Ss extends Q {
|
|
122
122
|
constructor(e, t, r = "runtime") {
|
|
123
123
|
super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
const tt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", rt = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;",
|
|
126
|
+
const tt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", rt = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Rt = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Nt = (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,7 +142,7 @@ const tt = "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
|
+
}, Ot = () => {
|
|
146
146
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
147
147
|
return !1;
|
|
148
148
|
try {
|
|
@@ -151,12 +151,12 @@ const tt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
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 ? Nt(e, r) : `[TraceLog] ${e}`, u = s === "error" ? "error" : s === "warn" ? "warn" : "log";
|
|
155
|
+
if (!Pt(l, i))
|
|
156
156
|
return;
|
|
157
|
-
const E =
|
|
158
|
-
|
|
159
|
-
},
|
|
157
|
+
const E = Dt(l, o), T = n !== void 0 ? pe(n) : void 0;
|
|
158
|
+
Vt(u, c, E, T);
|
|
159
|
+
}, Pt = (s, e) => s === "critical" ? !0 : s === "qa" || e ? Ot() : !1, Dt = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? Rt : "", Vt = (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
|
}, pe = (s) => {
|
|
@@ -174,9 +174,9 @@ const tt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
174
174
|
return e;
|
|
175
175
|
};
|
|
176
176
|
let Te, st;
|
|
177
|
-
const
|
|
177
|
+
const kt = () => {
|
|
178
178
|
typeof window < "u" && !Te && (Te = window.matchMedia("(pointer: coarse)"), st = window.matchMedia("(hover: none)"));
|
|
179
|
-
}, ne = "Unknown",
|
|
179
|
+
}, ne = "Unknown", Ut = (s) => {
|
|
180
180
|
const e = s.userAgentData?.platform;
|
|
181
181
|
if (e != null && e !== "") {
|
|
182
182
|
if (/windows/i.test(e)) return "Windows";
|
|
@@ -188,7 +188,7 @@ const Vt = () => {
|
|
|
188
188
|
}
|
|
189
189
|
const t = navigator.userAgent;
|
|
190
190
|
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" : ne;
|
|
191
|
-
},
|
|
191
|
+
}, Ht = (s) => {
|
|
192
192
|
const e = s.userAgentData?.brands;
|
|
193
193
|
if (e != null && e.length > 0) {
|
|
194
194
|
const n = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
|
|
@@ -199,26 +199,26 @@ const Vt = () => {
|
|
|
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
|
+
}, xt = () => {
|
|
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
|
-
|
|
209
|
+
kt();
|
|
210
210
|
const e = window.innerWidth, t = Te?.matches ?? !1, r = st?.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
|
+
}, Ft = () => {
|
|
216
216
|
try {
|
|
217
217
|
const s = navigator;
|
|
218
218
|
return {
|
|
219
|
-
type:
|
|
220
|
-
os:
|
|
221
|
-
browser:
|
|
219
|
+
type: xt(),
|
|
220
|
+
os: Ut(s),
|
|
221
|
+
browser: Ht(s)
|
|
222
222
|
};
|
|
223
223
|
} catch (s) {
|
|
224
224
|
return a("debug", "Device info detection failed, using defaults", { error: s }), {
|
|
@@ -242,7 +242,7 @@ const Vt = () => {
|
|
|
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
244
|
/:\/\/[^:/]+:([^@]+)@/gi
|
|
245
|
-
], Be = 500, We = 5e3, te = 50,
|
|
245
|
+
], Be = 500, We = 5e3, te = 50, $t = te * 2, it = 1, Bt = 1e3, Wt = 10, Ge = 5e3, Gt = 6e4, ps = {
|
|
246
246
|
LCP: 2500,
|
|
247
247
|
// Good: ≤ 2.5s
|
|
248
248
|
FCP: 1800,
|
|
@@ -266,7 +266,7 @@ const Vt = () => {
|
|
|
266
266
|
TTFB: 800,
|
|
267
267
|
// Needs improvement: > 800ms
|
|
268
268
|
LONG_TASK: 50
|
|
269
|
-
},
|
|
269
|
+
}, Xt = {
|
|
270
270
|
LCP: 4e3,
|
|
271
271
|
// Poor: > 4s
|
|
272
272
|
FCP: 3e3,
|
|
@@ -286,11 +286,11 @@ const Vt = () => {
|
|
|
286
286
|
case "needs-improvement":
|
|
287
287
|
return Xe;
|
|
288
288
|
case "poor":
|
|
289
|
-
return
|
|
289
|
+
return Xt;
|
|
290
290
|
default:
|
|
291
291
|
return Xe;
|
|
292
292
|
}
|
|
293
|
-
},
|
|
293
|
+
}, jt = 1e3, Qt = 50, zt = "2.6.2", Kt = zt, ot = () => typeof window < "u" && typeof sessionStorage < "u", Yt = () => {
|
|
294
294
|
try {
|
|
295
295
|
const s = new URLSearchParams(window.location.search);
|
|
296
296
|
s.delete(et);
|
|
@@ -298,7 +298,7 @@ const Vt = () => {
|
|
|
298
298
|
window.history.replaceState({}, "", t);
|
|
299
299
|
} catch {
|
|
300
300
|
}
|
|
301
|
-
},
|
|
301
|
+
}, qt = () => {
|
|
302
302
|
if (!ot())
|
|
303
303
|
return !1;
|
|
304
304
|
try {
|
|
@@ -310,11 +310,11 @@ const Vt = () => {
|
|
|
310
310
|
})) : e === ke && (r = !1, sessionStorage.setItem(X, "false"), a("info", "QA Mode DISABLED", {
|
|
311
311
|
visibility: "qa",
|
|
312
312
|
style: rt
|
|
313
|
-
})), (e === Ve || e === ke) &&
|
|
313
|
+
})), (e === Ve || e === ke) && Yt(), r ?? t === "true";
|
|
314
314
|
} catch {
|
|
315
315
|
return !1;
|
|
316
316
|
}
|
|
317
|
-
},
|
|
317
|
+
}, Jt = (s) => {
|
|
318
318
|
if (ot())
|
|
319
319
|
try {
|
|
320
320
|
sessionStorage.setItem(X, s ? "true" : "false"), a("info", s ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
@@ -324,7 +324,7 @@ const Vt = () => {
|
|
|
324
324
|
} catch {
|
|
325
325
|
a("debug", "Cannot set QA mode: sessionStorage unavailable");
|
|
326
326
|
}
|
|
327
|
-
},
|
|
327
|
+
}, Zt = [
|
|
328
328
|
"co.uk",
|
|
329
329
|
"org.uk",
|
|
330
330
|
"com.au",
|
|
@@ -341,20 +341,20 @@ const Vt = () => {
|
|
|
341
341
|
if (e.length <= 2)
|
|
342
342
|
return s.toLowerCase();
|
|
343
343
|
const t = e.slice(-2).join(".");
|
|
344
|
-
return
|
|
345
|
-
},
|
|
344
|
+
return Zt.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
345
|
+
}, er = (s, e) => s === e ? !0 : Qe(s) === Qe(e), de = () => {
|
|
346
346
|
const s = document.referrer;
|
|
347
347
|
if (!s)
|
|
348
348
|
return "Direct";
|
|
349
349
|
try {
|
|
350
350
|
const e = new URL(s).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
|
|
351
|
-
return
|
|
351
|
+
return er(e, t) ? "Direct" : s;
|
|
352
352
|
} catch (e) {
|
|
353
353
|
return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: s } }), s;
|
|
354
354
|
}
|
|
355
355
|
}, he = () => {
|
|
356
356
|
const s = new URLSearchParams(window.location.search), e = {};
|
|
357
|
-
return
|
|
357
|
+
return yt.forEach((r) => {
|
|
358
358
|
const n = s.get(r);
|
|
359
359
|
if (n) {
|
|
360
360
|
const i = r.split("utm_")[1];
|
|
@@ -366,7 +366,7 @@ const Vt = () => {
|
|
|
366
366
|
return (s === "x" ? e : e & 3 | 8).toString(16);
|
|
367
367
|
});
|
|
368
368
|
let q = 0, J = 0;
|
|
369
|
-
const
|
|
369
|
+
const tr = () => {
|
|
370
370
|
let s = Date.now();
|
|
371
371
|
s < J && (s = J), s === J ? q = (q + 1) % 1e3 : q = 0, J = s;
|
|
372
372
|
const e = q.toString().padStart(3, "0");
|
|
@@ -386,7 +386,7 @@ const er = () => {
|
|
|
386
386
|
} catch {
|
|
387
387
|
return !1;
|
|
388
388
|
}
|
|
389
|
-
},
|
|
389
|
+
}, rr = (s) => {
|
|
390
390
|
try {
|
|
391
391
|
const t = new URL(window.location.href).hostname;
|
|
392
392
|
if (!t || typeof t != "string")
|
|
@@ -410,9 +410,9 @@ const er = () => {
|
|
|
410
410
|
} catch (e) {
|
|
411
411
|
throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
|
|
412
412
|
}
|
|
413
|
-
},
|
|
413
|
+
}, sr = (s) => {
|
|
414
414
|
const e = {};
|
|
415
|
-
s.integrations?.tracelog?.projectId && (e.saas =
|
|
415
|
+
s.integrations?.tracelog?.projectId && (e.saas = rr(s.integrations.tracelog.projectId));
|
|
416
416
|
const t = s.integrations?.custom?.collectApiUrl;
|
|
417
417
|
if (t) {
|
|
418
418
|
const r = s.integrations?.custom?.allowHttp ?? !1;
|
|
@@ -425,7 +425,7 @@ const er = () => {
|
|
|
425
425
|
if (!s || typeof s != "string")
|
|
426
426
|
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof s } }), s || "";
|
|
427
427
|
try {
|
|
428
|
-
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...
|
|
428
|
+
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...wt, ...e])];
|
|
429
429
|
let i = !1;
|
|
430
430
|
const o = [];
|
|
431
431
|
return n.forEach((c) => {
|
|
@@ -440,7 +440,7 @@ const er = () => {
|
|
|
440
440
|
let e = s;
|
|
441
441
|
s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
|
|
442
442
|
let t = 0;
|
|
443
|
-
for (const n of
|
|
443
|
+
for (const n of bt) {
|
|
444
444
|
const i = e;
|
|
445
445
|
e = e.replace(n, ""), i !== e && t++;
|
|
446
446
|
}
|
|
@@ -475,7 +475,7 @@ const er = () => {
|
|
|
475
475
|
return t;
|
|
476
476
|
}
|
|
477
477
|
return null;
|
|
478
|
-
},
|
|
478
|
+
}, nr = (s) => {
|
|
479
479
|
if (typeof s != "object" || s === null)
|
|
480
480
|
return {};
|
|
481
481
|
try {
|
|
@@ -485,15 +485,15 @@ const er = () => {
|
|
|
485
485
|
const t = e instanceof Error ? e.message : String(e);
|
|
486
486
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
487
487
|
}
|
|
488
|
-
},
|
|
488
|
+
}, ir = (s) => {
|
|
489
489
|
if (s !== void 0 && (s === null || typeof s != "object"))
|
|
490
490
|
throw new f("Configuration must be an object", "config");
|
|
491
491
|
if (s) {
|
|
492
492
|
if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
|
|
493
|
-
throw new
|
|
493
|
+
throw new Ct(m.INVALID_SESSION_TIMEOUT, "config");
|
|
494
494
|
if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
|
|
495
495
|
throw new f(m.INVALID_GLOBAL_METADATA, "config");
|
|
496
|
-
if (s.integrations &&
|
|
496
|
+
if (s.integrations && ar(s.integrations), s.sensitiveQueryParams !== void 0) {
|
|
497
497
|
if (!Array.isArray(s.sensitiveQueryParams))
|
|
498
498
|
throw new f(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
499
499
|
for (const e of s.sensitiveQueryParams)
|
|
@@ -525,7 +525,7 @@ const er = () => {
|
|
|
525
525
|
throw new f(m.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
|
|
526
526
|
if (s.sendIntervalMs !== void 0 && (!Number.isFinite(s.sendIntervalMs) || s.sendIntervalMs < 1e3 || s.sendIntervalMs > 6e4))
|
|
527
527
|
throw new f(m.INVALID_SEND_INTERVAL, "config");
|
|
528
|
-
if (s.viewport !== void 0 &&
|
|
528
|
+
if (s.viewport !== void 0 && or(s.viewport), s.webVitalsMode !== void 0) {
|
|
529
529
|
if (typeof s.webVitalsMode != "string")
|
|
530
530
|
throw new f(
|
|
531
531
|
`Invalid webVitalsMode type: ${typeof s.webVitalsMode}. Must be a string`,
|
|
@@ -556,7 +556,7 @@ const er = () => {
|
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
},
|
|
559
|
+
}, or = (s) => {
|
|
560
560
|
if (typeof s != "object" || s === null)
|
|
561
561
|
throw new f(m.INVALID_VIEWPORT_CONFIG, "config");
|
|
562
562
|
if (!s.elements || !Array.isArray(s.elements))
|
|
@@ -586,7 +586,7 @@ const er = () => {
|
|
|
586
586
|
throw new f(m.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
587
587
|
if (s.maxTrackedElements !== void 0 && (typeof s.maxTrackedElements != "number" || s.maxTrackedElements <= 0))
|
|
588
588
|
throw new f(m.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
589
|
-
},
|
|
589
|
+
}, ar = (s) => {
|
|
590
590
|
if (s) {
|
|
591
591
|
if (s.tracelog && (!s.tracelog.projectId || typeof s.tracelog.projectId != "string" || s.tracelog.projectId.trim() === ""))
|
|
592
592
|
throw new U(m.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
@@ -607,8 +607,8 @@ const er = () => {
|
|
|
607
607
|
throw new U('fetchCredentials must be "include", "same-origin", or "omit"', "config");
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
},
|
|
611
|
-
|
|
610
|
+
}, lr = (s) => {
|
|
611
|
+
ir(s);
|
|
612
612
|
const e = {
|
|
613
613
|
...s ?? {},
|
|
614
614
|
sessionTimeout: s?.sessionTimeout ?? 9e5,
|
|
@@ -636,7 +636,13 @@ const er = () => {
|
|
|
636
636
|
return !0;
|
|
637
637
|
const t = typeof s;
|
|
638
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) => ye(r, e)) : t === "object" ? Object.values(s).every((r) => ye(r, e)) : !1);
|
|
639
|
-
},
|
|
639
|
+
}, cr = (s) => typeof s != "object" || s === null ? !1 : ye(s), ct = (s) => {
|
|
640
|
+
if (typeof s != "object" || s === null || Array.isArray(s)) return;
|
|
641
|
+
const e = {};
|
|
642
|
+
for (const [t, r] of Object.entries(s))
|
|
643
|
+
typeof r == "string" && (e[t] = r);
|
|
644
|
+
return Object.keys(e).length > 0 ? e : void 0;
|
|
645
|
+
}, ur = (s) => typeof s != "string" ? {
|
|
640
646
|
valid: !1,
|
|
641
647
|
error: "Event name must be a string"
|
|
642
648
|
} : s.length === 0 ? {
|
|
@@ -652,8 +658,8 @@ const er = () => {
|
|
|
652
658
|
valid: !1,
|
|
653
659
|
error: "Event name cannot be a reserved word"
|
|
654
660
|
} : { valid: !0 }, Ke = (s, e, t) => {
|
|
655
|
-
const r =
|
|
656
|
-
if (!
|
|
661
|
+
const r = nr(e), n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
662
|
+
if (!cr(r))
|
|
657
663
|
return {
|
|
658
664
|
valid: !1,
|
|
659
665
|
error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
|
|
@@ -701,7 +707,7 @@ const er = () => {
|
|
|
701
707
|
valid: !0,
|
|
702
708
|
sanitizedMetadata: r
|
|
703
709
|
};
|
|
704
|
-
},
|
|
710
|
+
}, ut = (s, e, t) => {
|
|
705
711
|
if (Array.isArray(e)) {
|
|
706
712
|
const r = [], n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
707
713
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -725,15 +731,15 @@ const er = () => {
|
|
|
725
731
|
};
|
|
726
732
|
}
|
|
727
733
|
return Ke(s, e, t);
|
|
728
|
-
},
|
|
729
|
-
const t =
|
|
734
|
+
}, dr = (s, e) => {
|
|
735
|
+
const t = ur(s);
|
|
730
736
|
if (!t.valid)
|
|
731
737
|
return a("error", "Event name validation failed", {
|
|
732
738
|
data: { eventName: s, error: t.error }
|
|
733
739
|
}), t;
|
|
734
740
|
if (!e)
|
|
735
741
|
return { valid: !0 };
|
|
736
|
-
const r =
|
|
742
|
+
const r = ut(s, e, "customEvent");
|
|
737
743
|
return r.valid || a("error", "Event metadata validation failed", {
|
|
738
744
|
data: {
|
|
739
745
|
eventName: s,
|
|
@@ -741,7 +747,7 @@ const er = () => {
|
|
|
741
747
|
}
|
|
742
748
|
}), r;
|
|
743
749
|
};
|
|
744
|
-
class
|
|
750
|
+
class hr {
|
|
745
751
|
listeners = /* @__PURE__ */ new Map();
|
|
746
752
|
/**
|
|
747
753
|
* Subscribes to an event channel
|
|
@@ -858,7 +864,7 @@ class dr {
|
|
|
858
864
|
this.listeners.clear();
|
|
859
865
|
}
|
|
860
866
|
}
|
|
861
|
-
function
|
|
867
|
+
function dt(s, e, t) {
|
|
862
868
|
try {
|
|
863
869
|
const r = e(s);
|
|
864
870
|
return r === null ? null : typeof r == "object" && r !== null && "type" in r ? r : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), s);
|
|
@@ -869,10 +875,10 @@ function ut(s, e, t) {
|
|
|
869
875
|
}), s;
|
|
870
876
|
}
|
|
871
877
|
}
|
|
872
|
-
function
|
|
873
|
-
return s.map((r) =>
|
|
878
|
+
function fr(s, e, t) {
|
|
879
|
+
return s.map((r) => dt(r, e, t)).filter((r) => r !== null);
|
|
874
880
|
}
|
|
875
|
-
function
|
|
881
|
+
function ht(s, e, t) {
|
|
876
882
|
try {
|
|
877
883
|
const r = e(s);
|
|
878
884
|
return r === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
|
|
@@ -1032,7 +1038,7 @@ class Ye extends w {
|
|
|
1032
1038
|
return { ...this.staticHeaders, ...e };
|
|
1033
1039
|
}
|
|
1034
1040
|
getQueueStorageKey() {
|
|
1035
|
-
const e = this.get("userId") || "anonymous", t =
|
|
1041
|
+
const e = this.get("userId") || "anonymous", t = At(e);
|
|
1036
1042
|
return this.integrationId ? `${t}:${this.integrationId}` : t;
|
|
1037
1043
|
}
|
|
1038
1044
|
/**
|
|
@@ -1262,7 +1268,7 @@ class Ye extends w {
|
|
|
1262
1268
|
const t = this.transformers.beforeSend;
|
|
1263
1269
|
if (!t)
|
|
1264
1270
|
return e;
|
|
1265
|
-
const r =
|
|
1271
|
+
const r = fr(
|
|
1266
1272
|
e.events,
|
|
1267
1273
|
t,
|
|
1268
1274
|
this.integrationId || "SenderManager"
|
|
@@ -1307,7 +1313,7 @@ class Ye extends w {
|
|
|
1307
1313
|
if (this.integrationId === "saas")
|
|
1308
1314
|
return e;
|
|
1309
1315
|
const t = this.transformers.beforeBatch;
|
|
1310
|
-
return t ?
|
|
1316
|
+
return t ? ht(e, t, this.integrationId || "SenderManager") : e;
|
|
1311
1317
|
}
|
|
1312
1318
|
/**
|
|
1313
1319
|
* Calculates exponential backoff delay with jitter for retry attempts.
|
|
@@ -1563,7 +1569,7 @@ class Ye extends w {
|
|
|
1563
1569
|
_metadata: {
|
|
1564
1570
|
referer: typeof window < "u" ? window.location.href : void 0,
|
|
1565
1571
|
timestamp: t,
|
|
1566
|
-
client_version:
|
|
1572
|
+
client_version: Kt
|
|
1567
1573
|
}
|
|
1568
1574
|
};
|
|
1569
1575
|
return {
|
|
@@ -1702,12 +1708,12 @@ class Ye extends w {
|
|
|
1702
1708
|
}
|
|
1703
1709
|
logPermanentError(e, t) {
|
|
1704
1710
|
const r = Date.now();
|
|
1705
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >=
|
|
1711
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >= Gt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1706
1712
|
data: { status: t.statusCode, message: t.message }
|
|
1707
1713
|
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: r });
|
|
1708
1714
|
}
|
|
1709
1715
|
}
|
|
1710
|
-
class
|
|
1716
|
+
class mr extends w {
|
|
1711
1717
|
bootTime;
|
|
1712
1718
|
bootTimestamp;
|
|
1713
1719
|
hasPerformanceNow;
|
|
@@ -1856,8 +1862,8 @@ class fr extends w {
|
|
|
1856
1862
|
};
|
|
1857
1863
|
}
|
|
1858
1864
|
}
|
|
1859
|
-
const
|
|
1860
|
-
class
|
|
1865
|
+
const gr = new Set(Object.values(d));
|
|
1866
|
+
class Er extends w {
|
|
1861
1867
|
dataSenders;
|
|
1862
1868
|
emitter;
|
|
1863
1869
|
transformers;
|
|
@@ -1896,7 +1902,7 @@ class gr extends w {
|
|
|
1896
1902
|
* @param fetchCredentials - Fetch credentials mode for custom backend. @default 'include'
|
|
1897
1903
|
*/
|
|
1898
1904
|
constructor(e, t = null, r = {}, n = {}, i, o = "include") {
|
|
1899
|
-
super(), this.emitter = t, this.transformers = r, this.timeManager = new
|
|
1905
|
+
super(), this.emitter = t, this.transformers = r, this.timeManager = new mr(), this.dataSenders = [];
|
|
1900
1906
|
const l = this.get("collectApiUrls");
|
|
1901
1907
|
l?.saas && this.dataSenders.push(new Ye(e, "saas", l.saas, r)), l?.custom && this.dataSenders.push(
|
|
1902
1908
|
new Ye(
|
|
@@ -2027,7 +2033,7 @@ class gr extends w {
|
|
|
2027
2033
|
a("error", "Event type is required - event will be ignored");
|
|
2028
2034
|
return;
|
|
2029
2035
|
}
|
|
2030
|
-
if (!
|
|
2036
|
+
if (!gr.has(e)) {
|
|
2031
2037
|
a("error", "Invalid event type - event will be ignored", {
|
|
2032
2038
|
data: { type: e }
|
|
2033
2039
|
});
|
|
@@ -2485,7 +2491,7 @@ class gr extends w {
|
|
|
2485
2491
|
};
|
|
2486
2492
|
const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
|
|
2487
2493
|
if (!o && l) {
|
|
2488
|
-
const c =
|
|
2494
|
+
const c = ht(n, l, "EventManager");
|
|
2489
2495
|
c !== null && (n = c);
|
|
2490
2496
|
}
|
|
2491
2497
|
return n;
|
|
@@ -2497,7 +2503,7 @@ class gr extends w {
|
|
|
2497
2503
|
});
|
|
2498
2504
|
const i = this.get("sessionReferrer"), o = this.get("sessionUtm");
|
|
2499
2505
|
let l = {
|
|
2500
|
-
id:
|
|
2506
|
+
id: tr(),
|
|
2501
2507
|
type: e.type,
|
|
2502
2508
|
page_url: t,
|
|
2503
2509
|
timestamp: r,
|
|
@@ -2514,7 +2520,7 @@ class gr extends w {
|
|
|
2514
2520
|
};
|
|
2515
2521
|
const c = this.get("collectApiUrls"), u = !!c?.custom, g = !!c?.saas, E = u || g, T = u && g, S = this.transformers.beforeSend;
|
|
2516
2522
|
if (S && (!E || u && !T)) {
|
|
2517
|
-
const Y =
|
|
2523
|
+
const Y = dt(l, S, "EventManager");
|
|
2518
2524
|
if (Y === null)
|
|
2519
2525
|
return null;
|
|
2520
2526
|
l = Y;
|
|
@@ -2817,7 +2823,7 @@ class gr extends w {
|
|
|
2817
2823
|
}
|
|
2818
2824
|
}
|
|
2819
2825
|
}
|
|
2820
|
-
class
|
|
2826
|
+
class Sr {
|
|
2821
2827
|
/**
|
|
2822
2828
|
* Gets or creates a unique user ID.
|
|
2823
2829
|
*
|
|
@@ -2842,8 +2848,8 @@ class Er {
|
|
|
2842
2848
|
return e.setItem(Ee, r), r;
|
|
2843
2849
|
}
|
|
2844
2850
|
}
|
|
2845
|
-
const
|
|
2846
|
-
class
|
|
2851
|
+
const pr = /^\d{13}-[a-z0-9]{9}$/;
|
|
2852
|
+
class Tr extends w {
|
|
2847
2853
|
storageManager;
|
|
2848
2854
|
eventManager;
|
|
2849
2855
|
projectId;
|
|
@@ -2869,7 +2875,7 @@ class pr extends w {
|
|
|
2869
2875
|
return;
|
|
2870
2876
|
}
|
|
2871
2877
|
const e = this.getProjectId();
|
|
2872
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
2878
|
+
this.broadcastChannel = new BroadcastChannel(Mt(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2873
2879
|
const { action: r, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
|
|
2874
2880
|
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 } }));
|
|
2875
2881
|
};
|
|
@@ -2889,7 +2895,7 @@ class pr extends w {
|
|
|
2889
2895
|
const e = this.loadStoredSession();
|
|
2890
2896
|
if (!e)
|
|
2891
2897
|
return null;
|
|
2892
|
-
if (!
|
|
2898
|
+
if (!pr.test(e.id))
|
|
2893
2899
|
return a("warn", "Invalid session ID format recovered from storage, clearing", {
|
|
2894
2900
|
data: { sessionId: e.id }
|
|
2895
2901
|
}), this.clearStoredSession(), null;
|
|
@@ -2934,7 +2940,7 @@ class pr extends w {
|
|
|
2934
2940
|
this.storageManager.setItem(t, r), this.storageManager.setSessionItem(t, r);
|
|
2935
2941
|
}
|
|
2936
2942
|
getSessionStorageKey() {
|
|
2937
|
-
return
|
|
2943
|
+
return Lt(this.getProjectId());
|
|
2938
2944
|
}
|
|
2939
2945
|
getProjectId() {
|
|
2940
2946
|
return this.projectId;
|
|
@@ -3174,7 +3180,7 @@ class pr extends w {
|
|
|
3174
3180
|
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
|
|
3175
3181
|
}
|
|
3176
3182
|
}
|
|
3177
|
-
class
|
|
3183
|
+
class Ir extends w {
|
|
3178
3184
|
eventManager;
|
|
3179
3185
|
storageManager;
|
|
3180
3186
|
sessionManager = null;
|
|
@@ -3209,7 +3215,7 @@ class Tr extends w {
|
|
|
3209
3215
|
}
|
|
3210
3216
|
const t = this.get("config")?.integrations?.tracelog?.projectId ?? "custom";
|
|
3211
3217
|
try {
|
|
3212
|
-
this.sessionManager = new
|
|
3218
|
+
this.sessionManager = new Tr(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
|
|
3213
3219
|
} catch (r) {
|
|
3214
3220
|
if (this.sessionManager) {
|
|
3215
3221
|
try {
|
|
@@ -3262,7 +3268,7 @@ class Tr extends w {
|
|
|
3262
3268
|
this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
|
|
3263
3269
|
}
|
|
3264
3270
|
}
|
|
3265
|
-
class
|
|
3271
|
+
class vr extends w {
|
|
3266
3272
|
eventManager;
|
|
3267
3273
|
onTrack;
|
|
3268
3274
|
originalPushState;
|
|
@@ -3338,7 +3344,7 @@ class Ir extends w {
|
|
|
3338
3344
|
};
|
|
3339
3345
|
}
|
|
3340
3346
|
}
|
|
3341
|
-
class
|
|
3347
|
+
class _r extends w {
|
|
3342
3348
|
eventManager;
|
|
3343
3349
|
lastClickTimes = /* @__PURE__ */ new Map();
|
|
3344
3350
|
clickHandler;
|
|
@@ -3476,7 +3482,7 @@ class vr extends w {
|
|
|
3476
3482
|
return e.hasAttribute(`${b}-name`) ? e : e.closest(`[${b}-name]`);
|
|
3477
3483
|
}
|
|
3478
3484
|
getRelevantClickElement(e) {
|
|
3479
|
-
for (const t of
|
|
3485
|
+
for (const t of _t)
|
|
3480
3486
|
try {
|
|
3481
3487
|
if (e.matches(t))
|
|
3482
3488
|
return e;
|
|
@@ -3595,7 +3601,7 @@ class vr extends w {
|
|
|
3595
3601
|
};
|
|
3596
3602
|
}
|
|
3597
3603
|
}
|
|
3598
|
-
class
|
|
3604
|
+
class yr extends w {
|
|
3599
3605
|
eventManager;
|
|
3600
3606
|
containers = [];
|
|
3601
3607
|
limitWarningLogged = !1;
|
|
@@ -3823,7 +3829,7 @@ class _r extends w {
|
|
|
3823
3829
|
e.isPrimary = t;
|
|
3824
3830
|
}
|
|
3825
3831
|
}
|
|
3826
|
-
class
|
|
3832
|
+
class wr extends w {
|
|
3827
3833
|
eventManager;
|
|
3828
3834
|
trackedElements = /* @__PURE__ */ new Map();
|
|
3829
3835
|
observer = null;
|
|
@@ -3984,7 +3990,7 @@ class yr extends w {
|
|
|
3984
3990
|
});
|
|
3985
3991
|
}
|
|
3986
3992
|
}
|
|
3987
|
-
class
|
|
3993
|
+
class br {
|
|
3988
3994
|
storage;
|
|
3989
3995
|
sessionStorageRef;
|
|
3990
3996
|
fallbackStorage = /* @__PURE__ */ new Map();
|
|
@@ -4267,7 +4273,7 @@ class wr {
|
|
|
4267
4273
|
this.fallbackSessionStorage.delete(e);
|
|
4268
4274
|
}
|
|
4269
4275
|
}
|
|
4270
|
-
class
|
|
4276
|
+
class Ar extends w {
|
|
4271
4277
|
eventManager;
|
|
4272
4278
|
reportedByNav = /* @__PURE__ */ new Map();
|
|
4273
4279
|
navigationHistory = [];
|
|
@@ -4366,7 +4372,7 @@ class br extends w {
|
|
|
4366
4372
|
}
|
|
4367
4373
|
async initWebVitals() {
|
|
4368
4374
|
try {
|
|
4369
|
-
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() =>
|
|
4375
|
+
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => is), o = (l) => (c) => {
|
|
4370
4376
|
const u = Number(c.value.toFixed(2));
|
|
4371
4377
|
this.sendVital({ type: l, value: u });
|
|
4372
4378
|
};
|
|
@@ -4393,7 +4399,7 @@ class br extends w {
|
|
|
4393
4399
|
const t = e.getEntries();
|
|
4394
4400
|
for (const r of t) {
|
|
4395
4401
|
const n = Number(r.duration.toFixed(2)), i = Date.now();
|
|
4396
|
-
i - this.lastLongTaskSentAt >=
|
|
4402
|
+
i - this.lastLongTaskSentAt >= jt && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
4397
4403
|
}
|
|
4398
4404
|
},
|
|
4399
4405
|
{ type: "longtask", buffered: !0 }
|
|
@@ -4409,7 +4415,7 @@ class br extends w {
|
|
|
4409
4415
|
return;
|
|
4410
4416
|
if (r)
|
|
4411
4417
|
r.add(e.type);
|
|
4412
|
-
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length >
|
|
4418
|
+
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Qt) {
|
|
4413
4419
|
const i = this.navigationHistory.shift();
|
|
4414
4420
|
i && this.reportedByNav.delete(i);
|
|
4415
4421
|
}
|
|
@@ -4500,7 +4506,7 @@ class br extends w {
|
|
|
4500
4506
|
return !(typeof r == "number" && t <= r);
|
|
4501
4507
|
}
|
|
4502
4508
|
}
|
|
4503
|
-
class
|
|
4509
|
+
class Lr extends w {
|
|
4504
4510
|
eventManager;
|
|
4505
4511
|
recentErrors = /* @__PURE__ */ new Map();
|
|
4506
4512
|
errorBurstCounter = 0;
|
|
@@ -4536,7 +4542,7 @@ class Ar extends w {
|
|
|
4536
4542
|
const e = Date.now();
|
|
4537
4543
|
if (e < this.burstBackoffUntil)
|
|
4538
4544
|
return !1;
|
|
4539
|
-
if (e - this.burstWindowStart >
|
|
4545
|
+
if (e - this.burstWindowStart > Bt && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Wt)
|
|
4540
4546
|
return this.burstBackoffUntil = e + Ge, a("debug", "Error burst detected - entering cooldown", {
|
|
4541
4547
|
data: {
|
|
4542
4548
|
errorsInWindow: this.errorBurstCounter,
|
|
@@ -4596,7 +4602,7 @@ class Ar extends w {
|
|
|
4596
4602
|
}
|
|
4597
4603
|
shouldSuppressError(e, t) {
|
|
4598
4604
|
const r = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
4599
|
-
return i && r - i < We ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size >
|
|
4605
|
+
return i && r - i < We ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size > $t ? (this.recentErrors.clear(), this.recentErrors.set(n, r), !1) : (this.recentErrors.size > te && this.pruneOldErrors(), !1));
|
|
4600
4606
|
}
|
|
4601
4607
|
pruneOldErrors() {
|
|
4602
4608
|
const e = Date.now();
|
|
@@ -4611,11 +4617,11 @@ class Ar extends w {
|
|
|
4611
4617
|
}
|
|
4612
4618
|
}
|
|
4613
4619
|
}
|
|
4614
|
-
class
|
|
4620
|
+
class Mr extends w {
|
|
4615
4621
|
isInitialized = !1;
|
|
4616
4622
|
suppressNextScrollTimer = null;
|
|
4617
4623
|
pageUnloadHandler = null;
|
|
4618
|
-
emitter = new
|
|
4624
|
+
emitter = new hr();
|
|
4619
4625
|
transformers = {};
|
|
4620
4626
|
customHeadersProvider;
|
|
4621
4627
|
managers = {};
|
|
@@ -4633,11 +4639,11 @@ class Lr extends w {
|
|
|
4633
4639
|
async init(e = {}) {
|
|
4634
4640
|
if (this.isInitialized)
|
|
4635
4641
|
return { sessionId: this.get("sessionId") ?? "" };
|
|
4636
|
-
this.managers.storage = new
|
|
4642
|
+
this.managers.storage = new br();
|
|
4637
4643
|
try {
|
|
4638
4644
|
this.setupState(e);
|
|
4639
4645
|
const t = e.integrations?.custom?.headers ?? {}, r = e.integrations?.custom?.fetchCredentials ?? "include";
|
|
4640
|
-
return this.managers.event = new
|
|
4646
|
+
return this.managers.event = new Er(
|
|
4641
4647
|
this.managers.storage,
|
|
4642
4648
|
this.emitter,
|
|
4643
4649
|
this.transformers,
|
|
@@ -4667,7 +4673,7 @@ class Lr extends w {
|
|
|
4667
4673
|
}
|
|
4668
4674
|
let r = t;
|
|
4669
4675
|
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
4670
|
-
const { valid: n, error: i, sanitizedMetadata: o } =
|
|
4676
|
+
const { valid: n, error: i, sanitizedMetadata: o } = dr(e, r);
|
|
4671
4677
|
if (!n) {
|
|
4672
4678
|
if (this.get("mode") === se.QA)
|
|
4673
4679
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
|
|
@@ -4737,14 +4743,14 @@ class Lr extends w {
|
|
|
4737
4743
|
}
|
|
4738
4744
|
setupState(e = {}) {
|
|
4739
4745
|
this.set("config", e);
|
|
4740
|
-
const t =
|
|
4746
|
+
const t = Sr.getId(this.managers.storage);
|
|
4741
4747
|
this.set("userId", t);
|
|
4742
|
-
const r =
|
|
4748
|
+
const r = sr(e);
|
|
4743
4749
|
this.set("collectApiUrls", r);
|
|
4744
|
-
const n =
|
|
4750
|
+
const n = Ft();
|
|
4745
4751
|
this.set("device", n);
|
|
4746
4752
|
const i = ve(window.location.href, e.sensitiveQueryParams);
|
|
4747
|
-
this.set("pageUrl", i),
|
|
4753
|
+
this.set("pageUrl", i), qt() && this.set("mode", se.QA);
|
|
4748
4754
|
}
|
|
4749
4755
|
/**
|
|
4750
4756
|
* Returns the current configuration object.
|
|
@@ -4795,7 +4801,7 @@ class Lr extends w {
|
|
|
4795
4801
|
valid: !1,
|
|
4796
4802
|
error: "Global metadata must be a plain object"
|
|
4797
4803
|
};
|
|
4798
|
-
const t =
|
|
4804
|
+
const t = ut("Global", e, "globalMetadata");
|
|
4799
4805
|
return t.valid ? { valid: !0 } : {
|
|
4800
4806
|
valid: !1,
|
|
4801
4807
|
error: t.error
|
|
@@ -4862,12 +4868,12 @@ class Lr extends w {
|
|
|
4862
4868
|
a("warn", "identify() userId exceeds 256 characters", { data: { length: e.trim().length } });
|
|
4863
4869
|
return;
|
|
4864
4870
|
}
|
|
4865
|
-
const r = e.trim(), n =
|
|
4871
|
+
const r = e.trim(), n = ct(t), i = {
|
|
4866
4872
|
userId: r,
|
|
4867
|
-
...n ? { traits:
|
|
4873
|
+
...n ? { traits: n } : {}
|
|
4868
4874
|
};
|
|
4869
4875
|
this.set("identity", i), this.persistIdentity(i), a("debug", "Visitor identified", {
|
|
4870
|
-
data: { userIdLength: r.length, traitKeys: n ? Object.keys(
|
|
4876
|
+
data: { userIdLength: r.length, traitKeys: n ? Object.keys(n) : [] }
|
|
4871
4877
|
});
|
|
4872
4878
|
}
|
|
4873
4879
|
/**
|
|
@@ -4916,7 +4922,8 @@ class Lr extends w {
|
|
|
4916
4922
|
a("debug", "Invalid pending identity in localStorage, discarded");
|
|
4917
4923
|
return;
|
|
4918
4924
|
}
|
|
4919
|
-
|
|
4925
|
+
const o = { ...i, userId: i.userId.trim() };
|
|
4926
|
+
e.setItem(r, JSON.stringify(o)), this.set("identity", o), a("debug", "Migrated pending identity to project-scoped key");
|
|
4920
4927
|
return;
|
|
4921
4928
|
}
|
|
4922
4929
|
} catch {
|
|
@@ -4930,7 +4937,8 @@ class Lr extends w {
|
|
|
4930
4937
|
e.removeItem(r), a("debug", "Invalid persisted identity in localStorage, discarded");
|
|
4931
4938
|
return;
|
|
4932
4939
|
}
|
|
4933
|
-
|
|
4940
|
+
const o = { ...i, userId: i.userId.trim() };
|
|
4941
|
+
this.set("identity", o), a("debug", "Loaded persisted identity");
|
|
4934
4942
|
}
|
|
4935
4943
|
} catch {
|
|
4936
4944
|
a("debug", "Failed to load persisted identity");
|
|
@@ -4969,7 +4977,7 @@ class Lr extends w {
|
|
|
4969
4977
|
}
|
|
4970
4978
|
initializeHandlers() {
|
|
4971
4979
|
const e = this.get("config");
|
|
4972
|
-
this.handlers.session = new
|
|
4980
|
+
this.handlers.session = new Ir(
|
|
4973
4981
|
this.managers.storage,
|
|
4974
4982
|
this.managers.event
|
|
4975
4983
|
), this.handlers.session.startTracking();
|
|
@@ -4978,16 +4986,16 @@ class Lr extends w {
|
|
|
4978
4986
|
this.set("suppressNextScroll", !1);
|
|
4979
4987
|
}, 500);
|
|
4980
4988
|
};
|
|
4981
|
-
this.handlers.pageView = new
|
|
4989
|
+
this.handlers.pageView = new vr(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new _r(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new yr(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new Ar(this.managers.event), this.handlers.performance.startTracking().catch((r) => {
|
|
4982
4990
|
a("warn", "Failed to start performance tracking", { error: r });
|
|
4983
|
-
}), this.handlers.error = new
|
|
4991
|
+
}), this.handlers.error = new Lr(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new wr(this.managers.event), this.handlers.viewport.startTracking());
|
|
4984
4992
|
}
|
|
4985
4993
|
}
|
|
4986
4994
|
const V = [], M = [];
|
|
4987
4995
|
let D = null, h = null, R = !1, p = !1, P = null;
|
|
4988
|
-
const
|
|
4996
|
+
const Cr = 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 () => {
|
|
4989
4997
|
try {
|
|
4990
|
-
const e =
|
|
4998
|
+
const e = lr(s ?? {}), t = new Mr();
|
|
4991
4999
|
try {
|
|
4992
5000
|
V.forEach(({ event: o, callback: l }) => {
|
|
4993
5001
|
t.on(o, l);
|
|
@@ -5013,7 +5021,7 @@ const Mr = async (s) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
5013
5021
|
} finally {
|
|
5014
5022
|
R = !1, P = null;
|
|
5015
5023
|
}
|
|
5016
|
-
})()), P)),
|
|
5024
|
+
})()), P)), Rr = (s, e) => {
|
|
5017
5025
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5018
5026
|
if (!h)
|
|
5019
5027
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -5021,7 +5029,7 @@ const Mr = async (s) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
5021
5029
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
5022
5030
|
h.sendCustomEvent(s, e);
|
|
5023
5031
|
}
|
|
5024
|
-
},
|
|
5032
|
+
}, Nr = (s, e) => {
|
|
5025
5033
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5026
5034
|
if (!h || R) {
|
|
5027
5035
|
V.push({ event: s, callback: e });
|
|
@@ -5029,7 +5037,7 @@ const Mr = async (s) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
5029
5037
|
}
|
|
5030
5038
|
h.on(s, e);
|
|
5031
5039
|
}
|
|
5032
|
-
},
|
|
5040
|
+
}, Or = (s, e) => {
|
|
5033
5041
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5034
5042
|
if (!h) {
|
|
5035
5043
|
const t = V.findIndex((r) => r.event === s && r.callback === e);
|
|
@@ -5039,7 +5047,7 @@ const Mr = async (s) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
5039
5047
|
h.off(s, e);
|
|
5040
5048
|
}
|
|
5041
5049
|
};
|
|
5042
|
-
function
|
|
5050
|
+
function Pr(s, e) {
|
|
5043
5051
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5044
5052
|
if (typeof e != "function")
|
|
5045
5053
|
throw new Error(`[TraceLog] Transformer must be a function, received: ${typeof e}`);
|
|
@@ -5053,7 +5061,7 @@ function Or(s, e) {
|
|
|
5053
5061
|
s === "beforeSend" ? h.setTransformer("beforeSend", e) : h.setTransformer("beforeBatch", e);
|
|
5054
5062
|
}
|
|
5055
5063
|
}
|
|
5056
|
-
const
|
|
5064
|
+
const Dr = (s) => {
|
|
5057
5065
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5058
5066
|
if (!h) {
|
|
5059
5067
|
const e = M.findIndex((t) => t.hook === s);
|
|
@@ -5064,7 +5072,7 @@ const Pr = (s) => {
|
|
|
5064
5072
|
throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
|
|
5065
5073
|
h.removeTransformer(s);
|
|
5066
5074
|
}
|
|
5067
|
-
},
|
|
5075
|
+
}, Vr = (s) => {
|
|
5068
5076
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5069
5077
|
if (typeof s != "function")
|
|
5070
5078
|
throw new Error(`[TraceLog] Custom headers provider must be a function, received: ${typeof s}`);
|
|
@@ -5076,7 +5084,7 @@ const Pr = (s) => {
|
|
|
5076
5084
|
throw new Error("[TraceLog] Cannot set custom headers while TraceLog is being destroyed");
|
|
5077
5085
|
h.setCustomHeaders(s);
|
|
5078
5086
|
}
|
|
5079
|
-
},
|
|
5087
|
+
}, kr = () => {
|
|
5080
5088
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5081
5089
|
if (!h) {
|
|
5082
5090
|
D = null;
|
|
@@ -5086,7 +5094,7 @@ const Pr = (s) => {
|
|
|
5086
5094
|
throw new Error("[TraceLog] Cannot remove custom headers while TraceLog is being destroyed");
|
|
5087
5095
|
h.removeCustomHeaders();
|
|
5088
5096
|
}
|
|
5089
|
-
},
|
|
5097
|
+
}, Ur = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, Hr = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), xr = () => {
|
|
5090
5098
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5091
5099
|
if (p)
|
|
5092
5100
|
throw new Error("[TraceLog] Destroy operation already in progress");
|
|
@@ -5101,9 +5109,9 @@ const Pr = (s) => {
|
|
|
5101
5109
|
h = null, R = !1, P = null, V.length = 0, M.length = 0, D = null, p = !1, a("warn", "Error during destroy, forced cleanup completed", { error: s });
|
|
5102
5110
|
}
|
|
5103
5111
|
}
|
|
5104
|
-
}, xr = (s) => {
|
|
5105
|
-
typeof window > "u" || typeof document > "u" || qt(s);
|
|
5106
5112
|
}, Fr = (s) => {
|
|
5113
|
+
typeof window > "u" || typeof document > "u" || Jt(s);
|
|
5114
|
+
}, $r = (s) => {
|
|
5107
5115
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5108
5116
|
if (!h)
|
|
5109
5117
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -5111,7 +5119,7 @@ const Pr = (s) => {
|
|
|
5111
5119
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5112
5120
|
h.updateGlobalMetadata(s);
|
|
5113
5121
|
}
|
|
5114
|
-
},
|
|
5122
|
+
}, Br = (s) => {
|
|
5115
5123
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5116
5124
|
if (!h)
|
|
5117
5125
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -5119,7 +5127,7 @@ const Pr = (s) => {
|
|
|
5119
5127
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5120
5128
|
h.mergeGlobalMetadata(s);
|
|
5121
5129
|
}
|
|
5122
|
-
},
|
|
5130
|
+
}, Wr = (s, e) => {
|
|
5123
5131
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5124
5132
|
if (!s || typeof s != "string" || s.trim().length === 0) {
|
|
5125
5133
|
a("warn", "identify() called with invalid userId");
|
|
@@ -5138,16 +5146,16 @@ const Pr = (s) => {
|
|
|
5138
5146
|
return;
|
|
5139
5147
|
}
|
|
5140
5148
|
try {
|
|
5141
|
-
const t =
|
|
5149
|
+
const t = ct(e), r = {
|
|
5142
5150
|
userId: s.trim(),
|
|
5143
|
-
...t ? { traits:
|
|
5151
|
+
...t ? { traits: t } : {}
|
|
5144
5152
|
};
|
|
5145
5153
|
localStorage.setItem(H, JSON.stringify(r)), a("debug", "Identity persisted pre-init (will be applied on init)");
|
|
5146
5154
|
} catch {
|
|
5147
5155
|
a("debug", "Failed to persist pre-init identity");
|
|
5148
5156
|
}
|
|
5149
5157
|
}
|
|
5150
|
-
},
|
|
5158
|
+
}, Gr = async () => {
|
|
5151
5159
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5152
5160
|
if (!h) {
|
|
5153
5161
|
try {
|
|
@@ -5160,27 +5168,27 @@ const Pr = (s) => {
|
|
|
5160
5168
|
throw new Error("[TraceLog] Cannot reset identity while TraceLog is being destroyed");
|
|
5161
5169
|
await h.resetIdentity();
|
|
5162
5170
|
}
|
|
5163
|
-
},
|
|
5164
|
-
init:
|
|
5165
|
-
event:
|
|
5166
|
-
on:
|
|
5167
|
-
off:
|
|
5168
|
-
setTransformer:
|
|
5169
|
-
removeTransformer:
|
|
5170
|
-
setCustomHeaders:
|
|
5171
|
-
removeCustomHeaders:
|
|
5172
|
-
isInitialized:
|
|
5173
|
-
getSessionId:
|
|
5174
|
-
destroy:
|
|
5175
|
-
setQaMode:
|
|
5176
|
-
updateGlobalMetadata:
|
|
5177
|
-
mergeGlobalMetadata:
|
|
5178
|
-
identify:
|
|
5179
|
-
resetIdentity:
|
|
5171
|
+
}, Ts = {
|
|
5172
|
+
init: Cr,
|
|
5173
|
+
event: Rr,
|
|
5174
|
+
on: Nr,
|
|
5175
|
+
off: Or,
|
|
5176
|
+
setTransformer: Pr,
|
|
5177
|
+
removeTransformer: Dr,
|
|
5178
|
+
setCustomHeaders: Vr,
|
|
5179
|
+
removeCustomHeaders: kr,
|
|
5180
|
+
isInitialized: Ur,
|
|
5181
|
+
getSessionId: Hr,
|
|
5182
|
+
destroy: xr,
|
|
5183
|
+
setQaMode: Fr,
|
|
5184
|
+
updateGlobalMetadata: $r,
|
|
5185
|
+
mergeGlobalMetadata: Br,
|
|
5186
|
+
identify: Wr,
|
|
5187
|
+
resetIdentity: Gr
|
|
5180
5188
|
};
|
|
5181
|
-
var we, C, j,
|
|
5189
|
+
var we, C, j, ft, ie, mt = -1, k = function(s) {
|
|
5182
5190
|
addEventListener("pageshow", (function(e) {
|
|
5183
|
-
e.persisted && (
|
|
5191
|
+
e.persisted && (mt = e.timeStamp, s(e));
|
|
5184
5192
|
}), !0);
|
|
5185
5193
|
}, Ne = function() {
|
|
5186
5194
|
var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
@@ -5190,7 +5198,7 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5190
5198
|
return s && s.activationStart || 0;
|
|
5191
5199
|
}, _ = function(s, e) {
|
|
5192
5200
|
var t = Ne(), r = "navigate";
|
|
5193
|
-
return
|
|
5201
|
+
return mt >= 0 ? r = "back-forward-cache" : t && (document.prerendering || ae() > 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 };
|
|
5194
5202
|
}, F = function(s, e, t) {
|
|
5195
5203
|
try {
|
|
5196
5204
|
if (PerformanceObserver.supportedEntryTypes.includes(s)) {
|
|
@@ -5228,10 +5236,10 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5228
5236
|
}, x = -1, qe = function() {
|
|
5229
5237
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
5230
5238
|
}, oe = function(s) {
|
|
5231
|
-
document.visibilityState === "hidden" && x > -1 && (x = s.type === "visibilitychange" ? s.timeStamp : 0,
|
|
5239
|
+
document.visibilityState === "hidden" && x > -1 && (x = s.type === "visibilitychange" ? s.timeStamp : 0, Xr());
|
|
5232
5240
|
}, Je = function() {
|
|
5233
5241
|
addEventListener("visibilitychange", oe, !0), addEventListener("prerenderingchange", oe, !0);
|
|
5234
|
-
},
|
|
5242
|
+
}, Xr = function() {
|
|
5235
5243
|
removeEventListener("visibilitychange", oe, !0), removeEventListener("prerenderingchange", oe, !0);
|
|
5236
5244
|
}, Pe = function() {
|
|
5237
5245
|
return x < 0 && (x = qe(), Je(), k((function() {
|
|
@@ -5245,7 +5253,7 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5245
5253
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
5246
5254
|
return s();
|
|
5247
5255
|
}), !0) : s();
|
|
5248
|
-
}, be = [1800, 3e3],
|
|
5256
|
+
}, be = [1800, 3e3], gt = function(s, e) {
|
|
5249
5257
|
e = e || {}, K((function() {
|
|
5250
5258
|
var t, r = Pe(), n = _("FCP"), i = F("paint", (function(o) {
|
|
5251
5259
|
o.forEach((function(l) {
|
|
@@ -5258,8 +5266,8 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5258
5266
|
}));
|
|
5259
5267
|
})));
|
|
5260
5268
|
}));
|
|
5261
|
-
}, Ae = [0.1, 0.25],
|
|
5262
|
-
e = e || {},
|
|
5269
|
+
}, Ae = [0.1, 0.25], jr = function(s, e) {
|
|
5270
|
+
e = e || {}, gt(le((function() {
|
|
5263
5271
|
var t, r = _("CLS", 0), n = 0, i = [], o = function(c) {
|
|
5264
5272
|
c.forEach((function(u) {
|
|
5265
5273
|
if (!u.hadRecentInput) {
|
|
@@ -5276,19 +5284,19 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5276
5284
|
}));
|
|
5277
5285
|
})), setTimeout(t, 0));
|
|
5278
5286
|
})));
|
|
5279
|
-
},
|
|
5287
|
+
}, Et = 0, me = 1 / 0, Z = 0, Qr = function(s) {
|
|
5280
5288
|
s.forEach((function(e) {
|
|
5281
|
-
e.interactionId && (me = Math.min(me, e.interactionId), Z = Math.max(Z, e.interactionId),
|
|
5289
|
+
e.interactionId && (me = Math.min(me, e.interactionId), Z = Math.max(Z, e.interactionId), Et = Z ? (Z - me) / 7 + 1 : 0);
|
|
5282
5290
|
}));
|
|
5283
|
-
},
|
|
5284
|
-
return we ?
|
|
5285
|
-
},
|
|
5286
|
-
"interactionCount" in performance || we || (we = F("event",
|
|
5287
|
-
}, A = [], re = /* @__PURE__ */ new Map(),
|
|
5288
|
-
var s = Math.min(A.length - 1, Math.floor((
|
|
5291
|
+
}, St = function() {
|
|
5292
|
+
return we ? Et : performance.interactionCount || 0;
|
|
5293
|
+
}, zr = function() {
|
|
5294
|
+
"interactionCount" in performance || we || (we = F("event", Qr, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
5295
|
+
}, A = [], re = /* @__PURE__ */ new Map(), pt = 0, Kr = function() {
|
|
5296
|
+
var s = Math.min(A.length - 1, Math.floor((St() - pt) / 50));
|
|
5289
5297
|
return A[s];
|
|
5290
|
-
},
|
|
5291
|
-
if (
|
|
5298
|
+
}, Yr = [], qr = function(s) {
|
|
5299
|
+
if (Yr.forEach((function(n) {
|
|
5292
5300
|
return n(s);
|
|
5293
5301
|
})), s.interactionId || s.entryType === "first-input") {
|
|
5294
5302
|
var e = A[A.length - 1], t = re.get(s.interactionId);
|
|
@@ -5305,27 +5313,27 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5305
5313
|
}));
|
|
5306
5314
|
}
|
|
5307
5315
|
}
|
|
5308
|
-
},
|
|
5316
|
+
}, Tt = function(s) {
|
|
5309
5317
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
5310
5318
|
return s = le(s), document.visibilityState === "hidden" ? s() : (t = e(s), z(s)), t;
|
|
5311
|
-
}, Le = [200, 500],
|
|
5319
|
+
}, Le = [200, 500], Jr = function(s, e) {
|
|
5312
5320
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, K((function() {
|
|
5313
5321
|
var t;
|
|
5314
|
-
|
|
5322
|
+
zr();
|
|
5315
5323
|
var r, n = _("INP"), i = function(l) {
|
|
5316
|
-
|
|
5317
|
-
l.forEach(
|
|
5318
|
-
var c =
|
|
5324
|
+
Tt((function() {
|
|
5325
|
+
l.forEach(qr);
|
|
5326
|
+
var c = Kr();
|
|
5319
5327
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, r());
|
|
5320
5328
|
}));
|
|
5321
5329
|
}, o = F("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
5322
5330
|
r = y(s, n, Le, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), z((function() {
|
|
5323
5331
|
i(o.takeRecords()), r(!0);
|
|
5324
5332
|
})), k((function() {
|
|
5325
|
-
|
|
5333
|
+
pt = St(), A.length = 0, re.clear(), n = _("INP"), r = y(s, n, Le, e.reportAllChanges);
|
|
5326
5334
|
})));
|
|
5327
5335
|
})));
|
|
5328
|
-
}, Me = [2500, 4e3], ge = {},
|
|
5336
|
+
}, Me = [2500, 4e3], ge = {}, Zr = function(s, e) {
|
|
5329
5337
|
e = e || {}, K((function() {
|
|
5330
5338
|
var t, r = Pe(), n = _("LCP"), i = function(c) {
|
|
5331
5339
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
@@ -5339,7 +5347,7 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5339
5347
|
}));
|
|
5340
5348
|
["keydown", "click"].forEach((function(c) {
|
|
5341
5349
|
addEventListener(c, (function() {
|
|
5342
|
-
return
|
|
5350
|
+
return Tt(l);
|
|
5343
5351
|
}), { once: !0, capture: !0 });
|
|
5344
5352
|
})), z(l), k((function(c) {
|
|
5345
5353
|
n = _("LCP"), t = y(s, n, Me, e.reportAllChanges), Oe((function() {
|
|
@@ -5348,31 +5356,31 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5348
5356
|
}));
|
|
5349
5357
|
}
|
|
5350
5358
|
}));
|
|
5351
|
-
}, Ce = [800, 1800],
|
|
5359
|
+
}, Ce = [800, 1800], es = function s(e) {
|
|
5352
5360
|
document.prerendering ? K((function() {
|
|
5353
5361
|
return s(e);
|
|
5354
5362
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
5355
5363
|
return s(e);
|
|
5356
5364
|
}), !0) : setTimeout(e, 0);
|
|
5357
|
-
},
|
|
5365
|
+
}, ts = function(s, e) {
|
|
5358
5366
|
e = e || {};
|
|
5359
5367
|
var t = _("TTFB"), r = y(s, t, Ce, e.reportAllChanges);
|
|
5360
|
-
|
|
5368
|
+
es((function() {
|
|
5361
5369
|
var n = Ne();
|
|
5362
5370
|
n && (t.value = Math.max(n.responseStart - ae(), 0), t.entries = [n], r(!0), k((function() {
|
|
5363
5371
|
t = _("TTFB", 0), (r = y(s, t, Ce, e.reportAllChanges))(!0);
|
|
5364
5372
|
})));
|
|
5365
5373
|
}));
|
|
5366
|
-
}, G = { passive: !0, capture: !0 },
|
|
5367
|
-
C || (C = e, j = s,
|
|
5368
|
-
},
|
|
5369
|
-
if (j >= 0 && j <
|
|
5374
|
+
}, G = { passive: !0, capture: !0 }, rs = /* @__PURE__ */ new Date(), Ze = function(s, e) {
|
|
5375
|
+
C || (C = e, j = s, ft = /* @__PURE__ */ new Date(), vt(removeEventListener), It());
|
|
5376
|
+
}, It = function() {
|
|
5377
|
+
if (j >= 0 && j < ft - rs) {
|
|
5370
5378
|
var s = { entryType: "first-input", name: C.type, target: C.target, cancelable: C.cancelable, startTime: C.timeStamp, processingStart: C.timeStamp + j };
|
|
5371
5379
|
ie.forEach((function(e) {
|
|
5372
5380
|
e(s);
|
|
5373
5381
|
})), ie = [];
|
|
5374
5382
|
}
|
|
5375
|
-
},
|
|
5383
|
+
}, ss = function(s) {
|
|
5376
5384
|
if (s.cancelable) {
|
|
5377
5385
|
var e = (s.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - s.timeStamp;
|
|
5378
5386
|
s.type == "pointerdown" ? (function(t, r) {
|
|
@@ -5386,11 +5394,11 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5386
5394
|
addEventListener("pointerup", n, G), addEventListener("pointercancel", i, G);
|
|
5387
5395
|
})(e, s) : Ze(e, s);
|
|
5388
5396
|
}
|
|
5389
|
-
},
|
|
5397
|
+
}, vt = function(s) {
|
|
5390
5398
|
["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
|
|
5391
|
-
return s(e,
|
|
5399
|
+
return s(e, ss, G);
|
|
5392
5400
|
}));
|
|
5393
|
-
}, Re = [100, 300],
|
|
5401
|
+
}, Re = [100, 300], ns = function(s, e) {
|
|
5394
5402
|
e = e || {}, K((function() {
|
|
5395
5403
|
var t, r = Pe(), n = _("FID"), i = function(c) {
|
|
5396
5404
|
c.startTime < r.firstHiddenTime && (n.value = c.processingStart - c.startTime, n.entries.push(c), t(!0));
|
|
@@ -5401,11 +5409,11 @@ var we, C, j, ht, ie, ft = -1, k = function(s) {
|
|
|
5401
5409
|
o(l.takeRecords()), l.disconnect();
|
|
5402
5410
|
}))), k((function() {
|
|
5403
5411
|
var c;
|
|
5404
|
-
n = _("FID"), t = y(s, n, Re, e.reportAllChanges), ie = [], j = -1, C = null,
|
|
5412
|
+
n = _("FID"), t = y(s, n, Re, e.reportAllChanges), ie = [], j = -1, C = null, vt(addEventListener), c = i, ie.push(c), It();
|
|
5405
5413
|
})));
|
|
5406
5414
|
}));
|
|
5407
5415
|
};
|
|
5408
|
-
const
|
|
5416
|
+
const is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5409
5417
|
__proto__: null,
|
|
5410
5418
|
CLSThresholds: Ae,
|
|
5411
5419
|
FCPThresholds: be,
|
|
@@ -5413,45 +5421,45 @@ const ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5413
5421
|
INPThresholds: Le,
|
|
5414
5422
|
LCPThresholds: Me,
|
|
5415
5423
|
TTFBThresholds: Ce,
|
|
5416
|
-
onCLS:
|
|
5417
|
-
onFCP:
|
|
5418
|
-
onFID:
|
|
5419
|
-
onINP:
|
|
5420
|
-
onLCP:
|
|
5421
|
-
onTTFB:
|
|
5424
|
+
onCLS: jr,
|
|
5425
|
+
onFCP: gt,
|
|
5426
|
+
onFID: ns,
|
|
5427
|
+
onINP: Jr,
|
|
5428
|
+
onLCP: Zr,
|
|
5429
|
+
onTTFB: ts
|
|
5422
5430
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5423
5431
|
export {
|
|
5424
5432
|
f as AppConfigValidationError,
|
|
5425
|
-
|
|
5433
|
+
os as DEFAULT_SESSION_TIMEOUT,
|
|
5426
5434
|
Ie as DEFAULT_WEB_VITALS_MODE,
|
|
5427
5435
|
L as DeviceType,
|
|
5428
5436
|
Se as EmitterEvent,
|
|
5429
5437
|
W as ErrorType,
|
|
5430
5438
|
d as EventType,
|
|
5431
|
-
|
|
5439
|
+
Ss as InitializationTimeoutError,
|
|
5432
5440
|
U as IntegrationValidationError,
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
+
ms as MAX_ARRAY_LENGTH,
|
|
5442
|
+
us as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
5443
|
+
cs as MAX_CUSTOM_EVENT_KEYS,
|
|
5444
|
+
as as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
5445
|
+
ls as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
5446
|
+
ds as MAX_NESTED_OBJECT_KEYS,
|
|
5447
|
+
hs as MAX_STRING_LENGTH,
|
|
5448
|
+
fs as MAX_STRING_LENGTH_IN_ARRAY,
|
|
5441
5449
|
se as Mode,
|
|
5442
5450
|
nt as PII_PATTERNS,
|
|
5443
5451
|
N as PermanentError,
|
|
5444
5452
|
$e as SamplingRateValidationError,
|
|
5445
5453
|
ee as ScrollDirection,
|
|
5446
|
-
|
|
5454
|
+
Ct as SessionTimeoutValidationError,
|
|
5447
5455
|
B as SpecialApiUrl,
|
|
5448
5456
|
O as TimeoutError,
|
|
5449
5457
|
Q as TraceLogValidationError,
|
|
5450
|
-
|
|
5458
|
+
ps as WEB_VITALS_GOOD_THRESHOLDS,
|
|
5451
5459
|
Xe as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
5452
|
-
|
|
5460
|
+
Xt as WEB_VITALS_POOR_THRESHOLDS,
|
|
5453
5461
|
je as getWebVitalsThresholds,
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5462
|
+
gs as isPrimaryScrollEvent,
|
|
5463
|
+
Es as isSecondaryScrollEvent,
|
|
5464
|
+
Ts as tracelog
|
|
5457
5465
|
};
|