@tracelog/lib 2.8.1 → 2.8.2-rc.102.6
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 +393 -346
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +2 -2
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +2 -2
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +8 -0
- package/dist/public-api.d.ts +8 -0
- 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 Er = 1e3,
|
|
4
|
-
const b = "data-tlog",
|
|
1
|
+
const ur = 9e5;
|
|
2
|
+
const dr = 120, hr = 49152, fr = 100, mr = 500, gr = 200;
|
|
3
|
+
const Er = 1e3, pr = 500, Sr = 1e3;
|
|
4
|
+
const b = "data-tlog", bt = [
|
|
5
5
|
"button",
|
|
6
6
|
"a",
|
|
7
7
|
'input[type="button"]',
|
|
@@ -33,7 +33,7 @@ const b = "data-tlog", At = [
|
|
|
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",
|
|
@@ -72,14 +72,14 @@ const E = {
|
|
|
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
|
+
}, Mt = [
|
|
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`, Te = `${I}:uid`,
|
|
82
|
+
], I = "tlog", X = `${I}:qa_mode`, Te = `${I}:uid`, rt = "tlog_mode", Ue = "qa", He = "qa_off", Ct = (r) => r ? `${I}:${r}:queue` : `${I}:queue`, Rt = (r) => r ? `${I}:${r}:session` : `${I}:session`, Nt = (r) => r ? `${I}:${r}:broadcast` : `${I}:broadcast`, Fe = (r, e) => `${I}:${r}:session_counts:${e}`, xe = 10080 * 60 * 1e3, $e = `${I}:session_counts_last_cleanup`, Be = 3600 * 1e3, fe = (r) => r ? `${I}:${r}:identity` : `${I}:identity`, U = `${I}:pending_identity`;
|
|
83
83
|
var $ = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))($ || {}), L = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(L || {}), se = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(se || {});
|
|
84
84
|
class O extends Error {
|
|
85
85
|
constructor(e, t) {
|
|
@@ -97,8 +97,8 @@ class ne extends Error {
|
|
|
97
97
|
super(e), this.name = "TimeoutError", Error.captureStackTrace && Error.captureStackTrace(this, ne);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
var
|
|
101
|
-
const Tr = (r) => r.type ===
|
|
100
|
+
var d = /* @__PURE__ */ ((r) => (r.PAGE_VIEW = "page_view", r.CLICK = "click", r.SCROLL = "scroll", r.SESSION_START = "session_start", r.CUSTOM = "custom", r.WEB_VITALS = "web_vitals", r.ERROR = "error", r.VIEWPORT_VISIBLE = "viewport_visible", r))(d || {}), Z = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(Z || {}), B = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(B || {}), ie = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(ie || {});
|
|
101
|
+
const Tr = (r) => r.type === d.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !0, Ir = (r) => r.type === d.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !1;
|
|
102
102
|
class j extends Error {
|
|
103
103
|
constructor(e, t, s) {
|
|
104
104
|
super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
@@ -111,12 +111,12 @@ class m extends j {
|
|
|
111
111
|
super(e, "APP_CONFIG_INVALID", t);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class
|
|
114
|
+
class Ot extends j {
|
|
115
115
|
constructor(e, t = "config") {
|
|
116
116
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class We extends j {
|
|
120
120
|
constructor(e, t = "config") {
|
|
121
121
|
super(e, "SAMPLING_RATE_INVALID", t);
|
|
122
122
|
}
|
|
@@ -132,7 +132,7 @@ class vr extends j {
|
|
|
132
132
|
}
|
|
133
133
|
timeoutMs;
|
|
134
134
|
}
|
|
135
|
-
const
|
|
135
|
+
const nt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", it = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Pt = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Dt = (r, e) => {
|
|
136
136
|
if (e) {
|
|
137
137
|
if (e instanceof Error) {
|
|
138
138
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
|
|
@@ -151,7 +151,7 @@ const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
151
151
|
return `[TraceLog] ${r}: ${String(e)}`;
|
|
152
152
|
}
|
|
153
153
|
return `[TraceLog] ${r}`;
|
|
154
|
-
},
|
|
154
|
+
}, kt = () => {
|
|
155
155
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
156
156
|
return !1;
|
|
157
157
|
try {
|
|
@@ -160,12 +160,12 @@ const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
160
160
|
return !1;
|
|
161
161
|
}
|
|
162
162
|
}, a = (r, e, t) => {
|
|
163
|
-
const { error: s, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = s ?
|
|
164
|
-
if (!
|
|
163
|
+
const { error: s, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = s ? Dt(e, s) : `[TraceLog] ${e}`, u = r === "error" ? "error" : r === "warn" ? "warn" : "log";
|
|
164
|
+
if (!Vt(l, i))
|
|
165
165
|
return;
|
|
166
|
-
const g =
|
|
167
|
-
|
|
168
|
-
},
|
|
166
|
+
const g = Ut(l, o), T = n !== void 0 ? Ie(n) : void 0;
|
|
167
|
+
Ht(u, c, g, T);
|
|
168
|
+
}, Vt = (r, e) => r === "critical" ? !0 : r === "qa" || e ? kt() : !1, Ut = (r, e) => e !== void 0 && e !== "" ? e : r === "critical" ? Pt : "", Ht = (r, e, t, s) => {
|
|
169
169
|
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
170
170
|
s !== void 0 ? n ? console[r](i, t, s) : console[r](i, s) : n ? console[r](i, t) : console[r](i);
|
|
171
171
|
}, Ie = (r) => {
|
|
@@ -182,10 +182,10 @@ const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
182
182
|
}
|
|
183
183
|
return e;
|
|
184
184
|
};
|
|
185
|
-
let ve,
|
|
186
|
-
const
|
|
187
|
-
typeof window < "u" && !ve && (ve = window.matchMedia("(pointer: coarse)"),
|
|
188
|
-
}, oe = "Unknown",
|
|
185
|
+
let ve, ot;
|
|
186
|
+
const Ft = () => {
|
|
187
|
+
typeof window < "u" && !ve && (ve = window.matchMedia("(pointer: coarse)"), ot = window.matchMedia("(hover: none)"));
|
|
188
|
+
}, oe = "Unknown", xt = (r) => {
|
|
189
189
|
const e = r.userAgentData?.platform;
|
|
190
190
|
if (e != null && e !== "") {
|
|
191
191
|
if (/windows/i.test(e)) return "Windows";
|
|
@@ -197,7 +197,7 @@ const xt = () => {
|
|
|
197
197
|
}
|
|
198
198
|
const t = navigator.userAgent;
|
|
199
199
|
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" : oe;
|
|
200
|
-
},
|
|
200
|
+
}, $t = (r) => {
|
|
201
201
|
const e = r.userAgentData?.brands;
|
|
202
202
|
if (e != null && e.length > 0) {
|
|
203
203
|
const n = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
|
|
@@ -208,26 +208,26 @@ const xt = () => {
|
|
|
208
208
|
}
|
|
209
209
|
const t = navigator.userAgent;
|
|
210
210
|
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" : oe;
|
|
211
|
-
},
|
|
211
|
+
}, Bt = () => {
|
|
212
212
|
try {
|
|
213
213
|
const r = navigator;
|
|
214
214
|
if (r.userAgentData != null && typeof r.userAgentData.mobile == "boolean") {
|
|
215
215
|
const c = r.userAgentData.platform;
|
|
216
216
|
return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet : r.userAgentData.mobile ? L.Mobile : L.Desktop;
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
const e = window.innerWidth, t = ve?.matches ?? !1, s =
|
|
218
|
+
Ft();
|
|
219
|
+
const e = window.innerWidth, t = ve?.matches ?? !1, s = ot?.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);
|
|
220
220
|
return e <= 767 || o && n ? L.Mobile : e >= 768 && e <= 1024 || l || t && s && n ? L.Tablet : L.Desktop;
|
|
221
221
|
} catch (r) {
|
|
222
222
|
return a("debug", "Device detection failed, defaulting to desktop", { error: r }), L.Desktop;
|
|
223
223
|
}
|
|
224
|
-
},
|
|
224
|
+
}, Wt = () => {
|
|
225
225
|
try {
|
|
226
226
|
const r = navigator;
|
|
227
227
|
return {
|
|
228
|
-
type:
|
|
229
|
-
os:
|
|
230
|
-
browser:
|
|
228
|
+
type: Bt(),
|
|
229
|
+
os: xt(r),
|
|
230
|
+
browser: $t(r)
|
|
231
231
|
};
|
|
232
232
|
} catch (r) {
|
|
233
233
|
return a("debug", "Device info detection failed, using defaults", { error: r }), {
|
|
@@ -236,7 +236,7 @@ const xt = () => {
|
|
|
236
236
|
browser: oe
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
},
|
|
239
|
+
}, at = [
|
|
240
240
|
// Email addresses
|
|
241
241
|
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
|
|
242
242
|
// US Phone numbers (various formats)
|
|
@@ -253,7 +253,7 @@ const xt = () => {
|
|
|
253
253
|
/:\/\/[^:/]+:([^@]+)@/gi,
|
|
254
254
|
// Sensitive URL query parameters (token=, password=, auth=, secret=, api_key=, etc.)
|
|
255
255
|
/[?&](token|password|passwd|auth|secret|secret_key|private_key|auth_key|api_key|apikey|access_token)=[^&\s]+/gi
|
|
256
|
-
],
|
|
256
|
+
], Xe = 500, Ge = 2e3, je = 5e3, ee = 50, Xt = ee * 2, lt = 1, Gt = 1e3, jt = 10, ze = 5e3, zt = 6e4, _r = {
|
|
257
257
|
LCP: 2500,
|
|
258
258
|
// Good: ≤ 2.5s
|
|
259
259
|
FCP: 1800,
|
|
@@ -265,7 +265,7 @@ const xt = () => {
|
|
|
265
265
|
TTFB: 800,
|
|
266
266
|
// Good: ≤ 800ms
|
|
267
267
|
LONG_TASK: 50
|
|
268
|
-
},
|
|
268
|
+
}, Qe = {
|
|
269
269
|
LCP: 2500,
|
|
270
270
|
// Needs improvement: > 2.5s (same as good boundary)
|
|
271
271
|
FCP: 1800,
|
|
@@ -277,7 +277,7 @@ const xt = () => {
|
|
|
277
277
|
TTFB: 800,
|
|
278
278
|
// Needs improvement: > 800ms
|
|
279
279
|
LONG_TASK: 50
|
|
280
|
-
},
|
|
280
|
+
}, Qt = {
|
|
281
281
|
LCP: 4e3,
|
|
282
282
|
// Poor: > 4s
|
|
283
283
|
FCP: 3e3,
|
|
@@ -289,53 +289,53 @@ const xt = () => {
|
|
|
289
289
|
TTFB: 1800,
|
|
290
290
|
// Poor: > 1800ms
|
|
291
291
|
LONG_TASK: 50
|
|
292
|
-
}, _e = "needs-improvement",
|
|
292
|
+
}, _e = "needs-improvement", Ke = (r = _e) => {
|
|
293
293
|
switch (r) {
|
|
294
294
|
case "all":
|
|
295
295
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
|
|
296
296
|
// Track everything
|
|
297
297
|
case "needs-improvement":
|
|
298
|
-
return
|
|
298
|
+
return Qe;
|
|
299
299
|
case "poor":
|
|
300
|
-
return
|
|
300
|
+
return Qt;
|
|
301
301
|
default:
|
|
302
|
-
return
|
|
302
|
+
return Qe;
|
|
303
303
|
}
|
|
304
|
-
},
|
|
304
|
+
}, Kt = 1e3, Yt = 50, qt = "2.8.2", Jt = qt, ct = () => typeof window < "u" && typeof sessionStorage < "u", Zt = () => {
|
|
305
305
|
try {
|
|
306
306
|
const r = new URLSearchParams(window.location.search);
|
|
307
|
-
r.delete(
|
|
307
|
+
r.delete(rt);
|
|
308
308
|
const e = r.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
|
|
309
309
|
window.history.replaceState({}, "", t);
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
|
-
},
|
|
313
|
-
if (!
|
|
312
|
+
}, es = () => {
|
|
313
|
+
if (!ct())
|
|
314
314
|
return !1;
|
|
315
315
|
try {
|
|
316
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
316
|
+
const e = new URLSearchParams(window.location.search).get(rt), t = sessionStorage.getItem(X);
|
|
317
317
|
let s = null;
|
|
318
|
-
return e ===
|
|
318
|
+
return e === Ue ? (s = !0, sessionStorage.setItem(X, "true"), a("info", "QA Mode ACTIVE", {
|
|
319
319
|
visibility: "qa",
|
|
320
|
-
style:
|
|
321
|
-
})) : e ===
|
|
320
|
+
style: nt
|
|
321
|
+
})) : e === He && (s = !1, sessionStorage.setItem(X, "false"), a("info", "QA Mode DISABLED", {
|
|
322
322
|
visibility: "qa",
|
|
323
|
-
style:
|
|
324
|
-
})), (e ===
|
|
323
|
+
style: it
|
|
324
|
+
})), (e === Ue || e === He) && Zt(), s ?? t === "true";
|
|
325
325
|
} catch {
|
|
326
326
|
return !1;
|
|
327
327
|
}
|
|
328
|
-
},
|
|
329
|
-
if (
|
|
328
|
+
}, ts = (r) => {
|
|
329
|
+
if (ct())
|
|
330
330
|
try {
|
|
331
331
|
sessionStorage.setItem(X, r ? "true" : "false"), a("info", r ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
332
332
|
visibility: "qa",
|
|
333
|
-
style: r ?
|
|
333
|
+
style: r ? nt : it
|
|
334
334
|
});
|
|
335
335
|
} catch {
|
|
336
336
|
a("debug", "Cannot set QA mode: sessionStorage unavailable");
|
|
337
337
|
}
|
|
338
|
-
},
|
|
338
|
+
}, ss = [
|
|
339
339
|
"co.uk",
|
|
340
340
|
"org.uk",
|
|
341
341
|
"com.au",
|
|
@@ -347,25 +347,25 @@ const xt = () => {
|
|
|
347
347
|
"co.in",
|
|
348
348
|
"com.cn",
|
|
349
349
|
"co.za"
|
|
350
|
-
],
|
|
350
|
+
], Ye = (r) => {
|
|
351
351
|
const e = r.toLowerCase().split(".");
|
|
352
352
|
if (e.length <= 2)
|
|
353
353
|
return r.toLowerCase();
|
|
354
354
|
const t = e.slice(-2).join(".");
|
|
355
|
-
return
|
|
356
|
-
},
|
|
355
|
+
return ss.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
356
|
+
}, rs = (r, e) => r === e ? !0 : Ye(r) === Ye(e), me = () => {
|
|
357
357
|
const r = document.referrer;
|
|
358
358
|
if (!r)
|
|
359
359
|
return "Direct";
|
|
360
360
|
try {
|
|
361
361
|
const e = new URL(r).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
|
|
362
|
-
return
|
|
362
|
+
return rs(e, t) ? "Direct" : r;
|
|
363
363
|
} catch (e) {
|
|
364
364
|
return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: r } }), r;
|
|
365
365
|
}
|
|
366
366
|
}, ge = () => {
|
|
367
367
|
const r = new URLSearchParams(window.location.search), e = {};
|
|
368
|
-
return
|
|
368
|
+
return At.forEach((s) => {
|
|
369
369
|
const n = r.get(s);
|
|
370
370
|
if (n) {
|
|
371
371
|
const i = s.split("utm_")[1];
|
|
@@ -377,7 +377,7 @@ const xt = () => {
|
|
|
377
377
|
return (r === "x" ? e : e & 3 | 8).toString(16);
|
|
378
378
|
});
|
|
379
379
|
let Y = 0, q = 0;
|
|
380
|
-
const
|
|
380
|
+
const ns = () => {
|
|
381
381
|
let r = Date.now();
|
|
382
382
|
r < q && (r = q), r === q ? Y = (Y + 1) % 1e3 : Y = 0, q = r;
|
|
383
383
|
const e = Y.toString().padStart(3, "0");
|
|
@@ -390,7 +390,7 @@ const ye = () => {
|
|
|
390
390
|
} catch {
|
|
391
391
|
}
|
|
392
392
|
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${r}-${e}-${t}`;
|
|
393
|
-
},
|
|
393
|
+
}, dt = (r, e = !1) => {
|
|
394
394
|
try {
|
|
395
395
|
const t = new URL(r), s = t.protocol === "https:", n = t.protocol === "http:";
|
|
396
396
|
return s || e && n;
|
|
@@ -415,7 +415,7 @@ const ye = () => {
|
|
|
415
415
|
if (s.length === 2 ? n = s.join(".") : n = s.slice(-2).join("."), !n || n.split(".").length < 2)
|
|
416
416
|
throw new Error("Invalid domain structure for SaaS");
|
|
417
417
|
const i = `https://${r}.${n}/collect`;
|
|
418
|
-
if (!
|
|
418
|
+
if (!dt(i))
|
|
419
419
|
throw new Error("Generated URL failed validation");
|
|
420
420
|
return i;
|
|
421
421
|
} catch (e) {
|
|
@@ -427,16 +427,16 @@ const ye = () => {
|
|
|
427
427
|
const t = r.integrations?.custom?.collectApiUrl;
|
|
428
428
|
if (t) {
|
|
429
429
|
const s = r.integrations?.custom?.allowHttp ?? !1;
|
|
430
|
-
if (!
|
|
430
|
+
if (!dt(t, s))
|
|
431
431
|
throw new Error("Invalid custom API URL");
|
|
432
432
|
e.custom = t;
|
|
433
433
|
}
|
|
434
434
|
return e;
|
|
435
|
-
},
|
|
435
|
+
}, ye = (r, e = []) => {
|
|
436
436
|
if (!r || typeof r != "string")
|
|
437
437
|
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof r } }), r || "";
|
|
438
438
|
try {
|
|
439
|
-
const t = new URL(r), s = t.searchParams, n = [.../* @__PURE__ */ new Set([...
|
|
439
|
+
const t = new URL(r), s = t.searchParams, n = [.../* @__PURE__ */ new Set([...Lt, ...e])];
|
|
440
440
|
let i = !1;
|
|
441
441
|
const o = [];
|
|
442
442
|
return n.forEach((c) => {
|
|
@@ -445,13 +445,13 @@ const ye = () => {
|
|
|
445
445
|
} catch (t) {
|
|
446
446
|
return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: r?.length } }), r;
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, qe = (r) => {
|
|
449
449
|
if (!r || typeof r != "string" || r.trim().length === 0)
|
|
450
450
|
return "";
|
|
451
451
|
let e = r;
|
|
452
452
|
r.length > 1e3 && (e = r.slice(0, Math.max(0, 1e3)));
|
|
453
453
|
let t = 0;
|
|
454
|
-
for (const n of
|
|
454
|
+
for (const n of Mt) {
|
|
455
455
|
const i = e;
|
|
456
456
|
e = e.replace(n, ""), i !== e && t++;
|
|
457
457
|
}
|
|
@@ -461,11 +461,11 @@ const ye = () => {
|
|
|
461
461
|
valueLength: r.length
|
|
462
462
|
}
|
|
463
463
|
}), e.trim();
|
|
464
|
-
},
|
|
464
|
+
}, we = (r, e = 0) => {
|
|
465
465
|
if (r == null)
|
|
466
466
|
return null;
|
|
467
467
|
if (typeof r == "string")
|
|
468
|
-
return
|
|
468
|
+
return qe(r);
|
|
469
469
|
if (typeof r == "number")
|
|
470
470
|
return !Number.isFinite(r) || r < -Number.MAX_SAFE_INTEGER || r > Number.MAX_SAFE_INTEGER ? 0 : r;
|
|
471
471
|
if (typeof r == "boolean")
|
|
@@ -473,13 +473,13 @@ const ye = () => {
|
|
|
473
473
|
if (e > 10)
|
|
474
474
|
return null;
|
|
475
475
|
if (Array.isArray(r))
|
|
476
|
-
return r.slice(0, 1e3).map((n) =>
|
|
476
|
+
return r.slice(0, 1e3).map((n) => we(n, e + 1)).filter((n) => n !== null);
|
|
477
477
|
if (typeof r == "object") {
|
|
478
478
|
const t = {}, n = Object.entries(r).slice(0, 200);
|
|
479
479
|
for (const [i, o] of n) {
|
|
480
|
-
const l =
|
|
480
|
+
const l = qe(i);
|
|
481
481
|
if (l) {
|
|
482
|
-
const c =
|
|
482
|
+
const c = we(o, e + 1);
|
|
483
483
|
c !== null && (t[l] = c);
|
|
484
484
|
}
|
|
485
485
|
}
|
|
@@ -490,7 +490,7 @@ const ye = () => {
|
|
|
490
490
|
if (typeof r != "object" || r === null)
|
|
491
491
|
return {};
|
|
492
492
|
try {
|
|
493
|
-
const e =
|
|
493
|
+
const e = we(r);
|
|
494
494
|
return typeof e == "object" && e !== null ? e : {};
|
|
495
495
|
} catch (e) {
|
|
496
496
|
const t = e instanceof Error ? e.message : String(e);
|
|
@@ -501,10 +501,10 @@ const ye = () => {
|
|
|
501
501
|
throw new m("Configuration must be an object", "config");
|
|
502
502
|
if (r) {
|
|
503
503
|
if (r.sessionTimeout !== void 0 && (typeof r.sessionTimeout != "number" || r.sessionTimeout < 3e4 || r.sessionTimeout > 864e5))
|
|
504
|
-
throw new
|
|
504
|
+
throw new Ot(E.INVALID_SESSION_TIMEOUT, "config");
|
|
505
505
|
if (r.globalMetadata !== void 0 && (typeof r.globalMetadata != "object" || r.globalMetadata === null))
|
|
506
506
|
throw new m(E.INVALID_GLOBAL_METADATA, "config");
|
|
507
|
-
if (r.integrations &&
|
|
507
|
+
if (r.integrations && us(r.integrations), r.sensitiveQueryParams !== void 0) {
|
|
508
508
|
if (!Array.isArray(r.sensitiveQueryParams))
|
|
509
509
|
throw new m(E.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
510
510
|
for (const e of r.sensitiveQueryParams)
|
|
@@ -512,9 +512,9 @@ const ye = () => {
|
|
|
512
512
|
throw new m("All sensitive query params must be strings", "config");
|
|
513
513
|
}
|
|
514
514
|
if (r.errorSampling !== void 0 && (typeof r.errorSampling != "number" || r.errorSampling < 0 || r.errorSampling > 1))
|
|
515
|
-
throw new
|
|
515
|
+
throw new We(E.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
516
516
|
if (r.samplingRate !== void 0 && (typeof r.samplingRate != "number" || r.samplingRate < 0 || r.samplingRate > 1))
|
|
517
|
-
throw new
|
|
517
|
+
throw new We(E.INVALID_SAMPLING_RATE, "config");
|
|
518
518
|
if (r.primaryScrollSelector !== void 0) {
|
|
519
519
|
if (typeof r.primaryScrollSelector != "string" || !r.primaryScrollSelector.trim())
|
|
520
520
|
throw new m(E.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
@@ -597,7 +597,7 @@ const ye = () => {
|
|
|
597
597
|
throw new m(E.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
598
598
|
if (r.maxTrackedElements !== void 0 && (typeof r.maxTrackedElements != "number" || r.maxTrackedElements <= 0))
|
|
599
599
|
throw new m(E.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
600
|
-
},
|
|
600
|
+
}, us = (r) => {
|
|
601
601
|
if (r) {
|
|
602
602
|
if (r.tracelog && (!r.tracelog.projectId || typeof r.tracelog.projectId != "string" || r.tracelog.projectId.trim() === ""))
|
|
603
603
|
throw new N(E.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
@@ -620,14 +620,14 @@ const ye = () => {
|
|
|
620
620
|
if (r.tracelog?.shopify !== void 0 && typeof r.tracelog.shopify != "boolean")
|
|
621
621
|
throw new N("tracelog.shopify must be a boolean", "config");
|
|
622
622
|
}
|
|
623
|
-
},
|
|
623
|
+
}, ds = (r) => {
|
|
624
624
|
ls(r);
|
|
625
625
|
const e = {
|
|
626
626
|
...r ?? {},
|
|
627
627
|
sessionTimeout: r?.sessionTimeout ?? 9e5,
|
|
628
628
|
globalMetadata: r?.globalMetadata ?? {},
|
|
629
629
|
sensitiveQueryParams: r?.sensitiveQueryParams ?? [],
|
|
630
|
-
errorSampling: r?.errorSampling ??
|
|
630
|
+
errorSampling: r?.errorSampling ?? lt,
|
|
631
631
|
samplingRate: r?.samplingRate ?? 1,
|
|
632
632
|
pageViewThrottleMs: r?.pageViewThrottleMs ?? 1e3,
|
|
633
633
|
clickThrottleMs: r?.clickThrottleMs ?? 300,
|
|
@@ -644,12 +644,12 @@ const ye = () => {
|
|
|
644
644
|
cooldownPeriod: e.viewport.cooldownPeriod ?? 6e4,
|
|
645
645
|
maxTrackedElements: e.viewport.maxTrackedElements ?? 100
|
|
646
646
|
}), e;
|
|
647
|
-
},
|
|
647
|
+
}, be = (r, e = /* @__PURE__ */ new Set()) => {
|
|
648
648
|
if (r == null)
|
|
649
649
|
return !0;
|
|
650
650
|
const t = typeof r;
|
|
651
|
-
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(r) ? !1 : (e.add(r), Array.isArray(r) ? r.every((s) =>
|
|
652
|
-
}, hs = (r) => typeof r != "object" || r === null ? !1 :
|
|
651
|
+
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(r) ? !1 : (e.add(r), Array.isArray(r) ? r.every((s) => be(s, e)) : t === "object" ? Object.values(r).every((s) => be(s, e)) : !1);
|
|
652
|
+
}, hs = (r) => typeof r != "object" || r === null ? !1 : be(r), ht = (r) => {
|
|
653
653
|
if (typeof r != "object" || r === null || Array.isArray(r)) return;
|
|
654
654
|
const e = {};
|
|
655
655
|
for (const [t, s] of Object.entries(r))
|
|
@@ -670,7 +670,7 @@ const ye = () => {
|
|
|
670
670
|
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(r.toLowerCase()) ? {
|
|
671
671
|
valid: !1,
|
|
672
672
|
error: "Event name cannot be a reserved word"
|
|
673
|
-
} : { valid: !0 },
|
|
673
|
+
} : { valid: !0 }, Je = (r, e, t) => {
|
|
674
674
|
const s = as(e), n = t && t === "customEvent" ? `${t} "${r}" metadata error` : `${r} metadata error`;
|
|
675
675
|
if (!hs(s))
|
|
676
676
|
return {
|
|
@@ -696,21 +696,21 @@ const ye = () => {
|
|
|
696
696
|
valid: !1,
|
|
697
697
|
error: `${n}: object has too many keys (max 100 keys).`
|
|
698
698
|
};
|
|
699
|
-
for (const [c,
|
|
700
|
-
if (Array.isArray(
|
|
701
|
-
if (
|
|
699
|
+
for (const [c, u] of Object.entries(s)) {
|
|
700
|
+
if (Array.isArray(u)) {
|
|
701
|
+
if (u.length > 500)
|
|
702
702
|
return {
|
|
703
703
|
valid: !1,
|
|
704
704
|
error: `${n}: array property "${c}" is too large (max 500 items).`
|
|
705
705
|
};
|
|
706
|
-
for (const f of
|
|
706
|
+
for (const f of u)
|
|
707
707
|
if (typeof f == "string" && f.length > 500)
|
|
708
708
|
return {
|
|
709
709
|
valid: !1,
|
|
710
710
|
error: `${n}: array property "${c}" contains strings that are too long (max 500 characters).`
|
|
711
711
|
};
|
|
712
712
|
}
|
|
713
|
-
if (typeof
|
|
713
|
+
if (typeof u == "string" && u.length > 1e3)
|
|
714
714
|
return {
|
|
715
715
|
valid: !1,
|
|
716
716
|
error: `${n}: property "${c}" is too long (max 1000 characters).`
|
|
@@ -720,7 +720,7 @@ const ye = () => {
|
|
|
720
720
|
valid: !0,
|
|
721
721
|
sanitizedMetadata: s
|
|
722
722
|
};
|
|
723
|
-
},
|
|
723
|
+
}, ft = (r, e, t) => {
|
|
724
724
|
if (Array.isArray(e)) {
|
|
725
725
|
const s = [], n = t && t === "customEvent" ? `${t} "${r}" metadata error` : `${r} metadata error`;
|
|
726
726
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -730,7 +730,7 @@ const ye = () => {
|
|
|
730
730
|
valid: !1,
|
|
731
731
|
error: `${n}: array item at index ${i} must be an object.`
|
|
732
732
|
};
|
|
733
|
-
const l =
|
|
733
|
+
const l = Je(r, o, t);
|
|
734
734
|
if (!l.valid)
|
|
735
735
|
return {
|
|
736
736
|
valid: !1,
|
|
@@ -743,7 +743,7 @@ const ye = () => {
|
|
|
743
743
|
sanitizedMetadata: s
|
|
744
744
|
};
|
|
745
745
|
}
|
|
746
|
-
return
|
|
746
|
+
return Je(r, e, t);
|
|
747
747
|
}, ms = (r, e) => {
|
|
748
748
|
const t = fs(r);
|
|
749
749
|
if (!t.valid)
|
|
@@ -752,7 +752,7 @@ const ye = () => {
|
|
|
752
752
|
}), t;
|
|
753
753
|
if (!e)
|
|
754
754
|
return { valid: !0 };
|
|
755
|
-
const s =
|
|
755
|
+
const s = ft(r, e, "customEvent");
|
|
756
756
|
return s.valid || a("error", "Event metadata validation failed", {
|
|
757
757
|
data: {
|
|
758
758
|
eventName: r,
|
|
@@ -877,7 +877,7 @@ class gs {
|
|
|
877
877
|
this.listeners.clear();
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function mt(r, e, t) {
|
|
881
881
|
try {
|
|
882
882
|
const s = e(r);
|
|
883
883
|
return s === null ? null : typeof s == "object" && s !== null && "type" in s ? s : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), r);
|
|
@@ -889,9 +889,9 @@ function gt(r, e, t) {
|
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
891
|
function Es(r, e, t) {
|
|
892
|
-
return r.map((s) =>
|
|
892
|
+
return r.map((s) => mt(s, e, t)).filter((s) => s !== null);
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function gt(r, e, t) {
|
|
895
895
|
try {
|
|
896
896
|
const s = e(r);
|
|
897
897
|
return s === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
|
|
@@ -966,7 +966,7 @@ class _ {
|
|
|
966
966
|
return { ...Ee };
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
|
-
class
|
|
969
|
+
class Ze extends _ {
|
|
970
970
|
storeManager;
|
|
971
971
|
integrationId;
|
|
972
972
|
apiUrl;
|
|
@@ -1051,7 +1051,7 @@ class et extends _ {
|
|
|
1051
1051
|
return { ...this.staticHeaders, ...e };
|
|
1052
1052
|
}
|
|
1053
1053
|
getQueueStorageKey() {
|
|
1054
|
-
const e = this.get("userId") || "anonymous", t =
|
|
1054
|
+
const e = this.get("userId") || "anonymous", t = Ct(e);
|
|
1055
1055
|
return this.integrationId ? `${t}:${this.integrationId}` : t;
|
|
1056
1056
|
}
|
|
1057
1057
|
/**
|
|
@@ -1108,6 +1108,21 @@ class et extends _ {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
), !0) : this.sendQueueSyncInternal(e);
|
|
1110
1110
|
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Persists events to localStorage for recovery without sending.
|
|
1113
|
+
*
|
|
1114
|
+
* Used when an async send is already in-flight to avoid sending the same
|
|
1115
|
+
* events through two paths (fetch + sendBeacon) with different idempotency tokens.
|
|
1116
|
+
* `ensureBatchMetadata()` assigns a stable token before persisting.
|
|
1117
|
+
* On next page load, `recoverPersistedEvents()` sends with the persisted token.
|
|
1118
|
+
*
|
|
1119
|
+
* @param body - Event queue to persist
|
|
1120
|
+
*/
|
|
1121
|
+
persistForRecovery(e) {
|
|
1122
|
+
if (this.shouldSkipSend()) return;
|
|
1123
|
+
const t = this.ensureBatchMetadata(e);
|
|
1124
|
+
this.persistEventsWithFailureCount(t, 0, !0);
|
|
1125
|
+
}
|
|
1111
1126
|
/**
|
|
1112
1127
|
* Sends events asynchronously using `fetch()` API with automatic persistence on failure.
|
|
1113
1128
|
*
|
|
@@ -1318,7 +1333,7 @@ class et extends _ {
|
|
|
1318
1333
|
if (this.integrationId === "saas")
|
|
1319
1334
|
return e;
|
|
1320
1335
|
const t = this.transformers.beforeBatch;
|
|
1321
|
-
return t ?
|
|
1336
|
+
return t ? gt(e, t, this.integrationId || "SenderManager") : e;
|
|
1322
1337
|
}
|
|
1323
1338
|
/**
|
|
1324
1339
|
* Calculates exponential backoff delay with jitter for retry attempts.
|
|
@@ -1396,50 +1411,50 @@ class et extends _ {
|
|
|
1396
1411
|
data: { events: n.events.length }
|
|
1397
1412
|
}), !0;
|
|
1398
1413
|
if (this.consecutiveNetworkFailures >= 3) {
|
|
1399
|
-
const
|
|
1400
|
-
if (
|
|
1414
|
+
const u = Date.now() - this.circuitOpenedAt;
|
|
1415
|
+
if (u < 12e4)
|
|
1401
1416
|
return a("debug", `Network circuit open, skipping send${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1402
1417
|
data: {
|
|
1403
1418
|
consecutiveNetworkFailures: this.consecutiveNetworkFailures,
|
|
1404
|
-
cooldownRemainingMs: 12e4 -
|
|
1419
|
+
cooldownRemainingMs: 12e4 - u
|
|
1405
1420
|
}
|
|
1406
1421
|
}), !1;
|
|
1407
1422
|
}
|
|
1408
1423
|
const { url: i, payload: o } = this.prepareRequest(n);
|
|
1409
1424
|
let l = !0, c = !1;
|
|
1410
|
-
for (let
|
|
1425
|
+
for (let u = 1; u <= 3; u++)
|
|
1411
1426
|
try {
|
|
1412
|
-
return (await this.sendWithTimeout(i, o)).ok ? (
|
|
1427
|
+
return (await this.sendWithTimeout(i, o)).ok ? (u > 1 && a(
|
|
1413
1428
|
"info",
|
|
1414
|
-
`Send succeeded after ${
|
|
1429
|
+
`Send succeeded after ${u - 1} retry attempt(s)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
|
|
1415
1430
|
{
|
|
1416
|
-
data: { events: n.events.length, attempt:
|
|
1431
|
+
data: { events: n.events.length, attempt: u }
|
|
1417
1432
|
}
|
|
1418
1433
|
), this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, !0) : !1;
|
|
1419
1434
|
} catch (f) {
|
|
1420
|
-
const g =
|
|
1435
|
+
const g = u === 3;
|
|
1421
1436
|
if (f instanceof O)
|
|
1422
1437
|
throw this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, f;
|
|
1423
1438
|
if (f instanceof re) {
|
|
1424
1439
|
this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, l = !1, c = !0, a("warn", `Rate limited, skipping retries${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1425
|
-
data: { events: e.events.length, attempt:
|
|
1440
|
+
data: { events: e.events.length, attempt: u }
|
|
1426
1441
|
});
|
|
1427
1442
|
break;
|
|
1428
1443
|
}
|
|
1429
1444
|
if (f instanceof ne || (l = !1), f instanceof TypeError || (c = !0), a(
|
|
1430
1445
|
g ? "error" : "warn",
|
|
1431
|
-
`Send attempt ${
|
|
1446
|
+
`Send attempt ${u} failed${this.integrationId ? ` [${this.integrationId}]` : ""}${g ? " (all retries exhausted)" : ", will retry"}`,
|
|
1432
1447
|
{
|
|
1433
1448
|
error: f,
|
|
1434
1449
|
data: {
|
|
1435
1450
|
events: e.events.length,
|
|
1436
1451
|
url: i.replace(/\/\/[^/]+/, "//[DOMAIN]"),
|
|
1437
|
-
attempt:
|
|
1452
|
+
attempt: u,
|
|
1438
1453
|
maxAttempts: 3
|
|
1439
1454
|
}
|
|
1440
1455
|
}
|
|
1441
1456
|
), !g) {
|
|
1442
|
-
await this.backoffDelay(
|
|
1457
|
+
await this.backoffDelay(u);
|
|
1443
1458
|
continue;
|
|
1444
1459
|
}
|
|
1445
1460
|
return l ? (a(
|
|
@@ -1552,11 +1567,11 @@ class et extends _ {
|
|
|
1552
1567
|
"warn",
|
|
1553
1568
|
`sendBeacon not available, persisting events for recovery${this.integrationId ? ` [${this.integrationId}]` : ""}`
|
|
1554
1569
|
), this.persistEvents(t), !1;
|
|
1555
|
-
const
|
|
1556
|
-
return
|
|
1570
|
+
const u = navigator.sendBeacon(o, c);
|
|
1571
|
+
return u || (a(
|
|
1557
1572
|
"warn",
|
|
1558
1573
|
`sendBeacon rejected request, persisting events for recovery${this.integrationId ? ` [${this.integrationId}]` : ""}`
|
|
1559
|
-
), this.persistEvents(t)),
|
|
1574
|
+
), this.persistEvents(t)), u;
|
|
1560
1575
|
}
|
|
1561
1576
|
/**
|
|
1562
1577
|
* Prepares request by enriching payload with metadata and serializing to JSON.
|
|
@@ -1569,7 +1584,7 @@ class et extends _ {
|
|
|
1569
1584
|
*
|
|
1570
1585
|
* **Idempotency Token**:
|
|
1571
1586
|
* - Set upstream by ensureBatchMetadata() before this method is called
|
|
1572
|
-
* - Fallback
|
|
1587
|
+
* - Fallback computeContentToken() is defensive only (should not trigger in normal flow)
|
|
1573
1588
|
* - Same token persists across all retry attempts of the same batch
|
|
1574
1589
|
* - Backend uses this to deduplicate retries
|
|
1575
1590
|
*
|
|
@@ -1584,10 +1599,10 @@ class et extends _ {
|
|
|
1584
1599
|
...e,
|
|
1585
1600
|
_metadata: {
|
|
1586
1601
|
...e._metadata,
|
|
1587
|
-
idempotency_token: e._metadata?.idempotency_token ??
|
|
1602
|
+
idempotency_token: e._metadata?.idempotency_token ?? this.computeContentToken(e),
|
|
1588
1603
|
referer: typeof window < "u" ? window.location.href : void 0,
|
|
1589
1604
|
timestamp: t,
|
|
1590
|
-
client_version:
|
|
1605
|
+
client_version: Jt
|
|
1591
1606
|
}
|
|
1592
1607
|
};
|
|
1593
1608
|
return {
|
|
@@ -1596,7 +1611,7 @@ class et extends _ {
|
|
|
1596
1611
|
};
|
|
1597
1612
|
}
|
|
1598
1613
|
ensureBatchMetadata(e, t) {
|
|
1599
|
-
const s = e._metadata?.idempotency_token ?? t ??
|
|
1614
|
+
const s = e._metadata?.idempotency_token ?? t ?? this.computeContentToken(e);
|
|
1600
1615
|
return e._metadata?.idempotency_token === s ? e : {
|
|
1601
1616
|
...e,
|
|
1602
1617
|
_metadata: {
|
|
@@ -1605,6 +1620,31 @@ class et extends _ {
|
|
|
1605
1620
|
}
|
|
1606
1621
|
};
|
|
1607
1622
|
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Deterministic 32-bit FNV-1a hash of sorted event IDs, salted with
|
|
1625
|
+
* `user_id` and `session_id`.
|
|
1626
|
+
*
|
|
1627
|
+
* **Purpose**: Produces the same idempotency token for the same set of events
|
|
1628
|
+
* across retries, so the backend's success cache catches in-session retries
|
|
1629
|
+
* before any MongoDB work. Replaces a random token that caused the API to
|
|
1630
|
+
* treat retried batches as new and emit `high_duplicate_rate` warnings.
|
|
1631
|
+
*
|
|
1632
|
+
* **Salting**: Scoping the hash by `user_id` + `session_id` ensures that
|
|
1633
|
+
* batches from different users/sessions cannot share a token even if their
|
|
1634
|
+
* event IDs hypothetically collided, eliminating cross-scope dedup risk
|
|
1635
|
+
* regardless of how the backend keys its success cache.
|
|
1636
|
+
*
|
|
1637
|
+
* @param body - Event queue whose events determine the token
|
|
1638
|
+
* @returns 8-char hex string
|
|
1639
|
+
* @private
|
|
1640
|
+
*/
|
|
1641
|
+
computeContentToken(e) {
|
|
1642
|
+
const t = e.events.map((i) => i.id).sort().join(","), s = `${e.user_id}|${e.session_id}|${t}`;
|
|
1643
|
+
let n = 2166136261;
|
|
1644
|
+
for (let i = 0; i < s.length; i++)
|
|
1645
|
+
n ^= s.charCodeAt(i), n = Math.imul(n, 16777619) >>> 0;
|
|
1646
|
+
return n.toString(16).padStart(8, "0");
|
|
1647
|
+
}
|
|
1608
1648
|
/**
|
|
1609
1649
|
* Retrieves persisted events from localStorage with error recovery.
|
|
1610
1650
|
*
|
|
@@ -1736,12 +1776,12 @@ class et extends _ {
|
|
|
1736
1776
|
}
|
|
1737
1777
|
logPermanentError(e, t) {
|
|
1738
1778
|
const s = Date.now();
|
|
1739
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >=
|
|
1779
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >= zt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1740
1780
|
data: { status: t.statusCode, message: t.message }
|
|
1741
1781
|
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: s });
|
|
1742
1782
|
}
|
|
1743
1783
|
}
|
|
1744
|
-
class
|
|
1784
|
+
class ps extends _ {
|
|
1745
1785
|
bootTime;
|
|
1746
1786
|
bootTimestamp;
|
|
1747
1787
|
hasPerformanceNow;
|
|
@@ -1890,7 +1930,7 @@ class Ss extends _ {
|
|
|
1890
1930
|
};
|
|
1891
1931
|
}
|
|
1892
1932
|
}
|
|
1893
|
-
const
|
|
1933
|
+
const Ss = new Set(Object.values(d));
|
|
1894
1934
|
class Ts extends _ {
|
|
1895
1935
|
dataSenders;
|
|
1896
1936
|
emitter;
|
|
@@ -1908,11 +1948,11 @@ class Ts extends _ {
|
|
|
1908
1948
|
lastSessionId = null;
|
|
1909
1949
|
sessionEventCounts = {
|
|
1910
1950
|
total: 0,
|
|
1911
|
-
[
|
|
1912
|
-
[
|
|
1913
|
-
[
|
|
1914
|
-
[
|
|
1915
|
-
[
|
|
1951
|
+
[d.CLICK]: 0,
|
|
1952
|
+
[d.PAGE_VIEW]: 0,
|
|
1953
|
+
[d.CUSTOM]: 0,
|
|
1954
|
+
[d.VIEWPORT_VISIBLE]: 0,
|
|
1955
|
+
[d.SCROLL]: 0
|
|
1916
1956
|
};
|
|
1917
1957
|
saveSessionCountsDebounced = null;
|
|
1918
1958
|
/**
|
|
@@ -1930,10 +1970,10 @@ class Ts extends _ {
|
|
|
1930
1970
|
* @param fetchCredentials - Fetch credentials mode for custom backend. @default 'include'
|
|
1931
1971
|
*/
|
|
1932
1972
|
constructor(e, t = null, s = {}, n = {}, i, o = "include") {
|
|
1933
|
-
super(), this.emitter = t, this.transformers = s, this.timeManager = new
|
|
1973
|
+
super(), this.emitter = t, this.transformers = s, this.timeManager = new ps(), this.dataSenders = [];
|
|
1934
1974
|
const l = this.get("collectApiUrls");
|
|
1935
|
-
l?.saas && this.dataSenders.push(new
|
|
1936
|
-
new
|
|
1975
|
+
l?.saas && this.dataSenders.push(new Ze(e, "saas", l.saas, s)), l?.custom && this.dataSenders.push(
|
|
1976
|
+
new Ze(
|
|
1937
1977
|
e,
|
|
1938
1978
|
"custom",
|
|
1939
1979
|
l.custom,
|
|
@@ -2054,14 +2094,14 @@ class Ts extends _ {
|
|
|
2054
2094
|
custom_event: o,
|
|
2055
2095
|
web_vitals: l,
|
|
2056
2096
|
error_data: c,
|
|
2057
|
-
viewport_data:
|
|
2097
|
+
viewport_data: u,
|
|
2058
2098
|
page_view: f
|
|
2059
2099
|
}) {
|
|
2060
2100
|
if (!e) {
|
|
2061
2101
|
a("error", "Event type is required - event will be ignored");
|
|
2062
2102
|
return;
|
|
2063
2103
|
}
|
|
2064
|
-
if (!
|
|
2104
|
+
if (!Ss.has(e)) {
|
|
2065
2105
|
a("error", "Invalid event type - event will be ignored", {
|
|
2066
2106
|
data: { type: e }
|
|
2067
2107
|
});
|
|
@@ -2080,36 +2120,36 @@ class Ts extends _ {
|
|
|
2080
2120
|
custom_event: o,
|
|
2081
2121
|
web_vitals: l,
|
|
2082
2122
|
error_data: c,
|
|
2083
|
-
viewport_data:
|
|
2123
|
+
viewport_data: u,
|
|
2084
2124
|
page_view: f
|
|
2085
2125
|
});
|
|
2086
2126
|
return;
|
|
2087
2127
|
}
|
|
2088
2128
|
this.lastSessionId !== g && (this.lastSessionId = g, this.sessionEventCounts = this.loadSessionCounts(g));
|
|
2089
|
-
const T = e ===
|
|
2129
|
+
const T = e === d.SESSION_START;
|
|
2090
2130
|
if (T && a("debug", "Processing SESSION_START event", {
|
|
2091
2131
|
data: { sessionId: g }
|
|
2092
2132
|
}), !T && !this.checkRateLimit())
|
|
2093
2133
|
return;
|
|
2094
|
-
const
|
|
2134
|
+
const p = e;
|
|
2095
2135
|
if (!T) {
|
|
2096
2136
|
if (this.sessionEventCounts.total >= 1e3) {
|
|
2097
2137
|
a("warn", "Session event limit reached", {
|
|
2098
2138
|
data: {
|
|
2099
|
-
type:
|
|
2139
|
+
type: p,
|
|
2100
2140
|
total: this.sessionEventCounts.total,
|
|
2101
2141
|
limit: 1e3
|
|
2102
2142
|
}
|
|
2103
2143
|
});
|
|
2104
2144
|
return;
|
|
2105
2145
|
}
|
|
2106
|
-
const v = this.getTypeLimitForEvent(
|
|
2146
|
+
const v = this.getTypeLimitForEvent(p);
|
|
2107
2147
|
if (v) {
|
|
2108
|
-
const he = this.sessionEventCounts[
|
|
2148
|
+
const he = this.sessionEventCounts[p];
|
|
2109
2149
|
if (he !== void 0 && he >= v) {
|
|
2110
2150
|
a("warn", "Session event type limit reached", {
|
|
2111
2151
|
data: {
|
|
2112
|
-
type:
|
|
2152
|
+
type: p,
|
|
2113
2153
|
count: he,
|
|
2114
2154
|
limit: v
|
|
2115
2155
|
}
|
|
@@ -2118,13 +2158,13 @@ class Ts extends _ {
|
|
|
2118
2158
|
}
|
|
2119
2159
|
}
|
|
2120
2160
|
}
|
|
2121
|
-
if (
|
|
2161
|
+
if (p === d.CUSTOM && o?.name) {
|
|
2122
2162
|
const v = this.get("config")?.maxSameEventPerMinute ?? 60;
|
|
2123
2163
|
if (!this.checkPerEventRateLimit(o.name, v))
|
|
2124
2164
|
return;
|
|
2125
2165
|
}
|
|
2126
|
-
const
|
|
2127
|
-
type:
|
|
2166
|
+
const Ve = p === d.SESSION_START, K = t || this.get("pageUrl"), x = this.buildEventPayload({
|
|
2167
|
+
type: p,
|
|
2128
2168
|
page_url: K,
|
|
2129
2169
|
from_page_url: s,
|
|
2130
2170
|
scroll_data: n,
|
|
@@ -2132,11 +2172,11 @@ class Ts extends _ {
|
|
|
2132
2172
|
custom_event: o,
|
|
2133
2173
|
web_vitals: l,
|
|
2134
2174
|
error_data: c,
|
|
2135
|
-
viewport_data:
|
|
2175
|
+
viewport_data: u,
|
|
2136
2176
|
page_view: f
|
|
2137
2177
|
});
|
|
2138
2178
|
if (x && !(!T && !this.shouldSample())) {
|
|
2139
|
-
if (
|
|
2179
|
+
if (Ve) {
|
|
2140
2180
|
const v = this.get("sessionId");
|
|
2141
2181
|
if (!v) {
|
|
2142
2182
|
a("error", "Session start event requires sessionId - event will be ignored");
|
|
@@ -2152,7 +2192,7 @@ class Ts extends _ {
|
|
|
2152
2192
|
}
|
|
2153
2193
|
if (!this.isDuplicateEvent(x)) {
|
|
2154
2194
|
if (this.get("mode") === ie.QA) {
|
|
2155
|
-
if (
|
|
2195
|
+
if (p === d.CUSTOM && o) {
|
|
2156
2196
|
a("info", `Custom Event: ${o.name}`, {
|
|
2157
2197
|
visibility: "qa",
|
|
2158
2198
|
data: {
|
|
@@ -2162,23 +2202,23 @@ class Ts extends _ {
|
|
|
2162
2202
|
}), this.emitEvent(x);
|
|
2163
2203
|
return;
|
|
2164
2204
|
}
|
|
2165
|
-
if (
|
|
2166
|
-
const v =
|
|
2205
|
+
if (p === d.VIEWPORT_VISIBLE && u) {
|
|
2206
|
+
const v = u.name || u.id || u.selector;
|
|
2167
2207
|
a("info", `Viewport Visible: ${v}`, {
|
|
2168
2208
|
visibility: "qa",
|
|
2169
2209
|
data: {
|
|
2170
|
-
selector:
|
|
2171
|
-
...
|
|
2172
|
-
...
|
|
2173
|
-
visibilityRatio:
|
|
2174
|
-
dwellTime:
|
|
2210
|
+
selector: u.selector,
|
|
2211
|
+
...u.name && { name: u.name },
|
|
2212
|
+
...u.id && { id: u.id },
|
|
2213
|
+
visibilityRatio: u.visibilityRatio,
|
|
2214
|
+
dwellTime: u.dwellTime
|
|
2175
2215
|
}
|
|
2176
2216
|
}), this.emitEvent(x);
|
|
2177
2217
|
return;
|
|
2178
2218
|
}
|
|
2179
2219
|
}
|
|
2180
2220
|
if (this.addToQueue(x), !T) {
|
|
2181
|
-
this.sessionEventCounts.total++, this.sessionEventCounts[
|
|
2221
|
+
this.sessionEventCounts.total++, this.sessionEventCounts[p] !== void 0 && this.sessionEventCounts[p]++;
|
|
2182
2222
|
const v = this.get("sessionId");
|
|
2183
2223
|
v && this.saveSessionCountsDebounced && this.saveSessionCountsDebounced(v);
|
|
2184
2224
|
}
|
|
@@ -2224,11 +2264,11 @@ class Ts extends _ {
|
|
|
2224
2264
|
const e = this.get("sessionId");
|
|
2225
2265
|
e && this.saveSessionCounts(e), this.eventsQueue = [], this.pendingEventsBuffer = [], this.recentEventFingerprints.clear(), this.rateLimitCounter = 0, this.rateLimitWindowStart = 0, this.perEventRateLimits.clear(), this.sessionEventCounts = {
|
|
2226
2266
|
total: 0,
|
|
2227
|
-
[
|
|
2228
|
-
[
|
|
2229
|
-
[
|
|
2230
|
-
[
|
|
2231
|
-
[
|
|
2267
|
+
[d.CLICK]: 0,
|
|
2268
|
+
[d.PAGE_VIEW]: 0,
|
|
2269
|
+
[d.CUSTOM]: 0,
|
|
2270
|
+
[d.VIEWPORT_VISIBLE]: 0,
|
|
2271
|
+
[d.SCROLL]: 0
|
|
2232
2272
|
}, this.lastSessionId = null, this.set("hasStartSession", !1), this.dataSenders.forEach((t) => {
|
|
2233
2273
|
t.stop();
|
|
2234
2274
|
});
|
|
@@ -2447,6 +2487,13 @@ class Ts extends _ {
|
|
|
2447
2487
|
const t = this.buildEventsPayload(), s = [...this.eventsQueue], n = s.map((i) => i.id);
|
|
2448
2488
|
if (this.dataSenders.length === 0)
|
|
2449
2489
|
return this.removeProcessedEvents(n), this.clearSendTimeout(), this.emitEventsQueue(t), e ? !0 : Promise.resolve(!0);
|
|
2490
|
+
if (e && this.sendInProgress) {
|
|
2491
|
+
for (const i of this.dataSenders)
|
|
2492
|
+
i.persistForRecovery(t);
|
|
2493
|
+
return a("debug", "Sync flush deferred: async send in progress, events persisted for recovery", {
|
|
2494
|
+
data: { eventCount: n.length }
|
|
2495
|
+
}), !0;
|
|
2496
|
+
}
|
|
2450
2497
|
if (e) {
|
|
2451
2498
|
const o = this.dataSenders.map((l) => l.sendEventsQueueSync(t)).some((l) => l);
|
|
2452
2499
|
return o ? (this.removeProcessedEvents(n), this.clearSendTimeout(), this.emitEventsQueue(t)) : (this.clearSendTimeout(), a("debug", "Sync flush complete failure, events kept in queue for retry", {
|
|
@@ -2505,10 +2552,10 @@ class Ts extends _ {
|
|
|
2505
2552
|
buildEventsPayload() {
|
|
2506
2553
|
const e = /* @__PURE__ */ new Map(), t = [];
|
|
2507
2554
|
for (const c of this.eventsQueue) {
|
|
2508
|
-
const
|
|
2509
|
-
e.has(
|
|
2555
|
+
const u = this.createEventSignature(c);
|
|
2556
|
+
e.has(u) || t.push(u), e.set(u, c);
|
|
2510
2557
|
}
|
|
2511
|
-
const s = t.map((c) => e.get(c)).filter((c) => !!c).sort((c,
|
|
2558
|
+
const s = t.map((c) => e.get(c)).filter((c) => !!c).sort((c, u) => c.type === d.SESSION_START && u.type !== d.SESSION_START ? -1 : u.type === d.SESSION_START && c.type !== d.SESSION_START ? 1 : c.timestamp - u.timestamp);
|
|
2512
2559
|
let n = {
|
|
2513
2560
|
user_id: this.get("userId"),
|
|
2514
2561
|
session_id: this.get("sessionId"),
|
|
@@ -2519,7 +2566,7 @@ class Ts extends _ {
|
|
|
2519
2566
|
};
|
|
2520
2567
|
const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
|
|
2521
2568
|
if (!o && l) {
|
|
2522
|
-
const c =
|
|
2569
|
+
const c = gt(n, l, "EventManager");
|
|
2523
2570
|
c !== null && (n = c);
|
|
2524
2571
|
}
|
|
2525
2572
|
return n;
|
|
@@ -2531,7 +2578,7 @@ class Ts extends _ {
|
|
|
2531
2578
|
});
|
|
2532
2579
|
const i = this.get("sessionReferrer"), o = this.get("sessionUtm");
|
|
2533
2580
|
let l = {
|
|
2534
|
-
id:
|
|
2581
|
+
id: ns(),
|
|
2535
2582
|
type: e.type,
|
|
2536
2583
|
page_url: t,
|
|
2537
2584
|
timestamp: s,
|
|
@@ -2546,9 +2593,9 @@ class Ts extends _ {
|
|
|
2546
2593
|
...e.page_view && { page_view: e.page_view },
|
|
2547
2594
|
...o && { utm: o }
|
|
2548
2595
|
};
|
|
2549
|
-
const c = this.get("collectApiUrls"),
|
|
2550
|
-
if (
|
|
2551
|
-
const K =
|
|
2596
|
+
const c = this.get("collectApiUrls"), u = !!c?.custom, f = !!c?.saas, g = u || f, T = u && f, p = this.transformers.beforeSend;
|
|
2597
|
+
if (p && (!g || u && !T)) {
|
|
2598
|
+
const K = mt(l, p, "EventManager");
|
|
2552
2599
|
if (K === null)
|
|
2553
2600
|
return null;
|
|
2554
2601
|
l = K;
|
|
@@ -2589,13 +2636,13 @@ class Ts extends _ {
|
|
|
2589
2636
|
}
|
|
2590
2637
|
addToQueue(e) {
|
|
2591
2638
|
if (this.emitEvent(e), this.eventsQueue.push(e), this.eventsQueue.length > 100) {
|
|
2592
|
-
const t = this.eventsQueue.findIndex((n) => n.type !==
|
|
2639
|
+
const t = this.eventsQueue.findIndex((n) => n.type !== d.SESSION_START), s = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();
|
|
2593
2640
|
a("warn", "Event queue overflow, oldest non-critical event removed", {
|
|
2594
2641
|
data: {
|
|
2595
2642
|
maxLength: 100,
|
|
2596
2643
|
currentLength: this.eventsQueue.length,
|
|
2597
2644
|
removedEventType: s?.type,
|
|
2598
|
-
wasCritical: s?.type ===
|
|
2645
|
+
wasCritical: s?.type === d.SESSION_START
|
|
2599
2646
|
}
|
|
2600
2647
|
});
|
|
2601
2648
|
}
|
|
@@ -2634,11 +2681,11 @@ class Ts extends _ {
|
|
|
2634
2681
|
}
|
|
2635
2682
|
getTypeLimitForEvent(e) {
|
|
2636
2683
|
return {
|
|
2637
|
-
[
|
|
2638
|
-
[
|
|
2639
|
-
[
|
|
2640
|
-
[
|
|
2641
|
-
[
|
|
2684
|
+
[d.CLICK]: 500,
|
|
2685
|
+
[d.PAGE_VIEW]: 100,
|
|
2686
|
+
[d.CUSTOM]: 500,
|
|
2687
|
+
[d.VIEWPORT_VISIBLE]: 200,
|
|
2688
|
+
[d.SCROLL]: 120
|
|
2642
2689
|
}[e] ?? null;
|
|
2643
2690
|
}
|
|
2644
2691
|
removeProcessedEvents(e) {
|
|
@@ -2692,11 +2739,11 @@ class Ts extends _ {
|
|
|
2692
2739
|
getInitialCounts() {
|
|
2693
2740
|
return {
|
|
2694
2741
|
total: 0,
|
|
2695
|
-
[
|
|
2696
|
-
[
|
|
2697
|
-
[
|
|
2698
|
-
[
|
|
2699
|
-
[
|
|
2742
|
+
[d.CLICK]: 0,
|
|
2743
|
+
[d.PAGE_VIEW]: 0,
|
|
2744
|
+
[d.CUSTOM]: 0,
|
|
2745
|
+
[d.VIEWPORT_VISIBLE]: 0,
|
|
2746
|
+
[d.SCROLL]: 0
|
|
2700
2747
|
};
|
|
2701
2748
|
}
|
|
2702
2749
|
/**
|
|
@@ -2725,21 +2772,21 @@ class Ts extends _ {
|
|
|
2725
2772
|
loadSessionCounts(e) {
|
|
2726
2773
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
2727
2774
|
return this.getInitialCounts();
|
|
2728
|
-
const t = this.get("userId") || "anonymous", s =
|
|
2775
|
+
const t = this.get("userId") || "anonymous", s = Fe(t, e);
|
|
2729
2776
|
try {
|
|
2730
2777
|
const n = localStorage.getItem(s);
|
|
2731
2778
|
if (!n)
|
|
2732
2779
|
return this.getInitialCounts();
|
|
2733
2780
|
const i = JSON.parse(n);
|
|
2734
|
-
return i._timestamp && Date.now() - i._timestamp >
|
|
2781
|
+
return i._timestamp && Date.now() - i._timestamp > xe ? (a("debug", "Session counts expired, clearing", {
|
|
2735
2782
|
data: { sessionId: e, age: Date.now() - i._timestamp }
|
|
2736
|
-
}), localStorage.removeItem(s), this.getInitialCounts()) : typeof i.total == "number" && typeof i[
|
|
2783
|
+
}), localStorage.removeItem(s), 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" ? {
|
|
2737
2784
|
total: i.total,
|
|
2738
|
-
[
|
|
2739
|
-
[
|
|
2740
|
-
[
|
|
2741
|
-
[
|
|
2742
|
-
[
|
|
2785
|
+
[d.CLICK]: i[d.CLICK],
|
|
2786
|
+
[d.PAGE_VIEW]: i[d.PAGE_VIEW],
|
|
2787
|
+
[d.CUSTOM]: i[d.CUSTOM],
|
|
2788
|
+
[d.VIEWPORT_VISIBLE]: i[d.VIEWPORT_VISIBLE],
|
|
2789
|
+
[d.SCROLL]: i[d.SCROLL]
|
|
2743
2790
|
} : (a("warn", "Invalid session counts structure in localStorage, resetting", {
|
|
2744
2791
|
data: { sessionId: e, parsed: i }
|
|
2745
2792
|
}), localStorage.removeItem(s), a("debug", "Session counts removed due to invalid/corrupted data", {
|
|
@@ -2776,12 +2823,12 @@ class Ts extends _ {
|
|
|
2776
2823
|
cleanupExpiredSessionCounts() {
|
|
2777
2824
|
if (!(typeof window > "u" || typeof localStorage > "u"))
|
|
2778
2825
|
try {
|
|
2779
|
-
const e = localStorage.getItem(
|
|
2826
|
+
const e = localStorage.getItem($e);
|
|
2780
2827
|
if (e) {
|
|
2781
2828
|
const i = Date.now() - parseInt(e, 10);
|
|
2782
|
-
if (i <
|
|
2829
|
+
if (i < Be) {
|
|
2783
2830
|
a("debug", "Skipping session counts cleanup (throttled)", {
|
|
2784
|
-
data: { timeSinceLastCleanup: i, throttleMs:
|
|
2831
|
+
data: { timeSinceLastCleanup: i, throttleMs: Be }
|
|
2785
2832
|
});
|
|
2786
2833
|
return;
|
|
2787
2834
|
}
|
|
@@ -2794,14 +2841,14 @@ class Ts extends _ {
|
|
|
2794
2841
|
const l = localStorage.getItem(o);
|
|
2795
2842
|
if (l) {
|
|
2796
2843
|
const c = JSON.parse(l);
|
|
2797
|
-
c._timestamp && Date.now() - c._timestamp >
|
|
2844
|
+
c._timestamp && Date.now() - c._timestamp > xe && n.push(o);
|
|
2798
2845
|
}
|
|
2799
2846
|
} catch {
|
|
2800
2847
|
}
|
|
2801
2848
|
}
|
|
2802
2849
|
n.forEach((i) => {
|
|
2803
2850
|
localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
|
|
2804
|
-
}), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem(
|
|
2851
|
+
}), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem($e, Date.now().toString());
|
|
2805
2852
|
} catch (e) {
|
|
2806
2853
|
a("warn", "Failed to cleanup expired session counts", { error: e });
|
|
2807
2854
|
}
|
|
@@ -2835,7 +2882,7 @@ class Ts extends _ {
|
|
|
2835
2882
|
* @internal
|
|
2836
2883
|
*/
|
|
2837
2884
|
saveSessionCounts(e) {
|
|
2838
|
-
const t = this.get("userId") || "anonymous", s =
|
|
2885
|
+
const t = this.get("userId") || "anonymous", s = Fe(t, e);
|
|
2839
2886
|
try {
|
|
2840
2887
|
const n = {
|
|
2841
2888
|
...this.sessionEventCounts,
|
|
@@ -2903,7 +2950,7 @@ class _s extends _ {
|
|
|
2903
2950
|
return;
|
|
2904
2951
|
}
|
|
2905
2952
|
const e = this.getProjectId();
|
|
2906
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
2953
|
+
this.broadcastChannel = new BroadcastChannel(Nt(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2907
2954
|
const { action: s, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
|
|
2908
2955
|
o === e && (s === "session_start" && n && typeof i == "number" && i > Date.now() - 5e3 ? (this.set("sessionId", n), this.persistSession(n, i), this.isTracking && this.setupSessionTimeout()) : s && s !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: s } }));
|
|
2909
2956
|
};
|
|
@@ -2968,7 +3015,7 @@ class _s extends _ {
|
|
|
2968
3015
|
this.storageManager.setItem(t, s), this.storageManager.setSessionItem(t, s);
|
|
2969
3016
|
}
|
|
2970
3017
|
getSessionStorageKey() {
|
|
2971
|
-
return
|
|
3018
|
+
return Rt(this.getProjectId());
|
|
2972
3019
|
}
|
|
2973
3020
|
getProjectId() {
|
|
2974
3021
|
return this.projectId;
|
|
@@ -3052,7 +3099,7 @@ class _s extends _ {
|
|
|
3052
3099
|
}) : (a("debug", "Emitting SESSION_START event", {
|
|
3053
3100
|
data: { sessionId: t }
|
|
3054
3101
|
}), this.eventManager.track({
|
|
3055
|
-
type:
|
|
3102
|
+
type: d.SESSION_START
|
|
3056
3103
|
})), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
|
|
3057
3104
|
} catch (i) {
|
|
3058
3105
|
throw this.isTracking = !1, this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.set("sessionId", null), i;
|
|
@@ -3091,7 +3138,7 @@ class _s extends _ {
|
|
|
3091
3138
|
a("debug", "Renewing session after timeout", {
|
|
3092
3139
|
data: { newSessionId: e }
|
|
3093
3140
|
}), this.set("sessionId", e), this.set("sessionReferrer", t), this.set("sessionUtm", s), this.persistSession(e, Date.now(), t, s), this.cleanupCrossTabSync(), this.initCrossTabSync(), this.shareSession(e), this.eventManager.track({
|
|
3094
|
-
type:
|
|
3141
|
+
type: d.SESSION_START
|
|
3095
3142
|
}), this.eventManager.flushPendingEvents(), this.setupSessionTimeout();
|
|
3096
3143
|
}
|
|
3097
3144
|
cleanupActivityListeners() {
|
|
@@ -3336,7 +3383,7 @@ class ws extends _ {
|
|
|
3336
3383
|
};
|
|
3337
3384
|
}
|
|
3338
3385
|
trackCurrentPage = () => {
|
|
3339
|
-
const e = window.location.href, t =
|
|
3386
|
+
const e = window.location.href, t = ye(e, this.get("config").sensitiveQueryParams);
|
|
3340
3387
|
if (this.get("pageUrl") === t)
|
|
3341
3388
|
return;
|
|
3342
3389
|
const s = Date.now(), n = this.get("config").pageViewThrottleMs ?? 1e3;
|
|
@@ -3347,16 +3394,16 @@ class ws extends _ {
|
|
|
3347
3394
|
this.set("pageUrl", t);
|
|
3348
3395
|
const o = this.extractPageViewData();
|
|
3349
3396
|
this.eventManager.track({
|
|
3350
|
-
type:
|
|
3397
|
+
type: d.PAGE_VIEW,
|
|
3351
3398
|
page_url: this.get("pageUrl"),
|
|
3352
3399
|
from_page_url: i,
|
|
3353
3400
|
...o && { page_view: o }
|
|
3354
3401
|
});
|
|
3355
3402
|
};
|
|
3356
3403
|
trackInitialPageView() {
|
|
3357
|
-
const e =
|
|
3404
|
+
const e = ye(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
|
|
3358
3405
|
this.lastPageViewTime = Date.now(), this.eventManager.track({
|
|
3359
|
-
type:
|
|
3406
|
+
type: d.PAGE_VIEW,
|
|
3360
3407
|
page_url: e,
|
|
3361
3408
|
...t && { page_view: t }
|
|
3362
3409
|
}), this.onTrack();
|
|
@@ -3411,7 +3458,7 @@ class bs extends _ {
|
|
|
3411
3458
|
if (f) {
|
|
3412
3459
|
const g = this.createCustomEventData(f);
|
|
3413
3460
|
this.eventManager.track({
|
|
3414
|
-
type:
|
|
3461
|
+
type: d.CUSTOM,
|
|
3415
3462
|
custom_event: {
|
|
3416
3463
|
name: g.name,
|
|
3417
3464
|
...g.value && { metadata: { value: g.value } }
|
|
@@ -3419,10 +3466,10 @@ class bs extends _ {
|
|
|
3419
3466
|
});
|
|
3420
3467
|
}
|
|
3421
3468
|
}
|
|
3422
|
-
const
|
|
3469
|
+
const u = this.generateClickData(n, l, c);
|
|
3423
3470
|
this.eventManager.track({
|
|
3424
|
-
type:
|
|
3425
|
-
click_data:
|
|
3471
|
+
type: d.CLICK,
|
|
3472
|
+
click_data: u
|
|
3426
3473
|
});
|
|
3427
3474
|
}, window.addEventListener("click", this.clickHandler, !0));
|
|
3428
3475
|
}
|
|
@@ -3510,7 +3557,7 @@ class bs extends _ {
|
|
|
3510
3557
|
return e.hasAttribute(`${b}-name`) ? e : e.closest(`[${b}-name]`);
|
|
3511
3558
|
}
|
|
3512
3559
|
getRelevantClickElement(e) {
|
|
3513
|
-
for (const t of
|
|
3560
|
+
for (const t of bt)
|
|
3514
3561
|
try {
|
|
3515
3562
|
if (e.matches(t))
|
|
3516
3563
|
return e;
|
|
@@ -3551,7 +3598,7 @@ class bs extends _ {
|
|
|
3551
3598
|
};
|
|
3552
3599
|
}
|
|
3553
3600
|
generateClickData(e, t, s) {
|
|
3554
|
-
const { x: n, y: i, relativeX: o, relativeY: l } = s, c = this.getRelevantText(e, t),
|
|
3601
|
+
const { x: n, y: i, relativeX: o, relativeY: l } = s, c = this.getRelevantText(e, t), u = this.extractElementAttributes(t);
|
|
3555
3602
|
return {
|
|
3556
3603
|
x: n,
|
|
3557
3604
|
y: i,
|
|
@@ -3561,12 +3608,12 @@ class bs extends _ {
|
|
|
3561
3608
|
...t.id && { id: t.id },
|
|
3562
3609
|
...t.className && { class: t.className },
|
|
3563
3610
|
...c && { text: c },
|
|
3564
|
-
...
|
|
3565
|
-
...
|
|
3566
|
-
...
|
|
3567
|
-
...
|
|
3568
|
-
...
|
|
3569
|
-
...Object.keys(
|
|
3611
|
+
...u.href && { href: u.href },
|
|
3612
|
+
...u.title && { title: u.title },
|
|
3613
|
+
...u.alt && { alt: u.alt },
|
|
3614
|
+
...u.role && { role: u.role },
|
|
3615
|
+
...u["aria-label"] && { ariaLabel: u["aria-label"] },
|
|
3616
|
+
...Object.keys(u).length > 0 && { dataAttributes: u }
|
|
3570
3617
|
};
|
|
3571
3618
|
}
|
|
3572
3619
|
/**
|
|
@@ -3590,7 +3637,7 @@ class bs extends _ {
|
|
|
3590
3637
|
*/
|
|
3591
3638
|
sanitizeText(e) {
|
|
3592
3639
|
let t = e;
|
|
3593
|
-
for (const s of
|
|
3640
|
+
for (const s of at) {
|
|
3594
3641
|
const n = new RegExp(s.source, s.flags);
|
|
3595
3642
|
t = t.replace(n, "[REDACTED]");
|
|
3596
3643
|
}
|
|
@@ -3730,7 +3777,7 @@ class As extends _ {
|
|
|
3730
3777
|
return this.isWindowScrollable() ? e === window : this.containers.length === 0;
|
|
3731
3778
|
}
|
|
3732
3779
|
setupScrollContainer(e, t) {
|
|
3733
|
-
if (this.containers.some((
|
|
3780
|
+
if (this.containers.some((u) => u.element === e) || e !== window && !this.isElementScrollable(e))
|
|
3734
3781
|
return;
|
|
3735
3782
|
const n = this.getScrollTop(e), i = this.calculateScrollDepth(
|
|
3736
3783
|
n,
|
|
@@ -3750,10 +3797,10 @@ class As extends _ {
|
|
|
3750
3797
|
listener: null
|
|
3751
3798
|
}, c = () => {
|
|
3752
3799
|
this.get("suppressNextScroll") || (l.firstScrollEventTime === null && (l.firstScrollEventTime = Date.now()), this.clearContainerTimer(l), l.debounceTimer = window.setTimeout(() => {
|
|
3753
|
-
const
|
|
3754
|
-
if (
|
|
3800
|
+
const u = this.calculateScrollData(l);
|
|
3801
|
+
if (u) {
|
|
3755
3802
|
const f = Date.now();
|
|
3756
|
-
this.processScrollEvent(l,
|
|
3803
|
+
this.processScrollEvent(l, u, f);
|
|
3757
3804
|
}
|
|
3758
3805
|
l.debounceTimer = null;
|
|
3759
3806
|
}, 250));
|
|
@@ -3766,7 +3813,7 @@ class As extends _ {
|
|
|
3766
3813
|
e.lastEventTime = s, e.lastDepth = t.depth, e.lastDirection = t.direction;
|
|
3767
3814
|
const n = this.get("scrollEventCount") ?? 0;
|
|
3768
3815
|
this.set("scrollEventCount", n + 1), this.eventManager.track({
|
|
3769
|
-
type:
|
|
3816
|
+
type: d.SCROLL,
|
|
3770
3817
|
scroll_data: {
|
|
3771
3818
|
...t,
|
|
3772
3819
|
container_selector: e.selector,
|
|
@@ -3813,14 +3860,14 @@ class As extends _ {
|
|
|
3813
3860
|
const { element: t, lastScrollPos: s, lastEventTime: n } = e, i = this.getScrollTop(t), o = Date.now(), l = Math.abs(i - s);
|
|
3814
3861
|
if (l < 10 || t === window && !this.isWindowScrollable())
|
|
3815
3862
|
return null;
|
|
3816
|
-
const c = this.getViewportHeight(t),
|
|
3863
|
+
const c = this.getViewportHeight(t), u = this.getScrollHeight(t), f = this.getScrollDirection(i, s), g = this.calculateScrollDepth(i, u, c);
|
|
3817
3864
|
let T;
|
|
3818
3865
|
n > 0 ? T = o - n : e.firstScrollEventTime !== null ? T = o - e.firstScrollEventTime : T = 250;
|
|
3819
|
-
const
|
|
3866
|
+
const p = Math.round(l / T * 1e3);
|
|
3820
3867
|
return g > e.maxDepthReached && (e.maxDepthReached = g), e.lastScrollPos = i, {
|
|
3821
3868
|
depth: g,
|
|
3822
3869
|
direction: f,
|
|
3823
|
-
velocity:
|
|
3870
|
+
velocity: p,
|
|
3824
3871
|
max_depth_reached: e.maxDepthReached
|
|
3825
3872
|
};
|
|
3826
3873
|
}
|
|
@@ -3978,7 +4025,7 @@ class Ls extends _ {
|
|
|
3978
4025
|
...e.name !== void 0 && { name: e.name }
|
|
3979
4026
|
};
|
|
3980
4027
|
this.eventManager.track({
|
|
3981
|
-
type:
|
|
4028
|
+
type: d.VIEWPORT_VISIBLE,
|
|
3982
4029
|
viewport_data: o
|
|
3983
4030
|
}), e.startTime = null, e.timeoutId = null, e.lastFiredTime = i;
|
|
3984
4031
|
}
|
|
@@ -4355,7 +4402,7 @@ class Ns extends _ {
|
|
|
4355
4402
|
navigationCounter = 0;
|
|
4356
4403
|
// Counter for handling simultaneous navigations edge case
|
|
4357
4404
|
constructor(e) {
|
|
4358
|
-
super(), this.eventManager = e, this.vitalThresholds =
|
|
4405
|
+
super(), this.eventManager = e, this.vitalThresholds = Ke(_e);
|
|
4359
4406
|
}
|
|
4360
4407
|
/**
|
|
4361
4408
|
* Starts tracking Web Vitals and performance metrics.
|
|
@@ -4373,7 +4420,7 @@ class Ns extends _ {
|
|
|
4373
4420
|
*/
|
|
4374
4421
|
async startTracking() {
|
|
4375
4422
|
const e = this.get("config"), t = e?.webVitalsMode ?? _e;
|
|
4376
|
-
this.vitalThresholds =
|
|
4423
|
+
this.vitalThresholds = Ke(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
|
|
4377
4424
|
}
|
|
4378
4425
|
/**
|
|
4379
4426
|
* Stops tracking Web Vitals and cleans up resources.
|
|
@@ -4444,8 +4491,8 @@ class Ns extends _ {
|
|
|
4444
4491
|
async initWebVitals() {
|
|
4445
4492
|
try {
|
|
4446
4493
|
const { onLCP: e, onCLS: t, onFCP: s, onTTFB: n, onINP: i } = await Promise.resolve().then(() => cr), o = (l) => (c) => {
|
|
4447
|
-
const
|
|
4448
|
-
this.sendVital({ type: l, value:
|
|
4494
|
+
const u = Number(c.value.toFixed(2));
|
|
4495
|
+
this.sendVital({ type: l, value: u });
|
|
4449
4496
|
};
|
|
4450
4497
|
e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), s(o("FCP"), { reportAllChanges: !1 }), n(o("TTFB"), { reportAllChanges: !1 }), i(o("INP"), { reportAllChanges: !1 });
|
|
4451
4498
|
} catch (e) {
|
|
@@ -4470,7 +4517,7 @@ class Ns extends _ {
|
|
|
4470
4517
|
const t = e.getEntries();
|
|
4471
4518
|
for (const s of t) {
|
|
4472
4519
|
const n = Number(s.duration.toFixed(2)), i = Date.now();
|
|
4473
|
-
i - this.lastLongTaskSentAt >=
|
|
4520
|
+
i - this.lastLongTaskSentAt >= Kt && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
4474
4521
|
}
|
|
4475
4522
|
},
|
|
4476
4523
|
{ type: "longtask", buffered: !0 }
|
|
@@ -4486,7 +4533,7 @@ class Ns extends _ {
|
|
|
4486
4533
|
return;
|
|
4487
4534
|
if (s)
|
|
4488
4535
|
s.add(e.type);
|
|
4489
|
-
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length >
|
|
4536
|
+
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Yt) {
|
|
4490
4537
|
const i = this.navigationHistory.shift();
|
|
4491
4538
|
i && this.reportedByNav.delete(i);
|
|
4492
4539
|
}
|
|
@@ -4499,7 +4546,7 @@ class Ns extends _ {
|
|
|
4499
4546
|
return;
|
|
4500
4547
|
}
|
|
4501
4548
|
this.eventManager.track({
|
|
4502
|
-
type:
|
|
4549
|
+
type: d.WEB_VITALS,
|
|
4503
4550
|
web_vitals: {
|
|
4504
4551
|
type: e,
|
|
4505
4552
|
value: t
|
|
@@ -4613,14 +4660,14 @@ class ae extends _ {
|
|
|
4613
4660
|
const e = Date.now();
|
|
4614
4661
|
if (e < this.burstBackoffUntil)
|
|
4615
4662
|
return !1;
|
|
4616
|
-
if (e - this.burstWindowStart >
|
|
4617
|
-
return this.burstBackoffUntil = e +
|
|
4663
|
+
if (e - this.burstWindowStart > Gt && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > jt)
|
|
4664
|
+
return this.burstBackoffUntil = e + ze, a("debug", "Error burst detected - entering cooldown", {
|
|
4618
4665
|
data: {
|
|
4619
4666
|
errorsInWindow: this.errorBurstCounter,
|
|
4620
|
-
cooldownMs:
|
|
4667
|
+
cooldownMs: ze
|
|
4621
4668
|
}
|
|
4622
4669
|
}), !1;
|
|
4623
|
-
const s = this.get("config").errorSampling ??
|
|
4670
|
+
const s = this.get("config").errorSampling ?? lt;
|
|
4624
4671
|
return Math.random() < s;
|
|
4625
4672
|
}
|
|
4626
4673
|
handleError = (e) => {
|
|
@@ -4631,7 +4678,7 @@ class ae extends _ {
|
|
|
4631
4678
|
return;
|
|
4632
4679
|
const s = typeof e.error?.stack == "string" ? this.truncateStack(e.error.stack) : void 0;
|
|
4633
4680
|
this.eventManager.track({
|
|
4634
|
-
type:
|
|
4681
|
+
type: d.ERROR,
|
|
4635
4682
|
error_data: {
|
|
4636
4683
|
type: B.JS_ERROR,
|
|
4637
4684
|
message: t,
|
|
@@ -4650,7 +4697,7 @@ class ae extends _ {
|
|
|
4650
4697
|
return;
|
|
4651
4698
|
const n = e.reason instanceof Error && typeof e.reason.stack == "string" ? this.truncateStack(e.reason.stack) : void 0;
|
|
4652
4699
|
this.eventManager.track({
|
|
4653
|
-
type:
|
|
4700
|
+
type: d.ERROR,
|
|
4654
4701
|
error_data: {
|
|
4655
4702
|
type: B.PROMISE_REJECTION,
|
|
4656
4703
|
message: s,
|
|
@@ -4672,12 +4719,12 @@ class ae extends _ {
|
|
|
4672
4719
|
}
|
|
4673
4720
|
}
|
|
4674
4721
|
sanitize(e) {
|
|
4675
|
-
const t = e.length >
|
|
4722
|
+
const t = e.length > Xe ? e.slice(0, Xe) + "..." : e;
|
|
4676
4723
|
return this.sanitizePii(t);
|
|
4677
4724
|
}
|
|
4678
4725
|
sanitizePii(e) {
|
|
4679
4726
|
let t = e;
|
|
4680
|
-
for (const s of
|
|
4727
|
+
for (const s of at) {
|
|
4681
4728
|
const n = new RegExp(s.source, s.flags);
|
|
4682
4729
|
t = t.replace(n, "[REDACTED]");
|
|
4683
4730
|
}
|
|
@@ -4685,19 +4732,19 @@ class ae extends _ {
|
|
|
4685
4732
|
}
|
|
4686
4733
|
shouldSuppressError(e, t) {
|
|
4687
4734
|
const s = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
4688
|
-
return i !== void 0 && s - i <
|
|
4735
|
+
return i !== void 0 && s - i < je ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size > Xt ? (this.recentErrors.clear(), this.recentErrors.set(n, s), !1) : (this.recentErrors.size > ee && this.pruneOldErrors(), !1));
|
|
4689
4736
|
}
|
|
4690
4737
|
static TRUNCATION_SUFFIX = `
|
|
4691
4738
|
...truncated`;
|
|
4692
4739
|
truncateStack(e) {
|
|
4693
|
-
if (e.length <=
|
|
4694
|
-
const t =
|
|
4740
|
+
if (e.length <= Ge) return this.sanitizePii(e);
|
|
4741
|
+
const t = Ge - ae.TRUNCATION_SUFFIX.length, s = e.slice(0, t) + ae.TRUNCATION_SUFFIX;
|
|
4695
4742
|
return this.sanitizePii(s);
|
|
4696
4743
|
}
|
|
4697
4744
|
pruneOldErrors() {
|
|
4698
4745
|
const e = Date.now();
|
|
4699
4746
|
for (const [n, i] of this.recentErrors.entries())
|
|
4700
|
-
e - i >
|
|
4747
|
+
e - i > je && this.recentErrors.delete(n);
|
|
4701
4748
|
if (this.recentErrors.size <= ee)
|
|
4702
4749
|
return;
|
|
4703
4750
|
const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), s = this.recentErrors.size - ee;
|
|
@@ -4772,7 +4819,7 @@ class Os extends _ {
|
|
|
4772
4819
|
return;
|
|
4773
4820
|
}
|
|
4774
4821
|
this.managers.event.track({
|
|
4775
|
-
type:
|
|
4822
|
+
type: d.CUSTOM,
|
|
4776
4823
|
custom_event: {
|
|
4777
4824
|
name: e,
|
|
4778
4825
|
...o && { metadata: o }
|
|
@@ -4838,10 +4885,10 @@ class Os extends _ {
|
|
|
4838
4885
|
this.set("userId", t);
|
|
4839
4886
|
const s = os(e);
|
|
4840
4887
|
this.set("collectApiUrls", s);
|
|
4841
|
-
const n =
|
|
4888
|
+
const n = Wt();
|
|
4842
4889
|
this.set("device", n);
|
|
4843
|
-
const i =
|
|
4844
|
-
this.set("pageUrl", i),
|
|
4890
|
+
const i = ye(window.location.href, e.sensitiveQueryParams);
|
|
4891
|
+
this.set("pageUrl", i), es() && this.set("mode", ie.QA);
|
|
4845
4892
|
}
|
|
4846
4893
|
/**
|
|
4847
4894
|
* Returns the current configuration object.
|
|
@@ -4892,7 +4939,7 @@ class Os extends _ {
|
|
|
4892
4939
|
valid: !1,
|
|
4893
4940
|
error: "Global metadata must be a plain object"
|
|
4894
4941
|
};
|
|
4895
|
-
const t =
|
|
4942
|
+
const t = ft("Global", e, "globalMetadata");
|
|
4896
4943
|
return t.valid ? { valid: !0 } : {
|
|
4897
4944
|
valid: !1,
|
|
4898
4945
|
error: t.error
|
|
@@ -4959,7 +5006,7 @@ class Os extends _ {
|
|
|
4959
5006
|
a("warn", "identify() userId exceeds 256 characters", { data: { length: e.trim().length } });
|
|
4960
5007
|
return;
|
|
4961
5008
|
}
|
|
4962
|
-
const s = e.trim(), n =
|
|
5009
|
+
const s = e.trim(), n = ht(t), i = {
|
|
4963
5010
|
userId: s,
|
|
4964
5011
|
...n ? { traits: n } : {}
|
|
4965
5012
|
};
|
|
@@ -5082,16 +5129,16 @@ class Os extends _ {
|
|
|
5082
5129
|
}), this.handlers.error = new ae(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new Ls(this.managers.event), this.handlers.viewport.startTracking()), e.integrations?.tracelog?.shopify) {
|
|
5083
5130
|
const s = new Cs();
|
|
5084
5131
|
s.activate(), this.integrationInstances.shopifyCartLinker = s, this.emitter.on(se.EVENT, (n) => {
|
|
5085
|
-
n.type ===
|
|
5132
|
+
n.type === d.SESSION_START && s.onSessionChange();
|
|
5086
5133
|
});
|
|
5087
5134
|
}
|
|
5088
5135
|
}
|
|
5089
5136
|
}
|
|
5090
5137
|
const k = [], M = [];
|
|
5091
|
-
let D = null, h = null, R = !1,
|
|
5092
|
-
const Ps = async (r) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (
|
|
5138
|
+
let D = null, h = null, R = !1, S = !1, P = null;
|
|
5139
|
+
const Ps = async (r) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (S = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : h ? { sessionId: h.getSessionId() ?? "" } : (R && P || (R = !0, P = (async () => {
|
|
5093
5140
|
try {
|
|
5094
|
-
const e =
|
|
5141
|
+
const e = ds(r ?? {}), t = new Os();
|
|
5095
5142
|
try {
|
|
5096
5143
|
k.forEach(({ event: o, callback: l }) => {
|
|
5097
5144
|
t.on(o, l);
|
|
@@ -5121,7 +5168,7 @@ const Ps = async (r) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
5121
5168
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5122
5169
|
if (!h)
|
|
5123
5170
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
5124
|
-
if (
|
|
5171
|
+
if (S)
|
|
5125
5172
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
5126
5173
|
h.sendCustomEvent(r, e);
|
|
5127
5174
|
}
|
|
@@ -5152,7 +5199,7 @@ function Us(r, e) {
|
|
|
5152
5199
|
t !== -1 && M.splice(t, 1), M.push({ hook: r, fn: e });
|
|
5153
5200
|
return;
|
|
5154
5201
|
}
|
|
5155
|
-
if (
|
|
5202
|
+
if (S)
|
|
5156
5203
|
throw new Error("[TraceLog] Cannot set transformers while TraceLog is being destroyed");
|
|
5157
5204
|
r === "beforeSend" ? h.setTransformer("beforeSend", e) : h.setTransformer("beforeBatch", e);
|
|
5158
5205
|
}
|
|
@@ -5164,7 +5211,7 @@ const Hs = (r) => {
|
|
|
5164
5211
|
e !== -1 && M.splice(e, 1);
|
|
5165
5212
|
return;
|
|
5166
5213
|
}
|
|
5167
|
-
if (
|
|
5214
|
+
if (S)
|
|
5168
5215
|
throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
|
|
5169
5216
|
h.removeTransformer(r);
|
|
5170
5217
|
}
|
|
@@ -5176,7 +5223,7 @@ const Hs = (r) => {
|
|
|
5176
5223
|
D = r;
|
|
5177
5224
|
return;
|
|
5178
5225
|
}
|
|
5179
|
-
if (
|
|
5226
|
+
if (S)
|
|
5180
5227
|
throw new Error("[TraceLog] Cannot set custom headers while TraceLog is being destroyed");
|
|
5181
5228
|
h.setCustomHeaders(r);
|
|
5182
5229
|
}
|
|
@@ -5186,32 +5233,32 @@ const Hs = (r) => {
|
|
|
5186
5233
|
D = null;
|
|
5187
5234
|
return;
|
|
5188
5235
|
}
|
|
5189
|
-
if (
|
|
5236
|
+
if (S)
|
|
5190
5237
|
throw new Error("[TraceLog] Cannot remove custom headers while TraceLog is being destroyed");
|
|
5191
5238
|
h.removeCustomHeaders();
|
|
5192
5239
|
}
|
|
5193
5240
|
}, $s = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, Bs = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), Ws = () => {
|
|
5194
5241
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5195
|
-
if (
|
|
5242
|
+
if (S)
|
|
5196
5243
|
throw new Error("[TraceLog] Destroy operation already in progress");
|
|
5197
5244
|
if (!h) {
|
|
5198
|
-
|
|
5245
|
+
S = !1;
|
|
5199
5246
|
return;
|
|
5200
5247
|
}
|
|
5201
|
-
|
|
5248
|
+
S = !0;
|
|
5202
5249
|
try {
|
|
5203
|
-
h.destroy(), h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null,
|
|
5250
|
+
h.destroy(), h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, S = !1;
|
|
5204
5251
|
} catch (r) {
|
|
5205
|
-
h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null,
|
|
5252
|
+
h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, S = !1, a("warn", "Error during destroy, forced cleanup completed", { error: r });
|
|
5206
5253
|
}
|
|
5207
5254
|
}
|
|
5208
5255
|
}, Xs = (r) => {
|
|
5209
|
-
typeof window > "u" || typeof document > "u" ||
|
|
5256
|
+
typeof window > "u" || typeof document > "u" || ts(r);
|
|
5210
5257
|
}, Gs = (r) => {
|
|
5211
5258
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5212
5259
|
if (!h)
|
|
5213
5260
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
5214
|
-
if (
|
|
5261
|
+
if (S)
|
|
5215
5262
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5216
5263
|
h.updateGlobalMetadata(r);
|
|
5217
5264
|
}
|
|
@@ -5219,7 +5266,7 @@ const Hs = (r) => {
|
|
|
5219
5266
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5220
5267
|
if (!h)
|
|
5221
5268
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
5222
|
-
if (
|
|
5269
|
+
if (S)
|
|
5223
5270
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5224
5271
|
h.mergeGlobalMetadata(r);
|
|
5225
5272
|
}
|
|
@@ -5233,7 +5280,7 @@ const Hs = (r) => {
|
|
|
5233
5280
|
a("warn", "identify() userId exceeds 256 characters");
|
|
5234
5281
|
return;
|
|
5235
5282
|
}
|
|
5236
|
-
if (
|
|
5283
|
+
if (S) {
|
|
5237
5284
|
a("warn", "Cannot identify while TraceLog is being destroyed");
|
|
5238
5285
|
return;
|
|
5239
5286
|
}
|
|
@@ -5242,7 +5289,7 @@ const Hs = (r) => {
|
|
|
5242
5289
|
return;
|
|
5243
5290
|
}
|
|
5244
5291
|
try {
|
|
5245
|
-
const t =
|
|
5292
|
+
const t = ht(e), s = {
|
|
5246
5293
|
userId: r.trim(),
|
|
5247
5294
|
...t ? { traits: t } : {}
|
|
5248
5295
|
};
|
|
@@ -5260,7 +5307,7 @@ const Hs = (r) => {
|
|
|
5260
5307
|
}
|
|
5261
5308
|
return;
|
|
5262
5309
|
}
|
|
5263
|
-
if (
|
|
5310
|
+
if (S)
|
|
5264
5311
|
throw new Error("[TraceLog] Cannot reset identity while TraceLog is being destroyed");
|
|
5265
5312
|
await h.resetIdentity();
|
|
5266
5313
|
}
|
|
@@ -5282,19 +5329,19 @@ const Hs = (r) => {
|
|
|
5282
5329
|
identify: zs,
|
|
5283
5330
|
resetIdentity: Qs
|
|
5284
5331
|
};
|
|
5285
|
-
var
|
|
5332
|
+
var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
5286
5333
|
addEventListener("pageshow", (function(e) {
|
|
5287
5334
|
e.persisted && (pt = e.timeStamp, r(e));
|
|
5288
5335
|
}), !0);
|
|
5289
|
-
},
|
|
5336
|
+
}, Pe = function() {
|
|
5290
5337
|
var r = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
5291
5338
|
if (r && r.responseStart > 0 && r.responseStart < performance.now()) return r;
|
|
5292
|
-
},
|
|
5293
|
-
var r =
|
|
5339
|
+
}, ue = function() {
|
|
5340
|
+
var r = Pe();
|
|
5294
5341
|
return r && r.activationStart || 0;
|
|
5295
5342
|
}, y = function(r, e) {
|
|
5296
|
-
var t =
|
|
5297
|
-
return pt >= 0 ? s = "back-forward-cache" : t && (document.prerendering ||
|
|
5343
|
+
var t = Pe(), s = "navigate";
|
|
5344
|
+
return pt >= 0 ? s = "back-forward-cache" : t && (document.prerendering || ue() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
|
|
5298
5345
|
}, F = function(r, e, t) {
|
|
5299
5346
|
try {
|
|
5300
5347
|
if (PerformanceObserver.supportedEntryTypes.includes(r)) {
|
|
@@ -5314,7 +5361,7 @@ var Le, C, G, St, le, pt = -1, V = function(r) {
|
|
|
5314
5361
|
return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
|
|
5315
5362
|
})(e.value, t), r(e));
|
|
5316
5363
|
};
|
|
5317
|
-
},
|
|
5364
|
+
}, De = function(r) {
|
|
5318
5365
|
requestAnimationFrame((function() {
|
|
5319
5366
|
return requestAnimationFrame((function() {
|
|
5320
5367
|
return r();
|
|
@@ -5324,23 +5371,23 @@ var Le, C, G, St, le, pt = -1, V = function(r) {
|
|
|
5324
5371
|
document.addEventListener("visibilitychange", (function() {
|
|
5325
5372
|
document.visibilityState === "hidden" && r();
|
|
5326
5373
|
}));
|
|
5327
|
-
},
|
|
5374
|
+
}, de = function(r) {
|
|
5328
5375
|
var e = !1;
|
|
5329
5376
|
return function() {
|
|
5330
5377
|
e || (r(), e = !0);
|
|
5331
5378
|
};
|
|
5332
|
-
}, H = -1,
|
|
5379
|
+
}, H = -1, et = function() {
|
|
5333
5380
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
5334
5381
|
}, ce = function(r) {
|
|
5335
5382
|
document.visibilityState === "hidden" && H > -1 && (H = r.type === "visibilitychange" ? r.timeStamp : 0, Ks());
|
|
5336
|
-
},
|
|
5383
|
+
}, tt = function() {
|
|
5337
5384
|
addEventListener("visibilitychange", ce, !0), addEventListener("prerenderingchange", ce, !0);
|
|
5338
5385
|
}, Ks = function() {
|
|
5339
5386
|
removeEventListener("visibilitychange", ce, !0), removeEventListener("prerenderingchange", ce, !0);
|
|
5340
|
-
},
|
|
5341
|
-
return H < 0 && (H =
|
|
5387
|
+
}, ke = function() {
|
|
5388
|
+
return H < 0 && (H = et(), tt(), V((function() {
|
|
5342
5389
|
setTimeout((function() {
|
|
5343
|
-
H =
|
|
5390
|
+
H = et(), tt();
|
|
5344
5391
|
}), 0);
|
|
5345
5392
|
}))), { get firstHiddenTime() {
|
|
5346
5393
|
return H;
|
|
@@ -5349,47 +5396,47 @@ var Le, C, G, St, le, pt = -1, V = function(r) {
|
|
|
5349
5396
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
5350
5397
|
return r();
|
|
5351
5398
|
}), !0) : r();
|
|
5352
|
-
},
|
|
5399
|
+
}, Le = [1800, 3e3], St = function(r, e) {
|
|
5353
5400
|
e = e || {}, Q((function() {
|
|
5354
|
-
var t, s =
|
|
5401
|
+
var t, s = ke(), n = y("FCP"), i = F("paint", (function(o) {
|
|
5355
5402
|
o.forEach((function(l) {
|
|
5356
|
-
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime -
|
|
5403
|
+
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime - ue(), 0), n.entries.push(l), t(!0)));
|
|
5357
5404
|
}));
|
|
5358
5405
|
}));
|
|
5359
|
-
i && (t = w(r, n,
|
|
5360
|
-
n = y("FCP"), t = w(r, n,
|
|
5406
|
+
i && (t = w(r, n, Le, e.reportAllChanges), V((function(o) {
|
|
5407
|
+
n = y("FCP"), t = w(r, n, Le, e.reportAllChanges), De((function() {
|
|
5361
5408
|
n.value = performance.now() - o.timeStamp, t(!0);
|
|
5362
5409
|
}));
|
|
5363
5410
|
})));
|
|
5364
5411
|
}));
|
|
5365
|
-
},
|
|
5366
|
-
e = e || {},
|
|
5412
|
+
}, Me = [0.1, 0.25], Ys = function(r, e) {
|
|
5413
|
+
e = e || {}, St(de((function() {
|
|
5367
5414
|
var t, s = y("CLS", 0), n = 0, i = [], o = function(c) {
|
|
5368
|
-
c.forEach((function(
|
|
5369
|
-
if (!
|
|
5415
|
+
c.forEach((function(u) {
|
|
5416
|
+
if (!u.hadRecentInput) {
|
|
5370
5417
|
var f = i[0], g = i[i.length - 1];
|
|
5371
|
-
n &&
|
|
5418
|
+
n && u.startTime - g.startTime < 1e3 && u.startTime - f.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
|
|
5372
5419
|
}
|
|
5373
5420
|
})), n > s.value && (s.value = n, s.entries = i, t());
|
|
5374
5421
|
}, l = F("layout-shift", o);
|
|
5375
|
-
l && (t = w(r, s,
|
|
5422
|
+
l && (t = w(r, s, Me, e.reportAllChanges), z((function() {
|
|
5376
5423
|
o(l.takeRecords()), t(!0);
|
|
5377
5424
|
})), V((function() {
|
|
5378
|
-
n = 0, s = y("CLS", 0), t = w(r, s,
|
|
5425
|
+
n = 0, s = y("CLS", 0), t = w(r, s, Me, e.reportAllChanges), De((function() {
|
|
5379
5426
|
return t();
|
|
5380
5427
|
}));
|
|
5381
5428
|
})), setTimeout(t, 0));
|
|
5382
5429
|
})));
|
|
5383
|
-
},
|
|
5430
|
+
}, Tt = 0, pe = 1 / 0, J = 0, qs = function(r) {
|
|
5384
5431
|
r.forEach((function(e) {
|
|
5385
|
-
e.interactionId && (
|
|
5432
|
+
e.interactionId && (pe = Math.min(pe, e.interactionId), J = Math.max(J, e.interactionId), Tt = J ? (J - pe) / 7 + 1 : 0);
|
|
5386
5433
|
}));
|
|
5387
|
-
},
|
|
5388
|
-
return
|
|
5434
|
+
}, It = function() {
|
|
5435
|
+
return Ae ? Tt : performance.interactionCount || 0;
|
|
5389
5436
|
}, Js = function() {
|
|
5390
|
-
"interactionCount" in performance ||
|
|
5391
|
-
}, A = [], te = /* @__PURE__ */ new Map(),
|
|
5392
|
-
var r = Math.min(A.length - 1, Math.floor((
|
|
5437
|
+
"interactionCount" in performance || Ae || (Ae = F("event", qs, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
5438
|
+
}, A = [], te = /* @__PURE__ */ new Map(), vt = 0, Zs = function() {
|
|
5439
|
+
var r = Math.min(A.length - 1, Math.floor((It() - vt) / 50));
|
|
5393
5440
|
return A[r];
|
|
5394
5441
|
}, er = [], tr = function(r) {
|
|
5395
5442
|
if (er.forEach((function(n) {
|
|
@@ -5409,50 +5456,50 @@ var Le, C, G, St, le, pt = -1, V = function(r) {
|
|
|
5409
5456
|
}));
|
|
5410
5457
|
}
|
|
5411
5458
|
}
|
|
5412
|
-
},
|
|
5459
|
+
}, _t = function(r) {
|
|
5413
5460
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
5414
|
-
return r =
|
|
5415
|
-
},
|
|
5461
|
+
return r = de(r), document.visibilityState === "hidden" ? r() : (t = e(r), z(r)), t;
|
|
5462
|
+
}, Ce = [200, 500], sr = function(r, e) {
|
|
5416
5463
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, Q((function() {
|
|
5417
5464
|
var t;
|
|
5418
5465
|
Js();
|
|
5419
5466
|
var s, n = y("INP"), i = function(l) {
|
|
5420
|
-
|
|
5467
|
+
_t((function() {
|
|
5421
5468
|
l.forEach(tr);
|
|
5422
5469
|
var c = Zs();
|
|
5423
5470
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, s());
|
|
5424
5471
|
}));
|
|
5425
5472
|
}, o = F("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
5426
|
-
s = w(r, n,
|
|
5473
|
+
s = w(r, n, Ce, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), z((function() {
|
|
5427
5474
|
i(o.takeRecords()), s(!0);
|
|
5428
5475
|
})), V((function() {
|
|
5429
|
-
|
|
5476
|
+
vt = It(), A.length = 0, te.clear(), n = y("INP"), s = w(r, n, Ce, e.reportAllChanges);
|
|
5430
5477
|
})));
|
|
5431
5478
|
})));
|
|
5432
|
-
},
|
|
5479
|
+
}, Re = [2500, 4e3], Se = {}, rr = function(r, e) {
|
|
5433
5480
|
e = e || {}, Q((function() {
|
|
5434
|
-
var t, s =
|
|
5435
|
-
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(
|
|
5436
|
-
|
|
5481
|
+
var t, s = ke(), n = y("LCP"), i = function(c) {
|
|
5482
|
+
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
5483
|
+
u.startTime < s.firstHiddenTime && (n.value = Math.max(u.startTime - ue(), 0), n.entries = [u], t());
|
|
5437
5484
|
}));
|
|
5438
5485
|
}, o = F("largest-contentful-paint", i);
|
|
5439
5486
|
if (o) {
|
|
5440
|
-
t = w(r, n,
|
|
5441
|
-
var l =
|
|
5442
|
-
|
|
5487
|
+
t = w(r, n, Re, e.reportAllChanges);
|
|
5488
|
+
var l = de((function() {
|
|
5489
|
+
Se[n.id] || (i(o.takeRecords()), o.disconnect(), Se[n.id] = !0, t(!0));
|
|
5443
5490
|
}));
|
|
5444
5491
|
["keydown", "click"].forEach((function(c) {
|
|
5445
5492
|
addEventListener(c, (function() {
|
|
5446
|
-
return
|
|
5493
|
+
return _t(l);
|
|
5447
5494
|
}), { once: !0, capture: !0 });
|
|
5448
5495
|
})), z(l), V((function(c) {
|
|
5449
|
-
n = y("LCP"), t = w(r, n,
|
|
5450
|
-
n.value = performance.now() - c.timeStamp,
|
|
5496
|
+
n = y("LCP"), t = w(r, n, Re, e.reportAllChanges), De((function() {
|
|
5497
|
+
n.value = performance.now() - c.timeStamp, Se[n.id] = !0, t(!0);
|
|
5451
5498
|
}));
|
|
5452
5499
|
}));
|
|
5453
5500
|
}
|
|
5454
5501
|
}));
|
|
5455
|
-
},
|
|
5502
|
+
}, Ne = [800, 1800], nr = function r(e) {
|
|
5456
5503
|
document.prerendering ? Q((function() {
|
|
5457
5504
|
return r(e);
|
|
5458
5505
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
@@ -5460,17 +5507,17 @@ var Le, C, G, St, le, pt = -1, V = function(r) {
|
|
|
5460
5507
|
}), !0) : setTimeout(e, 0);
|
|
5461
5508
|
}, ir = function(r, e) {
|
|
5462
5509
|
e = e || {};
|
|
5463
|
-
var t = y("TTFB"), s = w(r, t,
|
|
5510
|
+
var t = y("TTFB"), s = w(r, t, Ne, e.reportAllChanges);
|
|
5464
5511
|
nr((function() {
|
|
5465
|
-
var n =
|
|
5466
|
-
n && (t.value = Math.max(n.responseStart -
|
|
5467
|
-
t = y("TTFB", 0), (s = w(r, t,
|
|
5512
|
+
var n = Pe();
|
|
5513
|
+
n && (t.value = Math.max(n.responseStart - ue(), 0), t.entries = [n], s(!0), V((function() {
|
|
5514
|
+
t = y("TTFB", 0), (s = w(r, t, Ne, e.reportAllChanges))(!0);
|
|
5468
5515
|
})));
|
|
5469
5516
|
}));
|
|
5470
|
-
}, W = { passive: !0, capture: !0 }, or = /* @__PURE__ */ new Date(),
|
|
5471
|
-
C || (C = e, G = r,
|
|
5472
|
-
},
|
|
5473
|
-
if (G >= 0 && G <
|
|
5517
|
+
}, W = { passive: !0, capture: !0 }, or = /* @__PURE__ */ new Date(), st = function(r, e) {
|
|
5518
|
+
C || (C = e, G = r, Et = /* @__PURE__ */ new Date(), wt(removeEventListener), yt());
|
|
5519
|
+
}, yt = function() {
|
|
5520
|
+
if (G >= 0 && G < Et - or) {
|
|
5474
5521
|
var r = { entryType: "first-input", name: C.type, target: C.target, cancelable: C.cancelable, startTime: C.timeStamp, processingStart: C.timeStamp + G };
|
|
5475
5522
|
le.forEach((function(e) {
|
|
5476
5523
|
e(r);
|
|
@@ -5481,44 +5528,44 @@ var Le, C, G, St, le, pt = -1, V = function(r) {
|
|
|
5481
5528
|
var e = (r.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - r.timeStamp;
|
|
5482
5529
|
r.type == "pointerdown" ? (function(t, s) {
|
|
5483
5530
|
var n = function() {
|
|
5484
|
-
|
|
5531
|
+
st(t, s), o();
|
|
5485
5532
|
}, i = function() {
|
|
5486
5533
|
o();
|
|
5487
5534
|
}, o = function() {
|
|
5488
5535
|
removeEventListener("pointerup", n, W), removeEventListener("pointercancel", i, W);
|
|
5489
5536
|
};
|
|
5490
5537
|
addEventListener("pointerup", n, W), addEventListener("pointercancel", i, W);
|
|
5491
|
-
})(e, r) :
|
|
5538
|
+
})(e, r) : st(e, r);
|
|
5492
5539
|
}
|
|
5493
|
-
},
|
|
5540
|
+
}, wt = function(r) {
|
|
5494
5541
|
["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
|
|
5495
5542
|
return r(e, ar, W);
|
|
5496
5543
|
}));
|
|
5497
|
-
},
|
|
5544
|
+
}, Oe = [100, 300], lr = function(r, e) {
|
|
5498
5545
|
e = e || {}, Q((function() {
|
|
5499
|
-
var t, s =
|
|
5546
|
+
var t, s = ke(), n = y("FID"), i = function(c) {
|
|
5500
5547
|
c.startTime < s.firstHiddenTime && (n.value = c.processingStart - c.startTime, n.entries.push(c), t(!0));
|
|
5501
5548
|
}, o = function(c) {
|
|
5502
5549
|
c.forEach(i);
|
|
5503
5550
|
}, l = F("first-input", o);
|
|
5504
|
-
t = w(r, n,
|
|
5551
|
+
t = w(r, n, Oe, e.reportAllChanges), l && (z(de((function() {
|
|
5505
5552
|
o(l.takeRecords()), l.disconnect();
|
|
5506
5553
|
}))), V((function() {
|
|
5507
5554
|
var c;
|
|
5508
|
-
n = y("FID"), t = w(r, n,
|
|
5555
|
+
n = y("FID"), t = w(r, n, Oe, e.reportAllChanges), le = [], G = -1, C = null, wt(addEventListener), c = i, le.push(c), yt();
|
|
5509
5556
|
})));
|
|
5510
5557
|
}));
|
|
5511
5558
|
};
|
|
5512
5559
|
const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5513
5560
|
__proto__: null,
|
|
5514
|
-
CLSThresholds:
|
|
5515
|
-
FCPThresholds:
|
|
5516
|
-
FIDThresholds:
|
|
5517
|
-
INPThresholds:
|
|
5518
|
-
LCPThresholds:
|
|
5519
|
-
TTFBThresholds:
|
|
5561
|
+
CLSThresholds: Me,
|
|
5562
|
+
FCPThresholds: Le,
|
|
5563
|
+
FIDThresholds: Oe,
|
|
5564
|
+
INPThresholds: Ce,
|
|
5565
|
+
LCPThresholds: Re,
|
|
5566
|
+
TTFBThresholds: Ne,
|
|
5520
5567
|
onCLS: Ys,
|
|
5521
|
-
onFCP:
|
|
5568
|
+
onFCP: St,
|
|
5522
5569
|
onFID: lr,
|
|
5523
5570
|
onINP: sr,
|
|
5524
5571
|
onLCP: rr,
|
|
@@ -5526,36 +5573,36 @@ const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5526
5573
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5527
5574
|
export {
|
|
5528
5575
|
m as AppConfigValidationError,
|
|
5529
|
-
|
|
5576
|
+
ur as DEFAULT_SESSION_TIMEOUT,
|
|
5530
5577
|
_e as DEFAULT_WEB_VITALS_MODE,
|
|
5531
5578
|
L as DeviceType,
|
|
5532
5579
|
se as EmitterEvent,
|
|
5533
5580
|
B as ErrorType,
|
|
5534
|
-
|
|
5581
|
+
d as EventType,
|
|
5535
5582
|
vr as InitializationTimeoutError,
|
|
5536
5583
|
N as IntegrationValidationError,
|
|
5537
|
-
|
|
5584
|
+
Sr as MAX_ARRAY_LENGTH,
|
|
5538
5585
|
mr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
5539
5586
|
fr as MAX_CUSTOM_EVENT_KEYS,
|
|
5540
|
-
|
|
5587
|
+
dr as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
5541
5588
|
hr as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
5542
5589
|
gr as MAX_NESTED_OBJECT_KEYS,
|
|
5543
5590
|
Er as MAX_STRING_LENGTH,
|
|
5544
|
-
|
|
5591
|
+
pr as MAX_STRING_LENGTH_IN_ARRAY,
|
|
5545
5592
|
ie as Mode,
|
|
5546
|
-
|
|
5593
|
+
at as PII_PATTERNS,
|
|
5547
5594
|
O as PermanentError,
|
|
5548
5595
|
re as RateLimitError,
|
|
5549
|
-
|
|
5596
|
+
We as SamplingRateValidationError,
|
|
5550
5597
|
Z as ScrollDirection,
|
|
5551
|
-
|
|
5598
|
+
Ot as SessionTimeoutValidationError,
|
|
5552
5599
|
$ as SpecialApiUrl,
|
|
5553
5600
|
ne as TimeoutError,
|
|
5554
5601
|
j as TraceLogValidationError,
|
|
5555
5602
|
_r as WEB_VITALS_GOOD_THRESHOLDS,
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5603
|
+
Qe as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
5604
|
+
Qt as WEB_VITALS_POOR_THRESHOLDS,
|
|
5605
|
+
Ke as getWebVitalsThresholds,
|
|
5559
5606
|
Tr as isPrimaryScrollEvent,
|
|
5560
5607
|
Ir as isSecondaryScrollEvent,
|
|
5561
5608
|
yr as tracelog
|