@beworke/pixel 0.1.0-rc.6 → 0.1.0-rc.7
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 +12 -12
- package/RELEASE_CANDIDATE.md +19 -13
- package/dist/{StorageFactory-CPghDPBj.d.mts → StorageFactory-Cq29vF32.d.mts} +2 -2
- package/dist/{StorageFactory-tjfzk57c.d.ts → StorageFactory-DeMaZ8wk.d.ts} +2 -2
- package/dist/config/index.cjs.js +1 -1
- package/dist/config/index.cjs.js.map +1 -1
- package/dist/config/index.d.mts +4 -4
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.esm.js +1 -1
- package/dist/config/index.esm.js.map +1 -1
- package/dist/events/index.cjs.js.map +1 -1
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.esm.js.map +1 -1
- package/dist/examples/html-script/README.md +20 -76
- package/dist/examples/html-script/RELEASE_CANDIDATE.md +14 -13
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +1 -1
- package/dist/examples/html-script/add-to-cart/README.md +6 -3
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +597 -0
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +3 -2
- package/dist/examples/html-script/behavior/example-behavior-engagement.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-viewport.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior.html +1 -1
- package/dist/examples/html-script/example-basic.html +1 -1
- package/dist/examples/html-script/example-checkout-commerce.html +1 -1
- package/dist/examples/html-script/example-conversion.html +1 -1
- package/dist/examples/html-script/example-integration.html +1 -1
- package/dist/examples/html-script/example-landing-commerce.html +42 -1
- package/dist/examples/html-script/example-runtime-diagnostics.html +1 -1
- package/dist/examples/html-script/example-transport.html +6 -1
- package/dist/examples/html-script/full-funnel/README.md +1 -1
- package/dist/examples/html-script/full-funnel/checkout.html +1 -1
- package/dist/examples/html-script/full-funnel/downsell.html +1 -1
- package/dist/examples/html-script/full-funnel/landing.html +54 -2
- package/dist/examples/html-script/full-funnel/thank-you.html +1 -1
- package/dist/examples/html-script/full-funnel/upsell.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-auto.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-click.html +1 -1
- package/dist/examples/html-script/release-candidate.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +1 -1
- package/dist/examples/html-script/search/example-search-attribute.html +1 -1
- package/dist/examples/html-script/search/example-search-button-sync.html +1 -1
- package/dist/examples/html-script/search/example-search-dedupe.html +1 -1
- package/dist/examples/html-script/search/example-search-input.html +1 -1
- package/dist/examples/html-script/search/example-search-manual.html +1 -1
- package/dist/examples/html-script/search/example-search-submit.html +1 -1
- package/dist/examples/html-script/search/example-search-text.html +1 -1
- package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +38 -9
- package/dist/examples/html-script/url-context/example-url-context-landing.html +53 -13
- package/dist/examples/html-script/url-context/example-url-context-upsell.html +48 -10
- package/dist/examples/html-script/url-context/example-url-context.html +51 -17
- package/dist/examples/html-script/view-content/example-view-content-attribute.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-css.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-dedupe.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-empty.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-manual.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-product-card.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-text.html +1 -1
- package/dist/examples/release-candidate/README.md +2 -1
- package/dist/examples/v2/README.md +15 -15
- package/dist/{index-CQAyT5Od.d.ts → index-B8u_3PGG.d.ts} +21 -2
- package/dist/{index-JlKPz4pp.d.mts → index-BxT2d-TK.d.mts} +21 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +19 -782
- package/dist/index.d.ts +19 -782
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/{pixel-BxZZx8l5.d.ts → pixel-2uL4LSyC.d.ts} +126 -5
- package/dist/{pixel-CKc4OQUx.d.mts → pixel-DMwpppf_.d.mts} +126 -5
- package/dist/{pixel-default-config-aAOujzwp.d.ts → pixel-default-config-BDPUVHse.d.ts} +1 -1
- package/dist/{pixel-default-config-CJl-eypl.d.mts → pixel-default-config-C5uLt52W.d.mts} +1 -1
- package/dist/runtime/index.cjs.js +1 -1
- package/dist/runtime/index.cjs.js.map +1 -1
- package/dist/runtime/index.d.mts +6 -6
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.esm.js +1 -1
- package/dist/runtime/index.esm.js.map +1 -1
- package/dist/services/index.cjs.js +1 -1
- package/dist/services/index.cjs.js.map +1 -1
- package/dist/services/index.d.mts +7 -7
- package/dist/services/index.d.ts +7 -7
- package/dist/services/index.esm.js +1 -1
- package/dist/services/index.esm.js.map +1 -1
- package/dist/{types-BP8dz1gP.d.mts → types-6HF3UlsL.d.mts} +2 -2
- package/dist/{types-C75pQP31.d.ts → types-BqUEoZo0.d.ts} +2 -2
- package/dist/{types-DMhzHSVC.d.mts → types-CgrabttM.d.mts} +2 -2
- package/dist/{types-D_SsCur9.d.ts → types-fFcQ1apy.d.ts} +2 -2
- package/dist/{url-context-BjAsQoVl.d.mts → url-context-Ck2LK18V.d.mts} +4 -2
- package/dist/{url-context-BjAsQoVl.d.ts → url-context-Ck2LK18V.d.ts} +4 -2
- package/dist/v2/global.global.js +1 -1
- package/dist/v2/global.global.js.map +1 -1
- package/dist/v2/index.cjs.js +1 -1
- package/dist/v2/index.cjs.js.map +1 -1
- package/dist/v2/index.d.mts +793 -9
- package/dist/v2/index.d.ts +793 -9
- package/dist/v2/index.esm.js +1 -1
- package/dist/v2/index.esm.js.map +1 -1
- package/docs/public/README.md +13 -11
- package/docs/public/api/pixel.md +1 -1
- package/docs/public/configuration/commerce.md +1 -1
- package/docs/public/getting-started/installation.md +6 -3
- package/docs/public/getting-started/react-nextjs.md +3 -3
- package/docs/public/getting-started/script-tag.md +1 -1
- package/docs/public/guides/funnel-checkout.md +1 -1
- package/docs/public/guides/funnel-full.md +3 -3
- package/docs/public/guides/funnel-landing.md +1 -1
- package/docs/public/limitations.md +1 -1
- package/docs/public/release-candidate/validation.md +22 -17
- package/package.json +8 -12
package/dist/v2/index.d.ts
CHANGED
|
@@ -1,9 +1,793 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '../
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import '../
|
|
9
|
-
|
|
1
|
+
import { P as PixelEvent, l as PurchaseData, L as LeadData, m as AddToCartData, R as RemoveFromCartData, I as InitiateCheckoutData, n as AddPaymentInfoData, V as ViewContentData, o as SearchData, e as AttributionIdentifiers } from '../index-B8u_3PGG.js';
|
|
2
|
+
import { P as PixelLogger } from '../PixelLogger-B21lEjep.js';
|
|
3
|
+
import { P as PixelConfig } from '../pixel-2uL4LSyC.js';
|
|
4
|
+
import { P as PixelRuntimeServices } from '../types-fFcQ1apy.js';
|
|
5
|
+
import { P as PixelModule, a as PixelRuntimeContext } from '../types-BqUEoZo0.js';
|
|
6
|
+
export { D as DEFAULT_PIXEL_CONFIG } from '../pixel-default-config-BDPUVHse.js';
|
|
7
|
+
export { r as resolveStorageAdapterName } from '../StorageFactory-DeMaZ8wk.js';
|
|
8
|
+
import '../url-context-Ck2LK18V.js';
|
|
9
|
+
|
|
10
|
+
type DestinationResultStatus = 'success' | 'failed' | 'ignored' | 'retry' | 'skipped';
|
|
11
|
+
type DestinationResult = {
|
|
12
|
+
readonly status: DestinationResultStatus;
|
|
13
|
+
readonly adapter: string;
|
|
14
|
+
readonly duration: number;
|
|
15
|
+
readonly timestamp: number;
|
|
16
|
+
readonly error?: string;
|
|
17
|
+
readonly ignored?: boolean;
|
|
18
|
+
readonly skipped?: boolean;
|
|
19
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
20
|
+
};
|
|
21
|
+
type DestinationMetricsSnapshot = {
|
|
22
|
+
readonly registeredDestinations: number;
|
|
23
|
+
readonly activeDestinations: number;
|
|
24
|
+
readonly eventsSent: number;
|
|
25
|
+
readonly eventsFailed: number;
|
|
26
|
+
readonly eventsIgnored: number;
|
|
27
|
+
readonly eventsSkipped: number;
|
|
28
|
+
readonly pageViewReceived: number;
|
|
29
|
+
readonly pageViewSent: number;
|
|
30
|
+
readonly pageViewSkipped: number;
|
|
31
|
+
readonly pageViewDeduped: number;
|
|
32
|
+
readonly pageViewFailed: number;
|
|
33
|
+
readonly scriptLoadAttempts: number;
|
|
34
|
+
readonly scriptLoadSuccess: number;
|
|
35
|
+
readonly scriptLoadFailure: number;
|
|
36
|
+
readonly initAttempts: number;
|
|
37
|
+
readonly initSuccess: number;
|
|
38
|
+
readonly initFailure: number;
|
|
39
|
+
readonly averageDuration: number;
|
|
40
|
+
readonly successRate: number;
|
|
41
|
+
readonly lastExecutionAt: number | null;
|
|
42
|
+
readonly lastErrorAt: number | null;
|
|
43
|
+
readonly lastErrorMessage: string | null;
|
|
44
|
+
readonly perDestination: Readonly<Record<string, {
|
|
45
|
+
readonly sent: number;
|
|
46
|
+
readonly failed: number;
|
|
47
|
+
readonly ignored: number;
|
|
48
|
+
readonly skipped: number;
|
|
49
|
+
readonly averageDuration: number;
|
|
50
|
+
readonly successRate: number;
|
|
51
|
+
readonly pageViewSent: number;
|
|
52
|
+
readonly pageViewDeduped: number;
|
|
53
|
+
readonly pageViewFailed: number;
|
|
54
|
+
readonly scriptLoadAttempts: number;
|
|
55
|
+
readonly scriptLoadSuccess: number;
|
|
56
|
+
readonly scriptLoadFailure: number;
|
|
57
|
+
readonly initAttempts: number;
|
|
58
|
+
readonly initSuccess: number;
|
|
59
|
+
readonly initFailure: number;
|
|
60
|
+
readonly lastError: string | null;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly perDestinationId: Readonly<Record<string, {
|
|
63
|
+
readonly sent: number;
|
|
64
|
+
readonly failed: number;
|
|
65
|
+
readonly pageViewSent: number;
|
|
66
|
+
readonly pageViewDeduped: number;
|
|
67
|
+
readonly pageViewFailed: number;
|
|
68
|
+
}>>;
|
|
69
|
+
};
|
|
70
|
+
type IntegrationDebugState = {
|
|
71
|
+
readonly active: boolean;
|
|
72
|
+
readonly destinationNames: readonly string[];
|
|
73
|
+
readonly metrics: DestinationMetricsSnapshot;
|
|
74
|
+
readonly lastResults: readonly DestinationResult[];
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type CompressionDebugState = {
|
|
78
|
+
readonly enabled: boolean;
|
|
79
|
+
readonly strategy: string;
|
|
80
|
+
readonly lastOriginalSize: number | null;
|
|
81
|
+
readonly lastCompressedSize: number | null;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
type CoordinationDebugState = {
|
|
85
|
+
readonly enabled: boolean;
|
|
86
|
+
readonly tabId: string;
|
|
87
|
+
readonly isLeader: boolean;
|
|
88
|
+
readonly leaderTabId: string | null;
|
|
89
|
+
readonly tabCount: number;
|
|
90
|
+
readonly transport: 'broadcastChannel' | 'storageEvents' | 'none';
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
type DeadLetterReason = 'max_retries_exceeded' | 'circuit_open' | 'permanent_failure' | 'manual';
|
|
94
|
+
type DeadLetterEntry = {
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly events: readonly PixelEvent[];
|
|
97
|
+
readonly reason: DeadLetterReason;
|
|
98
|
+
readonly failedAt: number;
|
|
99
|
+
readonly attempts: number;
|
|
100
|
+
readonly lastError?: string;
|
|
101
|
+
};
|
|
102
|
+
type DeadLetterDebugState = {
|
|
103
|
+
readonly enabled: boolean;
|
|
104
|
+
readonly count: number;
|
|
105
|
+
readonly maxEntries: number;
|
|
106
|
+
readonly entries: readonly DeadLetterEntry[];
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type BatchConfig = {
|
|
110
|
+
readonly batchSize: number;
|
|
111
|
+
readonly flushIntervalMs: number;
|
|
112
|
+
readonly maxWaitMs: number;
|
|
113
|
+
};
|
|
114
|
+
type BatchDebugState = {
|
|
115
|
+
readonly bufferSize: number;
|
|
116
|
+
readonly oldestEventAt: number | null;
|
|
117
|
+
readonly pendingBatches: number;
|
|
118
|
+
};
|
|
119
|
+
interface IBatchManager {
|
|
120
|
+
add(events: readonly PixelEvent[]): void;
|
|
121
|
+
takeBatch(maxSize?: number): PixelEvent[];
|
|
122
|
+
peek(): readonly PixelEvent[];
|
|
123
|
+
size(): number;
|
|
124
|
+
clear(): void;
|
|
125
|
+
shouldFlush(config: BatchConfig): boolean;
|
|
126
|
+
getState(): BatchDebugState;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
type FlushDebugState = {
|
|
130
|
+
readonly flushCount: number;
|
|
131
|
+
readonly lastFlushAt: number | null;
|
|
132
|
+
readonly intervalActive: boolean;
|
|
133
|
+
};
|
|
134
|
+
interface IFlushManager {
|
|
135
|
+
init(onFlush: () => void): void;
|
|
136
|
+
flush(): void;
|
|
137
|
+
destroy(): void;
|
|
138
|
+
getState(): FlushDebugState;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
type OfflineDebugState = {
|
|
142
|
+
readonly isOnline: boolean;
|
|
143
|
+
readonly paused: boolean;
|
|
144
|
+
readonly simulatedOffline: boolean;
|
|
145
|
+
};
|
|
146
|
+
interface IOfflineDetector {
|
|
147
|
+
init(onOnline: () => void, onOffline: () => void): void;
|
|
148
|
+
isOnline(): boolean;
|
|
149
|
+
isPaused(): boolean;
|
|
150
|
+
destroy(): void;
|
|
151
|
+
/** @internal Testes e playground apenas. */
|
|
152
|
+
simulateOffline(offline: boolean): void;
|
|
153
|
+
getState(): OfflineDebugState;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
type RetryTask = () => Promise<void>;
|
|
157
|
+
type RetryAttemptState = {
|
|
158
|
+
readonly id: string;
|
|
159
|
+
readonly attempt: number;
|
|
160
|
+
readonly nextRetryAt: number | null;
|
|
161
|
+
readonly status: 'pending' | 'running' | 'scheduled' | 'completed' | 'failed' | 'cancelled';
|
|
162
|
+
};
|
|
163
|
+
type RetryDebugState = {
|
|
164
|
+
readonly pendingCount: number;
|
|
165
|
+
readonly attempts: readonly RetryAttemptState[];
|
|
166
|
+
};
|
|
167
|
+
interface IRetryEngine {
|
|
168
|
+
retry(task: RetryTask, taskId?: string): Promise<void>;
|
|
169
|
+
cancel(taskId: string): void;
|
|
170
|
+
cancelAll(): void;
|
|
171
|
+
getState(): RetryDebugState;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type SendOptions = {
|
|
175
|
+
readonly signal?: AbortSignal;
|
|
176
|
+
};
|
|
177
|
+
type SendResult = {
|
|
178
|
+
readonly ack: boolean;
|
|
179
|
+
readonly eventCount: number;
|
|
180
|
+
};
|
|
181
|
+
interface EventSender {
|
|
182
|
+
send(events: PixelEvent[], options?: SendOptions): Promise<SendResult>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type DeliveryConfig = {
|
|
186
|
+
readonly batch: BatchConfig;
|
|
187
|
+
readonly timeoutMs: number;
|
|
188
|
+
};
|
|
189
|
+
type DeliveryDebugState = {
|
|
190
|
+
readonly batch: ReturnType<IBatchManager['getState']>;
|
|
191
|
+
readonly retry: ReturnType<IRetryEngine['getState']>;
|
|
192
|
+
readonly offline: ReturnType<IOfflineDetector['getState']>;
|
|
193
|
+
readonly flush: ReturnType<IFlushManager['getState']>;
|
|
194
|
+
readonly timeoutMs: number;
|
|
195
|
+
readonly inFlight: boolean;
|
|
196
|
+
readonly ackCount: number;
|
|
197
|
+
};
|
|
198
|
+
declare class TransportDelivery {
|
|
199
|
+
private readonly batchManager;
|
|
200
|
+
private readonly flushManager;
|
|
201
|
+
private readonly retryEngine;
|
|
202
|
+
private readonly offlineDetector;
|
|
203
|
+
private readonly sender;
|
|
204
|
+
private readonly config;
|
|
205
|
+
private readonly logger;
|
|
206
|
+
private active;
|
|
207
|
+
private inFlight;
|
|
208
|
+
private ackCount;
|
|
209
|
+
private abortPending;
|
|
210
|
+
private readonly onPermanentFailure;
|
|
211
|
+
constructor(deps: {
|
|
212
|
+
batchManager: IBatchManager;
|
|
213
|
+
flushManager: IFlushManager;
|
|
214
|
+
retryEngine: IRetryEngine;
|
|
215
|
+
offlineDetector: IOfflineDetector;
|
|
216
|
+
sender: EventSender;
|
|
217
|
+
config: DeliveryConfig;
|
|
218
|
+
logger: PixelLogger;
|
|
219
|
+
abortPending?: () => void;
|
|
220
|
+
onPermanentFailure?: (events: readonly PixelEvent[], error: unknown) => void;
|
|
221
|
+
});
|
|
222
|
+
init(): void;
|
|
223
|
+
destroy(): void;
|
|
224
|
+
ingest(events: readonly PixelEvent[]): void;
|
|
225
|
+
flush(): void;
|
|
226
|
+
getDebugState(): DeliveryDebugState;
|
|
227
|
+
getOfflineDetector(): IOfflineDetector;
|
|
228
|
+
private processBatch;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
type OrderingDebugState = {
|
|
232
|
+
readonly enabled: boolean;
|
|
233
|
+
readonly globalSequence: number;
|
|
234
|
+
readonly sessionSequence: number;
|
|
235
|
+
readonly lastCorrelationId: string | null;
|
|
236
|
+
readonly recordCount: number;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
type BackpressurePolicy = 'drop_oldest' | 'drop_newest' | 'reject_new' | 'sample' | 'none';
|
|
240
|
+
type BackpressureDebugState = {
|
|
241
|
+
readonly enabled: boolean;
|
|
242
|
+
readonly currentSize: number;
|
|
243
|
+
readonly maxQueueSize: number;
|
|
244
|
+
readonly policy: BackpressurePolicy;
|
|
245
|
+
readonly totalDropped: number;
|
|
246
|
+
readonly totalRejected: number;
|
|
247
|
+
readonly totalSampled: number;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
type ReplayTrigger = 'init' | 'reload' | 'reconnect' | 'restart' | 'manual';
|
|
251
|
+
type ReplayDebugState = {
|
|
252
|
+
readonly enabled: boolean;
|
|
253
|
+
readonly lastTrigger: ReplayTrigger | null;
|
|
254
|
+
readonly lastReplayAt: number | null;
|
|
255
|
+
readonly totalReplayed: number;
|
|
256
|
+
readonly pendingCount: number;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
type CircuitBreakerState = 'closed' | 'open' | 'half_open';
|
|
260
|
+
type CircuitBreakerMetrics = {
|
|
261
|
+
readonly state: CircuitBreakerState;
|
|
262
|
+
readonly consecutiveFailures: number;
|
|
263
|
+
readonly totalFailures: number;
|
|
264
|
+
readonly totalSuccesses: number;
|
|
265
|
+
readonly totalBlocked: number;
|
|
266
|
+
readonly lastFailureAt: number | null;
|
|
267
|
+
readonly lastSuccessAt: number | null;
|
|
268
|
+
readonly openedAt: number | null;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
type TransportAdvancedDebugState = {
|
|
272
|
+
readonly storage: {
|
|
273
|
+
readonly adapter: string;
|
|
274
|
+
readonly persistenceEnabled: boolean;
|
|
275
|
+
readonly recordCount: number;
|
|
276
|
+
};
|
|
277
|
+
readonly replay: ReplayDebugState;
|
|
278
|
+
readonly ordering: OrderingDebugState;
|
|
279
|
+
readonly coordination: CoordinationDebugState;
|
|
280
|
+
readonly circuitBreaker: CircuitBreakerMetrics;
|
|
281
|
+
readonly backpressure: BackpressureDebugState;
|
|
282
|
+
readonly deadLetter: DeadLetterDebugState;
|
|
283
|
+
readonly compression: CompressionDebugState;
|
|
284
|
+
readonly senderMode: 'mock' | 'http';
|
|
285
|
+
};
|
|
286
|
+
type TransportDebugState = {
|
|
287
|
+
readonly queueSize: number;
|
|
288
|
+
readonly queueContents: readonly PixelEvent[];
|
|
289
|
+
readonly pipelineSteps: readonly string[];
|
|
290
|
+
readonly senderLogs: readonly string[];
|
|
291
|
+
readonly sentCount: number;
|
|
292
|
+
readonly delivery: ReturnType<TransportDelivery['getDebugState']> | null;
|
|
293
|
+
readonly sender: Record<string, unknown> | null;
|
|
294
|
+
readonly advanced: TransportAdvancedDebugState | null;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Contratos oficiais do Debug Snapshot (Etapa 16).
|
|
299
|
+
* Somente dados serializáveis, read-only, sem DOM/callbacks/classes.
|
|
300
|
+
*/
|
|
301
|
+
type DebugHealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
|
|
302
|
+
type DebugWarning = {
|
|
303
|
+
readonly code: string;
|
|
304
|
+
readonly message: string;
|
|
305
|
+
readonly source?: string;
|
|
306
|
+
};
|
|
307
|
+
type DebugError = {
|
|
308
|
+
readonly code: string;
|
|
309
|
+
readonly message: string;
|
|
310
|
+
readonly source?: string;
|
|
311
|
+
readonly at?: number;
|
|
312
|
+
};
|
|
313
|
+
type RuntimeHealthSnapshot = {
|
|
314
|
+
readonly status: DebugHealthStatus;
|
|
315
|
+
readonly checks: ReadonlyArray<{
|
|
316
|
+
readonly id: string;
|
|
317
|
+
readonly status: DebugHealthStatus;
|
|
318
|
+
readonly detail?: string;
|
|
319
|
+
}>;
|
|
320
|
+
readonly reasons: readonly string[];
|
|
321
|
+
};
|
|
322
|
+
type RuntimeDebugSnapshot = {
|
|
323
|
+
readonly initialized: boolean;
|
|
324
|
+
readonly destroyed: boolean;
|
|
325
|
+
readonly moduleCount: number;
|
|
326
|
+
readonly activeModuleCount: number;
|
|
327
|
+
readonly moduleNames: readonly string[];
|
|
328
|
+
readonly activeModuleNames: readonly string[];
|
|
329
|
+
};
|
|
330
|
+
type ModuleDebugSnapshot = {
|
|
331
|
+
/** Identificador do módulo (não confundir com PII `name`). */
|
|
332
|
+
readonly id: string;
|
|
333
|
+
readonly configuredEnabled: boolean;
|
|
334
|
+
readonly initialized: boolean;
|
|
335
|
+
};
|
|
336
|
+
type CoreDebugSnapshot = {
|
|
337
|
+
readonly enabled: boolean;
|
|
338
|
+
readonly visitorId: string | null;
|
|
339
|
+
readonly sessionId: string | null;
|
|
340
|
+
readonly sessionExpired: boolean | null;
|
|
341
|
+
readonly fingerprint: string | null;
|
|
342
|
+
readonly urlContextEnabled: boolean;
|
|
343
|
+
};
|
|
344
|
+
type UrlContextDebugSnapshot = {
|
|
345
|
+
readonly enabled: boolean;
|
|
346
|
+
readonly available: boolean;
|
|
347
|
+
readonly managedKeys: readonly string[];
|
|
348
|
+
readonly forwardedKeys: readonly string[];
|
|
349
|
+
readonly source: Readonly<Record<string, string>>;
|
|
350
|
+
readonly queryParamCount: number;
|
|
351
|
+
};
|
|
352
|
+
type AttributionDebugSnapshot = {
|
|
353
|
+
readonly enabled: boolean;
|
|
354
|
+
readonly available: boolean;
|
|
355
|
+
readonly identifierKeys: readonly string[];
|
|
356
|
+
/** Valores mascarados / públicos apenas. */
|
|
357
|
+
readonly identifiers: Readonly<Record<string, string>>;
|
|
358
|
+
};
|
|
359
|
+
type CommerceDebugSnapshot = {
|
|
360
|
+
readonly enabled: boolean;
|
|
361
|
+
readonly available: boolean;
|
|
362
|
+
readonly mode: string | null;
|
|
363
|
+
readonly currency: string | null;
|
|
364
|
+
readonly catalogSize: number;
|
|
365
|
+
readonly itemCount: number;
|
|
366
|
+
readonly cartValue: number | null;
|
|
367
|
+
readonly productIds: readonly string[];
|
|
368
|
+
};
|
|
369
|
+
type BehaviorHeartbeatDebugSnapshot = {
|
|
370
|
+
readonly enabled: boolean;
|
|
371
|
+
readonly initialized: boolean;
|
|
372
|
+
readonly running: boolean;
|
|
373
|
+
readonly intervalMs: number;
|
|
374
|
+
readonly hiddenIntervalMs: number;
|
|
375
|
+
readonly sequence: number;
|
|
376
|
+
readonly emittedCount: number;
|
|
377
|
+
readonly skippedCount: number;
|
|
378
|
+
readonly lastEmittedAt: number | undefined;
|
|
379
|
+
readonly nextExpectedAt: number | undefined;
|
|
380
|
+
readonly lastDriftMs: number | undefined;
|
|
381
|
+
};
|
|
382
|
+
type BehaviorViewportDebugSnapshot = {
|
|
383
|
+
readonly enabled: boolean;
|
|
384
|
+
readonly initialized: boolean;
|
|
385
|
+
readonly available: boolean;
|
|
386
|
+
readonly targetCount: number;
|
|
387
|
+
readonly matchedElementCount: number;
|
|
388
|
+
readonly observedElementCount: number;
|
|
389
|
+
readonly activeElementCount: number;
|
|
390
|
+
readonly pendingElementCount: number;
|
|
391
|
+
readonly enterCount: number;
|
|
392
|
+
readonly exitCount: number;
|
|
393
|
+
readonly mutationObserverEnabled: boolean;
|
|
394
|
+
readonly maxObservedElements: number;
|
|
395
|
+
readonly limitReached: boolean;
|
|
396
|
+
readonly lastEventAt: number | undefined;
|
|
397
|
+
};
|
|
398
|
+
type BehaviorEngagementSignalCounts = {
|
|
399
|
+
readonly HEARTBEAT: number;
|
|
400
|
+
readonly SCROLL: number;
|
|
401
|
+
readonly CLICK: number;
|
|
402
|
+
readonly RAGE_CLICK: number;
|
|
403
|
+
readonly IDLE: number;
|
|
404
|
+
readonly ACTIVITY: number;
|
|
405
|
+
readonly VISIBLE: number;
|
|
406
|
+
readonly HIDDEN: number;
|
|
407
|
+
readonly VIEWPORT_ENTER: number;
|
|
408
|
+
readonly VIEWPORT_EXIT: number;
|
|
409
|
+
};
|
|
410
|
+
type BehaviorEngagementDebugSnapshot = {
|
|
411
|
+
readonly enabled: boolean;
|
|
412
|
+
readonly initialized: boolean;
|
|
413
|
+
readonly running: boolean;
|
|
414
|
+
readonly score: number;
|
|
415
|
+
readonly previousScore: number;
|
|
416
|
+
readonly peakScore: number;
|
|
417
|
+
readonly averageScore: number;
|
|
418
|
+
readonly level: 'low' | 'medium' | 'high';
|
|
419
|
+
readonly evaluationCount: number;
|
|
420
|
+
readonly emittedUpdateCount: number;
|
|
421
|
+
readonly emittedSummaryCount: number;
|
|
422
|
+
readonly lastEvaluatedAt: number | undefined;
|
|
423
|
+
readonly lastEmittedAt: number | undefined;
|
|
424
|
+
readonly evaluationIntervalMs: number;
|
|
425
|
+
readonly lastDriftMs: number | undefined;
|
|
426
|
+
readonly hasError: boolean;
|
|
427
|
+
readonly signalCounts: BehaviorEngagementSignalCounts;
|
|
428
|
+
};
|
|
429
|
+
type BehaviorRateLimitDebugSnapshot = {
|
|
430
|
+
readonly enabled: boolean;
|
|
431
|
+
readonly windowMs: number;
|
|
432
|
+
readonly maxSignalsPerWindow: number;
|
|
433
|
+
readonly criticalBypass: boolean;
|
|
434
|
+
readonly accepted: number;
|
|
435
|
+
readonly dropped: number;
|
|
436
|
+
readonly bypassed: number;
|
|
437
|
+
readonly windowCount: number;
|
|
438
|
+
readonly windowStartedAt: number | undefined;
|
|
439
|
+
};
|
|
440
|
+
type BehaviorBufferDebugSnapshot = {
|
|
441
|
+
readonly enabled: boolean;
|
|
442
|
+
readonly size: number;
|
|
443
|
+
readonly maxSize: number;
|
|
444
|
+
readonly flushSize: number;
|
|
445
|
+
readonly maxAgeMs: number;
|
|
446
|
+
readonly dropStrategy: 'drop_oldest' | 'drop_newest' | 'compress_similar';
|
|
447
|
+
readonly flushCount: number;
|
|
448
|
+
readonly dropCount: number;
|
|
449
|
+
readonly compressedCount: number;
|
|
450
|
+
readonly lastFlushAt: number | undefined;
|
|
451
|
+
readonly lastFlushReason: 'size' | 'age' | 'hidden' | 'destroy' | 'manual' | undefined;
|
|
452
|
+
};
|
|
453
|
+
type BehaviorStateMachineDebugSnapshot = {
|
|
454
|
+
readonly enabled: boolean;
|
|
455
|
+
readonly state: string;
|
|
456
|
+
readonly previousState: string | undefined;
|
|
457
|
+
readonly generation: number;
|
|
458
|
+
readonly changedAt: number | undefined;
|
|
459
|
+
readonly transitionCount: number;
|
|
460
|
+
readonly invalidTransitionCount: number;
|
|
461
|
+
readonly historySize: number;
|
|
462
|
+
};
|
|
463
|
+
type BehaviorSessionSummaryDebugSnapshot = {
|
|
464
|
+
readonly enabled: boolean;
|
|
465
|
+
readonly emitOnHidden: boolean;
|
|
466
|
+
readonly emitOnDestroy: boolean;
|
|
467
|
+
readonly minimumSessionMs: number;
|
|
468
|
+
readonly emittedCount: number;
|
|
469
|
+
readonly lastEmittedAt: number | undefined;
|
|
470
|
+
readonly startedAt: number | undefined;
|
|
471
|
+
};
|
|
472
|
+
type BehaviorDebugSnapshot = {
|
|
473
|
+
readonly enabled: boolean;
|
|
474
|
+
readonly configuredTrackers: readonly string[];
|
|
475
|
+
readonly configuredEngines: readonly string[];
|
|
476
|
+
readonly heartbeat: BehaviorHeartbeatDebugSnapshot | null;
|
|
477
|
+
readonly viewport: BehaviorViewportDebugSnapshot | null;
|
|
478
|
+
readonly engagement: BehaviorEngagementDebugSnapshot | null;
|
|
479
|
+
readonly rateLimit: BehaviorRateLimitDebugSnapshot | null;
|
|
480
|
+
readonly buffer: BehaviorBufferDebugSnapshot | null;
|
|
481
|
+
readonly stateMachine: BehaviorStateMachineDebugSnapshot | null;
|
|
482
|
+
readonly sessionSummary: BehaviorSessionSummaryDebugSnapshot | null;
|
|
483
|
+
};
|
|
484
|
+
type ConversionDebugSnapshot = {
|
|
485
|
+
readonly enabled: boolean;
|
|
486
|
+
readonly autoEnabled: boolean;
|
|
487
|
+
readonly manualEnabledFlags: Readonly<Record<string, boolean>>;
|
|
488
|
+
readonly detectorCount: number;
|
|
489
|
+
readonly activeDetectors: readonly string[];
|
|
490
|
+
readonly dedupeKeyCount: number;
|
|
491
|
+
};
|
|
492
|
+
type IntegrationsDebugSnapshot = {
|
|
493
|
+
readonly enabled: boolean;
|
|
494
|
+
readonly available: boolean;
|
|
495
|
+
readonly active: boolean;
|
|
496
|
+
readonly destinationNames: readonly string[];
|
|
497
|
+
readonly metrics: Readonly<Record<string, unknown>> | null;
|
|
498
|
+
};
|
|
499
|
+
type TransportDebugSnapshot = {
|
|
500
|
+
readonly enabled: boolean;
|
|
501
|
+
readonly available: boolean;
|
|
502
|
+
readonly online: boolean | 'unknown';
|
|
503
|
+
readonly senderMode: string | 'unknown' | 'unavailable';
|
|
504
|
+
readonly queueSize: number | 'unavailable';
|
|
505
|
+
readonly sentCount: number | 'unavailable';
|
|
506
|
+
readonly ackCount: number | 'unavailable';
|
|
507
|
+
readonly inFlight: boolean | 'unavailable';
|
|
508
|
+
readonly retryPending: number | 'unavailable';
|
|
509
|
+
readonly circuitBreakerState: string | 'unavailable';
|
|
510
|
+
readonly dlqCount: number | 'unavailable';
|
|
511
|
+
readonly isLeader: boolean | 'unavailable';
|
|
512
|
+
readonly persistenceEnabled: boolean | 'unavailable';
|
|
513
|
+
};
|
|
514
|
+
type PixelDebugSnapshot = {
|
|
515
|
+
readonly sdkVersion: string;
|
|
516
|
+
readonly capturedAt: number;
|
|
517
|
+
readonly runtime: RuntimeDebugSnapshot;
|
|
518
|
+
readonly modules: readonly ModuleDebugSnapshot[];
|
|
519
|
+
readonly core: CoreDebugSnapshot;
|
|
520
|
+
readonly urlContext: UrlContextDebugSnapshot;
|
|
521
|
+
readonly attribution: AttributionDebugSnapshot;
|
|
522
|
+
readonly commerce: CommerceDebugSnapshot;
|
|
523
|
+
readonly behavior: BehaviorDebugSnapshot;
|
|
524
|
+
readonly conversion: ConversionDebugSnapshot;
|
|
525
|
+
readonly integrations: IntegrationsDebugSnapshot;
|
|
526
|
+
readonly transport: TransportDebugSnapshot;
|
|
527
|
+
readonly health: RuntimeHealthSnapshot;
|
|
528
|
+
readonly warnings: readonly DebugWarning[];
|
|
529
|
+
readonly errors: readonly DebugError[];
|
|
530
|
+
/** Config sanitizada (sem secrets). */
|
|
531
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/** Contratos Engagement Runtime (Etapa 19) — readonly, serializáveis, sem DOM. */
|
|
535
|
+
type EngagementLevel = 'low' | 'medium' | 'high';
|
|
536
|
+
type EngagementSignalCounts = {
|
|
537
|
+
readonly HEARTBEAT: number;
|
|
538
|
+
readonly SCROLL: number;
|
|
539
|
+
readonly CLICK: number;
|
|
540
|
+
readonly RAGE_CLICK: number;
|
|
541
|
+
readonly IDLE: number;
|
|
542
|
+
readonly ACTIVITY: number;
|
|
543
|
+
readonly VISIBLE: number;
|
|
544
|
+
readonly HIDDEN: number;
|
|
545
|
+
readonly VIEWPORT_ENTER: number;
|
|
546
|
+
readonly VIEWPORT_EXIT: number;
|
|
547
|
+
};
|
|
548
|
+
/** Snapshot read-only para diagnostics (sanitizado, imutável, sem sinais completos). */
|
|
549
|
+
type EngagementSnapshot = {
|
|
550
|
+
readonly enabled: boolean;
|
|
551
|
+
readonly initialized: boolean;
|
|
552
|
+
readonly running: boolean;
|
|
553
|
+
readonly score: number;
|
|
554
|
+
readonly previousScore: number;
|
|
555
|
+
readonly peakScore: number;
|
|
556
|
+
readonly averageScore: number;
|
|
557
|
+
readonly level: EngagementLevel;
|
|
558
|
+
readonly evaluationCount: number;
|
|
559
|
+
readonly emittedUpdateCount: number;
|
|
560
|
+
readonly emittedSummaryCount: number;
|
|
561
|
+
readonly lastEvaluatedAt: number | undefined;
|
|
562
|
+
readonly lastEmittedAt: number | undefined;
|
|
563
|
+
readonly evaluationIntervalMs: number;
|
|
564
|
+
readonly lastDriftMs: number | undefined;
|
|
565
|
+
readonly hasError: boolean;
|
|
566
|
+
readonly signalCounts: EngagementSignalCounts;
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
type HeartbeatSnapshot = {
|
|
570
|
+
readonly enabled: boolean;
|
|
571
|
+
readonly initialized: boolean;
|
|
572
|
+
readonly running: boolean;
|
|
573
|
+
readonly intervalMs: number;
|
|
574
|
+
readonly hiddenIntervalMs: number;
|
|
575
|
+
readonly sequence: number;
|
|
576
|
+
readonly emittedCount: number;
|
|
577
|
+
readonly skippedCount: number;
|
|
578
|
+
readonly lastEmittedAt: number | undefined;
|
|
579
|
+
readonly nextExpectedAt: number | undefined;
|
|
580
|
+
readonly lastDriftMs: number | undefined;
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
/** Sinais internos do módulo Behavior (não são eventos públicos). */
|
|
584
|
+
type BehaviorSignalType = 'ACTIVITY' | 'IDLE' | 'VISIBLE' | 'HIDDEN' | 'SCROLL' | 'CLICK' | 'RAGE_CLICK' | 'EXIT_INTENT' | 'HEARTBEAT' | 'VIEWPORT_ENTER' | 'VIEWPORT_EXIT';
|
|
585
|
+
type BehaviorSignalData = Readonly<Record<string, unknown>>;
|
|
586
|
+
|
|
587
|
+
/** Contratos do Behavior Rate Limiter (Etapa 20) — readonly, serializáveis. */
|
|
588
|
+
|
|
589
|
+
/** Snapshot read-only para diagnostics. */
|
|
590
|
+
type RateLimitSnapshot = {
|
|
591
|
+
readonly enabled: boolean;
|
|
592
|
+
readonly windowMs: number;
|
|
593
|
+
readonly maxSignalsPerWindow: number;
|
|
594
|
+
readonly criticalBypass: boolean;
|
|
595
|
+
readonly accepted: number;
|
|
596
|
+
readonly dropped: number;
|
|
597
|
+
readonly bypassed: number;
|
|
598
|
+
/** Sinais na janela corrente. */
|
|
599
|
+
readonly windowCount: number;
|
|
600
|
+
readonly windowStartedAt: number | undefined;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
/** Contratos do Behavior Buffer (Etapa 20) — agregação interna, não Transport. */
|
|
604
|
+
|
|
605
|
+
type BufferDropStrategy = 'drop_oldest' | 'drop_newest' | 'compress_similar';
|
|
606
|
+
type BufferFlushReason = 'size' | 'age' | 'hidden' | 'destroy' | 'manual';
|
|
607
|
+
/** Snapshot read-only para diagnostics. */
|
|
608
|
+
type BufferSnapshot = {
|
|
609
|
+
readonly enabled: boolean;
|
|
610
|
+
readonly size: number;
|
|
611
|
+
readonly maxSize: number;
|
|
612
|
+
readonly flushSize: number;
|
|
613
|
+
readonly maxAgeMs: number;
|
|
614
|
+
readonly dropStrategy: BufferDropStrategy;
|
|
615
|
+
readonly flushCount: number;
|
|
616
|
+
readonly dropCount: number;
|
|
617
|
+
readonly compressedCount: number;
|
|
618
|
+
readonly lastFlushAt: number | undefined;
|
|
619
|
+
readonly lastFlushReason: BufferFlushReason | undefined;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
/** Contratos da Behavior State Machine (Etapa 20) — readonly, serializáveis. */
|
|
623
|
+
type BehaviorState = 'NOT_INITIALIZED' | 'INITIALIZING' | 'ACTIVE' | 'IDLE' | 'HIDDEN' | 'PAUSED' | 'DESTROYING' | 'DESTROYED';
|
|
624
|
+
/** Snapshot read-only para diagnostics. */
|
|
625
|
+
type StateMachineSnapshot = {
|
|
626
|
+
readonly enabled: boolean;
|
|
627
|
+
readonly state: BehaviorState;
|
|
628
|
+
readonly previousState: BehaviorState | undefined;
|
|
629
|
+
readonly generation: number;
|
|
630
|
+
readonly changedAt: number | undefined;
|
|
631
|
+
readonly transitionCount: number;
|
|
632
|
+
readonly invalidTransitionCount: number;
|
|
633
|
+
readonly historySize: number;
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
/** Contratos do Behavior Session Summary (Etapa 20) — sem PII, sem DOM. */
|
|
637
|
+
|
|
638
|
+
type SessionSummaryReason = 'hidden' | 'destroy';
|
|
639
|
+
/** Snapshot read-only para diagnostics. */
|
|
640
|
+
type SessionSummarySnapshot = {
|
|
641
|
+
readonly enabled: boolean;
|
|
642
|
+
readonly emitOnHidden: boolean;
|
|
643
|
+
readonly emitOnDestroy: boolean;
|
|
644
|
+
readonly minimumSessionMs: number;
|
|
645
|
+
readonly emittedCount: number;
|
|
646
|
+
readonly lastEmittedAt: number | undefined;
|
|
647
|
+
readonly startedAt: number | undefined;
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
type ViewportSnapshot = {
|
|
651
|
+
readonly enabled: boolean;
|
|
652
|
+
readonly initialized: boolean;
|
|
653
|
+
readonly available: boolean;
|
|
654
|
+
readonly targetCount: number;
|
|
655
|
+
readonly matchedElementCount: number;
|
|
656
|
+
readonly observedElementCount: number;
|
|
657
|
+
readonly activeElementCount: number;
|
|
658
|
+
readonly pendingElementCount: number;
|
|
659
|
+
readonly enterCount: number;
|
|
660
|
+
readonly exitCount: number;
|
|
661
|
+
readonly mutationObserverEnabled: boolean;
|
|
662
|
+
readonly maxObservedElements: number;
|
|
663
|
+
readonly limitReached: boolean;
|
|
664
|
+
readonly lastEventAt: number | undefined;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
declare class BehaviorModule implements PixelModule {
|
|
668
|
+
readonly name: "behavior";
|
|
669
|
+
private trackers;
|
|
670
|
+
private heartbeatEngine;
|
|
671
|
+
private engagementEngine;
|
|
672
|
+
private viewportTracker;
|
|
673
|
+
private signalBus;
|
|
674
|
+
/**
|
|
675
|
+
* Coordenador de Runtime Intelligence (Etapa 20). Persiste entre init/destroy
|
|
676
|
+
* para manter a continuidade de geração da state machine no reinit.
|
|
677
|
+
*/
|
|
678
|
+
private coordinator;
|
|
679
|
+
private coordinatorActive;
|
|
680
|
+
private active;
|
|
681
|
+
init(context: PixelRuntimeContext): void;
|
|
682
|
+
destroy(): void;
|
|
683
|
+
private destroyCoordinator;
|
|
684
|
+
getHeartbeatSnapshot(): HeartbeatSnapshot | null;
|
|
685
|
+
getViewportSnapshot(): ViewportSnapshot | null;
|
|
686
|
+
getEngagementSnapshot(): EngagementSnapshot | null;
|
|
687
|
+
getRateLimitSnapshot(): RateLimitSnapshot | null;
|
|
688
|
+
getBufferSnapshot(): BufferSnapshot | null;
|
|
689
|
+
getStateMachineSnapshot(): StateMachineSnapshot | null;
|
|
690
|
+
getSessionSummarySnapshot(): SessionSummarySnapshot | null;
|
|
691
|
+
/** @internal Avaliação manual para playground/testes. */
|
|
692
|
+
evaluateEngagementNow(): void;
|
|
693
|
+
/** @internal Flush manual do buffer (playground/testes). */
|
|
694
|
+
flushBufferNow(): void;
|
|
695
|
+
/** @internal Emissão manual de session summary (playground/testes). */
|
|
696
|
+
emitSessionSummaryNow(reason?: SessionSummaryReason): boolean;
|
|
697
|
+
/** @internal Publica um sinal interno no bus (playground/testes). */
|
|
698
|
+
debugPublishSignal(type: BehaviorSignalType, data?: BehaviorSignalData): void;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
declare class Pixel {
|
|
702
|
+
private readonly runtime;
|
|
703
|
+
private readonly config;
|
|
704
|
+
private readonly conversionModule;
|
|
705
|
+
private readonly transportModule;
|
|
706
|
+
private readonly integrationsModule;
|
|
707
|
+
private readonly behaviorModule;
|
|
708
|
+
private readonly snapshotService;
|
|
709
|
+
private readonly diagnosticsModule;
|
|
710
|
+
constructor(config: PixelConfig);
|
|
711
|
+
init(): Promise<void>;
|
|
712
|
+
destroy(): Promise<void>;
|
|
713
|
+
isInitialized(): boolean;
|
|
714
|
+
/**
|
|
715
|
+
* Snapshot oficial read-only do Runtime (Etapa 16).
|
|
716
|
+
* Seguro antes/depois do init e após destroy. Retorno congelado e sanitizado.
|
|
717
|
+
*/
|
|
718
|
+
getDebugSnapshot(): Readonly<PixelDebugSnapshot>;
|
|
719
|
+
/**
|
|
720
|
+
* Define ou substitui um managed param do UrlContext após o init
|
|
721
|
+
* (ex.: `oid` quando a Order é criada no checkout).
|
|
722
|
+
* No-op se UrlContext desabilitado ou o param não estiver na config.
|
|
723
|
+
*/
|
|
724
|
+
setManagedUrlParam(param: string, value: string): boolean;
|
|
725
|
+
purchase(data?: PurchaseData): void;
|
|
726
|
+
lead(data: LeadData): void;
|
|
727
|
+
addToCart(data?: AddToCartData): void;
|
|
728
|
+
removeFromCart(data?: RemoveFromCartData): void;
|
|
729
|
+
initiateCheckout(data?: InitiateCheckoutData): void;
|
|
730
|
+
addPaymentInfo(data?: AddPaymentInfoData): void;
|
|
731
|
+
viewContent(data?: ViewContentData): void;
|
|
732
|
+
search(data: SearchData): void;
|
|
733
|
+
/** @internal For playground and development only. */
|
|
734
|
+
getDebugDedupeKeys(): readonly string[];
|
|
735
|
+
/** @internal For playground and development only. */
|
|
736
|
+
getDebugActiveDetectors(): readonly string[];
|
|
737
|
+
/** @internal For playground and development only. */
|
|
738
|
+
getDebugTransportState(): TransportDebugState | null;
|
|
739
|
+
/** @internal For playground — flush manual do transport. */
|
|
740
|
+
flushTransport(): void;
|
|
741
|
+
/** @internal For playground — simular offline. */
|
|
742
|
+
simulateTransportOffline(offline: boolean): void;
|
|
743
|
+
/** @internal For playground — forçar falhas no MockSender (retry). */
|
|
744
|
+
configureTransportMockSender(options: {
|
|
745
|
+
delayMs?: number;
|
|
746
|
+
failUntilAttempt?: number;
|
|
747
|
+
simulateTimeout?: boolean;
|
|
748
|
+
}): void;
|
|
749
|
+
/** @internal For playground — simular reload da página. */
|
|
750
|
+
simulateTransportReload(): Promise<void>;
|
|
751
|
+
/** @internal For playground — simular restart do transport. */
|
|
752
|
+
simulateTransportRestart(): Promise<void>;
|
|
753
|
+
/** @internal For playground — abrir circuit breaker. */
|
|
754
|
+
forceTransportCircuitOpen(): void;
|
|
755
|
+
/** @internal For playground — fechar circuit breaker. */
|
|
756
|
+
forceTransportCircuitClose(): void;
|
|
757
|
+
/** @internal For playground — replay manual da fila persistida. */
|
|
758
|
+
manualTransportReplay(): Promise<number>;
|
|
759
|
+
/** @internal For playground — replay dead letter. */
|
|
760
|
+
replayTransportDeadLetter(): PixelEvent[];
|
|
761
|
+
/** @internal For playground — limpar dead letter. */
|
|
762
|
+
clearTransportDeadLetter(): void;
|
|
763
|
+
/** @internal For playground — exportar fila. */
|
|
764
|
+
exportTransportQueue(): string;
|
|
765
|
+
/** @internal For playground — importar fila. */
|
|
766
|
+
importTransportQueue(raw: string): number;
|
|
767
|
+
/** @internal For playground — Integration Engine debug state. */
|
|
768
|
+
getDebugIntegrationState(): IntegrationDebugState | null;
|
|
769
|
+
/** @internal For playground — MemoryDestination records. */
|
|
770
|
+
getDebugIntegrationMemoryRecords(): readonly {
|
|
771
|
+
readonly at: number;
|
|
772
|
+
readonly type: string;
|
|
773
|
+
readonly payload: Readonly<Record<string, unknown>>;
|
|
774
|
+
}[];
|
|
775
|
+
/** @internal For playground — Attribution snapshot. */
|
|
776
|
+
getDebugAttributionSnapshot(): AttributionIdentifiers | null;
|
|
777
|
+
/** @internal For playground — recolher attribution. */
|
|
778
|
+
collectAttribution(): AttributionIdentifiers | null;
|
|
779
|
+
/** @internal For playground — limpar attribution. */
|
|
780
|
+
clearAttribution(): void;
|
|
781
|
+
/** @internal For playground and development only. Not part of the stable public API. */
|
|
782
|
+
getDebugServices(): PixelRuntimeServices | null;
|
|
783
|
+
/** @internal For playground — força avaliação de engagement. */
|
|
784
|
+
evaluateEngagement(): void;
|
|
785
|
+
/** @internal For playground — publica sinal interno de comportamento. */
|
|
786
|
+
debugPublishBehaviorSignal(type: Parameters<BehaviorModule['debugPublishSignal']>[0], data?: Parameters<BehaviorModule['debugPublishSignal']>[1]): void;
|
|
787
|
+
/** @internal For playground — flush manual do behavior buffer. */
|
|
788
|
+
flushBehaviorBuffer(): void;
|
|
789
|
+
/** @internal For playground — emite BEHAVIOR_SESSION_SUMMARY manualmente. */
|
|
790
|
+
emitBehaviorSessionSummary(reason?: Parameters<BehaviorModule['emitSessionSummaryNow']>[0]): boolean;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
export { Pixel, PixelConfig, type PixelDebugSnapshot };
|