@tracelog/lib 2.9.0-rc.108.13 → 2.9.0-rc.108.16
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 +2 -2
- 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 +179 -224
- 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 +17 -43
- package/dist/public-api.d.ts +17 -43
- package/dist/public-api.js +2 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
package/dist/public-api.d.mts
CHANGED
|
@@ -495,10 +495,14 @@ interface Config {
|
|
|
495
495
|
/** Interval in milliseconds between event batch sends. @default 10000 (10 seconds) */
|
|
496
496
|
sendIntervalMs?: number;
|
|
497
497
|
/**
|
|
498
|
-
*
|
|
499
|
-
* (`pushState`, `replaceState`, `popstate`, `hashchange`).
|
|
500
|
-
*
|
|
501
|
-
*
|
|
498
|
+
* Opt-in: when `true`, the event queue is flushed after every SPA navigation
|
|
499
|
+
* (`pushState`, `replaceState`, `popstate`, `hashchange`). Defaults to `false`
|
|
500
|
+
* because per-route flushing can multiply request volume on SPA-heavy apps
|
|
501
|
+
* (one request per route change vs. one per `sendIntervalMs`). Enable only
|
|
502
|
+
* if you need delivery between route changes that's faster than
|
|
503
|
+
* `sendIntervalMs`; `flushOnPageHidden` (default `true`) already covers the
|
|
504
|
+
* common tab-close / app-background case on every stack. No-op for MPAs.
|
|
505
|
+
* @default false
|
|
502
506
|
*/
|
|
503
507
|
flushOnSpaNavigation?: boolean;
|
|
504
508
|
/**
|
|
@@ -1573,7 +1577,14 @@ declare class EventManager extends StateManager {
|
|
|
1573
1577
|
* - No retry on failure (sendBeacon is fire-and-forget)
|
|
1574
1578
|
* - 64KB payload limit (large batches may be truncated)
|
|
1575
1579
|
*
|
|
1576
|
-
*
|
|
1580
|
+
* **In-flight contract**: if an async send is already running this call is
|
|
1581
|
+
* deferred (queued for replay in the async send's `finally` block) and
|
|
1582
|
+
* returns `false` — nothing has been delivered yet at the point of return.
|
|
1583
|
+
* Mirrors `flushImmediately()`'s behaviour for the same condition.
|
|
1584
|
+
*
|
|
1585
|
+
* @returns `true` if at least one integration accepted the beacon batch
|
|
1586
|
+
* *during this call*, `false` otherwise (no events, all senders
|
|
1587
|
+
* failed, or the call was deferred behind an in-flight async send)
|
|
1577
1588
|
*
|
|
1578
1589
|
* @example
|
|
1579
1590
|
* ```typescript
|
|
@@ -1587,44 +1598,6 @@ declare class EventManager extends StateManager {
|
|
|
1587
1598
|
* @see src/managers/README.md (lines 5-75) for flush details
|
|
1588
1599
|
*/
|
|
1589
1600
|
flushImmediatelySync(): boolean;
|
|
1590
|
-
/**
|
|
1591
|
-
* Sends ONLY the most recently queued event via `navigator.sendBeacon()` in
|
|
1592
|
-
* a dedicated single-event batch.
|
|
1593
|
-
*
|
|
1594
|
-
* **Purpose**: Guarantee delivery of an event that *must* survive an
|
|
1595
|
-
* imminent page unload (purchase confirmation, signup completion, etc.),
|
|
1596
|
-
* independent of the main queue's size or in-flight async send state.
|
|
1597
|
-
*
|
|
1598
|
-
* **Why a dedicated batch**: `flushImmediatelySync()` serialises the entire
|
|
1599
|
-
* queue into one `sendBeacon` call. If the queue is heavy (>64KB) the
|
|
1600
|
-
* beacon fails and the batch is persisted to `localStorage`, which is only
|
|
1601
|
-
* recovered on the next `init()` — useless for one-shot conversion events
|
|
1602
|
-
* where the user never returns.
|
|
1603
|
-
*
|
|
1604
|
-
* **Behaviour**:
|
|
1605
|
-
* - Reads the last entry of `eventsQueue` (the just-tracked event).
|
|
1606
|
-
* - Wraps it in its own `EventsQueue` and dispatches synchronously through
|
|
1607
|
-
* every `SenderManager` via `sendEventsQueueSync()`.
|
|
1608
|
-
* - Leaves the main queue untouched; the same event will be re-delivered by
|
|
1609
|
-
* the next periodic / unload flush. Idempotency is the caller-side
|
|
1610
|
-
* contract: the backend MUST deduplicate by `event.id` (e.g. unique index
|
|
1611
|
-
* on the ingestion collection) — same guarantee the library already
|
|
1612
|
-
* relies on for the persisted-events recovery path.
|
|
1613
|
-
*
|
|
1614
|
-
* **Use it after** `track()` so the event is in the queue. Caller is
|
|
1615
|
-
* responsible for verifying that `track()` actually queued the event
|
|
1616
|
-
* (it can be dropped by rate limiting / sampling / `beforeSend`).
|
|
1617
|
-
*
|
|
1618
|
-
* **Standalone mode** (no senders configured): returns `false` without
|
|
1619
|
-
* emitting. The subsequent main-queue drain (`flushImmediatelySync()`) is
|
|
1620
|
-
* responsible for delivering the event to local listeners — emitting here
|
|
1621
|
-
* too would surface the same event twice to a `tracelog.on('queue', ...)`
|
|
1622
|
-
* subscriber.
|
|
1623
|
-
*
|
|
1624
|
-
* @returns `true` if at least one sender delivered the beacon successfully,
|
|
1625
|
-
* `false` otherwise (including standalone mode — the drain handles it).
|
|
1626
|
-
*/
|
|
1627
|
-
flushLastEventSync(): boolean;
|
|
1628
1601
|
/**
|
|
1629
1602
|
* Sets the custom headers provider callback for the custom integration.
|
|
1630
1603
|
* Only affects requests to custom backend (not TraceLog SaaS).
|
|
@@ -2742,6 +2715,7 @@ declare const tracelog: {
|
|
|
2742
2715
|
removeCustomHeaders: () => void;
|
|
2743
2716
|
isInitialized: () => boolean;
|
|
2744
2717
|
getSessionId: () => string | null;
|
|
2718
|
+
getUserId: () => string | null;
|
|
2745
2719
|
destroy: () => void;
|
|
2746
2720
|
setQaMode: (enabled: boolean) => void;
|
|
2747
2721
|
updateGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
|
package/dist/public-api.d.ts
CHANGED
|
@@ -495,10 +495,14 @@ interface Config {
|
|
|
495
495
|
/** Interval in milliseconds between event batch sends. @default 10000 (10 seconds) */
|
|
496
496
|
sendIntervalMs?: number;
|
|
497
497
|
/**
|
|
498
|
-
*
|
|
499
|
-
* (`pushState`, `replaceState`, `popstate`, `hashchange`).
|
|
500
|
-
*
|
|
501
|
-
*
|
|
498
|
+
* Opt-in: when `true`, the event queue is flushed after every SPA navigation
|
|
499
|
+
* (`pushState`, `replaceState`, `popstate`, `hashchange`). Defaults to `false`
|
|
500
|
+
* because per-route flushing can multiply request volume on SPA-heavy apps
|
|
501
|
+
* (one request per route change vs. one per `sendIntervalMs`). Enable only
|
|
502
|
+
* if you need delivery between route changes that's faster than
|
|
503
|
+
* `sendIntervalMs`; `flushOnPageHidden` (default `true`) already covers the
|
|
504
|
+
* common tab-close / app-background case on every stack. No-op for MPAs.
|
|
505
|
+
* @default false
|
|
502
506
|
*/
|
|
503
507
|
flushOnSpaNavigation?: boolean;
|
|
504
508
|
/**
|
|
@@ -1573,7 +1577,14 @@ declare class EventManager extends StateManager {
|
|
|
1573
1577
|
* - No retry on failure (sendBeacon is fire-and-forget)
|
|
1574
1578
|
* - 64KB payload limit (large batches may be truncated)
|
|
1575
1579
|
*
|
|
1576
|
-
*
|
|
1580
|
+
* **In-flight contract**: if an async send is already running this call is
|
|
1581
|
+
* deferred (queued for replay in the async send's `finally` block) and
|
|
1582
|
+
* returns `false` — nothing has been delivered yet at the point of return.
|
|
1583
|
+
* Mirrors `flushImmediately()`'s behaviour for the same condition.
|
|
1584
|
+
*
|
|
1585
|
+
* @returns `true` if at least one integration accepted the beacon batch
|
|
1586
|
+
* *during this call*, `false` otherwise (no events, all senders
|
|
1587
|
+
* failed, or the call was deferred behind an in-flight async send)
|
|
1577
1588
|
*
|
|
1578
1589
|
* @example
|
|
1579
1590
|
* ```typescript
|
|
@@ -1587,44 +1598,6 @@ declare class EventManager extends StateManager {
|
|
|
1587
1598
|
* @see src/managers/README.md (lines 5-75) for flush details
|
|
1588
1599
|
*/
|
|
1589
1600
|
flushImmediatelySync(): boolean;
|
|
1590
|
-
/**
|
|
1591
|
-
* Sends ONLY the most recently queued event via `navigator.sendBeacon()` in
|
|
1592
|
-
* a dedicated single-event batch.
|
|
1593
|
-
*
|
|
1594
|
-
* **Purpose**: Guarantee delivery of an event that *must* survive an
|
|
1595
|
-
* imminent page unload (purchase confirmation, signup completion, etc.),
|
|
1596
|
-
* independent of the main queue's size or in-flight async send state.
|
|
1597
|
-
*
|
|
1598
|
-
* **Why a dedicated batch**: `flushImmediatelySync()` serialises the entire
|
|
1599
|
-
* queue into one `sendBeacon` call. If the queue is heavy (>64KB) the
|
|
1600
|
-
* beacon fails and the batch is persisted to `localStorage`, which is only
|
|
1601
|
-
* recovered on the next `init()` — useless for one-shot conversion events
|
|
1602
|
-
* where the user never returns.
|
|
1603
|
-
*
|
|
1604
|
-
* **Behaviour**:
|
|
1605
|
-
* - Reads the last entry of `eventsQueue` (the just-tracked event).
|
|
1606
|
-
* - Wraps it in its own `EventsQueue` and dispatches synchronously through
|
|
1607
|
-
* every `SenderManager` via `sendEventsQueueSync()`.
|
|
1608
|
-
* - Leaves the main queue untouched; the same event will be re-delivered by
|
|
1609
|
-
* the next periodic / unload flush. Idempotency is the caller-side
|
|
1610
|
-
* contract: the backend MUST deduplicate by `event.id` (e.g. unique index
|
|
1611
|
-
* on the ingestion collection) — same guarantee the library already
|
|
1612
|
-
* relies on for the persisted-events recovery path.
|
|
1613
|
-
*
|
|
1614
|
-
* **Use it after** `track()` so the event is in the queue. Caller is
|
|
1615
|
-
* responsible for verifying that `track()` actually queued the event
|
|
1616
|
-
* (it can be dropped by rate limiting / sampling / `beforeSend`).
|
|
1617
|
-
*
|
|
1618
|
-
* **Standalone mode** (no senders configured): returns `false` without
|
|
1619
|
-
* emitting. The subsequent main-queue drain (`flushImmediatelySync()`) is
|
|
1620
|
-
* responsible for delivering the event to local listeners — emitting here
|
|
1621
|
-
* too would surface the same event twice to a `tracelog.on('queue', ...)`
|
|
1622
|
-
* subscriber.
|
|
1623
|
-
*
|
|
1624
|
-
* @returns `true` if at least one sender delivered the beacon successfully,
|
|
1625
|
-
* `false` otherwise (including standalone mode — the drain handles it).
|
|
1626
|
-
*/
|
|
1627
|
-
flushLastEventSync(): boolean;
|
|
1628
1601
|
/**
|
|
1629
1602
|
* Sets the custom headers provider callback for the custom integration.
|
|
1630
1603
|
* Only affects requests to custom backend (not TraceLog SaaS).
|
|
@@ -2742,6 +2715,7 @@ declare const tracelog: {
|
|
|
2742
2715
|
removeCustomHeaders: () => void;
|
|
2743
2716
|
isInitialized: () => boolean;
|
|
2744
2717
|
getSessionId: () => string | null;
|
|
2718
|
+
getUserId: () => string | null;
|
|
2745
2719
|
destroy: () => void;
|
|
2746
2720
|
setQaMode: (enabled: boolean) => void;
|
|
2747
2721
|
updateGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
|