@tracelog/lib 2.1.0 → 2.1.1-rc.76.4
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 +466 -378
- 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 +6142 -6722
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +2 -0
- package/dist/public-api.d.ts +2 -0
- package/dist/public-api.js +6110 -6722
- 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 w = "data-tlog",
|
|
1
|
+
const Vr = 9e5;
|
|
2
|
+
const Ur = 120, xr = 8192, Hr = 10, Fr = 10, $r = 20, Br = 1;
|
|
3
|
+
const Wr = 1e3, Gr = 500, Xr = 100;
|
|
4
|
+
const w = "data-tlog", ot = [
|
|
5
5
|
"button",
|
|
6
6
|
"a",
|
|
7
7
|
'input[type="button"]',
|
|
@@ -33,7 +33,7 @@ const w = "data-tlog", nt = [
|
|
|
33
33
|
".menu-item",
|
|
34
34
|
"[data-testid]",
|
|
35
35
|
'[tabindex="0"]'
|
|
36
|
-
],
|
|
36
|
+
], at = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], lt = [
|
|
37
37
|
"token",
|
|
38
38
|
"auth",
|
|
39
39
|
"key",
|
|
@@ -71,22 +71,22 @@ const m = {
|
|
|
71
71
|
INVALID_VIEWPORT_MIN_DWELL_TIME: "Viewport minDwellTime must be a non-negative number",
|
|
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
|
+
}, ct = [
|
|
75
75
|
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
76
76
|
/javascript:/gi,
|
|
77
77
|
/on\w+\s*=/gi,
|
|
78
78
|
/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
|
79
79
|
/<embed\b[^>]*>/gi,
|
|
80
80
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
81
|
-
], I = "tlog", x = `${I}:qa_mode`,
|
|
82
|
-
var
|
|
81
|
+
], I = "tlog", x = `${I}:qa_mode`, Ie = `${I}:uid`, $e = "tlog_mode", we = "qa", ye = "qa_off", ut = (s) => s ? `${I}:${s}:queue` : `${I}:queue`, dt = (s) => s ? `${I}:${s}:session` : `${I}:session`, ht = (s) => s ? `${I}:${s}:broadcast` : `${I}:broadcast`, be = (s, e) => `${I}:${s}:session_counts:${e}`, Ae = 10080 * 60 * 1e3, Le = `${I}:session_counts_last_cleanup`, Me = 3600 * 1e3;
|
|
82
|
+
var V = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(V || {}), L = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(L || {}), oe = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(oe || {});
|
|
83
83
|
class N extends Error {
|
|
84
84
|
constructor(e, t) {
|
|
85
85
|
super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, N);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s.VIEWPORT_VISIBLE = "viewport_visible", s))(d || {}), X = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(X || {}), U = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(U || {}),
|
|
89
|
-
const
|
|
88
|
+
var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s.VIEWPORT_VISIBLE = "viewport_visible", s))(d || {}), X = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(X || {}), U = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(U || {}), z = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(z || {});
|
|
89
|
+
const Qr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !0, jr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !1;
|
|
90
90
|
class H extends Error {
|
|
91
91
|
constructor(e, t, r) {
|
|
92
92
|
super(e), this.errorCode = t, this.layer = r, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
@@ -97,27 +97,27 @@ class h extends H {
|
|
|
97
97
|
super(e, "APP_CONFIG_INVALID", t);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
class
|
|
100
|
+
class ft extends H {
|
|
101
101
|
constructor(e, t = "config") {
|
|
102
102
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
class
|
|
105
|
+
class Re extends H {
|
|
106
106
|
constructor(e, t = "config") {
|
|
107
107
|
super(e, "SAMPLING_RATE_INVALID", t);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
class
|
|
110
|
+
class k extends H {
|
|
111
111
|
constructor(e, t = "config") {
|
|
112
112
|
super(e, "INTEGRATION_INVALID", t);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
class
|
|
115
|
+
class zr extends H {
|
|
116
116
|
constructor(e, t, r = "runtime") {
|
|
117
117
|
super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
const
|
|
120
|
+
const Be = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", We = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", mt = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", gt = (s, e) => {
|
|
121
121
|
if (e) {
|
|
122
122
|
if (e instanceof Error) {
|
|
123
123
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
|
|
@@ -136,7 +136,7 @@ const He = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
136
136
|
return `[TraceLog] ${s}: ${String(e)}`;
|
|
137
137
|
}
|
|
138
138
|
return `[TraceLog] ${s}`;
|
|
139
|
-
},
|
|
139
|
+
}, Et = () => {
|
|
140
140
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
141
141
|
return !1;
|
|
142
142
|
try {
|
|
@@ -145,15 +145,15 @@ const He = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
145
145
|
return !1;
|
|
146
146
|
}
|
|
147
147
|
}, a = (s, e, t) => {
|
|
148
|
-
const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ?
|
|
149
|
-
if (!
|
|
148
|
+
const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ? gt(e, r) : `[TraceLog] ${e}`, u = s === "error" ? "error" : s === "warn" ? "warn" : "log";
|
|
149
|
+
if (!St(l, i))
|
|
150
150
|
return;
|
|
151
|
-
const g =
|
|
152
|
-
|
|
153
|
-
},
|
|
151
|
+
const g = pt(l, o), p = n !== void 0 ? ae(n) : void 0;
|
|
152
|
+
Tt(u, c, g, p);
|
|
153
|
+
}, St = (s, e) => s === "critical" ? !0 : s === "qa" || e ? Et() : !1, pt = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? mt : "", Tt = (s, e, t, r) => {
|
|
154
154
|
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
155
155
|
r !== void 0 ? n ? console[s](i, t, r) : console[s](i, r) : n ? console[s](i, t) : console[s](i);
|
|
156
|
-
},
|
|
156
|
+
}, ae = (s) => {
|
|
157
157
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
158
158
|
for (const [r, n] of Object.entries(s)) {
|
|
159
159
|
const i = r.toLowerCase();
|
|
@@ -161,16 +161,16 @@ const He = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
161
161
|
e[r] = "[REDACTED]";
|
|
162
162
|
continue;
|
|
163
163
|
}
|
|
164
|
-
n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] =
|
|
165
|
-
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ?
|
|
164
|
+
n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] = ae(n) : Array.isArray(n) ? e[r] = n.map(
|
|
165
|
+
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ? ae(o) : o
|
|
166
166
|
) : e[r] = n;
|
|
167
167
|
}
|
|
168
168
|
return e;
|
|
169
169
|
};
|
|
170
|
-
let
|
|
171
|
-
const
|
|
172
|
-
typeof window < "u" && !
|
|
173
|
-
}, K = "Unknown",
|
|
170
|
+
let le, Ge;
|
|
171
|
+
const _t = () => {
|
|
172
|
+
typeof window < "u" && !le && (le = window.matchMedia("(pointer: coarse)"), Ge = window.matchMedia("(hover: none)"));
|
|
173
|
+
}, K = "Unknown", vt = (s) => {
|
|
174
174
|
const e = s.userAgentData?.platform;
|
|
175
175
|
if (e != null && e !== "") {
|
|
176
176
|
if (/windows/i.test(e)) return "Windows";
|
|
@@ -182,7 +182,7 @@ const pt = () => {
|
|
|
182
182
|
}
|
|
183
183
|
const t = navigator.userAgent;
|
|
184
184
|
return /Windows/i.test(t) ? "Windows" : /iPhone|iPad|iPod/i.test(t) ? "iOS" : /Mac OS X|Macintosh/i.test(t) ? "macOS" : /Android/i.test(t) ? "Android" : /CrOS/i.test(t) ? "ChromeOS" : /Linux/i.test(t) ? "Linux" : K;
|
|
185
|
-
},
|
|
185
|
+
}, It = (s) => {
|
|
186
186
|
const e = s.userAgentData?.brands;
|
|
187
187
|
if (e != null && e.length > 0) {
|
|
188
188
|
const n = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
|
|
@@ -193,26 +193,26 @@ const pt = () => {
|
|
|
193
193
|
}
|
|
194
194
|
const t = navigator.userAgent;
|
|
195
195
|
return /Edg\//i.test(t) ? "Edge" : /OPR\//i.test(t) ? "Opera" : /Chrome/i.test(t) ? "Chrome" : /Firefox/i.test(t) ? "Firefox" : /Safari/i.test(t) && !/Chrome/i.test(t) ? "Safari" : K;
|
|
196
|
-
},
|
|
196
|
+
}, wt = () => {
|
|
197
197
|
try {
|
|
198
198
|
const s = navigator;
|
|
199
199
|
if (s.userAgentData != null && typeof s.userAgentData.mobile == "boolean") {
|
|
200
200
|
const c = s.userAgentData.platform;
|
|
201
201
|
return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet : s.userAgentData.mobile ? L.Mobile : L.Desktop;
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
const e = window.innerWidth, t =
|
|
203
|
+
_t();
|
|
204
|
+
const e = window.innerWidth, t = le?.matches ?? !1, r = Ge?.matches ?? !1, n = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), l = /tablet|ipad|android(?!.*mobile)/.test(i);
|
|
205
205
|
return e <= 767 || o && n ? L.Mobile : e >= 768 && e <= 1024 || l || t && r && n ? L.Tablet : L.Desktop;
|
|
206
206
|
} catch (s) {
|
|
207
207
|
return a("debug", "Device detection failed, defaulting to desktop", { error: s }), L.Desktop;
|
|
208
208
|
}
|
|
209
|
-
},
|
|
209
|
+
}, yt = () => {
|
|
210
210
|
try {
|
|
211
211
|
const s = navigator;
|
|
212
212
|
return {
|
|
213
|
-
type:
|
|
214
|
-
os:
|
|
215
|
-
browser:
|
|
213
|
+
type: wt(),
|
|
214
|
+
os: vt(s),
|
|
215
|
+
browser: It(s)
|
|
216
216
|
};
|
|
217
217
|
} catch (s) {
|
|
218
218
|
return a("debug", "Device info detection failed, using defaults", { error: s }), {
|
|
@@ -221,7 +221,7 @@ const pt = () => {
|
|
|
221
221
|
browser: K
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
|
-
},
|
|
224
|
+
}, Xe = [
|
|
225
225
|
// Email addresses
|
|
226
226
|
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
|
|
227
227
|
// US Phone numbers (various formats)
|
|
@@ -236,7 +236,7 @@ const pt = () => {
|
|
|
236
236
|
/Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
|
|
237
237
|
// Passwords in connection strings (protocol://user:password@host)
|
|
238
238
|
/:\/\/[^:/]+:([^@]+)@/gi
|
|
239
|
-
],
|
|
239
|
+
], Ce = 500, Ne = 5e3, Q = 50, bt = Q * 2, Qe = 1, At = 1e3, Lt = 10, Oe = 5e3, Mt = 6e4, Kr = {
|
|
240
240
|
LCP: 2500,
|
|
241
241
|
// Good: ≤ 2.5s
|
|
242
242
|
FCP: 1800,
|
|
@@ -248,7 +248,7 @@ const pt = () => {
|
|
|
248
248
|
TTFB: 800,
|
|
249
249
|
// Good: ≤ 800ms
|
|
250
250
|
LONG_TASK: 50
|
|
251
|
-
},
|
|
251
|
+
}, Pe = {
|
|
252
252
|
LCP: 2500,
|
|
253
253
|
// Needs improvement: > 2.5s (same as good boundary)
|
|
254
254
|
FCP: 1800,
|
|
@@ -260,7 +260,7 @@ const pt = () => {
|
|
|
260
260
|
TTFB: 800,
|
|
261
261
|
// Needs improvement: > 800ms
|
|
262
262
|
LONG_TASK: 50
|
|
263
|
-
},
|
|
263
|
+
}, Rt = {
|
|
264
264
|
LCP: 4e3,
|
|
265
265
|
// Poor: > 4s
|
|
266
266
|
FCP: 3e3,
|
|
@@ -272,67 +272,95 @@ const pt = () => {
|
|
|
272
272
|
TTFB: 1800,
|
|
273
273
|
// Poor: > 1800ms
|
|
274
274
|
LONG_TASK: 50
|
|
275
|
-
},
|
|
275
|
+
}, ce = "needs-improvement", De = (s = ce) => {
|
|
276
276
|
switch (s) {
|
|
277
277
|
case "all":
|
|
278
278
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
|
|
279
279
|
// Track everything
|
|
280
280
|
case "needs-improvement":
|
|
281
|
-
return
|
|
281
|
+
return Pe;
|
|
282
282
|
case "poor":
|
|
283
|
-
return
|
|
283
|
+
return Rt;
|
|
284
284
|
default:
|
|
285
|
-
return
|
|
285
|
+
return Pe;
|
|
286
286
|
}
|
|
287
|
-
},
|
|
287
|
+
}, Ct = 1e3, Nt = 50, Ot = "2.1.1", Pt = Ot, je = () => typeof window < "u" && typeof sessionStorage < "u", Dt = () => {
|
|
288
288
|
try {
|
|
289
289
|
const s = new URLSearchParams(window.location.search);
|
|
290
|
-
s.delete(
|
|
290
|
+
s.delete($e);
|
|
291
291
|
const e = s.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
|
|
292
292
|
window.history.replaceState({}, "", t);
|
|
293
293
|
} catch {
|
|
294
294
|
}
|
|
295
|
-
},
|
|
296
|
-
if (!
|
|
295
|
+
}, kt = () => {
|
|
296
|
+
if (!je())
|
|
297
297
|
return !1;
|
|
298
298
|
try {
|
|
299
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
299
|
+
const e = new URLSearchParams(window.location.search).get($e), t = sessionStorage.getItem(x);
|
|
300
300
|
let r = null;
|
|
301
|
-
return e ===
|
|
301
|
+
return e === we ? (r = !0, sessionStorage.setItem(x, "true"), a("info", "QA Mode ACTIVE", {
|
|
302
302
|
visibility: "qa",
|
|
303
|
-
style:
|
|
304
|
-
})) : e ===
|
|
303
|
+
style: Be
|
|
304
|
+
})) : e === ye && (r = !1, sessionStorage.setItem(x, "false"), a("info", "QA Mode DISABLED", {
|
|
305
305
|
visibility: "qa",
|
|
306
|
-
style:
|
|
307
|
-
})), (e ===
|
|
306
|
+
style: We
|
|
307
|
+
})), (e === we || e === ye) && Dt(), r ?? t === "true";
|
|
308
308
|
} catch {
|
|
309
309
|
return !1;
|
|
310
310
|
}
|
|
311
|
-
},
|
|
312
|
-
if (
|
|
311
|
+
}, Vt = (s) => {
|
|
312
|
+
if (je())
|
|
313
313
|
try {
|
|
314
314
|
sessionStorage.setItem(x, s ? "true" : "false"), a("info", s ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
315
315
|
visibility: "qa",
|
|
316
|
-
style: s ?
|
|
316
|
+
style: s ? Be : We
|
|
317
317
|
});
|
|
318
318
|
} catch {
|
|
319
319
|
a("debug", "Cannot set QA mode: sessionStorage unavailable");
|
|
320
320
|
}
|
|
321
|
-
},
|
|
321
|
+
}, Ut = [
|
|
322
|
+
"co.uk",
|
|
323
|
+
"org.uk",
|
|
324
|
+
"com.au",
|
|
325
|
+
"net.au",
|
|
326
|
+
"com.br",
|
|
327
|
+
"co.nz",
|
|
328
|
+
"co.jp",
|
|
329
|
+
"com.mx",
|
|
330
|
+
"co.in",
|
|
331
|
+
"com.cn",
|
|
332
|
+
"co.za"
|
|
333
|
+
], ke = (s) => {
|
|
334
|
+
const e = s.toLowerCase().split(".");
|
|
335
|
+
if (e.length <= 2)
|
|
336
|
+
return s.toLowerCase();
|
|
337
|
+
const t = e.slice(-2).join(".");
|
|
338
|
+
return Ut.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
339
|
+
}, xt = (s, e) => s === e ? !0 : ke(s) === ke(e), te = () => {
|
|
340
|
+
const s = document.referrer;
|
|
341
|
+
if (!s)
|
|
342
|
+
return "Direct";
|
|
343
|
+
try {
|
|
344
|
+
const e = new URL(s).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
|
|
345
|
+
return xt(e, t) ? "Direct" : s;
|
|
346
|
+
} catch (e) {
|
|
347
|
+
return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: s } }), s;
|
|
348
|
+
}
|
|
349
|
+
}, re = () => {
|
|
322
350
|
const s = new URLSearchParams(window.location.search), e = {};
|
|
323
|
-
return
|
|
351
|
+
return at.forEach((r) => {
|
|
324
352
|
const n = s.get(r);
|
|
325
353
|
if (n) {
|
|
326
354
|
const i = r.split("utm_")[1];
|
|
327
355
|
e[i] = n;
|
|
328
356
|
}
|
|
329
357
|
}), Object.keys(e).length ? e : void 0;
|
|
330
|
-
},
|
|
358
|
+
}, Ht = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (s) => {
|
|
331
359
|
const e = Math.random() * 16 | 0;
|
|
332
360
|
return (s === "x" ? e : e & 3 | 8).toString(16);
|
|
333
361
|
});
|
|
334
362
|
let B = 0, W = 0;
|
|
335
|
-
const
|
|
363
|
+
const Ft = () => {
|
|
336
364
|
let s = Date.now();
|
|
337
365
|
s < W && (s = W), s === W ? B = (B + 1) % 1e3 : B = 0, W = s;
|
|
338
366
|
const e = B.toString().padStart(3, "0");
|
|
@@ -345,14 +373,14 @@ const kt = () => {
|
|
|
345
373
|
} catch {
|
|
346
374
|
}
|
|
347
375
|
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${s}-${e}-${t}`;
|
|
348
|
-
},
|
|
376
|
+
}, ze = (s, e = !1) => {
|
|
349
377
|
try {
|
|
350
378
|
const t = new URL(s), r = t.protocol === "https:", n = t.protocol === "http:";
|
|
351
379
|
return r || e && n;
|
|
352
380
|
} catch {
|
|
353
381
|
return !1;
|
|
354
382
|
}
|
|
355
|
-
},
|
|
383
|
+
}, $t = (s) => {
|
|
356
384
|
try {
|
|
357
385
|
const t = new URL(window.location.href).hostname;
|
|
358
386
|
if (!t || typeof t != "string")
|
|
@@ -370,28 +398,28 @@ const kt = () => {
|
|
|
370
398
|
if (r.length === 2 ? n = r.join(".") : n = r.slice(-2).join("."), !n || n.split(".").length < 2)
|
|
371
399
|
throw new Error("Invalid domain structure for SaaS");
|
|
372
400
|
const i = `https://${s}.${n}/collect`;
|
|
373
|
-
if (!
|
|
401
|
+
if (!ze(i))
|
|
374
402
|
throw new Error("Generated URL failed validation");
|
|
375
403
|
return i;
|
|
376
404
|
} catch (e) {
|
|
377
405
|
throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
|
|
378
406
|
}
|
|
379
|
-
},
|
|
407
|
+
}, Bt = (s) => {
|
|
380
408
|
const e = {};
|
|
381
|
-
s.integrations?.tracelog?.projectId && (e.saas =
|
|
409
|
+
s.integrations?.tracelog?.projectId && (e.saas = $t(s.integrations.tracelog.projectId));
|
|
382
410
|
const t = s.integrations?.custom?.collectApiUrl;
|
|
383
411
|
if (t) {
|
|
384
412
|
const r = s.integrations?.custom?.allowHttp ?? !1;
|
|
385
|
-
if (!
|
|
413
|
+
if (!ze(t, r))
|
|
386
414
|
throw new Error("Invalid custom API URL");
|
|
387
415
|
e.custom = t;
|
|
388
416
|
}
|
|
389
417
|
return e;
|
|
390
|
-
},
|
|
418
|
+
}, ue = (s, e = []) => {
|
|
391
419
|
if (!s || typeof s != "string")
|
|
392
420
|
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof s } }), s || "";
|
|
393
421
|
try {
|
|
394
|
-
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...
|
|
422
|
+
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...lt, ...e])];
|
|
395
423
|
let i = !1;
|
|
396
424
|
const o = [];
|
|
397
425
|
return n.forEach((c) => {
|
|
@@ -400,13 +428,13 @@ const kt = () => {
|
|
|
400
428
|
} catch (t) {
|
|
401
429
|
return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: s?.length } }), s;
|
|
402
430
|
}
|
|
403
|
-
},
|
|
431
|
+
}, Ve = (s) => {
|
|
404
432
|
if (!s || typeof s != "string" || s.trim().length === 0)
|
|
405
433
|
return "";
|
|
406
434
|
let e = s;
|
|
407
435
|
s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
|
|
408
436
|
let t = 0;
|
|
409
|
-
for (const n of
|
|
437
|
+
for (const n of ct) {
|
|
410
438
|
const i = e;
|
|
411
439
|
e = e.replace(n, ""), i !== e && t++;
|
|
412
440
|
}
|
|
@@ -416,48 +444,48 @@ const kt = () => {
|
|
|
416
444
|
valueLength: s.length
|
|
417
445
|
}
|
|
418
446
|
}), e = e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'").replaceAll("/", "/"), e.trim();
|
|
419
|
-
},
|
|
447
|
+
}, de = (s, e = 0) => {
|
|
420
448
|
if (e > 3 || s == null)
|
|
421
449
|
return null;
|
|
422
450
|
if (typeof s == "string")
|
|
423
|
-
return
|
|
451
|
+
return Ve(s);
|
|
424
452
|
if (typeof s == "number")
|
|
425
453
|
return !Number.isFinite(s) || s < -Number.MAX_SAFE_INTEGER || s > Number.MAX_SAFE_INTEGER ? 0 : s;
|
|
426
454
|
if (typeof s == "boolean")
|
|
427
455
|
return s;
|
|
428
456
|
if (Array.isArray(s))
|
|
429
|
-
return s.slice(0, 100).map((n) =>
|
|
457
|
+
return s.slice(0, 100).map((n) => de(n, e + 1)).filter((n) => n !== null);
|
|
430
458
|
if (typeof s == "object") {
|
|
431
459
|
const t = {}, n = Object.entries(s).slice(0, 20);
|
|
432
460
|
for (const [i, o] of n) {
|
|
433
|
-
const l =
|
|
461
|
+
const l = Ve(i);
|
|
434
462
|
if (l) {
|
|
435
|
-
const c =
|
|
463
|
+
const c = de(o, e + 1);
|
|
436
464
|
c !== null && (t[l] = c);
|
|
437
465
|
}
|
|
438
466
|
}
|
|
439
467
|
return t;
|
|
440
468
|
}
|
|
441
469
|
return null;
|
|
442
|
-
},
|
|
470
|
+
}, Wt = (s) => {
|
|
443
471
|
if (typeof s != "object" || s === null)
|
|
444
472
|
return {};
|
|
445
473
|
try {
|
|
446
|
-
const e =
|
|
474
|
+
const e = de(s);
|
|
447
475
|
return typeof e == "object" && e !== null ? e : {};
|
|
448
476
|
} catch (e) {
|
|
449
477
|
const t = e instanceof Error ? e.message : String(e);
|
|
450
478
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
451
479
|
}
|
|
452
|
-
},
|
|
480
|
+
}, Gt = (s) => {
|
|
453
481
|
if (s !== void 0 && (s === null || typeof s != "object"))
|
|
454
482
|
throw new h("Configuration must be an object", "config");
|
|
455
483
|
if (s) {
|
|
456
484
|
if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
|
|
457
|
-
throw new
|
|
485
|
+
throw new ft(m.INVALID_SESSION_TIMEOUT, "config");
|
|
458
486
|
if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
|
|
459
487
|
throw new h(m.INVALID_GLOBAL_METADATA, "config");
|
|
460
|
-
if (s.integrations &&
|
|
488
|
+
if (s.integrations && Qt(s.integrations), s.sensitiveQueryParams !== void 0) {
|
|
461
489
|
if (!Array.isArray(s.sensitiveQueryParams))
|
|
462
490
|
throw new h(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
463
491
|
for (const e of s.sensitiveQueryParams)
|
|
@@ -465,9 +493,9 @@ const kt = () => {
|
|
|
465
493
|
throw new h("All sensitive query params must be strings", "config");
|
|
466
494
|
}
|
|
467
495
|
if (s.errorSampling !== void 0 && (typeof s.errorSampling != "number" || s.errorSampling < 0 || s.errorSampling > 1))
|
|
468
|
-
throw new
|
|
496
|
+
throw new Re(m.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
469
497
|
if (s.samplingRate !== void 0 && (typeof s.samplingRate != "number" || s.samplingRate < 0 || s.samplingRate > 1))
|
|
470
|
-
throw new
|
|
498
|
+
throw new Re(m.INVALID_SAMPLING_RATE, "config");
|
|
471
499
|
if (s.primaryScrollSelector !== void 0) {
|
|
472
500
|
if (typeof s.primaryScrollSelector != "string" || !s.primaryScrollSelector.trim())
|
|
473
501
|
throw new h(m.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
@@ -487,7 +515,7 @@ const kt = () => {
|
|
|
487
515
|
throw new h(m.INVALID_CLICK_THROTTLE, "config");
|
|
488
516
|
if (s.maxSameEventPerMinute !== void 0 && (typeof s.maxSameEventPerMinute != "number" || s.maxSameEventPerMinute <= 0))
|
|
489
517
|
throw new h(m.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
|
|
490
|
-
if (s.viewport !== void 0 &&
|
|
518
|
+
if (s.viewport !== void 0 && Xt(s.viewport), s.webVitalsMode !== void 0) {
|
|
491
519
|
if (typeof s.webVitalsMode != "string")
|
|
492
520
|
throw new h(
|
|
493
521
|
`Invalid webVitalsMode type: ${typeof s.webVitalsMode}. Must be a string`,
|
|
@@ -518,7 +546,7 @@ const kt = () => {
|
|
|
518
546
|
}
|
|
519
547
|
}
|
|
520
548
|
}
|
|
521
|
-
},
|
|
549
|
+
}, Xt = (s) => {
|
|
522
550
|
if (typeof s != "object" || s === null)
|
|
523
551
|
throw new h(m.INVALID_VIEWPORT_CONFIG, "config");
|
|
524
552
|
if (!s.elements || !Array.isArray(s.elements))
|
|
@@ -548,33 +576,33 @@ const kt = () => {
|
|
|
548
576
|
throw new h(m.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
549
577
|
if (s.maxTrackedElements !== void 0 && (typeof s.maxTrackedElements != "number" || s.maxTrackedElements <= 0))
|
|
550
578
|
throw new h(m.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
551
|
-
},
|
|
579
|
+
}, Qt = (s) => {
|
|
552
580
|
if (s) {
|
|
553
581
|
if (s.tracelog && (!s.tracelog.projectId || typeof s.tracelog.projectId != "string" || s.tracelog.projectId.trim() === ""))
|
|
554
|
-
throw new
|
|
582
|
+
throw new k(m.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
555
583
|
if (s.custom) {
|
|
556
584
|
if (!s.custom.collectApiUrl || typeof s.custom.collectApiUrl != "string" || s.custom.collectApiUrl.trim() === "")
|
|
557
|
-
throw new
|
|
585
|
+
throw new k(m.INVALID_CUSTOM_API_URL, "config");
|
|
558
586
|
if (s.custom.allowHttp !== void 0 && typeof s.custom.allowHttp != "boolean")
|
|
559
|
-
throw new
|
|
587
|
+
throw new k("allowHttp must be a boolean", "config");
|
|
560
588
|
const e = s.custom.collectApiUrl.trim();
|
|
561
589
|
if (!e.startsWith("http://") && !e.startsWith("https://"))
|
|
562
|
-
throw new
|
|
590
|
+
throw new k('Custom API URL must start with "http://" or "https://"', "config");
|
|
563
591
|
if (!(s.custom.allowHttp ?? !1) && e.startsWith("http://"))
|
|
564
|
-
throw new
|
|
592
|
+
throw new k(
|
|
565
593
|
"Custom API URL must use HTTPS in production. Set allowHttp: true in integration config to allow HTTP (not recommended)",
|
|
566
594
|
"config"
|
|
567
595
|
);
|
|
568
596
|
}
|
|
569
597
|
}
|
|
570
|
-
},
|
|
571
|
-
|
|
598
|
+
}, jt = (s) => {
|
|
599
|
+
Gt(s);
|
|
572
600
|
const e = {
|
|
573
601
|
...s ?? {},
|
|
574
602
|
sessionTimeout: s?.sessionTimeout ?? 9e5,
|
|
575
603
|
globalMetadata: s?.globalMetadata ?? {},
|
|
576
604
|
sensitiveQueryParams: s?.sensitiveQueryParams ?? [],
|
|
577
|
-
errorSampling: s?.errorSampling ??
|
|
605
|
+
errorSampling: s?.errorSampling ?? Qe,
|
|
578
606
|
samplingRate: s?.samplingRate ?? 1,
|
|
579
607
|
pageViewThrottleMs: s?.pageViewThrottleMs ?? 1e3,
|
|
580
608
|
clickThrottleMs: s?.clickThrottleMs ?? 300,
|
|
@@ -590,7 +618,7 @@ const kt = () => {
|
|
|
590
618
|
cooldownPeriod: e.viewport.cooldownPeriod ?? 6e4,
|
|
591
619
|
maxTrackedElements: e.viewport.maxTrackedElements ?? 100
|
|
592
620
|
}), e;
|
|
593
|
-
},
|
|
621
|
+
}, zt = (s) => {
|
|
594
622
|
if (typeof s == "string")
|
|
595
623
|
return !0;
|
|
596
624
|
if (typeof s == "object" && s !== null && !Array.isArray(s)) {
|
|
@@ -607,7 +635,7 @@ const kt = () => {
|
|
|
607
635
|
return !0;
|
|
608
636
|
}
|
|
609
637
|
return !1;
|
|
610
|
-
},
|
|
638
|
+
}, Ke = (s, e = 0) => {
|
|
611
639
|
if (typeof s != "object" || s === null || e > 1)
|
|
612
640
|
return !1;
|
|
613
641
|
for (const t of Object.values(s)) {
|
|
@@ -621,12 +649,12 @@ const kt = () => {
|
|
|
621
649
|
if (typeof t[0] == "string") {
|
|
622
650
|
if (!t.every((o) => typeof o == "string"))
|
|
623
651
|
return !1;
|
|
624
|
-
} else if (!t.every((o) =>
|
|
652
|
+
} else if (!t.every((o) => zt(o)))
|
|
625
653
|
return !1;
|
|
626
654
|
continue;
|
|
627
655
|
}
|
|
628
656
|
if (r === "object" && e === 0) {
|
|
629
|
-
if (!
|
|
657
|
+
if (!Ke(t, e + 1))
|
|
630
658
|
return !1;
|
|
631
659
|
continue;
|
|
632
660
|
}
|
|
@@ -634,7 +662,7 @@ const kt = () => {
|
|
|
634
662
|
}
|
|
635
663
|
}
|
|
636
664
|
return !0;
|
|
637
|
-
},
|
|
665
|
+
}, Kt = (s) => typeof s != "string" ? {
|
|
638
666
|
valid: !1,
|
|
639
667
|
error: "Event name must be a string"
|
|
640
668
|
} : s.length === 0 ? {
|
|
@@ -649,9 +677,9 @@ const kt = () => {
|
|
|
649
677
|
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(s.toLowerCase()) ? {
|
|
650
678
|
valid: !1,
|
|
651
679
|
error: "Event name cannot be a reserved word"
|
|
652
|
-
} : { valid: !0 },
|
|
653
|
-
const r =
|
|
654
|
-
if (!
|
|
680
|
+
} : { valid: !0 }, Ue = (s, e, t) => {
|
|
681
|
+
const r = Wt(e), n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
682
|
+
if (!Ke(r))
|
|
655
683
|
return {
|
|
656
684
|
valid: !1,
|
|
657
685
|
error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
|
|
@@ -699,7 +727,7 @@ const kt = () => {
|
|
|
699
727
|
valid: !0,
|
|
700
728
|
sanitizedMetadata: r
|
|
701
729
|
};
|
|
702
|
-
},
|
|
730
|
+
}, Ye = (s, e, t) => {
|
|
703
731
|
if (Array.isArray(e)) {
|
|
704
732
|
const r = [], n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
705
733
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -709,7 +737,7 @@ const kt = () => {
|
|
|
709
737
|
valid: !1,
|
|
710
738
|
error: `${n}: array item at index ${i} must be an object.`
|
|
711
739
|
};
|
|
712
|
-
const l =
|
|
740
|
+
const l = Ue(s, o, t);
|
|
713
741
|
if (!l.valid)
|
|
714
742
|
return {
|
|
715
743
|
valid: !1,
|
|
@@ -722,16 +750,16 @@ const kt = () => {
|
|
|
722
750
|
sanitizedMetadata: r
|
|
723
751
|
};
|
|
724
752
|
}
|
|
725
|
-
return
|
|
726
|
-
},
|
|
727
|
-
const t =
|
|
753
|
+
return Ue(s, e, t);
|
|
754
|
+
}, Yt = (s, e) => {
|
|
755
|
+
const t = Kt(s);
|
|
728
756
|
if (!t.valid)
|
|
729
757
|
return a("error", "Event name validation failed", {
|
|
730
758
|
data: { eventName: s, error: t.error }
|
|
731
759
|
}), t;
|
|
732
760
|
if (!e)
|
|
733
761
|
return { valid: !0 };
|
|
734
|
-
const r =
|
|
762
|
+
const r = Ye(s, e, "customEvent");
|
|
735
763
|
return r.valid || a("error", "Event metadata validation failed", {
|
|
736
764
|
data: {
|
|
737
765
|
eventName: s,
|
|
@@ -739,7 +767,7 @@ const kt = () => {
|
|
|
739
767
|
}
|
|
740
768
|
}), r;
|
|
741
769
|
};
|
|
742
|
-
class
|
|
770
|
+
class qt {
|
|
743
771
|
listeners = /* @__PURE__ */ new Map();
|
|
744
772
|
/**
|
|
745
773
|
* Subscribes to an event channel
|
|
@@ -856,7 +884,7 @@ class zt {
|
|
|
856
884
|
this.listeners.clear();
|
|
857
885
|
}
|
|
858
886
|
}
|
|
859
|
-
function
|
|
887
|
+
function qe(s, e, t) {
|
|
860
888
|
try {
|
|
861
889
|
const r = e(s);
|
|
862
890
|
return r === null ? null : typeof r == "object" && r !== null && "type" in r ? r : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), s);
|
|
@@ -867,10 +895,10 @@ function je(s, e, t) {
|
|
|
867
895
|
}), s;
|
|
868
896
|
}
|
|
869
897
|
}
|
|
870
|
-
function
|
|
871
|
-
return s.map((r) =>
|
|
898
|
+
function Jt(s, e, t) {
|
|
899
|
+
return s.map((r) => qe(r, e, t)).filter((r) => r !== null);
|
|
872
900
|
}
|
|
873
|
-
function
|
|
901
|
+
function Je(s, e, t) {
|
|
874
902
|
try {
|
|
875
903
|
const r = e(s);
|
|
876
904
|
return r === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
|
|
@@ -886,7 +914,7 @@ function Ke(s, e, t) {
|
|
|
886
914
|
}), s;
|
|
887
915
|
}
|
|
888
916
|
}
|
|
889
|
-
const
|
|
917
|
+
const se = {};
|
|
890
918
|
class _ {
|
|
891
919
|
/**
|
|
892
920
|
* Retrieves a value from global state.
|
|
@@ -905,7 +933,7 @@ class _ {
|
|
|
905
933
|
* ```
|
|
906
934
|
*/
|
|
907
935
|
get(e) {
|
|
908
|
-
return
|
|
936
|
+
return se[e];
|
|
909
937
|
}
|
|
910
938
|
/**
|
|
911
939
|
* Sets a value in global state.
|
|
@@ -925,7 +953,7 @@ class _ {
|
|
|
925
953
|
* ```
|
|
926
954
|
*/
|
|
927
955
|
set(e, t) {
|
|
928
|
-
|
|
956
|
+
se[e] = t;
|
|
929
957
|
}
|
|
930
958
|
/**
|
|
931
959
|
* Returns an immutable snapshot of the entire global state.
|
|
@@ -942,10 +970,10 @@ class _ {
|
|
|
942
970
|
* ```
|
|
943
971
|
*/
|
|
944
972
|
getState() {
|
|
945
|
-
return { ...
|
|
973
|
+
return { ...se };
|
|
946
974
|
}
|
|
947
975
|
}
|
|
948
|
-
class
|
|
976
|
+
class xe extends _ {
|
|
949
977
|
storeManager;
|
|
950
978
|
integrationId;
|
|
951
979
|
apiUrl;
|
|
@@ -979,7 +1007,7 @@ class Ve extends _ {
|
|
|
979
1007
|
return this.integrationId;
|
|
980
1008
|
}
|
|
981
1009
|
getQueueStorageKey() {
|
|
982
|
-
const e = this.get("userId") || "anonymous", t =
|
|
1010
|
+
const e = this.get("userId") || "anonymous", t = ut(e);
|
|
983
1011
|
return this.integrationId ? `${t}:${this.integrationId}` : t;
|
|
984
1012
|
}
|
|
985
1013
|
/**
|
|
@@ -1011,13 +1039,13 @@ class Ve extends _ {
|
|
|
1011
1039
|
* @see src/managers/README.md (lines 82-139) for send details
|
|
1012
1040
|
*/
|
|
1013
1041
|
sendEventsQueueSync(e) {
|
|
1014
|
-
return this.shouldSkipSend() ? !0 : this.apiUrl?.includes(
|
|
1042
|
+
return this.shouldSkipSend() ? !0 : this.apiUrl?.includes(V.Fail) ? (a(
|
|
1015
1043
|
"warn",
|
|
1016
1044
|
`Fail mode: simulating network failure (sync)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
|
|
1017
1045
|
{
|
|
1018
1046
|
data: { events: e.events.length }
|
|
1019
1047
|
}
|
|
1020
|
-
), !1) : this.apiUrl?.includes(
|
|
1048
|
+
), !1) : this.apiUrl?.includes(V.Localhost) ? (a(
|
|
1021
1049
|
"debug",
|
|
1022
1050
|
`Success mode: simulating successful send (sync)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
|
|
1023
1051
|
{
|
|
@@ -1180,7 +1208,7 @@ class Ve extends _ {
|
|
|
1180
1208
|
const t = this.transformers.beforeSend;
|
|
1181
1209
|
if (!t)
|
|
1182
1210
|
return e;
|
|
1183
|
-
const r =
|
|
1211
|
+
const r = Jt(
|
|
1184
1212
|
e.events,
|
|
1185
1213
|
t,
|
|
1186
1214
|
this.integrationId || "SenderManager"
|
|
@@ -1225,7 +1253,7 @@ class Ve extends _ {
|
|
|
1225
1253
|
if (this.integrationId === "saas")
|
|
1226
1254
|
return e;
|
|
1227
1255
|
const t = this.transformers.beforeBatch;
|
|
1228
|
-
return t ?
|
|
1256
|
+
return t ? Je(e, t, this.integrationId || "SenderManager") : e;
|
|
1229
1257
|
}
|
|
1230
1258
|
/**
|
|
1231
1259
|
* Calculates exponential backoff delay with jitter for retry attempts.
|
|
@@ -1293,11 +1321,11 @@ class Ve extends _ {
|
|
|
1293
1321
|
const r = this.applyBeforeBatchTransformer(t);
|
|
1294
1322
|
if (!r)
|
|
1295
1323
|
return !0;
|
|
1296
|
-
if (this.apiUrl?.includes(
|
|
1324
|
+
if (this.apiUrl?.includes(V.Fail))
|
|
1297
1325
|
return a("debug", `Fail mode: simulating network failure${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1298
1326
|
data: { events: r.events.length }
|
|
1299
1327
|
}), !1;
|
|
1300
|
-
if (this.apiUrl?.includes(
|
|
1328
|
+
if (this.apiUrl?.includes(V.Localhost))
|
|
1301
1329
|
return a("debug", `Success mode: simulating successful send${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1302
1330
|
data: { events: r.events.length }
|
|
1303
1331
|
}), !0;
|
|
@@ -1458,7 +1486,7 @@ class Ve extends _ {
|
|
|
1458
1486
|
_metadata: {
|
|
1459
1487
|
referer: typeof window < "u" ? window.location.href : void 0,
|
|
1460
1488
|
timestamp: t,
|
|
1461
|
-
client_version:
|
|
1489
|
+
client_version: Pt
|
|
1462
1490
|
}
|
|
1463
1491
|
};
|
|
1464
1492
|
return {
|
|
@@ -1579,12 +1607,12 @@ class Ve extends _ {
|
|
|
1579
1607
|
}
|
|
1580
1608
|
logPermanentError(e, t) {
|
|
1581
1609
|
const r = Date.now();
|
|
1582
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >=
|
|
1610
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >= Mt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1583
1611
|
data: { status: t.statusCode, message: t.message }
|
|
1584
1612
|
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: r });
|
|
1585
1613
|
}
|
|
1586
1614
|
}
|
|
1587
|
-
class
|
|
1615
|
+
class Zt extends _ {
|
|
1588
1616
|
bootTime;
|
|
1589
1617
|
bootTimestamp;
|
|
1590
1618
|
hasPerformanceNow;
|
|
@@ -1733,7 +1761,7 @@ class Kt extends _ {
|
|
|
1733
1761
|
};
|
|
1734
1762
|
}
|
|
1735
1763
|
}
|
|
1736
|
-
class
|
|
1764
|
+
class er extends _ {
|
|
1737
1765
|
dataSenders;
|
|
1738
1766
|
emitter;
|
|
1739
1767
|
transformers;
|
|
@@ -1767,9 +1795,9 @@ class Yt extends _ {
|
|
|
1767
1795
|
* @param transformers - Optional event transformation hooks
|
|
1768
1796
|
*/
|
|
1769
1797
|
constructor(e, t = null, r = {}) {
|
|
1770
|
-
super(), this.emitter = t, this.transformers = r, this.timeManager = new
|
|
1798
|
+
super(), this.emitter = t, this.transformers = r, this.timeManager = new Zt(), this.dataSenders = [];
|
|
1771
1799
|
const n = this.get("collectApiUrls");
|
|
1772
|
-
n?.saas && this.dataSenders.push(new
|
|
1800
|
+
n?.saas && this.dataSenders.push(new xe(e, "saas", n.saas, r)), n?.custom && this.dataSenders.push(new xe(e, "custom", n.custom, r)), this.saveSessionCountsDebounced = this.debounce((i) => {
|
|
1773
1801
|
this.saveSessionCounts(i);
|
|
1774
1802
|
}, 500), this.cleanupExpiredSessionCounts();
|
|
1775
1803
|
}
|
|
@@ -1907,30 +1935,30 @@ class Yt extends _ {
|
|
|
1907
1935
|
return;
|
|
1908
1936
|
}
|
|
1909
1937
|
this.lastSessionId !== g && (this.lastSessionId = g, this.sessionEventCounts = this.loadSessionCounts(g));
|
|
1910
|
-
const
|
|
1911
|
-
if (
|
|
1938
|
+
const p = e === d.SESSION_START;
|
|
1939
|
+
if (p && a("debug", "Processing SESSION_START event", {
|
|
1912
1940
|
data: { sessionId: g }
|
|
1913
|
-
}), !
|
|
1941
|
+
}), !p && !this.checkRateLimit())
|
|
1914
1942
|
return;
|
|
1915
|
-
const
|
|
1916
|
-
if (!
|
|
1943
|
+
const E = e;
|
|
1944
|
+
if (!p) {
|
|
1917
1945
|
if (this.sessionEventCounts.total >= 1e3) {
|
|
1918
1946
|
a("warn", "Session event limit reached", {
|
|
1919
1947
|
data: {
|
|
1920
|
-
type:
|
|
1948
|
+
type: E,
|
|
1921
1949
|
total: this.sessionEventCounts.total,
|
|
1922
1950
|
limit: 1e3
|
|
1923
1951
|
}
|
|
1924
1952
|
});
|
|
1925
1953
|
return;
|
|
1926
1954
|
}
|
|
1927
|
-
const T = this.getTypeLimitForEvent(
|
|
1955
|
+
const T = this.getTypeLimitForEvent(E);
|
|
1928
1956
|
if (T) {
|
|
1929
|
-
const ee = this.sessionEventCounts[
|
|
1957
|
+
const ee = this.sessionEventCounts[E];
|
|
1930
1958
|
if (ee !== void 0 && ee >= T) {
|
|
1931
1959
|
a("warn", "Session event type limit reached", {
|
|
1932
1960
|
data: {
|
|
1933
|
-
type:
|
|
1961
|
+
type: E,
|
|
1934
1962
|
count: ee,
|
|
1935
1963
|
limit: T
|
|
1936
1964
|
}
|
|
@@ -1939,14 +1967,14 @@ class Yt extends _ {
|
|
|
1939
1967
|
}
|
|
1940
1968
|
}
|
|
1941
1969
|
}
|
|
1942
|
-
if (
|
|
1970
|
+
if (E === d.CUSTOM && o?.name) {
|
|
1943
1971
|
const T = this.get("config")?.maxSameEventPerMinute ?? 60;
|
|
1944
1972
|
if (!this.checkPerEventRateLimit(o.name, T))
|
|
1945
1973
|
return;
|
|
1946
1974
|
}
|
|
1947
|
-
const
|
|
1948
|
-
type:
|
|
1949
|
-
page_url:
|
|
1975
|
+
const ve = E === d.SESSION_START, $ = t || this.get("pageUrl"), D = this.buildEventPayload({
|
|
1976
|
+
type: E,
|
|
1977
|
+
page_url: $,
|
|
1950
1978
|
from_page_url: r,
|
|
1951
1979
|
scroll_data: n,
|
|
1952
1980
|
click_data: i,
|
|
@@ -1956,8 +1984,8 @@ class Yt extends _ {
|
|
|
1956
1984
|
viewport_data: u,
|
|
1957
1985
|
page_view: S
|
|
1958
1986
|
});
|
|
1959
|
-
if (D && !(!
|
|
1960
|
-
if (
|
|
1987
|
+
if (D && !(!p && !this.shouldSample())) {
|
|
1988
|
+
if (ve) {
|
|
1961
1989
|
const T = this.get("sessionId");
|
|
1962
1990
|
if (!T) {
|
|
1963
1991
|
a("error", "Session start event requires sessionId - event will be ignored");
|
|
@@ -1972,8 +2000,8 @@ class Yt extends _ {
|
|
|
1972
2000
|
this.set("hasStartSession", !0);
|
|
1973
2001
|
}
|
|
1974
2002
|
if (!this.isDuplicateEvent(D)) {
|
|
1975
|
-
if (this.get("mode") ===
|
|
1976
|
-
if (
|
|
2003
|
+
if (this.get("mode") === z.QA) {
|
|
2004
|
+
if (E === d.CUSTOM && o) {
|
|
1977
2005
|
a("info", `Custom Event: ${o.name}`, {
|
|
1978
2006
|
visibility: "qa",
|
|
1979
2007
|
data: {
|
|
@@ -1983,7 +2011,7 @@ class Yt extends _ {
|
|
|
1983
2011
|
}), this.emitEvent(D);
|
|
1984
2012
|
return;
|
|
1985
2013
|
}
|
|
1986
|
-
if (
|
|
2014
|
+
if (E === d.VIEWPORT_VISIBLE && u) {
|
|
1987
2015
|
const T = u.name || u.id || u.selector;
|
|
1988
2016
|
a("info", `Viewport Visible: ${T}`, {
|
|
1989
2017
|
visibility: "qa",
|
|
@@ -1998,8 +2026,8 @@ class Yt extends _ {
|
|
|
1998
2026
|
return;
|
|
1999
2027
|
}
|
|
2000
2028
|
}
|
|
2001
|
-
if (this.addToQueue(D), !
|
|
2002
|
-
this.sessionEventCounts.total++, this.sessionEventCounts[
|
|
2029
|
+
if (this.addToQueue(D), !p) {
|
|
2030
|
+
this.sessionEventCounts.total++, this.sessionEventCounts[E] !== void 0 && this.sessionEventCounts[E]++;
|
|
2003
2031
|
const T = this.get("sessionId");
|
|
2004
2032
|
T && this.saveSessionCountsDebounced && this.saveSessionCountsDebounced(T);
|
|
2005
2033
|
}
|
|
@@ -2315,22 +2343,23 @@ class Yt extends _ {
|
|
|
2315
2343
|
};
|
|
2316
2344
|
const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
|
|
2317
2345
|
if (!o && l) {
|
|
2318
|
-
const c =
|
|
2346
|
+
const c = Je(n, l, "EventManager");
|
|
2319
2347
|
c !== null && (n = c);
|
|
2320
2348
|
}
|
|
2321
2349
|
return n;
|
|
2322
2350
|
}
|
|
2323
2351
|
buildEventPayload(e) {
|
|
2324
|
-
const t = e.
|
|
2325
|
-
|
|
2326
|
-
data: { type: e.type, error:
|
|
2352
|
+
const t = e.page_url ?? this.get("pageUrl"), r = this.timeManager.now(), n = this.timeManager.validateTimestamp(r);
|
|
2353
|
+
n.valid || a("warn", "Event timestamp validation failed", {
|
|
2354
|
+
data: { type: e.type, error: n.error }
|
|
2327
2355
|
});
|
|
2328
|
-
|
|
2329
|
-
|
|
2356
|
+
const i = this.get("sessionReferrer"), o = this.get("sessionUtm");
|
|
2357
|
+
let l = {
|
|
2358
|
+
id: Ft(),
|
|
2330
2359
|
type: e.type,
|
|
2331
|
-
page_url:
|
|
2332
|
-
timestamp:
|
|
2333
|
-
...
|
|
2360
|
+
page_url: t,
|
|
2361
|
+
timestamp: r,
|
|
2362
|
+
...i && { referrer: i },
|
|
2334
2363
|
...e.from_page_url && { from_page_url: e.from_page_url },
|
|
2335
2364
|
...e.scroll_data && { scroll_data: e.scroll_data },
|
|
2336
2365
|
...e.click_data && { click_data: e.click_data },
|
|
@@ -2339,16 +2368,16 @@ class Yt extends _ {
|
|
|
2339
2368
|
...e.error_data && { error_data: e.error_data },
|
|
2340
2369
|
...e.viewport_data && { viewport_data: e.viewport_data },
|
|
2341
2370
|
...e.page_view && { page_view: e.page_view },
|
|
2342
|
-
...
|
|
2371
|
+
...o && { utm: o }
|
|
2343
2372
|
};
|
|
2344
|
-
const
|
|
2345
|
-
if (E && (!
|
|
2346
|
-
const $ =
|
|
2373
|
+
const c = this.get("collectApiUrls"), u = !!c?.custom, S = !!c?.saas, g = u || S, p = u && S, E = this.transformers.beforeSend;
|
|
2374
|
+
if (E && (!g || u && !p)) {
|
|
2375
|
+
const $ = qe(l, E, "EventManager");
|
|
2347
2376
|
if ($ === null)
|
|
2348
2377
|
return null;
|
|
2349
|
-
|
|
2378
|
+
l = $;
|
|
2350
2379
|
}
|
|
2351
|
-
return
|
|
2380
|
+
return l;
|
|
2352
2381
|
}
|
|
2353
2382
|
isDuplicateEvent(e) {
|
|
2354
2383
|
const t = Date.now(), r = this.createEventFingerprint(e), n = this.recentEventFingerprints.get(r);
|
|
@@ -2429,10 +2458,10 @@ class Yt extends _ {
|
|
|
2429
2458
|
this.eventsQueue = this.eventsQueue.filter((r) => !t.has(r.id));
|
|
2430
2459
|
}
|
|
2431
2460
|
emitEvent(e) {
|
|
2432
|
-
this.emitter && this.emitter.emit(
|
|
2461
|
+
this.emitter && this.emitter.emit(oe.EVENT, e);
|
|
2433
2462
|
}
|
|
2434
2463
|
emitEventsQueue(e) {
|
|
2435
|
-
this.emitter && this.emitter.emit(
|
|
2464
|
+
this.emitter && this.emitter.emit(oe.QUEUE, e);
|
|
2436
2465
|
}
|
|
2437
2466
|
/**
|
|
2438
2467
|
* Creates a debounced version of a function that delays execution until after
|
|
@@ -2508,13 +2537,13 @@ class Yt extends _ {
|
|
|
2508
2537
|
loadSessionCounts(e) {
|
|
2509
2538
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
2510
2539
|
return this.getInitialCounts();
|
|
2511
|
-
const t = this.get("userId") || "anonymous", r =
|
|
2540
|
+
const t = this.get("userId") || "anonymous", r = be(t, e);
|
|
2512
2541
|
try {
|
|
2513
2542
|
const n = localStorage.getItem(r);
|
|
2514
2543
|
if (!n)
|
|
2515
2544
|
return this.getInitialCounts();
|
|
2516
2545
|
const i = JSON.parse(n);
|
|
2517
|
-
return i._timestamp && Date.now() - i._timestamp >
|
|
2546
|
+
return i._timestamp && Date.now() - i._timestamp > Ae ? (a("debug", "Session counts expired, clearing", {
|
|
2518
2547
|
data: { sessionId: e, age: Date.now() - i._timestamp }
|
|
2519
2548
|
}), 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" ? {
|
|
2520
2549
|
total: i.total,
|
|
@@ -2559,12 +2588,12 @@ class Yt extends _ {
|
|
|
2559
2588
|
cleanupExpiredSessionCounts() {
|
|
2560
2589
|
if (!(typeof window > "u" || typeof localStorage > "u"))
|
|
2561
2590
|
try {
|
|
2562
|
-
const e = localStorage.getItem(
|
|
2591
|
+
const e = localStorage.getItem(Le);
|
|
2563
2592
|
if (e) {
|
|
2564
2593
|
const i = Date.now() - parseInt(e, 10);
|
|
2565
|
-
if (i <
|
|
2594
|
+
if (i < Me) {
|
|
2566
2595
|
a("debug", "Skipping session counts cleanup (throttled)", {
|
|
2567
|
-
data: { timeSinceLastCleanup: i, throttleMs:
|
|
2596
|
+
data: { timeSinceLastCleanup: i, throttleMs: Me }
|
|
2568
2597
|
});
|
|
2569
2598
|
return;
|
|
2570
2599
|
}
|
|
@@ -2577,14 +2606,14 @@ class Yt extends _ {
|
|
|
2577
2606
|
const l = localStorage.getItem(o);
|
|
2578
2607
|
if (l) {
|
|
2579
2608
|
const c = JSON.parse(l);
|
|
2580
|
-
c._timestamp && Date.now() - c._timestamp >
|
|
2609
|
+
c._timestamp && Date.now() - c._timestamp > Ae && n.push(o);
|
|
2581
2610
|
}
|
|
2582
2611
|
} catch {
|
|
2583
2612
|
}
|
|
2584
2613
|
}
|
|
2585
2614
|
n.forEach((i) => {
|
|
2586
2615
|
localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
|
|
2587
|
-
}), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem(
|
|
2616
|
+
}), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem(Le, Date.now().toString());
|
|
2588
2617
|
} catch (e) {
|
|
2589
2618
|
a("warn", "Failed to cleanup expired session counts", { error: e });
|
|
2590
2619
|
}
|
|
@@ -2618,7 +2647,7 @@ class Yt extends _ {
|
|
|
2618
2647
|
* @internal
|
|
2619
2648
|
*/
|
|
2620
2649
|
saveSessionCounts(e) {
|
|
2621
|
-
const t = this.get("userId") || "anonymous", r =
|
|
2650
|
+
const t = this.get("userId") || "anonymous", r = be(t, e);
|
|
2622
2651
|
try {
|
|
2623
2652
|
const n = {
|
|
2624
2653
|
...this.sessionEventCounts,
|
|
@@ -2634,7 +2663,7 @@ class Yt extends _ {
|
|
|
2634
2663
|
}
|
|
2635
2664
|
}
|
|
2636
2665
|
}
|
|
2637
|
-
class
|
|
2666
|
+
class tr {
|
|
2638
2667
|
/**
|
|
2639
2668
|
* Gets or creates a unique user ID.
|
|
2640
2669
|
*
|
|
@@ -2652,15 +2681,15 @@ class qt {
|
|
|
2652
2681
|
* @returns Persistent unique user ID (UUID v4 format)
|
|
2653
2682
|
*/
|
|
2654
2683
|
static getId(e) {
|
|
2655
|
-
const t = e.getItem(
|
|
2684
|
+
const t = e.getItem(Ie);
|
|
2656
2685
|
if (t)
|
|
2657
2686
|
return t;
|
|
2658
|
-
const r =
|
|
2659
|
-
return e.setItem(
|
|
2687
|
+
const r = Ht();
|
|
2688
|
+
return e.setItem(Ie, r), r;
|
|
2660
2689
|
}
|
|
2661
2690
|
}
|
|
2662
|
-
const
|
|
2663
|
-
class
|
|
2691
|
+
const rr = /^\d{13}-[a-z0-9]{9}$/;
|
|
2692
|
+
class sr extends _ {
|
|
2664
2693
|
storageManager;
|
|
2665
2694
|
eventManager;
|
|
2666
2695
|
projectId;
|
|
@@ -2669,6 +2698,7 @@ class Zt extends _ {
|
|
|
2669
2698
|
sessionTimeoutId = null;
|
|
2670
2699
|
broadcastChannel = null;
|
|
2671
2700
|
isTracking = !1;
|
|
2701
|
+
needsRenewal = !1;
|
|
2672
2702
|
/**
|
|
2673
2703
|
* Creates a SessionManager instance.
|
|
2674
2704
|
*
|
|
@@ -2685,7 +2715,7 @@ class Zt extends _ {
|
|
|
2685
2715
|
return;
|
|
2686
2716
|
}
|
|
2687
2717
|
const e = this.getProjectId();
|
|
2688
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
2718
|
+
this.broadcastChannel = new BroadcastChannel(ht(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2689
2719
|
const { action: r, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
|
|
2690
2720
|
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 } }));
|
|
2691
2721
|
};
|
|
@@ -2705,17 +2735,19 @@ class Zt extends _ {
|
|
|
2705
2735
|
const e = this.loadStoredSession();
|
|
2706
2736
|
if (!e)
|
|
2707
2737
|
return null;
|
|
2708
|
-
if (!
|
|
2738
|
+
if (!rr.test(e.id))
|
|
2709
2739
|
return a("warn", "Invalid session ID format recovered from storage, clearing", {
|
|
2710
2740
|
data: { sessionId: e.id }
|
|
2711
2741
|
}), this.clearStoredSession(), null;
|
|
2712
2742
|
const t = this.get("config")?.sessionTimeout ?? 9e5;
|
|
2713
2743
|
return Date.now() - e.lastActivity > t ? (this.clearStoredSession(), null) : e.id;
|
|
2714
2744
|
}
|
|
2715
|
-
persistSession(e, t = Date.now()) {
|
|
2745
|
+
persistSession(e, t = Date.now(), r, n) {
|
|
2716
2746
|
this.saveStoredSession({
|
|
2717
2747
|
id: e,
|
|
2718
|
-
lastActivity: t
|
|
2748
|
+
lastActivity: t,
|
|
2749
|
+
...r && { referrer: r },
|
|
2750
|
+
...n && { utm: n }
|
|
2719
2751
|
});
|
|
2720
2752
|
}
|
|
2721
2753
|
clearStoredSession() {
|
|
@@ -2738,7 +2770,7 @@ class Zt extends _ {
|
|
|
2738
2770
|
this.storageManager.setItem(t, JSON.stringify(e));
|
|
2739
2771
|
}
|
|
2740
2772
|
getSessionStorageKey() {
|
|
2741
|
-
return
|
|
2773
|
+
return dt(this.getProjectId());
|
|
2742
2774
|
}
|
|
2743
2775
|
getProjectId() {
|
|
2744
2776
|
return this.projectId;
|
|
@@ -2800,21 +2832,31 @@ class Zt extends _ {
|
|
|
2800
2832
|
return;
|
|
2801
2833
|
}
|
|
2802
2834
|
const e = this.recoverSession(), t = e ?? this.generateSessionId();
|
|
2835
|
+
let r, n;
|
|
2836
|
+
if (e) {
|
|
2837
|
+
const i = this.loadStoredSession();
|
|
2838
|
+
r = i?.referrer ?? te(), n = i?.utm ?? re();
|
|
2839
|
+
} else
|
|
2840
|
+
r = te(), n = re();
|
|
2803
2841
|
a("debug", "Session tracking initialized", {
|
|
2804
2842
|
data: {
|
|
2805
2843
|
sessionId: t,
|
|
2806
2844
|
wasRecovered: !!e,
|
|
2807
|
-
willEmitSessionStart: !
|
|
2845
|
+
willEmitSessionStart: !e,
|
|
2846
|
+
sessionReferrer: r,
|
|
2847
|
+
hasUtm: !!n
|
|
2808
2848
|
}
|
|
2809
2849
|
}), this.isTracking = !0;
|
|
2810
2850
|
try {
|
|
2811
|
-
this.set("sessionId", t), this.persistSession(t), this.initCrossTabSync(), this.shareSession(t), a("debug", "
|
|
2851
|
+
this.set("sessionId", t), this.set("sessionReferrer", r), this.set("sessionUtm", n), this.persistSession(t, Date.now(), r, n), this.initCrossTabSync(), this.shareSession(t), e ? a("debug", "Session recovered, skipping SESSION_START", {
|
|
2852
|
+
data: { sessionId: t }
|
|
2853
|
+
}) : (a("debug", "Emitting SESSION_START event", {
|
|
2812
2854
|
data: { sessionId: t }
|
|
2813
2855
|
}), this.eventManager.track({
|
|
2814
2856
|
type: d.SESSION_START
|
|
2815
|
-
}), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
|
|
2816
|
-
} catch (
|
|
2817
|
-
throw this.isTracking = !1, this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.set("sessionId", null),
|
|
2857
|
+
})), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
|
|
2858
|
+
} catch (i) {
|
|
2859
|
+
throw this.isTracking = !1, this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.set("sessionId", null), i;
|
|
2818
2860
|
}
|
|
2819
2861
|
}
|
|
2820
2862
|
generateSessionId() {
|
|
@@ -2824,35 +2866,81 @@ class Zt extends _ {
|
|
|
2824
2866
|
this.clearSessionTimeout();
|
|
2825
2867
|
const e = this.get("config")?.sessionTimeout ?? 9e5;
|
|
2826
2868
|
this.sessionTimeoutId = setTimeout(() => {
|
|
2827
|
-
this.
|
|
2869
|
+
this.enterRenewalMode();
|
|
2828
2870
|
}, e);
|
|
2829
2871
|
}
|
|
2830
2872
|
resetSessionTimeout() {
|
|
2831
2873
|
this.setupSessionTimeout();
|
|
2832
2874
|
const e = this.get("sessionId");
|
|
2833
|
-
e && this.persistSession(e);
|
|
2875
|
+
e && this.persistSession(e, Date.now(), this.get("sessionReferrer"), this.get("sessionUtm"));
|
|
2834
2876
|
}
|
|
2835
2877
|
clearSessionTimeout() {
|
|
2836
2878
|
this.sessionTimeoutId && (clearTimeout(this.sessionTimeoutId), this.sessionTimeoutId = null);
|
|
2837
2879
|
}
|
|
2838
2880
|
setupActivityListeners() {
|
|
2839
2881
|
this.activityHandler = () => {
|
|
2840
|
-
this.resetSessionTimeout();
|
|
2882
|
+
this.needsRenewal ? this.renewSession() : this.resetSessionTimeout();
|
|
2841
2883
|
}, document.addEventListener("click", this.activityHandler, { passive: !0 }), document.addEventListener("keydown", this.activityHandler, { passive: !0 }), document.addEventListener("scroll", this.activityHandler, { passive: !0 });
|
|
2842
2884
|
}
|
|
2885
|
+
/**
|
|
2886
|
+
* Renews the session after timeout when user returns.
|
|
2887
|
+
* Creates a new session ID and emits SESSION_START.
|
|
2888
|
+
*/
|
|
2889
|
+
renewSession() {
|
|
2890
|
+
this.needsRenewal = !1;
|
|
2891
|
+
const e = this.generateSessionId(), t = te(), r = re();
|
|
2892
|
+
a("debug", "Renewing session after timeout", {
|
|
2893
|
+
data: { newSessionId: e }
|
|
2894
|
+
}), 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({
|
|
2895
|
+
type: d.SESSION_START
|
|
2896
|
+
}), this.eventManager.flushPendingEvents(), this.setupSessionTimeout();
|
|
2897
|
+
}
|
|
2843
2898
|
cleanupActivityListeners() {
|
|
2844
2899
|
this.activityHandler && (document.removeEventListener("click", this.activityHandler), document.removeEventListener("keydown", this.activityHandler), document.removeEventListener("scroll", this.activityHandler), this.activityHandler = null);
|
|
2845
2900
|
}
|
|
2846
2901
|
setupLifecycleListeners() {
|
|
2847
2902
|
this.visibilityChangeHandler || (this.visibilityChangeHandler = () => {
|
|
2848
|
-
document.hidden
|
|
2903
|
+
if (document.hidden)
|
|
2904
|
+
this.clearSessionTimeout();
|
|
2905
|
+
else {
|
|
2906
|
+
if (this.isSessionStale()) {
|
|
2907
|
+
a("debug", "Session expired during suspend, entering renewal mode"), this.enterRenewalMode();
|
|
2908
|
+
return;
|
|
2909
|
+
}
|
|
2910
|
+
this.get("sessionId") && this.setupSessionTimeout();
|
|
2911
|
+
}
|
|
2849
2912
|
}, document.addEventListener("visibilitychange", this.visibilityChangeHandler));
|
|
2850
2913
|
}
|
|
2914
|
+
/**
|
|
2915
|
+
* Checks if the current session has become stale (expired during browser suspend).
|
|
2916
|
+
* This handles the case where JavaScript timers are paused during suspend/hibernate.
|
|
2917
|
+
*/
|
|
2918
|
+
isSessionStale() {
|
|
2919
|
+
if (this.needsRenewal || !this.get("sessionId"))
|
|
2920
|
+
return !1;
|
|
2921
|
+
const t = this.loadStoredSession();
|
|
2922
|
+
if (!t)
|
|
2923
|
+
return !1;
|
|
2924
|
+
const r = this.get("config")?.sessionTimeout ?? 9e5;
|
|
2925
|
+
return Date.now() - t.lastActivity > r;
|
|
2926
|
+
}
|
|
2851
2927
|
cleanupLifecycleListeners() {
|
|
2852
2928
|
this.visibilityChangeHandler && (document.removeEventListener("visibilitychange", this.visibilityChangeHandler), this.visibilityChangeHandler = null);
|
|
2853
2929
|
}
|
|
2930
|
+
/**
|
|
2931
|
+
* Enters renewal mode after session timeout.
|
|
2932
|
+
* Keeps activity listeners active to detect when user returns.
|
|
2933
|
+
* Called by session timeout timer.
|
|
2934
|
+
*/
|
|
2935
|
+
enterRenewalMode() {
|
|
2936
|
+
this.clearSessionTimeout(), this.cleanupCrossTabSync(), this.clearStoredSession(), this.set("sessionId", null), this.set("hasStartSession", !1), this.set("sessionReferrer", void 0), this.set("sessionUtm", void 0), this.needsRenewal = !0, a("debug", "Session timed out, entering renewal mode");
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* Fully resets session state and cleans up all resources.
|
|
2940
|
+
* Called by stopTracking() for explicit session termination.
|
|
2941
|
+
*/
|
|
2854
2942
|
resetSessionState() {
|
|
2855
|
-
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.clearStoredSession(), this.set("sessionId", null), this.set("hasStartSession", !1), this.isTracking = !1;
|
|
2943
|
+
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.clearStoredSession(), this.set("sessionId", null), this.set("hasStartSession", !1), this.set("sessionReferrer", void 0), this.set("sessionUtm", void 0), this.needsRenewal = !1, this.isTracking = !1;
|
|
2856
2944
|
}
|
|
2857
2945
|
/**
|
|
2858
2946
|
* Stops session tracking and cleans up all resources.
|
|
@@ -2918,10 +3006,10 @@ class Zt extends _ {
|
|
|
2918
3006
|
* ```
|
|
2919
3007
|
*/
|
|
2920
3008
|
destroy() {
|
|
2921
|
-
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.set("hasStartSession", !1);
|
|
3009
|
+
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
|
|
2922
3010
|
}
|
|
2923
3011
|
}
|
|
2924
|
-
class
|
|
3012
|
+
class nr extends _ {
|
|
2925
3013
|
eventManager;
|
|
2926
3014
|
storageManager;
|
|
2927
3015
|
sessionManager = null;
|
|
@@ -2956,7 +3044,7 @@ class er extends _ {
|
|
|
2956
3044
|
}
|
|
2957
3045
|
const t = this.get("config")?.integrations?.tracelog?.projectId ?? "custom";
|
|
2958
3046
|
try {
|
|
2959
|
-
this.sessionManager = new
|
|
3047
|
+
this.sessionManager = new sr(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
|
|
2960
3048
|
} catch (r) {
|
|
2961
3049
|
if (this.sessionManager) {
|
|
2962
3050
|
try {
|
|
@@ -3009,7 +3097,7 @@ class er extends _ {
|
|
|
3009
3097
|
this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
|
|
3010
3098
|
}
|
|
3011
3099
|
}
|
|
3012
|
-
class
|
|
3100
|
+
class ir extends _ {
|
|
3013
3101
|
eventManager;
|
|
3014
3102
|
onTrack;
|
|
3015
3103
|
originalPushState;
|
|
@@ -3049,7 +3137,7 @@ class tr extends _ {
|
|
|
3049
3137
|
};
|
|
3050
3138
|
}
|
|
3051
3139
|
trackCurrentPage = () => {
|
|
3052
|
-
const e = window.location.href, t =
|
|
3140
|
+
const e = window.location.href, t = ue(e, this.get("config").sensitiveQueryParams);
|
|
3053
3141
|
if (this.get("pageUrl") === t)
|
|
3054
3142
|
return;
|
|
3055
3143
|
const r = Date.now(), n = this.get("config").pageViewThrottleMs ?? 1e3;
|
|
@@ -3067,7 +3155,7 @@ class tr extends _ {
|
|
|
3067
3155
|
});
|
|
3068
3156
|
};
|
|
3069
3157
|
trackInitialPageView() {
|
|
3070
|
-
const e =
|
|
3158
|
+
const e = ue(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
|
|
3071
3159
|
this.lastPageViewTime = Date.now(), this.eventManager.track({
|
|
3072
3160
|
type: d.PAGE_VIEW,
|
|
3073
3161
|
page_url: e,
|
|
@@ -3085,7 +3173,7 @@ class tr extends _ {
|
|
|
3085
3173
|
};
|
|
3086
3174
|
}
|
|
3087
3175
|
}
|
|
3088
|
-
class
|
|
3176
|
+
class or extends _ {
|
|
3089
3177
|
eventManager;
|
|
3090
3178
|
lastClickTimes = /* @__PURE__ */ new Map();
|
|
3091
3179
|
clickHandler;
|
|
@@ -3223,7 +3311,7 @@ class rr extends _ {
|
|
|
3223
3311
|
return e.hasAttribute(`${w}-name`) ? e : e.closest(`[${w}-name]`);
|
|
3224
3312
|
}
|
|
3225
3313
|
getRelevantClickElement(e) {
|
|
3226
|
-
for (const t of
|
|
3314
|
+
for (const t of ot)
|
|
3227
3315
|
try {
|
|
3228
3316
|
if (e.matches(t))
|
|
3229
3317
|
return e;
|
|
@@ -3303,7 +3391,7 @@ class rr extends _ {
|
|
|
3303
3391
|
*/
|
|
3304
3392
|
sanitizeText(e) {
|
|
3305
3393
|
let t = e;
|
|
3306
|
-
for (const r of
|
|
3394
|
+
for (const r of Xe) {
|
|
3307
3395
|
const n = new RegExp(r.source, r.flags);
|
|
3308
3396
|
t = t.replace(n, "[REDACTED]");
|
|
3309
3397
|
}
|
|
@@ -3342,7 +3430,7 @@ class rr extends _ {
|
|
|
3342
3430
|
};
|
|
3343
3431
|
}
|
|
3344
3432
|
}
|
|
3345
|
-
class
|
|
3433
|
+
class ar extends _ {
|
|
3346
3434
|
eventManager;
|
|
3347
3435
|
containers = [];
|
|
3348
3436
|
limitWarningLogged = !1;
|
|
@@ -3527,13 +3615,13 @@ class sr extends _ {
|
|
|
3527
3615
|
if (l < 10 || t === window && !this.isWindowScrollable())
|
|
3528
3616
|
return null;
|
|
3529
3617
|
const c = this.getViewportHeight(t), u = this.getScrollHeight(t), S = this.getScrollDirection(i, r), g = this.calculateScrollDepth(i, u, c);
|
|
3530
|
-
let
|
|
3531
|
-
n > 0 ?
|
|
3532
|
-
const
|
|
3618
|
+
let p;
|
|
3619
|
+
n > 0 ? p = o - n : e.firstScrollEventTime !== null ? p = o - e.firstScrollEventTime : p = 250;
|
|
3620
|
+
const E = Math.round(l / p * 1e3);
|
|
3533
3621
|
return g > e.maxDepthReached && (e.maxDepthReached = g), e.lastScrollPos = i, {
|
|
3534
3622
|
depth: g,
|
|
3535
3623
|
direction: S,
|
|
3536
|
-
velocity:
|
|
3624
|
+
velocity: E,
|
|
3537
3625
|
max_depth_reached: e.maxDepthReached
|
|
3538
3626
|
};
|
|
3539
3627
|
}
|
|
@@ -3570,7 +3658,7 @@ class sr extends _ {
|
|
|
3570
3658
|
e.isPrimary = t;
|
|
3571
3659
|
}
|
|
3572
3660
|
}
|
|
3573
|
-
class
|
|
3661
|
+
class lr extends _ {
|
|
3574
3662
|
eventManager;
|
|
3575
3663
|
trackedElements = /* @__PURE__ */ new Map();
|
|
3576
3664
|
observer = null;
|
|
@@ -3731,7 +3819,7 @@ class nr extends _ {
|
|
|
3731
3819
|
});
|
|
3732
3820
|
}
|
|
3733
3821
|
}
|
|
3734
|
-
class
|
|
3822
|
+
class cr {
|
|
3735
3823
|
storage;
|
|
3736
3824
|
sessionStorageRef;
|
|
3737
3825
|
fallbackStorage = /* @__PURE__ */ new Map();
|
|
@@ -4014,7 +4102,7 @@ class ir {
|
|
|
4014
4102
|
this.fallbackSessionStorage.delete(e);
|
|
4015
4103
|
}
|
|
4016
4104
|
}
|
|
4017
|
-
class
|
|
4105
|
+
class ur extends _ {
|
|
4018
4106
|
eventManager;
|
|
4019
4107
|
reportedByNav = /* @__PURE__ */ new Map();
|
|
4020
4108
|
navigationHistory = [];
|
|
@@ -4025,7 +4113,7 @@ class or extends _ {
|
|
|
4025
4113
|
navigationCounter = 0;
|
|
4026
4114
|
// Counter for handling simultaneous navigations edge case
|
|
4027
4115
|
constructor(e) {
|
|
4028
|
-
super(), this.eventManager = e, this.vitalThresholds =
|
|
4116
|
+
super(), this.eventManager = e, this.vitalThresholds = De(ce);
|
|
4029
4117
|
}
|
|
4030
4118
|
/**
|
|
4031
4119
|
* Starts tracking Web Vitals and performance metrics.
|
|
@@ -4042,8 +4130,8 @@ class or extends _ {
|
|
|
4042
4130
|
* @returns Promise that resolves when tracking is initialized
|
|
4043
4131
|
*/
|
|
4044
4132
|
async startTracking() {
|
|
4045
|
-
const e = this.get("config"), t = e?.webVitalsMode ??
|
|
4046
|
-
this.vitalThresholds =
|
|
4133
|
+
const e = this.get("config"), t = e?.webVitalsMode ?? ce;
|
|
4134
|
+
this.vitalThresholds = De(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
|
|
4047
4135
|
}
|
|
4048
4136
|
/**
|
|
4049
4137
|
* Stops tracking Web Vitals and cleans up resources.
|
|
@@ -4113,7 +4201,7 @@ class or extends _ {
|
|
|
4113
4201
|
}
|
|
4114
4202
|
async initWebVitals() {
|
|
4115
4203
|
try {
|
|
4116
|
-
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() =>
|
|
4204
|
+
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => kr), o = (l) => (c) => {
|
|
4117
4205
|
const u = Number(c.value.toFixed(2));
|
|
4118
4206
|
this.sendVital({ type: l, value: u });
|
|
4119
4207
|
};
|
|
@@ -4140,7 +4228,7 @@ class or extends _ {
|
|
|
4140
4228
|
const t = e.getEntries();
|
|
4141
4229
|
for (const r of t) {
|
|
4142
4230
|
const n = Number(r.duration.toFixed(2)), i = Date.now();
|
|
4143
|
-
i - this.lastLongTaskSentAt >=
|
|
4231
|
+
i - this.lastLongTaskSentAt >= Ct && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
4144
4232
|
}
|
|
4145
4233
|
},
|
|
4146
4234
|
{ type: "longtask", buffered: !0 }
|
|
@@ -4156,7 +4244,7 @@ class or extends _ {
|
|
|
4156
4244
|
return;
|
|
4157
4245
|
if (r)
|
|
4158
4246
|
r.add(e.type);
|
|
4159
|
-
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length >
|
|
4247
|
+
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Nt) {
|
|
4160
4248
|
const i = this.navigationHistory.shift();
|
|
4161
4249
|
i && this.reportedByNav.delete(i);
|
|
4162
4250
|
}
|
|
@@ -4247,7 +4335,7 @@ class or extends _ {
|
|
|
4247
4335
|
return !(typeof r == "number" && t <= r);
|
|
4248
4336
|
}
|
|
4249
4337
|
}
|
|
4250
|
-
class
|
|
4338
|
+
class dr extends _ {
|
|
4251
4339
|
eventManager;
|
|
4252
4340
|
recentErrors = /* @__PURE__ */ new Map();
|
|
4253
4341
|
errorBurstCounter = 0;
|
|
@@ -4283,14 +4371,14 @@ class ar extends _ {
|
|
|
4283
4371
|
const e = Date.now();
|
|
4284
4372
|
if (e < this.burstBackoffUntil)
|
|
4285
4373
|
return !1;
|
|
4286
|
-
if (e - this.burstWindowStart >
|
|
4287
|
-
return this.burstBackoffUntil = e +
|
|
4374
|
+
if (e - this.burstWindowStart > At && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Lt)
|
|
4375
|
+
return this.burstBackoffUntil = e + Oe, a("debug", "Error burst detected - entering cooldown", {
|
|
4288
4376
|
data: {
|
|
4289
4377
|
errorsInWindow: this.errorBurstCounter,
|
|
4290
|
-
cooldownMs:
|
|
4378
|
+
cooldownMs: Oe
|
|
4291
4379
|
}
|
|
4292
4380
|
}), !1;
|
|
4293
|
-
const r = this.get("config")?.errorSampling ??
|
|
4381
|
+
const r = this.get("config")?.errorSampling ?? Qe;
|
|
4294
4382
|
return Math.random() < r;
|
|
4295
4383
|
}
|
|
4296
4384
|
handleError = (e) => {
|
|
@@ -4334,8 +4422,8 @@ class ar extends _ {
|
|
|
4334
4422
|
}
|
|
4335
4423
|
}
|
|
4336
4424
|
sanitize(e) {
|
|
4337
|
-
let t = e.length >
|
|
4338
|
-
for (const r of
|
|
4425
|
+
let t = e.length > Ce ? e.slice(0, Ce) + "..." : e;
|
|
4426
|
+
for (const r of Xe) {
|
|
4339
4427
|
const n = new RegExp(r.source, r.flags);
|
|
4340
4428
|
t = t.replace(n, "[REDACTED]");
|
|
4341
4429
|
}
|
|
@@ -4343,12 +4431,12 @@ class ar extends _ {
|
|
|
4343
4431
|
}
|
|
4344
4432
|
shouldSuppressError(e, t) {
|
|
4345
4433
|
const r = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
4346
|
-
return i && r - i <
|
|
4434
|
+
return i && r - i < Ne ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size > bt ? (this.recentErrors.clear(), this.recentErrors.set(n, r), !1) : (this.recentErrors.size > Q && this.pruneOldErrors(), !1));
|
|
4347
4435
|
}
|
|
4348
4436
|
pruneOldErrors() {
|
|
4349
4437
|
const e = Date.now();
|
|
4350
4438
|
for (const [n, i] of this.recentErrors.entries())
|
|
4351
|
-
e - i >
|
|
4439
|
+
e - i > Ne && this.recentErrors.delete(n);
|
|
4352
4440
|
if (this.recentErrors.size <= Q)
|
|
4353
4441
|
return;
|
|
4354
4442
|
const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), r = this.recentErrors.size - Q;
|
|
@@ -4358,10 +4446,10 @@ class ar extends _ {
|
|
|
4358
4446
|
}
|
|
4359
4447
|
}
|
|
4360
4448
|
}
|
|
4361
|
-
class
|
|
4449
|
+
class hr extends _ {
|
|
4362
4450
|
isInitialized = !1;
|
|
4363
4451
|
suppressNextScrollTimer = null;
|
|
4364
|
-
emitter = new
|
|
4452
|
+
emitter = new qt();
|
|
4365
4453
|
transformers = {};
|
|
4366
4454
|
managers = {};
|
|
4367
4455
|
handlers = {};
|
|
@@ -4377,9 +4465,9 @@ class lr extends _ {
|
|
|
4377
4465
|
*/
|
|
4378
4466
|
async init(e = {}) {
|
|
4379
4467
|
if (!this.isInitialized) {
|
|
4380
|
-
this.managers.storage = new
|
|
4468
|
+
this.managers.storage = new cr();
|
|
4381
4469
|
try {
|
|
4382
|
-
this.setupState(e), this.managers.event = new
|
|
4470
|
+
this.setupState(e), this.managers.event = new er(this.managers.storage, this.emitter, this.transformers), this.initializeHandlers(), await this.managers.event.recoverPersistedEvents().catch((t) => {
|
|
4383
4471
|
a("warn", "Failed to recover persisted events", { error: t });
|
|
4384
4472
|
}), this.isInitialized = !0;
|
|
4385
4473
|
} catch (t) {
|
|
@@ -4403,9 +4491,9 @@ class lr extends _ {
|
|
|
4403
4491
|
}
|
|
4404
4492
|
let r = t;
|
|
4405
4493
|
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
4406
|
-
const { valid: n, error: i, sanitizedMetadata: o } =
|
|
4494
|
+
const { valid: n, error: i, sanitizedMetadata: o } = Yt(e, r);
|
|
4407
4495
|
if (!n) {
|
|
4408
|
-
if (this.get("mode") ===
|
|
4496
|
+
if (this.get("mode") === z.QA)
|
|
4409
4497
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
|
|
4410
4498
|
return;
|
|
4411
4499
|
}
|
|
@@ -4451,14 +4539,14 @@ class lr extends _ {
|
|
|
4451
4539
|
}
|
|
4452
4540
|
setupState(e = {}) {
|
|
4453
4541
|
this.set("config", e);
|
|
4454
|
-
const t =
|
|
4542
|
+
const t = tr.getId(this.managers.storage);
|
|
4455
4543
|
this.set("userId", t);
|
|
4456
|
-
const r =
|
|
4544
|
+
const r = Bt(e);
|
|
4457
4545
|
this.set("collectApiUrls", r);
|
|
4458
|
-
const n =
|
|
4546
|
+
const n = yt();
|
|
4459
4547
|
this.set("device", n);
|
|
4460
|
-
const i =
|
|
4461
|
-
this.set("pageUrl", i),
|
|
4548
|
+
const i = ue(window.location.href, e.sensitiveQueryParams);
|
|
4549
|
+
this.set("pageUrl", i), kt() && this.set("mode", z.QA);
|
|
4462
4550
|
}
|
|
4463
4551
|
/**
|
|
4464
4552
|
* Returns the current configuration object.
|
|
@@ -4500,7 +4588,7 @@ class lr extends _ {
|
|
|
4500
4588
|
valid: !1,
|
|
4501
4589
|
error: "Global metadata must be a plain object"
|
|
4502
4590
|
};
|
|
4503
|
-
const t =
|
|
4591
|
+
const t = Ye("Global", e, "globalMetadata");
|
|
4504
4592
|
return t.valid ? { valid: !0 } : {
|
|
4505
4593
|
valid: !1,
|
|
4506
4594
|
error: t.error
|
|
@@ -4545,7 +4633,7 @@ class lr extends _ {
|
|
|
4545
4633
|
}
|
|
4546
4634
|
initializeHandlers() {
|
|
4547
4635
|
const e = this.get("config");
|
|
4548
|
-
this.handlers.session = new
|
|
4636
|
+
this.handlers.session = new nr(
|
|
4549
4637
|
this.managers.storage,
|
|
4550
4638
|
this.managers.event
|
|
4551
4639
|
), this.handlers.session.startTracking();
|
|
@@ -4554,22 +4642,22 @@ class lr extends _ {
|
|
|
4554
4642
|
this.set("suppressNextScroll", !1);
|
|
4555
4643
|
}, 500);
|
|
4556
4644
|
};
|
|
4557
|
-
this.handlers.pageView = new
|
|
4645
|
+
this.handlers.pageView = new ir(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new or(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new ar(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new ur(this.managers.event), this.handlers.performance.startTracking().catch((r) => {
|
|
4558
4646
|
a("warn", "Failed to start performance tracking", { error: r });
|
|
4559
|
-
}), this.handlers.error = new
|
|
4647
|
+
}), this.handlers.error = new dr(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new lr(this.managers.event), this.handlers.viewport.startTracking());
|
|
4560
4648
|
}
|
|
4561
4649
|
}
|
|
4562
|
-
const
|
|
4563
|
-
let f = null,
|
|
4564
|
-
const
|
|
4565
|
-
if (!(typeof window > "u" || typeof document > "u") && (v = !1, window.__traceLogDisabled !== !0 && !f && !
|
|
4566
|
-
|
|
4650
|
+
const C = [], M = [];
|
|
4651
|
+
let f = null, R = !1, v = !1;
|
|
4652
|
+
const fr = async (s) => {
|
|
4653
|
+
if (!(typeof window > "u" || typeof document > "u") && (v = !1, window.__traceLogDisabled !== !0 && !f && !R)) {
|
|
4654
|
+
R = !0;
|
|
4567
4655
|
try {
|
|
4568
|
-
const e =
|
|
4656
|
+
const e = jt(s ?? {}), t = new hr();
|
|
4569
4657
|
try {
|
|
4570
|
-
|
|
4658
|
+
C.forEach(({ event: i, callback: o }) => {
|
|
4571
4659
|
t.on(i, o);
|
|
4572
|
-
}),
|
|
4660
|
+
}), C.length = 0, M.forEach(({ hook: i, fn: o }) => {
|
|
4573
4661
|
i === "beforeSend" ? t.setTransformer("beforeSend", o) : t.setTransformer("beforeBatch", o);
|
|
4574
4662
|
}), M.length = 0;
|
|
4575
4663
|
const r = t.init(e), n = new Promise((i, o) => {
|
|
@@ -4589,10 +4677,10 @@ const cr = async (s) => {
|
|
|
4589
4677
|
} catch (e) {
|
|
4590
4678
|
throw f = null, e;
|
|
4591
4679
|
} finally {
|
|
4592
|
-
|
|
4680
|
+
R = !1;
|
|
4593
4681
|
}
|
|
4594
4682
|
}
|
|
4595
|
-
},
|
|
4683
|
+
}, mr = (s, e) => {
|
|
4596
4684
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4597
4685
|
if (!f)
|
|
4598
4686
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -4600,29 +4688,29 @@ const cr = async (s) => {
|
|
|
4600
4688
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
4601
4689
|
f.sendCustomEvent(s, e);
|
|
4602
4690
|
}
|
|
4603
|
-
},
|
|
4691
|
+
}, gr = (s, e) => {
|
|
4604
4692
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4605
|
-
if (!f ||
|
|
4606
|
-
|
|
4693
|
+
if (!f || R) {
|
|
4694
|
+
C.push({ event: s, callback: e });
|
|
4607
4695
|
return;
|
|
4608
4696
|
}
|
|
4609
4697
|
f.on(s, e);
|
|
4610
4698
|
}
|
|
4611
|
-
},
|
|
4699
|
+
}, Er = (s, e) => {
|
|
4612
4700
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4613
4701
|
if (!f) {
|
|
4614
|
-
const t =
|
|
4615
|
-
t !== -1 &&
|
|
4702
|
+
const t = C.findIndex((r) => r.event === s && r.callback === e);
|
|
4703
|
+
t !== -1 && C.splice(t, 1);
|
|
4616
4704
|
return;
|
|
4617
4705
|
}
|
|
4618
4706
|
f.off(s, e);
|
|
4619
4707
|
}
|
|
4620
4708
|
};
|
|
4621
|
-
function
|
|
4709
|
+
function Sr(s, e) {
|
|
4622
4710
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4623
4711
|
if (typeof e != "function")
|
|
4624
4712
|
throw new Error(`[TraceLog] Transformer must be a function, received: ${typeof e}`);
|
|
4625
|
-
if (!f ||
|
|
4713
|
+
if (!f || R) {
|
|
4626
4714
|
const t = M.findIndex((r) => r.hook === s);
|
|
4627
4715
|
t !== -1 && M.splice(t, 1), M.push({ hook: s, fn: e });
|
|
4628
4716
|
return;
|
|
@@ -4632,7 +4720,7 @@ function fr(s, e) {
|
|
|
4632
4720
|
s === "beforeSend" ? f.setTransformer("beforeSend", e) : f.setTransformer("beforeBatch", e);
|
|
4633
4721
|
}
|
|
4634
4722
|
}
|
|
4635
|
-
const
|
|
4723
|
+
const pr = (s) => {
|
|
4636
4724
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4637
4725
|
if (!f) {
|
|
4638
4726
|
const e = M.findIndex((t) => t.hook === s);
|
|
@@ -4643,7 +4731,7 @@ const mr = (s) => {
|
|
|
4643
4731
|
throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
|
|
4644
4732
|
f.removeTransformer(s);
|
|
4645
4733
|
}
|
|
4646
|
-
},
|
|
4734
|
+
}, Tr = () => typeof window > "u" || typeof document > "u" ? !1 : f !== null, _r = () => {
|
|
4647
4735
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4648
4736
|
if (v)
|
|
4649
4737
|
throw new Error("[TraceLog] Destroy operation already in progress");
|
|
@@ -4653,14 +4741,14 @@ const mr = (s) => {
|
|
|
4653
4741
|
}
|
|
4654
4742
|
v = !0;
|
|
4655
4743
|
try {
|
|
4656
|
-
f.destroy(), f = null,
|
|
4744
|
+
f.destroy(), f = null, R = !1, C.length = 0, M.length = 0, v = !1;
|
|
4657
4745
|
} catch (s) {
|
|
4658
|
-
f = null,
|
|
4746
|
+
f = null, R = !1, C.length = 0, M.length = 0, v = !1, a("warn", "Error during destroy, forced cleanup completed", { error: s });
|
|
4659
4747
|
}
|
|
4660
4748
|
}
|
|
4661
|
-
},
|
|
4662
|
-
typeof window > "u" || typeof document > "u" ||
|
|
4663
|
-
},
|
|
4749
|
+
}, vr = (s) => {
|
|
4750
|
+
typeof window > "u" || typeof document > "u" || Vt(s);
|
|
4751
|
+
}, Ir = (s) => {
|
|
4664
4752
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4665
4753
|
if (!f)
|
|
4666
4754
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -4668,7 +4756,7 @@ const mr = (s) => {
|
|
|
4668
4756
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
4669
4757
|
f.updateGlobalMetadata(s);
|
|
4670
4758
|
}
|
|
4671
|
-
},
|
|
4759
|
+
}, wr = (s) => {
|
|
4672
4760
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4673
4761
|
if (!f)
|
|
4674
4762
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -4676,32 +4764,32 @@ const mr = (s) => {
|
|
|
4676
4764
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
4677
4765
|
f.mergeGlobalMetadata(s);
|
|
4678
4766
|
}
|
|
4679
|
-
},
|
|
4680
|
-
init:
|
|
4681
|
-
event:
|
|
4682
|
-
on:
|
|
4683
|
-
off:
|
|
4684
|
-
setTransformer:
|
|
4685
|
-
removeTransformer:
|
|
4686
|
-
isInitialized:
|
|
4687
|
-
destroy:
|
|
4688
|
-
setQaMode:
|
|
4689
|
-
updateGlobalMetadata:
|
|
4690
|
-
mergeGlobalMetadata:
|
|
4767
|
+
}, Yr = {
|
|
4768
|
+
init: fr,
|
|
4769
|
+
event: mr,
|
|
4770
|
+
on: gr,
|
|
4771
|
+
off: Er,
|
|
4772
|
+
setTransformer: Sr,
|
|
4773
|
+
removeTransformer: pr,
|
|
4774
|
+
isInitialized: Tr,
|
|
4775
|
+
destroy: _r,
|
|
4776
|
+
setQaMode: vr,
|
|
4777
|
+
updateGlobalMetadata: Ir,
|
|
4778
|
+
mergeGlobalMetadata: wr
|
|
4691
4779
|
};
|
|
4692
|
-
var
|
|
4780
|
+
var he, Ze = -1, P = function(s) {
|
|
4693
4781
|
addEventListener("pageshow", (function(e) {
|
|
4694
|
-
e.persisted && (
|
|
4782
|
+
e.persisted && (Ze = e.timeStamp, s(e));
|
|
4695
4783
|
}), !0);
|
|
4696
|
-
},
|
|
4784
|
+
}, pe = function() {
|
|
4697
4785
|
var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
4698
4786
|
if (s && s.responseStart > 0 && s.responseStart < performance.now()) return s;
|
|
4699
4787
|
}, q = function() {
|
|
4700
|
-
var s =
|
|
4788
|
+
var s = pe();
|
|
4701
4789
|
return s && s.activationStart || 0;
|
|
4702
4790
|
}, b = function(s, e) {
|
|
4703
|
-
var t =
|
|
4704
|
-
return
|
|
4791
|
+
var t = pe(), r = "navigate";
|
|
4792
|
+
return Ze >= 0 ? r = "back-forward-cache" : t && (document.prerendering || q() > 0 ? r = "prerender" : document.wasDiscarded ? r = "restore" : t.type && (r = t.type.replace(/_/g, "-"))), { name: s, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: r };
|
|
4705
4793
|
}, F = function(s, e, t) {
|
|
4706
4794
|
try {
|
|
4707
4795
|
if (PerformanceObserver.supportedEntryTypes.includes(s)) {
|
|
@@ -4721,7 +4809,7 @@ var ue, Ye = -1, P = function(s) {
|
|
|
4721
4809
|
return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
|
|
4722
4810
|
})(e.value, t), s(e));
|
|
4723
4811
|
};
|
|
4724
|
-
},
|
|
4812
|
+
}, Te = function(s) {
|
|
4725
4813
|
requestAnimationFrame((function() {
|
|
4726
4814
|
return requestAnimationFrame((function() {
|
|
4727
4815
|
return s();
|
|
@@ -4731,23 +4819,23 @@ var ue, Ye = -1, P = function(s) {
|
|
|
4731
4819
|
document.addEventListener("visibilitychange", (function() {
|
|
4732
4820
|
document.visibilityState === "hidden" && s();
|
|
4733
4821
|
}));
|
|
4734
|
-
},
|
|
4822
|
+
}, _e = function(s) {
|
|
4735
4823
|
var e = !1;
|
|
4736
4824
|
return function() {
|
|
4737
4825
|
e || (s(), e = !0);
|
|
4738
4826
|
};
|
|
4739
|
-
}, O = -1,
|
|
4827
|
+
}, O = -1, He = function() {
|
|
4740
4828
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
4741
4829
|
}, Y = function(s) {
|
|
4742
|
-
document.visibilityState === "hidden" && O > -1 && (O = s.type === "visibilitychange" ? s.timeStamp : 0,
|
|
4743
|
-
},
|
|
4830
|
+
document.visibilityState === "hidden" && O > -1 && (O = s.type === "visibilitychange" ? s.timeStamp : 0, yr());
|
|
4831
|
+
}, Fe = function() {
|
|
4744
4832
|
addEventListener("visibilitychange", Y, !0), addEventListener("prerenderingchange", Y, !0);
|
|
4745
|
-
},
|
|
4833
|
+
}, yr = function() {
|
|
4746
4834
|
removeEventListener("visibilitychange", Y, !0), removeEventListener("prerenderingchange", Y, !0);
|
|
4747
|
-
},
|
|
4748
|
-
return O < 0 && (O =
|
|
4835
|
+
}, et = function() {
|
|
4836
|
+
return O < 0 && (O = He(), Fe(), P((function() {
|
|
4749
4837
|
setTimeout((function() {
|
|
4750
|
-
O =
|
|
4838
|
+
O = He(), Fe();
|
|
4751
4839
|
}), 0);
|
|
4752
4840
|
}))), { get firstHiddenTime() {
|
|
4753
4841
|
return O;
|
|
@@ -4756,21 +4844,21 @@ var ue, Ye = -1, P = function(s) {
|
|
|
4756
4844
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
4757
4845
|
return s();
|
|
4758
4846
|
}), !0) : s();
|
|
4759
|
-
},
|
|
4847
|
+
}, fe = [1800, 3e3], tt = function(s, e) {
|
|
4760
4848
|
e = e || {}, Z((function() {
|
|
4761
|
-
var t, r =
|
|
4849
|
+
var t, r = et(), n = b("FCP"), i = F("paint", (function(o) {
|
|
4762
4850
|
o.forEach((function(l) {
|
|
4763
4851
|
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime - q(), 0), n.entries.push(l), t(!0)));
|
|
4764
4852
|
}));
|
|
4765
4853
|
}));
|
|
4766
|
-
i && (t = A(s, n,
|
|
4767
|
-
n = b("FCP"), t = A(s, n,
|
|
4854
|
+
i && (t = A(s, n, fe, e.reportAllChanges), P((function(o) {
|
|
4855
|
+
n = b("FCP"), t = A(s, n, fe, e.reportAllChanges), Te((function() {
|
|
4768
4856
|
n.value = performance.now() - o.timeStamp, t(!0);
|
|
4769
4857
|
}));
|
|
4770
4858
|
})));
|
|
4771
4859
|
}));
|
|
4772
|
-
},
|
|
4773
|
-
e = e || {},
|
|
4860
|
+
}, me = [0.1, 0.25], br = function(s, e) {
|
|
4861
|
+
e = e || {}, tt(_e((function() {
|
|
4774
4862
|
var t, r = b("CLS", 0), n = 0, i = [], o = function(c) {
|
|
4775
4863
|
c.forEach((function(u) {
|
|
4776
4864
|
if (!u.hadRecentInput) {
|
|
@@ -4779,147 +4867,147 @@ var ue, Ye = -1, P = function(s) {
|
|
|
4779
4867
|
}
|
|
4780
4868
|
})), n > r.value && (r.value = n, r.entries = i, t());
|
|
4781
4869
|
}, l = F("layout-shift", o);
|
|
4782
|
-
l && (t = A(s, r,
|
|
4870
|
+
l && (t = A(s, r, me, e.reportAllChanges), J((function() {
|
|
4783
4871
|
o(l.takeRecords()), t(!0);
|
|
4784
4872
|
})), P((function() {
|
|
4785
|
-
n = 0, r = b("CLS", 0), t = A(s, r,
|
|
4873
|
+
n = 0, r = b("CLS", 0), t = A(s, r, me, e.reportAllChanges), Te((function() {
|
|
4786
4874
|
return t();
|
|
4787
4875
|
}));
|
|
4788
4876
|
})), setTimeout(t, 0));
|
|
4789
4877
|
})));
|
|
4790
|
-
},
|
|
4878
|
+
}, rt = 0, ne = 1 / 0, G = 0, Ar = function(s) {
|
|
4791
4879
|
s.forEach((function(e) {
|
|
4792
|
-
e.interactionId && (
|
|
4880
|
+
e.interactionId && (ne = Math.min(ne, e.interactionId), G = Math.max(G, e.interactionId), rt = G ? (G - ne) / 7 + 1 : 0);
|
|
4793
4881
|
}));
|
|
4794
|
-
},
|
|
4795
|
-
return
|
|
4796
|
-
},
|
|
4797
|
-
"interactionCount" in performance ||
|
|
4798
|
-
}, y = [],
|
|
4799
|
-
var s = Math.min(y.length - 1, Math.floor((
|
|
4882
|
+
}, st = function() {
|
|
4883
|
+
return he ? rt : performance.interactionCount || 0;
|
|
4884
|
+
}, Lr = function() {
|
|
4885
|
+
"interactionCount" in performance || he || (he = F("event", Ar, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
4886
|
+
}, y = [], j = /* @__PURE__ */ new Map(), nt = 0, Mr = function() {
|
|
4887
|
+
var s = Math.min(y.length - 1, Math.floor((st() - nt) / 50));
|
|
4800
4888
|
return y[s];
|
|
4801
|
-
},
|
|
4802
|
-
if (
|
|
4889
|
+
}, Rr = [], Cr = function(s) {
|
|
4890
|
+
if (Rr.forEach((function(n) {
|
|
4803
4891
|
return n(s);
|
|
4804
4892
|
})), s.interactionId || s.entryType === "first-input") {
|
|
4805
|
-
var e = y[y.length - 1], t =
|
|
4893
|
+
var e = y[y.length - 1], t = j.get(s.interactionId);
|
|
4806
4894
|
if (t || y.length < 10 || s.duration > e.latency) {
|
|
4807
4895
|
if (t) s.duration > t.latency ? (t.entries = [s], t.latency = s.duration) : s.duration === t.latency && s.startTime === t.entries[0].startTime && t.entries.push(s);
|
|
4808
4896
|
else {
|
|
4809
4897
|
var r = { id: s.interactionId, latency: s.duration, entries: [s] };
|
|
4810
|
-
|
|
4898
|
+
j.set(r.id, r), y.push(r);
|
|
4811
4899
|
}
|
|
4812
4900
|
y.sort((function(n, i) {
|
|
4813
4901
|
return i.latency - n.latency;
|
|
4814
4902
|
})), y.length > 10 && y.splice(10).forEach((function(n) {
|
|
4815
|
-
return
|
|
4903
|
+
return j.delete(n.id);
|
|
4816
4904
|
}));
|
|
4817
4905
|
}
|
|
4818
4906
|
}
|
|
4819
|
-
},
|
|
4907
|
+
}, it = function(s) {
|
|
4820
4908
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
4821
|
-
return s =
|
|
4822
|
-
},
|
|
4909
|
+
return s = _e(s), document.visibilityState === "hidden" ? s() : (t = e(s), J(s)), t;
|
|
4910
|
+
}, ge = [200, 500], Nr = function(s, e) {
|
|
4823
4911
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, Z((function() {
|
|
4824
4912
|
var t;
|
|
4825
|
-
|
|
4913
|
+
Lr();
|
|
4826
4914
|
var r, n = b("INP"), i = function(l) {
|
|
4827
|
-
|
|
4828
|
-
l.forEach(
|
|
4829
|
-
var c =
|
|
4915
|
+
it((function() {
|
|
4916
|
+
l.forEach(Cr);
|
|
4917
|
+
var c = Mr();
|
|
4830
4918
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, r());
|
|
4831
4919
|
}));
|
|
4832
4920
|
}, o = F("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
4833
|
-
r = A(s, n,
|
|
4921
|
+
r = A(s, n, ge, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), J((function() {
|
|
4834
4922
|
i(o.takeRecords()), r(!0);
|
|
4835
4923
|
})), P((function() {
|
|
4836
|
-
|
|
4924
|
+
nt = st(), y.length = 0, j.clear(), n = b("INP"), r = A(s, n, ge, e.reportAllChanges);
|
|
4837
4925
|
})));
|
|
4838
4926
|
})));
|
|
4839
|
-
},
|
|
4927
|
+
}, Ee = [2500, 4e3], ie = {}, Or = function(s, e) {
|
|
4840
4928
|
e = e || {}, Z((function() {
|
|
4841
|
-
var t, r =
|
|
4929
|
+
var t, r = et(), n = b("LCP"), i = function(c) {
|
|
4842
4930
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
4843
4931
|
u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime - q(), 0), n.entries = [u], t());
|
|
4844
4932
|
}));
|
|
4845
4933
|
}, o = F("largest-contentful-paint", i);
|
|
4846
4934
|
if (o) {
|
|
4847
|
-
t = A(s, n,
|
|
4848
|
-
var l =
|
|
4849
|
-
|
|
4935
|
+
t = A(s, n, Ee, e.reportAllChanges);
|
|
4936
|
+
var l = _e((function() {
|
|
4937
|
+
ie[n.id] || (i(o.takeRecords()), o.disconnect(), ie[n.id] = !0, t(!0));
|
|
4850
4938
|
}));
|
|
4851
4939
|
["keydown", "click"].forEach((function(c) {
|
|
4852
4940
|
addEventListener(c, (function() {
|
|
4853
|
-
return
|
|
4941
|
+
return it(l);
|
|
4854
4942
|
}), { once: !0, capture: !0 });
|
|
4855
4943
|
})), J(l), P((function(c) {
|
|
4856
|
-
n = b("LCP"), t = A(s, n,
|
|
4857
|
-
n.value = performance.now() - c.timeStamp,
|
|
4944
|
+
n = b("LCP"), t = A(s, n, Ee, e.reportAllChanges), Te((function() {
|
|
4945
|
+
n.value = performance.now() - c.timeStamp, ie[n.id] = !0, t(!0);
|
|
4858
4946
|
}));
|
|
4859
4947
|
}));
|
|
4860
4948
|
}
|
|
4861
4949
|
}));
|
|
4862
|
-
},
|
|
4950
|
+
}, Se = [800, 1800], Pr = function s(e) {
|
|
4863
4951
|
document.prerendering ? Z((function() {
|
|
4864
4952
|
return s(e);
|
|
4865
4953
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
4866
4954
|
return s(e);
|
|
4867
4955
|
}), !0) : setTimeout(e, 0);
|
|
4868
|
-
},
|
|
4956
|
+
}, Dr = function(s, e) {
|
|
4869
4957
|
e = e || {};
|
|
4870
|
-
var t = b("TTFB"), r = A(s, t,
|
|
4871
|
-
|
|
4872
|
-
var n =
|
|
4958
|
+
var t = b("TTFB"), r = A(s, t, Se, e.reportAllChanges);
|
|
4959
|
+
Pr((function() {
|
|
4960
|
+
var n = pe();
|
|
4873
4961
|
n && (t.value = Math.max(n.responseStart - q(), 0), t.entries = [n], r(!0), P((function() {
|
|
4874
|
-
t = b("TTFB", 0), (r = A(s, t,
|
|
4962
|
+
t = b("TTFB", 0), (r = A(s, t, Se, e.reportAllChanges))(!0);
|
|
4875
4963
|
})));
|
|
4876
4964
|
}));
|
|
4877
4965
|
};
|
|
4878
|
-
const
|
|
4966
|
+
const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4879
4967
|
__proto__: null,
|
|
4880
|
-
CLSThresholds:
|
|
4881
|
-
FCPThresholds:
|
|
4882
|
-
INPThresholds:
|
|
4883
|
-
LCPThresholds:
|
|
4884
|
-
TTFBThresholds:
|
|
4885
|
-
onCLS:
|
|
4886
|
-
onFCP:
|
|
4887
|
-
onINP:
|
|
4888
|
-
onLCP:
|
|
4889
|
-
onTTFB:
|
|
4968
|
+
CLSThresholds: me,
|
|
4969
|
+
FCPThresholds: fe,
|
|
4970
|
+
INPThresholds: ge,
|
|
4971
|
+
LCPThresholds: Ee,
|
|
4972
|
+
TTFBThresholds: Se,
|
|
4973
|
+
onCLS: br,
|
|
4974
|
+
onFCP: tt,
|
|
4975
|
+
onINP: Nr,
|
|
4976
|
+
onLCP: Or,
|
|
4977
|
+
onTTFB: Dr
|
|
4890
4978
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4891
4979
|
export {
|
|
4892
4980
|
h as AppConfigValidationError,
|
|
4893
|
-
|
|
4894
|
-
|
|
4981
|
+
Vr as DEFAULT_SESSION_TIMEOUT,
|
|
4982
|
+
ce as DEFAULT_WEB_VITALS_MODE,
|
|
4895
4983
|
L as DeviceType,
|
|
4896
|
-
|
|
4984
|
+
oe as EmitterEvent,
|
|
4897
4985
|
U as ErrorType,
|
|
4898
4986
|
d as EventType,
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4987
|
+
zr as InitializationTimeoutError,
|
|
4988
|
+
k as IntegrationValidationError,
|
|
4989
|
+
Xr as MAX_ARRAY_LENGTH,
|
|
4990
|
+
Fr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
4991
|
+
Hr as MAX_CUSTOM_EVENT_KEYS,
|
|
4992
|
+
Ur as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
4993
|
+
xr as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
4994
|
+
Br as MAX_METADATA_NESTING_DEPTH,
|
|
4995
|
+
$r as MAX_NESTED_OBJECT_KEYS,
|
|
4996
|
+
Wr as MAX_STRING_LENGTH,
|
|
4997
|
+
Gr as MAX_STRING_LENGTH_IN_ARRAY,
|
|
4998
|
+
z as Mode,
|
|
4999
|
+
Xe as PII_PATTERNS,
|
|
4912
5000
|
N as PermanentError,
|
|
4913
|
-
|
|
5001
|
+
Re as SamplingRateValidationError,
|
|
4914
5002
|
X as ScrollDirection,
|
|
4915
|
-
|
|
4916
|
-
|
|
5003
|
+
ft as SessionTimeoutValidationError,
|
|
5004
|
+
V as SpecialApiUrl,
|
|
4917
5005
|
H as TraceLogValidationError,
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
5006
|
+
Kr as WEB_VITALS_GOOD_THRESHOLDS,
|
|
5007
|
+
Pe as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
5008
|
+
Rt as WEB_VITALS_POOR_THRESHOLDS,
|
|
5009
|
+
De as getWebVitalsThresholds,
|
|
5010
|
+
Qr as isPrimaryScrollEvent,
|
|
5011
|
+
jr as isSecondaryScrollEvent,
|
|
5012
|
+
Yr as tracelog
|
|
4925
5013
|
};
|