@tracelog/lib 3.1.0-rc.116.3 → 3.1.1-rc.118.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/tracelog.esm.js +214 -201
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +2 -2
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +2 -2
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +9 -0
- package/dist/public-api.d.ts +9 -0
- package/dist/public-api.js +2 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -67,8 +67,8 @@ const y = {
|
|
|
67
67
|
/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
|
68
68
|
/<embed\b[^>]*>/gi,
|
|
69
69
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
70
|
-
], g = "tlog",
|
|
71
|
-
var
|
|
70
|
+
], g = "tlog", Q = `${g}:qa_mode`, Ee = `${g}:uid`, nt = "tlog_mode", Fe = "qa", Ve = "qa_off", le = (n) => n ? `${g}:${n}:queue` : `${g}:queue`, ue = (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`, He = (n, e) => `${g}:${n}:session_counts:${e}`, xe = 10080 * 60 * 1e3, $e = `${g}:session_counts_last_cleanup`, Be = 3600 * 1e3, de = (n) => n ? `${g}:${n}:identity` : `${g}:identity`, O = `${g}:pending_identity`;
|
|
71
|
+
var V = /* @__PURE__ */ ((n) => (n.Localhost = "localhost:8080", n.Fail = "localhost:9999", n))(V || {}), 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) {
|
|
74
74
|
super(e), this.statusCode = t, this.responseCode = s, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, M);
|
|
@@ -76,51 +76,51 @@ class M extends Error {
|
|
|
76
76
|
statusCode;
|
|
77
77
|
responseCode;
|
|
78
78
|
}
|
|
79
|
-
class
|
|
79
|
+
class Z extends Error {
|
|
80
80
|
constructor(e) {
|
|
81
|
-
super(e), this.name = "RateLimitError", Error.captureStackTrace && Error.captureStackTrace(this,
|
|
81
|
+
super(e), this.name = "RateLimitError", Error.captureStackTrace && Error.captureStackTrace(this, Z);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class ee extends Error {
|
|
85
85
|
constructor(e) {
|
|
86
|
-
super(e), this.name = "TimeoutError", Error.captureStackTrace && Error.captureStackTrace(this,
|
|
86
|
+
super(e), this.name = "TimeoutError", Error.captureStackTrace && Error.captureStackTrace(this, ee);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
var d = /* @__PURE__ */ ((n) => (n.PAGE_VIEW = "page_view", n.CLICK = "click", n.SCROLL = "scroll", n.SESSION_START = "session_start", n.CUSTOM = "custom", n.WEB_VITALS = "web_vitals", n.ERROR = "error", n))(d || {}),
|
|
90
|
-
class
|
|
89
|
+
var d = /* @__PURE__ */ ((n) => (n.PAGE_VIEW = "page_view", n.CLICK = "click", n.SCROLL = "scroll", n.SESSION_START = "session_start", n.CUSTOM = "custom", n.WEB_VITALS = "web_vitals", n.ERROR = "error", n))(d || {}), ve = /* @__PURE__ */ ((n) => (n.UP = "up", n.DOWN = "down", n))(ve || {}), H = /* @__PURE__ */ ((n) => (n.JS_ERROR = "js_error", n.PROMISE_REJECTION = "promise_rejection", n))(H || {}), te = /* @__PURE__ */ ((n) => (n.QA = "qa", n))(te || {});
|
|
90
|
+
class B extends Error {
|
|
91
91
|
constructor(e, t, s) {
|
|
92
92
|
super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
93
93
|
}
|
|
94
94
|
errorCode;
|
|
95
95
|
layer;
|
|
96
96
|
}
|
|
97
|
-
class m extends
|
|
97
|
+
class m extends B {
|
|
98
98
|
constructor(e, t = "config") {
|
|
99
99
|
super(e, "APP_CONFIG_INVALID", t);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
class At extends
|
|
102
|
+
class At extends B {
|
|
103
103
|
constructor(e, t = "config") {
|
|
104
104
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
class
|
|
107
|
+
class Xe extends B {
|
|
108
108
|
constructor(e, t = "config") {
|
|
109
109
|
super(e, "SAMPLING_RATE_INVALID", t);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
class
|
|
112
|
+
class F extends B {
|
|
113
113
|
constructor(e, t = "config") {
|
|
114
114
|
super(e, "INTEGRATION_INVALID", t);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
class yn extends
|
|
117
|
+
class yn extends B {
|
|
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 Lt = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"],
|
|
123
|
+
const Lt = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], he = () => {
|
|
124
124
|
const n = new URLSearchParams(window.location.search), e = {};
|
|
125
125
|
return Lt.forEach((s) => {
|
|
126
126
|
const r = n.get(s);
|
|
@@ -149,7 +149,7 @@ const Lt = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], de = () => {
|
|
|
149
149
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
150
150
|
return !1;
|
|
151
151
|
try {
|
|
152
|
-
return sessionStorage.getItem(
|
|
152
|
+
return sessionStorage.getItem(Q) === "true";
|
|
153
153
|
} catch {
|
|
154
154
|
return !1;
|
|
155
155
|
}
|
|
@@ -157,12 +157,12 @@ const Lt = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], de = () => {
|
|
|
157
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
158
|
if (!Ot(c, i))
|
|
159
159
|
return;
|
|
160
|
-
const p = Pt(c, o), S = r !== void 0 ?
|
|
160
|
+
const p = Pt(c, o), S = r !== void 0 ? Te(r) : void 0;
|
|
161
161
|
kt(u, l, p, S);
|
|
162
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
|
+
}, Te = (n) => {
|
|
166
166
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
167
167
|
for (const [s, r] of Object.entries(n)) {
|
|
168
168
|
const i = s.toLowerCase();
|
|
@@ -170,16 +170,16 @@ const Lt = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], de = () => {
|
|
|
170
170
|
e[s] = "[REDACTED]";
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
|
-
r !== null && typeof r == "object" && !Array.isArray(r) ? e[s] =
|
|
174
|
-
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ?
|
|
173
|
+
r !== null && typeof r == "object" && !Array.isArray(r) ? e[s] = Te(r) : Array.isArray(r) ? e[s] = r.map(
|
|
174
|
+
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ? Te(o) : o
|
|
175
175
|
) : e[s] = r;
|
|
176
176
|
}
|
|
177
177
|
return e;
|
|
178
178
|
};
|
|
179
|
-
let
|
|
179
|
+
let _e, rt;
|
|
180
180
|
const Dt = () => {
|
|
181
|
-
typeof window < "u" && !
|
|
182
|
-
},
|
|
181
|
+
typeof window < "u" && !_e && (_e = window.matchMedia("(pointer: coarse)"), rt = window.matchMedia("(hover: none)"));
|
|
182
|
+
}, se = "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";
|
|
@@ -190,7 +190,7 @@ const Dt = () => {
|
|
|
190
190
|
if (/ios/i.test(e)) return "iOS";
|
|
191
191
|
}
|
|
192
192
|
const t = navigator.userAgent;
|
|
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" :
|
|
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" : se;
|
|
194
194
|
}, Ft = (n) => {
|
|
195
195
|
const e = n.userAgentData?.brands;
|
|
196
196
|
if (e != null && e.length > 0) {
|
|
@@ -201,7 +201,7 @@ const Dt = () => {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
const t = navigator.userAgent;
|
|
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" :
|
|
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" : se;
|
|
205
205
|
}, Vt = () => {
|
|
206
206
|
try {
|
|
207
207
|
const n = navigator;
|
|
@@ -210,7 +210,7 @@ const Dt = () => {
|
|
|
210
210
|
return l != null && l !== "" && /ipad|tablet/i.test(l) ? w.Tablet : n.userAgentData.mobile ? w.Mobile : w.Desktop;
|
|
211
211
|
}
|
|
212
212
|
Dt();
|
|
213
|
-
const e = window.innerWidth, t =
|
|
213
|
+
const e = window.innerWidth, t = _e?.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;
|
|
@@ -226,11 +226,11 @@ const Dt = () => {
|
|
|
226
226
|
} catch (n) {
|
|
227
227
|
return a("debug", "Device info detection failed, using defaults", { error: n }), {
|
|
228
228
|
type: w.Desktop,
|
|
229
|
-
os:
|
|
230
|
-
browser:
|
|
229
|
+
os: se,
|
|
230
|
+
browser: se
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
}, Ge = 500, We = 2e3, je = 5e3,
|
|
233
|
+
}, Ge = 500, We = 2e3, je = 5e3, Y = 50, xt = Y * 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,
|
|
@@ -248,7 +248,7 @@ const Dt = () => {
|
|
|
248
248
|
CLS: 0.25,
|
|
249
249
|
INP: 500,
|
|
250
250
|
TTFB: 1800
|
|
251
|
-
},
|
|
251
|
+
}, ye = "needs-improvement", Qe = (n = ye) => {
|
|
252
252
|
switch (n) {
|
|
253
253
|
case "all":
|
|
254
254
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0 };
|
|
@@ -259,7 +259,7 @@ const Dt = () => {
|
|
|
259
259
|
default:
|
|
260
260
|
return ze;
|
|
261
261
|
}
|
|
262
|
-
}, zt = 50, Qt = "3.1.
|
|
262
|
+
}, zt = 50, Qt = "3.1.1", Yt = Qt, qt = () => typeof window < "u" && typeof sessionStorage < "u", Jt = () => {
|
|
263
263
|
try {
|
|
264
264
|
const n = new URLSearchParams(window.location.search);
|
|
265
265
|
n.delete(nt);
|
|
@@ -271,15 +271,15 @@ const Dt = () => {
|
|
|
271
271
|
if (!qt())
|
|
272
272
|
return !1;
|
|
273
273
|
try {
|
|
274
|
-
const e = new URLSearchParams(window.location.search).get(nt), t = sessionStorage.getItem(
|
|
274
|
+
const e = new URLSearchParams(window.location.search).get(nt), t = sessionStorage.getItem(Q);
|
|
275
275
|
let s = null;
|
|
276
|
-
return e ===
|
|
276
|
+
return e === Fe ? (s = !0, sessionStorage.setItem(Q, "true"), a("info", "QA Mode ACTIVE", {
|
|
277
277
|
visibility: "qa",
|
|
278
278
|
style: bt
|
|
279
|
-
})) : e ===
|
|
279
|
+
})) : e === Ve && (s = !1, sessionStorage.setItem(Q, "false"), a("info", "QA Mode DISABLED", {
|
|
280
280
|
visibility: "qa",
|
|
281
281
|
style: Mt
|
|
282
|
-
})), (e ===
|
|
282
|
+
})), (e === Fe || e === Ve) && Jt(), s ?? t === "true";
|
|
283
283
|
} catch {
|
|
284
284
|
return !1;
|
|
285
285
|
}
|
|
@@ -301,7 +301,7 @@ const Dt = () => {
|
|
|
301
301
|
return n.toLowerCase();
|
|
302
302
|
const t = e.slice(-2).join(".");
|
|
303
303
|
return es.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
304
|
-
}, ts = (n, e) => n === e ? !0 : Ye(n) === Ye(e),
|
|
304
|
+
}, ts = (n, e) => n === e ? !0 : Ye(n) === Ye(e), fe = () => {
|
|
305
305
|
const n = document.referrer;
|
|
306
306
|
if (!n)
|
|
307
307
|
return "Direct";
|
|
@@ -311,7 +311,7 @@ const Dt = () => {
|
|
|
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
|
+
}, ge = () => {
|
|
315
315
|
const n = new URLSearchParams(window.location.search), e = {};
|
|
316
316
|
return Tt.forEach((s) => {
|
|
317
317
|
const r = n.get(s);
|
|
@@ -324,11 +324,11 @@ const Dt = () => {
|
|
|
324
324
|
const e = Math.random() * 16 | 0;
|
|
325
325
|
return (n === "x" ? e : e & 3 | 8).toString(16);
|
|
326
326
|
});
|
|
327
|
-
let
|
|
327
|
+
let j = 0, K = 0;
|
|
328
328
|
const ss = () => {
|
|
329
329
|
let n = Date.now();
|
|
330
|
-
n <
|
|
331
|
-
const e =
|
|
330
|
+
n < K && (n = K), n === K ? j = (j + 1) % 1e3 : j = 0, K = n;
|
|
331
|
+
const e = j.toString().padStart(3, "0");
|
|
332
332
|
let t = "";
|
|
333
333
|
try {
|
|
334
334
|
if (typeof crypto < "u" && crypto.getRandomValues) {
|
|
@@ -370,8 +370,8 @@ const ss = () => {
|
|
|
370
370
|
}
|
|
371
371
|
}, is = (n) => {
|
|
372
372
|
const e = {};
|
|
373
|
-
return n.integrations?.tracelog?.projectId && (e.saas = rs(n.integrations.tracelog.projectId)), e;
|
|
374
|
-
},
|
|
373
|
+
return n.integrations?.tracelog?.projectId && (e.saas = n.integrations.tracelog.collectUrl ?? rs(n.integrations.tracelog.projectId)), e;
|
|
374
|
+
}, Ie = (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 {
|
|
@@ -400,7 +400,7 @@ const ss = () => {
|
|
|
400
400
|
valueLength: n.length
|
|
401
401
|
}
|
|
402
402
|
}), e.trim();
|
|
403
|
-
},
|
|
403
|
+
}, we = (n, e = 0) => {
|
|
404
404
|
if (n == null)
|
|
405
405
|
return null;
|
|
406
406
|
if (typeof n == "string")
|
|
@@ -412,13 +412,13 @@ const ss = () => {
|
|
|
412
412
|
if (e > 10)
|
|
413
413
|
return null;
|
|
414
414
|
if (Array.isArray(n))
|
|
415
|
-
return n.slice(0, 1e3).map((r) =>
|
|
415
|
+
return n.slice(0, 1e3).map((r) => we(r, e + 1)).filter((r) => r !== null);
|
|
416
416
|
if (typeof n == "object") {
|
|
417
417
|
const t = {}, r = Object.entries(n).slice(0, 200);
|
|
418
418
|
for (const [i, o] of r) {
|
|
419
419
|
const c = qe(i);
|
|
420
420
|
if (c) {
|
|
421
|
-
const l =
|
|
421
|
+
const l = we(o, e + 1);
|
|
422
422
|
l !== null && (t[c] = l);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
@@ -429,7 +429,7 @@ const ss = () => {
|
|
|
429
429
|
if (typeof n != "object" || n === null)
|
|
430
430
|
return {};
|
|
431
431
|
try {
|
|
432
|
-
const e =
|
|
432
|
+
const e = we(n);
|
|
433
433
|
return typeof e == "object" && e !== null ? e : {};
|
|
434
434
|
} catch (e) {
|
|
435
435
|
const t = e instanceof Error ? e.message : String(e);
|
|
@@ -456,7 +456,7 @@ const ss = () => {
|
|
|
456
456
|
/:\/\/[^:/]+:([^@]+)@/gi,
|
|
457
457
|
// Sensitive URL query parameters (token=, password=, auth=, secret=, api_key=, …)
|
|
458
458
|
/[?&](token|password|passwd|auth|secret|secret_key|private_key|auth_key|api_key|apikey|access_token)=[^&\s]+/gi
|
|
459
|
-
],
|
|
459
|
+
], q = (n) => {
|
|
460
460
|
let e = n;
|
|
461
461
|
for (const t of as)
|
|
462
462
|
e = e.replace(t, "[REDACTED]");
|
|
@@ -477,9 +477,9 @@ const ss = () => {
|
|
|
477
477
|
throw new m("All sensitive query params must be strings", "config");
|
|
478
478
|
}
|
|
479
479
|
if (n.errorSampling !== void 0 && (typeof n.errorSampling != "number" || n.errorSampling < 0 || n.errorSampling > 1))
|
|
480
|
-
throw new
|
|
480
|
+
throw new Xe(y.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
481
481
|
if (n.samplingRate !== void 0 && (typeof n.samplingRate != "number" || n.samplingRate < 0 || n.samplingRate > 1))
|
|
482
|
-
throw new
|
|
482
|
+
throw new Xe(y.INVALID_SAMPLING_RATE, "config");
|
|
483
483
|
if (n.pageViewThrottleMs !== void 0 && (typeof n.pageViewThrottleMs != "number" || n.pageViewThrottleMs < 0))
|
|
484
484
|
throw new m(y.INVALID_PAGE_VIEW_THROTTLE, "config");
|
|
485
485
|
if (n.clickThrottleMs !== void 0 && (typeof n.clickThrottleMs != "number" || n.clickThrottleMs < 0))
|
|
@@ -532,9 +532,22 @@ const ss = () => {
|
|
|
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
|
-
throw new
|
|
535
|
+
throw new F(y.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
536
536
|
if (n.tracelog.shopify !== void 0 && typeof n.tracelog.shopify != "boolean")
|
|
537
|
-
throw new
|
|
537
|
+
throw new F("tracelog.shopify must be a boolean", "config");
|
|
538
|
+
if (n.tracelog.collectUrl !== void 0) {
|
|
539
|
+
const e = "tracelog.collectUrl must be a non-empty HTTPS URL", { collectUrl: t } = n.tracelog;
|
|
540
|
+
if (typeof t != "string" || t.trim() === "")
|
|
541
|
+
throw new F(e, "config");
|
|
542
|
+
let s;
|
|
543
|
+
try {
|
|
544
|
+
s = new URL(t);
|
|
545
|
+
} catch {
|
|
546
|
+
throw new F(e, "config");
|
|
547
|
+
}
|
|
548
|
+
if (s.protocol !== "https:")
|
|
549
|
+
throw new F(e, "config");
|
|
550
|
+
}
|
|
538
551
|
}
|
|
539
552
|
}, us = (n) => (cs(n), {
|
|
540
553
|
...n ?? {},
|
|
@@ -549,12 +562,12 @@ const ss = () => {
|
|
|
549
562
|
sendIntervalMs: n?.sendIntervalMs ?? 1e4,
|
|
550
563
|
flushOnSpaNavigation: n?.flushOnSpaNavigation ?? !1,
|
|
551
564
|
flushOnPageHidden: n?.flushOnPageHidden ?? !0
|
|
552
|
-
}),
|
|
565
|
+
}), Ae = (n, e = /* @__PURE__ */ new Set()) => {
|
|
553
566
|
if (n == null)
|
|
554
567
|
return !0;
|
|
555
568
|
const t = typeof n;
|
|
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) =>
|
|
557
|
-
}, ds = (n) => typeof n != "object" || n === null ? !1 :
|
|
569
|
+
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) => Ae(s, e)) : t === "object" ? Object.values(n).every((s) => Ae(s, e)) : !1);
|
|
570
|
+
}, ds = (n) => typeof n != "object" || n === null ? !1 : Ae(n), Le = (n) => {
|
|
558
571
|
if (typeof n != "object" || n === null || Array.isArray(n)) return;
|
|
559
572
|
const e = {};
|
|
560
573
|
for (const [t, s] of Object.entries(n))
|
|
@@ -807,25 +820,25 @@ function Is(n) {
|
|
|
807
820
|
const e = _s(n.message), t = ys(n.filename, n.page_url), s = n.line == null ? "" : String(n.line);
|
|
808
821
|
return `${e}|${t}|${s}`;
|
|
809
822
|
}
|
|
810
|
-
const
|
|
823
|
+
const me = { config: {} };
|
|
811
824
|
class T {
|
|
812
825
|
/**
|
|
813
826
|
* Retrieves a value from global state.
|
|
814
827
|
*/
|
|
815
828
|
get(e) {
|
|
816
|
-
return
|
|
829
|
+
return me[e];
|
|
817
830
|
}
|
|
818
831
|
/**
|
|
819
832
|
* Sets a value in global state.
|
|
820
833
|
*/
|
|
821
834
|
set(e, t) {
|
|
822
|
-
|
|
835
|
+
me[e] = t;
|
|
823
836
|
}
|
|
824
837
|
/**
|
|
825
838
|
* Returns an immutable snapshot of the entire global state.
|
|
826
839
|
*/
|
|
827
840
|
getState() {
|
|
828
|
-
return { ...
|
|
841
|
+
return { ...me };
|
|
829
842
|
}
|
|
830
843
|
}
|
|
831
844
|
class ws extends T {
|
|
@@ -873,7 +886,7 @@ class ws extends T {
|
|
|
873
886
|
* cases so the migration is one-shot per browser.
|
|
874
887
|
*/
|
|
875
888
|
migrateLegacyV2Keys() {
|
|
876
|
-
const e = this.get("userId") || "anonymous", t = `${
|
|
889
|
+
const e = this.get("userId") || "anonymous", t = `${le(e)}:saas`, s = `${le(e)}:custom`, r = `${ue(e)}:saas`, i = `${ue(e)}:custom`;
|
|
877
890
|
try {
|
|
878
891
|
const o = this.storeManager.getItem(t);
|
|
879
892
|
if (o) {
|
|
@@ -919,11 +932,11 @@ class ws extends T {
|
|
|
919
932
|
}
|
|
920
933
|
getQueueStorageKey() {
|
|
921
934
|
const e = this.get("userId") || "anonymous";
|
|
922
|
-
return
|
|
935
|
+
return le(e);
|
|
923
936
|
}
|
|
924
937
|
getRateLimitStorageKey() {
|
|
925
938
|
const e = this.get("userId") || "anonymous";
|
|
926
|
-
return
|
|
939
|
+
return ue(e);
|
|
927
940
|
}
|
|
928
941
|
getActiveRateLimitKey() {
|
|
929
942
|
return this.rateLimitStorageKeyAtArm ?? this.getRateLimitStorageKey();
|
|
@@ -991,7 +1004,7 @@ class ws extends T {
|
|
|
991
1004
|
const t = this.ensureBatchMetadata(e), s = this.getPersistedData(), r = typeof s?.recoveryFailures == "number" && Number.isFinite(s.recoveryFailures) ? s.recoveryFailures : 0;
|
|
992
1005
|
return this.persistEventsWithFailureCount(t, r, !0), !1;
|
|
993
1006
|
}
|
|
994
|
-
return this.apiUrl.includes(
|
|
1007
|
+
return this.apiUrl.includes(V.Fail) ? (a("warn", "Fail mode: simulating network failure (sync)", { data: { events: e.events.length } }), !1) : this.apiUrl.includes(V.Localhost) ? (a("debug", "Success mode: simulating successful send (sync)", { data: { events: e.events.length } }), !0) : this.sendQueueSyncInternal(e);
|
|
995
1008
|
}
|
|
996
1009
|
/**
|
|
997
1010
|
* Sends events asynchronously using `fetch()` with retry, circuit breaker, and 429 cooldown.
|
|
@@ -1062,9 +1075,9 @@ class ws extends T {
|
|
|
1062
1075
|
}
|
|
1063
1076
|
async send(e) {
|
|
1064
1077
|
const t = this.ensureBatchMetadata(e, e._metadata?.idempotency_token);
|
|
1065
|
-
if (this.apiUrl.includes(
|
|
1078
|
+
if (this.apiUrl.includes(V.Fail))
|
|
1066
1079
|
return a("debug", "Fail mode: simulating network failure", { data: { events: t.events.length } }), !1;
|
|
1067
|
-
if (this.apiUrl.includes(
|
|
1080
|
+
if (this.apiUrl.includes(V.Localhost))
|
|
1068
1081
|
return a("debug", "Success mode: simulating successful send", { data: { events: t.events.length } }), !0;
|
|
1069
1082
|
if (this.isRateLimited())
|
|
1070
1083
|
return a("debug", "Rate-limit cooldown active, skipping send", {
|
|
@@ -1094,13 +1107,13 @@ class ws extends T {
|
|
|
1094
1107
|
const u = c === 3;
|
|
1095
1108
|
if (l instanceof M)
|
|
1096
1109
|
throw this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, l;
|
|
1097
|
-
if (l instanceof
|
|
1110
|
+
if (l instanceof Z) {
|
|
1098
1111
|
this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, i = !1, o = !0, this.armRateLimitCooldown(Date.now() + 6e4), a("warn", "Rate limited, skipping retries", {
|
|
1099
1112
|
data: { events: e.events.length, attempt: c, cooldownMs: 6e4 }
|
|
1100
1113
|
});
|
|
1101
1114
|
break;
|
|
1102
1115
|
}
|
|
1103
|
-
if (l instanceof
|
|
1116
|
+
if (l instanceof ee || (i = !1), l instanceof TypeError || (o = !0), a(
|
|
1104
1117
|
u ? "error" : "warn",
|
|
1105
1118
|
`Send attempt ${c} failed${u ? " (all retries exhausted)" : ", will retry"}`,
|
|
1106
1119
|
{
|
|
@@ -1148,11 +1161,11 @@ class ws extends T {
|
|
|
1148
1161
|
const l = await this.readTraceLogErrorCode(o), u = l ? `HTTP ${o.status}: ${o.statusText} (${l})` : `HTTP ${o.status}: ${o.statusText}`;
|
|
1149
1162
|
throw new M(u, o.status, l);
|
|
1150
1163
|
}
|
|
1151
|
-
throw o.status === 429 ? new
|
|
1164
|
+
throw o.status === 429 ? new Z(`HTTP 429: ${o.statusText}`) : new Error(`HTTP ${o.status}: ${o.statusText}`);
|
|
1152
1165
|
}
|
|
1153
1166
|
return o;
|
|
1154
1167
|
} catch (o) {
|
|
1155
|
-
throw o instanceof M ? o : r ? new
|
|
1168
|
+
throw o instanceof M ? o : r ? new ee("Request timed out") : o;
|
|
1156
1169
|
} finally {
|
|
1157
1170
|
clearTimeout(i), this.pendingControllers.delete(s);
|
|
1158
1171
|
}
|
|
@@ -1514,12 +1527,12 @@ class bs extends T {
|
|
|
1514
1527
|
}
|
|
1515
1528
|
const _ = this.getTypeLimitForEvent(S);
|
|
1516
1529
|
if (_) {
|
|
1517
|
-
const
|
|
1518
|
-
if (
|
|
1530
|
+
const ce = this.sessionEventCounts[S];
|
|
1531
|
+
if (ce !== void 0 && ce >= _) {
|
|
1519
1532
|
a("warn", "Session event type limit reached", {
|
|
1520
1533
|
data: {
|
|
1521
1534
|
type: S,
|
|
1522
|
-
count:
|
|
1535
|
+
count: ce,
|
|
1523
1536
|
limit: _
|
|
1524
1537
|
}
|
|
1525
1538
|
});
|
|
@@ -1532,7 +1545,7 @@ class bs extends T {
|
|
|
1532
1545
|
if (!this.checkPerEventRateLimit(o.name, _))
|
|
1533
1546
|
return;
|
|
1534
1547
|
}
|
|
1535
|
-
const St = S === d.SESSION_START, Et = t || this.get("pageUrl"),
|
|
1548
|
+
const St = S === d.SESSION_START, Et = t || this.get("pageUrl"), W = this.buildEventPayload({
|
|
1536
1549
|
type: S,
|
|
1537
1550
|
page_url: Et,
|
|
1538
1551
|
from_page_url: s,
|
|
@@ -1543,7 +1556,7 @@ class bs extends T {
|
|
|
1543
1556
|
error_data: l,
|
|
1544
1557
|
page_view: u
|
|
1545
1558
|
});
|
|
1546
|
-
if (
|
|
1559
|
+
if (W && !(!p && !this.shouldSample())) {
|
|
1547
1560
|
if (St) {
|
|
1548
1561
|
const _ = this.get("sessionId");
|
|
1549
1562
|
if (!_) {
|
|
@@ -1558,18 +1571,18 @@ class bs extends T {
|
|
|
1558
1571
|
}
|
|
1559
1572
|
this.set("hasStartSession", !0);
|
|
1560
1573
|
}
|
|
1561
|
-
if (!this.isDuplicateEvent(
|
|
1562
|
-
if (this.get("mode") ===
|
|
1574
|
+
if (!this.isDuplicateEvent(W)) {
|
|
1575
|
+
if (this.get("mode") === te.QA && S === d.CUSTOM && o) {
|
|
1563
1576
|
a("info", `Custom Event: ${o.name}`, {
|
|
1564
1577
|
visibility: "qa",
|
|
1565
1578
|
data: {
|
|
1566
1579
|
name: o.name,
|
|
1567
1580
|
...o.metadata && { metadata: o.metadata }
|
|
1568
1581
|
}
|
|
1569
|
-
}), this.emitEvent(
|
|
1582
|
+
}), this.emitEvent(W);
|
|
1570
1583
|
return;
|
|
1571
1584
|
}
|
|
1572
|
-
if (this.addToQueue(
|
|
1585
|
+
if (this.addToQueue(W), !p) {
|
|
1573
1586
|
this.sessionEventCounts.total++, this.sessionEventCounts[S] !== void 0 && this.sessionEventCounts[S]++;
|
|
1574
1587
|
const _ = this.get("sessionId");
|
|
1575
1588
|
_ && this.saveSessionCountsDebounced && this.saveSessionCountsDebounced(_);
|
|
@@ -2214,13 +2227,13 @@ class bs extends T {
|
|
|
2214
2227
|
loadSessionCounts(e) {
|
|
2215
2228
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
2216
2229
|
return this.getInitialCounts();
|
|
2217
|
-
const t = this.get("userId") || "anonymous", s =
|
|
2230
|
+
const t = this.get("userId") || "anonymous", s = He(t, e);
|
|
2218
2231
|
try {
|
|
2219
2232
|
const r = localStorage.getItem(s);
|
|
2220
2233
|
if (!r)
|
|
2221
2234
|
return this.getInitialCounts();
|
|
2222
2235
|
const i = JSON.parse(r);
|
|
2223
|
-
return i._timestamp && Date.now() - i._timestamp >
|
|
2236
|
+
return i._timestamp && Date.now() - i._timestamp > xe ? (a("debug", "Session counts expired, clearing", {
|
|
2224
2237
|
data: { sessionId: e, age: Date.now() - i._timestamp }
|
|
2225
2238
|
}), localStorage.removeItem(s), this.getInitialCounts()) : typeof i.total == "number" && typeof i[d.CLICK] == "number" && typeof i[d.PAGE_VIEW] == "number" && typeof i[d.CUSTOM] == "number" && typeof i[d.SCROLL] == "number" ? {
|
|
2226
2239
|
total: i.total,
|
|
@@ -2264,12 +2277,12 @@ class bs extends T {
|
|
|
2264
2277
|
cleanupExpiredSessionCounts() {
|
|
2265
2278
|
if (!(typeof window > "u" || typeof localStorage > "u"))
|
|
2266
2279
|
try {
|
|
2267
|
-
const e = localStorage.getItem(
|
|
2280
|
+
const e = localStorage.getItem($e);
|
|
2268
2281
|
if (e) {
|
|
2269
2282
|
const i = Date.now() - parseInt(e, 10);
|
|
2270
|
-
if (i <
|
|
2283
|
+
if (i < Be) {
|
|
2271
2284
|
a("debug", "Skipping session counts cleanup (throttled)", {
|
|
2272
|
-
data: { timeSinceLastCleanup: i, throttleMs:
|
|
2285
|
+
data: { timeSinceLastCleanup: i, throttleMs: Be }
|
|
2273
2286
|
});
|
|
2274
2287
|
return;
|
|
2275
2288
|
}
|
|
@@ -2282,14 +2295,14 @@ class bs extends T {
|
|
|
2282
2295
|
const c = localStorage.getItem(o);
|
|
2283
2296
|
if (c) {
|
|
2284
2297
|
const l = JSON.parse(c);
|
|
2285
|
-
l._timestamp && Date.now() - l._timestamp >
|
|
2298
|
+
l._timestamp && Date.now() - l._timestamp > xe && r.push(o);
|
|
2286
2299
|
}
|
|
2287
2300
|
} catch {
|
|
2288
2301
|
}
|
|
2289
2302
|
}
|
|
2290
2303
|
r.forEach((i) => {
|
|
2291
2304
|
localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
|
|
2292
|
-
}), r.length > 0 && a("info", `Cleaned up ${r.length} expired session counts entries`), localStorage.setItem(
|
|
2305
|
+
}), r.length > 0 && a("info", `Cleaned up ${r.length} expired session counts entries`), localStorage.setItem($e, Date.now().toString());
|
|
2293
2306
|
} catch (e) {
|
|
2294
2307
|
a("warn", "Failed to cleanup expired session counts", { error: e });
|
|
2295
2308
|
}
|
|
@@ -2323,7 +2336,7 @@ class bs extends T {
|
|
|
2323
2336
|
* @internal
|
|
2324
2337
|
*/
|
|
2325
2338
|
saveSessionCounts(e) {
|
|
2326
|
-
const t = this.get("userId") || "anonymous", s =
|
|
2339
|
+
const t = this.get("userId") || "anonymous", s = He(t, e);
|
|
2327
2340
|
try {
|
|
2328
2341
|
const r = {
|
|
2329
2342
|
...this.sessionEventCounts,
|
|
@@ -2357,11 +2370,11 @@ class Ms {
|
|
|
2357
2370
|
* @returns Persistent unique user ID (UUID v4 format)
|
|
2358
2371
|
*/
|
|
2359
2372
|
static getId(e) {
|
|
2360
|
-
const t = e.getItem(
|
|
2373
|
+
const t = e.getItem(Ee);
|
|
2361
2374
|
if (t)
|
|
2362
2375
|
return t;
|
|
2363
2376
|
const s = at();
|
|
2364
|
-
return e.setItem(
|
|
2377
|
+
return e.setItem(Ee, s), s;
|
|
2365
2378
|
}
|
|
2366
2379
|
}
|
|
2367
2380
|
const Cs = /^\d{13}-[a-z0-9]{9}$/;
|
|
@@ -2536,9 +2549,9 @@ class Rs extends T {
|
|
|
2536
2549
|
let s, r, i;
|
|
2537
2550
|
if (e) {
|
|
2538
2551
|
const o = this.loadStoredSession();
|
|
2539
|
-
s = o?.referrer ??
|
|
2552
|
+
s = o?.referrer ?? fe(), r = o?.utm ?? ge(), i = o?.clickIds ?? he();
|
|
2540
2553
|
} else
|
|
2541
|
-
s =
|
|
2554
|
+
s = fe(), r = ge(), i = he();
|
|
2542
2555
|
a("debug", "Session tracking initialized", {
|
|
2543
2556
|
data: {
|
|
2544
2557
|
sessionId: t,
|
|
@@ -2610,7 +2623,7 @@ class Rs extends T {
|
|
|
2610
2623
|
*/
|
|
2611
2624
|
renewSession() {
|
|
2612
2625
|
this.needsRenewal = !1;
|
|
2613
|
-
const e = this.generateSessionId(), t =
|
|
2626
|
+
const e = this.generateSessionId(), t = fe(), s = ge(), r = he();
|
|
2614
2627
|
a("debug", "Renewing session after timeout", {
|
|
2615
2628
|
data: { newSessionId: e }
|
|
2616
2629
|
}), this.set("sessionId", e), this.set("sessionReferrer", t), this.set("sessionUtm", s), this.set("sessionClickIds", r), this.persistSession(e, Date.now(), t, s, r), this.cleanupCrossTabSync(), this.initCrossTabSync(), this.shareSession(e), this.eventManager.track({
|
|
@@ -2868,7 +2881,7 @@ class Os extends T {
|
|
|
2868
2881
|
};
|
|
2869
2882
|
}
|
|
2870
2883
|
trackCurrentPage = () => {
|
|
2871
|
-
const e = window.location.href, t =
|
|
2884
|
+
const e = window.location.href, t = Ie(e, this.get("config").sensitiveQueryParams);
|
|
2872
2885
|
if (this.get("pageUrl") === t)
|
|
2873
2886
|
return;
|
|
2874
2887
|
const s = Date.now(), r = this.get("config").pageViewThrottleMs ?? 1e3;
|
|
@@ -2886,7 +2899,7 @@ class Os extends T {
|
|
|
2886
2899
|
}), this.get("config").flushOnSpaNavigation === !0 && this.eventManager.flushImmediately();
|
|
2887
2900
|
};
|
|
2888
2901
|
trackInitialPageView() {
|
|
2889
|
-
const e =
|
|
2902
|
+
const e = Ie(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
|
|
2890
2903
|
this.lastPageViewTime = Date.now(), this.eventManager.track({
|
|
2891
2904
|
type: d.PAGE_VIEW,
|
|
2892
2905
|
page_url: e,
|
|
@@ -3087,7 +3100,7 @@ class Ps extends T {
|
|
|
3087
3100
|
if (!s && !r)
|
|
3088
3101
|
return "";
|
|
3089
3102
|
let i = "";
|
|
3090
|
-
return s && s.length <= 255 ? i = s : r.length <= 255 ? i = r : i = r.slice(0, 252) + "...",
|
|
3103
|
+
return s && s.length <= 255 ? i = s : r.length <= 255 ? i = r : i = r.slice(0, 252) + "...", q(i);
|
|
3091
3104
|
}
|
|
3092
3105
|
createCustomEventData(e) {
|
|
3093
3106
|
return {
|
|
@@ -3222,7 +3235,7 @@ class ks extends T {
|
|
|
3222
3235
|
e.debounceTimer !== null && (clearTimeout(e.debounceTimer), e.debounceTimer = null);
|
|
3223
3236
|
}
|
|
3224
3237
|
getScrollDirection(e, t) {
|
|
3225
|
-
return e > t ?
|
|
3238
|
+
return e > t ? ve.DOWN : ve.UP;
|
|
3226
3239
|
}
|
|
3227
3240
|
calculateScrollDepth(e, t, s) {
|
|
3228
3241
|
if (t <= s)
|
|
@@ -3434,7 +3447,7 @@ class Hs extends T {
|
|
|
3434
3447
|
navigationCounter = 0;
|
|
3435
3448
|
// Counter for handling simultaneous navigations edge case
|
|
3436
3449
|
constructor(e) {
|
|
3437
|
-
super(), this.eventManager = e, this.vitalThresholds = Qe(
|
|
3450
|
+
super(), this.eventManager = e, this.vitalThresholds = Qe(ye);
|
|
3438
3451
|
}
|
|
3439
3452
|
/**
|
|
3440
3453
|
* Starts tracking Web Vitals and performance metrics.
|
|
@@ -3450,7 +3463,7 @@ class Hs extends T {
|
|
|
3450
3463
|
* @returns Promise that resolves when tracking is initialized
|
|
3451
3464
|
*/
|
|
3452
3465
|
async startTracking() {
|
|
3453
|
-
const e = this.get("config"), t = e?.webVitalsMode ??
|
|
3466
|
+
const e = this.get("config"), t = e?.webVitalsMode ?? ye;
|
|
3454
3467
|
this.vitalThresholds = Qe(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals();
|
|
3455
3468
|
}
|
|
3456
3469
|
/**
|
|
@@ -3642,7 +3655,7 @@ class Hs extends T {
|
|
|
3642
3655
|
return !(typeof s == "number" && t <= s);
|
|
3643
3656
|
}
|
|
3644
3657
|
}
|
|
3645
|
-
class
|
|
3658
|
+
class ne extends T {
|
|
3646
3659
|
eventManager;
|
|
3647
3660
|
emitter;
|
|
3648
3661
|
recentErrors = /* @__PURE__ */ new Map();
|
|
@@ -3728,7 +3741,7 @@ class se extends T {
|
|
|
3728
3741
|
if (!this.shouldSample())
|
|
3729
3742
|
return;
|
|
3730
3743
|
const t = this.sanitize(e.message || "Unknown error");
|
|
3731
|
-
if (this.shouldSuppressError(
|
|
3744
|
+
if (this.shouldSuppressError(H.JS_ERROR, t) || this.shouldThrottleBySignature({
|
|
3732
3745
|
message: t,
|
|
3733
3746
|
filename: e.filename,
|
|
3734
3747
|
line: e.lineno,
|
|
@@ -3743,7 +3756,7 @@ class se extends T {
|
|
|
3743
3756
|
this.eventManager.track({
|
|
3744
3757
|
type: d.ERROR,
|
|
3745
3758
|
error_data: {
|
|
3746
|
-
type:
|
|
3759
|
+
type: H.JS_ERROR,
|
|
3747
3760
|
message: t,
|
|
3748
3761
|
...r !== void 0 && { name: r },
|
|
3749
3762
|
...e.filename !== "" && { filename: e.filename },
|
|
@@ -3757,13 +3770,13 @@ class se extends T {
|
|
|
3757
3770
|
if (!this.shouldSample())
|
|
3758
3771
|
return;
|
|
3759
3772
|
const t = this.extractRejectionMessage(e.reason), s = this.sanitize(t);
|
|
3760
|
-
if (this.shouldSuppressError(
|
|
3773
|
+
if (this.shouldSuppressError(H.PROMISE_REJECTION, s) || this.shouldThrottleBySignature({ message: s }))
|
|
3761
3774
|
return;
|
|
3762
3775
|
const r = e.reason instanceof Error && typeof e.reason.stack == "string" ? this.truncateStack(e.reason.stack) : void 0, i = e.reason instanceof Error && e.reason.name !== "Error" ? e.reason.name : void 0;
|
|
3763
3776
|
this.eventManager.track({
|
|
3764
3777
|
type: d.ERROR,
|
|
3765
3778
|
error_data: {
|
|
3766
|
-
type:
|
|
3779
|
+
type: H.PROMISE_REJECTION,
|
|
3767
3780
|
message: s,
|
|
3768
3781
|
...i !== void 0 && { name: i },
|
|
3769
3782
|
...r !== void 0 && { stack: r }
|
|
@@ -3785,26 +3798,26 @@ class se extends T {
|
|
|
3785
3798
|
}
|
|
3786
3799
|
sanitize(e) {
|
|
3787
3800
|
const t = e.length > Ge ? e.slice(0, Ge) + "..." : e;
|
|
3788
|
-
return
|
|
3801
|
+
return q(t);
|
|
3789
3802
|
}
|
|
3790
3803
|
shouldSuppressError(e, t) {
|
|
3791
3804
|
const s = Date.now(), r = `${e}:${t}`, i = this.recentErrors.get(r);
|
|
3792
|
-
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 >
|
|
3805
|
+
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 > Y && this.pruneOldErrors(), !1));
|
|
3793
3806
|
}
|
|
3794
3807
|
static TRUNCATION_SUFFIX = `
|
|
3795
3808
|
...truncated`;
|
|
3796
3809
|
truncateStack(e) {
|
|
3797
|
-
if (e.length <= We) return
|
|
3798
|
-
const t = We -
|
|
3799
|
-
return
|
|
3810
|
+
if (e.length <= We) return q(e);
|
|
3811
|
+
const t = We - ne.TRUNCATION_SUFFIX.length, s = e.slice(0, t) + ne.TRUNCATION_SUFFIX;
|
|
3812
|
+
return q(s);
|
|
3800
3813
|
}
|
|
3801
3814
|
pruneOldErrors() {
|
|
3802
3815
|
const e = Date.now();
|
|
3803
3816
|
for (const [r, i] of this.recentErrors.entries())
|
|
3804
3817
|
e - i > je && this.recentErrors.delete(r);
|
|
3805
|
-
if (this.recentErrors.size <=
|
|
3818
|
+
if (this.recentErrors.size <= Y)
|
|
3806
3819
|
return;
|
|
3807
|
-
const t = Array.from(this.recentErrors.entries()).sort((r, i) => r[1] - i[1]), s = this.recentErrors.size -
|
|
3820
|
+
const t = Array.from(this.recentErrors.entries()).sort((r, i) => r[1] - i[1]), s = this.recentErrors.size - Y;
|
|
3808
3821
|
for (let r = 0; r < s; r += 1) {
|
|
3809
3822
|
const i = t[r];
|
|
3810
3823
|
i && this.recentErrors.delete(i[0]);
|
|
@@ -3858,7 +3871,7 @@ class xs extends T {
|
|
|
3858
3871
|
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
3859
3872
|
const { valid: i, error: o, sanitizedMetadata: c } = gs(e, r);
|
|
3860
3873
|
if (!i) {
|
|
3861
|
-
if (this.get("mode") ===
|
|
3874
|
+
if (this.get("mode") === te.QA)
|
|
3862
3875
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${o}`);
|
|
3863
3876
|
a("warn", `Custom event "${e}" dropped: ${o}`);
|
|
3864
3877
|
return;
|
|
@@ -3901,8 +3914,8 @@ class xs extends T {
|
|
|
3901
3914
|
this.set("collectApiUrls", s);
|
|
3902
3915
|
const r = Ht();
|
|
3903
3916
|
this.set("device", r);
|
|
3904
|
-
const i =
|
|
3905
|
-
this.set("pageUrl", i), Zt() && this.set("mode",
|
|
3917
|
+
const i = Ie(window.location.href, e.sensitiveQueryParams);
|
|
3918
|
+
this.set("pageUrl", i), Zt() && this.set("mode", te.QA);
|
|
3906
3919
|
}
|
|
3907
3920
|
/**
|
|
3908
3921
|
* @internal Used by api.ts for configuration access
|
|
@@ -3957,7 +3970,7 @@ class xs extends T {
|
|
|
3957
3970
|
a("warn", "identify() userId exceeds 256 characters", { data: { length: e.trim().length } });
|
|
3958
3971
|
return;
|
|
3959
3972
|
}
|
|
3960
|
-
const s = e.trim(), r =
|
|
3973
|
+
const s = e.trim(), r = Le(t), i = {
|
|
3961
3974
|
userId: s,
|
|
3962
3975
|
...r ? { traits: r } : {}
|
|
3963
3976
|
};
|
|
@@ -3981,7 +3994,7 @@ class xs extends T {
|
|
|
3981
3994
|
async resetIdentity() {
|
|
3982
3995
|
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();
|
|
3983
3996
|
const e = at();
|
|
3984
|
-
this.managers.storage.setItem(
|
|
3997
|
+
this.managers.storage.setItem(Ee, 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");
|
|
3985
3998
|
}
|
|
3986
3999
|
/**
|
|
3987
4000
|
* Returns the project ID used for identity storage scoping.
|
|
@@ -3994,7 +4007,7 @@ class xs extends T {
|
|
|
3994
4007
|
*/
|
|
3995
4008
|
persistIdentity(e) {
|
|
3996
4009
|
try {
|
|
3997
|
-
const t = this.getProjectId(), s =
|
|
4010
|
+
const t = this.getProjectId(), s = de(t);
|
|
3998
4011
|
this.managers.storage.setItem(s, JSON.stringify(e));
|
|
3999
4012
|
} catch {
|
|
4000
4013
|
a("debug", "Failed to persist identity to localStorage");
|
|
@@ -4005,7 +4018,7 @@ class xs extends T {
|
|
|
4005
4018
|
* Also migrates pending identity (set before init) to the project-scoped key.
|
|
4006
4019
|
*/
|
|
4007
4020
|
loadPersistedIdentity() {
|
|
4008
|
-
const e = this.managers.storage, t = this.getProjectId(), s =
|
|
4021
|
+
const e = this.managers.storage, t = this.getProjectId(), s = de(t);
|
|
4009
4022
|
try {
|
|
4010
4023
|
const r = e.getItem(O);
|
|
4011
4024
|
if (r) {
|
|
@@ -4053,7 +4066,7 @@ class xs extends T {
|
|
|
4053
4066
|
* localStorage values.
|
|
4054
4067
|
*/
|
|
4055
4068
|
normalizePersistedIdentity(e) {
|
|
4056
|
-
const t =
|
|
4069
|
+
const t = Le(e.traits);
|
|
4057
4070
|
return {
|
|
4058
4071
|
userId: e.userId.trim(),
|
|
4059
4072
|
...t ? { traits: t } : {}
|
|
@@ -4065,7 +4078,7 @@ class xs extends T {
|
|
|
4065
4078
|
clearPersistedIdentity() {
|
|
4066
4079
|
try {
|
|
4067
4080
|
const e = this.managers.storage, t = this.getProjectId();
|
|
4068
|
-
e.removeItem(
|
|
4081
|
+
e.removeItem(de(t)), e.removeItem(O);
|
|
4069
4082
|
} catch {
|
|
4070
4083
|
a("debug", "Failed to clear persisted identity");
|
|
4071
4084
|
}
|
|
@@ -4092,7 +4105,7 @@ class xs extends T {
|
|
|
4092
4105
|
this.set("suppressNextScroll", !1);
|
|
4093
4106
|
}, 500);
|
|
4094
4107
|
};
|
|
4095
|
-
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
|
|
4108
|
+
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 ne(this.managers.event, this.emitter);
|
|
4096
4109
|
const s = () => {
|
|
4097
4110
|
if (this.handlers.pageView?.startTracking(), this.handlers.click?.startTracking(), this.handlers.scroll?.startTracking(), this.handlers.performance?.startTracking().catch((r) => {
|
|
4098
4111
|
a("warn", "Failed to start performance tracking", { error: r });
|
|
@@ -4195,7 +4208,7 @@ const $s = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4195
4208
|
return;
|
|
4196
4209
|
}
|
|
4197
4210
|
try {
|
|
4198
|
-
const t =
|
|
4211
|
+
const t = Le(e), s = {
|
|
4199
4212
|
userId: n.trim(),
|
|
4200
4213
|
...t ? { traits: t } : {}
|
|
4201
4214
|
};
|
|
@@ -4229,19 +4242,19 @@ const $s = async (n) => typeof window > "u" || typeof document > "u" ? { session
|
|
|
4229
4242
|
identify: Qs,
|
|
4230
4243
|
resetIdentity: Ys
|
|
4231
4244
|
};
|
|
4232
|
-
var
|
|
4245
|
+
var be, b, $, ct, re, lt = -1, N = function(n) {
|
|
4233
4246
|
addEventListener("pageshow", (function(e) {
|
|
4234
4247
|
e.persisted && (lt = e.timeStamp, n(e));
|
|
4235
4248
|
}), !0);
|
|
4236
|
-
},
|
|
4249
|
+
}, ke = function() {
|
|
4237
4250
|
var n = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
4238
4251
|
if (n && n.responseStart > 0 && n.responseStart < performance.now()) return n;
|
|
4239
|
-
},
|
|
4240
|
-
var n =
|
|
4252
|
+
}, oe = function() {
|
|
4253
|
+
var n = ke();
|
|
4241
4254
|
return n && n.activationStart || 0;
|
|
4242
4255
|
}, E = function(n, e) {
|
|
4243
|
-
var t =
|
|
4244
|
-
return lt >= 0 ? s = "back-forward-cache" : t && (document.prerendering ||
|
|
4256
|
+
var t = ke(), s = "navigate";
|
|
4257
|
+
return lt >= 0 ? s = "back-forward-cache" : t && (document.prerendering || oe() > 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 };
|
|
4245
4258
|
}, U = function(n, e, t) {
|
|
4246
4259
|
try {
|
|
4247
4260
|
if (PerformanceObserver.supportedEntryTypes.includes(n)) {
|
|
@@ -4261,30 +4274,30 @@ var Le, b, x, ct, ne, lt = -1, N = function(n) {
|
|
|
4261
4274
|
return c > l[1] ? "poor" : c > l[0] ? "needs-improvement" : "good";
|
|
4262
4275
|
})(e.value, t), n(e));
|
|
4263
4276
|
};
|
|
4264
|
-
},
|
|
4277
|
+
}, De = function(n) {
|
|
4265
4278
|
requestAnimationFrame((function() {
|
|
4266
4279
|
return requestAnimationFrame((function() {
|
|
4267
4280
|
return n();
|
|
4268
4281
|
}));
|
|
4269
4282
|
}));
|
|
4270
|
-
},
|
|
4283
|
+
}, X = function(n) {
|
|
4271
4284
|
document.addEventListener("visibilitychange", (function() {
|
|
4272
4285
|
document.visibilityState === "hidden" && n();
|
|
4273
4286
|
}));
|
|
4274
|
-
},
|
|
4287
|
+
}, ae = function(n) {
|
|
4275
4288
|
var e = !1;
|
|
4276
4289
|
return function() {
|
|
4277
4290
|
e || (n(), e = !0);
|
|
4278
4291
|
};
|
|
4279
4292
|
}, P = -1, et = function() {
|
|
4280
4293
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
4281
|
-
},
|
|
4294
|
+
}, ie = function(n) {
|
|
4282
4295
|
document.visibilityState === "hidden" && P > -1 && (P = n.type === "visibilitychange" ? n.timeStamp : 0, qs());
|
|
4283
4296
|
}, tt = function() {
|
|
4284
|
-
addEventListener("visibilitychange",
|
|
4297
|
+
addEventListener("visibilitychange", ie, !0), addEventListener("prerenderingchange", ie, !0);
|
|
4285
4298
|
}, qs = function() {
|
|
4286
|
-
removeEventListener("visibilitychange",
|
|
4287
|
-
},
|
|
4299
|
+
removeEventListener("visibilitychange", ie, !0), removeEventListener("prerenderingchange", ie, !0);
|
|
4300
|
+
}, Ue = function() {
|
|
4288
4301
|
return P < 0 && (P = et(), tt(), N((function() {
|
|
4289
4302
|
setTimeout((function() {
|
|
4290
4303
|
P = et(), tt();
|
|
@@ -4292,25 +4305,25 @@ var Le, b, x, ct, ne, lt = -1, N = function(n) {
|
|
|
4292
4305
|
}))), { get firstHiddenTime() {
|
|
4293
4306
|
return P;
|
|
4294
4307
|
} };
|
|
4295
|
-
},
|
|
4308
|
+
}, G = function(n) {
|
|
4296
4309
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
4297
4310
|
return n();
|
|
4298
4311
|
}), !0) : n();
|
|
4299
|
-
},
|
|
4300
|
-
e = e || {},
|
|
4301
|
-
var t, s =
|
|
4312
|
+
}, Me = [1800, 3e3], ut = function(n, e) {
|
|
4313
|
+
e = e || {}, G((function() {
|
|
4314
|
+
var t, s = Ue(), r = E("FCP"), i = U("paint", (function(o) {
|
|
4302
4315
|
o.forEach((function(c) {
|
|
4303
|
-
c.name === "first-contentful-paint" && (i.disconnect(), c.startTime < s.firstHiddenTime && (r.value = Math.max(c.startTime -
|
|
4316
|
+
c.name === "first-contentful-paint" && (i.disconnect(), c.startTime < s.firstHiddenTime && (r.value = Math.max(c.startTime - oe(), 0), r.entries.push(c), t(!0)));
|
|
4304
4317
|
}));
|
|
4305
4318
|
}));
|
|
4306
|
-
i && (t = v(n, r,
|
|
4307
|
-
r = E("FCP"), t = v(n, r,
|
|
4319
|
+
i && (t = v(n, r, Me, e.reportAllChanges), N((function(o) {
|
|
4320
|
+
r = E("FCP"), t = v(n, r, Me, e.reportAllChanges), De((function() {
|
|
4308
4321
|
r.value = performance.now() - o.timeStamp, t(!0);
|
|
4309
4322
|
}));
|
|
4310
4323
|
})));
|
|
4311
4324
|
}));
|
|
4312
|
-
},
|
|
4313
|
-
e = e || {}, ut(
|
|
4325
|
+
}, Ce = [0.1, 0.25], Js = function(n, e) {
|
|
4326
|
+
e = e || {}, ut(ae((function() {
|
|
4314
4327
|
var t, s = E("CLS", 0), r = 0, i = [], o = function(l) {
|
|
4315
4328
|
l.forEach((function(u) {
|
|
4316
4329
|
if (!u.hadRecentInput) {
|
|
@@ -4319,48 +4332,48 @@ var Le, b, x, ct, ne, lt = -1, N = function(n) {
|
|
|
4319
4332
|
}
|
|
4320
4333
|
})), r > s.value && (s.value = r, s.entries = i, t());
|
|
4321
4334
|
}, c = U("layout-shift", o);
|
|
4322
|
-
c && (t = v(n, s,
|
|
4335
|
+
c && (t = v(n, s, Ce, e.reportAllChanges), X((function() {
|
|
4323
4336
|
o(c.takeRecords()), t(!0);
|
|
4324
4337
|
})), N((function() {
|
|
4325
|
-
r = 0, s = E("CLS", 0), t = v(n, s,
|
|
4338
|
+
r = 0, s = E("CLS", 0), t = v(n, s, Ce, e.reportAllChanges), De((function() {
|
|
4326
4339
|
return t();
|
|
4327
4340
|
}));
|
|
4328
4341
|
})), setTimeout(t, 0));
|
|
4329
4342
|
})));
|
|
4330
|
-
}, dt = 0,
|
|
4343
|
+
}, dt = 0, pe = 1 / 0, z = 0, Zs = function(n) {
|
|
4331
4344
|
n.forEach((function(e) {
|
|
4332
|
-
e.interactionId && (
|
|
4345
|
+
e.interactionId && (pe = Math.min(pe, e.interactionId), z = Math.max(z, e.interactionId), dt = z ? (z - pe) / 7 + 1 : 0);
|
|
4333
4346
|
}));
|
|
4334
4347
|
}, ht = function() {
|
|
4335
|
-
return
|
|
4348
|
+
return be ? dt : performance.interactionCount || 0;
|
|
4336
4349
|
}, en = function() {
|
|
4337
|
-
"interactionCount" in performance ||
|
|
4338
|
-
}, I = [],
|
|
4350
|
+
"interactionCount" in performance || be || (be = U("event", Zs, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
4351
|
+
}, I = [], J = /* @__PURE__ */ new Map(), ft = 0, tn = function() {
|
|
4339
4352
|
var n = Math.min(I.length - 1, Math.floor((ht() - ft) / 50));
|
|
4340
4353
|
return I[n];
|
|
4341
4354
|
}, sn = [], nn = function(n) {
|
|
4342
4355
|
if (sn.forEach((function(r) {
|
|
4343
4356
|
return r(n);
|
|
4344
4357
|
})), n.interactionId || n.entryType === "first-input") {
|
|
4345
|
-
var e = I[I.length - 1], t =
|
|
4358
|
+
var e = I[I.length - 1], t = J.get(n.interactionId);
|
|
4346
4359
|
if (t || I.length < 10 || n.duration > e.latency) {
|
|
4347
4360
|
if (t) n.duration > t.latency ? (t.entries = [n], t.latency = n.duration) : n.duration === t.latency && n.startTime === t.entries[0].startTime && t.entries.push(n);
|
|
4348
4361
|
else {
|
|
4349
4362
|
var s = { id: n.interactionId, latency: n.duration, entries: [n] };
|
|
4350
|
-
|
|
4363
|
+
J.set(s.id, s), I.push(s);
|
|
4351
4364
|
}
|
|
4352
4365
|
I.sort((function(r, i) {
|
|
4353
4366
|
return i.latency - r.latency;
|
|
4354
4367
|
})), I.length > 10 && I.splice(10).forEach((function(r) {
|
|
4355
|
-
return
|
|
4368
|
+
return J.delete(r.id);
|
|
4356
4369
|
}));
|
|
4357
4370
|
}
|
|
4358
4371
|
}
|
|
4359
4372
|
}, gt = function(n) {
|
|
4360
4373
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
4361
|
-
return n =
|
|
4362
|
-
},
|
|
4363
|
-
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {},
|
|
4374
|
+
return n = ae(n), document.visibilityState === "hidden" ? n() : (t = e(n), X(n)), t;
|
|
4375
|
+
}, Re = [200, 500], rn = function(n, e) {
|
|
4376
|
+
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, G((function() {
|
|
4364
4377
|
var t;
|
|
4365
4378
|
en();
|
|
4366
4379
|
var s, r = E("INP"), i = function(c) {
|
|
@@ -4370,58 +4383,58 @@ var Le, b, x, ct, ne, lt = -1, N = function(n) {
|
|
|
4370
4383
|
l && l.latency !== r.value && (r.value = l.latency, r.entries = l.entries, s());
|
|
4371
4384
|
}));
|
|
4372
4385
|
}, o = U("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
4373
|
-
s = v(n, r,
|
|
4386
|
+
s = v(n, r, Re, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), X((function() {
|
|
4374
4387
|
i(o.takeRecords()), s(!0);
|
|
4375
4388
|
})), N((function() {
|
|
4376
|
-
ft = ht(), I.length = 0,
|
|
4389
|
+
ft = ht(), I.length = 0, J.clear(), r = E("INP"), s = v(n, r, Re, e.reportAllChanges);
|
|
4377
4390
|
})));
|
|
4378
4391
|
})));
|
|
4379
|
-
},
|
|
4380
|
-
e = e || {},
|
|
4381
|
-
var t, s =
|
|
4392
|
+
}, Ne = [2500, 4e3], Se = {}, on = function(n, e) {
|
|
4393
|
+
e = e || {}, G((function() {
|
|
4394
|
+
var t, s = Ue(), r = E("LCP"), i = function(l) {
|
|
4382
4395
|
e.reportAllChanges || (l = l.slice(-1)), l.forEach((function(u) {
|
|
4383
|
-
u.startTime < s.firstHiddenTime && (r.value = Math.max(u.startTime -
|
|
4396
|
+
u.startTime < s.firstHiddenTime && (r.value = Math.max(u.startTime - oe(), 0), r.entries = [u], t());
|
|
4384
4397
|
}));
|
|
4385
4398
|
}, o = U("largest-contentful-paint", i);
|
|
4386
4399
|
if (o) {
|
|
4387
|
-
t = v(n, r,
|
|
4388
|
-
var c =
|
|
4389
|
-
|
|
4400
|
+
t = v(n, r, Ne, e.reportAllChanges);
|
|
4401
|
+
var c = ae((function() {
|
|
4402
|
+
Se[r.id] || (i(o.takeRecords()), o.disconnect(), Se[r.id] = !0, t(!0));
|
|
4390
4403
|
}));
|
|
4391
4404
|
["keydown", "click"].forEach((function(l) {
|
|
4392
4405
|
addEventListener(l, (function() {
|
|
4393
4406
|
return gt(c);
|
|
4394
4407
|
}), { once: !0, capture: !0 });
|
|
4395
|
-
})),
|
|
4396
|
-
r = E("LCP"), t = v(n, r,
|
|
4397
|
-
r.value = performance.now() - l.timeStamp,
|
|
4408
|
+
})), X(c), N((function(l) {
|
|
4409
|
+
r = E("LCP"), t = v(n, r, Ne, e.reportAllChanges), De((function() {
|
|
4410
|
+
r.value = performance.now() - l.timeStamp, Se[r.id] = !0, t(!0);
|
|
4398
4411
|
}));
|
|
4399
4412
|
}));
|
|
4400
4413
|
}
|
|
4401
4414
|
}));
|
|
4402
|
-
},
|
|
4403
|
-
document.prerendering ?
|
|
4415
|
+
}, Oe = [800, 1800], an = function n(e) {
|
|
4416
|
+
document.prerendering ? G((function() {
|
|
4404
4417
|
return n(e);
|
|
4405
4418
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
4406
4419
|
return n(e);
|
|
4407
4420
|
}), !0) : setTimeout(e, 0);
|
|
4408
4421
|
}, cn = function(n, e) {
|
|
4409
4422
|
e = e || {};
|
|
4410
|
-
var t = E("TTFB"), s = v(n, t,
|
|
4423
|
+
var t = E("TTFB"), s = v(n, t, Oe, e.reportAllChanges);
|
|
4411
4424
|
an((function() {
|
|
4412
|
-
var r =
|
|
4413
|
-
r && (t.value = Math.max(r.responseStart -
|
|
4414
|
-
t = E("TTFB", 0), (s = v(n, t,
|
|
4425
|
+
var r = ke();
|
|
4426
|
+
r && (t.value = Math.max(r.responseStart - oe(), 0), t.entries = [r], s(!0), N((function() {
|
|
4427
|
+
t = E("TTFB", 0), (s = v(n, t, Oe, e.reportAllChanges))(!0);
|
|
4415
4428
|
})));
|
|
4416
4429
|
}));
|
|
4417
|
-
},
|
|
4418
|
-
b || (b = e,
|
|
4430
|
+
}, x = { passive: !0, capture: !0 }, ln = /* @__PURE__ */ new Date(), st = function(n, e) {
|
|
4431
|
+
b || (b = e, $ = n, ct = /* @__PURE__ */ new Date(), pt(removeEventListener), mt());
|
|
4419
4432
|
}, mt = function() {
|
|
4420
|
-
if (
|
|
4421
|
-
var n = { entryType: "first-input", name: b.type, target: b.target, cancelable: b.cancelable, startTime: b.timeStamp, processingStart: b.timeStamp +
|
|
4422
|
-
|
|
4433
|
+
if ($ >= 0 && $ < ct - ln) {
|
|
4434
|
+
var n = { entryType: "first-input", name: b.type, target: b.target, cancelable: b.cancelable, startTime: b.timeStamp, processingStart: b.timeStamp + $ };
|
|
4435
|
+
re.forEach((function(e) {
|
|
4423
4436
|
e(n);
|
|
4424
|
-
})),
|
|
4437
|
+
})), re = [];
|
|
4425
4438
|
}
|
|
4426
4439
|
}, un = function(n) {
|
|
4427
4440
|
if (n.cancelable) {
|
|
@@ -4432,38 +4445,38 @@ var Le, b, x, ct, ne, lt = -1, N = function(n) {
|
|
|
4432
4445
|
}, i = function() {
|
|
4433
4446
|
o();
|
|
4434
4447
|
}, o = function() {
|
|
4435
|
-
removeEventListener("pointerup", r,
|
|
4448
|
+
removeEventListener("pointerup", r, x), removeEventListener("pointercancel", i, x);
|
|
4436
4449
|
};
|
|
4437
|
-
addEventListener("pointerup", r,
|
|
4450
|
+
addEventListener("pointerup", r, x), addEventListener("pointercancel", i, x);
|
|
4438
4451
|
})(e, n) : st(e, n);
|
|
4439
4452
|
}
|
|
4440
4453
|
}, pt = function(n) {
|
|
4441
4454
|
["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
|
|
4442
|
-
return n(e, un,
|
|
4455
|
+
return n(e, un, x);
|
|
4443
4456
|
}));
|
|
4444
|
-
},
|
|
4445
|
-
e = e || {},
|
|
4446
|
-
var t, s =
|
|
4457
|
+
}, Pe = [100, 300], dn = function(n, e) {
|
|
4458
|
+
e = e || {}, G((function() {
|
|
4459
|
+
var t, s = Ue(), r = E("FID"), i = function(l) {
|
|
4447
4460
|
l.startTime < s.firstHiddenTime && (r.value = l.processingStart - l.startTime, r.entries.push(l), t(!0));
|
|
4448
4461
|
}, o = function(l) {
|
|
4449
4462
|
l.forEach(i);
|
|
4450
4463
|
}, c = U("first-input", o);
|
|
4451
|
-
t = v(n, r,
|
|
4464
|
+
t = v(n, r, Pe, e.reportAllChanges), c && (X(ae((function() {
|
|
4452
4465
|
o(c.takeRecords()), c.disconnect();
|
|
4453
4466
|
}))), N((function() {
|
|
4454
4467
|
var l;
|
|
4455
|
-
r = E("FID"), t = v(n, r,
|
|
4468
|
+
r = E("FID"), t = v(n, r, Pe, e.reportAllChanges), re = [], $ = -1, b = null, pt(addEventListener), l = i, re.push(l), mt();
|
|
4456
4469
|
})));
|
|
4457
4470
|
}));
|
|
4458
4471
|
};
|
|
4459
4472
|
const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4460
4473
|
__proto__: null,
|
|
4461
|
-
CLSThresholds:
|
|
4462
|
-
FCPThresholds:
|
|
4463
|
-
FIDThresholds:
|
|
4464
|
-
INPThresholds:
|
|
4465
|
-
LCPThresholds:
|
|
4466
|
-
TTFBThresholds:
|
|
4474
|
+
CLSThresholds: Ce,
|
|
4475
|
+
FCPThresholds: Me,
|
|
4476
|
+
FIDThresholds: Pe,
|
|
4477
|
+
INPThresholds: Re,
|
|
4478
|
+
LCPThresholds: Ne,
|
|
4479
|
+
TTFBThresholds: Oe,
|
|
4467
4480
|
onCLS: Js,
|
|
4468
4481
|
onFCP: ut,
|
|
4469
4482
|
onFID: dn,
|
|
@@ -4474,13 +4487,13 @@ const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4474
4487
|
export {
|
|
4475
4488
|
m as AppConfigValidationError,
|
|
4476
4489
|
fn as DEFAULT_SESSION_TIMEOUT,
|
|
4477
|
-
|
|
4490
|
+
ye as DEFAULT_WEB_VITALS_MODE,
|
|
4478
4491
|
w as DeviceType,
|
|
4479
4492
|
D as EmitterEvent,
|
|
4480
|
-
|
|
4493
|
+
H as ErrorType,
|
|
4481
4494
|
d as EventType,
|
|
4482
4495
|
yn as InitializationTimeoutError,
|
|
4483
|
-
|
|
4496
|
+
F as IntegrationValidationError,
|
|
4484
4497
|
_n as MAX_ARRAY_LENGTH,
|
|
4485
4498
|
Sn as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
4486
4499
|
pn as MAX_CUSTOM_EVENT_KEYS,
|
|
@@ -4489,16 +4502,16 @@ export {
|
|
|
4489
4502
|
En as MAX_NESTED_OBJECT_KEYS,
|
|
4490
4503
|
vn as MAX_STRING_LENGTH,
|
|
4491
4504
|
Tn as MAX_STRING_LENGTH_IN_ARRAY,
|
|
4492
|
-
|
|
4505
|
+
te as Mode,
|
|
4493
4506
|
as as PII_PATTERNS,
|
|
4494
4507
|
M as PermanentError,
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4508
|
+
Z as RateLimitError,
|
|
4509
|
+
Xe as SamplingRateValidationError,
|
|
4510
|
+
ve as ScrollDirection,
|
|
4498
4511
|
At as SessionTimeoutValidationError,
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4512
|
+
V as SpecialApiUrl,
|
|
4513
|
+
ee as TimeoutError,
|
|
4514
|
+
B as TraceLogValidationError,
|
|
4502
4515
|
In as WEB_VITALS_GOOD_THRESHOLDS,
|
|
4503
4516
|
ze as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
4504
4517
|
Kt as WEB_VITALS_POOR_THRESHOLDS,
|