@tracelog/lib 2.9.0-rc.108.13 → 2.9.0-rc.108.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/browser/tracelog-shopify-pixel.iife.js +1 -1
- package/dist/browser/tracelog-shopify-pixel.iife.js.map +1 -1
- package/dist/browser/tracelog.esm.js +255 -277
- 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/pixel/index.cjs +2 -2
- package/dist/pixel/index.cjs.map +1 -1
- package/dist/pixel/index.js +2 -2
- package/dist/pixel/index.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 +33 -44
- package/dist/public-api.d.ts +33 -44
- package/dist/public-api.js +2 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
const pr = 9e5;
|
|
2
|
+
const Sr = 120, Er = 49152, Tr = 100, Ir = 500, vr = 200;
|
|
3
|
+
const _r = 1e3, yr = 500, wr = 1e3;
|
|
4
4
|
const b = "data-tlog", bt = [
|
|
5
5
|
"button",
|
|
6
6
|
"a",
|
|
@@ -49,7 +49,7 @@ const b = "data-tlog", bt = [
|
|
|
49
49
|
"code",
|
|
50
50
|
"otp"
|
|
51
51
|
];
|
|
52
|
-
const
|
|
52
|
+
const E = {
|
|
53
53
|
INVALID_SESSION_TIMEOUT: "Session timeout must be between 30000ms (30 seconds) and 86400000ms (24 hours)",
|
|
54
54
|
INVALID_SAMPLING_RATE: "Sampling rate must be between 0 and 1",
|
|
55
55
|
INVALID_ERROR_SAMPLING_RATE: "Error sampling must be between 0 and 1",
|
|
@@ -79,7 +79,7 @@ const S = {
|
|
|
79
79
|
/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
|
80
80
|
/<embed\b[^>]*>/gi,
|
|
81
81
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
82
|
-
],
|
|
82
|
+
], v = "tlog", G = `${v}:qa_mode`, Ie = `${v}:uid`, rt = "tlog_mode", Ue = "qa", He = "qa_off", Ct = (r) => r ? `${v}:${r}:queue` : `${v}:queue`, Rt = (r) => r ? `${v}:${r}:rate_limit` : `${v}:rate_limit`, Nt = (r) => r ? `${v}:${r}:session` : `${v}:session`, Ot = (r) => r ? `${v}:${r}:broadcast` : `${v}:broadcast`, Fe = (r, e) => `${v}:${r}:session_counts:${e}`, xe = 10080 * 60 * 1e3, $e = `${v}:session_counts_last_cleanup`, Be = 3600 * 1e3, me = (r) => r ? `${v}:${r}:identity` : `${v}:identity`, H = `${v}:pending_identity`;
|
|
83
83
|
var $ = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))($ || {}), A = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(A || {}), se = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(se || {});
|
|
84
84
|
class O extends Error {
|
|
85
85
|
constructor(e, t, s) {
|
|
@@ -99,7 +99,7 @@ class ne extends Error {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
var u = /* @__PURE__ */ ((r) => (r.PAGE_VIEW = "page_view", r.CLICK = "click", r.SCROLL = "scroll", r.SESSION_START = "session_start", r.CUSTOM = "custom", r.WEB_VITALS = "web_vitals", r.ERROR = "error", r.VIEWPORT_VISIBLE = "viewport_visible", r))(u || {}), Z = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(Z || {}), B = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(B || {}), ie = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(ie || {});
|
|
102
|
-
const
|
|
102
|
+
const br = (r) => r.type === u.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !0, Lr = (r) => r.type === u.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !1;
|
|
103
103
|
class j extends Error {
|
|
104
104
|
constructor(e, t, s) {
|
|
105
105
|
super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
@@ -127,7 +127,7 @@ class N extends j {
|
|
|
127
127
|
super(e, "INTEGRATION_INVALID", t);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
class
|
|
130
|
+
class Ar extends j {
|
|
131
131
|
constructor(e, t, s = "runtime") {
|
|
132
132
|
super(e, "INITIALIZATION_TIMEOUT", s), this.timeoutMs = t;
|
|
133
133
|
}
|
|
@@ -164,12 +164,12 @@ const nt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
164
164
|
const { error: s, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, d = s ? kt(e, s) : `[TraceLog] ${e}`, c = r === "error" ? "error" : r === "warn" ? "warn" : "log";
|
|
165
165
|
if (!Ut(l, i))
|
|
166
166
|
return;
|
|
167
|
-
const
|
|
168
|
-
Ft(c, d,
|
|
167
|
+
const g = Ht(l, o), m = n !== void 0 ? ve(n) : void 0;
|
|
168
|
+
Ft(c, d, g, m);
|
|
169
169
|
}, Ut = (r, e) => r === "critical" ? !0 : r === "qa" || e ? Vt() : !1, Ht = (r, e) => e !== void 0 && e !== "" ? e : r === "critical" ? Dt : "", Ft = (r, e, t, s) => {
|
|
170
170
|
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
171
171
|
s !== void 0 ? n ? console[r](i, t, s) : console[r](i, s) : n ? console[r](i, t) : console[r](i);
|
|
172
|
-
},
|
|
172
|
+
}, ve = (r) => {
|
|
173
173
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
174
174
|
for (const [s, n] of Object.entries(r)) {
|
|
175
175
|
const i = s.toLowerCase();
|
|
@@ -177,8 +177,8 @@ const nt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
177
177
|
e[s] = "[REDACTED]";
|
|
178
178
|
continue;
|
|
179
179
|
}
|
|
180
|
-
n !== null && typeof n == "object" && !Array.isArray(n) ? e[s] =
|
|
181
|
-
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ?
|
|
180
|
+
n !== null && typeof n == "object" && !Array.isArray(n) ? e[s] = ve(n) : Array.isArray(n) ? e[s] = n.map(
|
|
181
|
+
(o) => o !== null && typeof o == "object" && !Array.isArray(o) ? ve(o) : o
|
|
182
182
|
) : e[s] = n;
|
|
183
183
|
}
|
|
184
184
|
return e;
|
|
@@ -254,7 +254,7 @@ const xt = () => {
|
|
|
254
254
|
/:\/\/[^:/]+:([^@]+)@/gi,
|
|
255
255
|
// Sensitive URL query parameters (token=, password=, auth=, secret=, api_key=, etc.)
|
|
256
256
|
/[?&](token|password|passwd|auth|secret|secret_key|private_key|auth_key|api_key|apikey|access_token)=[^&\s]+/gi
|
|
257
|
-
], Ge = 500, Xe = 2e3, je = 5e3, ee = 50, Xt = ee * 2, lt = 1, jt = 1e3, Kt = 10, Ke = 5e3,
|
|
257
|
+
], Ge = 500, Xe = 2e3, je = 5e3, ee = 50, Xt = ee * 2, lt = 1, jt = 1e3, Kt = 10, Ke = 5e3, zt = 6e4, Qt = 64, Mr = {
|
|
258
258
|
LCP: 2500,
|
|
259
259
|
// Good: ≤ 2.5s
|
|
260
260
|
FCP: 1800,
|
|
@@ -266,7 +266,7 @@ const xt = () => {
|
|
|
266
266
|
TTFB: 800,
|
|
267
267
|
// Good: ≤ 800ms
|
|
268
268
|
LONG_TASK: 50
|
|
269
|
-
},
|
|
269
|
+
}, ze = {
|
|
270
270
|
LCP: 2500,
|
|
271
271
|
// Needs improvement: > 2.5s (same as good boundary)
|
|
272
272
|
FCP: 1800,
|
|
@@ -290,17 +290,17 @@ const xt = () => {
|
|
|
290
290
|
TTFB: 1800,
|
|
291
291
|
// Poor: > 1800ms
|
|
292
292
|
LONG_TASK: 50
|
|
293
|
-
}, ye = "needs-improvement",
|
|
293
|
+
}, ye = "needs-improvement", Qe = (r = ye) => {
|
|
294
294
|
switch (r) {
|
|
295
295
|
case "all":
|
|
296
296
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
|
|
297
297
|
// Track everything
|
|
298
298
|
case "needs-improvement":
|
|
299
|
-
return
|
|
299
|
+
return ze;
|
|
300
300
|
case "poor":
|
|
301
301
|
return Yt;
|
|
302
302
|
default:
|
|
303
|
-
return
|
|
303
|
+
return ze;
|
|
304
304
|
}
|
|
305
305
|
}, qt = 1e3, Jt = 50, Zt = "2.9.0", es = Zt, ct = () => typeof window < "u" && typeof sessionStorage < "u", ts = () => {
|
|
306
306
|
try {
|
|
@@ -502,41 +502,41 @@ const os = () => {
|
|
|
502
502
|
throw new p("Configuration must be an object", "config");
|
|
503
503
|
if (r) {
|
|
504
504
|
if (r.sessionTimeout !== void 0 && (typeof r.sessionTimeout != "number" || r.sessionTimeout < 3e4 || r.sessionTimeout > 864e5))
|
|
505
|
-
throw new Pt(
|
|
505
|
+
throw new Pt(E.INVALID_SESSION_TIMEOUT, "config");
|
|
506
506
|
if (r.globalMetadata !== void 0 && (typeof r.globalMetadata != "object" || r.globalMetadata === null))
|
|
507
|
-
throw new p(
|
|
507
|
+
throw new p(E.INVALID_GLOBAL_METADATA, "config");
|
|
508
508
|
if (r.integrations && hs(r.integrations), r.sensitiveQueryParams !== void 0) {
|
|
509
509
|
if (!Array.isArray(r.sensitiveQueryParams))
|
|
510
|
-
throw new p(
|
|
510
|
+
throw new p(E.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
511
511
|
for (const e of r.sensitiveQueryParams)
|
|
512
512
|
if (typeof e != "string")
|
|
513
513
|
throw new p("All sensitive query params must be strings", "config");
|
|
514
514
|
}
|
|
515
515
|
if (r.errorSampling !== void 0 && (typeof r.errorSampling != "number" || r.errorSampling < 0 || r.errorSampling > 1))
|
|
516
|
-
throw new We(
|
|
516
|
+
throw new We(E.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
517
517
|
if (r.samplingRate !== void 0 && (typeof r.samplingRate != "number" || r.samplingRate < 0 || r.samplingRate > 1))
|
|
518
|
-
throw new We(
|
|
518
|
+
throw new We(E.INVALID_SAMPLING_RATE, "config");
|
|
519
519
|
if (r.primaryScrollSelector !== void 0) {
|
|
520
520
|
if (typeof r.primaryScrollSelector != "string" || !r.primaryScrollSelector.trim())
|
|
521
|
-
throw new p(
|
|
521
|
+
throw new p(E.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
522
522
|
if (r.primaryScrollSelector !== "window")
|
|
523
523
|
try {
|
|
524
524
|
document.querySelector(r.primaryScrollSelector);
|
|
525
525
|
} catch {
|
|
526
526
|
throw new p(
|
|
527
|
-
`${
|
|
527
|
+
`${E.INVALID_PRIMARY_SCROLL_SELECTOR_SYNTAX}: "${r.primaryScrollSelector}"`,
|
|
528
528
|
"config"
|
|
529
529
|
);
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
if (r.pageViewThrottleMs !== void 0 && (typeof r.pageViewThrottleMs != "number" || r.pageViewThrottleMs < 0))
|
|
533
|
-
throw new p(
|
|
533
|
+
throw new p(E.INVALID_PAGE_VIEW_THROTTLE, "config");
|
|
534
534
|
if (r.clickThrottleMs !== void 0 && (typeof r.clickThrottleMs != "number" || r.clickThrottleMs < 0))
|
|
535
|
-
throw new p(
|
|
535
|
+
throw new p(E.INVALID_CLICK_THROTTLE, "config");
|
|
536
536
|
if (r.maxSameEventPerMinute !== void 0 && (typeof r.maxSameEventPerMinute != "number" || r.maxSameEventPerMinute <= 0))
|
|
537
|
-
throw new p(
|
|
537
|
+
throw new p(E.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
|
|
538
538
|
if (r.sendIntervalMs !== void 0 && (!Number.isFinite(r.sendIntervalMs) || r.sendIntervalMs < 1e3 || r.sendIntervalMs > 6e4))
|
|
539
|
-
throw new p(
|
|
539
|
+
throw new p(E.INVALID_SEND_INTERVAL, "config");
|
|
540
540
|
if (r.flushOnSpaNavigation !== void 0 && typeof r.flushOnSpaNavigation != "boolean")
|
|
541
541
|
throw new p(
|
|
542
542
|
`Invalid flushOnSpaNavigation type: ${typeof r.flushOnSpaNavigation}. Must be a boolean`,
|
|
@@ -580,15 +580,15 @@ const os = () => {
|
|
|
580
580
|
}
|
|
581
581
|
}, us = (r) => {
|
|
582
582
|
if (typeof r != "object" || r === null)
|
|
583
|
-
throw new p(
|
|
583
|
+
throw new p(E.INVALID_VIEWPORT_CONFIG, "config");
|
|
584
584
|
if (!r.elements || !Array.isArray(r.elements))
|
|
585
|
-
throw new p(
|
|
585
|
+
throw new p(E.INVALID_VIEWPORT_ELEMENTS, "config");
|
|
586
586
|
if (r.elements.length === 0)
|
|
587
|
-
throw new p(
|
|
587
|
+
throw new p(E.INVALID_VIEWPORT_ELEMENTS, "config");
|
|
588
588
|
const e = /* @__PURE__ */ new Set();
|
|
589
589
|
for (const t of r.elements) {
|
|
590
590
|
if (!t.selector || typeof t.selector != "string" || !t.selector.trim())
|
|
591
|
-
throw new p(
|
|
591
|
+
throw new p(E.INVALID_VIEWPORT_ELEMENT, "config");
|
|
592
592
|
const s = t.selector.trim();
|
|
593
593
|
if (e.has(s))
|
|
594
594
|
throw new p(
|
|
@@ -596,25 +596,25 @@ const os = () => {
|
|
|
596
596
|
"config"
|
|
597
597
|
);
|
|
598
598
|
if (e.add(s), t.id !== void 0 && (typeof t.id != "string" || !t.id.trim()))
|
|
599
|
-
throw new p(
|
|
599
|
+
throw new p(E.INVALID_VIEWPORT_ELEMENT_ID, "config");
|
|
600
600
|
if (t.name !== void 0 && (typeof t.name != "string" || !t.name.trim()))
|
|
601
|
-
throw new p(
|
|
601
|
+
throw new p(E.INVALID_VIEWPORT_ELEMENT_NAME, "config");
|
|
602
602
|
}
|
|
603
603
|
if (r.threshold !== void 0 && (typeof r.threshold != "number" || r.threshold < 0 || r.threshold > 1))
|
|
604
|
-
throw new p(
|
|
604
|
+
throw new p(E.INVALID_VIEWPORT_THRESHOLD, "config");
|
|
605
605
|
if (r.minDwellTime !== void 0 && (typeof r.minDwellTime != "number" || r.minDwellTime < 0))
|
|
606
|
-
throw new p(
|
|
606
|
+
throw new p(E.INVALID_VIEWPORT_MIN_DWELL_TIME, "config");
|
|
607
607
|
if (r.cooldownPeriod !== void 0 && (typeof r.cooldownPeriod != "number" || r.cooldownPeriod < 0))
|
|
608
|
-
throw new p(
|
|
608
|
+
throw new p(E.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
|
|
609
609
|
if (r.maxTrackedElements !== void 0 && (typeof r.maxTrackedElements != "number" || r.maxTrackedElements <= 0))
|
|
610
|
-
throw new p(
|
|
610
|
+
throw new p(E.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
|
|
611
611
|
}, hs = (r) => {
|
|
612
612
|
if (r) {
|
|
613
613
|
if (r.tracelog && (!r.tracelog.projectId || typeof r.tracelog.projectId != "string" || r.tracelog.projectId.trim() === ""))
|
|
614
|
-
throw new N(
|
|
614
|
+
throw new N(E.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
615
615
|
if (r.custom) {
|
|
616
616
|
if (!r.custom.collectApiUrl || typeof r.custom.collectApiUrl != "string" || r.custom.collectApiUrl.trim() === "")
|
|
617
|
-
throw new N(
|
|
617
|
+
throw new N(E.INVALID_CUSTOM_API_URL, "config");
|
|
618
618
|
if (r.custom.allowHttp !== void 0 && typeof r.custom.allowHttp != "boolean")
|
|
619
619
|
throw new N("allowHttp must be a boolean", "config");
|
|
620
620
|
const e = r.custom.collectApiUrl.trim();
|
|
@@ -644,7 +644,7 @@ const os = () => {
|
|
|
644
644
|
clickThrottleMs: r?.clickThrottleMs ?? 300,
|
|
645
645
|
maxSameEventPerMinute: r?.maxSameEventPerMinute ?? 60,
|
|
646
646
|
sendIntervalMs: r?.sendIntervalMs ?? 1e4,
|
|
647
|
-
flushOnSpaNavigation: r?.flushOnSpaNavigation ?? !
|
|
647
|
+
flushOnSpaNavigation: r?.flushOnSpaNavigation ?? !1,
|
|
648
648
|
flushOnPageHidden: r?.flushOnPageHidden ?? !0
|
|
649
649
|
};
|
|
650
650
|
return e.integrations?.custom && (e.integrations.custom = {
|
|
@@ -773,7 +773,7 @@ const os = () => {
|
|
|
773
773
|
}
|
|
774
774
|
}), s;
|
|
775
775
|
};
|
|
776
|
-
class
|
|
776
|
+
class Ss {
|
|
777
777
|
listeners = /* @__PURE__ */ new Map();
|
|
778
778
|
/**
|
|
779
779
|
* Subscribes to an event channel
|
|
@@ -901,7 +901,7 @@ function mt(r, e, t) {
|
|
|
901
901
|
}), r;
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
|
-
function
|
|
904
|
+
function Es(r, e, t) {
|
|
905
905
|
return r.map((s) => mt(s, e, t)).filter((s) => s !== null);
|
|
906
906
|
}
|
|
907
907
|
function gt(r, e, t) {
|
|
@@ -920,7 +920,7 @@ function gt(r, e, t) {
|
|
|
920
920
|
}), r;
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
const
|
|
923
|
+
const Se = { config: {} };
|
|
924
924
|
class _ {
|
|
925
925
|
/**
|
|
926
926
|
* Retrieves a value from global state.
|
|
@@ -939,7 +939,7 @@ class _ {
|
|
|
939
939
|
* ```
|
|
940
940
|
*/
|
|
941
941
|
get(e) {
|
|
942
|
-
return
|
|
942
|
+
return Se[e];
|
|
943
943
|
}
|
|
944
944
|
/**
|
|
945
945
|
* Sets a value in global state.
|
|
@@ -959,7 +959,7 @@ class _ {
|
|
|
959
959
|
* ```
|
|
960
960
|
*/
|
|
961
961
|
set(e, t) {
|
|
962
|
-
|
|
962
|
+
Se[e] = t;
|
|
963
963
|
}
|
|
964
964
|
/**
|
|
965
965
|
* Returns an immutable snapshot of the entire global state.
|
|
@@ -976,7 +976,7 @@ class _ {
|
|
|
976
976
|
* ```
|
|
977
977
|
*/
|
|
978
978
|
getState() {
|
|
979
|
-
return { ...
|
|
979
|
+
return { ...Se };
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
982
|
class Ze extends _ {
|
|
@@ -1385,7 +1385,7 @@ class Ze extends _ {
|
|
|
1385
1385
|
const t = this.transformers.beforeSend;
|
|
1386
1386
|
if (!t)
|
|
1387
1387
|
return e;
|
|
1388
|
-
const s =
|
|
1388
|
+
const s = Es(
|
|
1389
1389
|
e.events,
|
|
1390
1390
|
t,
|
|
1391
1391
|
this.integrationId || "SenderManager"
|
|
@@ -1536,7 +1536,7 @@ class Ze extends _ {
|
|
|
1536
1536
|
}
|
|
1537
1537
|
), this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, !0) : !1;
|
|
1538
1538
|
} catch (f) {
|
|
1539
|
-
const
|
|
1539
|
+
const g = c === 3;
|
|
1540
1540
|
if (f instanceof O)
|
|
1541
1541
|
throw this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, f;
|
|
1542
1542
|
if (f instanceof re) {
|
|
@@ -1546,8 +1546,8 @@ class Ze extends _ {
|
|
|
1546
1546
|
break;
|
|
1547
1547
|
}
|
|
1548
1548
|
if (f instanceof ne || (l = !1), f instanceof TypeError || (d = !0), a(
|
|
1549
|
-
|
|
1550
|
-
`Send attempt ${c} failed${this.integrationId ? ` [${this.integrationId}]` : ""}${
|
|
1549
|
+
g ? "error" : "warn",
|
|
1550
|
+
`Send attempt ${c} failed${this.integrationId ? ` [${this.integrationId}]` : ""}${g ? " (all retries exhausted)" : ", will retry"}`,
|
|
1551
1551
|
{
|
|
1552
1552
|
error: f,
|
|
1553
1553
|
data: {
|
|
@@ -1557,7 +1557,7 @@ class Ze extends _ {
|
|
|
1557
1557
|
maxAttempts: 3
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
|
-
), !
|
|
1560
|
+
), !g) {
|
|
1561
1561
|
await this.backoffDelay(c);
|
|
1562
1562
|
continue;
|
|
1563
1563
|
}
|
|
@@ -1645,7 +1645,7 @@ class Ze extends _ {
|
|
|
1645
1645
|
async readTraceLogErrorCode(e) {
|
|
1646
1646
|
try {
|
|
1647
1647
|
const t = await e.clone().json();
|
|
1648
|
-
if (typeof t.code == "string" && t.code.length > 0 && t.code.length <=
|
|
1648
|
+
if (typeof t.code == "string" && t.code.length > 0 && t.code.length <= Qt)
|
|
1649
1649
|
return t.code;
|
|
1650
1650
|
} catch {
|
|
1651
1651
|
}
|
|
@@ -1906,7 +1906,7 @@ class Ze extends _ {
|
|
|
1906
1906
|
}
|
|
1907
1907
|
logPermanentError(e, t) {
|
|
1908
1908
|
const s = Date.now(), n = `${t.statusCode ?? "unknown"}:${t.responseCode ?? ""}`;
|
|
1909
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.key !== n || s - this.lastPermanentErrorLog.timestamp >=
|
|
1909
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.key !== n || s - this.lastPermanentErrorLog.timestamp >= zt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1910
1910
|
data: { status: t.statusCode, code: t.responseCode, message: t.message }
|
|
1911
1911
|
}), this.lastPermanentErrorLog = { key: n, timestamp: s });
|
|
1912
1912
|
}
|
|
@@ -2060,8 +2060,8 @@ class Ts extends _ {
|
|
|
2060
2060
|
};
|
|
2061
2061
|
}
|
|
2062
2062
|
}
|
|
2063
|
-
const
|
|
2064
|
-
class
|
|
2063
|
+
const Is = new Set(Object.values(u));
|
|
2064
|
+
class vs extends _ {
|
|
2065
2065
|
dataSenders;
|
|
2066
2066
|
emitter;
|
|
2067
2067
|
transformers;
|
|
@@ -2234,14 +2234,14 @@ class Is extends _ {
|
|
|
2234
2234
|
a("error", "Event type is required - event will be ignored");
|
|
2235
2235
|
return;
|
|
2236
2236
|
}
|
|
2237
|
-
if (!
|
|
2237
|
+
if (!Is.has(e)) {
|
|
2238
2238
|
a("error", "Invalid event type - event will be ignored", {
|
|
2239
2239
|
data: { type: e }
|
|
2240
2240
|
});
|
|
2241
2241
|
return;
|
|
2242
2242
|
}
|
|
2243
|
-
const
|
|
2244
|
-
if (!
|
|
2243
|
+
const g = this.get("sessionId");
|
|
2244
|
+
if (!g) {
|
|
2245
2245
|
this.pendingEventsBuffer.length >= 100 && (this.pendingEventsBuffer.shift(), a("debug", "Pending events buffer full - dropping oldest event", {
|
|
2246
2246
|
data: { maxBufferSize: 100 }
|
|
2247
2247
|
})), this.pendingEventsBuffer.push({
|
|
@@ -2258,47 +2258,47 @@ class Is extends _ {
|
|
|
2258
2258
|
});
|
|
2259
2259
|
return;
|
|
2260
2260
|
}
|
|
2261
|
-
this.lastSessionId !==
|
|
2262
|
-
const
|
|
2263
|
-
if (
|
|
2264
|
-
data: { sessionId:
|
|
2265
|
-
}), !
|
|
2261
|
+
this.lastSessionId !== g && (this.lastSessionId = g, this.sessionEventCounts = this.loadSessionCounts(g));
|
|
2262
|
+
const m = e === u.SESSION_START;
|
|
2263
|
+
if (m && a("debug", "Processing SESSION_START event", {
|
|
2264
|
+
data: { sessionId: g }
|
|
2265
|
+
}), !m && !this.checkRateLimit())
|
|
2266
2266
|
return;
|
|
2267
|
-
const
|
|
2268
|
-
if (!
|
|
2267
|
+
const S = e;
|
|
2268
|
+
if (!m) {
|
|
2269
2269
|
if (this.sessionEventCounts.total >= 1e3) {
|
|
2270
2270
|
a("warn", "Session event limit reached", {
|
|
2271
2271
|
data: {
|
|
2272
|
-
type:
|
|
2272
|
+
type: S,
|
|
2273
2273
|
total: this.sessionEventCounts.total,
|
|
2274
2274
|
limit: 1e3
|
|
2275
2275
|
}
|
|
2276
2276
|
});
|
|
2277
2277
|
return;
|
|
2278
2278
|
}
|
|
2279
|
-
const
|
|
2280
|
-
if (
|
|
2281
|
-
const fe = this.sessionEventCounts[
|
|
2282
|
-
if (fe !== void 0 && fe >=
|
|
2279
|
+
const I = this.getTypeLimitForEvent(S);
|
|
2280
|
+
if (I) {
|
|
2281
|
+
const fe = this.sessionEventCounts[S];
|
|
2282
|
+
if (fe !== void 0 && fe >= I) {
|
|
2283
2283
|
a("warn", "Session event type limit reached", {
|
|
2284
2284
|
data: {
|
|
2285
|
-
type:
|
|
2285
|
+
type: S,
|
|
2286
2286
|
count: fe,
|
|
2287
|
-
limit:
|
|
2287
|
+
limit: I
|
|
2288
2288
|
}
|
|
2289
2289
|
});
|
|
2290
2290
|
return;
|
|
2291
2291
|
}
|
|
2292
2292
|
}
|
|
2293
2293
|
}
|
|
2294
|
-
if (
|
|
2295
|
-
const
|
|
2296
|
-
if (!this.checkPerEventRateLimit(o.name,
|
|
2294
|
+
if (S === u.CUSTOM && o?.name) {
|
|
2295
|
+
const I = this.get("config")?.maxSameEventPerMinute ?? 60;
|
|
2296
|
+
if (!this.checkPerEventRateLimit(o.name, I))
|
|
2297
2297
|
return;
|
|
2298
2298
|
}
|
|
2299
|
-
const he =
|
|
2300
|
-
type:
|
|
2301
|
-
page_url:
|
|
2299
|
+
const he = S === u.SESSION_START, Q = t || this.get("pageUrl"), U = this.buildEventPayload({
|
|
2300
|
+
type: S,
|
|
2301
|
+
page_url: Q,
|
|
2302
2302
|
from_page_url: s,
|
|
2303
2303
|
scroll_data: n,
|
|
2304
2304
|
click_data: i,
|
|
@@ -2308,16 +2308,16 @@ class Is extends _ {
|
|
|
2308
2308
|
viewport_data: c,
|
|
2309
2309
|
page_view: f
|
|
2310
2310
|
});
|
|
2311
|
-
if (U && !(!
|
|
2311
|
+
if (U && !(!m && !this.shouldSample())) {
|
|
2312
2312
|
if (he) {
|
|
2313
|
-
const
|
|
2314
|
-
if (!
|
|
2313
|
+
const I = this.get("sessionId");
|
|
2314
|
+
if (!I) {
|
|
2315
2315
|
a("error", "Session start event requires sessionId - event will be ignored");
|
|
2316
2316
|
return;
|
|
2317
2317
|
}
|
|
2318
2318
|
if (this.get("hasStartSession")) {
|
|
2319
2319
|
a("debug", "Duplicate session_start detected", {
|
|
2320
|
-
data: { sessionId:
|
|
2320
|
+
data: { sessionId: I }
|
|
2321
2321
|
});
|
|
2322
2322
|
return;
|
|
2323
2323
|
}
|
|
@@ -2325,7 +2325,7 @@ class Is extends _ {
|
|
|
2325
2325
|
}
|
|
2326
2326
|
if (!this.isDuplicateEvent(U)) {
|
|
2327
2327
|
if (this.get("mode") === ie.QA) {
|
|
2328
|
-
if (
|
|
2328
|
+
if (S === u.CUSTOM && o) {
|
|
2329
2329
|
a("info", `Custom Event: ${o.name}`, {
|
|
2330
2330
|
visibility: "qa",
|
|
2331
2331
|
data: {
|
|
@@ -2335,9 +2335,9 @@ class Is extends _ {
|
|
|
2335
2335
|
}), this.emitEvent(U);
|
|
2336
2336
|
return;
|
|
2337
2337
|
}
|
|
2338
|
-
if (
|
|
2339
|
-
const
|
|
2340
|
-
a("info", `Viewport Visible: ${
|
|
2338
|
+
if (S === u.VIEWPORT_VISIBLE && c) {
|
|
2339
|
+
const I = c.name || c.id || c.selector;
|
|
2340
|
+
a("info", `Viewport Visible: ${I}`, {
|
|
2341
2341
|
visibility: "qa",
|
|
2342
2342
|
data: {
|
|
2343
2343
|
selector: c.selector,
|
|
@@ -2350,10 +2350,10 @@ class Is extends _ {
|
|
|
2350
2350
|
return;
|
|
2351
2351
|
}
|
|
2352
2352
|
}
|
|
2353
|
-
if (this.addToQueue(U), !
|
|
2354
|
-
this.sessionEventCounts.total++, this.sessionEventCounts[
|
|
2355
|
-
const
|
|
2356
|
-
|
|
2353
|
+
if (this.addToQueue(U), !m) {
|
|
2354
|
+
this.sessionEventCounts.total++, this.sessionEventCounts[S] !== void 0 && this.sessionEventCounts[S]++;
|
|
2355
|
+
const I = this.get("sessionId");
|
|
2356
|
+
I && this.saveSessionCountsDebounced && this.saveSessionCountsDebounced(I);
|
|
2357
2357
|
}
|
|
2358
2358
|
}
|
|
2359
2359
|
}
|
|
@@ -2426,7 +2426,10 @@ class Is extends _ {
|
|
|
2426
2426
|
* **Note**: For page unload, use `flushImmediatelySync()` instead,
|
|
2427
2427
|
* which uses `sendBeacon()` for guaranteed delivery.
|
|
2428
2428
|
*
|
|
2429
|
-
* @returns Promise resolving to `true` if
|
|
2429
|
+
* @returns Promise resolving to `true` if at least one integration accepted
|
|
2430
|
+
* the batch during this call (optimistic removal — failures
|
|
2431
|
+
* persist per-integration for retry). `false` if no events, all
|
|
2432
|
+
* senders failed, or a flush is already in flight.
|
|
2430
2433
|
*
|
|
2431
2434
|
* @example
|
|
2432
2435
|
* ```typescript
|
|
@@ -2464,7 +2467,14 @@ class Is extends _ {
|
|
|
2464
2467
|
* - No retry on failure (sendBeacon is fire-and-forget)
|
|
2465
2468
|
* - 64KB payload limit (large batches may be truncated)
|
|
2466
2469
|
*
|
|
2467
|
-
*
|
|
2470
|
+
* **In-flight contract**: if an async send is already running this call is
|
|
2471
|
+
* deferred (queued for replay in the async send's `finally` block) and
|
|
2472
|
+
* returns `false` — nothing has been delivered yet at the point of return.
|
|
2473
|
+
* Mirrors `flushImmediately()`'s behaviour for the same condition.
|
|
2474
|
+
*
|
|
2475
|
+
* @returns `true` if at least one integration accepted the beacon batch
|
|
2476
|
+
* *during this call*, `false` otherwise (no events, all senders
|
|
2477
|
+
* failed, or the call was deferred behind an in-flight async send)
|
|
2468
2478
|
*
|
|
2469
2479
|
* @example
|
|
2470
2480
|
* ```typescript
|
|
@@ -2480,62 +2490,6 @@ class Is extends _ {
|
|
|
2480
2490
|
flushImmediatelySync() {
|
|
2481
2491
|
return this.flushEvents(!0);
|
|
2482
2492
|
}
|
|
2483
|
-
/**
|
|
2484
|
-
* Sends ONLY the most recently queued event via `navigator.sendBeacon()` in
|
|
2485
|
-
* a dedicated single-event batch.
|
|
2486
|
-
*
|
|
2487
|
-
* **Purpose**: Guarantee delivery of an event that *must* survive an
|
|
2488
|
-
* imminent page unload (purchase confirmation, signup completion, etc.),
|
|
2489
|
-
* independent of the main queue's size or in-flight async send state.
|
|
2490
|
-
*
|
|
2491
|
-
* **Why a dedicated batch**: `flushImmediatelySync()` serialises the entire
|
|
2492
|
-
* queue into one `sendBeacon` call. If the queue is heavy (>64KB) the
|
|
2493
|
-
* beacon fails and the batch is persisted to `localStorage`, which is only
|
|
2494
|
-
* recovered on the next `init()` — useless for one-shot conversion events
|
|
2495
|
-
* where the user never returns.
|
|
2496
|
-
*
|
|
2497
|
-
* **Behaviour**:
|
|
2498
|
-
* - Reads the last entry of `eventsQueue` (the just-tracked event).
|
|
2499
|
-
* - Wraps it in its own `EventsQueue` and dispatches synchronously through
|
|
2500
|
-
* every `SenderManager` via `sendEventsQueueSync()`.
|
|
2501
|
-
* - Leaves the main queue untouched; the same event will be re-delivered by
|
|
2502
|
-
* the next periodic / unload flush. Idempotency is the caller-side
|
|
2503
|
-
* contract: the backend MUST deduplicate by `event.id` (e.g. unique index
|
|
2504
|
-
* on the ingestion collection) — same guarantee the library already
|
|
2505
|
-
* relies on for the persisted-events recovery path.
|
|
2506
|
-
*
|
|
2507
|
-
* **Use it after** `track()` so the event is in the queue. Caller is
|
|
2508
|
-
* responsible for verifying that `track()` actually queued the event
|
|
2509
|
-
* (it can be dropped by rate limiting / sampling / `beforeSend`).
|
|
2510
|
-
*
|
|
2511
|
-
* **Standalone mode** (no senders configured): returns `false` without
|
|
2512
|
-
* emitting. The subsequent main-queue drain (`flushImmediatelySync()`) is
|
|
2513
|
-
* responsible for delivering the event to local listeners — emitting here
|
|
2514
|
-
* too would surface the same event twice to a `tracelog.on('queue', ...)`
|
|
2515
|
-
* subscriber.
|
|
2516
|
-
*
|
|
2517
|
-
* @returns `true` if at least one sender delivered the beacon successfully,
|
|
2518
|
-
* `false` otherwise (including standalone mode — the drain handles it).
|
|
2519
|
-
*/
|
|
2520
|
-
flushLastEventSync() {
|
|
2521
|
-
if (this.dataSenders.length === 0)
|
|
2522
|
-
return !1;
|
|
2523
|
-
const e = this.eventsQueue[this.eventsQueue.length - 1];
|
|
2524
|
-
if (!e)
|
|
2525
|
-
return !1;
|
|
2526
|
-
const { _session_id: t, ...s } = e;
|
|
2527
|
-
if (!t)
|
|
2528
|
-
return a("debug", "flushLastEventSync: last queued event missing _session_id, skipping"), !1;
|
|
2529
|
-
const n = this.get("config")?.globalMetadata, i = this.get("identity"), o = {
|
|
2530
|
-
user_id: this.get("userId"),
|
|
2531
|
-
session_id: t,
|
|
2532
|
-
device: this.get("device"),
|
|
2533
|
-
events: [s],
|
|
2534
|
-
...n && { global_metadata: n },
|
|
2535
|
-
...i && { identify: i }
|
|
2536
|
-
};
|
|
2537
|
-
return this.dataSenders.map((d) => d.sendEventsQueueSync(o)).some(Boolean);
|
|
2538
|
-
}
|
|
2539
2493
|
/**
|
|
2540
2494
|
* Sets the custom headers provider callback for the custom integration.
|
|
2541
2495
|
* Only affects requests to custom backend (not TraceLog SaaS).
|
|
@@ -2727,23 +2681,37 @@ class Is extends _ {
|
|
|
2727
2681
|
const s = t.reduce((n, i) => n + i.eventIds.length, 0);
|
|
2728
2682
|
return this.pendingSyncFlush = !0, a("debug", "Sync flush deferred: async send in-flight, will retry on settle", {
|
|
2729
2683
|
data: { eventCount: s }
|
|
2730
|
-
}), !
|
|
2684
|
+
}), !1;
|
|
2731
2685
|
}
|
|
2732
2686
|
if (e) {
|
|
2733
2687
|
const s = t.map(({ batch: n, eventIds: i }) => this.sendBatchSync(n, i));
|
|
2734
|
-
return this.
|
|
2688
|
+
return this.settleSendTimeout(), s.some(Boolean);
|
|
2735
2689
|
}
|
|
2736
2690
|
return this.sendInProgress = !0, (async () => {
|
|
2737
2691
|
try {
|
|
2738
2692
|
const s = await Promise.all(
|
|
2739
2693
|
t.map(async ({ batch: n, eventIds: i }) => this.sendBatchAsync(n, i))
|
|
2740
2694
|
);
|
|
2741
|
-
return this.
|
|
2695
|
+
return this.settleSendTimeout(), s.some(Boolean);
|
|
2742
2696
|
} finally {
|
|
2743
2697
|
this.sendInProgress = !1, this.drainPendingSyncFlush();
|
|
2744
2698
|
}
|
|
2745
2699
|
})();
|
|
2746
2700
|
}
|
|
2701
|
+
/**
|
|
2702
|
+
* Reconciles the periodic send timer after a flush attempt. Clears the
|
|
2703
|
+
* timer when the queue is empty, otherwise (re)schedules a retry tick.
|
|
2704
|
+
*
|
|
2705
|
+
* **Why**: a `flushImmediately()` / `flushImmediatelySync()` call where all
|
|
2706
|
+
* integrations fail leaves events in `eventsQueue` for retry. The periodic
|
|
2707
|
+
* timer is the safety net that drains them when the backend recovers — if
|
|
2708
|
+
* we cleared it unconditionally here, the queue would sit untouched until
|
|
2709
|
+
* the next tracked event resurrects the timer in `addToQueue`. Mirrors the
|
|
2710
|
+
* pattern in `sendEventsQueue()` (the periodic path).
|
|
2711
|
+
*/
|
|
2712
|
+
settleSendTimeout() {
|
|
2713
|
+
this.eventsQueue.length === 0 ? this.clearSendTimeout() : this.scheduleSendTimeout();
|
|
2714
|
+
}
|
|
2747
2715
|
/**
|
|
2748
2716
|
* Re-runs a sync flush that was deferred while an async send was in flight.
|
|
2749
2717
|
*
|
|
@@ -2831,11 +2799,11 @@ class Is extends _ {
|
|
|
2831
2799
|
*/
|
|
2832
2800
|
buildBatchFromGroup(e, t) {
|
|
2833
2801
|
const s = /* @__PURE__ */ new Map(), n = [];
|
|
2834
|
-
for (const
|
|
2835
|
-
const
|
|
2836
|
-
s.has(
|
|
2802
|
+
for (const m of t) {
|
|
2803
|
+
const S = this.createEventSignature(m);
|
|
2804
|
+
s.has(S) || n.push(S), s.set(S, m);
|
|
2837
2805
|
}
|
|
2838
|
-
const i = n.map((
|
|
2806
|
+
const i = n.map((m) => s.get(m)).filter((m) => !!m).sort((m, S) => m.type === u.SESSION_START && S.type !== u.SESSION_START ? -1 : S.type === u.SESSION_START && m.type !== u.SESSION_START ? 1 : m.timestamp - S.timestamp).map(({ _session_id: m, ...S }) => S), o = this.get("config")?.globalMetadata, l = this.get("identity");
|
|
2839
2807
|
let d = {
|
|
2840
2808
|
user_id: this.get("userId"),
|
|
2841
2809
|
session_id: e,
|
|
@@ -2844,10 +2812,10 @@ class Is extends _ {
|
|
|
2844
2812
|
...o && { global_metadata: o },
|
|
2845
2813
|
...l && { identify: l }
|
|
2846
2814
|
};
|
|
2847
|
-
const c = this.get("collectApiUrls"), f = !!(c?.custom || c?.saas),
|
|
2848
|
-
if (!f &&
|
|
2849
|
-
const
|
|
2850
|
-
|
|
2815
|
+
const c = this.get("collectApiUrls"), f = !!(c?.custom || c?.saas), g = this.transformers.beforeBatch;
|
|
2816
|
+
if (!f && g) {
|
|
2817
|
+
const m = gt(d, g, "EventManager");
|
|
2818
|
+
m !== null && (d = m);
|
|
2851
2819
|
}
|
|
2852
2820
|
return d;
|
|
2853
2821
|
}
|
|
@@ -2879,12 +2847,12 @@ class Is extends _ {
|
|
|
2879
2847
|
...e.page_view && { page_view: e.page_view },
|
|
2880
2848
|
...d && { utm: d }
|
|
2881
2849
|
};
|
|
2882
|
-
const f = this.get("collectApiUrls"),
|
|
2883
|
-
if (
|
|
2884
|
-
const
|
|
2885
|
-
if (
|
|
2850
|
+
const f = this.get("collectApiUrls"), g = !!f?.custom, m = !!f?.saas, S = g || m, he = g && m, Q = this.transformers.beforeSend;
|
|
2851
|
+
if (Q && (!S || g && !he)) {
|
|
2852
|
+
const I = mt(c, Q, "EventManager");
|
|
2853
|
+
if (I === null)
|
|
2886
2854
|
return null;
|
|
2887
|
-
c =
|
|
2855
|
+
c = I;
|
|
2888
2856
|
}
|
|
2889
2857
|
return { ...c, _session_id: t };
|
|
2890
2858
|
}
|
|
@@ -3122,7 +3090,7 @@ class Is extends _ {
|
|
|
3122
3090
|
return;
|
|
3123
3091
|
}
|
|
3124
3092
|
}
|
|
3125
|
-
const t = this.get("userId") || "anonymous", s = `${
|
|
3093
|
+
const t = this.get("userId") || "anonymous", s = `${v}:${t}:session_counts:`, n = [];
|
|
3126
3094
|
for (let i = 0; i < localStorage.length; i++) {
|
|
3127
3095
|
const o = localStorage.key(i);
|
|
3128
3096
|
if (o?.startsWith(s))
|
|
@@ -3205,11 +3173,11 @@ class _s {
|
|
|
3205
3173
|
* @returns Persistent unique user ID (UUID v4 format)
|
|
3206
3174
|
*/
|
|
3207
3175
|
static getId(e) {
|
|
3208
|
-
const t = e.getItem(
|
|
3176
|
+
const t = e.getItem(Ie);
|
|
3209
3177
|
if (t)
|
|
3210
3178
|
return t;
|
|
3211
3179
|
const s = dt();
|
|
3212
|
-
return e.setItem(
|
|
3180
|
+
return e.setItem(Ie, s), s;
|
|
3213
3181
|
}
|
|
3214
3182
|
}
|
|
3215
3183
|
const ys = /^\d{13}-[a-z0-9]{9}$/;
|
|
@@ -3687,7 +3655,7 @@ class Ls extends _ {
|
|
|
3687
3655
|
page_url: this.get("pageUrl"),
|
|
3688
3656
|
from_page_url: i,
|
|
3689
3657
|
...o && { page_view: o }
|
|
3690
|
-
}), this.get("config").flushOnSpaNavigation
|
|
3658
|
+
}), this.get("config").flushOnSpaNavigation === !0 && this.eventManager.flushImmediately();
|
|
3691
3659
|
};
|
|
3692
3660
|
trackInitialPageView() {
|
|
3693
3661
|
const e = we(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
|
|
@@ -3745,12 +3713,12 @@ class As extends _ {
|
|
|
3745
3713
|
if (o) {
|
|
3746
3714
|
const f = this.extractTrackingData(o);
|
|
3747
3715
|
if (f) {
|
|
3748
|
-
const
|
|
3716
|
+
const g = this.createCustomEventData(f);
|
|
3749
3717
|
this.eventManager.track({
|
|
3750
3718
|
type: u.CUSTOM,
|
|
3751
3719
|
custom_event: {
|
|
3752
|
-
name:
|
|
3753
|
-
...
|
|
3720
|
+
name: g.name,
|
|
3721
|
+
...g.value && { metadata: { value: g.value } }
|
|
3754
3722
|
}
|
|
3755
3723
|
});
|
|
3756
3724
|
}
|
|
@@ -4156,14 +4124,14 @@ class Ms extends _ {
|
|
|
4156
4124
|
const { element: t, lastScrollPos: s, lastEventTime: n } = e, i = this.getScrollTop(t), o = Date.now(), l = Math.abs(i - s);
|
|
4157
4125
|
if (l < 10 || t === window && !this.isWindowScrollable())
|
|
4158
4126
|
return null;
|
|
4159
|
-
const d = this.getViewportHeight(t), c = this.getScrollHeight(t), f = this.getScrollDirection(i, s),
|
|
4160
|
-
let
|
|
4161
|
-
n > 0 ?
|
|
4162
|
-
const
|
|
4163
|
-
return
|
|
4164
|
-
depth:
|
|
4127
|
+
const d = this.getViewportHeight(t), c = this.getScrollHeight(t), f = this.getScrollDirection(i, s), g = this.calculateScrollDepth(i, c, d);
|
|
4128
|
+
let m;
|
|
4129
|
+
n > 0 ? m = o - n : e.firstScrollEventTime !== null ? m = o - e.firstScrollEventTime : m = 250;
|
|
4130
|
+
const S = Math.round(l / m * 1e3);
|
|
4131
|
+
return g > e.maxDepthReached && (e.maxDepthReached = g), e.lastScrollPos = i, {
|
|
4132
|
+
depth: g,
|
|
4165
4133
|
direction: f,
|
|
4166
|
-
velocity:
|
|
4134
|
+
velocity: S,
|
|
4167
4135
|
max_depth_reached: e.maxDepthReached
|
|
4168
4136
|
};
|
|
4169
4137
|
}
|
|
@@ -4715,7 +4683,7 @@ class Ds extends _ {
|
|
|
4715
4683
|
navigationCounter = 0;
|
|
4716
4684
|
// Counter for handling simultaneous navigations edge case
|
|
4717
4685
|
constructor(e) {
|
|
4718
|
-
super(), this.eventManager = e, this.vitalThresholds =
|
|
4686
|
+
super(), this.eventManager = e, this.vitalThresholds = Qe(ye);
|
|
4719
4687
|
}
|
|
4720
4688
|
/**
|
|
4721
4689
|
* Starts tracking Web Vitals and performance metrics.
|
|
@@ -4733,7 +4701,7 @@ class Ds extends _ {
|
|
|
4733
4701
|
*/
|
|
4734
4702
|
async startTracking() {
|
|
4735
4703
|
const e = this.get("config"), t = e?.webVitalsMode ?? ye;
|
|
4736
|
-
this.vitalThresholds =
|
|
4704
|
+
this.vitalThresholds = Qe(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
|
|
4737
4705
|
}
|
|
4738
4706
|
/**
|
|
4739
4707
|
* Stops tracking Web Vitals and cleans up resources.
|
|
@@ -4803,7 +4771,7 @@ class Ds extends _ {
|
|
|
4803
4771
|
}
|
|
4804
4772
|
async initWebVitals() {
|
|
4805
4773
|
try {
|
|
4806
|
-
const { onLCP: e, onCLS: t, onFCP: s, onTTFB: n, onINP: i } = await Promise.resolve().then(() =>
|
|
4774
|
+
const { onLCP: e, onCLS: t, onFCP: s, onTTFB: n, onINP: i } = await Promise.resolve().then(() => gr), o = (l) => (d) => {
|
|
4807
4775
|
const c = Number(d.value.toFixed(2));
|
|
4808
4776
|
this.sendVital({ type: l, value: c });
|
|
4809
4777
|
};
|
|
@@ -5075,7 +5043,7 @@ class ks extends _ {
|
|
|
5075
5043
|
pageUnloadHandler = null;
|
|
5076
5044
|
pageShowHandler = null;
|
|
5077
5045
|
visibilityFlushHandler = null;
|
|
5078
|
-
emitter = new
|
|
5046
|
+
emitter = new Ss();
|
|
5079
5047
|
transformers = {};
|
|
5080
5048
|
customHeadersProvider;
|
|
5081
5049
|
managers = {};
|
|
@@ -5098,7 +5066,7 @@ class ks extends _ {
|
|
|
5098
5066
|
try {
|
|
5099
5067
|
this.setupState(e);
|
|
5100
5068
|
const t = e.integrations?.custom?.headers ?? {}, s = e.integrations?.custom?.fetchCredentials ?? "include";
|
|
5101
|
-
return this.managers.event = new
|
|
5069
|
+
return this.managers.event = new vs(
|
|
5102
5070
|
this.managers.storage,
|
|
5103
5071
|
this.emitter,
|
|
5104
5072
|
this.transformers,
|
|
@@ -5121,7 +5089,10 @@ class ks extends _ {
|
|
|
5121
5089
|
* Use when you need to force-send buffered events without waiting for the next send interval
|
|
5122
5090
|
* (e.g., before a critical user action like sign-out, or before a SPA route teardown).
|
|
5123
5091
|
*
|
|
5124
|
-
* @returns Promise<boolean> — `true` if
|
|
5092
|
+
* @returns Promise<boolean> — `true` if at least one integration accepted
|
|
5093
|
+
* the batch (optimistic removal — failures persist per-integration
|
|
5094
|
+
* and retry on the next flush). `false` if not initialized,
|
|
5095
|
+
* destroying, another flush is in flight, or all senders failed.
|
|
5125
5096
|
* @internal Called from api.flushImmediately()
|
|
5126
5097
|
*/
|
|
5127
5098
|
async flushImmediately() {
|
|
@@ -5133,7 +5104,10 @@ class ks extends _ {
|
|
|
5133
5104
|
* Use only for page-unload scenarios (or equivalent) where async fetch may be cancelled.
|
|
5134
5105
|
* For general flush needs, prefer {@link flushImmediately}.
|
|
5135
5106
|
*
|
|
5136
|
-
* @returns `true` if
|
|
5107
|
+
* @returns `true` if at least one integration accepted the beacon batch
|
|
5108
|
+
* during this call (optimistic removal — failures persist
|
|
5109
|
+
* per-integration). `false` if no events, all senders failed, or
|
|
5110
|
+
* the call was deferred behind an in-flight async send.
|
|
5137
5111
|
* @internal Called from api.flushImmediatelySync()
|
|
5138
5112
|
*/
|
|
5139
5113
|
flushImmediatelySync() {
|
|
@@ -5144,14 +5118,14 @@ class ks extends _ {
|
|
|
5144
5118
|
*
|
|
5145
5119
|
* @param name - Event name
|
|
5146
5120
|
* @param metadata - Optional metadata
|
|
5147
|
-
* @param options - Optional event options. `{ critical: true }`
|
|
5148
|
-
*
|
|
5149
|
-
*
|
|
5150
|
-
*
|
|
5151
|
-
*
|
|
5152
|
-
*
|
|
5153
|
-
*
|
|
5154
|
-
*
|
|
5121
|
+
* @param options - Optional event options. `{ critical: true }` drains the
|
|
5122
|
+
* queue via `navigator.sendBeacon()` immediately after tracking — the
|
|
5123
|
+
* browser guarantees the request is queued for delivery even if the page
|
|
5124
|
+
* is about to unload (typical pattern: tracking a purchase, then
|
|
5125
|
+
* `window.location.href = '/thanks'`). If an async fetch is already in
|
|
5126
|
+
* flight when the critical event is tracked, the sync flush is deferred
|
|
5127
|
+
* and re-runs from the async send's `finally` block so the critical
|
|
5128
|
+
* event is not stranded in the queue.
|
|
5155
5129
|
* @internal Called from api.event()
|
|
5156
5130
|
*/
|
|
5157
5131
|
sendCustomEvent(e, t, s) {
|
|
@@ -5168,21 +5142,15 @@ class ks extends _ {
|
|
|
5168
5142
|
a("warn", `Custom event "${e}" dropped: ${o}`);
|
|
5169
5143
|
return;
|
|
5170
5144
|
}
|
|
5171
|
-
|
|
5172
|
-
if (this.managers.event.track({
|
|
5145
|
+
this.managers.event.track({
|
|
5173
5146
|
type: u.CUSTOM,
|
|
5174
5147
|
custom_event: {
|
|
5175
5148
|
name: e,
|
|
5176
5149
|
...l && { metadata: l }
|
|
5177
5150
|
}
|
|
5178
|
-
}), s?.critical === !0) {
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
return;
|
|
5182
|
-
}
|
|
5183
|
-
const f = this.managers.event.flushLastEventSync(), m = this.managers.event.flushImmediatelySync();
|
|
5184
|
-
!f && !m && a("debug", "Critical event: dedicated beacon and queue drain both failed", { data: { name: e } });
|
|
5185
|
-
}
|
|
5151
|
+
}), s?.critical === !0 && (this.managers.event.flushImmediatelySync() || a("debug", "Critical event flush returned false (deferred to in-flight send or empty queue)", {
|
|
5152
|
+
data: { name: e }
|
|
5153
|
+
}));
|
|
5186
5154
|
}
|
|
5187
5155
|
on(e, t) {
|
|
5188
5156
|
this.emitter.on(e, t);
|
|
@@ -5284,6 +5252,15 @@ class ks extends _ {
|
|
|
5284
5252
|
getSessionId() {
|
|
5285
5253
|
return this.get("sessionId");
|
|
5286
5254
|
}
|
|
5255
|
+
/**
|
|
5256
|
+
* Returns the current user ID.
|
|
5257
|
+
*
|
|
5258
|
+
* @returns The user ID string, or null if not yet initialized
|
|
5259
|
+
* @internal Used by api.getUserId()
|
|
5260
|
+
*/
|
|
5261
|
+
getUserId() {
|
|
5262
|
+
return this.get("userId");
|
|
5263
|
+
}
|
|
5287
5264
|
/**
|
|
5288
5265
|
* Validates metadata object structure and values.
|
|
5289
5266
|
*
|
|
@@ -5384,7 +5361,7 @@ class ks extends _ {
|
|
|
5384
5361
|
async resetIdentity() {
|
|
5385
5362
|
await this.managers.event?.flushImmediately(), this.set("identity", void 0), this.clearPersistedIdentity();
|
|
5386
5363
|
const e = dt();
|
|
5387
|
-
this.managers.storage.setItem(
|
|
5364
|
+
this.managers.storage.setItem(Ie, 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");
|
|
5388
5365
|
}
|
|
5389
5366
|
/**
|
|
5390
5367
|
* Returns the project ID used for identity storage scoping.
|
|
@@ -5601,7 +5578,7 @@ const Ws = (r) => {
|
|
|
5601
5578
|
throw new Error("[TraceLog] Cannot remove custom headers while TraceLog is being destroyed");
|
|
5602
5579
|
h.removeCustomHeaders();
|
|
5603
5580
|
}
|
|
5604
|
-
}, js = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, Ks = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), Qs = () => {
|
|
5581
|
+
}, js = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, Ks = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), zs = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getUserId(), Qs = () => {
|
|
5605
5582
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5606
5583
|
if (T)
|
|
5607
5584
|
throw new Error("[TraceLog] Destroy operation already in progress");
|
|
@@ -5616,9 +5593,9 @@ const Ws = (r) => {
|
|
|
5616
5593
|
h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, T = !1, a("warn", "Error during destroy, forced cleanup completed", { error: r });
|
|
5617
5594
|
}
|
|
5618
5595
|
}
|
|
5619
|
-
}, zs = (r) => {
|
|
5620
|
-
typeof window > "u" || typeof document > "u" || rs(r);
|
|
5621
5596
|
}, Ys = (r) => {
|
|
5597
|
+
typeof window > "u" || typeof document > "u" || rs(r);
|
|
5598
|
+
}, qs = (r) => {
|
|
5622
5599
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5623
5600
|
if (!h)
|
|
5624
5601
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -5626,7 +5603,7 @@ const Ws = (r) => {
|
|
|
5626
5603
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5627
5604
|
h.updateGlobalMetadata(r);
|
|
5628
5605
|
}
|
|
5629
|
-
},
|
|
5606
|
+
}, Js = (r) => {
|
|
5630
5607
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5631
5608
|
if (!h)
|
|
5632
5609
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
@@ -5634,7 +5611,7 @@ const Ws = (r) => {
|
|
|
5634
5611
|
throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
|
|
5635
5612
|
h.mergeGlobalMetadata(r);
|
|
5636
5613
|
}
|
|
5637
|
-
},
|
|
5614
|
+
}, Zs = (r, e) => {
|
|
5638
5615
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5639
5616
|
if (!r || typeof r != "string" || r.trim().length === 0) {
|
|
5640
5617
|
a("warn", "identify() called with invalid userId");
|
|
@@ -5662,7 +5639,7 @@ const Ws = (r) => {
|
|
|
5662
5639
|
a("debug", "Failed to persist pre-init identity");
|
|
5663
5640
|
}
|
|
5664
5641
|
}
|
|
5665
|
-
},
|
|
5642
|
+
}, er = async () => {
|
|
5666
5643
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5667
5644
|
if (!h) {
|
|
5668
5645
|
try {
|
|
@@ -5675,7 +5652,7 @@ const Ws = (r) => {
|
|
|
5675
5652
|
throw new Error("[TraceLog] Cannot reset identity while TraceLog is being destroyed");
|
|
5676
5653
|
await h.resetIdentity();
|
|
5677
5654
|
}
|
|
5678
|
-
},
|
|
5655
|
+
}, Cr = {
|
|
5679
5656
|
init: Vs,
|
|
5680
5657
|
event: Us,
|
|
5681
5658
|
on: xs,
|
|
@@ -5686,18 +5663,19 @@ const Ws = (r) => {
|
|
|
5686
5663
|
removeCustomHeaders: Xs,
|
|
5687
5664
|
isInitialized: js,
|
|
5688
5665
|
getSessionId: Ks,
|
|
5666
|
+
getUserId: zs,
|
|
5689
5667
|
destroy: Qs,
|
|
5690
|
-
setQaMode:
|
|
5691
|
-
updateGlobalMetadata:
|
|
5692
|
-
mergeGlobalMetadata:
|
|
5693
|
-
identify:
|
|
5694
|
-
resetIdentity:
|
|
5668
|
+
setQaMode: Ys,
|
|
5669
|
+
updateGlobalMetadata: qs,
|
|
5670
|
+
mergeGlobalMetadata: Js,
|
|
5671
|
+
identify: Zs,
|
|
5672
|
+
resetIdentity: er,
|
|
5695
5673
|
flushImmediately: Hs,
|
|
5696
5674
|
flushImmediatelySync: Fs
|
|
5697
5675
|
};
|
|
5698
|
-
var Ae, C, X, pt, le,
|
|
5676
|
+
var Ae, C, X, pt, le, St = -1, V = function(r) {
|
|
5699
5677
|
addEventListener("pageshow", (function(e) {
|
|
5700
|
-
e.persisted && (
|
|
5678
|
+
e.persisted && (St = e.timeStamp, r(e));
|
|
5701
5679
|
}), !0);
|
|
5702
5680
|
}, De = function() {
|
|
5703
5681
|
var r = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
@@ -5707,7 +5685,7 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5707
5685
|
return r && r.activationStart || 0;
|
|
5708
5686
|
}, y = function(r, e) {
|
|
5709
5687
|
var t = De(), s = "navigate";
|
|
5710
|
-
return
|
|
5688
|
+
return St >= 0 ? s = "back-forward-cache" : t && (document.prerendering || de() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
|
|
5711
5689
|
}, x = function(r, e, t) {
|
|
5712
5690
|
try {
|
|
5713
5691
|
if (PerformanceObserver.supportedEntryTypes.includes(r)) {
|
|
@@ -5745,10 +5723,10 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5745
5723
|
}, F = -1, et = function() {
|
|
5746
5724
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
5747
5725
|
}, ce = function(r) {
|
|
5748
|
-
document.visibilityState === "hidden" && F > -1 && (F = r.type === "visibilitychange" ? r.timeStamp : 0,
|
|
5726
|
+
document.visibilityState === "hidden" && F > -1 && (F = r.type === "visibilitychange" ? r.timeStamp : 0, tr());
|
|
5749
5727
|
}, tt = function() {
|
|
5750
5728
|
addEventListener("visibilitychange", ce, !0), addEventListener("prerenderingchange", ce, !0);
|
|
5751
|
-
},
|
|
5729
|
+
}, tr = function() {
|
|
5752
5730
|
removeEventListener("visibilitychange", ce, !0), removeEventListener("prerenderingchange", ce, !0);
|
|
5753
5731
|
}, Ve = function() {
|
|
5754
5732
|
return F < 0 && (F = et(), tt(), V((function() {
|
|
@@ -5758,12 +5736,12 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5758
5736
|
}))), { get firstHiddenTime() {
|
|
5759
5737
|
return F;
|
|
5760
5738
|
} };
|
|
5761
|
-
},
|
|
5739
|
+
}, z = function(r) {
|
|
5762
5740
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
5763
5741
|
return r();
|
|
5764
5742
|
}), !0) : r();
|
|
5765
|
-
}, Me = [1800, 3e3],
|
|
5766
|
-
e = e || {},
|
|
5743
|
+
}, Me = [1800, 3e3], Et = function(r, e) {
|
|
5744
|
+
e = e || {}, z((function() {
|
|
5767
5745
|
var t, s = Ve(), n = y("FCP"), i = x("paint", (function(o) {
|
|
5768
5746
|
o.forEach((function(l) {
|
|
5769
5747
|
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime - de(), 0), n.entries.push(l), t(!0)));
|
|
@@ -5775,13 +5753,13 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5775
5753
|
}));
|
|
5776
5754
|
})));
|
|
5777
5755
|
}));
|
|
5778
|
-
}, Ce = [0.1, 0.25],
|
|
5779
|
-
e = e || {},
|
|
5756
|
+
}, Ce = [0.1, 0.25], sr = function(r, e) {
|
|
5757
|
+
e = e || {}, Et(ue((function() {
|
|
5780
5758
|
var t, s = y("CLS", 0), n = 0, i = [], o = function(d) {
|
|
5781
5759
|
d.forEach((function(c) {
|
|
5782
5760
|
if (!c.hadRecentInput) {
|
|
5783
|
-
var f = i[0],
|
|
5784
|
-
n && c.startTime -
|
|
5761
|
+
var f = i[0], g = i[i.length - 1];
|
|
5762
|
+
n && c.startTime - g.startTime < 1e3 && c.startTime - f.startTime < 5e3 ? (n += c.value, i.push(c)) : (n = c.value, i = [c]);
|
|
5785
5763
|
}
|
|
5786
5764
|
})), n > s.value && (s.value = n, s.entries = i, t());
|
|
5787
5765
|
}, l = x("layout-shift", o);
|
|
@@ -5793,19 +5771,19 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5793
5771
|
}));
|
|
5794
5772
|
})), setTimeout(t, 0));
|
|
5795
5773
|
})));
|
|
5796
|
-
}, Tt = 0,
|
|
5774
|
+
}, Tt = 0, Ee = 1 / 0, J = 0, rr = function(r) {
|
|
5797
5775
|
r.forEach((function(e) {
|
|
5798
|
-
e.interactionId && (
|
|
5776
|
+
e.interactionId && (Ee = Math.min(Ee, e.interactionId), J = Math.max(J, e.interactionId), Tt = J ? (J - Ee) / 7 + 1 : 0);
|
|
5799
5777
|
}));
|
|
5800
|
-
},
|
|
5778
|
+
}, It = function() {
|
|
5801
5779
|
return Ae ? Tt : performance.interactionCount || 0;
|
|
5802
|
-
},
|
|
5803
|
-
"interactionCount" in performance || Ae || (Ae = x("event",
|
|
5804
|
-
}, L = [], te = /* @__PURE__ */ new Map(),
|
|
5805
|
-
var r = Math.min(L.length - 1, Math.floor((
|
|
5780
|
+
}, nr = function() {
|
|
5781
|
+
"interactionCount" in performance || Ae || (Ae = x("event", rr, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
5782
|
+
}, L = [], te = /* @__PURE__ */ new Map(), vt = 0, ir = function() {
|
|
5783
|
+
var r = Math.min(L.length - 1, Math.floor((It() - vt) / 50));
|
|
5806
5784
|
return L[r];
|
|
5807
|
-
},
|
|
5808
|
-
if (
|
|
5785
|
+
}, or = [], ar = function(r) {
|
|
5786
|
+
if (or.forEach((function(n) {
|
|
5809
5787
|
return n(r);
|
|
5810
5788
|
})), r.interactionId || r.entryType === "first-input") {
|
|
5811
5789
|
var e = L[L.length - 1], t = te.get(r.interactionId);
|
|
@@ -5825,25 +5803,25 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5825
5803
|
}, _t = function(r) {
|
|
5826
5804
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
5827
5805
|
return r = ue(r), document.visibilityState === "hidden" ? r() : (t = e(r), K(r)), t;
|
|
5828
|
-
}, Re = [200, 500],
|
|
5829
|
-
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {},
|
|
5806
|
+
}, Re = [200, 500], lr = function(r, e) {
|
|
5807
|
+
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, z((function() {
|
|
5830
5808
|
var t;
|
|
5831
|
-
|
|
5809
|
+
nr();
|
|
5832
5810
|
var s, n = y("INP"), i = function(l) {
|
|
5833
5811
|
_t((function() {
|
|
5834
|
-
l.forEach(
|
|
5835
|
-
var d =
|
|
5812
|
+
l.forEach(ar);
|
|
5813
|
+
var d = ir();
|
|
5836
5814
|
d && d.latency !== n.value && (n.value = d.latency, n.entries = d.entries, s());
|
|
5837
5815
|
}));
|
|
5838
5816
|
}, o = x("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
5839
5817
|
s = w(r, n, Re, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), K((function() {
|
|
5840
5818
|
i(o.takeRecords()), s(!0);
|
|
5841
5819
|
})), V((function() {
|
|
5842
|
-
|
|
5820
|
+
vt = It(), L.length = 0, te.clear(), n = y("INP"), s = w(r, n, Re, e.reportAllChanges);
|
|
5843
5821
|
})));
|
|
5844
5822
|
})));
|
|
5845
|
-
}, Ne = [2500, 4e3], Te = {},
|
|
5846
|
-
e = e || {},
|
|
5823
|
+
}, Ne = [2500, 4e3], Te = {}, cr = function(r, e) {
|
|
5824
|
+
e = e || {}, z((function() {
|
|
5847
5825
|
var t, s = Ve(), n = y("LCP"), i = function(d) {
|
|
5848
5826
|
e.reportAllChanges || (d = d.slice(-1)), d.forEach((function(c) {
|
|
5849
5827
|
c.startTime < s.firstHiddenTime && (n.value = Math.max(c.startTime - de(), 0), n.entries = [c], t());
|
|
@@ -5865,31 +5843,31 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5865
5843
|
}));
|
|
5866
5844
|
}
|
|
5867
5845
|
}));
|
|
5868
|
-
}, Oe = [800, 1800],
|
|
5869
|
-
document.prerendering ?
|
|
5846
|
+
}, Oe = [800, 1800], dr = function r(e) {
|
|
5847
|
+
document.prerendering ? z((function() {
|
|
5870
5848
|
return r(e);
|
|
5871
5849
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
5872
5850
|
return r(e);
|
|
5873
5851
|
}), !0) : setTimeout(e, 0);
|
|
5874
|
-
},
|
|
5852
|
+
}, ur = function(r, e) {
|
|
5875
5853
|
e = e || {};
|
|
5876
5854
|
var t = y("TTFB"), s = w(r, t, Oe, e.reportAllChanges);
|
|
5877
|
-
|
|
5855
|
+
dr((function() {
|
|
5878
5856
|
var n = De();
|
|
5879
5857
|
n && (t.value = Math.max(n.responseStart - de(), 0), t.entries = [n], s(!0), V((function() {
|
|
5880
5858
|
t = y("TTFB", 0), (s = w(r, t, Oe, e.reportAllChanges))(!0);
|
|
5881
5859
|
})));
|
|
5882
5860
|
}));
|
|
5883
|
-
}, W = { passive: !0, capture: !0 },
|
|
5861
|
+
}, W = { passive: !0, capture: !0 }, hr = /* @__PURE__ */ new Date(), st = function(r, e) {
|
|
5884
5862
|
C || (C = e, X = r, pt = /* @__PURE__ */ new Date(), wt(removeEventListener), yt());
|
|
5885
5863
|
}, yt = function() {
|
|
5886
|
-
if (X >= 0 && X < pt -
|
|
5864
|
+
if (X >= 0 && X < pt - hr) {
|
|
5887
5865
|
var r = { entryType: "first-input", name: C.type, target: C.target, cancelable: C.cancelable, startTime: C.timeStamp, processingStart: C.timeStamp + X };
|
|
5888
5866
|
le.forEach((function(e) {
|
|
5889
5867
|
e(r);
|
|
5890
5868
|
})), le = [];
|
|
5891
5869
|
}
|
|
5892
|
-
},
|
|
5870
|
+
}, fr = function(r) {
|
|
5893
5871
|
if (r.cancelable) {
|
|
5894
5872
|
var e = (r.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - r.timeStamp;
|
|
5895
5873
|
r.type == "pointerdown" ? (function(t, s) {
|
|
@@ -5905,10 +5883,10 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5905
5883
|
}
|
|
5906
5884
|
}, wt = function(r) {
|
|
5907
5885
|
["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
|
|
5908
|
-
return r(e,
|
|
5886
|
+
return r(e, fr, W);
|
|
5909
5887
|
}));
|
|
5910
|
-
}, Pe = [100, 300],
|
|
5911
|
-
e = e || {},
|
|
5888
|
+
}, Pe = [100, 300], mr = function(r, e) {
|
|
5889
|
+
e = e || {}, z((function() {
|
|
5912
5890
|
var t, s = Ve(), n = y("FID"), i = function(d) {
|
|
5913
5891
|
d.startTime < s.firstHiddenTime && (n.value = d.processingStart - d.startTime, n.entries.push(d), t(!0));
|
|
5914
5892
|
}, o = function(d) {
|
|
@@ -5922,7 +5900,7 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5922
5900
|
})));
|
|
5923
5901
|
}));
|
|
5924
5902
|
};
|
|
5925
|
-
const
|
|
5903
|
+
const gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5926
5904
|
__proto__: null,
|
|
5927
5905
|
CLSThresholds: Ce,
|
|
5928
5906
|
FCPThresholds: Me,
|
|
@@ -5930,31 +5908,31 @@ const mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5930
5908
|
INPThresholds: Re,
|
|
5931
5909
|
LCPThresholds: Ne,
|
|
5932
5910
|
TTFBThresholds: Oe,
|
|
5933
|
-
onCLS:
|
|
5934
|
-
onFCP:
|
|
5935
|
-
onFID:
|
|
5936
|
-
onINP:
|
|
5937
|
-
onLCP:
|
|
5938
|
-
onTTFB:
|
|
5911
|
+
onCLS: sr,
|
|
5912
|
+
onFCP: Et,
|
|
5913
|
+
onFID: mr,
|
|
5914
|
+
onINP: lr,
|
|
5915
|
+
onLCP: cr,
|
|
5916
|
+
onTTFB: ur
|
|
5939
5917
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5940
5918
|
export {
|
|
5941
5919
|
p as AppConfigValidationError,
|
|
5942
|
-
|
|
5920
|
+
pr as DEFAULT_SESSION_TIMEOUT,
|
|
5943
5921
|
ye as DEFAULT_WEB_VITALS_MODE,
|
|
5944
5922
|
A as DeviceType,
|
|
5945
5923
|
se as EmitterEvent,
|
|
5946
5924
|
B as ErrorType,
|
|
5947
5925
|
u as EventType,
|
|
5948
|
-
|
|
5926
|
+
Ar as InitializationTimeoutError,
|
|
5949
5927
|
N as IntegrationValidationError,
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5928
|
+
wr as MAX_ARRAY_LENGTH,
|
|
5929
|
+
Ir as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
5930
|
+
Tr as MAX_CUSTOM_EVENT_KEYS,
|
|
5931
|
+
Sr as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
5954
5932
|
Er as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
5955
5933
|
vr as MAX_NESTED_OBJECT_KEYS,
|
|
5956
|
-
|
|
5957
|
-
|
|
5934
|
+
_r as MAX_STRING_LENGTH,
|
|
5935
|
+
yr as MAX_STRING_LENGTH_IN_ARRAY,
|
|
5958
5936
|
ie as Mode,
|
|
5959
5937
|
at as PII_PATTERNS,
|
|
5960
5938
|
O as PermanentError,
|
|
@@ -5965,11 +5943,11 @@ export {
|
|
|
5965
5943
|
$ as SpecialApiUrl,
|
|
5966
5944
|
ne as TimeoutError,
|
|
5967
5945
|
j as TraceLogValidationError,
|
|
5968
|
-
|
|
5969
|
-
|
|
5946
|
+
Mr as WEB_VITALS_GOOD_THRESHOLDS,
|
|
5947
|
+
ze as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
5970
5948
|
Yt as WEB_VITALS_POOR_THRESHOLDS,
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5949
|
+
Qe as getWebVitalsThresholds,
|
|
5950
|
+
br as isPrimaryScrollEvent,
|
|
5951
|
+
Lr as isSecondaryScrollEvent,
|
|
5952
|
+
Cr as tracelog
|
|
5975
5953
|
};
|