@tracelog/lib 2.9.0-rc.107.4 → 2.9.0-rc.108.13
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 +7 -1
- package/dist/browser/tracelog.esm.js +380 -240
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +2 -2
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +2 -2
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +98 -4
- package/dist/public-api.d.ts +98 -4
- 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
|
@@ -301,6 +301,33 @@ interface CustomEventData {
|
|
|
301
301
|
/** Additional event metadata */
|
|
302
302
|
metadata?: Record<string, MetadataType> | Record<string, MetadataType>[];
|
|
303
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Optional flags for `tracelog.event()`.
|
|
306
|
+
*/
|
|
307
|
+
interface EventOptions {
|
|
308
|
+
/**
|
|
309
|
+
* If `true`, the event queue is flushed via `navigator.sendBeacon()`
|
|
310
|
+
* immediately after this event is tracked. The browser guarantees the
|
|
311
|
+
* request is queued for delivery even if the page is about to unload
|
|
312
|
+
* (e.g., `window.location.href = '/thanks'` right after tracking a
|
|
313
|
+
* purchase). Async fetch would be cancelled by the navigation;
|
|
314
|
+
* sendBeacon survives.
|
|
315
|
+
*
|
|
316
|
+
* Use for high-value events where loss is unacceptable (Purchase, Signup,
|
|
317
|
+
* AddPaymentInfo). The critical event plus any previously queued events
|
|
318
|
+
* are sent in a single request — this does not bypass the queue.
|
|
319
|
+
*
|
|
320
|
+
* **Limitations** (inherited from `sendBeacon`):
|
|
321
|
+
* - 64KB payload cap. If the combined queue + critical event exceeds it,
|
|
322
|
+
* the failed batch is persisted to localStorage and recovered on next
|
|
323
|
+
* `init()` via its idempotency token.
|
|
324
|
+
* - No retry on failure (fire-and-forget).
|
|
325
|
+
* - Custom headers are not applied (browser API limitation).
|
|
326
|
+
*
|
|
327
|
+
* @default false
|
|
328
|
+
*/
|
|
329
|
+
critical?: boolean;
|
|
330
|
+
}
|
|
304
331
|
/**
|
|
305
332
|
* Web performance metrics data
|
|
306
333
|
*/
|
|
@@ -318,6 +345,8 @@ interface ErrorData {
|
|
|
318
345
|
type: ErrorType;
|
|
319
346
|
/** Error message text */
|
|
320
347
|
message: string;
|
|
348
|
+
/** Error constructor name (TypeError, ReferenceError, etc.) when available */
|
|
349
|
+
name?: string;
|
|
321
350
|
/** Source file where error occurred */
|
|
322
351
|
filename?: string;
|
|
323
352
|
/** Line number in source file */
|
|
@@ -465,6 +494,20 @@ interface Config {
|
|
|
465
494
|
webVitalsThresholds?: Partial<Record<WebVitalType, number>>;
|
|
466
495
|
/** Interval in milliseconds between event batch sends. @default 10000 (10 seconds) */
|
|
467
496
|
sendIntervalMs?: number;
|
|
497
|
+
/**
|
|
498
|
+
* If true, the event queue is flushed automatically after every SPA navigation
|
|
499
|
+
* (`pushState`, `replaceState`, `popstate`, `hashchange`). Prevents batch loss when the
|
|
500
|
+
* user closes the tab mid-buffer between SPA route changes. No-op for MPAs (no SPA nav).
|
|
501
|
+
* @default true
|
|
502
|
+
*/
|
|
503
|
+
flushOnSpaNavigation?: boolean;
|
|
504
|
+
/**
|
|
505
|
+
* If true, the event queue is flushed when `document.hidden` becomes `true`
|
|
506
|
+
* (tab switch, lock screen, app backgrounding). Especially relevant on mobile Safari
|
|
507
|
+
* where `pagehide`/`beforeunload` may not fire reliably.
|
|
508
|
+
* @default true
|
|
509
|
+
*/
|
|
510
|
+
flushOnPageHidden?: boolean;
|
|
468
511
|
/** Optional configuration for third-party integrations. */
|
|
469
512
|
integrations?: {
|
|
470
513
|
/** TraceLog integration options. */
|
|
@@ -1336,6 +1379,7 @@ declare class EventManager extends StateManager {
|
|
|
1336
1379
|
private rateLimitCounter;
|
|
1337
1380
|
private rateLimitWindowStart;
|
|
1338
1381
|
private lastSessionId;
|
|
1382
|
+
private pendingSyncFlush;
|
|
1339
1383
|
private sessionEventCounts;
|
|
1340
1384
|
private readonly saveSessionCountsDebounced;
|
|
1341
1385
|
/**
|
|
@@ -1543,6 +1587,44 @@ declare class EventManager extends StateManager {
|
|
|
1543
1587
|
* @see src/managers/README.md (lines 5-75) for flush details
|
|
1544
1588
|
*/
|
|
1545
1589
|
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;
|
|
1546
1628
|
/**
|
|
1547
1629
|
* Sets the custom headers provider callback for the custom integration.
|
|
1548
1630
|
* Only affects requests to custom backend (not TraceLog SaaS).
|
|
@@ -1664,6 +1746,16 @@ declare class EventManager extends StateManager {
|
|
|
1664
1746
|
*/
|
|
1665
1747
|
private buildBatchesWithIds;
|
|
1666
1748
|
private flushEvents;
|
|
1749
|
+
/**
|
|
1750
|
+
* Re-runs a sync flush that was deferred while an async send was in flight.
|
|
1751
|
+
*
|
|
1752
|
+
* Called from the `finally` blocks of `flushEvents(false)` and
|
|
1753
|
+
* `sendEventsQueue()`. If `pendingSyncFlush` is set, clears the flag and
|
|
1754
|
+
* invokes `flushImmediatelySync()` synchronously so any events that arrived
|
|
1755
|
+
* after the deferred sync call are delivered before the next event loop
|
|
1756
|
+
* tick. Critical for high-stakes events tracked mid-async-send.
|
|
1757
|
+
*/
|
|
1758
|
+
private drainPendingSyncFlush;
|
|
1667
1759
|
/**
|
|
1668
1760
|
* Sends one batch synchronously across all integrations (sendBeacon path).
|
|
1669
1761
|
* Optimistic removal: if any integration succeeds, we remove the batch's
|
|
@@ -2453,8 +2545,8 @@ interface TraceLogTestBridge {
|
|
|
2453
2545
|
readonly initialized: boolean;
|
|
2454
2546
|
init(config?: Config): Promise<InitResult>;
|
|
2455
2547
|
destroy(force?: boolean): void;
|
|
2456
|
-
sendCustomEvent(name: string, data?: Record<string, unknown> | Record<string, unknown>[]): void;
|
|
2457
|
-
event(name: string, metadata?: Record<string, unknown> | Record<string, unknown>[]): void;
|
|
2548
|
+
sendCustomEvent(name: string, data?: Record<string, unknown> | Record<string, unknown>[], options?: EventOptions): void;
|
|
2549
|
+
event(name: string, metadata?: Record<string, unknown> | Record<string, unknown>[], options?: EventOptions): void;
|
|
2458
2550
|
on(event: string, callback: (data: any) => void): void;
|
|
2459
2551
|
off(event: string, callback: (data: any) => void): void;
|
|
2460
2552
|
get<T extends keyof State>(key: T): State[T];
|
|
@@ -2641,7 +2733,7 @@ declare const getWebVitalsThresholds: (mode?: WebVitalsMode) => Record<WebVitalT
|
|
|
2641
2733
|
|
|
2642
2734
|
declare const tracelog: {
|
|
2643
2735
|
init: (config?: Config) => Promise<InitResult>;
|
|
2644
|
-
event: (name: string, metadata?: Record<string, MetadataType> | Record<string, MetadataType>[]) => void;
|
|
2736
|
+
event: (name: string, metadata?: Record<string, MetadataType> | Record<string, MetadataType>[], options?: EventOptions) => void;
|
|
2645
2737
|
on: <K extends keyof EmitterMap>(event: K, callback: EmitterCallback<EmitterMap[K]>) => void;
|
|
2646
2738
|
off: <K extends keyof EmitterMap>(event: K, callback: EmitterCallback<EmitterMap[K]>) => void;
|
|
2647
2739
|
setTransformer: typeof setTransformer;
|
|
@@ -2656,6 +2748,8 @@ declare const tracelog: {
|
|
|
2656
2748
|
mergeGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
|
|
2657
2749
|
identify: (userId: string, traits?: Record<string, string>) => void;
|
|
2658
2750
|
resetIdentity: () => Promise<void>;
|
|
2751
|
+
flushImmediately: () => Promise<boolean>;
|
|
2752
|
+
flushImmediatelySync: () => boolean;
|
|
2659
2753
|
};
|
|
2660
2754
|
|
|
2661
|
-
export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, type CustomHeadersProvider, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, type IdentifyData, type InitResult, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, type QueueMetadata, type QueuedEvent, RateLimitError, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, TimeoutError, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
|
|
2755
|
+
export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, type CustomHeadersProvider, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, type EventOptions, EventType, type EventTypeName, type EventsQueue, type IdentifyData, type InitResult, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, type QueueMetadata, type QueuedEvent, RateLimitError, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, TimeoutError, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
|
package/dist/public-api.d.ts
CHANGED
|
@@ -301,6 +301,33 @@ interface CustomEventData {
|
|
|
301
301
|
/** Additional event metadata */
|
|
302
302
|
metadata?: Record<string, MetadataType> | Record<string, MetadataType>[];
|
|
303
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Optional flags for `tracelog.event()`.
|
|
306
|
+
*/
|
|
307
|
+
interface EventOptions {
|
|
308
|
+
/**
|
|
309
|
+
* If `true`, the event queue is flushed via `navigator.sendBeacon()`
|
|
310
|
+
* immediately after this event is tracked. The browser guarantees the
|
|
311
|
+
* request is queued for delivery even if the page is about to unload
|
|
312
|
+
* (e.g., `window.location.href = '/thanks'` right after tracking a
|
|
313
|
+
* purchase). Async fetch would be cancelled by the navigation;
|
|
314
|
+
* sendBeacon survives.
|
|
315
|
+
*
|
|
316
|
+
* Use for high-value events where loss is unacceptable (Purchase, Signup,
|
|
317
|
+
* AddPaymentInfo). The critical event plus any previously queued events
|
|
318
|
+
* are sent in a single request — this does not bypass the queue.
|
|
319
|
+
*
|
|
320
|
+
* **Limitations** (inherited from `sendBeacon`):
|
|
321
|
+
* - 64KB payload cap. If the combined queue + critical event exceeds it,
|
|
322
|
+
* the failed batch is persisted to localStorage and recovered on next
|
|
323
|
+
* `init()` via its idempotency token.
|
|
324
|
+
* - No retry on failure (fire-and-forget).
|
|
325
|
+
* - Custom headers are not applied (browser API limitation).
|
|
326
|
+
*
|
|
327
|
+
* @default false
|
|
328
|
+
*/
|
|
329
|
+
critical?: boolean;
|
|
330
|
+
}
|
|
304
331
|
/**
|
|
305
332
|
* Web performance metrics data
|
|
306
333
|
*/
|
|
@@ -318,6 +345,8 @@ interface ErrorData {
|
|
|
318
345
|
type: ErrorType;
|
|
319
346
|
/** Error message text */
|
|
320
347
|
message: string;
|
|
348
|
+
/** Error constructor name (TypeError, ReferenceError, etc.) when available */
|
|
349
|
+
name?: string;
|
|
321
350
|
/** Source file where error occurred */
|
|
322
351
|
filename?: string;
|
|
323
352
|
/** Line number in source file */
|
|
@@ -465,6 +494,20 @@ interface Config {
|
|
|
465
494
|
webVitalsThresholds?: Partial<Record<WebVitalType, number>>;
|
|
466
495
|
/** Interval in milliseconds between event batch sends. @default 10000 (10 seconds) */
|
|
467
496
|
sendIntervalMs?: number;
|
|
497
|
+
/**
|
|
498
|
+
* If true, the event queue is flushed automatically after every SPA navigation
|
|
499
|
+
* (`pushState`, `replaceState`, `popstate`, `hashchange`). Prevents batch loss when the
|
|
500
|
+
* user closes the tab mid-buffer between SPA route changes. No-op for MPAs (no SPA nav).
|
|
501
|
+
* @default true
|
|
502
|
+
*/
|
|
503
|
+
flushOnSpaNavigation?: boolean;
|
|
504
|
+
/**
|
|
505
|
+
* If true, the event queue is flushed when `document.hidden` becomes `true`
|
|
506
|
+
* (tab switch, lock screen, app backgrounding). Especially relevant on mobile Safari
|
|
507
|
+
* where `pagehide`/`beforeunload` may not fire reliably.
|
|
508
|
+
* @default true
|
|
509
|
+
*/
|
|
510
|
+
flushOnPageHidden?: boolean;
|
|
468
511
|
/** Optional configuration for third-party integrations. */
|
|
469
512
|
integrations?: {
|
|
470
513
|
/** TraceLog integration options. */
|
|
@@ -1336,6 +1379,7 @@ declare class EventManager extends StateManager {
|
|
|
1336
1379
|
private rateLimitCounter;
|
|
1337
1380
|
private rateLimitWindowStart;
|
|
1338
1381
|
private lastSessionId;
|
|
1382
|
+
private pendingSyncFlush;
|
|
1339
1383
|
private sessionEventCounts;
|
|
1340
1384
|
private readonly saveSessionCountsDebounced;
|
|
1341
1385
|
/**
|
|
@@ -1543,6 +1587,44 @@ declare class EventManager extends StateManager {
|
|
|
1543
1587
|
* @see src/managers/README.md (lines 5-75) for flush details
|
|
1544
1588
|
*/
|
|
1545
1589
|
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;
|
|
1546
1628
|
/**
|
|
1547
1629
|
* Sets the custom headers provider callback for the custom integration.
|
|
1548
1630
|
* Only affects requests to custom backend (not TraceLog SaaS).
|
|
@@ -1664,6 +1746,16 @@ declare class EventManager extends StateManager {
|
|
|
1664
1746
|
*/
|
|
1665
1747
|
private buildBatchesWithIds;
|
|
1666
1748
|
private flushEvents;
|
|
1749
|
+
/**
|
|
1750
|
+
* Re-runs a sync flush that was deferred while an async send was in flight.
|
|
1751
|
+
*
|
|
1752
|
+
* Called from the `finally` blocks of `flushEvents(false)` and
|
|
1753
|
+
* `sendEventsQueue()`. If `pendingSyncFlush` is set, clears the flag and
|
|
1754
|
+
* invokes `flushImmediatelySync()` synchronously so any events that arrived
|
|
1755
|
+
* after the deferred sync call are delivered before the next event loop
|
|
1756
|
+
* tick. Critical for high-stakes events tracked mid-async-send.
|
|
1757
|
+
*/
|
|
1758
|
+
private drainPendingSyncFlush;
|
|
1667
1759
|
/**
|
|
1668
1760
|
* Sends one batch synchronously across all integrations (sendBeacon path).
|
|
1669
1761
|
* Optimistic removal: if any integration succeeds, we remove the batch's
|
|
@@ -2453,8 +2545,8 @@ interface TraceLogTestBridge {
|
|
|
2453
2545
|
readonly initialized: boolean;
|
|
2454
2546
|
init(config?: Config): Promise<InitResult>;
|
|
2455
2547
|
destroy(force?: boolean): void;
|
|
2456
|
-
sendCustomEvent(name: string, data?: Record<string, unknown> | Record<string, unknown>[]): void;
|
|
2457
|
-
event(name: string, metadata?: Record<string, unknown> | Record<string, unknown>[]): void;
|
|
2548
|
+
sendCustomEvent(name: string, data?: Record<string, unknown> | Record<string, unknown>[], options?: EventOptions): void;
|
|
2549
|
+
event(name: string, metadata?: Record<string, unknown> | Record<string, unknown>[], options?: EventOptions): void;
|
|
2458
2550
|
on(event: string, callback: (data: any) => void): void;
|
|
2459
2551
|
off(event: string, callback: (data: any) => void): void;
|
|
2460
2552
|
get<T extends keyof State>(key: T): State[T];
|
|
@@ -2641,7 +2733,7 @@ declare const getWebVitalsThresholds: (mode?: WebVitalsMode) => Record<WebVitalT
|
|
|
2641
2733
|
|
|
2642
2734
|
declare const tracelog: {
|
|
2643
2735
|
init: (config?: Config) => Promise<InitResult>;
|
|
2644
|
-
event: (name: string, metadata?: Record<string, MetadataType> | Record<string, MetadataType>[]) => void;
|
|
2736
|
+
event: (name: string, metadata?: Record<string, MetadataType> | Record<string, MetadataType>[], options?: EventOptions) => void;
|
|
2645
2737
|
on: <K extends keyof EmitterMap>(event: K, callback: EmitterCallback<EmitterMap[K]>) => void;
|
|
2646
2738
|
off: <K extends keyof EmitterMap>(event: K, callback: EmitterCallback<EmitterMap[K]>) => void;
|
|
2647
2739
|
setTransformer: typeof setTransformer;
|
|
@@ -2656,6 +2748,8 @@ declare const tracelog: {
|
|
|
2656
2748
|
mergeGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
|
|
2657
2749
|
identify: (userId: string, traits?: Record<string, string>) => void;
|
|
2658
2750
|
resetIdentity: () => Promise<void>;
|
|
2751
|
+
flushImmediately: () => Promise<boolean>;
|
|
2752
|
+
flushImmediatelySync: () => boolean;
|
|
2659
2753
|
};
|
|
2660
2754
|
|
|
2661
|
-
export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, type CustomHeadersProvider, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, type IdentifyData, type InitResult, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, type QueueMetadata, type QueuedEvent, RateLimitError, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, TimeoutError, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
|
|
2755
|
+
export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, type CustomHeadersProvider, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, type EventOptions, EventType, type EventTypeName, type EventsQueue, type IdentifyData, type InitResult, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, type QueueMetadata, type QueuedEvent, RateLimitError, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, TimeoutError, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
|