@tracelog/lib 3.0.0-rc.115.8 → 3.1.0-rc.116.2
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 +243 -226
- 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.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 L = "data-tlog",
|
|
1
|
+
const fn = 9e5;
|
|
2
|
+
const gn = 120, mn = 49152, pn = 100, Sn = 500, En = 200;
|
|
3
|
+
const vn = 1e3, Tn = 500, _n = 1e3;
|
|
4
|
+
const L = "data-tlog", vt = [
|
|
5
5
|
"button",
|
|
6
6
|
"a",
|
|
7
7
|
'input[type="button"]',
|
|
@@ -33,7 +33,7 @@ const L = "data-tlog", Et = [
|
|
|
33
33
|
".menu-item",
|
|
34
34
|
"[data-testid]",
|
|
35
35
|
'[tabindex="0"]'
|
|
36
|
-
],
|
|
36
|
+
], Tt = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], _t = [
|
|
37
37
|
"token",
|
|
38
38
|
"auth",
|
|
39
39
|
"key",
|
|
@@ -60,14 +60,14 @@ const y = {
|
|
|
60
60
|
INVALID_CLICK_THROTTLE: "Click throttle must be a non-negative number",
|
|
61
61
|
INVALID_MAX_SAME_EVENT_PER_MINUTE: "Max same event per minute must be a positive number",
|
|
62
62
|
INVALID_SEND_INTERVAL: "Send interval must be between 1000ms (1 second) and 60000ms (60 seconds)"
|
|
63
|
-
},
|
|
63
|
+
}, yt = [
|
|
64
64
|
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
65
65
|
/javascript:/gi,
|
|
66
66
|
/on\w+\s*=/gi,
|
|
67
67
|
/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
|
68
68
|
/<embed\b[^>]*>/gi,
|
|
69
69
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
70
|
-
], g = "tlog", z = `${g}:qa_mode`, Se = `${g}:uid`,
|
|
70
|
+
], g = "tlog", z = `${g}:qa_mode`, Se = `${g}:uid`, nt = "tlog_mode", Ue = "qa", Fe = "qa_off", ce = (n) => n ? `${g}:${n}:queue` : `${g}:queue`, le = (n) => n ? `${g}:${n}:rate_limit` : `${g}:rate_limit`, It = (n) => n ? `${g}:${n}:session` : `${g}:session`, wt = (n) => n ? `${g}:${n}:broadcast` : `${g}:broadcast`, Ve = (n, e) => `${g}:${n}:session_counts:${e}`, He = 10080 * 60 * 1e3, xe = `${g}:session_counts_last_cleanup`, $e = 3600 * 1e3, ue = (n) => n ? `${g}:${n}:identity` : `${g}:identity`, O = `${g}:pending_identity`;
|
|
71
71
|
var F = /* @__PURE__ */ ((n) => (n.Localhost = "localhost:8080", n.Fail = "localhost:9999", n))(F || {}), w = /* @__PURE__ */ ((n) => (n.Mobile = "mobile", n.Tablet = "tablet", n.Desktop = "desktop", n.Unknown = "unknown", n))(w || {}), D = /* @__PURE__ */ ((n) => (n.EVENT = "event", n.QUEUE = "queue", n))(D || {});
|
|
72
72
|
class M extends Error {
|
|
73
73
|
constructor(e, t, s) {
|
|
@@ -99,7 +99,7 @@ class m extends $ {
|
|
|
99
99
|
super(e, "APP_CONFIG_INVALID", t);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
class
|
|
102
|
+
class At extends $ {
|
|
103
103
|
constructor(e, t = "config") {
|
|
104
104
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
105
105
|
}
|
|
@@ -114,19 +114,19 @@ class Xe extends $ {
|
|
|
114
114
|
super(e, "INTEGRATION_INVALID", t);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
class
|
|
117
|
+
class yn extends $ {
|
|
118
118
|
constructor(e, t, s = "runtime") {
|
|
119
119
|
super(e, "INITIALIZATION_TIMEOUT", s), this.timeoutMs = t;
|
|
120
120
|
}
|
|
121
121
|
timeoutMs;
|
|
122
122
|
}
|
|
123
|
-
const
|
|
123
|
+
const Lt = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], de = () => {
|
|
124
124
|
const n = new URLSearchParams(window.location.search), e = {};
|
|
125
|
-
return
|
|
125
|
+
return Lt.forEach((s) => {
|
|
126
126
|
const r = n.get(s);
|
|
127
127
|
r && (e[s] = r);
|
|
128
128
|
}), Object.keys(e).length ? e : void 0;
|
|
129
|
-
},
|
|
129
|
+
}, bt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Mt = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Ct = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Rt = (n, e) => {
|
|
130
130
|
if (e) {
|
|
131
131
|
if (e instanceof Error) {
|
|
132
132
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
|
|
@@ -145,7 +145,7 @@ const At = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], de = () => {
|
|
|
145
145
|
return `[TraceLog] ${n}: ${String(e)}`;
|
|
146
146
|
}
|
|
147
147
|
return `[TraceLog] ${n}`;
|
|
148
|
-
},
|
|
148
|
+
}, Nt = () => {
|
|
149
149
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
150
150
|
return !1;
|
|
151
151
|
try {
|
|
@@ -154,12 +154,12 @@ const At = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], de = () => {
|
|
|
154
154
|
return !1;
|
|
155
155
|
}
|
|
156
156
|
}, a = (n, e, t) => {
|
|
157
|
-
const { error: s, data: r, showToClient: i = !1, style: o, visibility: c } = t ?? {}, l = s ?
|
|
158
|
-
if (!
|
|
157
|
+
const { error: s, data: r, showToClient: i = !1, style: o, visibility: c } = t ?? {}, l = s ? Rt(e, s) : `[TraceLog] ${e}`, u = n === "error" ? "error" : n === "warn" ? "warn" : "log";
|
|
158
|
+
if (!Ot(c, i))
|
|
159
159
|
return;
|
|
160
|
-
const p =
|
|
161
|
-
|
|
162
|
-
},
|
|
160
|
+
const p = Pt(c, o), S = r !== void 0 ? ve(r) : void 0;
|
|
161
|
+
kt(u, l, p, S);
|
|
162
|
+
}, Ot = (n, e) => n === "critical" ? !0 : n === "qa" || e ? Nt() : !1, Pt = (n, e) => e !== void 0 && e !== "" ? e : n === "critical" ? Ct : "", kt = (n, e, t, s) => {
|
|
163
163
|
const r = t !== void 0 && t !== "", i = r ? `%c${e}` : e;
|
|
164
164
|
s !== void 0 ? r ? console[n](i, t, s) : console[n](i, s) : r ? console[n](i, t) : console[n](i);
|
|
165
165
|
}, ve = (n) => {
|
|
@@ -176,10 +176,10 @@ const At = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], de = () => {
|
|
|
176
176
|
}
|
|
177
177
|
return e;
|
|
178
178
|
};
|
|
179
|
-
let Te,
|
|
180
|
-
const
|
|
181
|
-
typeof window < "u" && !Te && (Te = window.matchMedia("(pointer: coarse)"),
|
|
182
|
-
}, te = "Unknown",
|
|
179
|
+
let Te, rt;
|
|
180
|
+
const Dt = () => {
|
|
181
|
+
typeof window < "u" && !Te && (Te = window.matchMedia("(pointer: coarse)"), rt = window.matchMedia("(hover: none)"));
|
|
182
|
+
}, te = "Unknown", Ut = (n) => {
|
|
183
183
|
const e = n.userAgentData?.platform;
|
|
184
184
|
if (e != null && e !== "") {
|
|
185
185
|
if (/windows/i.test(e)) return "Windows";
|
|
@@ -191,7 +191,7 @@ const kt = () => {
|
|
|
191
191
|
}
|
|
192
192
|
const t = navigator.userAgent;
|
|
193
193
|
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" : te;
|
|
194
|
-
},
|
|
194
|
+
}, Ft = (n) => {
|
|
195
195
|
const e = n.userAgentData?.brands;
|
|
196
196
|
if (e != null && e.length > 0) {
|
|
197
197
|
const r = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
|
|
@@ -202,26 +202,26 @@ const kt = () => {
|
|
|
202
202
|
}
|
|
203
203
|
const t = navigator.userAgent;
|
|
204
204
|
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" : te;
|
|
205
|
-
},
|
|
205
|
+
}, Vt = () => {
|
|
206
206
|
try {
|
|
207
207
|
const n = navigator;
|
|
208
208
|
if (n.userAgentData != null && typeof n.userAgentData.mobile == "boolean") {
|
|
209
209
|
const l = n.userAgentData.platform;
|
|
210
210
|
return l != null && l !== "" && /ipad|tablet/i.test(l) ? w.Tablet : n.userAgentData.mobile ? w.Mobile : w.Desktop;
|
|
211
211
|
}
|
|
212
|
-
|
|
213
|
-
const e = window.innerWidth, t = Te?.matches ?? !1, s =
|
|
212
|
+
Dt();
|
|
213
|
+
const e = window.innerWidth, t = Te?.matches ?? !1, s = rt?.matches ?? !1, r = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), c = /tablet|ipad|android(?!.*mobile)/.test(i);
|
|
214
214
|
return e <= 767 || o && r ? w.Mobile : e >= 768 && e <= 1024 || c || t && s && r ? w.Tablet : w.Desktop;
|
|
215
215
|
} catch (n) {
|
|
216
216
|
return a("debug", "Device detection failed, defaulting to desktop", { error: n }), w.Desktop;
|
|
217
217
|
}
|
|
218
|
-
},
|
|
218
|
+
}, Ht = () => {
|
|
219
219
|
try {
|
|
220
220
|
const n = navigator;
|
|
221
221
|
return {
|
|
222
|
-
type:
|
|
223
|
-
os:
|
|
224
|
-
browser:
|
|
222
|
+
type: Vt(),
|
|
223
|
+
os: Ut(n),
|
|
224
|
+
browser: Ft(n)
|
|
225
225
|
};
|
|
226
226
|
} catch (n) {
|
|
227
227
|
return a("debug", "Device info detection failed, using defaults", { error: n }), {
|
|
@@ -230,7 +230,7 @@ const kt = () => {
|
|
|
230
230
|
browser: te
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
}, Ge = 500, We = 2e3, je = 5e3, Q = 50,
|
|
233
|
+
}, Ge = 500, We = 2e3, je = 5e3, Q = 50, xt = Q * 2, it = 1, $t = 1e3, Bt = 10, Ke = 5e3, Xt = 3, Gt = 200, Wt = 6e4, jt = 64, In = {
|
|
234
234
|
LCP: 2500,
|
|
235
235
|
FCP: 1800,
|
|
236
236
|
CLS: 0.1,
|
|
@@ -242,7 +242,7 @@ const kt = () => {
|
|
|
242
242
|
CLS: 0.1,
|
|
243
243
|
INP: 200,
|
|
244
244
|
TTFB: 800
|
|
245
|
-
},
|
|
245
|
+
}, Kt = {
|
|
246
246
|
LCP: 4e3,
|
|
247
247
|
FCP: 3e3,
|
|
248
248
|
CLS: 0.25,
|
|
@@ -255,35 +255,35 @@ const kt = () => {
|
|
|
255
255
|
case "needs-improvement":
|
|
256
256
|
return ze;
|
|
257
257
|
case "poor":
|
|
258
|
-
return
|
|
258
|
+
return Kt;
|
|
259
259
|
default:
|
|
260
260
|
return ze;
|
|
261
261
|
}
|
|
262
|
-
},
|
|
262
|
+
}, zt = 50, Qt = "3.1.0", Yt = Qt, qt = () => typeof window < "u" && typeof sessionStorage < "u", Jt = () => {
|
|
263
263
|
try {
|
|
264
264
|
const n = new URLSearchParams(window.location.search);
|
|
265
|
-
n.delete(
|
|
265
|
+
n.delete(nt);
|
|
266
266
|
const e = n.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
|
|
267
267
|
window.history.replaceState({}, "", t);
|
|
268
268
|
} catch {
|
|
269
269
|
}
|
|
270
|
-
},
|
|
271
|
-
if (!
|
|
270
|
+
}, Zt = () => {
|
|
271
|
+
if (!qt())
|
|
272
272
|
return !1;
|
|
273
273
|
try {
|
|
274
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
274
|
+
const e = new URLSearchParams(window.location.search).get(nt), t = sessionStorage.getItem(z);
|
|
275
275
|
let s = null;
|
|
276
276
|
return e === Ue ? (s = !0, sessionStorage.setItem(z, "true"), a("info", "QA Mode ACTIVE", {
|
|
277
277
|
visibility: "qa",
|
|
278
|
-
style:
|
|
278
|
+
style: bt
|
|
279
279
|
})) : e === Fe && (s = !1, sessionStorage.setItem(z, "false"), a("info", "QA Mode DISABLED", {
|
|
280
280
|
visibility: "qa",
|
|
281
|
-
style:
|
|
282
|
-
})), (e === Ue || e === Fe) &&
|
|
281
|
+
style: Mt
|
|
282
|
+
})), (e === Ue || e === Fe) && Jt(), s ?? t === "true";
|
|
283
283
|
} catch {
|
|
284
284
|
return !1;
|
|
285
285
|
}
|
|
286
|
-
},
|
|
286
|
+
}, ot = () => typeof document < "u" && document.prerendering === !0, es = [
|
|
287
287
|
"co.uk",
|
|
288
288
|
"org.uk",
|
|
289
289
|
"com.au",
|
|
@@ -300,32 +300,32 @@ const kt = () => {
|
|
|
300
300
|
if (e.length <= 2)
|
|
301
301
|
return n.toLowerCase();
|
|
302
302
|
const t = e.slice(-2).join(".");
|
|
303
|
-
return
|
|
304
|
-
},
|
|
303
|
+
return es.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
304
|
+
}, ts = (n, e) => n === e ? !0 : Ye(n) === Ye(e), he = () => {
|
|
305
305
|
const n = document.referrer;
|
|
306
306
|
if (!n)
|
|
307
307
|
return "Direct";
|
|
308
308
|
try {
|
|
309
309
|
const e = new URL(n).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
|
|
310
|
-
return
|
|
310
|
+
return ts(e, t) ? "Direct" : n;
|
|
311
311
|
} catch (e) {
|
|
312
312
|
return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: n } }), n;
|
|
313
313
|
}
|
|
314
314
|
}, fe = () => {
|
|
315
315
|
const n = new URLSearchParams(window.location.search), e = {};
|
|
316
|
-
return
|
|
316
|
+
return Tt.forEach((s) => {
|
|
317
317
|
const r = n.get(s);
|
|
318
318
|
if (r) {
|
|
319
319
|
const i = s.split("utm_")[1];
|
|
320
320
|
e[i] = r;
|
|
321
321
|
}
|
|
322
322
|
}), Object.keys(e).length ? e : void 0;
|
|
323
|
-
},
|
|
323
|
+
}, at = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (n) => {
|
|
324
324
|
const e = Math.random() * 16 | 0;
|
|
325
325
|
return (n === "x" ? e : e & 3 | 8).toString(16);
|
|
326
326
|
});
|
|
327
327
|
let W = 0, j = 0;
|
|
328
|
-
const
|
|
328
|
+
const ss = () => {
|
|
329
329
|
let n = Date.now();
|
|
330
330
|
n < j && (n = j), n === j ? W = (W + 1) % 1e3 : W = 0, j = n;
|
|
331
331
|
const e = W.toString().padStart(3, "0");
|
|
@@ -338,13 +338,13 @@ const ts = () => {
|
|
|
338
338
|
} catch {
|
|
339
339
|
}
|
|
340
340
|
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${n}-${e}-${t}`;
|
|
341
|
-
},
|
|
341
|
+
}, ns = (n) => {
|
|
342
342
|
try {
|
|
343
343
|
return new URL(n).protocol === "https:";
|
|
344
344
|
} catch {
|
|
345
345
|
return !1;
|
|
346
346
|
}
|
|
347
|
-
},
|
|
347
|
+
}, rs = (n) => {
|
|
348
348
|
try {
|
|
349
349
|
const t = new URL(window.location.href).hostname;
|
|
350
350
|
if (!t || typeof t != "string")
|
|
@@ -362,20 +362,20 @@ const ts = () => {
|
|
|
362
362
|
if (!r || r.split(".").length < 2)
|
|
363
363
|
throw new Error("Invalid domain structure for SaaS");
|
|
364
364
|
const i = `https://${n}.${r}/collect`;
|
|
365
|
-
if (!
|
|
365
|
+
if (!ns(i))
|
|
366
366
|
throw new Error("Generated URL failed validation");
|
|
367
367
|
return i;
|
|
368
368
|
} catch (e) {
|
|
369
369
|
throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
|
|
370
370
|
}
|
|
371
|
-
},
|
|
371
|
+
}, is = (n) => {
|
|
372
372
|
const e = {};
|
|
373
|
-
return n.integrations?.tracelog?.projectId && (e.saas =
|
|
373
|
+
return n.integrations?.tracelog?.projectId && (e.saas = rs(n.integrations.tracelog.projectId)), e;
|
|
374
374
|
}, ye = (n, e = []) => {
|
|
375
375
|
if (!n || typeof n != "string")
|
|
376
376
|
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof n } }), n || "";
|
|
377
377
|
try {
|
|
378
|
-
const t = new URL(n), s = t.searchParams, r = [.../* @__PURE__ */ new Set([...
|
|
378
|
+
const t = new URL(n), s = t.searchParams, r = [.../* @__PURE__ */ new Set([..._t, ...e])];
|
|
379
379
|
let i = !1;
|
|
380
380
|
const o = [];
|
|
381
381
|
return r.forEach((c) => {
|
|
@@ -390,7 +390,7 @@ const ts = () => {
|
|
|
390
390
|
let e = n;
|
|
391
391
|
n.length > 1e3 && (e = n.slice(0, Math.max(0, 1e3)));
|
|
392
392
|
let t = 0;
|
|
393
|
-
for (const r of
|
|
393
|
+
for (const r of yt) {
|
|
394
394
|
const i = e;
|
|
395
395
|
e = e.replace(r, ""), i !== e && t++;
|
|
396
396
|
}
|
|
@@ -425,7 +425,7 @@ const ts = () => {
|
|
|
425
425
|
return t;
|
|
426
426
|
}
|
|
427
427
|
return null;
|
|
428
|
-
},
|
|
428
|
+
}, os = (n) => {
|
|
429
429
|
if (typeof n != "object" || n === null)
|
|
430
430
|
return {};
|
|
431
431
|
try {
|
|
@@ -435,7 +435,7 @@ const ts = () => {
|
|
|
435
435
|
const t = e instanceof Error ? e.message : String(e);
|
|
436
436
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
437
437
|
}
|
|
438
|
-
},
|
|
438
|
+
}, as = [
|
|
439
439
|
// Email addresses.
|
|
440
440
|
// Quantifiers are bounded (local part ≤64, each label ≤63, TLD ≤63 per RFC/DNS limits)
|
|
441
441
|
// and the domain is matched as discrete dot-separated labels so the local-part and
|
|
@@ -458,18 +458,18 @@ const ts = () => {
|
|
|
458
458
|
/[?&](token|password|passwd|auth|secret|secret_key|private_key|auth_key|api_key|apikey|access_token)=[^&\s]+/gi
|
|
459
459
|
], Y = (n) => {
|
|
460
460
|
let e = n;
|
|
461
|
-
for (const t of
|
|
461
|
+
for (const t of as)
|
|
462
462
|
e = e.replace(t, "[REDACTED]");
|
|
463
463
|
return e;
|
|
464
|
-
},
|
|
464
|
+
}, cs = (n) => {
|
|
465
465
|
if (n !== void 0 && (n === null || typeof n != "object"))
|
|
466
466
|
throw new m("Configuration must be an object", "config");
|
|
467
467
|
if (n) {
|
|
468
468
|
if (n.sessionTimeout !== void 0 && (typeof n.sessionTimeout != "number" || n.sessionTimeout < 3e4 || n.sessionTimeout > 864e5))
|
|
469
|
-
throw new
|
|
469
|
+
throw new At(y.INVALID_SESSION_TIMEOUT, "config");
|
|
470
470
|
if (n.globalMetadata !== void 0 && (typeof n.globalMetadata != "object" || n.globalMetadata === null))
|
|
471
471
|
throw new m(y.INVALID_GLOBAL_METADATA, "config");
|
|
472
|
-
if (n.integrations &&
|
|
472
|
+
if (n.integrations && ls(n.integrations), n.sensitiveQueryParams !== void 0) {
|
|
473
473
|
if (!Array.isArray(n.sensitiveQueryParams))
|
|
474
474
|
throw new m(y.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
475
475
|
for (const e of n.sensitiveQueryParams)
|
|
@@ -529,19 +529,19 @@ const ts = () => {
|
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
},
|
|
532
|
+
}, ls = (n) => {
|
|
533
533
|
if (n && n.tracelog) {
|
|
534
534
|
if (!n.tracelog.projectId || typeof n.tracelog.projectId != "string" || n.tracelog.projectId.trim() === "")
|
|
535
535
|
throw new Xe(y.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
536
536
|
if (n.tracelog.shopify !== void 0 && typeof n.tracelog.shopify != "boolean")
|
|
537
537
|
throw new Xe("tracelog.shopify must be a boolean", "config");
|
|
538
538
|
}
|
|
539
|
-
},
|
|
539
|
+
}, us = (n) => (cs(n), {
|
|
540
540
|
...n ?? {},
|
|
541
541
|
sessionTimeout: n?.sessionTimeout ?? 9e5,
|
|
542
542
|
globalMetadata: n?.globalMetadata ?? {},
|
|
543
543
|
sensitiveQueryParams: n?.sensitiveQueryParams ?? [],
|
|
544
|
-
errorSampling: n?.errorSampling ??
|
|
544
|
+
errorSampling: n?.errorSampling ?? it,
|
|
545
545
|
samplingRate: n?.samplingRate ?? 1,
|
|
546
546
|
pageViewThrottleMs: n?.pageViewThrottleMs ?? 1e3,
|
|
547
547
|
clickThrottleMs: n?.clickThrottleMs ?? 300,
|
|
@@ -554,13 +554,13 @@ const ts = () => {
|
|
|
554
554
|
return !0;
|
|
555
555
|
const t = typeof n;
|
|
556
556
|
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(n) ? !1 : (e.add(n), Array.isArray(n) ? n.every((s) => we(s, e)) : t === "object" ? Object.values(n).every((s) => we(s, e)) : !1);
|
|
557
|
-
},
|
|
557
|
+
}, ds = (n) => typeof n != "object" || n === null ? !1 : we(n), Ae = (n) => {
|
|
558
558
|
if (typeof n != "object" || n === null || Array.isArray(n)) return;
|
|
559
559
|
const e = {};
|
|
560
560
|
for (const [t, s] of Object.entries(n))
|
|
561
561
|
typeof s == "string" && (e[t] = s);
|
|
562
562
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
563
|
-
},
|
|
563
|
+
}, hs = (n) => typeof n != "string" ? {
|
|
564
564
|
valid: !1,
|
|
565
565
|
error: "Event name must be a string"
|
|
566
566
|
} : n.length === 0 ? {
|
|
@@ -576,8 +576,8 @@ const ts = () => {
|
|
|
576
576
|
valid: !1,
|
|
577
577
|
error: "Event name cannot be a reserved word"
|
|
578
578
|
} : { valid: !0 }, Je = (n, e, t) => {
|
|
579
|
-
const s =
|
|
580
|
-
if (!
|
|
579
|
+
const s = os(e), r = `${t} "${n}" metadata error`;
|
|
580
|
+
if (!ds(s))
|
|
581
581
|
return {
|
|
582
582
|
valid: !1,
|
|
583
583
|
error: `${r}: object has invalid types. Valid types are string, number, boolean or string arrays.`
|
|
@@ -625,7 +625,7 @@ const ts = () => {
|
|
|
625
625
|
valid: !0,
|
|
626
626
|
sanitizedMetadata: s
|
|
627
627
|
};
|
|
628
|
-
},
|
|
628
|
+
}, fs = (n, e, t) => {
|
|
629
629
|
if (Array.isArray(e)) {
|
|
630
630
|
const s = [], r = `${t} "${n}" metadata error`;
|
|
631
631
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -649,15 +649,15 @@ const ts = () => {
|
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
651
|
return Je(n, e, t);
|
|
652
|
-
},
|
|
653
|
-
const t =
|
|
652
|
+
}, gs = (n, e) => {
|
|
653
|
+
const t = hs(n);
|
|
654
654
|
if (!t.valid)
|
|
655
655
|
return a("error", "Event name validation failed", {
|
|
656
656
|
data: { eventName: n, error: t.error }
|
|
657
657
|
}), t;
|
|
658
658
|
if (!e)
|
|
659
659
|
return { valid: !0 };
|
|
660
|
-
const s =
|
|
660
|
+
const s = fs(n, e, "customEvent");
|
|
661
661
|
return s.valid || a("error", "Event metadata validation failed", {
|
|
662
662
|
data: {
|
|
663
663
|
eventName: n,
|
|
@@ -665,7 +665,7 @@ const ts = () => {
|
|
|
665
665
|
}
|
|
666
666
|
}), s;
|
|
667
667
|
};
|
|
668
|
-
class
|
|
668
|
+
class ms {
|
|
669
669
|
listeners = /* @__PURE__ */ new Map();
|
|
670
670
|
/**
|
|
671
671
|
* Subscribes to an event channel
|
|
@@ -782,13 +782,30 @@ class gs {
|
|
|
782
782
|
this.listeners.clear();
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
|
-
const
|
|
786
|
-
function Ts(n) {
|
|
787
|
-
return n.replace(ms, "[URL]").replace(ps, "[ID]").replace(Ss, "[ADDR]").replace(Es, "[N]").replace(vs, "$1[VAR]$1").toLowerCase().trim();
|
|
788
|
-
}
|
|
785
|
+
const ps = /https?:\/\/\S+/g, Ss = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, Es = /0x[0-9a-fA-F]{4,}/g, vs = /(?<!\d)\d{4,}(?!\d)/g, Ts = /(['"])[^'"]{20,}\1/g;
|
|
789
786
|
function _s(n) {
|
|
790
|
-
|
|
791
|
-
|
|
787
|
+
return n.replace(ps, "[URL]").replace(Ss, "[ID]").replace(Es, "[ADDR]").replace(vs, "[N]").replace(Ts, "$1[VAR]$1").toLowerCase().trim();
|
|
788
|
+
}
|
|
789
|
+
function Ze(n) {
|
|
790
|
+
const e = n.search(/[?#]/);
|
|
791
|
+
return e === -1 ? n : n.slice(0, e);
|
|
792
|
+
}
|
|
793
|
+
function ys(n, e) {
|
|
794
|
+
const t = Ze((n ?? "").trim());
|
|
795
|
+
if (!t) return "";
|
|
796
|
+
let s;
|
|
797
|
+
try {
|
|
798
|
+
s = new URL(t);
|
|
799
|
+
} catch {
|
|
800
|
+
return t;
|
|
801
|
+
}
|
|
802
|
+
if (s.protocol !== "http:" && s.protocol !== "https:") return "";
|
|
803
|
+
const r = Ze((e ?? "").trim());
|
|
804
|
+
return r && t === r ? s.origin : t;
|
|
805
|
+
}
|
|
806
|
+
function Is(n) {
|
|
807
|
+
const e = _s(n.message), t = ys(n.filename, n.page_url), s = n.line == null ? "" : String(n.line);
|
|
808
|
+
return `${e}|${t}|${s}`;
|
|
792
809
|
}
|
|
793
810
|
const ge = { config: {} };
|
|
794
811
|
class T {
|
|
@@ -811,7 +828,7 @@ class T {
|
|
|
811
828
|
return { ...ge };
|
|
812
829
|
}
|
|
813
830
|
}
|
|
814
|
-
class
|
|
831
|
+
class ws extends T {
|
|
815
832
|
storeManager;
|
|
816
833
|
apiUrl;
|
|
817
834
|
lastPermanentErrorLog = null;
|
|
@@ -1143,7 +1160,7 @@ class ys extends T {
|
|
|
1143
1160
|
async readTraceLogErrorCode(e) {
|
|
1144
1161
|
try {
|
|
1145
1162
|
const t = await e.clone().json();
|
|
1146
|
-
if (typeof t.code == "string" && t.code.length > 0 && t.code.length <=
|
|
1163
|
+
if (typeof t.code == "string" && t.code.length > 0 && t.code.length <= jt)
|
|
1147
1164
|
return t.code;
|
|
1148
1165
|
} catch {
|
|
1149
1166
|
}
|
|
@@ -1170,7 +1187,7 @@ class ys extends T {
|
|
|
1170
1187
|
idempotency_token: e._metadata?.idempotency_token ?? this.computeContentToken(e),
|
|
1171
1188
|
referer: typeof window < "u" ? window.location.href : void 0,
|
|
1172
1189
|
timestamp: t,
|
|
1173
|
-
client_version:
|
|
1190
|
+
client_version: Yt
|
|
1174
1191
|
}
|
|
1175
1192
|
};
|
|
1176
1193
|
return {
|
|
@@ -1262,12 +1279,12 @@ class ys extends T {
|
|
|
1262
1279
|
}
|
|
1263
1280
|
logPermanentError(e, t) {
|
|
1264
1281
|
const s = Date.now(), r = `${t.statusCode ?? "unknown"}:${t.responseCode ?? ""}`;
|
|
1265
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.key !== r || s - this.lastPermanentErrorLog.timestamp >=
|
|
1282
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.key !== r || s - this.lastPermanentErrorLog.timestamp >= Wt) && (a("error", e, {
|
|
1266
1283
|
data: { status: t.statusCode, code: t.responseCode, message: t.message }
|
|
1267
1284
|
}), this.lastPermanentErrorLog = { key: r, timestamp: s });
|
|
1268
1285
|
}
|
|
1269
1286
|
}
|
|
1270
|
-
class
|
|
1287
|
+
class As extends T {
|
|
1271
1288
|
bootTime;
|
|
1272
1289
|
bootTimestamp;
|
|
1273
1290
|
hasPerformanceNow;
|
|
@@ -1301,8 +1318,8 @@ class Is extends T {
|
|
|
1301
1318
|
} : { valid: !0 };
|
|
1302
1319
|
}
|
|
1303
1320
|
}
|
|
1304
|
-
const
|
|
1305
|
-
class
|
|
1321
|
+
const Ls = new Set(Object.values(d));
|
|
1322
|
+
class bs extends T {
|
|
1306
1323
|
dataSenders;
|
|
1307
1324
|
emitter;
|
|
1308
1325
|
timeManager;
|
|
@@ -1334,9 +1351,9 @@ class As extends T {
|
|
|
1334
1351
|
* @param emitter - Optional event emitter for local event consumption
|
|
1335
1352
|
*/
|
|
1336
1353
|
constructor(e, t = null) {
|
|
1337
|
-
super(), this.emitter = t, this.timeManager = new
|
|
1354
|
+
super(), this.emitter = t, this.timeManager = new As(), this.dataSenders = [];
|
|
1338
1355
|
const s = this.get("collectApiUrls");
|
|
1339
|
-
s?.saas && this.dataSenders.push(new
|
|
1356
|
+
s?.saas && this.dataSenders.push(new ws(e, s.saas)), this.saveSessionCountsDebounced = this.debounce((r) => {
|
|
1340
1357
|
this.saveSessionCounts(r);
|
|
1341
1358
|
}, 500), this.cleanupExpiredSessionCounts();
|
|
1342
1359
|
}
|
|
@@ -1454,7 +1471,7 @@ class As extends T {
|
|
|
1454
1471
|
a("error", "Event type is required - event will be ignored");
|
|
1455
1472
|
return;
|
|
1456
1473
|
}
|
|
1457
|
-
if (!
|
|
1474
|
+
if (!Ls.has(e)) {
|
|
1458
1475
|
a("error", "Invalid event type - event will be ignored", {
|
|
1459
1476
|
data: { type: e }
|
|
1460
1477
|
});
|
|
@@ -1515,9 +1532,9 @@ class As extends T {
|
|
|
1515
1532
|
if (!this.checkPerEventRateLimit(o.name, _))
|
|
1516
1533
|
return;
|
|
1517
1534
|
}
|
|
1518
|
-
const
|
|
1535
|
+
const St = S === d.SESSION_START, Et = t || this.get("pageUrl"), G = this.buildEventPayload({
|
|
1519
1536
|
type: S,
|
|
1520
|
-
page_url:
|
|
1537
|
+
page_url: Et,
|
|
1521
1538
|
from_page_url: s,
|
|
1522
1539
|
scroll_data: r,
|
|
1523
1540
|
click_data: i,
|
|
@@ -1527,7 +1544,7 @@ class As extends T {
|
|
|
1527
1544
|
page_view: u
|
|
1528
1545
|
});
|
|
1529
1546
|
if (G && !(!p && !this.shouldSample())) {
|
|
1530
|
-
if (
|
|
1547
|
+
if (St) {
|
|
1531
1548
|
const _ = this.get("sessionId");
|
|
1532
1549
|
if (!_) {
|
|
1533
1550
|
a("error", "Session start event requires sessionId - event will be ignored");
|
|
@@ -2010,7 +2027,7 @@ class As extends T {
|
|
|
2010
2027
|
});
|
|
2011
2028
|
const c = this.get("sessionReferrer"), l = this.get("sessionUtm"), u = this.get("sessionClickIds");
|
|
2012
2029
|
return { ...{
|
|
2013
|
-
id:
|
|
2030
|
+
id: ss(),
|
|
2014
2031
|
type: e.type,
|
|
2015
2032
|
page_url: r,
|
|
2016
2033
|
timestamp: i,
|
|
@@ -2322,7 +2339,7 @@ class As extends T {
|
|
|
2322
2339
|
}
|
|
2323
2340
|
}
|
|
2324
2341
|
}
|
|
2325
|
-
class
|
|
2342
|
+
class Ms {
|
|
2326
2343
|
/**
|
|
2327
2344
|
* Gets or creates a unique user ID.
|
|
2328
2345
|
*
|
|
@@ -2343,12 +2360,12 @@ class Ls {
|
|
|
2343
2360
|
const t = e.getItem(Se);
|
|
2344
2361
|
if (t)
|
|
2345
2362
|
return t;
|
|
2346
|
-
const s =
|
|
2363
|
+
const s = at();
|
|
2347
2364
|
return e.setItem(Se, s), s;
|
|
2348
2365
|
}
|
|
2349
2366
|
}
|
|
2350
|
-
const
|
|
2351
|
-
class
|
|
2367
|
+
const Cs = /^\d{13}-[a-z0-9]{9}$/;
|
|
2368
|
+
class Rs extends T {
|
|
2352
2369
|
storageManager;
|
|
2353
2370
|
eventManager;
|
|
2354
2371
|
projectId;
|
|
@@ -2375,7 +2392,7 @@ class Ms extends T {
|
|
|
2375
2392
|
return;
|
|
2376
2393
|
}
|
|
2377
2394
|
const e = this.getProjectId();
|
|
2378
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
2395
|
+
this.broadcastChannel = new BroadcastChannel(wt(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2379
2396
|
const { action: s, sessionId: r, timestamp: i, projectId: o } = t.data ?? {};
|
|
2380
2397
|
if (o === e)
|
|
2381
2398
|
if (s === "session_start" && r && typeof i == "number" && i > Date.now() - 5e3) {
|
|
@@ -2400,7 +2417,7 @@ class Ms extends T {
|
|
|
2400
2417
|
const e = this.loadStoredSession();
|
|
2401
2418
|
if (!e)
|
|
2402
2419
|
return null;
|
|
2403
|
-
if (!
|
|
2420
|
+
if (!Cs.test(e.id))
|
|
2404
2421
|
return a("warn", "Invalid session ID format recovered from storage, clearing", {
|
|
2405
2422
|
data: { sessionId: e.id }
|
|
2406
2423
|
}), this.clearStoredSession(), null;
|
|
@@ -2446,7 +2463,7 @@ class Ms extends T {
|
|
|
2446
2463
|
this.storageManager.setItem(t, s), this.storageManager.setSessionItem(t, s);
|
|
2447
2464
|
}
|
|
2448
2465
|
getSessionStorageKey() {
|
|
2449
|
-
return
|
|
2466
|
+
return It(this.getProjectId());
|
|
2450
2467
|
}
|
|
2451
2468
|
getProjectId() {
|
|
2452
2469
|
return this.projectId;
|
|
@@ -2533,7 +2550,7 @@ class Ms extends T {
|
|
|
2533
2550
|
}
|
|
2534
2551
|
}), this.isTracking = !0;
|
|
2535
2552
|
try {
|
|
2536
|
-
if (this.set("sessionId", t), this.set("sessionReferrer", s), this.set("sessionUtm", r), this.set("sessionClickIds", i),
|
|
2553
|
+
if (this.set("sessionId", t), this.set("sessionReferrer", s), this.set("sessionUtm", r), this.set("sessionClickIds", i), ot()) {
|
|
2537
2554
|
this.prerenderActivationHandler = () => {
|
|
2538
2555
|
this.prerenderActivationHandler = null, this.activateSession(t, e, s, r, i);
|
|
2539
2556
|
}, document.addEventListener("prerenderingchange", this.prerenderActivationHandler, { once: !0 });
|
|
@@ -2723,7 +2740,7 @@ class Ms extends T {
|
|
|
2723
2740
|
this.prerenderActivationHandler && (document.removeEventListener("prerenderingchange", this.prerenderActivationHandler), this.prerenderActivationHandler = null);
|
|
2724
2741
|
}
|
|
2725
2742
|
}
|
|
2726
|
-
class
|
|
2743
|
+
class Ns extends T {
|
|
2727
2744
|
eventManager;
|
|
2728
2745
|
storageManager;
|
|
2729
2746
|
sessionManager = null;
|
|
@@ -2758,7 +2775,7 @@ class Cs extends T {
|
|
|
2758
2775
|
}
|
|
2759
2776
|
const t = this.get("config")?.integrations?.tracelog?.projectId ?? "custom";
|
|
2760
2777
|
try {
|
|
2761
|
-
this.sessionManager = new
|
|
2778
|
+
this.sessionManager = new Rs(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
|
|
2762
2779
|
} catch (s) {
|
|
2763
2780
|
if (this.sessionManager) {
|
|
2764
2781
|
try {
|
|
@@ -2811,7 +2828,7 @@ class Cs extends T {
|
|
|
2811
2828
|
this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
|
|
2812
2829
|
}
|
|
2813
2830
|
}
|
|
2814
|
-
class
|
|
2831
|
+
class Os extends T {
|
|
2815
2832
|
eventManager;
|
|
2816
2833
|
onTrack;
|
|
2817
2834
|
originalPushState;
|
|
@@ -2885,7 +2902,7 @@ class Rs extends T {
|
|
|
2885
2902
|
};
|
|
2886
2903
|
}
|
|
2887
2904
|
}
|
|
2888
|
-
class
|
|
2905
|
+
class Ps extends T {
|
|
2889
2906
|
eventManager;
|
|
2890
2907
|
lastClickTimes = /* @__PURE__ */ new Map();
|
|
2891
2908
|
clickHandler;
|
|
@@ -3027,7 +3044,7 @@ class Ns extends T {
|
|
|
3027
3044
|
return e.hasAttribute(`${L}-name`) ? e : e.closest(`[${L}-name]`);
|
|
3028
3045
|
}
|
|
3029
3046
|
getRelevantClickElement(e) {
|
|
3030
|
-
for (const t of
|
|
3047
|
+
for (const t of vt)
|
|
3031
3048
|
try {
|
|
3032
3049
|
if (e.matches(t))
|
|
3033
3050
|
return e;
|
|
@@ -3079,7 +3096,7 @@ class Ns extends T {
|
|
|
3079
3096
|
};
|
|
3080
3097
|
}
|
|
3081
3098
|
}
|
|
3082
|
-
class
|
|
3099
|
+
class ks extends T {
|
|
3083
3100
|
eventManager;
|
|
3084
3101
|
containers = [];
|
|
3085
3102
|
limitWarningLogged = !1;
|
|
@@ -3234,8 +3251,8 @@ class Os extends T {
|
|
|
3234
3251
|
return s && r;
|
|
3235
3252
|
}
|
|
3236
3253
|
}
|
|
3237
|
-
const
|
|
3238
|
-
class
|
|
3254
|
+
const Ds = "tracelog_session_id", Us = "tracelog_user_id";
|
|
3255
|
+
class Fs extends T {
|
|
3239
3256
|
visibilityHandler = null;
|
|
3240
3257
|
pageshowHandler = null;
|
|
3241
3258
|
lastSyncedKey = null;
|
|
@@ -3256,8 +3273,8 @@ class Ds extends T {
|
|
|
3256
3273
|
r !== this.lastSyncedKey && (this.lastSyncedKey = r, this.postCartUpdate(e, s));
|
|
3257
3274
|
}
|
|
3258
3275
|
postCartUpdate(e, t) {
|
|
3259
|
-
const s = { [
|
|
3260
|
-
t.length > 0 && (s[
|
|
3276
|
+
const s = { [Ds]: e };
|
|
3277
|
+
t.length > 0 && (s[Us] = t);
|
|
3261
3278
|
try {
|
|
3262
3279
|
fetch("/cart/update.js", {
|
|
3263
3280
|
method: "POST",
|
|
@@ -3294,7 +3311,7 @@ class Ds extends T {
|
|
|
3294
3311
|
this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null), this.pageshowHandler && (window.removeEventListener("pageshow", this.pageshowHandler), this.pageshowHandler = null);
|
|
3295
3312
|
}
|
|
3296
3313
|
}
|
|
3297
|
-
class
|
|
3314
|
+
class Vs {
|
|
3298
3315
|
storage;
|
|
3299
3316
|
sessionStorageRef;
|
|
3300
3317
|
fallbackStorage = /* @__PURE__ */ new Map();
|
|
@@ -3407,7 +3424,7 @@ class Us {
|
|
|
3407
3424
|
this.fallbackSessionStorage.delete(e);
|
|
3408
3425
|
}
|
|
3409
3426
|
}
|
|
3410
|
-
class
|
|
3427
|
+
class Hs extends T {
|
|
3411
3428
|
eventManager;
|
|
3412
3429
|
reportedByNav = /* @__PURE__ */ new Map();
|
|
3413
3430
|
navigationHistory = [];
|
|
@@ -3504,7 +3521,7 @@ class Fs extends T {
|
|
|
3504
3521
|
}
|
|
3505
3522
|
async initWebVitals() {
|
|
3506
3523
|
try {
|
|
3507
|
-
const { onLCP: e, onCLS: t, onFCP: s, onTTFB: r, onINP: i } = await Promise.resolve().then(() =>
|
|
3524
|
+
const { onLCP: e, onCLS: t, onFCP: s, onTTFB: r, onINP: i } = await Promise.resolve().then(() => hn), o = (c) => (l) => {
|
|
3508
3525
|
const u = Number(l.value.toFixed(2));
|
|
3509
3526
|
this.sendVital({ type: c, value: u });
|
|
3510
3527
|
};
|
|
@@ -3534,7 +3551,7 @@ class Fs extends T {
|
|
|
3534
3551
|
return;
|
|
3535
3552
|
if (s)
|
|
3536
3553
|
s.add(e.type);
|
|
3537
|
-
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length >
|
|
3554
|
+
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > zt) {
|
|
3538
3555
|
const i = this.navigationHistory.shift();
|
|
3539
3556
|
i && this.reportedByNav.delete(i);
|
|
3540
3557
|
}
|
|
@@ -3682,14 +3699,14 @@ class se extends T {
|
|
|
3682
3699
|
const e = Date.now();
|
|
3683
3700
|
if (e < this.burstBackoffUntil)
|
|
3684
3701
|
return !1;
|
|
3685
|
-
if (e - this.burstWindowStart >
|
|
3702
|
+
if (e - this.burstWindowStart > $t && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Bt)
|
|
3686
3703
|
return this.burstBackoffUntil = e + Ke, a("debug", "Error burst detected - entering cooldown", {
|
|
3687
3704
|
data: {
|
|
3688
3705
|
errorsInWindow: this.errorBurstCounter,
|
|
3689
3706
|
cooldownMs: Ke
|
|
3690
3707
|
}
|
|
3691
3708
|
}), !1;
|
|
3692
|
-
const s = this.get("config").errorSampling ??
|
|
3709
|
+
const s = this.get("config").errorSampling ?? it;
|
|
3693
3710
|
return Math.random() < s;
|
|
3694
3711
|
}
|
|
3695
3712
|
/**
|
|
@@ -3699,17 +3716,13 @@ class se extends T {
|
|
|
3699
3716
|
* later signature that recycles the same map key after a counter reset.
|
|
3700
3717
|
*/
|
|
3701
3718
|
shouldThrottleBySignature(e) {
|
|
3702
|
-
const t =
|
|
3703
|
-
|
|
3704
|
-
filename: e.filename,
|
|
3705
|
-
line: e.line
|
|
3706
|
-
}), s = this.pageviewSignatureCounts.get(t) ?? 0;
|
|
3707
|
-
if (s >= Bt)
|
|
3719
|
+
const t = Is(e), s = this.pageviewSignatureCounts.get(t) ?? 0;
|
|
3720
|
+
if (s >= Xt)
|
|
3708
3721
|
return a("debug", "Error throttled (pageview cap)", {
|
|
3709
3722
|
data: { signature: t, count: s }
|
|
3710
3723
|
}), !0;
|
|
3711
3724
|
const r = s + 1;
|
|
3712
|
-
return this.pageviewSignatureCounts.set(t, r), this.pageviewSignatureCounts.size >
|
|
3725
|
+
return this.pageviewSignatureCounts.set(t, r), this.pageviewSignatureCounts.size > Gt && (this.pageviewSignatureCounts.clear(), this.pageviewSignatureCounts.set(t, r)), !1;
|
|
3713
3726
|
}
|
|
3714
3727
|
handleError = (e) => {
|
|
3715
3728
|
if (!this.shouldSample())
|
|
@@ -3718,7 +3731,11 @@ class se extends T {
|
|
|
3718
3731
|
if (this.shouldSuppressError(V.JS_ERROR, t) || this.shouldThrottleBySignature({
|
|
3719
3732
|
message: t,
|
|
3720
3733
|
filename: e.filename,
|
|
3721
|
-
line: e.lineno
|
|
3734
|
+
line: e.lineno,
|
|
3735
|
+
// Inline-script errors report the page URL as `filename`; passing the current
|
|
3736
|
+
// page URL lets buildErrorSignatureKey collapse them to origin, byte-identical
|
|
3737
|
+
// to the server cap/dedup hash. normalizeFilename strips query/hash internally.
|
|
3738
|
+
page_url: window.location.href
|
|
3722
3739
|
}))
|
|
3723
3740
|
return;
|
|
3724
3741
|
const s = typeof e.error?.stack == "string" ? this.truncateStack(e.error.stack) : void 0, r = typeof e.error?.name == "string" && e.error.name !== "Error" ? e.error.name : void 0;
|
|
@@ -3771,7 +3788,7 @@ class se extends T {
|
|
|
3771
3788
|
}
|
|
3772
3789
|
shouldSuppressError(e, t) {
|
|
3773
3790
|
const s = Date.now(), r = `${e}:${t}`, i = this.recentErrors.get(r);
|
|
3774
|
-
return i !== void 0 && s - i < je ? (this.recentErrors.set(r, s), !0) : (this.recentErrors.set(r, s), this.recentErrors.size >
|
|
3791
|
+
return i !== void 0 && s - i < je ? (this.recentErrors.set(r, s), !0) : (this.recentErrors.set(r, s), this.recentErrors.size > xt ? (this.recentErrors.clear(), this.recentErrors.set(r, s), !1) : (this.recentErrors.size > Q && this.pruneOldErrors(), !1));
|
|
3775
3792
|
}
|
|
3776
3793
|
static TRUNCATION_SUFFIX = `
|
|
3777
3794
|
...truncated`;
|
|
@@ -3793,14 +3810,14 @@ class se extends T {
|
|
|
3793
3810
|
}
|
|
3794
3811
|
}
|
|
3795
3812
|
}
|
|
3796
|
-
class
|
|
3813
|
+
class xs extends T {
|
|
3797
3814
|
isInitialized = !1;
|
|
3798
3815
|
suppressNextScrollTimer = null;
|
|
3799
3816
|
pageUnloadHandler = null;
|
|
3800
3817
|
pageShowHandler = null;
|
|
3801
3818
|
visibilityFlushHandler = null;
|
|
3802
3819
|
prerenderActivationHandler = null;
|
|
3803
|
-
emitter = new
|
|
3820
|
+
emitter = new ms();
|
|
3804
3821
|
managers = {};
|
|
3805
3822
|
handlers = {};
|
|
3806
3823
|
integrationInstances = {};
|
|
@@ -3815,9 +3832,9 @@ class Vs extends T {
|
|
|
3815
3832
|
async init(e = {}) {
|
|
3816
3833
|
if (this.isInitialized)
|
|
3817
3834
|
return { sessionId: this.get("sessionId") ?? "" };
|
|
3818
|
-
this.managers.storage = new
|
|
3835
|
+
this.managers.storage = new Vs();
|
|
3819
3836
|
try {
|
|
3820
|
-
return this.setupState(e), this.managers.event = new
|
|
3837
|
+
return this.setupState(e), this.managers.event = new bs(this.managers.storage, this.emitter), this.loadPersistedIdentity(), this.initializeHandlers(), this.setupPageLifecycleListeners(), await this.managers.event.recoverPersistedEvents().catch((t) => {
|
|
3821
3838
|
a("warn", "Failed to recover persisted events", { error: t });
|
|
3822
3839
|
}), this.isInitialized = !0, { sessionId: this.get("sessionId") ?? "" };
|
|
3823
3840
|
} catch (t) {
|
|
@@ -3838,7 +3855,7 @@ class Vs extends T {
|
|
|
3838
3855
|
}
|
|
3839
3856
|
let r = t;
|
|
3840
3857
|
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
3841
|
-
const { valid: i, error: o, sanitizedMetadata: c } =
|
|
3858
|
+
const { valid: i, error: o, sanitizedMetadata: c } = gs(e, r);
|
|
3842
3859
|
if (!i) {
|
|
3843
3860
|
if (this.get("mode") === ee.QA)
|
|
3844
3861
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${o}`);
|
|
@@ -3877,14 +3894,14 @@ class Vs extends T {
|
|
|
3877
3894
|
}
|
|
3878
3895
|
setupState(e = {}) {
|
|
3879
3896
|
this.set("config", e);
|
|
3880
|
-
const t =
|
|
3897
|
+
const t = Ms.getId(this.managers.storage);
|
|
3881
3898
|
this.set("userId", t);
|
|
3882
|
-
const s =
|
|
3899
|
+
const s = is(e);
|
|
3883
3900
|
this.set("collectApiUrls", s);
|
|
3884
|
-
const r =
|
|
3901
|
+
const r = Ht();
|
|
3885
3902
|
this.set("device", r);
|
|
3886
3903
|
const i = ye(window.location.href, e.sensitiveQueryParams);
|
|
3887
|
-
this.set("pageUrl", i),
|
|
3904
|
+
this.set("pageUrl", i), Zt() && this.set("mode", ee.QA);
|
|
3888
3905
|
}
|
|
3889
3906
|
/**
|
|
3890
3907
|
* @internal Used by api.ts for configuration access
|
|
@@ -3962,7 +3979,7 @@ class Vs extends T {
|
|
|
3962
3979
|
*/
|
|
3963
3980
|
async resetIdentity() {
|
|
3964
3981
|
await this.managers.event?.flushImmediately().catch((t) => (a("debug", "Failed to flush before identity reset", { error: t }), !1)), this.set("identity", void 0), this.clearPersistedIdentity();
|
|
3965
|
-
const e =
|
|
3982
|
+
const e = at();
|
|
3966
3983
|
this.managers.storage.setItem(Se, e), this.set("userId", e), this.set("hasStartSession", !1), this.set("sessionId", null), this.handlers.session?.stopTracking(), this.handlers.session?.startTracking(), a("debug", "Identity reset, new UUID generated");
|
|
3967
3984
|
}
|
|
3968
3985
|
/**
|
|
@@ -4065,7 +4082,7 @@ class Vs extends T {
|
|
|
4065
4082
|
}
|
|
4066
4083
|
initializeHandlers() {
|
|
4067
4084
|
const e = this.get("config");
|
|
4068
|
-
this.handlers.session = new
|
|
4085
|
+
this.handlers.session = new Ns(
|
|
4069
4086
|
this.managers.storage,
|
|
4070
4087
|
this.managers.event
|
|
4071
4088
|
), this.handlers.session.startTracking();
|
|
@@ -4074,27 +4091,27 @@ class Vs extends T {
|
|
|
4074
4091
|
this.set("suppressNextScroll", !1);
|
|
4075
4092
|
}, 500);
|
|
4076
4093
|
};
|
|
4077
|
-
this.handlers.pageView = new
|
|
4094
|
+
this.handlers.pageView = new Os(this.managers.event, t), this.handlers.click = new Ps(this.managers.event), this.handlers.scroll = new ks(this.managers.event), this.handlers.performance = new Hs(this.managers.event), this.handlers.error = new se(this.managers.event, this.emitter);
|
|
4078
4095
|
const s = () => {
|
|
4079
4096
|
if (this.handlers.pageView?.startTracking(), this.handlers.click?.startTracking(), this.handlers.scroll?.startTracking(), this.handlers.performance?.startTracking().catch((r) => {
|
|
4080
4097
|
a("warn", "Failed to start performance tracking", { error: r });
|
|
4081
4098
|
}), this.handlers.error?.startTracking(), e.integrations?.tracelog?.shopify) {
|
|
4082
|
-
const r = new
|
|
4099
|
+
const r = new Fs();
|
|
4083
4100
|
r.activate(), this.integrationInstances.shopifyCartLinker = r, this.emitter.on(D.EVENT, (i) => {
|
|
4084
4101
|
i.type === d.SESSION_START && r.onSessionChange();
|
|
4085
4102
|
});
|
|
4086
4103
|
}
|
|
4087
4104
|
};
|
|
4088
|
-
|
|
4105
|
+
ot() ? (this.prerenderActivationHandler = () => {
|
|
4089
4106
|
this.prerenderActivationHandler = null, s();
|
|
4090
4107
|
}, document.addEventListener("prerenderingchange", this.prerenderActivationHandler, { once: !0 })) : s();
|
|
4091
4108
|
}
|
|
4092
4109
|
}
|
|
4093
4110
|
const R = [];
|
|
4094
4111
|
let f = null, k = !1, A = !1, C = null;
|
|
4095
|
-
const
|
|
4112
|
+
const $s = async (n) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (A = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : f ? { sessionId: f.getSessionId() ?? "" } : (k && C || (k = !0, C = (async () => {
|
|
4096
4113
|
try {
|
|
4097
|
-
const e =
|
|
4114
|
+
const e = us(n ?? {}), t = new xs();
|
|
4098
4115
|
try {
|
|
4099
4116
|
R.forEach(({ event: o, callback: c }) => {
|
|
4100
4117
|
t.on(o, c);
|
|
@@ -4118,7 +4135,7 @@ const Hs = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4118
4135
|
} finally {
|
|
4119
4136
|
k = !1, C = null;
|
|
4120
4137
|
}
|
|
4121
|
-
})()), C)),
|
|
4138
|
+
})()), C)), Bs = (n, e, t) => {
|
|
4122
4139
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4123
4140
|
if (!f)
|
|
4124
4141
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -4126,7 +4143,7 @@ const Hs = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4126
4143
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
4127
4144
|
f.sendCustomEvent(n, e, t);
|
|
4128
4145
|
}
|
|
4129
|
-
},
|
|
4146
|
+
}, Xs = (n, e) => {
|
|
4130
4147
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4131
4148
|
if (!f || k) {
|
|
4132
4149
|
R.push({ event: n, callback: e });
|
|
@@ -4134,7 +4151,7 @@ const Hs = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4134
4151
|
}
|
|
4135
4152
|
f.on(n, e);
|
|
4136
4153
|
}
|
|
4137
|
-
},
|
|
4154
|
+
}, Gs = (n, e) => {
|
|
4138
4155
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4139
4156
|
if (!f) {
|
|
4140
4157
|
const t = R.findIndex((s) => s.event === n && s.callback === e);
|
|
@@ -4143,7 +4160,7 @@ const Hs = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4143
4160
|
}
|
|
4144
4161
|
f.off(n, e);
|
|
4145
4162
|
}
|
|
4146
|
-
},
|
|
4163
|
+
}, Ws = () => typeof window > "u" || typeof document > "u" ? !1 : f !== null, js = () => typeof window > "u" || typeof document > "u" || !f ? null : f.getSessionId(), Ks = () => typeof window > "u" || typeof document > "u" || !f ? null : f.getUserId(), zs = () => {
|
|
4147
4164
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4148
4165
|
if (A)
|
|
4149
4166
|
throw new Error("[TraceLog] Destroy operation already in progress");
|
|
@@ -4158,7 +4175,7 @@ const Hs = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4158
4175
|
f = null, k = !1, C = null, R.length = 0, A = !1, a("warn", "Error during destroy, forced cleanup completed", { error: n });
|
|
4159
4176
|
}
|
|
4160
4177
|
}
|
|
4161
|
-
},
|
|
4178
|
+
}, Qs = (n, e) => {
|
|
4162
4179
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4163
4180
|
if (!n || typeof n != "string" || n.trim().length === 0) {
|
|
4164
4181
|
a("warn", "identify() called with invalid userId");
|
|
@@ -4186,7 +4203,7 @@ const Hs = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4186
4203
|
a("debug", "Failed to persist pre-init identity");
|
|
4187
4204
|
}
|
|
4188
4205
|
}
|
|
4189
|
-
},
|
|
4206
|
+
}, Ys = async () => {
|
|
4190
4207
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4191
4208
|
if (!f) {
|
|
4192
4209
|
try {
|
|
@@ -4199,21 +4216,21 @@ const Hs = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4199
4216
|
throw new Error("[TraceLog] Cannot reset identity while TraceLog is being destroyed");
|
|
4200
4217
|
await f.resetIdentity();
|
|
4201
4218
|
}
|
|
4202
|
-
},
|
|
4203
|
-
init:
|
|
4204
|
-
event:
|
|
4205
|
-
on:
|
|
4206
|
-
off:
|
|
4207
|
-
isInitialized:
|
|
4208
|
-
getSessionId:
|
|
4209
|
-
getUserId:
|
|
4210
|
-
destroy:
|
|
4211
|
-
identify:
|
|
4212
|
-
resetIdentity:
|
|
4219
|
+
}, wn = {
|
|
4220
|
+
init: $s,
|
|
4221
|
+
event: Bs,
|
|
4222
|
+
on: Xs,
|
|
4223
|
+
off: Gs,
|
|
4224
|
+
isInitialized: Ws,
|
|
4225
|
+
getSessionId: js,
|
|
4226
|
+
getUserId: Ks,
|
|
4227
|
+
destroy: zs,
|
|
4228
|
+
identify: Qs,
|
|
4229
|
+
resetIdentity: Ys
|
|
4213
4230
|
};
|
|
4214
|
-
var Le, b, x,
|
|
4231
|
+
var Le, b, x, ct, ne, lt = -1, N = function(n) {
|
|
4215
4232
|
addEventListener("pageshow", (function(e) {
|
|
4216
|
-
e.persisted && (
|
|
4233
|
+
e.persisted && (lt = e.timeStamp, n(e));
|
|
4217
4234
|
}), !0);
|
|
4218
4235
|
}, Pe = function() {
|
|
4219
4236
|
var n = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
@@ -4223,7 +4240,7 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4223
4240
|
return n && n.activationStart || 0;
|
|
4224
4241
|
}, E = function(n, e) {
|
|
4225
4242
|
var t = Pe(), s = "navigate";
|
|
4226
|
-
return
|
|
4243
|
+
return lt >= 0 ? s = "back-forward-cache" : t && (document.prerendering || ie() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: n, 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 };
|
|
4227
4244
|
}, U = function(n, e, t) {
|
|
4228
4245
|
try {
|
|
4229
4246
|
if (PerformanceObserver.supportedEntryTypes.includes(n)) {
|
|
@@ -4258,18 +4275,18 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4258
4275
|
return function() {
|
|
4259
4276
|
e || (n(), e = !0);
|
|
4260
4277
|
};
|
|
4261
|
-
}, P = -1,
|
|
4278
|
+
}, P = -1, et = function() {
|
|
4262
4279
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
4263
4280
|
}, re = function(n) {
|
|
4264
|
-
document.visibilityState === "hidden" && P > -1 && (P = n.type === "visibilitychange" ? n.timeStamp : 0,
|
|
4265
|
-
},
|
|
4281
|
+
document.visibilityState === "hidden" && P > -1 && (P = n.type === "visibilitychange" ? n.timeStamp : 0, qs());
|
|
4282
|
+
}, tt = function() {
|
|
4266
4283
|
addEventListener("visibilitychange", re, !0), addEventListener("prerenderingchange", re, !0);
|
|
4267
|
-
},
|
|
4284
|
+
}, qs = function() {
|
|
4268
4285
|
removeEventListener("visibilitychange", re, !0), removeEventListener("prerenderingchange", re, !0);
|
|
4269
4286
|
}, De = function() {
|
|
4270
|
-
return P < 0 && (P =
|
|
4287
|
+
return P < 0 && (P = et(), tt(), N((function() {
|
|
4271
4288
|
setTimeout((function() {
|
|
4272
|
-
P =
|
|
4289
|
+
P = et(), tt();
|
|
4273
4290
|
}), 0);
|
|
4274
4291
|
}))), { get firstHiddenTime() {
|
|
4275
4292
|
return P;
|
|
@@ -4278,7 +4295,7 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4278
4295
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
4279
4296
|
return n();
|
|
4280
4297
|
}), !0) : n();
|
|
4281
|
-
}, be = [1800, 3e3],
|
|
4298
|
+
}, be = [1800, 3e3], ut = function(n, e) {
|
|
4282
4299
|
e = e || {}, X((function() {
|
|
4283
4300
|
var t, s = De(), r = E("FCP"), i = U("paint", (function(o) {
|
|
4284
4301
|
o.forEach((function(c) {
|
|
@@ -4291,8 +4308,8 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4291
4308
|
}));
|
|
4292
4309
|
})));
|
|
4293
4310
|
}));
|
|
4294
|
-
}, Me = [0.1, 0.25],
|
|
4295
|
-
e = e || {},
|
|
4311
|
+
}, Me = [0.1, 0.25], Js = function(n, e) {
|
|
4312
|
+
e = e || {}, ut(oe((function() {
|
|
4296
4313
|
var t, s = E("CLS", 0), r = 0, i = [], o = function(l) {
|
|
4297
4314
|
l.forEach((function(u) {
|
|
4298
4315
|
if (!u.hadRecentInput) {
|
|
@@ -4309,19 +4326,19 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4309
4326
|
}));
|
|
4310
4327
|
})), setTimeout(t, 0));
|
|
4311
4328
|
})));
|
|
4312
|
-
},
|
|
4329
|
+
}, dt = 0, me = 1 / 0, K = 0, Zs = function(n) {
|
|
4313
4330
|
n.forEach((function(e) {
|
|
4314
|
-
e.interactionId && (me = Math.min(me, e.interactionId), K = Math.max(K, e.interactionId),
|
|
4331
|
+
e.interactionId && (me = Math.min(me, e.interactionId), K = Math.max(K, e.interactionId), dt = K ? (K - me) / 7 + 1 : 0);
|
|
4315
4332
|
}));
|
|
4316
|
-
},
|
|
4317
|
-
return Le ?
|
|
4318
|
-
},
|
|
4319
|
-
"interactionCount" in performance || Le || (Le = U("event",
|
|
4320
|
-
}, I = [], q = /* @__PURE__ */ new Map(),
|
|
4321
|
-
var n = Math.min(I.length - 1, Math.floor((
|
|
4333
|
+
}, ht = function() {
|
|
4334
|
+
return Le ? dt : performance.interactionCount || 0;
|
|
4335
|
+
}, en = function() {
|
|
4336
|
+
"interactionCount" in performance || Le || (Le = U("event", Zs, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
4337
|
+
}, I = [], q = /* @__PURE__ */ new Map(), ft = 0, tn = function() {
|
|
4338
|
+
var n = Math.min(I.length - 1, Math.floor((ht() - ft) / 50));
|
|
4322
4339
|
return I[n];
|
|
4323
|
-
},
|
|
4324
|
-
if (
|
|
4340
|
+
}, sn = [], nn = function(n) {
|
|
4341
|
+
if (sn.forEach((function(r) {
|
|
4325
4342
|
return r(n);
|
|
4326
4343
|
})), n.interactionId || n.entryType === "first-input") {
|
|
4327
4344
|
var e = I[I.length - 1], t = q.get(n.interactionId);
|
|
@@ -4338,27 +4355,27 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4338
4355
|
}));
|
|
4339
4356
|
}
|
|
4340
4357
|
}
|
|
4341
|
-
},
|
|
4358
|
+
}, gt = function(n) {
|
|
4342
4359
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
4343
4360
|
return n = oe(n), document.visibilityState === "hidden" ? n() : (t = e(n), B(n)), t;
|
|
4344
|
-
}, Ce = [200, 500],
|
|
4361
|
+
}, Ce = [200, 500], rn = function(n, e) {
|
|
4345
4362
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, X((function() {
|
|
4346
4363
|
var t;
|
|
4347
|
-
|
|
4364
|
+
en();
|
|
4348
4365
|
var s, r = E("INP"), i = function(c) {
|
|
4349
|
-
|
|
4350
|
-
c.forEach(
|
|
4351
|
-
var l =
|
|
4366
|
+
gt((function() {
|
|
4367
|
+
c.forEach(nn);
|
|
4368
|
+
var l = tn();
|
|
4352
4369
|
l && l.latency !== r.value && (r.value = l.latency, r.entries = l.entries, s());
|
|
4353
4370
|
}));
|
|
4354
4371
|
}, o = U("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
4355
4372
|
s = v(n, r, Ce, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), B((function() {
|
|
4356
4373
|
i(o.takeRecords()), s(!0);
|
|
4357
4374
|
})), N((function() {
|
|
4358
|
-
|
|
4375
|
+
ft = ht(), I.length = 0, q.clear(), r = E("INP"), s = v(n, r, Ce, e.reportAllChanges);
|
|
4359
4376
|
})));
|
|
4360
4377
|
})));
|
|
4361
|
-
}, Re = [2500, 4e3], pe = {},
|
|
4378
|
+
}, Re = [2500, 4e3], pe = {}, on = function(n, e) {
|
|
4362
4379
|
e = e || {}, X((function() {
|
|
4363
4380
|
var t, s = De(), r = E("LCP"), i = function(l) {
|
|
4364
4381
|
e.reportAllChanges || (l = l.slice(-1)), l.forEach((function(u) {
|
|
@@ -4372,7 +4389,7 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4372
4389
|
}));
|
|
4373
4390
|
["keydown", "click"].forEach((function(l) {
|
|
4374
4391
|
addEventListener(l, (function() {
|
|
4375
|
-
return
|
|
4392
|
+
return gt(c);
|
|
4376
4393
|
}), { once: !0, capture: !0 });
|
|
4377
4394
|
})), B(c), N((function(l) {
|
|
4378
4395
|
r = E("LCP"), t = v(n, r, Re, e.reportAllChanges), ke((function() {
|
|
@@ -4381,49 +4398,49 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4381
4398
|
}));
|
|
4382
4399
|
}
|
|
4383
4400
|
}));
|
|
4384
|
-
}, Ne = [800, 1800],
|
|
4401
|
+
}, Ne = [800, 1800], an = function n(e) {
|
|
4385
4402
|
document.prerendering ? X((function() {
|
|
4386
4403
|
return n(e);
|
|
4387
4404
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
4388
4405
|
return n(e);
|
|
4389
4406
|
}), !0) : setTimeout(e, 0);
|
|
4390
|
-
},
|
|
4407
|
+
}, cn = function(n, e) {
|
|
4391
4408
|
e = e || {};
|
|
4392
4409
|
var t = E("TTFB"), s = v(n, t, Ne, e.reportAllChanges);
|
|
4393
|
-
|
|
4410
|
+
an((function() {
|
|
4394
4411
|
var r = Pe();
|
|
4395
4412
|
r && (t.value = Math.max(r.responseStart - ie(), 0), t.entries = [r], s(!0), N((function() {
|
|
4396
4413
|
t = E("TTFB", 0), (s = v(n, t, Ne, e.reportAllChanges))(!0);
|
|
4397
4414
|
})));
|
|
4398
4415
|
}));
|
|
4399
|
-
}, H = { passive: !0, capture: !0 },
|
|
4400
|
-
b || (b = e, x = n,
|
|
4401
|
-
},
|
|
4402
|
-
if (x >= 0 && x <
|
|
4416
|
+
}, H = { passive: !0, capture: !0 }, ln = /* @__PURE__ */ new Date(), st = function(n, e) {
|
|
4417
|
+
b || (b = e, x = n, ct = /* @__PURE__ */ new Date(), pt(removeEventListener), mt());
|
|
4418
|
+
}, mt = function() {
|
|
4419
|
+
if (x >= 0 && x < ct - ln) {
|
|
4403
4420
|
var n = { entryType: "first-input", name: b.type, target: b.target, cancelable: b.cancelable, startTime: b.timeStamp, processingStart: b.timeStamp + x };
|
|
4404
4421
|
ne.forEach((function(e) {
|
|
4405
4422
|
e(n);
|
|
4406
4423
|
})), ne = [];
|
|
4407
4424
|
}
|
|
4408
|
-
},
|
|
4425
|
+
}, un = function(n) {
|
|
4409
4426
|
if (n.cancelable) {
|
|
4410
4427
|
var e = (n.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - n.timeStamp;
|
|
4411
4428
|
n.type == "pointerdown" ? (function(t, s) {
|
|
4412
4429
|
var r = function() {
|
|
4413
|
-
|
|
4430
|
+
st(t, s), o();
|
|
4414
4431
|
}, i = function() {
|
|
4415
4432
|
o();
|
|
4416
4433
|
}, o = function() {
|
|
4417
4434
|
removeEventListener("pointerup", r, H), removeEventListener("pointercancel", i, H);
|
|
4418
4435
|
};
|
|
4419
4436
|
addEventListener("pointerup", r, H), addEventListener("pointercancel", i, H);
|
|
4420
|
-
})(e, n) :
|
|
4437
|
+
})(e, n) : st(e, n);
|
|
4421
4438
|
}
|
|
4422
|
-
},
|
|
4439
|
+
}, pt = function(n) {
|
|
4423
4440
|
["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
|
|
4424
|
-
return n(e,
|
|
4441
|
+
return n(e, un, H);
|
|
4425
4442
|
}));
|
|
4426
|
-
}, Oe = [100, 300],
|
|
4443
|
+
}, Oe = [100, 300], dn = function(n, e) {
|
|
4427
4444
|
e = e || {}, X((function() {
|
|
4428
4445
|
var t, s = De(), r = E("FID"), i = function(l) {
|
|
4429
4446
|
l.startTime < s.firstHiddenTime && (r.value = l.processingStart - l.startTime, r.entries.push(l), t(!0));
|
|
@@ -4434,11 +4451,11 @@ var Le, b, x, at, ne, ct = -1, N = function(n) {
|
|
|
4434
4451
|
o(c.takeRecords()), c.disconnect();
|
|
4435
4452
|
}))), N((function() {
|
|
4436
4453
|
var l;
|
|
4437
|
-
r = E("FID"), t = v(n, r, Oe, e.reportAllChanges), ne = [], x = -1, b = null,
|
|
4454
|
+
r = E("FID"), t = v(n, r, Oe, e.reportAllChanges), ne = [], x = -1, b = null, pt(addEventListener), l = i, ne.push(l), mt();
|
|
4438
4455
|
})));
|
|
4439
4456
|
}));
|
|
4440
4457
|
};
|
|
4441
|
-
const
|
|
4458
|
+
const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4442
4459
|
__proto__: null,
|
|
4443
4460
|
CLSThresholds: Me,
|
|
4444
4461
|
FCPThresholds: be,
|
|
@@ -4446,44 +4463,44 @@ const un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4446
4463
|
INPThresholds: Ce,
|
|
4447
4464
|
LCPThresholds: Re,
|
|
4448
4465
|
TTFBThresholds: Ne,
|
|
4449
|
-
onCLS:
|
|
4450
|
-
onFCP:
|
|
4451
|
-
onFID:
|
|
4452
|
-
onINP:
|
|
4453
|
-
onLCP:
|
|
4454
|
-
onTTFB:
|
|
4466
|
+
onCLS: Js,
|
|
4467
|
+
onFCP: ut,
|
|
4468
|
+
onFID: dn,
|
|
4469
|
+
onINP: rn,
|
|
4470
|
+
onLCP: on,
|
|
4471
|
+
onTTFB: cn
|
|
4455
4472
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4456
4473
|
export {
|
|
4457
4474
|
m as AppConfigValidationError,
|
|
4458
|
-
|
|
4475
|
+
fn as DEFAULT_SESSION_TIMEOUT,
|
|
4459
4476
|
_e as DEFAULT_WEB_VITALS_MODE,
|
|
4460
4477
|
w as DeviceType,
|
|
4461
4478
|
D as EmitterEvent,
|
|
4462
4479
|
V as ErrorType,
|
|
4463
4480
|
d as EventType,
|
|
4464
|
-
|
|
4481
|
+
yn as InitializationTimeoutError,
|
|
4465
4482
|
Xe as IntegrationValidationError,
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4483
|
+
_n as MAX_ARRAY_LENGTH,
|
|
4484
|
+
Sn as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
4485
|
+
pn as MAX_CUSTOM_EVENT_KEYS,
|
|
4486
|
+
gn as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
4487
|
+
mn as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
4488
|
+
En as MAX_NESTED_OBJECT_KEYS,
|
|
4489
|
+
vn as MAX_STRING_LENGTH,
|
|
4490
|
+
Tn as MAX_STRING_LENGTH_IN_ARRAY,
|
|
4474
4491
|
ee as Mode,
|
|
4475
|
-
|
|
4492
|
+
as as PII_PATTERNS,
|
|
4476
4493
|
M as PermanentError,
|
|
4477
4494
|
J as RateLimitError,
|
|
4478
4495
|
Be as SamplingRateValidationError,
|
|
4479
4496
|
Ee as ScrollDirection,
|
|
4480
|
-
|
|
4497
|
+
At as SessionTimeoutValidationError,
|
|
4481
4498
|
F as SpecialApiUrl,
|
|
4482
4499
|
Z as TimeoutError,
|
|
4483
4500
|
$ as TraceLogValidationError,
|
|
4484
|
-
|
|
4501
|
+
In as WEB_VITALS_GOOD_THRESHOLDS,
|
|
4485
4502
|
ze as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
4486
|
-
|
|
4503
|
+
Kt as WEB_VITALS_POOR_THRESHOLDS,
|
|
4487
4504
|
Qe as getWebVitalsThresholds,
|
|
4488
|
-
|
|
4505
|
+
wn as tracelog
|
|
4489
4506
|
};
|