@tracelog/lib 2.3.1-rc.84.2 → 2.3.1-rc.84.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/tracelog.esm.js +102 -94
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +1 -1
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +2 -2
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +6 -4
- package/dist/public-api.d.ts +6 -4
- package/dist/public-api.js +2 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -78,7 +78,7 @@ const m = {
|
|
|
78
78
|
/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
|
79
79
|
/<embed\b[^>]*>/gi,
|
|
80
80
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
81
|
-
],
|
|
81
|
+
], I = "tlog", F = `${I}:qa_mode`, be = `${I}:uid`, Ge = "tlog_mode", Le = "qa", Ae = "qa_off", ht = (s) => s ? `${I}:${s}:queue` : `${I}:queue`, ft = (s) => s ? `${I}:${s}:session` : `${I}:session`, mt = (s) => s ? `${I}:${s}:broadcast` : `${I}:broadcast`, Me = (s, e) => `${I}:${s}:session_counts:${e}`, Ce = 10080 * 60 * 1e3, Re = `${I}:session_counts_last_cleanup`, Ne = 3600 * 1e3;
|
|
82
82
|
var H = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(H || {}), A = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(A || {}), le = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(le || {});
|
|
83
83
|
class P extends Error {
|
|
84
84
|
constructor(e, t) {
|
|
@@ -87,32 +87,32 @@ class P extends Error {
|
|
|
87
87
|
}
|
|
88
88
|
var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s.VIEWPORT_VISIBLE = "viewport_visible", s))(d || {}), j = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(j || {}), x = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(x || {}), Y = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(Y || {});
|
|
89
89
|
const qr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !0, Jr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !1;
|
|
90
|
-
class
|
|
90
|
+
class $ extends Error {
|
|
91
91
|
constructor(e, t, r) {
|
|
92
92
|
super(e), this.errorCode = t, this.layer = r, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
class f extends
|
|
95
|
+
class f extends $ {
|
|
96
96
|
constructor(e, t = "config") {
|
|
97
97
|
super(e, "APP_CONFIG_INVALID", t);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
class gt extends
|
|
100
|
+
class gt extends $ {
|
|
101
101
|
constructor(e, t = "config") {
|
|
102
102
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
class Oe extends
|
|
105
|
+
class Oe extends $ {
|
|
106
106
|
constructor(e, t = "config") {
|
|
107
107
|
super(e, "SAMPLING_RATE_INVALID", t);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
class U extends
|
|
110
|
+
class U extends $ {
|
|
111
111
|
constructor(e, t = "config") {
|
|
112
112
|
super(e, "INTEGRATION_INVALID", t);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
class Zr extends
|
|
115
|
+
class Zr extends $ {
|
|
116
116
|
constructor(e, t, r = "runtime") {
|
|
117
117
|
super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
|
|
118
118
|
}
|
|
@@ -140,7 +140,7 @@ const Xe = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
140
140
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
141
141
|
return !1;
|
|
142
142
|
try {
|
|
143
|
-
return sessionStorage.getItem(
|
|
143
|
+
return sessionStorage.getItem(F) === "true";
|
|
144
144
|
} catch {
|
|
145
145
|
return !1;
|
|
146
146
|
}
|
|
@@ -149,8 +149,8 @@ const Xe = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
149
149
|
if (!Tt(l, i))
|
|
150
150
|
return;
|
|
151
151
|
const g = vt(l, o), p = n !== void 0 ? ce(n) : void 0;
|
|
152
|
-
|
|
153
|
-
}, Tt = (s, e) => s === "critical" ? !0 : s === "qa" || e ? pt() : !1, vt = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? Et : "",
|
|
152
|
+
_t(u, c, g, p);
|
|
153
|
+
}, Tt = (s, e) => s === "critical" ? !0 : s === "qa" || e ? pt() : !1, vt = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? Et : "", _t = (s, e, t, r) => {
|
|
154
154
|
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
155
155
|
r !== void 0 ? n ? console[s](i, t, r) : console[s](i, r) : n ? console[s](i, t) : console[s](i);
|
|
156
156
|
}, ce = (s) => {
|
|
@@ -168,7 +168,7 @@ const Xe = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
168
168
|
return e;
|
|
169
169
|
};
|
|
170
170
|
let ue, je;
|
|
171
|
-
const
|
|
171
|
+
const It = () => {
|
|
172
172
|
typeof window < "u" && !ue && (ue = window.matchMedia("(pointer: coarse)"), je = window.matchMedia("(hover: none)"));
|
|
173
173
|
}, q = "Unknown", wt = (s) => {
|
|
174
174
|
const e = s.userAgentData?.platform;
|
|
@@ -200,7 +200,7 @@ const _t = () => {
|
|
|
200
200
|
const c = s.userAgentData.platform;
|
|
201
201
|
return c != null && c !== "" && /ipad|tablet/i.test(c) ? A.Tablet : s.userAgentData.mobile ? A.Mobile : A.Desktop;
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
It();
|
|
204
204
|
const e = window.innerWidth, t = ue?.matches ?? !1, r = je?.matches ?? !1, n = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), l = /tablet|ipad|android(?!.*mobile)/.test(i);
|
|
205
205
|
return e <= 767 || o && n ? A.Mobile : e >= 768 && e <= 1024 || l || t && r && n ? A.Tablet : A.Desktop;
|
|
206
206
|
} catch (s) {
|
|
@@ -236,7 +236,7 @@ const _t = () => {
|
|
|
236
236
|
/Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
|
|
237
237
|
// Passwords in connection strings (protocol://user:password@host)
|
|
238
238
|
/:\/\/[^:/]+:([^@]+)@/gi
|
|
239
|
-
], Pe = 500, De = 5e3, z = 50, At = z * 2, Ke = 1, Mt = 1e3, Ct = 10,
|
|
239
|
+
], Pe = 500, De = 5e3, z = 50, At = z * 2, Ke = 1, Mt = 1e3, Ct = 10, Ve = 5e3, Rt = 6e4, es = {
|
|
240
240
|
LCP: 2500,
|
|
241
241
|
// Good: ≤ 2.5s
|
|
242
242
|
FCP: 1800,
|
|
@@ -248,7 +248,7 @@ const _t = () => {
|
|
|
248
248
|
TTFB: 800,
|
|
249
249
|
// Good: ≤ 800ms
|
|
250
250
|
LONG_TASK: 50
|
|
251
|
-
},
|
|
251
|
+
}, ke = {
|
|
252
252
|
LCP: 2500,
|
|
253
253
|
// Needs improvement: > 2.5s (same as good boundary)
|
|
254
254
|
FCP: 1800,
|
|
@@ -278,13 +278,13 @@ const _t = () => {
|
|
|
278
278
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
|
|
279
279
|
// Track everything
|
|
280
280
|
case "needs-improvement":
|
|
281
|
-
return
|
|
281
|
+
return ke;
|
|
282
282
|
case "poor":
|
|
283
283
|
return Nt;
|
|
284
284
|
default:
|
|
285
|
-
return
|
|
285
|
+
return ke;
|
|
286
286
|
}
|
|
287
|
-
}, Ot = 1e3, Pt = 50, Dt = "2.3.1",
|
|
287
|
+
}, Ot = 1e3, Pt = 50, Dt = "2.3.1", Vt = Dt, Ye = () => typeof window < "u" && typeof sessionStorage < "u", kt = () => {
|
|
288
288
|
try {
|
|
289
289
|
const s = new URLSearchParams(window.location.search);
|
|
290
290
|
s.delete(Ge);
|
|
@@ -296,22 +296,22 @@ const _t = () => {
|
|
|
296
296
|
if (!Ye())
|
|
297
297
|
return !1;
|
|
298
298
|
try {
|
|
299
|
-
const e = new URLSearchParams(window.location.search).get(Ge), t = sessionStorage.getItem(
|
|
299
|
+
const e = new URLSearchParams(window.location.search).get(Ge), t = sessionStorage.getItem(F);
|
|
300
300
|
let r = null;
|
|
301
|
-
return e === Le ? (r = !0, sessionStorage.setItem(
|
|
301
|
+
return e === Le ? (r = !0, sessionStorage.setItem(F, "true"), a("info", "QA Mode ACTIVE", {
|
|
302
302
|
visibility: "qa",
|
|
303
303
|
style: Xe
|
|
304
|
-
})) : e === Ae && (r = !1, sessionStorage.setItem(
|
|
304
|
+
})) : e === Ae && (r = !1, sessionStorage.setItem(F, "false"), a("info", "QA Mode DISABLED", {
|
|
305
305
|
visibility: "qa",
|
|
306
306
|
style: Qe
|
|
307
|
-
})), (e === Le || e === Ae) &&
|
|
307
|
+
})), (e === Le || e === Ae) && kt(), r ?? t === "true";
|
|
308
308
|
} catch {
|
|
309
309
|
return !1;
|
|
310
310
|
}
|
|
311
311
|
}, Ht = (s) => {
|
|
312
312
|
if (Ye())
|
|
313
313
|
try {
|
|
314
|
-
sessionStorage.setItem(
|
|
314
|
+
sessionStorage.setItem(F, s ? "true" : "false"), a("info", s ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
315
315
|
visibility: "qa",
|
|
316
316
|
style: s ? Xe : Qe
|
|
317
317
|
});
|
|
@@ -336,13 +336,13 @@ const _t = () => {
|
|
|
336
336
|
return s.toLowerCase();
|
|
337
337
|
const t = e.slice(-2).join(".");
|
|
338
338
|
return xt.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
339
|
-
},
|
|
339
|
+
}, Ft = (s, e) => s === e ? !0 : He(s) === He(e), se = () => {
|
|
340
340
|
const s = document.referrer;
|
|
341
341
|
if (!s)
|
|
342
342
|
return "Direct";
|
|
343
343
|
try {
|
|
344
344
|
const e = new URL(s).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
|
|
345
|
-
return
|
|
345
|
+
return Ft(e, t) ? "Direct" : s;
|
|
346
346
|
} catch (e) {
|
|
347
347
|
return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: s } }), s;
|
|
348
348
|
}
|
|
@@ -355,7 +355,7 @@ const _t = () => {
|
|
|
355
355
|
e[i] = n;
|
|
356
356
|
}
|
|
357
357
|
}), Object.keys(e).length ? e : void 0;
|
|
358
|
-
},
|
|
358
|
+
}, $t = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (s) => {
|
|
359
359
|
const e = Math.random() * 16 | 0;
|
|
360
360
|
return (s === "x" ? e : e & 3 | 8).toString(16);
|
|
361
361
|
});
|
|
@@ -640,7 +640,7 @@ const Bt = () => {
|
|
|
640
640
|
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(s.toLowerCase()) ? {
|
|
641
641
|
valid: !1,
|
|
642
642
|
error: "Event name cannot be a reserved word"
|
|
643
|
-
} : { valid: !0 },
|
|
643
|
+
} : { valid: !0 }, Fe = (s, e, t) => {
|
|
644
644
|
const r = Xt(e), n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
|
|
645
645
|
if (!Yt(r))
|
|
646
646
|
return {
|
|
@@ -700,7 +700,7 @@ const Bt = () => {
|
|
|
700
700
|
valid: !1,
|
|
701
701
|
error: `${n}: array item at index ${i} must be an object.`
|
|
702
702
|
};
|
|
703
|
-
const l =
|
|
703
|
+
const l = Fe(s, o, t);
|
|
704
704
|
if (!l.valid)
|
|
705
705
|
return {
|
|
706
706
|
valid: !1,
|
|
@@ -713,7 +713,7 @@ const Bt = () => {
|
|
|
713
713
|
sanitizedMetadata: r
|
|
714
714
|
};
|
|
715
715
|
}
|
|
716
|
-
return
|
|
716
|
+
return Fe(s, e, t);
|
|
717
717
|
}, Jt = (s, e) => {
|
|
718
718
|
const t = qt(s);
|
|
719
719
|
if (!t.valid)
|
|
@@ -878,7 +878,7 @@ function et(s, e, t) {
|
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
const ie = {};
|
|
881
|
-
class
|
|
881
|
+
class _ {
|
|
882
882
|
/**
|
|
883
883
|
* Retrieves a value from global state.
|
|
884
884
|
*
|
|
@@ -936,7 +936,7 @@ class I {
|
|
|
936
936
|
return { ...ie };
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
|
-
class
|
|
939
|
+
class $e extends _ {
|
|
940
940
|
storeManager;
|
|
941
941
|
integrationId;
|
|
942
942
|
apiUrl;
|
|
@@ -1496,7 +1496,7 @@ class Fe extends I {
|
|
|
1496
1496
|
_metadata: {
|
|
1497
1497
|
referer: typeof window < "u" ? window.location.href : void 0,
|
|
1498
1498
|
timestamp: t,
|
|
1499
|
-
client_version:
|
|
1499
|
+
client_version: Vt
|
|
1500
1500
|
}
|
|
1501
1501
|
};
|
|
1502
1502
|
return {
|
|
@@ -1622,7 +1622,7 @@ class Fe extends I {
|
|
|
1622
1622
|
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: r });
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
|
-
class tr extends
|
|
1625
|
+
class tr extends _ {
|
|
1626
1626
|
bootTime;
|
|
1627
1627
|
bootTimestamp;
|
|
1628
1628
|
hasPerformanceNow;
|
|
@@ -1772,7 +1772,7 @@ class tr extends I {
|
|
|
1772
1772
|
}
|
|
1773
1773
|
}
|
|
1774
1774
|
const rr = new Set(Object.values(d));
|
|
1775
|
-
class sr extends
|
|
1775
|
+
class sr extends _ {
|
|
1776
1776
|
dataSenders;
|
|
1777
1777
|
emitter;
|
|
1778
1778
|
transformers;
|
|
@@ -1783,6 +1783,7 @@ class sr extends I {
|
|
|
1783
1783
|
pendingEventsBuffer = [];
|
|
1784
1784
|
sendIntervalId = null;
|
|
1785
1785
|
sendInProgress = !1;
|
|
1786
|
+
consecutiveSendFailures = 0;
|
|
1786
1787
|
rateLimitCounter = 0;
|
|
1787
1788
|
rateLimitWindowStart = 0;
|
|
1788
1789
|
lastSessionId = null;
|
|
@@ -1811,8 +1812,8 @@ class sr extends I {
|
|
|
1811
1812
|
constructor(e, t = null, r = {}, n = {}, i) {
|
|
1812
1813
|
super(), this.emitter = t, this.transformers = r, this.timeManager = new tr(), this.dataSenders = [];
|
|
1813
1814
|
const o = this.get("collectApiUrls");
|
|
1814
|
-
o?.saas && this.dataSenders.push(new
|
|
1815
|
-
new
|
|
1815
|
+
o?.saas && this.dataSenders.push(new $e(e, "saas", o.saas, r)), o?.custom && this.dataSenders.push(
|
|
1816
|
+
new $e(
|
|
1816
1817
|
e,
|
|
1817
1818
|
"custom",
|
|
1818
1819
|
o.custom,
|
|
@@ -2001,7 +2002,7 @@ class sr extends I {
|
|
|
2001
2002
|
if (!this.checkPerEventRateLimit(o.name, T))
|
|
2002
2003
|
return;
|
|
2003
2004
|
}
|
|
2004
|
-
const ye = E === d.SESSION_START, W = t || this.get("pageUrl"),
|
|
2005
|
+
const ye = E === d.SESSION_START, W = t || this.get("pageUrl"), k = this.buildEventPayload({
|
|
2005
2006
|
type: E,
|
|
2006
2007
|
page_url: W,
|
|
2007
2008
|
from_page_url: r,
|
|
@@ -2013,7 +2014,7 @@ class sr extends I {
|
|
|
2013
2014
|
viewport_data: u,
|
|
2014
2015
|
page_view: S
|
|
2015
2016
|
});
|
|
2016
|
-
if (
|
|
2017
|
+
if (k && !(!p && !this.shouldSample())) {
|
|
2017
2018
|
if (ye) {
|
|
2018
2019
|
const T = this.get("sessionId");
|
|
2019
2020
|
if (!T) {
|
|
@@ -2028,7 +2029,7 @@ class sr extends I {
|
|
|
2028
2029
|
}
|
|
2029
2030
|
this.set("hasStartSession", !0);
|
|
2030
2031
|
}
|
|
2031
|
-
if (!this.isDuplicateEvent(
|
|
2032
|
+
if (!this.isDuplicateEvent(k)) {
|
|
2032
2033
|
if (this.get("mode") === Y.QA) {
|
|
2033
2034
|
if (E === d.CUSTOM && o) {
|
|
2034
2035
|
a("info", `Custom Event: ${o.name}`, {
|
|
@@ -2037,7 +2038,7 @@ class sr extends I {
|
|
|
2037
2038
|
name: o.name,
|
|
2038
2039
|
...o.metadata && { metadata: o.metadata }
|
|
2039
2040
|
}
|
|
2040
|
-
}), this.emitEvent(
|
|
2041
|
+
}), this.emitEvent(k);
|
|
2041
2042
|
return;
|
|
2042
2043
|
}
|
|
2043
2044
|
if (E === d.VIEWPORT_VISIBLE && u) {
|
|
@@ -2051,11 +2052,11 @@ class sr extends I {
|
|
|
2051
2052
|
visibilityRatio: u.visibilityRatio,
|
|
2052
2053
|
dwellTime: u.dwellTime
|
|
2053
2054
|
}
|
|
2054
|
-
}), this.emitEvent(
|
|
2055
|
+
}), this.emitEvent(k);
|
|
2055
2056
|
return;
|
|
2056
2057
|
}
|
|
2057
2058
|
}
|
|
2058
|
-
if (this.addToQueue(
|
|
2059
|
+
if (this.addToQueue(k), !p) {
|
|
2059
2060
|
this.sessionEventCounts.total++, this.sessionEventCounts[E] !== void 0 && this.sessionEventCounts[E]++;
|
|
2060
2061
|
const T = this.get("sessionId");
|
|
2061
2062
|
T && this.saveSessionCountsDebounced && this.saveSessionCountsDebounced(T);
|
|
@@ -2070,7 +2071,7 @@ class sr extends I {
|
|
|
2070
2071
|
* and allow subsequent init() → destroy() → init() cycles.
|
|
2071
2072
|
*
|
|
2072
2073
|
* **Cleanup Actions**:
|
|
2073
|
-
* 1. **Clear send
|
|
2074
|
+
* 1. **Clear send timeout**: Cancels pending queue flush timeout and resets backoff state
|
|
2074
2075
|
* 2. **Clear all queues and buffers**:
|
|
2075
2076
|
* - `eventsQueue`: Discarded (not sent)
|
|
2076
2077
|
* - `pendingEventsBuffer`: Discarded (events before session init)
|
|
@@ -2098,7 +2099,7 @@ class sr extends I {
|
|
|
2098
2099
|
* @see src/managers/README.md (lines 5-75) for cleanup details
|
|
2099
2100
|
*/
|
|
2100
2101
|
stop() {
|
|
2101
|
-
this.
|
|
2102
|
+
this.clearSendInterval(), this.sendInProgress = !1, this.consecutiveSendFailures = 0;
|
|
2102
2103
|
const e = this.get("sessionId");
|
|
2103
2104
|
e && this.saveSessionCounts(e), this.eventsQueue = [], this.pendingEventsBuffer = [], this.recentEventFingerprints.clear(), this.rateLimitCounter = 0, this.rateLimitWindowStart = 0, this.perEventRateLimits.clear(), this.sessionEventCounts = {
|
|
2104
2105
|
total: 0,
|
|
@@ -2115,7 +2116,7 @@ class sr extends I {
|
|
|
2115
2116
|
* Flushes all events in the queue asynchronously.
|
|
2116
2117
|
*
|
|
2117
2118
|
* **Purpose**: Force immediate sending of queued events without waiting for
|
|
2118
|
-
* the
|
|
2119
|
+
* the scheduled queue flush timeout.
|
|
2119
2120
|
*
|
|
2120
2121
|
* **Use Cases**:
|
|
2121
2122
|
* - Manual flush triggered by user action
|
|
@@ -2312,7 +2313,7 @@ class sr extends I {
|
|
|
2312
2313
|
});
|
|
2313
2314
|
}
|
|
2314
2315
|
clearSendInterval() {
|
|
2315
|
-
this.sendIntervalId && (
|
|
2316
|
+
this.sendIntervalId !== null && (clearTimeout(this.sendIntervalId), this.sendIntervalId = null);
|
|
2316
2317
|
}
|
|
2317
2318
|
isSuccessfulResult(e) {
|
|
2318
2319
|
return e.status === "fulfilled" && e.value === !0;
|
|
@@ -2363,16 +2364,16 @@ class sr extends I {
|
|
|
2363
2364
|
})
|
|
2364
2365
|
), i = await Promise.allSettled(n);
|
|
2365
2366
|
if (i.some((l) => this.isSuccessfulResult(l))) {
|
|
2366
|
-
this.removeProcessedEvents(r), this.emitEventsQueue(e);
|
|
2367
|
+
this.consecutiveSendFailures = 0, this.removeProcessedEvents(r), this.emitEventsQueue(e);
|
|
2367
2368
|
const l = i.filter((c) => !this.isSuccessfulResult(c)).length;
|
|
2368
2369
|
l > 0 && a("debug", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
|
|
2369
2370
|
data: { eventCount: t.length, failedCount: l }
|
|
2370
2371
|
});
|
|
2371
2372
|
} else
|
|
2372
|
-
a("debug", "Periodic send complete failure, events kept in queue for retry", {
|
|
2373
|
+
this.consecutiveSendFailures++, a("debug", "Periodic send complete failure, events kept in queue for retry", {
|
|
2373
2374
|
data: { eventCount: t.length }
|
|
2374
2375
|
});
|
|
2375
|
-
this.eventsQueue.length === 0
|
|
2376
|
+
this.eventsQueue.length === 0 ? this.clearSendInterval() : this.scheduleSendTimeout();
|
|
2376
2377
|
} finally {
|
|
2377
2378
|
this.sendInProgress = !1;
|
|
2378
2379
|
}
|
|
@@ -2470,12 +2471,19 @@ class sr extends I {
|
|
|
2470
2471
|
}
|
|
2471
2472
|
});
|
|
2472
2473
|
}
|
|
2473
|
-
this.
|
|
2474
|
+
this.consecutiveSendFailures >= 5 && (this.consecutiveSendFailures = 0), this.scheduleSendTimeout(), this.eventsQueue.length >= 50 && this.sendEventsQueue();
|
|
2474
2475
|
}
|
|
2475
|
-
|
|
2476
|
-
this.sendIntervalId
|
|
2477
|
-
|
|
2478
|
-
|
|
2476
|
+
scheduleSendTimeout() {
|
|
2477
|
+
if (this.sendIntervalId !== null || this.consecutiveSendFailures >= 5) return;
|
|
2478
|
+
const e = this.calculateSendDelay();
|
|
2479
|
+
this.sendIntervalId = window.setTimeout(() => {
|
|
2480
|
+
this.sendIntervalId = null, this.eventsQueue.length > 0 && this.sendEventsQueue();
|
|
2481
|
+
}, e);
|
|
2482
|
+
}
|
|
2483
|
+
calculateSendDelay() {
|
|
2484
|
+
if (this.consecutiveSendFailures === 0) return 1e4;
|
|
2485
|
+
const e = 1e4 * Math.pow(2, this.consecutiveSendFailures);
|
|
2486
|
+
return Math.min(e, 12e4);
|
|
2479
2487
|
}
|
|
2480
2488
|
shouldSample() {
|
|
2481
2489
|
const e = this.get("config")?.samplingRate ?? 1;
|
|
@@ -2649,7 +2657,7 @@ class sr extends I {
|
|
|
2649
2657
|
return;
|
|
2650
2658
|
}
|
|
2651
2659
|
}
|
|
2652
|
-
const t = this.get("userId") || "anonymous", r = `${
|
|
2660
|
+
const t = this.get("userId") || "anonymous", r = `${I}:${t}:session_counts:`, n = [];
|
|
2653
2661
|
for (let i = 0; i < localStorage.length; i++) {
|
|
2654
2662
|
const o = localStorage.key(i);
|
|
2655
2663
|
if (o?.startsWith(r))
|
|
@@ -2735,12 +2743,12 @@ class nr {
|
|
|
2735
2743
|
const t = e.getItem(be);
|
|
2736
2744
|
if (t)
|
|
2737
2745
|
return t;
|
|
2738
|
-
const r =
|
|
2746
|
+
const r = $t();
|
|
2739
2747
|
return e.setItem(be, r), r;
|
|
2740
2748
|
}
|
|
2741
2749
|
}
|
|
2742
2750
|
const ir = /^\d{13}-[a-z0-9]{9}$/;
|
|
2743
|
-
class or extends
|
|
2751
|
+
class or extends _ {
|
|
2744
2752
|
storageManager;
|
|
2745
2753
|
eventManager;
|
|
2746
2754
|
projectId;
|
|
@@ -3060,7 +3068,7 @@ class or extends I {
|
|
|
3060
3068
|
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
|
|
3061
3069
|
}
|
|
3062
3070
|
}
|
|
3063
|
-
class ar extends
|
|
3071
|
+
class ar extends _ {
|
|
3064
3072
|
eventManager;
|
|
3065
3073
|
storageManager;
|
|
3066
3074
|
sessionManager = null;
|
|
@@ -3148,7 +3156,7 @@ class ar extends I {
|
|
|
3148
3156
|
this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
|
|
3149
3157
|
}
|
|
3150
3158
|
}
|
|
3151
|
-
class lr extends
|
|
3159
|
+
class lr extends _ {
|
|
3152
3160
|
eventManager;
|
|
3153
3161
|
onTrack;
|
|
3154
3162
|
originalPushState;
|
|
@@ -3224,7 +3232,7 @@ class lr extends I {
|
|
|
3224
3232
|
};
|
|
3225
3233
|
}
|
|
3226
3234
|
}
|
|
3227
|
-
class cr extends
|
|
3235
|
+
class cr extends _ {
|
|
3228
3236
|
eventManager;
|
|
3229
3237
|
lastClickTimes = /* @__PURE__ */ new Map();
|
|
3230
3238
|
clickHandler;
|
|
@@ -3481,7 +3489,7 @@ class cr extends I {
|
|
|
3481
3489
|
};
|
|
3482
3490
|
}
|
|
3483
3491
|
}
|
|
3484
|
-
class ur extends
|
|
3492
|
+
class ur extends _ {
|
|
3485
3493
|
eventManager;
|
|
3486
3494
|
containers = [];
|
|
3487
3495
|
limitWarningLogged = !1;
|
|
@@ -3709,7 +3717,7 @@ class ur extends I {
|
|
|
3709
3717
|
e.isPrimary = t;
|
|
3710
3718
|
}
|
|
3711
3719
|
}
|
|
3712
|
-
class dr extends
|
|
3720
|
+
class dr extends _ {
|
|
3713
3721
|
eventManager;
|
|
3714
3722
|
trackedElements = /* @__PURE__ */ new Map();
|
|
3715
3723
|
observer = null;
|
|
@@ -4153,7 +4161,7 @@ class hr {
|
|
|
4153
4161
|
this.fallbackSessionStorage.delete(e);
|
|
4154
4162
|
}
|
|
4155
4163
|
}
|
|
4156
|
-
class fr extends
|
|
4164
|
+
class fr extends _ {
|
|
4157
4165
|
eventManager;
|
|
4158
4166
|
reportedByNav = /* @__PURE__ */ new Map();
|
|
4159
4167
|
navigationHistory = [];
|
|
@@ -4252,7 +4260,7 @@ class fr extends I {
|
|
|
4252
4260
|
}
|
|
4253
4261
|
async initWebVitals() {
|
|
4254
4262
|
try {
|
|
4255
|
-
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() =>
|
|
4263
|
+
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => $r), o = (l) => (c) => {
|
|
4256
4264
|
const u = Number(c.value.toFixed(2));
|
|
4257
4265
|
this.sendVital({ type: l, value: u });
|
|
4258
4266
|
};
|
|
@@ -4386,7 +4394,7 @@ class fr extends I {
|
|
|
4386
4394
|
return !(typeof r == "number" && t <= r);
|
|
4387
4395
|
}
|
|
4388
4396
|
}
|
|
4389
|
-
class mr extends
|
|
4397
|
+
class mr extends _ {
|
|
4390
4398
|
eventManager;
|
|
4391
4399
|
recentErrors = /* @__PURE__ */ new Map();
|
|
4392
4400
|
errorBurstCounter = 0;
|
|
@@ -4423,10 +4431,10 @@ class mr extends I {
|
|
|
4423
4431
|
if (e < this.burstBackoffUntil)
|
|
4424
4432
|
return !1;
|
|
4425
4433
|
if (e - this.burstWindowStart > Mt && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Ct)
|
|
4426
|
-
return this.burstBackoffUntil = e +
|
|
4434
|
+
return this.burstBackoffUntil = e + Ve, a("debug", "Error burst detected - entering cooldown", {
|
|
4427
4435
|
data: {
|
|
4428
4436
|
errorsInWindow: this.errorBurstCounter,
|
|
4429
|
-
cooldownMs:
|
|
4437
|
+
cooldownMs: Ve
|
|
4430
4438
|
}
|
|
4431
4439
|
}), !1;
|
|
4432
4440
|
const r = this.get("config")?.errorSampling ?? Ke;
|
|
@@ -4497,7 +4505,7 @@ class mr extends I {
|
|
|
4497
4505
|
}
|
|
4498
4506
|
}
|
|
4499
4507
|
}
|
|
4500
|
-
class gr extends
|
|
4508
|
+
class gr extends _ {
|
|
4501
4509
|
isInitialized = !1;
|
|
4502
4510
|
suppressNextScrollTimer = null;
|
|
4503
4511
|
pageUnloadHandler = null;
|
|
@@ -4814,7 +4822,7 @@ function vr(s, e) {
|
|
|
4814
4822
|
s === "beforeSend" ? h.setTransformer("beforeSend", e) : h.setTransformer("beforeBatch", e);
|
|
4815
4823
|
}
|
|
4816
4824
|
}
|
|
4817
|
-
const
|
|
4825
|
+
const _r = (s) => {
|
|
4818
4826
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4819
4827
|
if (!h) {
|
|
4820
4828
|
const e = M.findIndex((t) => t.hook === s);
|
|
@@ -4825,7 +4833,7 @@ const Ir = (s) => {
|
|
|
4825
4833
|
throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
|
|
4826
4834
|
h.removeTransformer(s);
|
|
4827
4835
|
}
|
|
4828
|
-
},
|
|
4836
|
+
}, Ir = (s) => {
|
|
4829
4837
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
4830
4838
|
if (typeof s != "function")
|
|
4831
4839
|
throw new Error(`[TraceLog] Custom headers provider must be a function, received: ${typeof s}`);
|
|
@@ -4886,8 +4894,8 @@ const Ir = (s) => {
|
|
|
4886
4894
|
on: pr,
|
|
4887
4895
|
off: Tr,
|
|
4888
4896
|
setTransformer: vr,
|
|
4889
|
-
removeTransformer:
|
|
4890
|
-
setCustomHeaders:
|
|
4897
|
+
removeTransformer: _r,
|
|
4898
|
+
setCustomHeaders: Ir,
|
|
4891
4899
|
removeCustomHeaders: wr,
|
|
4892
4900
|
isInitialized: yr,
|
|
4893
4901
|
getSessionId: br,
|
|
@@ -4896,18 +4904,18 @@ const Ir = (s) => {
|
|
|
4896
4904
|
updateGlobalMetadata: Mr,
|
|
4897
4905
|
mergeGlobalMetadata: Cr
|
|
4898
4906
|
};
|
|
4899
|
-
var ge, tt = -1,
|
|
4907
|
+
var ge, tt = -1, V = function(s) {
|
|
4900
4908
|
addEventListener("pageshow", (function(e) {
|
|
4901
4909
|
e.persisted && (tt = e.timeStamp, s(e));
|
|
4902
4910
|
}), !0);
|
|
4903
|
-
},
|
|
4911
|
+
}, _e = function() {
|
|
4904
4912
|
var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
4905
4913
|
if (s && s.responseStart > 0 && s.responseStart < performance.now()) return s;
|
|
4906
4914
|
}, Z = function() {
|
|
4907
|
-
var s =
|
|
4915
|
+
var s = _e();
|
|
4908
4916
|
return s && s.activationStart || 0;
|
|
4909
4917
|
}, b = function(s, e) {
|
|
4910
|
-
var t =
|
|
4918
|
+
var t = _e(), r = "navigate";
|
|
4911
4919
|
return tt >= 0 ? r = "back-forward-cache" : t && (document.prerendering || Z() > 0 ? r = "prerender" : document.wasDiscarded ? r = "restore" : t.type && (r = t.type.replace(/_/g, "-"))), { name: s, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: r };
|
|
4912
4920
|
}, B = function(s, e, t) {
|
|
4913
4921
|
try {
|
|
@@ -4928,7 +4936,7 @@ var ge, tt = -1, k = function(s) {
|
|
|
4928
4936
|
return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
|
|
4929
4937
|
})(e.value, t), s(e));
|
|
4930
4938
|
};
|
|
4931
|
-
},
|
|
4939
|
+
}, Ie = function(s) {
|
|
4932
4940
|
requestAnimationFrame((function() {
|
|
4933
4941
|
return requestAnimationFrame((function() {
|
|
4934
4942
|
return s();
|
|
@@ -4952,7 +4960,7 @@ var ge, tt = -1, k = function(s) {
|
|
|
4952
4960
|
}, Rr = function() {
|
|
4953
4961
|
removeEventListener("visibilitychange", J, !0), removeEventListener("prerenderingchange", J, !0);
|
|
4954
4962
|
}, rt = function() {
|
|
4955
|
-
return D < 0 && (D = Be(), We(),
|
|
4963
|
+
return D < 0 && (D = Be(), We(), V((function() {
|
|
4956
4964
|
setTimeout((function() {
|
|
4957
4965
|
D = Be(), We();
|
|
4958
4966
|
}), 0);
|
|
@@ -4970,8 +4978,8 @@ var ge, tt = -1, k = function(s) {
|
|
|
4970
4978
|
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime - Z(), 0), n.entries.push(l), t(!0)));
|
|
4971
4979
|
}));
|
|
4972
4980
|
}));
|
|
4973
|
-
i && (t = L(s, n, Ee, e.reportAllChanges),
|
|
4974
|
-
n = b("FCP"), t = L(s, n, Ee, e.reportAllChanges),
|
|
4981
|
+
i && (t = L(s, n, Ee, e.reportAllChanges), V((function(o) {
|
|
4982
|
+
n = b("FCP"), t = L(s, n, Ee, e.reportAllChanges), Ie((function() {
|
|
4975
4983
|
n.value = performance.now() - o.timeStamp, t(!0);
|
|
4976
4984
|
}));
|
|
4977
4985
|
})));
|
|
@@ -4988,8 +4996,8 @@ var ge, tt = -1, k = function(s) {
|
|
|
4988
4996
|
}, l = B("layout-shift", o);
|
|
4989
4997
|
l && (t = L(s, r, Se, e.reportAllChanges), ee((function() {
|
|
4990
4998
|
o(l.takeRecords()), t(!0);
|
|
4991
|
-
})),
|
|
4992
|
-
n = 0, r = b("CLS", 0), t = L(s, r, Se, e.reportAllChanges),
|
|
4999
|
+
})), V((function() {
|
|
5000
|
+
n = 0, r = b("CLS", 0), t = L(s, r, Se, e.reportAllChanges), Ie((function() {
|
|
4993
5001
|
return t();
|
|
4994
5002
|
}));
|
|
4995
5003
|
})), setTimeout(t, 0));
|
|
@@ -5005,8 +5013,8 @@ var ge, tt = -1, k = function(s) {
|
|
|
5005
5013
|
}, y = [], K = /* @__PURE__ */ new Map(), ot = 0, Dr = function() {
|
|
5006
5014
|
var s = Math.min(y.length - 1, Math.floor((it() - ot) / 50));
|
|
5007
5015
|
return y[s];
|
|
5008
|
-
},
|
|
5009
|
-
if (
|
|
5016
|
+
}, Vr = [], kr = function(s) {
|
|
5017
|
+
if (Vr.forEach((function(n) {
|
|
5010
5018
|
return n(s);
|
|
5011
5019
|
})), s.interactionId || s.entryType === "first-input") {
|
|
5012
5020
|
var e = y[y.length - 1], t = K.get(s.interactionId);
|
|
@@ -5032,14 +5040,14 @@ var ge, tt = -1, k = function(s) {
|
|
|
5032
5040
|
Pr();
|
|
5033
5041
|
var r, n = b("INP"), i = function(l) {
|
|
5034
5042
|
at((function() {
|
|
5035
|
-
l.forEach(
|
|
5043
|
+
l.forEach(kr);
|
|
5036
5044
|
var c = Dr();
|
|
5037
5045
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, r());
|
|
5038
5046
|
}));
|
|
5039
5047
|
}, o = B("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
5040
5048
|
r = L(s, n, pe, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), ee((function() {
|
|
5041
5049
|
i(o.takeRecords()), r(!0);
|
|
5042
|
-
})),
|
|
5050
|
+
})), V((function() {
|
|
5043
5051
|
ot = it(), y.length = 0, K.clear(), n = b("INP"), r = L(s, n, pe, e.reportAllChanges);
|
|
5044
5052
|
})));
|
|
5045
5053
|
})));
|
|
@@ -5059,8 +5067,8 @@ var ge, tt = -1, k = function(s) {
|
|
|
5059
5067
|
addEventListener(c, (function() {
|
|
5060
5068
|
return at(l);
|
|
5061
5069
|
}), { once: !0, capture: !0 });
|
|
5062
|
-
})), ee(l),
|
|
5063
|
-
n = b("LCP"), t = L(s, n, Te, e.reportAllChanges),
|
|
5070
|
+
})), ee(l), V((function(c) {
|
|
5071
|
+
n = b("LCP"), t = L(s, n, Te, e.reportAllChanges), Ie((function() {
|
|
5064
5072
|
n.value = performance.now() - c.timeStamp, ae[n.id] = !0, t(!0);
|
|
5065
5073
|
}));
|
|
5066
5074
|
}));
|
|
@@ -5072,17 +5080,17 @@ var ge, tt = -1, k = function(s) {
|
|
|
5072
5080
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
5073
5081
|
return s(e);
|
|
5074
5082
|
}), !0) : setTimeout(e, 0);
|
|
5075
|
-
},
|
|
5083
|
+
}, Fr = function(s, e) {
|
|
5076
5084
|
e = e || {};
|
|
5077
5085
|
var t = b("TTFB"), r = L(s, t, ve, e.reportAllChanges);
|
|
5078
5086
|
xr((function() {
|
|
5079
|
-
var n =
|
|
5080
|
-
n && (t.value = Math.max(n.responseStart - Z(), 0), t.entries = [n], r(!0),
|
|
5087
|
+
var n = _e();
|
|
5088
|
+
n && (t.value = Math.max(n.responseStart - Z(), 0), t.entries = [n], r(!0), V((function() {
|
|
5081
5089
|
t = b("TTFB", 0), (r = L(s, t, ve, e.reportAllChanges))(!0);
|
|
5082
5090
|
})));
|
|
5083
5091
|
}));
|
|
5084
5092
|
};
|
|
5085
|
-
const
|
|
5093
|
+
const $r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5086
5094
|
__proto__: null,
|
|
5087
5095
|
CLSThresholds: Se,
|
|
5088
5096
|
FCPThresholds: Ee,
|
|
@@ -5093,7 +5101,7 @@ const Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5093
5101
|
onFCP: st,
|
|
5094
5102
|
onINP: Ur,
|
|
5095
5103
|
onLCP: Hr,
|
|
5096
|
-
onTTFB:
|
|
5104
|
+
onTTFB: Fr
|
|
5097
5105
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5098
5106
|
export {
|
|
5099
5107
|
f as AppConfigValidationError,
|
|
@@ -5120,9 +5128,9 @@ export {
|
|
|
5120
5128
|
j as ScrollDirection,
|
|
5121
5129
|
gt as SessionTimeoutValidationError,
|
|
5122
5130
|
H as SpecialApiUrl,
|
|
5123
|
-
|
|
5131
|
+
$ as TraceLogValidationError,
|
|
5124
5132
|
es as WEB_VITALS_GOOD_THRESHOLDS,
|
|
5125
|
-
|
|
5133
|
+
ke as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
5126
5134
|
Nt as WEB_VITALS_POOR_THRESHOLDS,
|
|
5127
5135
|
Ue as getWebVitalsThresholds,
|
|
5128
5136
|
qr as isPrimaryScrollEvent,
|