@tracelog/lib 2.7.1 → 2.7.2-rc.97.3
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/README.md +8 -3
- package/dist/browser/tracelog.esm.js +430 -397
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +2 -1
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +2 -2
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +15 -2
- package/dist/public-api.d.ts +15 -2
- package/dist/public-api.js +2 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const b = "data-tlog",
|
|
1
|
+
const ls = 9e5;
|
|
2
|
+
const cs = 120, us = 49152, ds = 100, hs = 500, fs = 200;
|
|
3
|
+
const ms = 1e3, gs = 500, Es = 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", _t = [
|
|
|
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,58 +72,63 @@ const m = {
|
|
|
72
72
|
INVALID_VIEWPORT_COOLDOWN_PERIOD: "Viewport cooldownPeriod must be a non-negative number",
|
|
73
73
|
INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS: "Viewport maxTrackedElements must be a positive number",
|
|
74
74
|
INVALID_SEND_INTERVAL: "Send interval must be between 1000ms (1 second) and 60000ms (60 seconds)"
|
|
75
|
-
},
|
|
75
|
+
}, 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",
|
|
83
|
-
var B = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(B || {}), L = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(L || {}),
|
|
82
|
+
], I = "tlog", G = `${I}:qa_mode`, pe = `${I}:uid`, st = "tlog_mode", Ue = "qa", He = "qa_off", Ct = (s) => s ? `${I}:${s}:queue` : `${I}:queue`, Rt = (s) => s ? `${I}:${s}:session` : `${I}:session`, Nt = (s) => s ? `${I}:${s}:broadcast` : `${I}:broadcast`, Fe = (s, e) => `${I}:${s}:session_counts:${e}`, xe = 10080 * 60 * 1e3, $e = `${I}:session_counts_last_cleanup`, Be = 3600 * 1e3, he = (s) => s ? `${I}:${s}:identity` : `${I}:identity`, H = `${I}:pending_identity`;
|
|
83
|
+
var B = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(B || {}), L = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(L || {}), Te = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(Te || {});
|
|
84
84
|
class N extends Error {
|
|
85
85
|
constructor(e, t) {
|
|
86
86
|
super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, N);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
class se extends Error {
|
|
90
|
+
constructor(e) {
|
|
91
|
+
super(e), this.name = "RateLimitError", Error.captureStackTrace && Error.captureStackTrace(this, se);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
89
94
|
class O extends Error {
|
|
90
95
|
constructor(e) {
|
|
91
96
|
super(e), this.name = "TimeoutError", Error.captureStackTrace && Error.captureStackTrace(this, O);
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
|
-
var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s.VIEWPORT_VISIBLE = "viewport_visible", s))(d || {}), ee = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(ee || {}), W = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(W || {}),
|
|
95
|
-
const
|
|
96
|
-
class
|
|
99
|
+
var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s.VIEWPORT_VISIBLE = "viewport_visible", s))(d || {}), ee = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(ee || {}), W = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(W || {}), ne = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(ne || {});
|
|
100
|
+
const Ss = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !0, ps = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !1;
|
|
101
|
+
class z extends Error {
|
|
97
102
|
constructor(e, t, r) {
|
|
98
103
|
super(e), this.errorCode = t, this.layer = r, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
99
104
|
}
|
|
100
105
|
}
|
|
101
|
-
class f extends
|
|
106
|
+
class f extends z {
|
|
102
107
|
constructor(e, t = "config") {
|
|
103
108
|
super(e, "APP_CONFIG_INVALID", t);
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
|
-
class
|
|
111
|
+
class Ot extends z {
|
|
107
112
|
constructor(e, t = "config") {
|
|
108
113
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
|
-
class
|
|
116
|
+
class We extends z {
|
|
112
117
|
constructor(e, t = "config") {
|
|
113
118
|
super(e, "SAMPLING_RATE_INVALID", t);
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
|
-
class U extends
|
|
121
|
+
class U extends z {
|
|
117
122
|
constructor(e, t = "config") {
|
|
118
123
|
super(e, "INTEGRATION_INVALID", t);
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
|
-
class
|
|
126
|
+
class Ts extends z {
|
|
122
127
|
constructor(e, t, r = "runtime") {
|
|
123
128
|
super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
|
-
const
|
|
131
|
+
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 = (s, e) => {
|
|
127
132
|
if (e) {
|
|
128
133
|
if (e instanceof Error) {
|
|
129
134
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
|
|
@@ -142,24 +147,24 @@ const tt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
142
147
|
return `[TraceLog] ${s}: ${String(e)}`;
|
|
143
148
|
}
|
|
144
149
|
return `[TraceLog] ${s}`;
|
|
145
|
-
},
|
|
150
|
+
}, kt = () => {
|
|
146
151
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
147
152
|
return !1;
|
|
148
153
|
try {
|
|
149
|
-
return sessionStorage.getItem(
|
|
154
|
+
return sessionStorage.getItem(G) === "true";
|
|
150
155
|
} catch {
|
|
151
156
|
return !1;
|
|
152
157
|
}
|
|
153
158
|
}, a = (s, e, t) => {
|
|
154
|
-
const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ?
|
|
155
|
-
if (!
|
|
159
|
+
const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ? Dt(e, r) : `[TraceLog] ${e}`, u = s === "error" ? "error" : s === "warn" ? "warn" : "log";
|
|
160
|
+
if (!Vt(l, i))
|
|
156
161
|
return;
|
|
157
|
-
const E =
|
|
158
|
-
|
|
159
|
-
},
|
|
162
|
+
const E = Ut(l, o), T = n !== void 0 ? Ie(n) : void 0;
|
|
163
|
+
Ht(u, c, E, T);
|
|
164
|
+
}, Vt = (s, e) => s === "critical" ? !0 : s === "qa" || e ? kt() : !1, Ut = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? Pt : "", Ht = (s, e, t, r) => {
|
|
160
165
|
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
161
166
|
r !== void 0 ? n ? console[s](i, t, r) : console[s](i, r) : n ? console[s](i, t) : console[s](i);
|
|
162
|
-
},
|
|
167
|
+
}, Ie = (s) => {
|
|
163
168
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
164
169
|
for (const [r, n] of Object.entries(s)) {
|
|
165
170
|
const i = r.toLowerCase();
|
|
@@ -167,16 +172,16 @@ const tt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
167
172
|
e[r] = "[REDACTED]";
|
|
168
173
|
continue;
|
|
169
174
|
}
|
|
170
|
-
n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] =
|
|
171
|
-
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ?
|
|
175
|
+
n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] = Ie(n) : Array.isArray(n) ? e[r] = n.map(
|
|
176
|
+
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ? Ie(o) : o
|
|
172
177
|
) : e[r] = n;
|
|
173
178
|
}
|
|
174
179
|
return e;
|
|
175
180
|
};
|
|
176
|
-
let
|
|
177
|
-
const
|
|
178
|
-
typeof window < "u" && !
|
|
179
|
-
},
|
|
181
|
+
let ve, ot;
|
|
182
|
+
const Ft = () => {
|
|
183
|
+
typeof window < "u" && !ve && (ve = window.matchMedia("(pointer: coarse)"), ot = window.matchMedia("(hover: none)"));
|
|
184
|
+
}, ie = "Unknown", xt = (s) => {
|
|
180
185
|
const e = s.userAgentData?.platform;
|
|
181
186
|
if (e != null && e !== "") {
|
|
182
187
|
if (/windows/i.test(e)) return "Windows";
|
|
@@ -187,8 +192,8 @@ const kt = () => {
|
|
|
187
192
|
if (/ios/i.test(e)) return "iOS";
|
|
188
193
|
}
|
|
189
194
|
const t = navigator.userAgent;
|
|
190
|
-
return /Windows/i.test(t) ? "Windows" : /iPhone|iPad|iPod/i.test(t) ? "iOS" : /Mac OS X|Macintosh/i.test(t) ? "macOS" : /Android/i.test(t) ? "Android" : /CrOS/i.test(t) ? "ChromeOS" : /Linux/i.test(t) ? "Linux" :
|
|
191
|
-
},
|
|
195
|
+
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" : ie;
|
|
196
|
+
}, $t = (s) => {
|
|
192
197
|
const e = s.userAgentData?.brands;
|
|
193
198
|
if (e != null && e.length > 0) {
|
|
194
199
|
const n = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
|
|
@@ -198,36 +203,36 @@ const kt = () => {
|
|
|
198
203
|
}
|
|
199
204
|
}
|
|
200
205
|
const t = navigator.userAgent;
|
|
201
|
-
return /Edg\//i.test(t) ? "Edge" : /OPR\//i.test(t) ? "Opera" : /Chrome/i.test(t) ? "Chrome" : /Firefox/i.test(t) ? "Firefox" : /Safari/i.test(t) && !/Chrome/i.test(t) ? "Safari" :
|
|
202
|
-
},
|
|
206
|
+
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" : ie;
|
|
207
|
+
}, Bt = () => {
|
|
203
208
|
try {
|
|
204
209
|
const s = navigator;
|
|
205
210
|
if (s.userAgentData != null && typeof s.userAgentData.mobile == "boolean") {
|
|
206
211
|
const c = s.userAgentData.platform;
|
|
207
212
|
return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet : s.userAgentData.mobile ? L.Mobile : L.Desktop;
|
|
208
213
|
}
|
|
209
|
-
|
|
210
|
-
const e = window.innerWidth, t =
|
|
214
|
+
Ft();
|
|
215
|
+
const e = window.innerWidth, t = ve?.matches ?? !1, r = 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);
|
|
211
216
|
return e <= 767 || o && n ? L.Mobile : e >= 768 && e <= 1024 || l || t && r && n ? L.Tablet : L.Desktop;
|
|
212
217
|
} catch (s) {
|
|
213
218
|
return a("debug", "Device detection failed, defaulting to desktop", { error: s }), L.Desktop;
|
|
214
219
|
}
|
|
215
|
-
},
|
|
220
|
+
}, Wt = () => {
|
|
216
221
|
try {
|
|
217
222
|
const s = navigator;
|
|
218
223
|
return {
|
|
219
|
-
type:
|
|
220
|
-
os:
|
|
221
|
-
browser:
|
|
224
|
+
type: Bt(),
|
|
225
|
+
os: xt(s),
|
|
226
|
+
browser: $t(s)
|
|
222
227
|
};
|
|
223
228
|
} catch (s) {
|
|
224
229
|
return a("debug", "Device info detection failed, using defaults", { error: s }), {
|
|
225
230
|
type: L.Desktop,
|
|
226
|
-
os:
|
|
227
|
-
browser:
|
|
231
|
+
os: ie,
|
|
232
|
+
browser: ie
|
|
228
233
|
};
|
|
229
234
|
}
|
|
230
|
-
},
|
|
235
|
+
}, at = [
|
|
231
236
|
// Email addresses
|
|
232
237
|
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
|
|
233
238
|
// US Phone numbers (various formats)
|
|
@@ -241,8 +246,10 @@ const kt = () => {
|
|
|
241
246
|
// Bearer tokens (JWT-like patterns - matches complete and partial tokens)
|
|
242
247
|
/Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
|
|
243
248
|
// Passwords in connection strings (protocol://user:password@host)
|
|
244
|
-
/:\/\/[^:/]+:([^@]+)@/gi
|
|
245
|
-
|
|
249
|
+
/:\/\/[^:/]+:([^@]+)@/gi,
|
|
250
|
+
// Sensitive URL query parameters (token=, password=, auth=, secret=, api_key=, etc.)
|
|
251
|
+
/[?&](token|password|passwd|auth|secret|secret_key|private_key|auth_key|api_key|apikey|access_token)=[^&\s]+/gi
|
|
252
|
+
], Xe = 500, Ge = 2e3, je = 5e3, te = 50, Xt = te * 2, lt = 1, Gt = 1e3, jt = 10, ze = 5e3, zt = 6e4, Is = {
|
|
246
253
|
LCP: 2500,
|
|
247
254
|
// Good: ≤ 2.5s
|
|
248
255
|
FCP: 1800,
|
|
@@ -254,7 +261,7 @@ const kt = () => {
|
|
|
254
261
|
TTFB: 800,
|
|
255
262
|
// Good: ≤ 800ms
|
|
256
263
|
LONG_TASK: 50
|
|
257
|
-
},
|
|
264
|
+
}, Qe = {
|
|
258
265
|
LCP: 2500,
|
|
259
266
|
// Needs improvement: > 2.5s (same as good boundary)
|
|
260
267
|
FCP: 1800,
|
|
@@ -266,7 +273,7 @@ const kt = () => {
|
|
|
266
273
|
TTFB: 800,
|
|
267
274
|
// Needs improvement: > 800ms
|
|
268
275
|
LONG_TASK: 50
|
|
269
|
-
},
|
|
276
|
+
}, Qt = {
|
|
270
277
|
LCP: 4e3,
|
|
271
278
|
// Poor: > 4s
|
|
272
279
|
FCP: 3e3,
|
|
@@ -278,53 +285,53 @@ const kt = () => {
|
|
|
278
285
|
TTFB: 1800,
|
|
279
286
|
// Poor: > 1800ms
|
|
280
287
|
LONG_TASK: 50
|
|
281
|
-
},
|
|
288
|
+
}, _e = "needs-improvement", Ke = (s = _e) => {
|
|
282
289
|
switch (s) {
|
|
283
290
|
case "all":
|
|
284
291
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
|
|
285
292
|
// Track everything
|
|
286
293
|
case "needs-improvement":
|
|
287
|
-
return
|
|
294
|
+
return Qe;
|
|
288
295
|
case "poor":
|
|
289
|
-
return
|
|
296
|
+
return Qt;
|
|
290
297
|
default:
|
|
291
|
-
return
|
|
298
|
+
return Qe;
|
|
292
299
|
}
|
|
293
|
-
},
|
|
300
|
+
}, Kt = 1e3, Yt = 50, qt = "2.7.2", Jt = qt, ct = () => typeof window < "u" && typeof sessionStorage < "u", Zt = () => {
|
|
294
301
|
try {
|
|
295
302
|
const s = new URLSearchParams(window.location.search);
|
|
296
|
-
s.delete(
|
|
303
|
+
s.delete(st);
|
|
297
304
|
const e = s.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
|
|
298
305
|
window.history.replaceState({}, "", t);
|
|
299
306
|
} catch {
|
|
300
307
|
}
|
|
301
|
-
},
|
|
302
|
-
if (!
|
|
308
|
+
}, er = () => {
|
|
309
|
+
if (!ct())
|
|
303
310
|
return !1;
|
|
304
311
|
try {
|
|
305
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
312
|
+
const e = new URLSearchParams(window.location.search).get(st), t = sessionStorage.getItem(G);
|
|
306
313
|
let r = null;
|
|
307
|
-
return e ===
|
|
314
|
+
return e === Ue ? (r = !0, sessionStorage.setItem(G, "true"), a("info", "QA Mode ACTIVE", {
|
|
308
315
|
visibility: "qa",
|
|
309
|
-
style:
|
|
310
|
-
})) : e ===
|
|
316
|
+
style: nt
|
|
317
|
+
})) : e === He && (r = !1, sessionStorage.setItem(G, "false"), a("info", "QA Mode DISABLED", {
|
|
311
318
|
visibility: "qa",
|
|
312
|
-
style:
|
|
313
|
-
})), (e ===
|
|
319
|
+
style: it
|
|
320
|
+
})), (e === Ue || e === He) && Zt(), r ?? t === "true";
|
|
314
321
|
} catch {
|
|
315
322
|
return !1;
|
|
316
323
|
}
|
|
317
|
-
},
|
|
318
|
-
if (
|
|
324
|
+
}, tr = (s) => {
|
|
325
|
+
if (ct())
|
|
319
326
|
try {
|
|
320
|
-
sessionStorage.setItem(
|
|
327
|
+
sessionStorage.setItem(G, s ? "true" : "false"), a("info", s ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
321
328
|
visibility: "qa",
|
|
322
|
-
style: s ?
|
|
329
|
+
style: s ? nt : it
|
|
323
330
|
});
|
|
324
331
|
} catch {
|
|
325
332
|
a("debug", "Cannot set QA mode: sessionStorage unavailable");
|
|
326
333
|
}
|
|
327
|
-
},
|
|
334
|
+
}, rr = [
|
|
328
335
|
"co.uk",
|
|
329
336
|
"org.uk",
|
|
330
337
|
"com.au",
|
|
@@ -336,37 +343,37 @@ const kt = () => {
|
|
|
336
343
|
"co.in",
|
|
337
344
|
"com.cn",
|
|
338
345
|
"co.za"
|
|
339
|
-
],
|
|
346
|
+
], Ye = (s) => {
|
|
340
347
|
const e = s.toLowerCase().split(".");
|
|
341
348
|
if (e.length <= 2)
|
|
342
349
|
return s.toLowerCase();
|
|
343
350
|
const t = e.slice(-2).join(".");
|
|
344
|
-
return
|
|
345
|
-
},
|
|
351
|
+
return rr.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
352
|
+
}, sr = (s, e) => s === e ? !0 : Ye(s) === Ye(e), fe = () => {
|
|
346
353
|
const s = document.referrer;
|
|
347
354
|
if (!s)
|
|
348
355
|
return "Direct";
|
|
349
356
|
try {
|
|
350
357
|
const e = new URL(s).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
|
|
351
|
-
return
|
|
358
|
+
return sr(e, t) ? "Direct" : s;
|
|
352
359
|
} catch (e) {
|
|
353
360
|
return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: s } }), s;
|
|
354
361
|
}
|
|
355
|
-
},
|
|
362
|
+
}, me = () => {
|
|
356
363
|
const s = new URLSearchParams(window.location.search), e = {};
|
|
357
|
-
return
|
|
364
|
+
return At.forEach((r) => {
|
|
358
365
|
const n = s.get(r);
|
|
359
366
|
if (n) {
|
|
360
367
|
const i = r.split("utm_")[1];
|
|
361
368
|
e[i] = n;
|
|
362
369
|
}
|
|
363
370
|
}), Object.keys(e).length ? e : void 0;
|
|
364
|
-
},
|
|
371
|
+
}, ut = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (s) => {
|
|
365
372
|
const e = Math.random() * 16 | 0;
|
|
366
373
|
return (s === "x" ? e : e & 3 | 8).toString(16);
|
|
367
374
|
});
|
|
368
375
|
let q = 0, J = 0;
|
|
369
|
-
const
|
|
376
|
+
const nr = () => {
|
|
370
377
|
let s = Date.now();
|
|
371
378
|
s < J && (s = J), s === J ? q = (q + 1) % 1e3 : q = 0, J = s;
|
|
372
379
|
const e = q.toString().padStart(3, "0");
|
|
@@ -379,14 +386,14 @@ const tr = () => {
|
|
|
379
386
|
} catch {
|
|
380
387
|
}
|
|
381
388
|
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${s}-${e}-${t}`;
|
|
382
|
-
},
|
|
389
|
+
}, dt = (s, e = !1) => {
|
|
383
390
|
try {
|
|
384
391
|
const t = new URL(s), r = t.protocol === "https:", n = t.protocol === "http:";
|
|
385
392
|
return r || e && n;
|
|
386
393
|
} catch {
|
|
387
394
|
return !1;
|
|
388
395
|
}
|
|
389
|
-
},
|
|
396
|
+
}, ir = (s) => {
|
|
390
397
|
try {
|
|
391
398
|
const t = new URL(window.location.href).hostname;
|
|
392
399
|
if (!t || typeof t != "string")
|
|
@@ -404,28 +411,28 @@ const tr = () => {
|
|
|
404
411
|
if (r.length === 2 ? n = r.join(".") : n = r.slice(-2).join("."), !n || n.split(".").length < 2)
|
|
405
412
|
throw new Error("Invalid domain structure for SaaS");
|
|
406
413
|
const i = `https://${s}.${n}/collect`;
|
|
407
|
-
if (!
|
|
414
|
+
if (!dt(i))
|
|
408
415
|
throw new Error("Generated URL failed validation");
|
|
409
416
|
return i;
|
|
410
417
|
} catch (e) {
|
|
411
418
|
throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
|
|
412
419
|
}
|
|
413
|
-
},
|
|
420
|
+
}, or = (s) => {
|
|
414
421
|
const e = {};
|
|
415
|
-
s.integrations?.tracelog?.projectId && (e.saas =
|
|
422
|
+
s.integrations?.tracelog?.projectId && (e.saas = ir(s.integrations.tracelog.projectId));
|
|
416
423
|
const t = s.integrations?.custom?.collectApiUrl;
|
|
417
424
|
if (t) {
|
|
418
425
|
const r = s.integrations?.custom?.allowHttp ?? !1;
|
|
419
|
-
if (!
|
|
426
|
+
if (!dt(t, r))
|
|
420
427
|
throw new Error("Invalid custom API URL");
|
|
421
428
|
e.custom = t;
|
|
422
429
|
}
|
|
423
430
|
return e;
|
|
424
|
-
},
|
|
431
|
+
}, ye = (s, e = []) => {
|
|
425
432
|
if (!s || typeof s != "string")
|
|
426
433
|
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof s } }), s || "";
|
|
427
434
|
try {
|
|
428
|
-
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...
|
|
435
|
+
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...Lt, ...e])];
|
|
429
436
|
let i = !1;
|
|
430
437
|
const o = [];
|
|
431
438
|
return n.forEach((c) => {
|
|
@@ -434,13 +441,13 @@ const tr = () => {
|
|
|
434
441
|
} catch (t) {
|
|
435
442
|
return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: s?.length } }), s;
|
|
436
443
|
}
|
|
437
|
-
},
|
|
444
|
+
}, qe = (s) => {
|
|
438
445
|
if (!s || typeof s != "string" || s.trim().length === 0)
|
|
439
446
|
return "";
|
|
440
447
|
let e = s;
|
|
441
448
|
s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
|
|
442
449
|
let t = 0;
|
|
443
|
-
for (const n of
|
|
450
|
+
for (const n of Mt) {
|
|
444
451
|
const i = e;
|
|
445
452
|
e = e.replace(n, ""), i !== e && t++;
|
|
446
453
|
}
|
|
@@ -450,11 +457,11 @@ const tr = () => {
|
|
|
450
457
|
valueLength: s.length
|
|
451
458
|
}
|
|
452
459
|
}), e.trim();
|
|
453
|
-
},
|
|
460
|
+
}, we = (s, e = 0) => {
|
|
454
461
|
if (s == null)
|
|
455
462
|
return null;
|
|
456
463
|
if (typeof s == "string")
|
|
457
|
-
return
|
|
464
|
+
return qe(s);
|
|
458
465
|
if (typeof s == "number")
|
|
459
466
|
return !Number.isFinite(s) || s < -Number.MAX_SAFE_INTEGER || s > Number.MAX_SAFE_INTEGER ? 0 : s;
|
|
460
467
|
if (typeof s == "boolean")
|
|
@@ -462,38 +469,38 @@ const tr = () => {
|
|
|
462
469
|
if (e > 10)
|
|
463
470
|
return null;
|
|
464
471
|
if (Array.isArray(s))
|
|
465
|
-
return s.slice(0, 1e3).map((n) =>
|
|
472
|
+
return s.slice(0, 1e3).map((n) => we(n, e + 1)).filter((n) => n !== null);
|
|
466
473
|
if (typeof s == "object") {
|
|
467
474
|
const t = {}, n = Object.entries(s).slice(0, 200);
|
|
468
475
|
for (const [i, o] of n) {
|
|
469
|
-
const l =
|
|
476
|
+
const l = qe(i);
|
|
470
477
|
if (l) {
|
|
471
|
-
const c =
|
|
478
|
+
const c = we(o, e + 1);
|
|
472
479
|
c !== null && (t[l] = c);
|
|
473
480
|
}
|
|
474
481
|
}
|
|
475
482
|
return t;
|
|
476
483
|
}
|
|
477
484
|
return null;
|
|
478
|
-
},
|
|
485
|
+
}, ar = (s) => {
|
|
479
486
|
if (typeof s != "object" || s === null)
|
|
480
487
|
return {};
|
|
481
488
|
try {
|
|
482
|
-
const e =
|
|
489
|
+
const e = we(s);
|
|
483
490
|
return typeof e == "object" && e !== null ? e : {};
|
|
484
491
|
} catch (e) {
|
|
485
492
|
const t = e instanceof Error ? e.message : String(e);
|
|
486
493
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
487
494
|
}
|
|
488
|
-
},
|
|
495
|
+
}, lr = (s) => {
|
|
489
496
|
if (s !== void 0 && (s === null || typeof s != "object"))
|
|
490
497
|
throw new f("Configuration must be an object", "config");
|
|
491
498
|
if (s) {
|
|
492
499
|
if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
|
|
493
|
-
throw new
|
|
500
|
+
throw new Ot(m.INVALID_SESSION_TIMEOUT, "config");
|
|
494
501
|
if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
|
|
495
502
|
throw new f(m.INVALID_GLOBAL_METADATA, "config");
|
|
496
|
-
if (s.integrations &&
|
|
503
|
+
if (s.integrations && ur(s.integrations), s.sensitiveQueryParams !== void 0) {
|
|
497
504
|
if (!Array.isArray(s.sensitiveQueryParams))
|
|
498
505
|
throw new f(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
499
506
|
for (const e of s.sensitiveQueryParams)
|
|
@@ -501,9 +508,9 @@ const tr = () => {
|
|
|
501
508
|
throw new f("All sensitive query params must be strings", "config");
|
|
502
509
|
}
|
|
503
510
|
if (s.errorSampling !== void 0 && (typeof s.errorSampling != "number" || s.errorSampling < 0 || s.errorSampling > 1))
|
|
504
|
-
throw new
|
|
511
|
+
throw new We(m.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
505
512
|
if (s.samplingRate !== void 0 && (typeof s.samplingRate != "number" || s.samplingRate < 0 || s.samplingRate > 1))
|
|
506
|
-
throw new
|
|
513
|
+
throw new We(m.INVALID_SAMPLING_RATE, "config");
|
|
507
514
|
if (s.primaryScrollSelector !== void 0) {
|
|
508
515
|
if (typeof s.primaryScrollSelector != "string" || !s.primaryScrollSelector.trim())
|
|
509
516
|
throw new f(m.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
@@ -525,7 +532,7 @@ const tr = () => {
|
|
|
525
532
|
throw new f(m.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
|
|
526
533
|
if (s.sendIntervalMs !== void 0 && (!Number.isFinite(s.sendIntervalMs) || s.sendIntervalMs < 1e3 || s.sendIntervalMs > 6e4))
|
|
527
534
|
throw new f(m.INVALID_SEND_INTERVAL, "config");
|
|
528
|
-
if (s.viewport !== void 0 &&
|
|
535
|
+
if (s.viewport !== void 0 && cr(s.viewport), s.webVitalsMode !== void 0) {
|
|
529
536
|
if (typeof s.webVitalsMode != "string")
|
|
530
537
|
throw new f(
|
|
531
538
|
`Invalid webVitalsMode type: ${typeof s.webVitalsMode}. Must be a string`,
|
|
@@ -556,7 +563,7 @@ const tr = () => {
|
|
|
556
563
|
}
|
|
557
564
|
}
|
|
558
565
|
}
|
|
559
|
-
},
|
|
566
|
+
}, cr = (s) => {
|
|
560
567
|
if (typeof s != "object" || s === null)
|
|
561
568
|
throw new f(m.INVALID_VIEWPORT_CONFIG, "config");
|
|
562
569
|
if (!s.elements || !Array.isArray(s.elements))
|
|
@@ -586,7 +593,7 @@ const tr = () => {
|
|
|
586
593
|
throw new f(m.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
587
594
|
if (s.maxTrackedElements !== void 0 && (typeof s.maxTrackedElements != "number" || s.maxTrackedElements <= 0))
|
|
588
595
|
throw new f(m.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
589
|
-
},
|
|
596
|
+
}, ur = (s) => {
|
|
590
597
|
if (s) {
|
|
591
598
|
if (s.tracelog && (!s.tracelog.projectId || typeof s.tracelog.projectId != "string" || s.tracelog.projectId.trim() === ""))
|
|
592
599
|
throw new U(m.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
@@ -607,14 +614,14 @@ const tr = () => {
|
|
|
607
614
|
throw new U('fetchCredentials must be "include", "same-origin", or "omit"', "config");
|
|
608
615
|
}
|
|
609
616
|
}
|
|
610
|
-
},
|
|
611
|
-
|
|
617
|
+
}, dr = (s) => {
|
|
618
|
+
lr(s);
|
|
612
619
|
const e = {
|
|
613
620
|
...s ?? {},
|
|
614
621
|
sessionTimeout: s?.sessionTimeout ?? 9e5,
|
|
615
622
|
globalMetadata: s?.globalMetadata ?? {},
|
|
616
623
|
sensitiveQueryParams: s?.sensitiveQueryParams ?? [],
|
|
617
|
-
errorSampling: s?.errorSampling ??
|
|
624
|
+
errorSampling: s?.errorSampling ?? lt,
|
|
618
625
|
samplingRate: s?.samplingRate ?? 1,
|
|
619
626
|
pageViewThrottleMs: s?.pageViewThrottleMs ?? 1e3,
|
|
620
627
|
clickThrottleMs: s?.clickThrottleMs ?? 300,
|
|
@@ -631,18 +638,18 @@ const tr = () => {
|
|
|
631
638
|
cooldownPeriod: e.viewport.cooldownPeriod ?? 6e4,
|
|
632
639
|
maxTrackedElements: e.viewport.maxTrackedElements ?? 100
|
|
633
640
|
}), e;
|
|
634
|
-
},
|
|
641
|
+
}, be = (s, e = /* @__PURE__ */ new Set()) => {
|
|
635
642
|
if (s == null)
|
|
636
643
|
return !0;
|
|
637
644
|
const t = typeof s;
|
|
638
|
-
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(s) ? !1 : (e.add(s), Array.isArray(s) ? s.every((r) =>
|
|
639
|
-
},
|
|
645
|
+
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(s) ? !1 : (e.add(s), Array.isArray(s) ? s.every((r) => be(r, e)) : t === "object" ? Object.values(s).every((r) => be(r, e)) : !1);
|
|
646
|
+
}, hr = (s) => typeof s != "object" || s === null ? !1 : be(s), ht = (s) => {
|
|
640
647
|
if (typeof s != "object" || s === null || Array.isArray(s)) return;
|
|
641
648
|
const e = {};
|
|
642
649
|
for (const [t, r] of Object.entries(s))
|
|
643
650
|
typeof r == "string" && (e[t] = r);
|
|
644
651
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
645
|
-
},
|
|
652
|
+
}, fr = (s) => typeof s != "string" ? {
|
|
646
653
|
valid: !1,
|
|
647
654
|
error: "Event name must be a string"
|
|
648
655
|
} : s.length === 0 ? {
|
|
@@ -657,9 +664,9 @@ const tr = () => {
|
|
|
657
664
|
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(s.toLowerCase()) ? {
|
|
658
665
|
valid: !1,
|
|
659
666
|
error: "Event name cannot be a reserved word"
|
|
660
|
-
} : { valid: !0 },
|
|
661
|
-
const r =
|
|
662
|
-
if (!
|
|
667
|
+
} : { valid: !0 }, Je = (s, e, t) => {
|
|
668
|
+
const r = ar(e), n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
669
|
+
if (!hr(r))
|
|
663
670
|
return {
|
|
664
671
|
valid: !1,
|
|
665
672
|
error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
|
|
@@ -707,7 +714,7 @@ const tr = () => {
|
|
|
707
714
|
valid: !0,
|
|
708
715
|
sanitizedMetadata: r
|
|
709
716
|
};
|
|
710
|
-
},
|
|
717
|
+
}, ft = (s, e, t) => {
|
|
711
718
|
if (Array.isArray(e)) {
|
|
712
719
|
const r = [], n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
713
720
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -717,7 +724,7 @@ const tr = () => {
|
|
|
717
724
|
valid: !1,
|
|
718
725
|
error: `${n}: array item at index ${i} must be an object.`
|
|
719
726
|
};
|
|
720
|
-
const l =
|
|
727
|
+
const l = Je(s, o, t);
|
|
721
728
|
if (!l.valid)
|
|
722
729
|
return {
|
|
723
730
|
valid: !1,
|
|
@@ -730,16 +737,16 @@ const tr = () => {
|
|
|
730
737
|
sanitizedMetadata: r
|
|
731
738
|
};
|
|
732
739
|
}
|
|
733
|
-
return
|
|
734
|
-
},
|
|
735
|
-
const t =
|
|
740
|
+
return Je(s, e, t);
|
|
741
|
+
}, mr = (s, e) => {
|
|
742
|
+
const t = fr(s);
|
|
736
743
|
if (!t.valid)
|
|
737
744
|
return a("error", "Event name validation failed", {
|
|
738
745
|
data: { eventName: s, error: t.error }
|
|
739
746
|
}), t;
|
|
740
747
|
if (!e)
|
|
741
748
|
return { valid: !0 };
|
|
742
|
-
const r =
|
|
749
|
+
const r = ft(s, e, "customEvent");
|
|
743
750
|
return r.valid || a("error", "Event metadata validation failed", {
|
|
744
751
|
data: {
|
|
745
752
|
eventName: s,
|
|
@@ -747,7 +754,7 @@ const tr = () => {
|
|
|
747
754
|
}
|
|
748
755
|
}), r;
|
|
749
756
|
};
|
|
750
|
-
class
|
|
757
|
+
class gr {
|
|
751
758
|
listeners = /* @__PURE__ */ new Map();
|
|
752
759
|
/**
|
|
753
760
|
* Subscribes to an event channel
|
|
@@ -864,7 +871,7 @@ class hr {
|
|
|
864
871
|
this.listeners.clear();
|
|
865
872
|
}
|
|
866
873
|
}
|
|
867
|
-
function
|
|
874
|
+
function mt(s, e, t) {
|
|
868
875
|
try {
|
|
869
876
|
const r = e(s);
|
|
870
877
|
return r === null ? null : typeof r == "object" && r !== null && "type" in r ? r : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), s);
|
|
@@ -875,10 +882,10 @@ function dt(s, e, t) {
|
|
|
875
882
|
}), s;
|
|
876
883
|
}
|
|
877
884
|
}
|
|
878
|
-
function
|
|
879
|
-
return s.map((r) =>
|
|
885
|
+
function Er(s, e, t) {
|
|
886
|
+
return s.map((r) => mt(r, e, t)).filter((r) => r !== null);
|
|
880
887
|
}
|
|
881
|
-
function
|
|
888
|
+
function gt(s, e, t) {
|
|
882
889
|
try {
|
|
883
890
|
const r = e(s);
|
|
884
891
|
return r === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
|
|
@@ -894,7 +901,7 @@ function ht(s, e, t) {
|
|
|
894
901
|
}), s;
|
|
895
902
|
}
|
|
896
903
|
}
|
|
897
|
-
const
|
|
904
|
+
const ge = { config: {} };
|
|
898
905
|
class w {
|
|
899
906
|
/**
|
|
900
907
|
* Retrieves a value from global state.
|
|
@@ -913,7 +920,7 @@ class w {
|
|
|
913
920
|
* ```
|
|
914
921
|
*/
|
|
915
922
|
get(e) {
|
|
916
|
-
return
|
|
923
|
+
return ge[e];
|
|
917
924
|
}
|
|
918
925
|
/**
|
|
919
926
|
* Sets a value in global state.
|
|
@@ -933,7 +940,7 @@ class w {
|
|
|
933
940
|
* ```
|
|
934
941
|
*/
|
|
935
942
|
set(e, t) {
|
|
936
|
-
|
|
943
|
+
ge[e] = t;
|
|
937
944
|
}
|
|
938
945
|
/**
|
|
939
946
|
* Returns an immutable snapshot of the entire global state.
|
|
@@ -950,10 +957,10 @@ class w {
|
|
|
950
957
|
* ```
|
|
951
958
|
*/
|
|
952
959
|
getState() {
|
|
953
|
-
return { ...
|
|
960
|
+
return { ...ge };
|
|
954
961
|
}
|
|
955
962
|
}
|
|
956
|
-
class
|
|
963
|
+
class Ze extends w {
|
|
957
964
|
storeManager;
|
|
958
965
|
integrationId;
|
|
959
966
|
apiUrl;
|
|
@@ -1038,7 +1045,7 @@ class Ye extends w {
|
|
|
1038
1045
|
return { ...this.staticHeaders, ...e };
|
|
1039
1046
|
}
|
|
1040
1047
|
getQueueStorageKey() {
|
|
1041
|
-
const e = this.get("userId") || "anonymous", t =
|
|
1048
|
+
const e = this.get("userId") || "anonymous", t = Ct(e);
|
|
1042
1049
|
return this.integrationId ? `${t}:${this.integrationId}` : t;
|
|
1043
1050
|
}
|
|
1044
1051
|
/**
|
|
@@ -1268,7 +1275,7 @@ class Ye extends w {
|
|
|
1268
1275
|
const t = this.transformers.beforeSend;
|
|
1269
1276
|
if (!t)
|
|
1270
1277
|
return e;
|
|
1271
|
-
const r =
|
|
1278
|
+
const r = Er(
|
|
1272
1279
|
e.events,
|
|
1273
1280
|
t,
|
|
1274
1281
|
this.integrationId || "SenderManager"
|
|
@@ -1313,7 +1320,7 @@ class Ye extends w {
|
|
|
1313
1320
|
if (this.integrationId === "saas")
|
|
1314
1321
|
return e;
|
|
1315
1322
|
const t = this.transformers.beforeBatch;
|
|
1316
|
-
return t ?
|
|
1323
|
+
return t ? gt(e, t, this.integrationId || "SenderManager") : e;
|
|
1317
1324
|
}
|
|
1318
1325
|
/**
|
|
1319
1326
|
* Calculates exponential backoff delay with jitter for retry attempts.
|
|
@@ -1415,6 +1422,12 @@ class Ye extends w {
|
|
|
1415
1422
|
const g = c === 3;
|
|
1416
1423
|
if (u instanceof N)
|
|
1417
1424
|
throw this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, u;
|
|
1425
|
+
if (u instanceof se) {
|
|
1426
|
+
this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, o = !1, l = !0, a("warn", `Rate limited, skipping retries${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1427
|
+
data: { events: e.events.length, attempt: c }
|
|
1428
|
+
});
|
|
1429
|
+
break;
|
|
1430
|
+
}
|
|
1418
1431
|
if (u instanceof O || (o = !1), u instanceof TypeError || (l = !0), a(
|
|
1419
1432
|
g ? "error" : "warn",
|
|
1420
1433
|
`Send attempt ${c} failed${this.integrationId ? ` [${this.integrationId}]` : ""}${g ? " (all retries exhausted)" : ", will retry"}`,
|
|
@@ -1483,7 +1496,7 @@ class Ye extends w {
|
|
|
1483
1496
|
}
|
|
1484
1497
|
});
|
|
1485
1498
|
if (!l.ok)
|
|
1486
|
-
throw l.status >= 400 && l.status < 500 && l.status !== 408 && l.status !== 429 ? new N(`HTTP ${l.status}: ${l.statusText}`, l.status) : new Error(`HTTP ${l.status}: ${l.statusText}`);
|
|
1499
|
+
throw l.status >= 400 && l.status < 500 && l.status !== 408 && l.status !== 429 ? new N(`HTTP ${l.status}: ${l.statusText}`, l.status) : l.status === 429 ? new se(`HTTP 429: ${l.statusText}`) : new Error(`HTTP ${l.status}: ${l.statusText}`);
|
|
1487
1500
|
return l;
|
|
1488
1501
|
} catch (o) {
|
|
1489
1502
|
throw o instanceof N ? o : n ? new O("Request timed out (server likely received the request)") : o;
|
|
@@ -1569,7 +1582,7 @@ class Ye extends w {
|
|
|
1569
1582
|
_metadata: {
|
|
1570
1583
|
referer: typeof window < "u" ? window.location.href : void 0,
|
|
1571
1584
|
timestamp: t,
|
|
1572
|
-
client_version:
|
|
1585
|
+
client_version: Jt
|
|
1573
1586
|
}
|
|
1574
1587
|
};
|
|
1575
1588
|
return {
|
|
@@ -1708,12 +1721,12 @@ class Ye extends w {
|
|
|
1708
1721
|
}
|
|
1709
1722
|
logPermanentError(e, t) {
|
|
1710
1723
|
const r = Date.now();
|
|
1711
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >=
|
|
1724
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >= zt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1712
1725
|
data: { status: t.statusCode, message: t.message }
|
|
1713
1726
|
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: r });
|
|
1714
1727
|
}
|
|
1715
1728
|
}
|
|
1716
|
-
class
|
|
1729
|
+
class Sr extends w {
|
|
1717
1730
|
bootTime;
|
|
1718
1731
|
bootTimestamp;
|
|
1719
1732
|
hasPerformanceNow;
|
|
@@ -1862,8 +1875,8 @@ class mr extends w {
|
|
|
1862
1875
|
};
|
|
1863
1876
|
}
|
|
1864
1877
|
}
|
|
1865
|
-
const
|
|
1866
|
-
class
|
|
1878
|
+
const pr = new Set(Object.values(d));
|
|
1879
|
+
class Tr extends w {
|
|
1867
1880
|
dataSenders;
|
|
1868
1881
|
emitter;
|
|
1869
1882
|
transformers;
|
|
@@ -1902,10 +1915,10 @@ class Er extends w {
|
|
|
1902
1915
|
* @param fetchCredentials - Fetch credentials mode for custom backend. @default 'include'
|
|
1903
1916
|
*/
|
|
1904
1917
|
constructor(e, t = null, r = {}, n = {}, i, o = "include") {
|
|
1905
|
-
super(), this.emitter = t, this.transformers = r, this.timeManager = new
|
|
1918
|
+
super(), this.emitter = t, this.transformers = r, this.timeManager = new Sr(), this.dataSenders = [];
|
|
1906
1919
|
const l = this.get("collectApiUrls");
|
|
1907
|
-
l?.saas && this.dataSenders.push(new
|
|
1908
|
-
new
|
|
1920
|
+
l?.saas && this.dataSenders.push(new Ze(e, "saas", l.saas, r)), l?.custom && this.dataSenders.push(
|
|
1921
|
+
new Ze(
|
|
1909
1922
|
e,
|
|
1910
1923
|
"custom",
|
|
1911
1924
|
l.custom,
|
|
@@ -2033,7 +2046,7 @@ class Er extends w {
|
|
|
2033
2046
|
a("error", "Event type is required - event will be ignored");
|
|
2034
2047
|
return;
|
|
2035
2048
|
}
|
|
2036
|
-
if (!
|
|
2049
|
+
if (!pr.has(e)) {
|
|
2037
2050
|
a("error", "Invalid event type - event will be ignored", {
|
|
2038
2051
|
data: { type: e }
|
|
2039
2052
|
});
|
|
@@ -2077,12 +2090,12 @@ class Er extends w {
|
|
|
2077
2090
|
}
|
|
2078
2091
|
const v = this.getTypeLimitForEvent(S);
|
|
2079
2092
|
if (v) {
|
|
2080
|
-
const
|
|
2081
|
-
if (
|
|
2093
|
+
const de = this.sessionEventCounts[S];
|
|
2094
|
+
if (de !== void 0 && de >= v) {
|
|
2082
2095
|
a("warn", "Session event type limit reached", {
|
|
2083
2096
|
data: {
|
|
2084
2097
|
type: S,
|
|
2085
|
-
count:
|
|
2098
|
+
count: de,
|
|
2086
2099
|
limit: v
|
|
2087
2100
|
}
|
|
2088
2101
|
});
|
|
@@ -2095,7 +2108,7 @@ class Er extends w {
|
|
|
2095
2108
|
if (!this.checkPerEventRateLimit(o.name, v))
|
|
2096
2109
|
return;
|
|
2097
2110
|
}
|
|
2098
|
-
const
|
|
2111
|
+
const Ve = S === d.SESSION_START, Y = t || this.get("pageUrl"), $ = this.buildEventPayload({
|
|
2099
2112
|
type: S,
|
|
2100
2113
|
page_url: Y,
|
|
2101
2114
|
from_page_url: r,
|
|
@@ -2108,7 +2121,7 @@ class Er extends w {
|
|
|
2108
2121
|
page_view: g
|
|
2109
2122
|
});
|
|
2110
2123
|
if ($ && !(!T && !this.shouldSample())) {
|
|
2111
|
-
if (
|
|
2124
|
+
if (Ve) {
|
|
2112
2125
|
const v = this.get("sessionId");
|
|
2113
2126
|
if (!v) {
|
|
2114
2127
|
a("error", "Session start event requires sessionId - event will be ignored");
|
|
@@ -2123,7 +2136,7 @@ class Er extends w {
|
|
|
2123
2136
|
this.set("hasStartSession", !0);
|
|
2124
2137
|
}
|
|
2125
2138
|
if (!this.isDuplicateEvent($)) {
|
|
2126
|
-
if (this.get("mode") ===
|
|
2139
|
+
if (this.get("mode") === ne.QA) {
|
|
2127
2140
|
if (S === d.CUSTOM && o) {
|
|
2128
2141
|
a("info", `Custom Event: ${o.name}`, {
|
|
2129
2142
|
visibility: "qa",
|
|
@@ -2491,7 +2504,7 @@ class Er extends w {
|
|
|
2491
2504
|
};
|
|
2492
2505
|
const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
|
|
2493
2506
|
if (!o && l) {
|
|
2494
|
-
const c =
|
|
2507
|
+
const c = gt(n, l, "EventManager");
|
|
2495
2508
|
c !== null && (n = c);
|
|
2496
2509
|
}
|
|
2497
2510
|
return n;
|
|
@@ -2503,7 +2516,7 @@ class Er extends w {
|
|
|
2503
2516
|
});
|
|
2504
2517
|
const i = this.get("sessionReferrer"), o = this.get("sessionUtm");
|
|
2505
2518
|
let l = {
|
|
2506
|
-
id:
|
|
2519
|
+
id: nr(),
|
|
2507
2520
|
type: e.type,
|
|
2508
2521
|
page_url: t,
|
|
2509
2522
|
timestamp: r,
|
|
@@ -2520,7 +2533,7 @@ class Er extends w {
|
|
|
2520
2533
|
};
|
|
2521
2534
|
const c = this.get("collectApiUrls"), u = !!c?.custom, g = !!c?.saas, E = u || g, T = u && g, S = this.transformers.beforeSend;
|
|
2522
2535
|
if (S && (!E || u && !T)) {
|
|
2523
|
-
const Y =
|
|
2536
|
+
const Y = mt(l, S, "EventManager");
|
|
2524
2537
|
if (Y === null)
|
|
2525
2538
|
return null;
|
|
2526
2539
|
l = Y;
|
|
@@ -2618,10 +2631,10 @@ class Er extends w {
|
|
|
2618
2631
|
this.eventsQueue = this.eventsQueue.filter((r) => !t.has(r.id));
|
|
2619
2632
|
}
|
|
2620
2633
|
emitEvent(e) {
|
|
2621
|
-
this.emitter && this.emitter.emit(
|
|
2634
|
+
this.emitter && this.emitter.emit(Te.EVENT, e);
|
|
2622
2635
|
}
|
|
2623
2636
|
emitEventsQueue(e) {
|
|
2624
|
-
this.emitter && this.emitter.emit(
|
|
2637
|
+
this.emitter && this.emitter.emit(Te.QUEUE, e);
|
|
2625
2638
|
}
|
|
2626
2639
|
/**
|
|
2627
2640
|
* Creates a debounced version of a function that delays execution until after
|
|
@@ -2697,13 +2710,13 @@ class Er extends w {
|
|
|
2697
2710
|
loadSessionCounts(e) {
|
|
2698
2711
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
2699
2712
|
return this.getInitialCounts();
|
|
2700
|
-
const t = this.get("userId") || "anonymous", r =
|
|
2713
|
+
const t = this.get("userId") || "anonymous", r = Fe(t, e);
|
|
2701
2714
|
try {
|
|
2702
2715
|
const n = localStorage.getItem(r);
|
|
2703
2716
|
if (!n)
|
|
2704
2717
|
return this.getInitialCounts();
|
|
2705
2718
|
const i = JSON.parse(n);
|
|
2706
|
-
return i._timestamp && Date.now() - i._timestamp >
|
|
2719
|
+
return i._timestamp && Date.now() - i._timestamp > xe ? (a("debug", "Session counts expired, clearing", {
|
|
2707
2720
|
data: { sessionId: e, age: Date.now() - i._timestamp }
|
|
2708
2721
|
}), localStorage.removeItem(r), this.getInitialCounts()) : typeof i.total == "number" && typeof i[d.CLICK] == "number" && typeof i[d.PAGE_VIEW] == "number" && typeof i[d.CUSTOM] == "number" && typeof i[d.VIEWPORT_VISIBLE] == "number" && typeof i[d.SCROLL] == "number" ? {
|
|
2709
2722
|
total: i.total,
|
|
@@ -2748,12 +2761,12 @@ class Er extends w {
|
|
|
2748
2761
|
cleanupExpiredSessionCounts() {
|
|
2749
2762
|
if (!(typeof window > "u" || typeof localStorage > "u"))
|
|
2750
2763
|
try {
|
|
2751
|
-
const e = localStorage.getItem(
|
|
2764
|
+
const e = localStorage.getItem($e);
|
|
2752
2765
|
if (e) {
|
|
2753
2766
|
const i = Date.now() - parseInt(e, 10);
|
|
2754
|
-
if (i <
|
|
2767
|
+
if (i < Be) {
|
|
2755
2768
|
a("debug", "Skipping session counts cleanup (throttled)", {
|
|
2756
|
-
data: { timeSinceLastCleanup: i, throttleMs:
|
|
2769
|
+
data: { timeSinceLastCleanup: i, throttleMs: Be }
|
|
2757
2770
|
});
|
|
2758
2771
|
return;
|
|
2759
2772
|
}
|
|
@@ -2766,14 +2779,14 @@ class Er extends w {
|
|
|
2766
2779
|
const l = localStorage.getItem(o);
|
|
2767
2780
|
if (l) {
|
|
2768
2781
|
const c = JSON.parse(l);
|
|
2769
|
-
c._timestamp && Date.now() - c._timestamp >
|
|
2782
|
+
c._timestamp && Date.now() - c._timestamp > xe && n.push(o);
|
|
2770
2783
|
}
|
|
2771
2784
|
} catch {
|
|
2772
2785
|
}
|
|
2773
2786
|
}
|
|
2774
2787
|
n.forEach((i) => {
|
|
2775
2788
|
localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
|
|
2776
|
-
}), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem(
|
|
2789
|
+
}), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem($e, Date.now().toString());
|
|
2777
2790
|
} catch (e) {
|
|
2778
2791
|
a("warn", "Failed to cleanup expired session counts", { error: e });
|
|
2779
2792
|
}
|
|
@@ -2807,7 +2820,7 @@ class Er extends w {
|
|
|
2807
2820
|
* @internal
|
|
2808
2821
|
*/
|
|
2809
2822
|
saveSessionCounts(e) {
|
|
2810
|
-
const t = this.get("userId") || "anonymous", r =
|
|
2823
|
+
const t = this.get("userId") || "anonymous", r = Fe(t, e);
|
|
2811
2824
|
try {
|
|
2812
2825
|
const n = {
|
|
2813
2826
|
...this.sessionEventCounts,
|
|
@@ -2823,7 +2836,7 @@ class Er extends w {
|
|
|
2823
2836
|
}
|
|
2824
2837
|
}
|
|
2825
2838
|
}
|
|
2826
|
-
class
|
|
2839
|
+
class Ir {
|
|
2827
2840
|
/**
|
|
2828
2841
|
* Gets or creates a unique user ID.
|
|
2829
2842
|
*
|
|
@@ -2841,15 +2854,15 @@ class Sr {
|
|
|
2841
2854
|
* @returns Persistent unique user ID (UUID v4 format)
|
|
2842
2855
|
*/
|
|
2843
2856
|
static getId(e) {
|
|
2844
|
-
const t = e.getItem(
|
|
2857
|
+
const t = e.getItem(pe);
|
|
2845
2858
|
if (t)
|
|
2846
2859
|
return t;
|
|
2847
|
-
const r =
|
|
2848
|
-
return e.setItem(
|
|
2860
|
+
const r = ut();
|
|
2861
|
+
return e.setItem(pe, r), r;
|
|
2849
2862
|
}
|
|
2850
2863
|
}
|
|
2851
|
-
const
|
|
2852
|
-
class
|
|
2864
|
+
const vr = /^\d{13}-[a-z0-9]{9}$/;
|
|
2865
|
+
class _r extends w {
|
|
2853
2866
|
storageManager;
|
|
2854
2867
|
eventManager;
|
|
2855
2868
|
projectId;
|
|
@@ -2875,7 +2888,7 @@ class Tr extends w {
|
|
|
2875
2888
|
return;
|
|
2876
2889
|
}
|
|
2877
2890
|
const e = this.getProjectId();
|
|
2878
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
2891
|
+
this.broadcastChannel = new BroadcastChannel(Nt(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2879
2892
|
const { action: r, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
|
|
2880
2893
|
o === e && (r === "session_start" && n && typeof i == "number" && i > Date.now() - 5e3 ? (this.set("sessionId", n), this.persistSession(n, i), this.isTracking && this.setupSessionTimeout()) : r && r !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: r } }));
|
|
2881
2894
|
};
|
|
@@ -2895,7 +2908,7 @@ class Tr extends w {
|
|
|
2895
2908
|
const e = this.loadStoredSession();
|
|
2896
2909
|
if (!e)
|
|
2897
2910
|
return null;
|
|
2898
|
-
if (!
|
|
2911
|
+
if (!vr.test(e.id))
|
|
2899
2912
|
return a("warn", "Invalid session ID format recovered from storage, clearing", {
|
|
2900
2913
|
data: { sessionId: e.id }
|
|
2901
2914
|
}), this.clearStoredSession(), null;
|
|
@@ -2940,7 +2953,7 @@ class Tr extends w {
|
|
|
2940
2953
|
this.storageManager.setItem(t, r), this.storageManager.setSessionItem(t, r);
|
|
2941
2954
|
}
|
|
2942
2955
|
getSessionStorageKey() {
|
|
2943
|
-
return
|
|
2956
|
+
return Rt(this.getProjectId());
|
|
2944
2957
|
}
|
|
2945
2958
|
getProjectId() {
|
|
2946
2959
|
return this.projectId;
|
|
@@ -3006,9 +3019,9 @@ class Tr extends w {
|
|
|
3006
3019
|
let r, n;
|
|
3007
3020
|
if (e) {
|
|
3008
3021
|
const i = this.loadStoredSession();
|
|
3009
|
-
r = i?.referrer ??
|
|
3022
|
+
r = i?.referrer ?? fe(), n = i?.utm ?? me();
|
|
3010
3023
|
} else
|
|
3011
|
-
r =
|
|
3024
|
+
r = fe(), n = me();
|
|
3012
3025
|
a("debug", "Session tracking initialized", {
|
|
3013
3026
|
data: {
|
|
3014
3027
|
sessionId: t,
|
|
@@ -3059,7 +3072,7 @@ class Tr extends w {
|
|
|
3059
3072
|
*/
|
|
3060
3073
|
renewSession() {
|
|
3061
3074
|
this.needsRenewal = !1;
|
|
3062
|
-
const e = this.generateSessionId(), t =
|
|
3075
|
+
const e = this.generateSessionId(), t = fe(), r = me();
|
|
3063
3076
|
a("debug", "Renewing session after timeout", {
|
|
3064
3077
|
data: { newSessionId: e }
|
|
3065
3078
|
}), this.set("sessionId", e), this.set("sessionReferrer", t), this.set("sessionUtm", r), this.persistSession(e, Date.now(), t, r), this.cleanupCrossTabSync(), this.initCrossTabSync(), this.shareSession(e), this.eventManager.track({
|
|
@@ -3180,7 +3193,7 @@ class Tr extends w {
|
|
|
3180
3193
|
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
|
|
3181
3194
|
}
|
|
3182
3195
|
}
|
|
3183
|
-
class
|
|
3196
|
+
class yr extends w {
|
|
3184
3197
|
eventManager;
|
|
3185
3198
|
storageManager;
|
|
3186
3199
|
sessionManager = null;
|
|
@@ -3215,7 +3228,7 @@ class Ir extends w {
|
|
|
3215
3228
|
}
|
|
3216
3229
|
const t = this.get("config")?.integrations?.tracelog?.projectId ?? "custom";
|
|
3217
3230
|
try {
|
|
3218
|
-
this.sessionManager = new
|
|
3231
|
+
this.sessionManager = new _r(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
|
|
3219
3232
|
} catch (r) {
|
|
3220
3233
|
if (this.sessionManager) {
|
|
3221
3234
|
try {
|
|
@@ -3268,7 +3281,7 @@ class Ir extends w {
|
|
|
3268
3281
|
this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
|
|
3269
3282
|
}
|
|
3270
3283
|
}
|
|
3271
|
-
class
|
|
3284
|
+
class wr extends w {
|
|
3272
3285
|
eventManager;
|
|
3273
3286
|
onTrack;
|
|
3274
3287
|
originalPushState;
|
|
@@ -3308,7 +3321,7 @@ class vr extends w {
|
|
|
3308
3321
|
};
|
|
3309
3322
|
}
|
|
3310
3323
|
trackCurrentPage = () => {
|
|
3311
|
-
const e = window.location.href, t =
|
|
3324
|
+
const e = window.location.href, t = ye(e, this.get("config").sensitiveQueryParams);
|
|
3312
3325
|
if (this.get("pageUrl") === t)
|
|
3313
3326
|
return;
|
|
3314
3327
|
const r = Date.now(), n = this.get("config").pageViewThrottleMs ?? 1e3;
|
|
@@ -3326,7 +3339,7 @@ class vr extends w {
|
|
|
3326
3339
|
});
|
|
3327
3340
|
};
|
|
3328
3341
|
trackInitialPageView() {
|
|
3329
|
-
const e =
|
|
3342
|
+
const e = ye(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
|
|
3330
3343
|
this.lastPageViewTime = Date.now(), this.eventManager.track({
|
|
3331
3344
|
type: d.PAGE_VIEW,
|
|
3332
3345
|
page_url: e,
|
|
@@ -3344,7 +3357,7 @@ class vr extends w {
|
|
|
3344
3357
|
};
|
|
3345
3358
|
}
|
|
3346
3359
|
}
|
|
3347
|
-
class
|
|
3360
|
+
class br extends w {
|
|
3348
3361
|
eventManager;
|
|
3349
3362
|
lastClickTimes = /* @__PURE__ */ new Map();
|
|
3350
3363
|
clickHandler;
|
|
@@ -3482,7 +3495,7 @@ class _r extends w {
|
|
|
3482
3495
|
return e.hasAttribute(`${b}-name`) ? e : e.closest(`[${b}-name]`);
|
|
3483
3496
|
}
|
|
3484
3497
|
getRelevantClickElement(e) {
|
|
3485
|
-
for (const t of
|
|
3498
|
+
for (const t of bt)
|
|
3486
3499
|
try {
|
|
3487
3500
|
if (e.matches(t))
|
|
3488
3501
|
return e;
|
|
@@ -3562,7 +3575,7 @@ class _r extends w {
|
|
|
3562
3575
|
*/
|
|
3563
3576
|
sanitizeText(e) {
|
|
3564
3577
|
let t = e;
|
|
3565
|
-
for (const r of
|
|
3578
|
+
for (const r of at) {
|
|
3566
3579
|
const n = new RegExp(r.source, r.flags);
|
|
3567
3580
|
t = t.replace(n, "[REDACTED]");
|
|
3568
3581
|
}
|
|
@@ -3601,7 +3614,7 @@ class _r extends w {
|
|
|
3601
3614
|
};
|
|
3602
3615
|
}
|
|
3603
3616
|
}
|
|
3604
|
-
class
|
|
3617
|
+
class Ar extends w {
|
|
3605
3618
|
eventManager;
|
|
3606
3619
|
containers = [];
|
|
3607
3620
|
limitWarningLogged = !1;
|
|
@@ -3829,7 +3842,7 @@ class yr extends w {
|
|
|
3829
3842
|
e.isPrimary = t;
|
|
3830
3843
|
}
|
|
3831
3844
|
}
|
|
3832
|
-
class
|
|
3845
|
+
class Lr extends w {
|
|
3833
3846
|
eventManager;
|
|
3834
3847
|
trackedElements = /* @__PURE__ */ new Map();
|
|
3835
3848
|
observer = null;
|
|
@@ -3990,7 +4003,7 @@ class wr extends w {
|
|
|
3990
4003
|
});
|
|
3991
4004
|
}
|
|
3992
4005
|
}
|
|
3993
|
-
class
|
|
4006
|
+
class Mr {
|
|
3994
4007
|
storage;
|
|
3995
4008
|
sessionStorageRef;
|
|
3996
4009
|
fallbackStorage = /* @__PURE__ */ new Map();
|
|
@@ -4273,7 +4286,7 @@ class br {
|
|
|
4273
4286
|
this.fallbackSessionStorage.delete(e);
|
|
4274
4287
|
}
|
|
4275
4288
|
}
|
|
4276
|
-
class
|
|
4289
|
+
class Cr extends w {
|
|
4277
4290
|
eventManager;
|
|
4278
4291
|
reportedByNav = /* @__PURE__ */ new Map();
|
|
4279
4292
|
navigationHistory = [];
|
|
@@ -4284,7 +4297,7 @@ class Ar extends w {
|
|
|
4284
4297
|
navigationCounter = 0;
|
|
4285
4298
|
// Counter for handling simultaneous navigations edge case
|
|
4286
4299
|
constructor(e) {
|
|
4287
|
-
super(), this.eventManager = e, this.vitalThresholds =
|
|
4300
|
+
super(), this.eventManager = e, this.vitalThresholds = Ke(_e);
|
|
4288
4301
|
}
|
|
4289
4302
|
/**
|
|
4290
4303
|
* Starts tracking Web Vitals and performance metrics.
|
|
@@ -4301,8 +4314,8 @@ class Ar extends w {
|
|
|
4301
4314
|
* @returns Promise that resolves when tracking is initialized
|
|
4302
4315
|
*/
|
|
4303
4316
|
async startTracking() {
|
|
4304
|
-
const e = this.get("config"), t = e?.webVitalsMode ??
|
|
4305
|
-
this.vitalThresholds =
|
|
4317
|
+
const e = this.get("config"), t = e?.webVitalsMode ?? _e;
|
|
4318
|
+
this.vitalThresholds = Ke(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
|
|
4306
4319
|
}
|
|
4307
4320
|
/**
|
|
4308
4321
|
* Stops tracking Web Vitals and cleans up resources.
|
|
@@ -4372,7 +4385,7 @@ class Ar extends w {
|
|
|
4372
4385
|
}
|
|
4373
4386
|
async initWebVitals() {
|
|
4374
4387
|
try {
|
|
4375
|
-
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() =>
|
|
4388
|
+
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => as), o = (l) => (c) => {
|
|
4376
4389
|
const u = Number(c.value.toFixed(2));
|
|
4377
4390
|
this.sendVital({ type: l, value: u });
|
|
4378
4391
|
};
|
|
@@ -4399,7 +4412,7 @@ class Ar extends w {
|
|
|
4399
4412
|
const t = e.getEntries();
|
|
4400
4413
|
for (const r of t) {
|
|
4401
4414
|
const n = Number(r.duration.toFixed(2)), i = Date.now();
|
|
4402
|
-
i - this.lastLongTaskSentAt >=
|
|
4415
|
+
i - this.lastLongTaskSentAt >= Kt && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
4403
4416
|
}
|
|
4404
4417
|
},
|
|
4405
4418
|
{ type: "longtask", buffered: !0 }
|
|
@@ -4415,7 +4428,7 @@ class Ar extends w {
|
|
|
4415
4428
|
return;
|
|
4416
4429
|
if (r)
|
|
4417
4430
|
r.add(e.type);
|
|
4418
|
-
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length >
|
|
4431
|
+
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Yt) {
|
|
4419
4432
|
const i = this.navigationHistory.shift();
|
|
4420
4433
|
i && this.reportedByNav.delete(i);
|
|
4421
4434
|
}
|
|
@@ -4506,7 +4519,7 @@ class Ar extends w {
|
|
|
4506
4519
|
return !(typeof r == "number" && t <= r);
|
|
4507
4520
|
}
|
|
4508
4521
|
}
|
|
4509
|
-
class
|
|
4522
|
+
class oe extends w {
|
|
4510
4523
|
eventManager;
|
|
4511
4524
|
recentErrors = /* @__PURE__ */ new Map();
|
|
4512
4525
|
errorBurstCounter = 0;
|
|
@@ -4542,28 +4555,32 @@ class Lr extends w {
|
|
|
4542
4555
|
const e = Date.now();
|
|
4543
4556
|
if (e < this.burstBackoffUntil)
|
|
4544
4557
|
return !1;
|
|
4545
|
-
if (e - this.burstWindowStart >
|
|
4546
|
-
return this.burstBackoffUntil = e +
|
|
4558
|
+
if (e - this.burstWindowStart > Gt && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > jt)
|
|
4559
|
+
return this.burstBackoffUntil = e + ze, a("debug", "Error burst detected - entering cooldown", {
|
|
4547
4560
|
data: {
|
|
4548
4561
|
errorsInWindow: this.errorBurstCounter,
|
|
4549
|
-
cooldownMs:
|
|
4562
|
+
cooldownMs: ze
|
|
4550
4563
|
}
|
|
4551
4564
|
}), !1;
|
|
4552
|
-
const r = this.get("config")
|
|
4565
|
+
const r = this.get("config").errorSampling ?? lt;
|
|
4553
4566
|
return Math.random() < r;
|
|
4554
4567
|
}
|
|
4555
4568
|
handleError = (e) => {
|
|
4556
4569
|
if (!this.shouldSample())
|
|
4557
4570
|
return;
|
|
4558
4571
|
const t = this.sanitize(e.message || "Unknown error");
|
|
4559
|
-
this.shouldSuppressError(W.JS_ERROR, t)
|
|
4572
|
+
if (this.shouldSuppressError(W.JS_ERROR, t))
|
|
4573
|
+
return;
|
|
4574
|
+
const r = typeof e.error?.stack == "string" ? this.truncateStack(e.error.stack) : void 0;
|
|
4575
|
+
this.eventManager.track({
|
|
4560
4576
|
type: d.ERROR,
|
|
4561
4577
|
error_data: {
|
|
4562
4578
|
type: W.JS_ERROR,
|
|
4563
4579
|
message: t,
|
|
4564
|
-
...e.filename && { filename: e.filename },
|
|
4565
|
-
...e.lineno && { line: e.lineno },
|
|
4566
|
-
...e.colno && { column: e.colno }
|
|
4580
|
+
...e.filename !== "" && { filename: e.filename },
|
|
4581
|
+
...e.lineno !== 0 && { line: e.lineno },
|
|
4582
|
+
...e.colno !== 0 && { column: e.colno },
|
|
4583
|
+
...r !== void 0 && { stack: r }
|
|
4567
4584
|
}
|
|
4568
4585
|
});
|
|
4569
4586
|
};
|
|
@@ -4571,30 +4588,38 @@ class Lr extends w {
|
|
|
4571
4588
|
if (!this.shouldSample())
|
|
4572
4589
|
return;
|
|
4573
4590
|
const t = this.extractRejectionMessage(e.reason), r = this.sanitize(t);
|
|
4574
|
-
this.shouldSuppressError(W.PROMISE_REJECTION, r)
|
|
4591
|
+
if (this.shouldSuppressError(W.PROMISE_REJECTION, r))
|
|
4592
|
+
return;
|
|
4593
|
+
const n = e.reason instanceof Error && typeof e.reason.stack == "string" ? this.truncateStack(e.reason.stack) : void 0;
|
|
4594
|
+
this.eventManager.track({
|
|
4575
4595
|
type: d.ERROR,
|
|
4576
4596
|
error_data: {
|
|
4577
4597
|
type: W.PROMISE_REJECTION,
|
|
4578
|
-
message: r
|
|
4598
|
+
message: r,
|
|
4599
|
+
...n !== void 0 && { stack: n }
|
|
4579
4600
|
}
|
|
4580
4601
|
});
|
|
4581
4602
|
};
|
|
4582
4603
|
extractRejectionMessage(e) {
|
|
4583
|
-
if (
|
|
4604
|
+
if (e == null) return "Unknown rejection";
|
|
4584
4605
|
if (typeof e == "string") return e;
|
|
4585
4606
|
if (e instanceof Error)
|
|
4586
|
-
return e.
|
|
4607
|
+
return e.message;
|
|
4587
4608
|
if (typeof e == "object" && "message" in e)
|
|
4588
4609
|
return String(e.message);
|
|
4589
4610
|
try {
|
|
4590
4611
|
return JSON.stringify(e);
|
|
4591
4612
|
} catch {
|
|
4592
|
-
return
|
|
4613
|
+
return "Unserializable rejection";
|
|
4593
4614
|
}
|
|
4594
4615
|
}
|
|
4595
4616
|
sanitize(e) {
|
|
4596
|
-
|
|
4597
|
-
|
|
4617
|
+
const t = e.length > Xe ? e.slice(0, Xe) + "..." : e;
|
|
4618
|
+
return this.sanitizePii(t);
|
|
4619
|
+
}
|
|
4620
|
+
sanitizePii(e) {
|
|
4621
|
+
let t = e;
|
|
4622
|
+
for (const r of at) {
|
|
4598
4623
|
const n = new RegExp(r.source, r.flags);
|
|
4599
4624
|
t = t.replace(n, "[REDACTED]");
|
|
4600
4625
|
}
|
|
@@ -4602,12 +4627,19 @@ class Lr extends w {
|
|
|
4602
4627
|
}
|
|
4603
4628
|
shouldSuppressError(e, t) {
|
|
4604
4629
|
const r = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
4605
|
-
return i && r - i <
|
|
4630
|
+
return i !== void 0 && r - i < je ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size > Xt ? (this.recentErrors.clear(), this.recentErrors.set(n, r), !1) : (this.recentErrors.size > te && this.pruneOldErrors(), !1));
|
|
4631
|
+
}
|
|
4632
|
+
static TRUNCATION_SUFFIX = `
|
|
4633
|
+
...truncated`;
|
|
4634
|
+
truncateStack(e) {
|
|
4635
|
+
if (e.length <= Ge) return this.sanitizePii(e);
|
|
4636
|
+
const t = Ge - oe.TRUNCATION_SUFFIX.length, r = e.slice(0, t) + oe.TRUNCATION_SUFFIX;
|
|
4637
|
+
return this.sanitizePii(r);
|
|
4606
4638
|
}
|
|
4607
4639
|
pruneOldErrors() {
|
|
4608
4640
|
const e = Date.now();
|
|
4609
4641
|
for (const [n, i] of this.recentErrors.entries())
|
|
4610
|
-
e - i >
|
|
4642
|
+
e - i > je && this.recentErrors.delete(n);
|
|
4611
4643
|
if (this.recentErrors.size <= te)
|
|
4612
4644
|
return;
|
|
4613
4645
|
const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), r = this.recentErrors.size - te;
|
|
@@ -4617,11 +4649,11 @@ class Lr extends w {
|
|
|
4617
4649
|
}
|
|
4618
4650
|
}
|
|
4619
4651
|
}
|
|
4620
|
-
class
|
|
4652
|
+
class Rr extends w {
|
|
4621
4653
|
isInitialized = !1;
|
|
4622
4654
|
suppressNextScrollTimer = null;
|
|
4623
4655
|
pageUnloadHandler = null;
|
|
4624
|
-
emitter = new
|
|
4656
|
+
emitter = new gr();
|
|
4625
4657
|
transformers = {};
|
|
4626
4658
|
customHeadersProvider;
|
|
4627
4659
|
managers = {};
|
|
@@ -4639,11 +4671,11 @@ class Mr extends w {
|
|
|
4639
4671
|
async init(e = {}) {
|
|
4640
4672
|
if (this.isInitialized)
|
|
4641
4673
|
return { sessionId: this.get("sessionId") ?? "" };
|
|
4642
|
-
this.managers.storage = new
|
|
4674
|
+
this.managers.storage = new Mr();
|
|
4643
4675
|
try {
|
|
4644
4676
|
this.setupState(e);
|
|
4645
4677
|
const t = e.integrations?.custom?.headers ?? {}, r = e.integrations?.custom?.fetchCredentials ?? "include";
|
|
4646
|
-
return this.managers.event = new
|
|
4678
|
+
return this.managers.event = new Tr(
|
|
4647
4679
|
this.managers.storage,
|
|
4648
4680
|
this.emitter,
|
|
4649
4681
|
this.transformers,
|
|
@@ -4673,9 +4705,9 @@ class Mr extends w {
|
|
|
4673
4705
|
}
|
|
4674
4706
|
let r = t;
|
|
4675
4707
|
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
4676
|
-
const { valid: n, error: i, sanitizedMetadata: o } =
|
|
4708
|
+
const { valid: n, error: i, sanitizedMetadata: o } = mr(e, r);
|
|
4677
4709
|
if (!n) {
|
|
4678
|
-
if (this.get("mode") ===
|
|
4710
|
+
if (this.get("mode") === ne.QA)
|
|
4679
4711
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
|
|
4680
4712
|
a("warn", `Custom event "${e}" dropped: ${i}`);
|
|
4681
4713
|
return;
|
|
@@ -4743,14 +4775,14 @@ class Mr extends w {
|
|
|
4743
4775
|
}
|
|
4744
4776
|
setupState(e = {}) {
|
|
4745
4777
|
this.set("config", e);
|
|
4746
|
-
const t =
|
|
4778
|
+
const t = Ir.getId(this.managers.storage);
|
|
4747
4779
|
this.set("userId", t);
|
|
4748
|
-
const r =
|
|
4780
|
+
const r = or(e);
|
|
4749
4781
|
this.set("collectApiUrls", r);
|
|
4750
|
-
const n =
|
|
4782
|
+
const n = Wt();
|
|
4751
4783
|
this.set("device", n);
|
|
4752
|
-
const i =
|
|
4753
|
-
this.set("pageUrl", i),
|
|
4784
|
+
const i = ye(window.location.href, e.sensitiveQueryParams);
|
|
4785
|
+
this.set("pageUrl", i), er() && this.set("mode", ne.QA);
|
|
4754
4786
|
}
|
|
4755
4787
|
/**
|
|
4756
4788
|
* Returns the current configuration object.
|
|
@@ -4801,7 +4833,7 @@ class Mr extends w {
|
|
|
4801
4833
|
valid: !1,
|
|
4802
4834
|
error: "Global metadata must be a plain object"
|
|
4803
4835
|
};
|
|
4804
|
-
const t =
|
|
4836
|
+
const t = ft("Global", e, "globalMetadata");
|
|
4805
4837
|
return t.valid ? { valid: !0 } : {
|
|
4806
4838
|
valid: !1,
|
|
4807
4839
|
error: t.error
|
|
@@ -4868,7 +4900,7 @@ class Mr extends w {
|
|
|
4868
4900
|
a("warn", "identify() userId exceeds 256 characters", { data: { length: e.trim().length } });
|
|
4869
4901
|
return;
|
|
4870
4902
|
}
|
|
4871
|
-
const r = e.trim(), n =
|
|
4903
|
+
const r = e.trim(), n = ht(t), i = {
|
|
4872
4904
|
userId: r,
|
|
4873
4905
|
...n ? { traits: n } : {}
|
|
4874
4906
|
};
|
|
@@ -4887,8 +4919,8 @@ class Mr extends w {
|
|
|
4887
4919
|
*/
|
|
4888
4920
|
async resetIdentity() {
|
|
4889
4921
|
await this.managers.event?.flushImmediately(), this.set("identity", void 0), this.clearPersistedIdentity();
|
|
4890
|
-
const e =
|
|
4891
|
-
this.managers.storage.setItem(
|
|
4922
|
+
const e = ut();
|
|
4923
|
+
this.managers.storage.setItem(pe, e), this.set("userId", e), this.set("hasStartSession", !1), this.set("sessionId", null), this.handlers.session?.stopTracking(), this.handlers.session?.startTracking(), a("debug", "Identity reset, new UUID generated");
|
|
4892
4924
|
}
|
|
4893
4925
|
/**
|
|
4894
4926
|
* Returns the project ID used for identity storage scoping.
|
|
@@ -4902,7 +4934,7 @@ class Mr extends w {
|
|
|
4902
4934
|
*/
|
|
4903
4935
|
persistIdentity(e) {
|
|
4904
4936
|
try {
|
|
4905
|
-
const t = this.getProjectId(), r =
|
|
4937
|
+
const t = this.getProjectId(), r = he(t);
|
|
4906
4938
|
this.managers.storage.setItem(r, JSON.stringify(e));
|
|
4907
4939
|
} catch {
|
|
4908
4940
|
a("debug", "Failed to persist identity to localStorage");
|
|
@@ -4913,7 +4945,7 @@ class Mr extends w {
|
|
|
4913
4945
|
* Also migrates pending identity (set before init) to the project-scoped key.
|
|
4914
4946
|
*/
|
|
4915
4947
|
loadPersistedIdentity() {
|
|
4916
|
-
const e = this.managers.storage, t = this.getProjectId(), r =
|
|
4948
|
+
const e = this.managers.storage, t = this.getProjectId(), r = he(t);
|
|
4917
4949
|
try {
|
|
4918
4950
|
const n = e.getItem(H);
|
|
4919
4951
|
if (n) {
|
|
@@ -4965,7 +4997,7 @@ class Mr extends w {
|
|
|
4965
4997
|
clearPersistedIdentity() {
|
|
4966
4998
|
try {
|
|
4967
4999
|
const e = this.managers.storage, t = this.getProjectId();
|
|
4968
|
-
e.removeItem(
|
|
5000
|
+
e.removeItem(he(t)), e.removeItem(H);
|
|
4969
5001
|
} catch {
|
|
4970
5002
|
a("debug", "Failed to clear persisted identity");
|
|
4971
5003
|
}
|
|
@@ -4977,7 +5009,7 @@ class Mr extends w {
|
|
|
4977
5009
|
}
|
|
4978
5010
|
initializeHandlers() {
|
|
4979
5011
|
const e = this.get("config");
|
|
4980
|
-
this.handlers.session = new
|
|
5012
|
+
this.handlers.session = new yr(
|
|
4981
5013
|
this.managers.storage,
|
|
4982
5014
|
this.managers.event
|
|
4983
5015
|
), this.handlers.session.startTracking();
|
|
@@ -4986,20 +5018,20 @@ class Mr extends w {
|
|
|
4986
5018
|
this.set("suppressNextScroll", !1);
|
|
4987
5019
|
}, 500);
|
|
4988
5020
|
};
|
|
4989
|
-
this.handlers.pageView = new
|
|
5021
|
+
this.handlers.pageView = new wr(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new br(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new Ar(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new Cr(this.managers.event), this.handlers.performance.startTracking().catch((r) => {
|
|
4990
5022
|
a("warn", "Failed to start performance tracking", { error: r });
|
|
4991
|
-
}), this.handlers.error = new
|
|
5023
|
+
}), this.handlers.error = new oe(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new Lr(this.managers.event), this.handlers.viewport.startTracking());
|
|
4992
5024
|
}
|
|
4993
5025
|
}
|
|
4994
|
-
const
|
|
5026
|
+
const k = [], M = [];
|
|
4995
5027
|
let D = null, h = null, R = !1, p = !1, P = null;
|
|
4996
|
-
const
|
|
5028
|
+
const Nr = async (s) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (p = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : h ? { sessionId: h.getSessionId() ?? "" } : (R && P || (R = !0, P = (async () => {
|
|
4997
5029
|
try {
|
|
4998
|
-
const e =
|
|
5030
|
+
const e = dr(s ?? {}), t = new Rr();
|
|
4999
5031
|
try {
|
|
5000
|
-
|
|
5032
|
+
k.forEach(({ event: o, callback: l }) => {
|
|
5001
5033
|
t.on(o, l);
|
|
5002
|
-
}),
|
|
5034
|
+
}), k.length = 0, M.forEach(({ hook: o, fn: l }) => {
|
|
5003
5035
|
o === "beforeSend" ? t.setTransformer("beforeSend", l) : t.setTransformer("beforeBatch", l);
|
|
5004
5036
|
}), M.length = 0, D && (t.setCustomHeaders(D), D = null);
|
|
5005
5037
|
const r = t.init(e), n = new Promise((o, l) => {
|
|
@@ -5021,7 +5053,7 @@ const Cr = async (s) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
5021
5053
|
} finally {
|
|
5022
5054
|
R = !1, P = null;
|
|
5023
5055
|
}
|
|
5024
|
-
})()), P)),
|
|
5056
|
+
})()), P)), Or = (s, e) => {
|
|
5025
5057
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5026
5058
|
if (!h)
|
|
5027
5059
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -5029,25 +5061,25 @@ const Cr = async (s) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
5029
5061
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
5030
5062
|
h.sendCustomEvent(s, e);
|
|
5031
5063
|
}
|
|
5032
|
-
},
|
|
5064
|
+
}, Pr = (s, e) => {
|
|
5033
5065
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5034
5066
|
if (!h || R) {
|
|
5035
|
-
|
|
5067
|
+
k.push({ event: s, callback: e });
|
|
5036
5068
|
return;
|
|
5037
5069
|
}
|
|
5038
5070
|
h.on(s, e);
|
|
5039
5071
|
}
|
|
5040
|
-
},
|
|
5072
|
+
}, Dr = (s, e) => {
|
|
5041
5073
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5042
5074
|
if (!h) {
|
|
5043
|
-
const t =
|
|
5044
|
-
t !== -1 &&
|
|
5075
|
+
const t = k.findIndex((r) => r.event === s && r.callback === e);
|
|
5076
|
+
t !== -1 && k.splice(t, 1);
|
|
5045
5077
|
return;
|
|
5046
5078
|
}
|
|
5047
5079
|
h.off(s, e);
|
|
5048
5080
|
}
|
|
5049
5081
|
};
|
|
5050
|
-
function
|
|
5082
|
+
function kr(s, e) {
|
|
5051
5083
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5052
5084
|
if (typeof e != "function")
|
|
5053
5085
|
throw new Error(`[TraceLog] Transformer must be a function, received: ${typeof e}`);
|
|
@@ -5061,7 +5093,7 @@ function Pr(s, e) {
|
|
|
5061
5093
|
s === "beforeSend" ? h.setTransformer("beforeSend", e) : h.setTransformer("beforeBatch", e);
|
|
5062
5094
|
}
|
|
5063
5095
|
}
|
|
5064
|
-
const
|
|
5096
|
+
const Vr = (s) => {
|
|
5065
5097
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5066
5098
|
if (!h) {
|
|
5067
5099
|
const e = M.findIndex((t) => t.hook === s);
|
|
@@ -5072,7 +5104,7 @@ const Dr = (s) => {
|
|
|
5072
5104
|
throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
|
|
5073
5105
|
h.removeTransformer(s);
|
|
5074
5106
|
}
|
|
5075
|
-
},
|
|
5107
|
+
}, Ur = (s) => {
|
|
5076
5108
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5077
5109
|
if (typeof s != "function")
|
|
5078
5110
|
throw new Error(`[TraceLog] Custom headers provider must be a function, received: ${typeof s}`);
|
|
@@ -5084,7 +5116,7 @@ const Dr = (s) => {
|
|
|
5084
5116
|
throw new Error("[TraceLog] Cannot set custom headers while TraceLog is being destroyed");
|
|
5085
5117
|
h.setCustomHeaders(s);
|
|
5086
5118
|
}
|
|
5087
|
-
},
|
|
5119
|
+
}, Hr = () => {
|
|
5088
5120
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5089
5121
|
if (!h) {
|
|
5090
5122
|
D = null;
|
|
@@ -5094,7 +5126,7 @@ const Dr = (s) => {
|
|
|
5094
5126
|
throw new Error("[TraceLog] Cannot remove custom headers while TraceLog is being destroyed");
|
|
5095
5127
|
h.removeCustomHeaders();
|
|
5096
5128
|
}
|
|
5097
|
-
},
|
|
5129
|
+
}, Fr = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, xr = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), $r = () => {
|
|
5098
5130
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5099
5131
|
if (p)
|
|
5100
5132
|
throw new Error("[TraceLog] Destroy operation already in progress");
|
|
@@ -5104,14 +5136,14 @@ const Dr = (s) => {
|
|
|
5104
5136
|
}
|
|
5105
5137
|
p = !0;
|
|
5106
5138
|
try {
|
|
5107
|
-
h.destroy(), h = null, R = !1, P = null,
|
|
5139
|
+
h.destroy(), h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, p = !1;
|
|
5108
5140
|
} catch (s) {
|
|
5109
|
-
h = null, R = !1, P = null,
|
|
5141
|
+
h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, p = !1, a("warn", "Error during destroy, forced cleanup completed", { error: s });
|
|
5110
5142
|
}
|
|
5111
5143
|
}
|
|
5112
|
-
},
|
|
5113
|
-
typeof window > "u" || typeof document > "u" ||
|
|
5114
|
-
},
|
|
5144
|
+
}, Br = (s) => {
|
|
5145
|
+
typeof window > "u" || typeof document > "u" || tr(s);
|
|
5146
|
+
}, Wr = (s) => {
|
|
5115
5147
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5116
5148
|
if (!h)
|
|
5117
5149
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -5119,7 +5151,7 @@ const Dr = (s) => {
|
|
|
5119
5151
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5120
5152
|
h.updateGlobalMetadata(s);
|
|
5121
5153
|
}
|
|
5122
|
-
},
|
|
5154
|
+
}, Xr = (s) => {
|
|
5123
5155
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5124
5156
|
if (!h)
|
|
5125
5157
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -5127,7 +5159,7 @@ const Dr = (s) => {
|
|
|
5127
5159
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5128
5160
|
h.mergeGlobalMetadata(s);
|
|
5129
5161
|
}
|
|
5130
|
-
},
|
|
5162
|
+
}, Gr = (s, e) => {
|
|
5131
5163
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5132
5164
|
if (!s || typeof s != "string" || s.trim().length === 0) {
|
|
5133
5165
|
a("warn", "identify() called with invalid userId");
|
|
@@ -5146,7 +5178,7 @@ const Dr = (s) => {
|
|
|
5146
5178
|
return;
|
|
5147
5179
|
}
|
|
5148
5180
|
try {
|
|
5149
|
-
const t =
|
|
5181
|
+
const t = ht(e), r = {
|
|
5150
5182
|
userId: s.trim(),
|
|
5151
5183
|
...t ? { traits: t } : {}
|
|
5152
5184
|
};
|
|
@@ -5155,7 +5187,7 @@ const Dr = (s) => {
|
|
|
5155
5187
|
a("debug", "Failed to persist pre-init identity");
|
|
5156
5188
|
}
|
|
5157
5189
|
}
|
|
5158
|
-
},
|
|
5190
|
+
}, jr = async () => {
|
|
5159
5191
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5160
5192
|
if (!h) {
|
|
5161
5193
|
try {
|
|
@@ -5168,38 +5200,38 @@ const Dr = (s) => {
|
|
|
5168
5200
|
throw new Error("[TraceLog] Cannot reset identity while TraceLog is being destroyed");
|
|
5169
5201
|
await h.resetIdentity();
|
|
5170
5202
|
}
|
|
5171
|
-
},
|
|
5172
|
-
init:
|
|
5173
|
-
event:
|
|
5174
|
-
on:
|
|
5175
|
-
off:
|
|
5176
|
-
setTransformer:
|
|
5177
|
-
removeTransformer:
|
|
5178
|
-
setCustomHeaders:
|
|
5179
|
-
removeCustomHeaders:
|
|
5180
|
-
isInitialized:
|
|
5181
|
-
getSessionId:
|
|
5182
|
-
destroy:
|
|
5183
|
-
setQaMode:
|
|
5184
|
-
updateGlobalMetadata:
|
|
5185
|
-
mergeGlobalMetadata:
|
|
5186
|
-
identify:
|
|
5187
|
-
resetIdentity:
|
|
5203
|
+
}, vs = {
|
|
5204
|
+
init: Nr,
|
|
5205
|
+
event: Or,
|
|
5206
|
+
on: Pr,
|
|
5207
|
+
off: Dr,
|
|
5208
|
+
setTransformer: kr,
|
|
5209
|
+
removeTransformer: Vr,
|
|
5210
|
+
setCustomHeaders: Ur,
|
|
5211
|
+
removeCustomHeaders: Hr,
|
|
5212
|
+
isInitialized: Fr,
|
|
5213
|
+
getSessionId: xr,
|
|
5214
|
+
destroy: $r,
|
|
5215
|
+
setQaMode: Br,
|
|
5216
|
+
updateGlobalMetadata: Wr,
|
|
5217
|
+
mergeGlobalMetadata: Xr,
|
|
5218
|
+
identify: Gr,
|
|
5219
|
+
resetIdentity: jr
|
|
5188
5220
|
};
|
|
5189
|
-
var
|
|
5221
|
+
var Ae, C, j, Et, ae, St = -1, V = function(s) {
|
|
5190
5222
|
addEventListener("pageshow", (function(e) {
|
|
5191
|
-
e.persisted && (
|
|
5223
|
+
e.persisted && (St = e.timeStamp, s(e));
|
|
5192
5224
|
}), !0);
|
|
5193
|
-
},
|
|
5225
|
+
}, Pe = function() {
|
|
5194
5226
|
var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
5195
5227
|
if (s && s.responseStart > 0 && s.responseStart < performance.now()) return s;
|
|
5196
|
-
},
|
|
5197
|
-
var s =
|
|
5228
|
+
}, ce = function() {
|
|
5229
|
+
var s = Pe();
|
|
5198
5230
|
return s && s.activationStart || 0;
|
|
5199
5231
|
}, _ = function(s, e) {
|
|
5200
|
-
var t =
|
|
5201
|
-
return
|
|
5202
|
-
},
|
|
5232
|
+
var t = Pe(), r = "navigate";
|
|
5233
|
+
return St >= 0 ? r = "back-forward-cache" : t && (document.prerendering || ce() > 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 };
|
|
5234
|
+
}, x = function(s, e, t) {
|
|
5203
5235
|
try {
|
|
5204
5236
|
if (PerformanceObserver.supportedEntryTypes.includes(s)) {
|
|
5205
5237
|
var r = new PerformanceObserver((function(n) {
|
|
@@ -5218,56 +5250,56 @@ var we, C, j, ft, ie, mt = -1, k = function(s) {
|
|
|
5218
5250
|
return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
|
|
5219
5251
|
})(e.value, t), s(e));
|
|
5220
5252
|
};
|
|
5221
|
-
},
|
|
5253
|
+
}, De = function(s) {
|
|
5222
5254
|
requestAnimationFrame((function() {
|
|
5223
5255
|
return requestAnimationFrame((function() {
|
|
5224
5256
|
return s();
|
|
5225
5257
|
}));
|
|
5226
5258
|
}));
|
|
5227
|
-
},
|
|
5259
|
+
}, Q = function(s) {
|
|
5228
5260
|
document.addEventListener("visibilitychange", (function() {
|
|
5229
5261
|
document.visibilityState === "hidden" && s();
|
|
5230
5262
|
}));
|
|
5231
|
-
},
|
|
5263
|
+
}, ue = function(s) {
|
|
5232
5264
|
var e = !1;
|
|
5233
5265
|
return function() {
|
|
5234
5266
|
e || (s(), e = !0);
|
|
5235
5267
|
};
|
|
5236
|
-
},
|
|
5268
|
+
}, F = -1, et = function() {
|
|
5237
5269
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
5238
|
-
},
|
|
5239
|
-
document.visibilityState === "hidden" &&
|
|
5240
|
-
},
|
|
5241
|
-
addEventListener("visibilitychange",
|
|
5242
|
-
},
|
|
5243
|
-
removeEventListener("visibilitychange",
|
|
5244
|
-
},
|
|
5245
|
-
return
|
|
5270
|
+
}, le = function(s) {
|
|
5271
|
+
document.visibilityState === "hidden" && F > -1 && (F = s.type === "visibilitychange" ? s.timeStamp : 0, zr());
|
|
5272
|
+
}, tt = function() {
|
|
5273
|
+
addEventListener("visibilitychange", le, !0), addEventListener("prerenderingchange", le, !0);
|
|
5274
|
+
}, zr = function() {
|
|
5275
|
+
removeEventListener("visibilitychange", le, !0), removeEventListener("prerenderingchange", le, !0);
|
|
5276
|
+
}, ke = function() {
|
|
5277
|
+
return F < 0 && (F = et(), tt(), V((function() {
|
|
5246
5278
|
setTimeout((function() {
|
|
5247
|
-
|
|
5279
|
+
F = et(), tt();
|
|
5248
5280
|
}), 0);
|
|
5249
5281
|
}))), { get firstHiddenTime() {
|
|
5250
|
-
return
|
|
5282
|
+
return F;
|
|
5251
5283
|
} };
|
|
5252
5284
|
}, K = function(s) {
|
|
5253
5285
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
5254
5286
|
return s();
|
|
5255
5287
|
}), !0) : s();
|
|
5256
|
-
},
|
|
5288
|
+
}, Le = [1800, 3e3], pt = function(s, e) {
|
|
5257
5289
|
e = e || {}, K((function() {
|
|
5258
|
-
var t, r =
|
|
5290
|
+
var t, r = ke(), n = _("FCP"), i = x("paint", (function(o) {
|
|
5259
5291
|
o.forEach((function(l) {
|
|
5260
|
-
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime -
|
|
5292
|
+
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime - ce(), 0), n.entries.push(l), t(!0)));
|
|
5261
5293
|
}));
|
|
5262
5294
|
}));
|
|
5263
|
-
i && (t = y(s, n,
|
|
5264
|
-
n = _("FCP"), t = y(s, n,
|
|
5295
|
+
i && (t = y(s, n, Le, e.reportAllChanges), V((function(o) {
|
|
5296
|
+
n = _("FCP"), t = y(s, n, Le, e.reportAllChanges), De((function() {
|
|
5265
5297
|
n.value = performance.now() - o.timeStamp, t(!0);
|
|
5266
5298
|
}));
|
|
5267
5299
|
})));
|
|
5268
5300
|
}));
|
|
5269
|
-
},
|
|
5270
|
-
e = e || {},
|
|
5301
|
+
}, Me = [0.1, 0.25], Qr = function(s, e) {
|
|
5302
|
+
e = e || {}, pt(ue((function() {
|
|
5271
5303
|
var t, r = _("CLS", 0), n = 0, i = [], o = function(c) {
|
|
5272
5304
|
c.forEach((function(u) {
|
|
5273
5305
|
if (!u.hadRecentInput) {
|
|
@@ -5275,28 +5307,28 @@ var we, C, j, ft, ie, mt = -1, k = function(s) {
|
|
|
5275
5307
|
n && u.startTime - E.startTime < 1e3 && u.startTime - g.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
|
|
5276
5308
|
}
|
|
5277
5309
|
})), n > r.value && (r.value = n, r.entries = i, t());
|
|
5278
|
-
}, l =
|
|
5279
|
-
l && (t = y(s, r,
|
|
5310
|
+
}, l = x("layout-shift", o);
|
|
5311
|
+
l && (t = y(s, r, Me, e.reportAllChanges), Q((function() {
|
|
5280
5312
|
o(l.takeRecords()), t(!0);
|
|
5281
|
-
})),
|
|
5282
|
-
n = 0, r = _("CLS", 0), t = y(s, r,
|
|
5313
|
+
})), V((function() {
|
|
5314
|
+
n = 0, r = _("CLS", 0), t = y(s, r, Me, e.reportAllChanges), De((function() {
|
|
5283
5315
|
return t();
|
|
5284
5316
|
}));
|
|
5285
5317
|
})), setTimeout(t, 0));
|
|
5286
5318
|
})));
|
|
5287
|
-
},
|
|
5319
|
+
}, Tt = 0, Ee = 1 / 0, Z = 0, Kr = function(s) {
|
|
5288
5320
|
s.forEach((function(e) {
|
|
5289
|
-
e.interactionId && (
|
|
5321
|
+
e.interactionId && (Ee = Math.min(Ee, e.interactionId), Z = Math.max(Z, e.interactionId), Tt = Z ? (Z - Ee) / 7 + 1 : 0);
|
|
5290
5322
|
}));
|
|
5291
|
-
},
|
|
5292
|
-
return
|
|
5293
|
-
},
|
|
5294
|
-
"interactionCount" in performance ||
|
|
5295
|
-
}, A = [], re = /* @__PURE__ */ new Map(),
|
|
5296
|
-
var s = Math.min(A.length - 1, Math.floor((
|
|
5323
|
+
}, It = function() {
|
|
5324
|
+
return Ae ? Tt : performance.interactionCount || 0;
|
|
5325
|
+
}, Yr = function() {
|
|
5326
|
+
"interactionCount" in performance || Ae || (Ae = x("event", Kr, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
5327
|
+
}, A = [], re = /* @__PURE__ */ new Map(), vt = 0, qr = function() {
|
|
5328
|
+
var s = Math.min(A.length - 1, Math.floor((It() - vt) / 50));
|
|
5297
5329
|
return A[s];
|
|
5298
|
-
},
|
|
5299
|
-
if (
|
|
5330
|
+
}, Jr = [], Zr = function(s) {
|
|
5331
|
+
if (Jr.forEach((function(n) {
|
|
5300
5332
|
return n(s);
|
|
5301
5333
|
})), s.interactionId || s.entryType === "first-input") {
|
|
5302
5334
|
var e = A[A.length - 1], t = re.get(s.interactionId);
|
|
@@ -5313,153 +5345,154 @@ var we, C, j, ft, ie, mt = -1, k = function(s) {
|
|
|
5313
5345
|
}));
|
|
5314
5346
|
}
|
|
5315
5347
|
}
|
|
5316
|
-
},
|
|
5348
|
+
}, _t = function(s) {
|
|
5317
5349
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
5318
|
-
return s =
|
|
5319
|
-
},
|
|
5350
|
+
return s = ue(s), document.visibilityState === "hidden" ? s() : (t = e(s), Q(s)), t;
|
|
5351
|
+
}, Ce = [200, 500], es = function(s, e) {
|
|
5320
5352
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, K((function() {
|
|
5321
5353
|
var t;
|
|
5322
|
-
|
|
5354
|
+
Yr();
|
|
5323
5355
|
var r, n = _("INP"), i = function(l) {
|
|
5324
|
-
|
|
5325
|
-
l.forEach(
|
|
5326
|
-
var c =
|
|
5356
|
+
_t((function() {
|
|
5357
|
+
l.forEach(Zr);
|
|
5358
|
+
var c = qr();
|
|
5327
5359
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, r());
|
|
5328
5360
|
}));
|
|
5329
|
-
}, o =
|
|
5330
|
-
r = y(s, n,
|
|
5361
|
+
}, o = x("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
5362
|
+
r = y(s, n, Ce, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), Q((function() {
|
|
5331
5363
|
i(o.takeRecords()), r(!0);
|
|
5332
|
-
})),
|
|
5333
|
-
|
|
5364
|
+
})), V((function() {
|
|
5365
|
+
vt = It(), A.length = 0, re.clear(), n = _("INP"), r = y(s, n, Ce, e.reportAllChanges);
|
|
5334
5366
|
})));
|
|
5335
5367
|
})));
|
|
5336
|
-
},
|
|
5368
|
+
}, Re = [2500, 4e3], Se = {}, ts = function(s, e) {
|
|
5337
5369
|
e = e || {}, K((function() {
|
|
5338
|
-
var t, r =
|
|
5370
|
+
var t, r = ke(), n = _("LCP"), i = function(c) {
|
|
5339
5371
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
5340
|
-
u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime -
|
|
5372
|
+
u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime - ce(), 0), n.entries = [u], t());
|
|
5341
5373
|
}));
|
|
5342
|
-
}, o =
|
|
5374
|
+
}, o = x("largest-contentful-paint", i);
|
|
5343
5375
|
if (o) {
|
|
5344
|
-
t = y(s, n,
|
|
5345
|
-
var l =
|
|
5346
|
-
|
|
5376
|
+
t = y(s, n, Re, e.reportAllChanges);
|
|
5377
|
+
var l = ue((function() {
|
|
5378
|
+
Se[n.id] || (i(o.takeRecords()), o.disconnect(), Se[n.id] = !0, t(!0));
|
|
5347
5379
|
}));
|
|
5348
5380
|
["keydown", "click"].forEach((function(c) {
|
|
5349
5381
|
addEventListener(c, (function() {
|
|
5350
|
-
return
|
|
5382
|
+
return _t(l);
|
|
5351
5383
|
}), { once: !0, capture: !0 });
|
|
5352
|
-
})),
|
|
5353
|
-
n = _("LCP"), t = y(s, n,
|
|
5354
|
-
n.value = performance.now() - c.timeStamp,
|
|
5384
|
+
})), Q(l), V((function(c) {
|
|
5385
|
+
n = _("LCP"), t = y(s, n, Re, e.reportAllChanges), De((function() {
|
|
5386
|
+
n.value = performance.now() - c.timeStamp, Se[n.id] = !0, t(!0);
|
|
5355
5387
|
}));
|
|
5356
5388
|
}));
|
|
5357
5389
|
}
|
|
5358
5390
|
}));
|
|
5359
|
-
},
|
|
5391
|
+
}, Ne = [800, 1800], rs = function s(e) {
|
|
5360
5392
|
document.prerendering ? K((function() {
|
|
5361
5393
|
return s(e);
|
|
5362
5394
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
5363
5395
|
return s(e);
|
|
5364
5396
|
}), !0) : setTimeout(e, 0);
|
|
5365
|
-
},
|
|
5397
|
+
}, ss = function(s, e) {
|
|
5366
5398
|
e = e || {};
|
|
5367
|
-
var t = _("TTFB"), r = y(s, t,
|
|
5368
|
-
|
|
5369
|
-
var n =
|
|
5370
|
-
n && (t.value = Math.max(n.responseStart -
|
|
5371
|
-
t = _("TTFB", 0), (r = y(s, t,
|
|
5399
|
+
var t = _("TTFB"), r = y(s, t, Ne, e.reportAllChanges);
|
|
5400
|
+
rs((function() {
|
|
5401
|
+
var n = Pe();
|
|
5402
|
+
n && (t.value = Math.max(n.responseStart - ce(), 0), t.entries = [n], r(!0), V((function() {
|
|
5403
|
+
t = _("TTFB", 0), (r = y(s, t, Ne, e.reportAllChanges))(!0);
|
|
5372
5404
|
})));
|
|
5373
5405
|
}));
|
|
5374
|
-
},
|
|
5375
|
-
C || (C = e, j = s,
|
|
5376
|
-
},
|
|
5377
|
-
if (j >= 0 && j <
|
|
5406
|
+
}, X = { passive: !0, capture: !0 }, ns = /* @__PURE__ */ new Date(), rt = function(s, e) {
|
|
5407
|
+
C || (C = e, j = s, Et = /* @__PURE__ */ new Date(), wt(removeEventListener), yt());
|
|
5408
|
+
}, yt = function() {
|
|
5409
|
+
if (j >= 0 && j < Et - ns) {
|
|
5378
5410
|
var s = { entryType: "first-input", name: C.type, target: C.target, cancelable: C.cancelable, startTime: C.timeStamp, processingStart: C.timeStamp + j };
|
|
5379
|
-
|
|
5411
|
+
ae.forEach((function(e) {
|
|
5380
5412
|
e(s);
|
|
5381
|
-
})),
|
|
5413
|
+
})), ae = [];
|
|
5382
5414
|
}
|
|
5383
|
-
},
|
|
5415
|
+
}, is = function(s) {
|
|
5384
5416
|
if (s.cancelable) {
|
|
5385
5417
|
var e = (s.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - s.timeStamp;
|
|
5386
5418
|
s.type == "pointerdown" ? (function(t, r) {
|
|
5387
5419
|
var n = function() {
|
|
5388
|
-
|
|
5420
|
+
rt(t, r), o();
|
|
5389
5421
|
}, i = function() {
|
|
5390
5422
|
o();
|
|
5391
5423
|
}, o = function() {
|
|
5392
|
-
removeEventListener("pointerup", n,
|
|
5424
|
+
removeEventListener("pointerup", n, X), removeEventListener("pointercancel", i, X);
|
|
5393
5425
|
};
|
|
5394
|
-
addEventListener("pointerup", n,
|
|
5395
|
-
})(e, s) :
|
|
5426
|
+
addEventListener("pointerup", n, X), addEventListener("pointercancel", i, X);
|
|
5427
|
+
})(e, s) : rt(e, s);
|
|
5396
5428
|
}
|
|
5397
|
-
},
|
|
5429
|
+
}, wt = function(s) {
|
|
5398
5430
|
["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
|
|
5399
|
-
return s(e,
|
|
5431
|
+
return s(e, is, X);
|
|
5400
5432
|
}));
|
|
5401
|
-
},
|
|
5433
|
+
}, Oe = [100, 300], os = function(s, e) {
|
|
5402
5434
|
e = e || {}, K((function() {
|
|
5403
|
-
var t, r =
|
|
5435
|
+
var t, r = ke(), n = _("FID"), i = function(c) {
|
|
5404
5436
|
c.startTime < r.firstHiddenTime && (n.value = c.processingStart - c.startTime, n.entries.push(c), t(!0));
|
|
5405
5437
|
}, o = function(c) {
|
|
5406
5438
|
c.forEach(i);
|
|
5407
|
-
}, l =
|
|
5408
|
-
t = y(s, n,
|
|
5439
|
+
}, l = x("first-input", o);
|
|
5440
|
+
t = y(s, n, Oe, e.reportAllChanges), l && (Q(ue((function() {
|
|
5409
5441
|
o(l.takeRecords()), l.disconnect();
|
|
5410
|
-
}))),
|
|
5442
|
+
}))), V((function() {
|
|
5411
5443
|
var c;
|
|
5412
|
-
n = _("FID"), t = y(s, n,
|
|
5444
|
+
n = _("FID"), t = y(s, n, Oe, e.reportAllChanges), ae = [], j = -1, C = null, wt(addEventListener), c = i, ae.push(c), yt();
|
|
5413
5445
|
})));
|
|
5414
5446
|
}));
|
|
5415
5447
|
};
|
|
5416
|
-
const
|
|
5448
|
+
const as = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5417
5449
|
__proto__: null,
|
|
5418
|
-
CLSThresholds:
|
|
5419
|
-
FCPThresholds:
|
|
5420
|
-
FIDThresholds:
|
|
5421
|
-
INPThresholds:
|
|
5422
|
-
LCPThresholds:
|
|
5423
|
-
TTFBThresholds:
|
|
5424
|
-
onCLS:
|
|
5425
|
-
onFCP:
|
|
5426
|
-
onFID:
|
|
5427
|
-
onINP:
|
|
5428
|
-
onLCP:
|
|
5429
|
-
onTTFB:
|
|
5450
|
+
CLSThresholds: Me,
|
|
5451
|
+
FCPThresholds: Le,
|
|
5452
|
+
FIDThresholds: Oe,
|
|
5453
|
+
INPThresholds: Ce,
|
|
5454
|
+
LCPThresholds: Re,
|
|
5455
|
+
TTFBThresholds: Ne,
|
|
5456
|
+
onCLS: Qr,
|
|
5457
|
+
onFCP: pt,
|
|
5458
|
+
onFID: os,
|
|
5459
|
+
onINP: es,
|
|
5460
|
+
onLCP: ts,
|
|
5461
|
+
onTTFB: ss
|
|
5430
5462
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5431
5463
|
export {
|
|
5432
5464
|
f as AppConfigValidationError,
|
|
5433
|
-
|
|
5434
|
-
|
|
5465
|
+
ls as DEFAULT_SESSION_TIMEOUT,
|
|
5466
|
+
_e as DEFAULT_WEB_VITALS_MODE,
|
|
5435
5467
|
L as DeviceType,
|
|
5436
|
-
|
|
5468
|
+
Te as EmitterEvent,
|
|
5437
5469
|
W as ErrorType,
|
|
5438
5470
|
d as EventType,
|
|
5439
|
-
|
|
5471
|
+
Ts as InitializationTimeoutError,
|
|
5440
5472
|
U as IntegrationValidationError,
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5473
|
+
Es as MAX_ARRAY_LENGTH,
|
|
5474
|
+
hs as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
5475
|
+
ds as MAX_CUSTOM_EVENT_KEYS,
|
|
5476
|
+
cs as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
5477
|
+
us as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
5478
|
+
fs as MAX_NESTED_OBJECT_KEYS,
|
|
5479
|
+
ms as MAX_STRING_LENGTH,
|
|
5480
|
+
gs as MAX_STRING_LENGTH_IN_ARRAY,
|
|
5481
|
+
ne as Mode,
|
|
5482
|
+
at as PII_PATTERNS,
|
|
5451
5483
|
N as PermanentError,
|
|
5452
|
-
|
|
5484
|
+
se as RateLimitError,
|
|
5485
|
+
We as SamplingRateValidationError,
|
|
5453
5486
|
ee as ScrollDirection,
|
|
5454
|
-
|
|
5487
|
+
Ot as SessionTimeoutValidationError,
|
|
5455
5488
|
B as SpecialApiUrl,
|
|
5456
5489
|
O as TimeoutError,
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5490
|
+
z as TraceLogValidationError,
|
|
5491
|
+
Is as WEB_VITALS_GOOD_THRESHOLDS,
|
|
5492
|
+
Qe as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
5493
|
+
Qt as WEB_VITALS_POOR_THRESHOLDS,
|
|
5494
|
+
Ke as getWebVitalsThresholds,
|
|
5495
|
+
Ss as isPrimaryScrollEvent,
|
|
5496
|
+
ps as isSecondaryScrollEvent,
|
|
5497
|
+
vs as tracelog
|
|
5465
5498
|
};
|