@tracelog/lib 2.9.0-rc.108.16 → 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 +1 -1
- package/dist/browser/tracelog.esm.js +89 -66
- 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 +1 -1
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +16 -1
- package/dist/public-api.d.ts +16 -1
- package/dist/public-api.js +1 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,7 +127,7 @@ tracelog.destroy();
|
|
|
127
127
|
| Method | Description |
|
|
128
128
|
|--------|-------------|
|
|
129
129
|
| `init(config?)` | Initialize tracking (see [Configuration](#configuration)) |
|
|
130
|
-
| `event(name, metadata?, options?)` | Track custom events. `options.critical: true`
|
|
130
|
+
| `event(name, metadata?, options?)` | Track custom events. `options.critical: true` drains the queue via `sendBeacon` right after tracking, so the batch (the critical event + anything already queued) survives an imminent navigation. Subject to `sendBeacon`'s 64KB cap — oversized batches are persisted to `localStorage` and recovered on next `init()` via their idempotency token; the backend deduplicates by `event.id`. See [API_REFERENCE.md](./API_REFERENCE.md#eventname-metadata-options) for the full contract. |
|
|
131
131
|
| `flushImmediately()` | Force an async `fetch` flush of all pending events. Returns `Promise<boolean>`. |
|
|
132
132
|
| `flushImmediatelySync()` | Force a `sendBeacon` flush. Use for custom unload handlers; the library already wires this to `pagehide`/`beforeunload`/`visibilitychange`. |
|
|
133
133
|
| `updateGlobalMetadata(metadata)` | Replace all global metadata |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const pr = 9e5;
|
|
2
|
-
const
|
|
2
|
+
const Sr = 120, Er = 49152, Tr = 100, Ir = 500, vr = 200;
|
|
3
3
|
const _r = 1e3, yr = 500, wr = 1e3;
|
|
4
4
|
const b = "data-tlog", bt = [
|
|
5
5
|
"button",
|
|
@@ -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",
|
|
@@ -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();
|
|
@@ -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"
|
|
@@ -2264,25 +2264,25 @@ class vs extends _ {
|
|
|
2264
2264
|
data: { sessionId: g }
|
|
2265
2265
|
}), !m && !this.checkRateLimit())
|
|
2266
2266
|
return;
|
|
2267
|
-
const
|
|
2267
|
+
const S = e;
|
|
2268
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 I = this.getTypeLimitForEvent(
|
|
2279
|
+
const I = this.getTypeLimitForEvent(S);
|
|
2280
2280
|
if (I) {
|
|
2281
|
-
const fe = this.sessionEventCounts[
|
|
2281
|
+
const fe = this.sessionEventCounts[S];
|
|
2282
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
2287
|
limit: I
|
|
2288
2288
|
}
|
|
@@ -2291,13 +2291,13 @@ class vs extends _ {
|
|
|
2291
2291
|
}
|
|
2292
2292
|
}
|
|
2293
2293
|
}
|
|
2294
|
-
if (
|
|
2294
|
+
if (S === u.CUSTOM && o?.name) {
|
|
2295
2295
|
const I = this.get("config")?.maxSameEventPerMinute ?? 60;
|
|
2296
2296
|
if (!this.checkPerEventRateLimit(o.name, I))
|
|
2297
2297
|
return;
|
|
2298
2298
|
}
|
|
2299
|
-
const he =
|
|
2300
|
-
type:
|
|
2299
|
+
const he = S === u.SESSION_START, Q = t || this.get("pageUrl"), U = this.buildEventPayload({
|
|
2300
|
+
type: S,
|
|
2301
2301
|
page_url: Q,
|
|
2302
2302
|
from_page_url: s,
|
|
2303
2303
|
scroll_data: n,
|
|
@@ -2325,7 +2325,7 @@ class vs 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,7 +2335,7 @@ class vs extends _ {
|
|
|
2335
2335
|
}), this.emitEvent(U);
|
|
2336
2336
|
return;
|
|
2337
2337
|
}
|
|
2338
|
-
if (
|
|
2338
|
+
if (S === u.VIEWPORT_VISIBLE && c) {
|
|
2339
2339
|
const I = c.name || c.id || c.selector;
|
|
2340
2340
|
a("info", `Viewport Visible: ${I}`, {
|
|
2341
2341
|
visibility: "qa",
|
|
@@ -2351,7 +2351,7 @@ class vs extends _ {
|
|
|
2351
2351
|
}
|
|
2352
2352
|
}
|
|
2353
2353
|
if (this.addToQueue(U), !m) {
|
|
2354
|
-
this.sessionEventCounts.total++, this.sessionEventCounts[
|
|
2354
|
+
this.sessionEventCounts.total++, this.sessionEventCounts[S] !== void 0 && this.sessionEventCounts[S]++;
|
|
2355
2355
|
const I = this.get("sessionId");
|
|
2356
2356
|
I && this.saveSessionCountsDebounced && this.saveSessionCountsDebounced(I);
|
|
2357
2357
|
}
|
|
@@ -2426,7 +2426,10 @@ class vs 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
|
|
@@ -2682,19 +2685,33 @@ class vs extends _ {
|
|
|
2682
2685
|
}
|
|
2683
2686
|
if (e) {
|
|
2684
2687
|
const s = t.map(({ batch: n, eventIds: i }) => this.sendBatchSync(n, i));
|
|
2685
|
-
return this.
|
|
2688
|
+
return this.settleSendTimeout(), s.some(Boolean);
|
|
2686
2689
|
}
|
|
2687
2690
|
return this.sendInProgress = !0, (async () => {
|
|
2688
2691
|
try {
|
|
2689
2692
|
const s = await Promise.all(
|
|
2690
2693
|
t.map(async ({ batch: n, eventIds: i }) => this.sendBatchAsync(n, i))
|
|
2691
2694
|
);
|
|
2692
|
-
return this.
|
|
2695
|
+
return this.settleSendTimeout(), s.some(Boolean);
|
|
2693
2696
|
} finally {
|
|
2694
2697
|
this.sendInProgress = !1, this.drainPendingSyncFlush();
|
|
2695
2698
|
}
|
|
2696
2699
|
})();
|
|
2697
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
|
+
}
|
|
2698
2715
|
/**
|
|
2699
2716
|
* Re-runs a sync flush that was deferred while an async send was in flight.
|
|
2700
2717
|
*
|
|
@@ -2783,10 +2800,10 @@ class vs extends _ {
|
|
|
2783
2800
|
buildBatchFromGroup(e, t) {
|
|
2784
2801
|
const s = /* @__PURE__ */ new Map(), n = [];
|
|
2785
2802
|
for (const m of t) {
|
|
2786
|
-
const
|
|
2787
|
-
s.has(
|
|
2803
|
+
const S = this.createEventSignature(m);
|
|
2804
|
+
s.has(S) || n.push(S), s.set(S, m);
|
|
2788
2805
|
}
|
|
2789
|
-
const i = n.map((m) => s.get(m)).filter((m) => !!m).sort((m,
|
|
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");
|
|
2790
2807
|
let d = {
|
|
2791
2808
|
user_id: this.get("userId"),
|
|
2792
2809
|
session_id: e,
|
|
@@ -2830,8 +2847,8 @@ class vs extends _ {
|
|
|
2830
2847
|
...e.page_view && { page_view: e.page_view },
|
|
2831
2848
|
...d && { utm: d }
|
|
2832
2849
|
};
|
|
2833
|
-
const f = this.get("collectApiUrls"), g = !!f?.custom, m = !!f?.saas,
|
|
2834
|
-
if (Q && (!
|
|
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)) {
|
|
2835
2852
|
const I = mt(c, Q, "EventManager");
|
|
2836
2853
|
if (I === null)
|
|
2837
2854
|
return null;
|
|
@@ -4110,11 +4127,11 @@ class Ms extends _ {
|
|
|
4110
4127
|
const d = this.getViewportHeight(t), c = this.getScrollHeight(t), f = this.getScrollDirection(i, s), g = this.calculateScrollDepth(i, c, d);
|
|
4111
4128
|
let m;
|
|
4112
4129
|
n > 0 ? m = o - n : e.firstScrollEventTime !== null ? m = o - e.firstScrollEventTime : m = 250;
|
|
4113
|
-
const
|
|
4130
|
+
const S = Math.round(l / m * 1e3);
|
|
4114
4131
|
return g > e.maxDepthReached && (e.maxDepthReached = g), e.lastScrollPos = i, {
|
|
4115
4132
|
depth: g,
|
|
4116
4133
|
direction: f,
|
|
4117
|
-
velocity:
|
|
4134
|
+
velocity: S,
|
|
4118
4135
|
max_depth_reached: e.maxDepthReached
|
|
4119
4136
|
};
|
|
4120
4137
|
}
|
|
@@ -5026,7 +5043,7 @@ class ks extends _ {
|
|
|
5026
5043
|
pageUnloadHandler = null;
|
|
5027
5044
|
pageShowHandler = null;
|
|
5028
5045
|
visibilityFlushHandler = null;
|
|
5029
|
-
emitter = new
|
|
5046
|
+
emitter = new Ss();
|
|
5030
5047
|
transformers = {};
|
|
5031
5048
|
customHeadersProvider;
|
|
5032
5049
|
managers = {};
|
|
@@ -5072,7 +5089,10 @@ class ks extends _ {
|
|
|
5072
5089
|
* Use when you need to force-send buffered events without waiting for the next send interval
|
|
5073
5090
|
* (e.g., before a critical user action like sign-out, or before a SPA route teardown).
|
|
5074
5091
|
*
|
|
5075
|
-
* @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.
|
|
5076
5096
|
* @internal Called from api.flushImmediately()
|
|
5077
5097
|
*/
|
|
5078
5098
|
async flushImmediately() {
|
|
@@ -5084,7 +5104,10 @@ class ks extends _ {
|
|
|
5084
5104
|
* Use only for page-unload scenarios (or equivalent) where async fetch may be cancelled.
|
|
5085
5105
|
* For general flush needs, prefer {@link flushImmediately}.
|
|
5086
5106
|
*
|
|
5087
|
-
* @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.
|
|
5088
5111
|
* @internal Called from api.flushImmediatelySync()
|
|
5089
5112
|
*/
|
|
5090
5113
|
flushImmediatelySync() {
|
|
@@ -5650,9 +5673,9 @@ const Ws = (r) => {
|
|
|
5650
5673
|
flushImmediately: Hs,
|
|
5651
5674
|
flushImmediatelySync: Fs
|
|
5652
5675
|
};
|
|
5653
|
-
var Ae, C, X, pt, le,
|
|
5676
|
+
var Ae, C, X, pt, le, St = -1, V = function(r) {
|
|
5654
5677
|
addEventListener("pageshow", (function(e) {
|
|
5655
|
-
e.persisted && (
|
|
5678
|
+
e.persisted && (St = e.timeStamp, r(e));
|
|
5656
5679
|
}), !0);
|
|
5657
5680
|
}, De = function() {
|
|
5658
5681
|
var r = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
@@ -5662,7 +5685,7 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5662
5685
|
return r && r.activationStart || 0;
|
|
5663
5686
|
}, y = function(r, e) {
|
|
5664
5687
|
var t = De(), s = "navigate";
|
|
5665
|
-
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 };
|
|
5666
5689
|
}, x = function(r, e, t) {
|
|
5667
5690
|
try {
|
|
5668
5691
|
if (PerformanceObserver.supportedEntryTypes.includes(r)) {
|
|
@@ -5717,7 +5740,7 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5717
5740
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
5718
5741
|
return r();
|
|
5719
5742
|
}), !0) : r();
|
|
5720
|
-
}, Me = [1800, 3e3],
|
|
5743
|
+
}, Me = [1800, 3e3], Et = function(r, e) {
|
|
5721
5744
|
e = e || {}, z((function() {
|
|
5722
5745
|
var t, s = Ve(), n = y("FCP"), i = x("paint", (function(o) {
|
|
5723
5746
|
o.forEach((function(l) {
|
|
@@ -5731,7 +5754,7 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5731
5754
|
})));
|
|
5732
5755
|
}));
|
|
5733
5756
|
}, Ce = [0.1, 0.25], sr = function(r, e) {
|
|
5734
|
-
e = e || {},
|
|
5757
|
+
e = e || {}, Et(ue((function() {
|
|
5735
5758
|
var t, s = y("CLS", 0), n = 0, i = [], o = function(d) {
|
|
5736
5759
|
d.forEach((function(c) {
|
|
5737
5760
|
if (!c.hadRecentInput) {
|
|
@@ -5748,9 +5771,9 @@ var Ae, C, X, pt, le, Et = -1, V = function(r) {
|
|
|
5748
5771
|
}));
|
|
5749
5772
|
})), setTimeout(t, 0));
|
|
5750
5773
|
})));
|
|
5751
|
-
}, Tt = 0,
|
|
5774
|
+
}, Tt = 0, Ee = 1 / 0, J = 0, rr = function(r) {
|
|
5752
5775
|
r.forEach((function(e) {
|
|
5753
|
-
e.interactionId && (
|
|
5776
|
+
e.interactionId && (Ee = Math.min(Ee, e.interactionId), J = Math.max(J, e.interactionId), Tt = J ? (J - Ee) / 7 + 1 : 0);
|
|
5754
5777
|
}));
|
|
5755
5778
|
}, It = function() {
|
|
5756
5779
|
return Ae ? Tt : performance.interactionCount || 0;
|
|
@@ -5886,7 +5909,7 @@ const gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5886
5909
|
LCPThresholds: Ne,
|
|
5887
5910
|
TTFBThresholds: Oe,
|
|
5888
5911
|
onCLS: sr,
|
|
5889
|
-
onFCP:
|
|
5912
|
+
onFCP: Et,
|
|
5890
5913
|
onFID: mr,
|
|
5891
5914
|
onINP: lr,
|
|
5892
5915
|
onLCP: cr,
|
|
@@ -5905,8 +5928,8 @@ export {
|
|
|
5905
5928
|
wr as MAX_ARRAY_LENGTH,
|
|
5906
5929
|
Ir as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
5907
5930
|
Tr as MAX_CUSTOM_EVENT_KEYS,
|
|
5908
|
-
|
|
5909
|
-
|
|
5931
|
+
Sr as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
5932
|
+
Er as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
5910
5933
|
vr as MAX_NESTED_OBJECT_KEYS,
|
|
5911
5934
|
_r as MAX_STRING_LENGTH,
|
|
5912
5935
|
yr as MAX_STRING_LENGTH_IN_ARRAY,
|