@beworke/pixel 0.1.0-rc.1 → 0.1.0-rc.10
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/CHANGELOG.md +303 -4
- package/README.md +90 -128
- package/RELEASE_CANDIDATE.md +218 -101
- package/dist/Pixel-BnN86r4X.d.ts +797 -0
- package/dist/Pixel-BoUGqCbP.d.mts +797 -0
- package/dist/{StorageFactory-CAkJJqVD.d.ts → StorageFactory-BfCArzMM.d.ts} +2 -2
- package/dist/{StorageFactory-BhpbB6Jj.d.mts → StorageFactory-C0prtNR7.d.mts} +2 -2
- package/dist/browser/index.cjs.js +3 -0
- package/dist/browser/index.cjs.js.map +1 -0
- package/dist/browser/index.d.mts +71 -0
- package/dist/browser/index.d.ts +71 -0
- package/dist/browser/index.esm.js +3 -0
- package/dist/browser/index.esm.js.map +1 -0
- package/dist/browser/pixel.buygoods-checkout.global.js +4 -0
- package/dist/browser/pixel.buygoods-checkout.global.js.map +1 -0
- package/dist/browser/pixel.buygoods-landing.global.js +4 -0
- package/dist/browser/pixel.buygoods-landing.global.js.map +1 -0
- package/dist/browser/pixel.global.js +4 -0
- package/dist/browser/pixel.global.js.map +1 -0
- package/dist/config/index.cjs.js +1 -1
- package/dist/config/index.cjs.js.map +1 -1
- package/dist/config/index.d.mts +16 -5
- package/dist/config/index.d.ts +16 -5
- package/dist/config/index.esm.js +1 -1
- package/dist/config/index.esm.js.map +1 -1
- package/dist/events/index.cjs.js +1 -1
- package/dist/events/index.cjs.js.map +1 -1
- package/dist/events/index.d.mts +2 -1
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.esm.js +1 -1
- package/dist/events/index.esm.js.map +1 -1
- package/dist/examples/html-script/README.md +21 -55
- package/dist/examples/html-script/RELEASE_CANDIDATE.md +39 -26
- package/dist/examples/html-script/add-payment-info/README.md +3 -3
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +107 -96
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +107 -96
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +106 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +114 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +106 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +97 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +106 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +106 -95
- package/dist/examples/html-script/add-to-cart/README.md +9 -6
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +133 -119
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +146 -130
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +144 -127
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +133 -119
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +590 -0
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +124 -116
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +133 -119
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +147 -130
- package/dist/examples/html-script/behavior/example-behavior-engagement.html +489 -0
- package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +350 -0
- package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +433 -0
- package/dist/examples/html-script/behavior/example-behavior-viewport.html +397 -0
- package/dist/examples/html-script/{example-behavior.html → behavior/example-behavior.html} +23 -17
- package/dist/examples/html-script/buygoods/example-buygoods-checkout.html +50 -0
- package/dist/examples/html-script/buygoods/ladding.html +184 -0
- package/dist/examples/html-script/example-basic.html +1 -1
- package/dist/examples/html-script/example-checkout-commerce.html +826 -0
- package/dist/examples/html-script/example-conversion.html +42 -49
- package/dist/examples/html-script/example-global-factory-classic.html +45 -0
- package/dist/examples/html-script/example-global-factory.html +40 -0
- package/dist/examples/html-script/example-integration.html +45 -51
- package/dist/examples/html-script/example-landing-commerce.html +416 -0
- package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
- package/dist/examples/html-script/example-transport.html +70 -63
- package/dist/examples/html-script/full-funnel/README.md +64 -0
- package/dist/examples/html-script/full-funnel/checkout.html +118 -0
- package/dist/examples/html-script/full-funnel/downsell.html +60 -0
- package/dist/examples/html-script/full-funnel/landing.html +153 -0
- package/dist/examples/html-script/full-funnel/thank-you.html +87 -0
- package/dist/examples/html-script/full-funnel/upsell.html +66 -0
- package/dist/examples/html-script/initiate-checkout/README.md +6 -6
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +135 -122
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +143 -128
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +144 -128
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +127 -120
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +136 -123
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +144 -131
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +146 -130
- package/dist/examples/html-script/internal-checkout/example-cardioclear-checkout.html +103 -0
- package/dist/examples/html-script/internal-checkout/example-slimsoda-checkout.html +103 -0
- package/dist/examples/html-script/lead/README.md +9 -7
- package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +107 -94
- package/dist/examples/html-script/lead/example-lead-trigger-auto.html +118 -103
- package/dist/examples/html-script/lead/example-lead-trigger-click.html +118 -102
- package/dist/examples/html-script/release-candidate.html +219 -107
- package/dist/examples/html-script/remove-from-cart/README.md +4 -4
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +134 -121
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +134 -121
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +141 -128
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +125 -118
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +135 -122
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +136 -123
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +139 -124
- package/dist/examples/html-script/search/README.md +1 -1
- package/dist/examples/html-script/search/example-search-attribute.html +107 -99
- package/dist/examples/html-script/search/example-search-button-sync.html +107 -99
- package/dist/examples/html-script/search/example-search-dedupe.html +107 -99
- package/dist/examples/html-script/search/example-search-input.html +108 -99
- package/dist/examples/html-script/search/example-search-manual.html +98 -96
- package/dist/examples/html-script/search/example-search-submit.html +107 -99
- package/dist/examples/html-script/search/example-search-text.html +112 -99
- package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +92 -0
- package/dist/examples/html-script/url-context/example-url-context-landing.html +110 -0
- package/dist/examples/html-script/url-context/example-url-context-upsell.html +105 -0
- package/dist/examples/html-script/url-context/example-url-context.html +205 -0
- package/dist/examples/html-script/view-content/README.md +1 -1
- package/dist/examples/html-script/view-content/example-view-content-attribute.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-css.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-dedupe.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-empty.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-manual.html +117 -115
- package/dist/examples/html-script/view-content/example-view-content-product-card.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-text.html +131 -121
- package/dist/examples/release-candidate/README.md +2 -1
- package/dist/examples/v2/README.md +16 -13
- package/dist/index-B8u_3PGG.d.ts +460 -0
- package/dist/index-BxT2d-TK.d.mts +460 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +23 -361
- package/dist/index.d.ts +23 -361
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/pixel-DNGbAN5C.d.ts +871 -0
- package/dist/pixel-_BSDpx4M.d.mts +871 -0
- package/dist/pixel-default-config-BMYaqs7i.d.ts +21 -0
- package/dist/pixel-default-config-DLRya1tl.d.mts +21 -0
- package/dist/pixel-settings-D-t9zQb4.d.ts +40 -0
- package/dist/pixel-settings-DGxl0MVm.d.mts +40 -0
- package/dist/runtime/index.cjs.js +1 -1
- package/dist/runtime/index.cjs.js.map +1 -1
- package/dist/runtime/index.d.mts +19 -26
- package/dist/runtime/index.d.ts +19 -26
- 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 +14 -6
- package/dist/services/index.d.ts +14 -6
- package/dist/services/index.esm.js +1 -1
- package/dist/services/index.esm.js.map +1 -1
- package/dist/types-B-Nzagpk.d.mts +19 -0
- package/dist/types-D0KVsgzs.d.mts +293 -0
- package/dist/types-D3kJ9bfT.d.ts +293 -0
- package/dist/types-Dfi9C49l.d.ts +19 -0
- package/dist/url-context-Ck2LK18V.d.mts +87 -0
- package/dist/url-context-Ck2LK18V.d.ts +87 -0
- 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 +26 -6
- package/dist/v2/index.d.ts +26 -6
- package/dist/v2/index.esm.js +1 -1
- package/dist/v2/index.esm.js.map +1 -1
- package/docs/public/README.md +80 -0
- package/docs/public/api/exports.md +55 -0
- package/docs/public/api/pixel.md +86 -0
- package/docs/public/configuration/commerce.md +44 -0
- package/docs/public/configuration/modules.md +63 -0
- package/docs/public/configuration/overview.md +85 -0
- package/docs/public/configuration/transport.md +127 -0
- package/docs/public/events/catalog.md +67 -0
- package/docs/public/getting-started/installation.md +87 -0
- package/docs/public/getting-started/quick-start.md +142 -0
- package/docs/public/getting-started/react-nextjs.md +78 -0
- package/docs/public/getting-started/script-tag.md +94 -0
- package/docs/public/guides/funnel-checkout.md +52 -0
- package/docs/public/guides/funnel-downsell.md +53 -0
- package/docs/public/guides/funnel-full.md +64 -0
- package/docs/public/guides/funnel-landing.md +70 -0
- package/docs/public/guides/funnel-thank-you.md +48 -0
- package/docs/public/guides/funnel-upsell.md +72 -0
- package/docs/public/limitations.md +33 -0
- package/docs/public/privacy/limitations.md +33 -0
- package/docs/public/release-candidate/validation.md +42 -0
- package/docs/public/troubleshooting.md +56 -0
- package/package.json +38 -20
- package/dist/index-DUfFzniE.d.mts +0 -274
- package/dist/index-DUfFzniE.d.ts +0 -274
- package/dist/pixel-CbeF25mD.d.mts +0 -555
- package/dist/pixel-CbeF25mD.d.ts +0 -555
- package/dist/pixel-default-config-1VgLFOiL.d.mts +0 -5
- package/dist/pixel-default-config-Bxb-Vdd8.d.ts +0 -5
- package/dist/types-CTpRvFKZ.d.ts +0 -71
- package/dist/types-DGlBdsAy.d.mts +0 -71
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
import { U as UrlContextConfig } from './url-context-Ck2LK18V.js';
|
|
2
|
+
|
|
3
|
+
type MetaBrowserDestinationConfig = {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
pixelIds: string[];
|
|
6
|
+
autoPageView: boolean;
|
|
7
|
+
loadScript: boolean;
|
|
8
|
+
};
|
|
9
|
+
type GoogleBrowserDestinationConfig = {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
tagIds: string[];
|
|
12
|
+
autoPageView: boolean;
|
|
13
|
+
loadScript: boolean;
|
|
14
|
+
};
|
|
15
|
+
type TikTokBrowserDestinationConfig = {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
pixelIds: string[];
|
|
18
|
+
autoPageView: boolean;
|
|
19
|
+
loadScript: boolean;
|
|
20
|
+
};
|
|
21
|
+
type IntegrationTestDestinationConfig = {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Integration Engine — browser destinations only (pageview externo).
|
|
26
|
+
* Attribution is independent (`config.attribution`).
|
|
27
|
+
* Conversões/CAPI/server-side pertencem ao backend.
|
|
28
|
+
*/
|
|
29
|
+
type IntegrationsModuleConfig = {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
debug: boolean;
|
|
32
|
+
concurrency: number;
|
|
33
|
+
timeoutMs: number;
|
|
34
|
+
continueOnError: boolean;
|
|
35
|
+
destinations: {
|
|
36
|
+
console: IntegrationTestDestinationConfig;
|
|
37
|
+
memory: IntegrationTestDestinationConfig;
|
|
38
|
+
mock: IntegrationTestDestinationConfig;
|
|
39
|
+
meta: MetaBrowserDestinationConfig;
|
|
40
|
+
google: GoogleBrowserDestinationConfig;
|
|
41
|
+
tiktok: TikTokBrowserDestinationConfig;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/** @deprecated use MetaBrowserDestinationConfig */
|
|
45
|
+
type MetaIntegrationConfig = MetaBrowserDestinationConfig;
|
|
46
|
+
/** @deprecated use GoogleBrowserDestinationConfig */
|
|
47
|
+
type GoogleIntegrationConfig = GoogleBrowserDestinationConfig;
|
|
48
|
+
|
|
49
|
+
/** Valores conhecidos — autocomplete. Qualquer outra string também é válida. */
|
|
50
|
+
type KnownPixelSource = 'pageus' | 'gomarke' | 'bemony' | 'custom';
|
|
51
|
+
type PixelSource = KnownPixelSource | (string & {});
|
|
52
|
+
type PixelTarget = 'landing' | 'checkout' | 'editor' | 'preview' | 'dashboard' | 'custom';
|
|
53
|
+
/** Checkout/vendor da página. Autocomplete para conhecidos; string livre ok. */
|
|
54
|
+
type KnownPixelPlatform = 'buygoods';
|
|
55
|
+
type PixelPlatform = KnownPixelPlatform | (string & {});
|
|
56
|
+
type PixelEnvironment = 'production' | 'staging' | 'development';
|
|
57
|
+
type AppConfig = {
|
|
58
|
+
source: PixelSource;
|
|
59
|
+
target: PixelTarget;
|
|
60
|
+
/** Vendor/plataforma do checkout ou da página. Default `''`. */
|
|
61
|
+
platform: PixelPlatform;
|
|
62
|
+
environment: PixelEnvironment;
|
|
63
|
+
debug: boolean;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
type IdentityConfig = {
|
|
67
|
+
readonly pixelId: string;
|
|
68
|
+
organizationId?: string;
|
|
69
|
+
workspaceId?: string;
|
|
70
|
+
projectId?: string;
|
|
71
|
+
pageId?: string;
|
|
72
|
+
funnelId?: string;
|
|
73
|
+
funnelStepId?: string;
|
|
74
|
+
offerId?: string;
|
|
75
|
+
checkoutId?: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type AttributionConfig = {
|
|
79
|
+
readonly enabled: boolean;
|
|
80
|
+
readonly ttlDays?: number;
|
|
81
|
+
readonly persist?: boolean;
|
|
82
|
+
readonly captureUrlParams?: boolean;
|
|
83
|
+
readonly captureCookies?: boolean;
|
|
84
|
+
readonly customClickIdParams?: string[];
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type TransportTestSenderConfig = {
|
|
88
|
+
mode: 'test';
|
|
89
|
+
capture?: boolean;
|
|
90
|
+
response?: 'success' | 'failure';
|
|
91
|
+
delayMs?: number;
|
|
92
|
+
};
|
|
93
|
+
type TransportInternalSenderConfig = {
|
|
94
|
+
mode: 'internal';
|
|
95
|
+
baseUrl?: string;
|
|
96
|
+
};
|
|
97
|
+
type TransportExternalSenderConfig = {
|
|
98
|
+
mode: 'external';
|
|
99
|
+
endpoints: {
|
|
100
|
+
event: string;
|
|
101
|
+
batch?: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Public browser-visible headers only. Backend secrets must be proxied by a
|
|
105
|
+
* trusted server and must never be embedded in browser configuration.
|
|
106
|
+
*/
|
|
107
|
+
headers?: Readonly<Record<string, string>>;
|
|
108
|
+
batchFallback?: 'single' | 'error';
|
|
109
|
+
};
|
|
110
|
+
type TransportSenderConfig = TransportTestSenderConfig | TransportInternalSenderConfig | TransportExternalSenderConfig;
|
|
111
|
+
type TransportPersistenceConfig = {
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
};
|
|
114
|
+
type TransportReplayConfig = {
|
|
115
|
+
enabled: boolean;
|
|
116
|
+
};
|
|
117
|
+
type TransportOrderingConfig = {
|
|
118
|
+
enabled: boolean;
|
|
119
|
+
};
|
|
120
|
+
type TransportCoordinationConfig = {
|
|
121
|
+
enabled: boolean;
|
|
122
|
+
};
|
|
123
|
+
type TransportCircuitBreakerConfig = {
|
|
124
|
+
enabled: boolean;
|
|
125
|
+
failureThreshold: number;
|
|
126
|
+
resetTimeoutMs: number;
|
|
127
|
+
halfOpenMaxAttempts: number;
|
|
128
|
+
};
|
|
129
|
+
type TransportBackpressurePolicy = 'drop_oldest' | 'drop_newest' | 'reject_new' | 'sample' | 'none';
|
|
130
|
+
type TransportBackpressureConfig = {
|
|
131
|
+
enabled: boolean;
|
|
132
|
+
maxQueueSize: number;
|
|
133
|
+
policy: TransportBackpressurePolicy;
|
|
134
|
+
sampleRate?: number;
|
|
135
|
+
};
|
|
136
|
+
type TransportDeadLetterConfig = {
|
|
137
|
+
enabled: boolean;
|
|
138
|
+
maxEntries: number;
|
|
139
|
+
};
|
|
140
|
+
type TransportCompressionConfig = {
|
|
141
|
+
enabled: boolean;
|
|
142
|
+
strategy: 'identity';
|
|
143
|
+
};
|
|
144
|
+
type TransportRetryConfig = {
|
|
145
|
+
enabled: boolean;
|
|
146
|
+
maxAttempts: number;
|
|
147
|
+
baseDelayMs: number;
|
|
148
|
+
maxDelayMs: number;
|
|
149
|
+
multiplier: number;
|
|
150
|
+
};
|
|
151
|
+
type TransportBatchConfig = {
|
|
152
|
+
enabled: boolean;
|
|
153
|
+
batchSize: number;
|
|
154
|
+
maxWaitMs: number;
|
|
155
|
+
};
|
|
156
|
+
type TransportTimeoutConfig = {
|
|
157
|
+
enabled: boolean;
|
|
158
|
+
timeoutMs: number;
|
|
159
|
+
};
|
|
160
|
+
type TransportOfflineConfig = {
|
|
161
|
+
enabled: boolean;
|
|
162
|
+
};
|
|
163
|
+
type TransportFlushConfig = {
|
|
164
|
+
enabled: boolean;
|
|
165
|
+
flushIntervalMs: number;
|
|
166
|
+
flushOnDestroy: boolean;
|
|
167
|
+
prepareUnloadHooks: boolean;
|
|
168
|
+
};
|
|
169
|
+
type TransportConfig = {
|
|
170
|
+
enabled: boolean;
|
|
171
|
+
sender: TransportSenderConfig;
|
|
172
|
+
persistence: TransportPersistenceConfig;
|
|
173
|
+
replay: TransportReplayConfig;
|
|
174
|
+
ordering: TransportOrderingConfig;
|
|
175
|
+
coordination: TransportCoordinationConfig;
|
|
176
|
+
circuitBreaker: TransportCircuitBreakerConfig;
|
|
177
|
+
backpressure: TransportBackpressureConfig;
|
|
178
|
+
deadLetter: TransportDeadLetterConfig;
|
|
179
|
+
compression: TransportCompressionConfig;
|
|
180
|
+
retry: TransportRetryConfig;
|
|
181
|
+
batch: TransportBatchConfig;
|
|
182
|
+
timeout: TransportTimeoutConfig;
|
|
183
|
+
offline: TransportOfflineConfig;
|
|
184
|
+
flush: TransportFlushConfig;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
type VisitorStoragePersistence = 'memory' | 'cookie' | 'localStorage' | 'cookie_localStorage';
|
|
188
|
+
type SessionStoragePersistence = 'memory' | 'sessionStorage' | 'localStorage';
|
|
189
|
+
type AttributionStoragePersistence = 'memory' | 'localStorage' | 'cookie' | 'cookie_localStorage';
|
|
190
|
+
type QueueStoragePersistence = 'memory' | 'localStorage' | 'indexedDB';
|
|
191
|
+
|
|
192
|
+
type StorageKeysConfig = {
|
|
193
|
+
visitor?: string;
|
|
194
|
+
session?: string;
|
|
195
|
+
queue?: string;
|
|
196
|
+
pendingEvents?: string;
|
|
197
|
+
heartbeat?: string;
|
|
198
|
+
fingerprint?: string;
|
|
199
|
+
attribution?: string;
|
|
200
|
+
custom?: Record<string, string>;
|
|
201
|
+
};
|
|
202
|
+
type StorageConfig = {
|
|
203
|
+
/**
|
|
204
|
+
* Identificador lógico do pixel para composição de chaves de storage.
|
|
205
|
+
* Ex.: `"bemony-checkout"` → `__gmk:bemony-checkout:vid`
|
|
206
|
+
*/
|
|
207
|
+
namespace: string;
|
|
208
|
+
/**
|
|
209
|
+
* Prefixo global das chaves de storage.
|
|
210
|
+
* Ex.: `"__gmk"` → `__gmk:bemony-checkout:vid`
|
|
211
|
+
*/
|
|
212
|
+
prefix?: string;
|
|
213
|
+
persistence?: {
|
|
214
|
+
visitor?: VisitorStoragePersistence;
|
|
215
|
+
session?: SessionStoragePersistence;
|
|
216
|
+
attribution?: AttributionStoragePersistence;
|
|
217
|
+
};
|
|
218
|
+
queue?: {
|
|
219
|
+
enabled: boolean;
|
|
220
|
+
persistence: QueueStoragePersistence;
|
|
221
|
+
index?: boolean;
|
|
222
|
+
};
|
|
223
|
+
keys?: StorageKeysConfig;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
type FingerprintMode = 'light' | 'full';
|
|
227
|
+
|
|
228
|
+
type PaymentMethod = 'CREDIT_CARD' | 'PIX' | 'BANK_SLIP';
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Tipo padrão/fallback para interpretar selectors string sem prefixo.
|
|
232
|
+
*
|
|
233
|
+
* Ordem de resolução (`SelectorResolver`):
|
|
234
|
+
* 1. Objeto → selector.type
|
|
235
|
+
* 2. String com prefixo (css:, id:, class:, attr:, attribute:, text:) → prefixo
|
|
236
|
+
* 3. String sem prefixo → selectorType
|
|
237
|
+
* 4. Sem selectorType → css (DEFAULT_SELECTOR_TYPE)
|
|
238
|
+
*/
|
|
239
|
+
type SelectorType = 'css' | 'id' | 'class' | 'attribute' | 'text';
|
|
240
|
+
/** Fallback quando `selectorType` é omitido. */
|
|
241
|
+
declare const DEFAULT_SELECTOR_TYPE: SelectorType;
|
|
242
|
+
/**
|
|
243
|
+
* Forma avançada de um seletor individual.
|
|
244
|
+
* `exact` / `caseSensitive` aplicam-se principalmente a `type: 'text'`.
|
|
245
|
+
* `closest` restringe a busca a um ancestral CSS (resolvido na etapa do Resolver).
|
|
246
|
+
*/
|
|
247
|
+
type SelectorDescriptor = {
|
|
248
|
+
type: SelectorType;
|
|
249
|
+
value: string;
|
|
250
|
+
exact?: boolean;
|
|
251
|
+
caseSensitive?: boolean;
|
|
252
|
+
closest?: string;
|
|
253
|
+
};
|
|
254
|
+
/** Um seletor: string simples/prefixada ou descritor tipado. */
|
|
255
|
+
type SelectorInput = string | SelectorDescriptor;
|
|
256
|
+
/** Um ou vários seletores (OR — qualquer match dispara). */
|
|
257
|
+
type SelectorConfig = SelectorInput | SelectorInput[];
|
|
258
|
+
/**
|
|
259
|
+
* Extrai o valor primário de um `SelectorConfig` (utilitário de config).
|
|
260
|
+
* Para match/query no DOM, use `SelectorResolver`.
|
|
261
|
+
*/
|
|
262
|
+
declare function getPrimarySelectorValue(selector: SelectorConfig | undefined): string | null;
|
|
263
|
+
/**
|
|
264
|
+
* Resolve o `selectorType` efetivo: config explícita → tipo do descriptor → css.
|
|
265
|
+
*/
|
|
266
|
+
declare function resolveSelectorTypeFallback(selector: SelectorConfig | undefined, selectorType?: SelectorType): SelectorType;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Condição de formulário para liberar o disparo de um evento auto.
|
|
270
|
+
* Não representa dados de produto — apenas campos/triggers necessários.
|
|
271
|
+
*/
|
|
272
|
+
type SelectorFormTrigger = 'input' | 'change' | 'submit' | 'click' | 'auto';
|
|
273
|
+
type SelectorFormMode = 'all' | 'any';
|
|
274
|
+
type SelectorFormConfig = string[] | {
|
|
275
|
+
fields: string[];
|
|
276
|
+
mode?: SelectorFormMode;
|
|
277
|
+
minRequired?: number;
|
|
278
|
+
formSelector?: string;
|
|
279
|
+
trigger?: SelectorFormTrigger;
|
|
280
|
+
debounceMs?: number;
|
|
281
|
+
fireOnce?: boolean;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Contrato de fontes independentes para auto detectors (Etapa 14+).
|
|
286
|
+
* Um evento automático pode ter várias sources; cada uma vira um detector.
|
|
287
|
+
*
|
|
288
|
+
* A source `url` observa a URL da página (`window.location`) / rotas.
|
|
289
|
+
* A source `link` observa o destino de um `<a href>` clicado.
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
type AutoSourceType = 'selector' | 'form' | 'payment' | 'lifecycle' | 'url' | 'link';
|
|
293
|
+
type AutoSourceBase = {
|
|
294
|
+
/** Nome estável da source (obrigatório). */
|
|
295
|
+
name: string;
|
|
296
|
+
type: AutoSourceType;
|
|
297
|
+
enabled?: boolean;
|
|
298
|
+
fireOnce?: boolean;
|
|
299
|
+
debounceMs?: number;
|
|
300
|
+
cooldownMs?: number;
|
|
301
|
+
};
|
|
302
|
+
type SelectorAutoTrigger = 'click' | 'submit' | 'hover' | 'visible';
|
|
303
|
+
type SelectorAutoSource = AutoSourceBase & {
|
|
304
|
+
type: 'selector';
|
|
305
|
+
selector: SelectorConfig;
|
|
306
|
+
selectorType?: SelectorType;
|
|
307
|
+
trigger?: SelectorAutoTrigger;
|
|
308
|
+
/**
|
|
309
|
+
* Só para `trigger: 'visible'`. Fração visível 0–1.
|
|
310
|
+
* Default `0` (qualquer parte na viewport).
|
|
311
|
+
*/
|
|
312
|
+
visibleThreshold?: number;
|
|
313
|
+
};
|
|
314
|
+
type FormAutoSource = AutoSourceBase & {
|
|
315
|
+
type: 'form';
|
|
316
|
+
selectorForm: SelectorFormConfig;
|
|
317
|
+
/** Opcional: restringe a fonte form a um target específico. */
|
|
318
|
+
selector?: SelectorConfig;
|
|
319
|
+
selectorType?: SelectorType;
|
|
320
|
+
};
|
|
321
|
+
type PaymentAutoSource = AutoSourceBase & {
|
|
322
|
+
type: 'payment';
|
|
323
|
+
paymentMethod?: PaymentMethod | (string & {});
|
|
324
|
+
cardDetection?: boolean;
|
|
325
|
+
autoDispatch?: boolean;
|
|
326
|
+
formSelector?: string;
|
|
327
|
+
};
|
|
328
|
+
type LifecycleAutoSource = AutoSourceBase & {
|
|
329
|
+
type: 'lifecycle';
|
|
330
|
+
trigger: 'init' | 'ready';
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Observa a URL da página atual (location / history).
|
|
334
|
+
* Não confundir com `LinkAutoSource` (destino de um clique em âncora).
|
|
335
|
+
*/
|
|
336
|
+
type UrlAutoSource = AutoSourceBase & {
|
|
337
|
+
type: 'url';
|
|
338
|
+
patterns: string[];
|
|
339
|
+
};
|
|
340
|
+
/** Protocols HTTP suportados pelo matcher de links. */
|
|
341
|
+
type LinkMatchProtocol = 'http:' | 'https:';
|
|
342
|
+
/**
|
|
343
|
+
* Condição de query string para match de destino.
|
|
344
|
+
* Sem regex arbitrária / callbacks.
|
|
345
|
+
*/
|
|
346
|
+
type LinkQueryCondition = {
|
|
347
|
+
key: string;
|
|
348
|
+
operator: 'exists' | 'absent';
|
|
349
|
+
} | {
|
|
350
|
+
key: string;
|
|
351
|
+
operator: 'equals' | 'starts_with';
|
|
352
|
+
value: string;
|
|
353
|
+
caseSensitive?: boolean;
|
|
354
|
+
} | {
|
|
355
|
+
key: string;
|
|
356
|
+
operator: 'one_of';
|
|
357
|
+
value: string[];
|
|
358
|
+
caseSensitive?: boolean;
|
|
359
|
+
};
|
|
360
|
+
type LinkQueryMatch = {
|
|
361
|
+
/** Default: `all`. */
|
|
362
|
+
mode?: 'all' | 'any';
|
|
363
|
+
conditions: LinkQueryCondition[];
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Regras para reconhecer o destino do link (AND entre grupos configurados).
|
|
367
|
+
* Arrays dentro de um grupo usam OR.
|
|
368
|
+
*/
|
|
369
|
+
type LinkTargetMatch = {
|
|
370
|
+
protocols?: LinkMatchProtocol[];
|
|
371
|
+
/** Origins absolutas normalizadas (sem `/` final), ex.: `https://checkout.example.com`. */
|
|
372
|
+
origins?: string[];
|
|
373
|
+
/** Hostnames em lowercase, ex.: `checkout.example.com`. */
|
|
374
|
+
hostnames?: string[];
|
|
375
|
+
path?: {
|
|
376
|
+
exact?: string[];
|
|
377
|
+
prefixes?: string[];
|
|
378
|
+
/**
|
|
379
|
+
* Prefixo de **segmento** do path (não do pathname inteiro).
|
|
380
|
+
* Ex.: `pri` casa `/pri6670988`, `/pri_123` e `/examples/security/pri6670988.html`,
|
|
381
|
+
* mas não `/privacy` (próximo char precisa ser dígito ou `_`+dígito).
|
|
382
|
+
*/
|
|
383
|
+
segmentPrefixes?: string[];
|
|
384
|
+
/**
|
|
385
|
+
* Template simples: `/pay/:offerId`.
|
|
386
|
+
* `:param` captura um segmento; literais devem casar exatamente.
|
|
387
|
+
*/
|
|
388
|
+
template?: string;
|
|
389
|
+
};
|
|
390
|
+
query?: LinkQueryMatch;
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* Origem de um valor resolvido a partir do link / elemento.
|
|
394
|
+
*/
|
|
395
|
+
type LinkValueResolver = {
|
|
396
|
+
source: 'query';
|
|
397
|
+
key: string;
|
|
398
|
+
} | {
|
|
399
|
+
source: 'pathParam';
|
|
400
|
+
key: string;
|
|
401
|
+
} | {
|
|
402
|
+
source: 'pathSegment';
|
|
403
|
+
/**
|
|
404
|
+
* Índice do segmento (0 = primeiro).
|
|
405
|
+
* Índice negativo conta do fim (`-1` = último segmento).
|
|
406
|
+
*/
|
|
407
|
+
index: number;
|
|
408
|
+
} | {
|
|
409
|
+
source: 'attribute';
|
|
410
|
+
name: string;
|
|
411
|
+
} | {
|
|
412
|
+
source: 'dataset';
|
|
413
|
+
/** Chave camelCase do `dataset` (`data-product-id` → `productId`). */
|
|
414
|
+
key: string;
|
|
415
|
+
} | {
|
|
416
|
+
source: 'static';
|
|
417
|
+
value: string | number | boolean | null;
|
|
418
|
+
} | {
|
|
419
|
+
source: 'href' | 'origin' | 'hostname' | 'pathname' | 'text';
|
|
420
|
+
};
|
|
421
|
+
type LinkValueTransform = 'trim' | 'lowercase' | 'uppercase' | 'number';
|
|
422
|
+
type LinkValueBinding = {
|
|
423
|
+
from: LinkValueResolver | LinkValueResolver[];
|
|
424
|
+
required?: boolean;
|
|
425
|
+
transform?: LinkValueTransform;
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Source automática baseada no destino de um link clicado.
|
|
429
|
+
*
|
|
430
|
+
* `match` decide se o destino corresponde.
|
|
431
|
+
* `bindings` resolve valores genéricos (incluindo chaves semânticas
|
|
432
|
+
* como `productId` reconhecidas pelo mapper do evento).
|
|
433
|
+
*/
|
|
434
|
+
type LinkAutoSource = AutoSourceBase & {
|
|
435
|
+
type: 'link';
|
|
436
|
+
/** Somente click nesta etapa. Default: `click`. */
|
|
437
|
+
trigger?: 'click';
|
|
438
|
+
/**
|
|
439
|
+
* Restrição opcional sobre o elemento.
|
|
440
|
+
* Sem selector, usa o `<a href>` ancestral mais próximo do clique.
|
|
441
|
+
*/
|
|
442
|
+
selector?: SelectorConfig;
|
|
443
|
+
selectorType?: SelectorType;
|
|
444
|
+
/** Regras de reconhecimento do destino. */
|
|
445
|
+
match: LinkTargetMatch;
|
|
446
|
+
/**
|
|
447
|
+
* Valores extraídos do link / elemento / configuração.
|
|
448
|
+
* Chaves são genéricas; o mapper do evento reconhece semântica
|
|
449
|
+
* opcional (`productId`, `query`, etc.).
|
|
450
|
+
*/
|
|
451
|
+
bindings?: Record<string, LinkValueBinding>;
|
|
452
|
+
};
|
|
453
|
+
type AutoTrackSource = SelectorAutoSource | FormAutoSource | PaymentAutoSource | LifecycleAutoSource | UrlAutoSource | LinkAutoSource;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Contratos globais de commerce (root `PixelConfig.commerce`).
|
|
457
|
+
* Não pertencem a conversion — representam o contexto comercial da página/fluxo.
|
|
458
|
+
*/
|
|
459
|
+
type ProductType = 'main' | 'order_bump' | 'upsell' | 'downsell' | 'cross_sell' | 'addon' | 'subscription' | 'custom' | 'other';
|
|
460
|
+
type CommerceProduct = {
|
|
461
|
+
id: string;
|
|
462
|
+
name?: string;
|
|
463
|
+
sku?: string;
|
|
464
|
+
type?: ProductType;
|
|
465
|
+
price?: number;
|
|
466
|
+
currency?: string;
|
|
467
|
+
quantity?: number;
|
|
468
|
+
category?: string;
|
|
469
|
+
variant?: string;
|
|
470
|
+
brand?: string;
|
|
471
|
+
metadata?: Record<string, unknown>;
|
|
472
|
+
};
|
|
473
|
+
type CommerceCartItem = {
|
|
474
|
+
productId: string;
|
|
475
|
+
quantity?: number;
|
|
476
|
+
price?: number;
|
|
477
|
+
currency?: string;
|
|
478
|
+
selected?: boolean;
|
|
479
|
+
metadata?: Record<string, unknown>;
|
|
480
|
+
};
|
|
481
|
+
type CommerceCartMode = 'landing_page' | 'single_product' | 'multi_product' | 'checkout' | 'upsell' | 'custom' | 'cart' | 'funnel';
|
|
482
|
+
type CommerceCalculateValueFrom = 'cart' | 'event' | 'manual' | 'catalog';
|
|
483
|
+
type CommerceEnrichmentSource = 'cart' | 'event' | 'event_or_cart' | 'catalog';
|
|
484
|
+
type CommerceEventEnrichmentConfig = {
|
|
485
|
+
enabled: boolean;
|
|
486
|
+
source?: CommerceEnrichmentSource;
|
|
487
|
+
};
|
|
488
|
+
type CommerceEnrichmentConfig = {
|
|
489
|
+
pageView?: CommerceEventEnrichmentConfig;
|
|
490
|
+
viewContent?: CommerceEventEnrichmentConfig;
|
|
491
|
+
lead?: CommerceEventEnrichmentConfig;
|
|
492
|
+
addToCart?: CommerceEventEnrichmentConfig;
|
|
493
|
+
removeFromCart?: CommerceEventEnrichmentConfig;
|
|
494
|
+
initiateCheckout?: CommerceEventEnrichmentConfig;
|
|
495
|
+
addPaymentInfo?: CommerceEventEnrichmentConfig;
|
|
496
|
+
purchase?: CommerceEventEnrichmentConfig;
|
|
497
|
+
};
|
|
498
|
+
type ProductCatalogConfig = {
|
|
499
|
+
products?: CommerceProduct[];
|
|
500
|
+
};
|
|
501
|
+
type CommerceCartConfig = {
|
|
502
|
+
mode?: CommerceCartMode;
|
|
503
|
+
/** Seed inicial do carrinho — não é estado vivo. */
|
|
504
|
+
initialItems?: CommerceCartItem[];
|
|
505
|
+
allowDynamicItems?: boolean;
|
|
506
|
+
calculateValueFrom?: CommerceCalculateValueFrom;
|
|
507
|
+
metadata?: Record<string, unknown>;
|
|
508
|
+
};
|
|
509
|
+
type CommerceMappingsConfig = {
|
|
510
|
+
attributes?: Record<string, string[]>;
|
|
511
|
+
fields?: Record<string, string[]>;
|
|
512
|
+
};
|
|
513
|
+
type CommerceConfig = {
|
|
514
|
+
enabled?: boolean;
|
|
515
|
+
currency?: string;
|
|
516
|
+
catalog?: ProductCatalogConfig;
|
|
517
|
+
cart?: CommerceCartConfig;
|
|
518
|
+
mappings?: CommerceMappingsConfig;
|
|
519
|
+
enrichment?: CommerceEnrichmentConfig;
|
|
520
|
+
};
|
|
521
|
+
declare const DEFAULT_COMMERCE_ENRICHMENT: Required<CommerceEnrichmentConfig>;
|
|
522
|
+
/**
|
|
523
|
+
* Commerce on by default so catalog/cart enrichment runs when products exist.
|
|
524
|
+
* Empty catalog / empty cart is a no-op.
|
|
525
|
+
*/
|
|
526
|
+
declare const DEFAULT_COMMERCE_CONFIG: CommerceConfig;
|
|
527
|
+
/** Normaliza calculateValueFrom (inclui aliases legado em runtime). */
|
|
528
|
+
declare function normalizeCalculateValueFrom(value: CommerceCalculateValueFrom | string | undefined): 'cart' | 'event' | 'manual' | 'catalog';
|
|
529
|
+
|
|
530
|
+
/** Limites de nível do Engagement Runtime (Etapa 19). */
|
|
531
|
+
type EngagementThresholds = {
|
|
532
|
+
/** Score máximo (inclusive) do nível `low`. */
|
|
533
|
+
lowMax: number;
|
|
534
|
+
/** Score máximo (inclusive) do nível `medium`. */
|
|
535
|
+
mediumMax: number;
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
/** Pesos positivos do Engagement Runtime (Etapa 19). */
|
|
539
|
+
type EngagementWeights = {
|
|
540
|
+
activeTime: number;
|
|
541
|
+
scroll: number;
|
|
542
|
+
click: number;
|
|
543
|
+
viewport: number;
|
|
544
|
+
visibility: number;
|
|
545
|
+
heartbeat: number;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
/** Penalidades do Engagement Runtime (Etapa 19). */
|
|
549
|
+
type EngagementPenalties = {
|
|
550
|
+
/** Penalidade proporcional ao tempo ocioso (0..1). */
|
|
551
|
+
idle: number;
|
|
552
|
+
/** Penalidade proporcional a rage clicks (0..1). */
|
|
553
|
+
rageClick: number;
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
type ScrollBehaviorConfig = {
|
|
557
|
+
enabled: boolean;
|
|
558
|
+
thresholds: number[];
|
|
559
|
+
debounceMs: number;
|
|
560
|
+
};
|
|
561
|
+
type ClickBehaviorConfig = {
|
|
562
|
+
enabled: boolean;
|
|
563
|
+
rageClick: {
|
|
564
|
+
enabled: boolean;
|
|
565
|
+
threshold: number;
|
|
566
|
+
windowMs: number;
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
type IdleBehaviorConfig = {
|
|
570
|
+
enabled: boolean;
|
|
571
|
+
thresholdMs: number;
|
|
572
|
+
};
|
|
573
|
+
type VisibilityBehaviorConfig = {
|
|
574
|
+
enabled: boolean;
|
|
575
|
+
};
|
|
576
|
+
type ExitIntentBehaviorConfig = {
|
|
577
|
+
enabled: boolean;
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* Alvo observado pelo ViewportTracker (Etapa 18).
|
|
581
|
+
* `key` deve ser único dentro de `targets`.
|
|
582
|
+
*/
|
|
583
|
+
type ViewportTargetConfig = {
|
|
584
|
+
readonly key: string;
|
|
585
|
+
/** Seletor CSS oficial. */
|
|
586
|
+
readonly selector: string;
|
|
587
|
+
/** Ratio mínimo para confirmar entrada (0..1). Default 0.5. */
|
|
588
|
+
readonly enterThreshold?: number;
|
|
589
|
+
/** Ratio no qual sai (0..enterThreshold). Default 0. */
|
|
590
|
+
readonly exitThreshold?: number;
|
|
591
|
+
/** Tempo mínimo contínuo acima do enterThreshold. Default 0. */
|
|
592
|
+
readonly minVisibleMs?: number;
|
|
593
|
+
/** Emite VIEWPORT_EXIT após entrada. Default true. */
|
|
594
|
+
readonly trackExit?: boolean;
|
|
595
|
+
/** Um único ciclo válido por elemento. Default false. */
|
|
596
|
+
readonly once?: boolean;
|
|
597
|
+
/** Inclui descritor sanitizado do elemento. Default false. */
|
|
598
|
+
readonly includeElement?: boolean;
|
|
599
|
+
};
|
|
600
|
+
/**
|
|
601
|
+
* Viewport Tracker — contrato oficial em `trackers.viewport`.
|
|
602
|
+
*/
|
|
603
|
+
type ViewportBehaviorConfig = {
|
|
604
|
+
readonly enabled: boolean;
|
|
605
|
+
readonly targets: readonly ViewportTargetConfig[];
|
|
606
|
+
readonly rootMargin: string;
|
|
607
|
+
readonly observeMutations: boolean;
|
|
608
|
+
readonly mutationDebounceMs: number;
|
|
609
|
+
readonly maxObservedElements: number;
|
|
610
|
+
};
|
|
611
|
+
/**
|
|
612
|
+
* Heartbeat Runtime Engine (único contrato oficial).
|
|
613
|
+
* Não faz parte de `trackers`.
|
|
614
|
+
*/
|
|
615
|
+
type HeartbeatModuleConfig = {
|
|
616
|
+
enabled: boolean;
|
|
617
|
+
intervalMs: number;
|
|
618
|
+
hiddenIntervalMs: number;
|
|
619
|
+
emitWhenHidden: boolean;
|
|
620
|
+
emitWhenIdle: boolean;
|
|
621
|
+
includeSnapshot: boolean;
|
|
622
|
+
fireImmediately: boolean;
|
|
623
|
+
minActivityWindowMs?: number;
|
|
624
|
+
};
|
|
625
|
+
/**
|
|
626
|
+
* Engagement Runtime Engine (Etapa 19) — contrato oficial em
|
|
627
|
+
* `modules.behavior.engagement`. Não faz parte de `trackers`.
|
|
628
|
+
*/
|
|
629
|
+
type EngagementBehaviorConfig = {
|
|
630
|
+
enabled: boolean;
|
|
631
|
+
/** Intervalo de avaliação periódica via ManagedScheduler. */
|
|
632
|
+
evaluationIntervalMs: number;
|
|
633
|
+
/** Emite ENGAGEMENT_UPDATE apenas quando o score muda o suficiente. */
|
|
634
|
+
emitOnChange: boolean;
|
|
635
|
+
/** Delta mínimo de score para emitir um novo ENGAGEMENT_UPDATE. */
|
|
636
|
+
minScoreDelta: number;
|
|
637
|
+
/** Emite ENGAGEMENT_SUMMARY (uma vez) no destroy. */
|
|
638
|
+
emitSummaryOnDestroy: boolean;
|
|
639
|
+
weights: EngagementWeights;
|
|
640
|
+
penalties: EngagementPenalties;
|
|
641
|
+
thresholds: EngagementThresholds;
|
|
642
|
+
};
|
|
643
|
+
/**
|
|
644
|
+
* Behavior Rate Limiter (Etapa 20) — limitador interno por instância.
|
|
645
|
+
* Protege o runtime de bursts de sinais; não é rate limit de Transport.
|
|
646
|
+
*/
|
|
647
|
+
type RateLimitBehaviorConfig = {
|
|
648
|
+
enabled: boolean;
|
|
649
|
+
/** Janela deslizante (ms). */
|
|
650
|
+
windowMs: number;
|
|
651
|
+
/** Máximo de sinais aceitos por janela. */
|
|
652
|
+
maxSignalsPerWindow: number;
|
|
653
|
+
/** Sinais críticos (IDLE/ACTIVITY/VISIBLE/HIDDEN/EXIT_INTENT) ignoram o limite. */
|
|
654
|
+
criticalBypass: boolean;
|
|
655
|
+
};
|
|
656
|
+
/** Estratégia de descarte quando o buffer atinge `maxSize`. */
|
|
657
|
+
type BufferDropStrategy = 'drop_oldest' | 'drop_newest' | 'compress_similar';
|
|
658
|
+
/**
|
|
659
|
+
* Behavior Buffer (Etapa 20) — agregação interna de sinais normalizados.
|
|
660
|
+
* NÃO é a Transport Queue: sem persistência, retry, batch HTTP ou sendBeacon.
|
|
661
|
+
*/
|
|
662
|
+
type BufferBehaviorConfig = {
|
|
663
|
+
enabled: boolean;
|
|
664
|
+
/** Capacidade máxima de entries antes de aplicar a drop strategy. */
|
|
665
|
+
maxSize: number;
|
|
666
|
+
/** Idade máxima (ms) de um entry antes do flush por idade (0 = desabilitado). */
|
|
667
|
+
maxAgeMs: number;
|
|
668
|
+
/** Tamanho que dispara flush por tamanho. */
|
|
669
|
+
flushSize: number;
|
|
670
|
+
dropStrategy: BufferDropStrategy;
|
|
671
|
+
/** Flush automático quando a página fica hidden. */
|
|
672
|
+
flushOnHidden: boolean;
|
|
673
|
+
};
|
|
674
|
+
/**
|
|
675
|
+
* Behavior State Machine (Etapa 20) — estado do runtime por instância.
|
|
676
|
+
*/
|
|
677
|
+
type StateMachineBehaviorConfig = {
|
|
678
|
+
enabled: boolean;
|
|
679
|
+
/** Tamanho máximo do histórico de transições retido. */
|
|
680
|
+
historyLimit: number;
|
|
681
|
+
};
|
|
682
|
+
/**
|
|
683
|
+
* Behavior Session Summary (Etapa 20) — resumo consolidado da sessão.
|
|
684
|
+
*/
|
|
685
|
+
type SessionSummaryBehaviorConfig = {
|
|
686
|
+
enabled: boolean;
|
|
687
|
+
/** Emite BEHAVIOR_SESSION_SUMMARY quando a página fica hidden. */
|
|
688
|
+
emitOnHidden: boolean;
|
|
689
|
+
/** Emite BEHAVIOR_SESSION_SUMMARY no destroy. */
|
|
690
|
+
emitOnDestroy: boolean;
|
|
691
|
+
/** Duração mínima da sessão (ms) para emitir o summary. */
|
|
692
|
+
minimumSessionMs: number;
|
|
693
|
+
};
|
|
694
|
+
type BehaviorModuleConfig = {
|
|
695
|
+
enabled: boolean;
|
|
696
|
+
heartbeat: HeartbeatModuleConfig;
|
|
697
|
+
engagement: EngagementBehaviorConfig;
|
|
698
|
+
rateLimit: RateLimitBehaviorConfig;
|
|
699
|
+
buffer: BufferBehaviorConfig;
|
|
700
|
+
stateMachine: StateMachineBehaviorConfig;
|
|
701
|
+
sessionSummary: SessionSummaryBehaviorConfig;
|
|
702
|
+
trackers: {
|
|
703
|
+
scroll: ScrollBehaviorConfig;
|
|
704
|
+
click: ClickBehaviorConfig;
|
|
705
|
+
idle: IdleBehaviorConfig;
|
|
706
|
+
visibility: VisibilityBehaviorConfig;
|
|
707
|
+
exitIntent: ExitIntentBehaviorConfig;
|
|
708
|
+
viewport: ViewportBehaviorConfig;
|
|
709
|
+
};
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
type ManualEventConfig = {
|
|
713
|
+
enabled: boolean;
|
|
714
|
+
};
|
|
715
|
+
type ManualConversionConfig = {
|
|
716
|
+
pageView: ManualEventConfig;
|
|
717
|
+
purchase: ManualEventConfig;
|
|
718
|
+
lead: ManualEventConfig;
|
|
719
|
+
addToCart: ManualEventConfig;
|
|
720
|
+
removeFromCart: ManualEventConfig;
|
|
721
|
+
initiateCheckout: ManualEventConfig;
|
|
722
|
+
addPaymentInfo: ManualEventConfig;
|
|
723
|
+
search: ManualEventConfig;
|
|
724
|
+
viewContent: ManualEventConfig;
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* Config de um auto detector — fontes independentes em `sources[]`.
|
|
728
|
+
*/
|
|
729
|
+
type AutoDetectorConfig = {
|
|
730
|
+
enabled: boolean;
|
|
731
|
+
sources: AutoTrackSource[];
|
|
732
|
+
};
|
|
733
|
+
type LeadAutoDetectorConfig = AutoDetectorConfig;
|
|
734
|
+
type AddToCartAutoDetectorConfig = AutoDetectorConfig;
|
|
735
|
+
type InitiateCheckoutAutoDetectorConfig = AutoDetectorConfig;
|
|
736
|
+
type PurchaseAutoDetectorConfig = AutoDetectorConfig;
|
|
737
|
+
type RemoveFromCartAutoDetectorConfig = AutoDetectorConfig;
|
|
738
|
+
type SearchAutoDetectorConfig = AutoDetectorConfig;
|
|
739
|
+
type ViewContentAutoDetectorConfig = AutoDetectorConfig;
|
|
740
|
+
type AddPaymentInfoAutoDetectorConfig = AutoDetectorConfig;
|
|
741
|
+
type ConversionAutoDetectorsConfig = {
|
|
742
|
+
lead: AutoDetectorConfig;
|
|
743
|
+
addToCart: AutoDetectorConfig;
|
|
744
|
+
removeFromCart: AutoDetectorConfig;
|
|
745
|
+
initiateCheckout: AutoDetectorConfig;
|
|
746
|
+
purchase: AutoDetectorConfig;
|
|
747
|
+
addPaymentInfo: AutoDetectorConfig;
|
|
748
|
+
search: AutoDetectorConfig;
|
|
749
|
+
viewContent: AutoDetectorConfig;
|
|
750
|
+
};
|
|
751
|
+
type AutoConversionConfig = {
|
|
752
|
+
enabled: boolean;
|
|
753
|
+
detectors: ConversionAutoDetectorsConfig;
|
|
754
|
+
};
|
|
755
|
+
type ConversionRulesConfig = {
|
|
756
|
+
enabled: boolean;
|
|
757
|
+
selectors: string[];
|
|
758
|
+
texts: string[];
|
|
759
|
+
urlPatterns: string[];
|
|
760
|
+
checkout: {
|
|
761
|
+
enabled: boolean;
|
|
762
|
+
};
|
|
763
|
+
card: {
|
|
764
|
+
enabled: boolean;
|
|
765
|
+
};
|
|
766
|
+
};
|
|
767
|
+
/**
|
|
768
|
+
* Config do módulo de conversion.
|
|
769
|
+
* Commerce é root (`PixelConfig.commerce`) — não vive aqui.
|
|
770
|
+
*/
|
|
771
|
+
type ConversionModuleConfig = {
|
|
772
|
+
enabled: boolean;
|
|
773
|
+
manual: ManualConversionConfig;
|
|
774
|
+
auto: AutoConversionConfig;
|
|
775
|
+
rules: ConversionRulesConfig;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
type PageViewConfig = {
|
|
779
|
+
enabled: boolean;
|
|
780
|
+
trackInitialPageView: boolean;
|
|
781
|
+
spa: boolean;
|
|
782
|
+
dedupeMs: number;
|
|
783
|
+
};
|
|
784
|
+
type VisitorConfig = {
|
|
785
|
+
enabled: boolean;
|
|
786
|
+
persistence: VisitorStoragePersistence;
|
|
787
|
+
renew: boolean;
|
|
788
|
+
};
|
|
789
|
+
type SessionConfig = {
|
|
790
|
+
enabled: boolean;
|
|
791
|
+
ttlMs: number;
|
|
792
|
+
renewOnActivity: boolean;
|
|
793
|
+
renewOnPageView: boolean;
|
|
794
|
+
};
|
|
795
|
+
type FingerprintConfig = {
|
|
796
|
+
enabled: boolean;
|
|
797
|
+
mode: FingerprintMode;
|
|
798
|
+
cache: boolean;
|
|
799
|
+
};
|
|
800
|
+
type ConsentConfig = {
|
|
801
|
+
enabled: boolean;
|
|
802
|
+
required: boolean;
|
|
803
|
+
waitForConsent: boolean;
|
|
804
|
+
};
|
|
805
|
+
type DedupeConfig = {
|
|
806
|
+
enabled: boolean;
|
|
807
|
+
windowMs: number;
|
|
808
|
+
};
|
|
809
|
+
type CoordinationConfig = {
|
|
810
|
+
enabled: boolean;
|
|
811
|
+
leaderElection: boolean;
|
|
812
|
+
broadcastChannel: boolean;
|
|
813
|
+
};
|
|
814
|
+
type OrderingConfig = {
|
|
815
|
+
enabled: boolean;
|
|
816
|
+
preserveOrder: boolean;
|
|
817
|
+
};
|
|
818
|
+
type CoreModuleConfig = {
|
|
819
|
+
enabled: boolean;
|
|
820
|
+
pageView: PageViewConfig;
|
|
821
|
+
visitor: VisitorConfig;
|
|
822
|
+
session: SessionConfig;
|
|
823
|
+
fingerprint: FingerprintConfig;
|
|
824
|
+
consent: ConsentConfig;
|
|
825
|
+
dedupe: DedupeConfig;
|
|
826
|
+
coordination: CoordinationConfig;
|
|
827
|
+
ordering: OrderingConfig;
|
|
828
|
+
/** Core UrlContext — off por default. */
|
|
829
|
+
urlContext?: UrlContextConfig;
|
|
830
|
+
};
|
|
831
|
+
|
|
832
|
+
type PrivacyConsentConfig = {
|
|
833
|
+
enabled: boolean;
|
|
834
|
+
required: boolean;
|
|
835
|
+
};
|
|
836
|
+
type PiiConfig = {
|
|
837
|
+
enabled: boolean;
|
|
838
|
+
hashEmail: boolean;
|
|
839
|
+
hashPhone: boolean;
|
|
840
|
+
};
|
|
841
|
+
type AnonymizationConfig = {
|
|
842
|
+
enabled: boolean;
|
|
843
|
+
anonymizeIp: boolean;
|
|
844
|
+
};
|
|
845
|
+
type PrivacyModuleConfig = {
|
|
846
|
+
enabled: boolean;
|
|
847
|
+
consent: PrivacyConsentConfig;
|
|
848
|
+
pii: PiiConfig;
|
|
849
|
+
anonymization: AnonymizationConfig;
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
type ModulesConfig = {
|
|
853
|
+
core: CoreModuleConfig;
|
|
854
|
+
behavior: BehaviorModuleConfig;
|
|
855
|
+
conversion: ConversionModuleConfig;
|
|
856
|
+
integrations: IntegrationsModuleConfig;
|
|
857
|
+
privacy: PrivacyModuleConfig;
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
type PixelConfig = {
|
|
861
|
+
app: AppConfig;
|
|
862
|
+
identity: IdentityConfig;
|
|
863
|
+
transport: TransportConfig;
|
|
864
|
+
storage: StorageConfig;
|
|
865
|
+
attribution: AttributionConfig;
|
|
866
|
+
/** Contexto comercial global da página/fluxo (fora dos módulos). */
|
|
867
|
+
commerce: CommerceConfig;
|
|
868
|
+
modules: ModulesConfig;
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
export { type LinkQueryCondition as $, type AttributionStoragePersistence as A, type BehaviorModuleConfig as B, type CommerceConfig as C, type TransportReplayConfig as D, type TransportRetryConfig as E, type TransportTestSenderConfig as F, type TransportTimeoutConfig as G, type StorageKeysConfig as H, type IdentityConfig as I, type AutoSourceBase as J, type KnownPixelPlatform as K, type AutoSourceType as L, type ModulesConfig as M, type AutoTrackSource as N, type EngagementThresholds as O, type PixelConfig as P, type QueueStoragePersistence as Q, type EngagementWeights as R, type SessionStoragePersistence as S, type TransportConfig as T, type EngagementPenalties as U, type VisitorStoragePersistence as V, type FingerprintMode as W, type FormAutoSource as X, type LifecycleAutoSource as Y, type LinkAutoSource as Z, type LinkMatchProtocol as _, type AppConfig as a, type PrivacyConsentConfig as a$, type LinkQueryMatch as a0, type LinkTargetMatch as a1, type LinkValueBinding as a2, type LinkValueResolver as a3, type LinkValueTransform as a4, type PaymentAutoSource as a5, type PaymentMethod as a6, type SelectorAutoSource as a7, type SelectorAutoTrigger as a8, type SelectorConfig as a9, type AnonymizationConfig as aA, type AutoConversionConfig as aB, type AutoDetectorConfig as aC, type ClickBehaviorConfig as aD, type ConsentConfig as aE, type ConversionAutoDetectorsConfig as aF, type ConversionRulesConfig as aG, type CoordinationConfig as aH, type DedupeConfig as aI, type EngagementBehaviorConfig as aJ, type ExitIntentBehaviorConfig as aK, type FingerprintConfig as aL, type GoogleBrowserDestinationConfig as aM, type GoogleIntegrationConfig as aN, type HeartbeatModuleConfig as aO, type IdleBehaviorConfig as aP, type InitiateCheckoutAutoDetectorConfig as aQ, type IntegrationTestDestinationConfig as aR, type LeadAutoDetectorConfig as aS, type ManualConversionConfig as aT, type ManualEventConfig as aU, type MetaBrowserDestinationConfig as aV, type MetaIntegrationConfig as aW, type TikTokBrowserDestinationConfig as aX, type OrderingConfig as aY, type PageViewConfig as aZ, type PiiConfig as a_, type SelectorDescriptor as aa, type SelectorInput as ab, type SelectorType as ac, type SelectorFormConfig as ad, type SelectorFormMode as ae, type SelectorFormTrigger as af, type CommerceCalculateValueFrom as ag, type CommerceCartConfig as ah, type CommerceCartItem as ai, type CommerceCartMode as aj, type CommerceEnrichmentConfig as ak, type CommerceEnrichmentSource as al, type CommerceEventEnrichmentConfig as am, type CommerceMappingsConfig as an, type CommerceProduct as ao, type ProductCatalogConfig as ap, type ProductType as aq, type UrlAutoSource as ar, DEFAULT_SELECTOR_TYPE as as, DEFAULT_COMMERCE_CONFIG as at, DEFAULT_COMMERCE_ENRICHMENT as au, getPrimarySelectorValue as av, normalizeCalculateValueFrom as aw, resolveSelectorTypeFallback as ax, type AddPaymentInfoAutoDetectorConfig as ay, type AddToCartAutoDetectorConfig as az, type TransportSenderConfig as b, type PurchaseAutoDetectorConfig as b0, type RemoveFromCartAutoDetectorConfig as b1, type ScrollBehaviorConfig as b2, type SearchAutoDetectorConfig as b3, type SessionConfig as b4, type ViewContentAutoDetectorConfig as b5, type ViewportBehaviorConfig as b6, type ViewportTargetConfig as b7, type VisibilityBehaviorConfig as b8, type VisitorConfig as b9, type StorageConfig as c, type AttributionConfig as d, type ConversionModuleConfig as e, type CoreModuleConfig as f, type IntegrationsModuleConfig as g, type PrivacyModuleConfig as h, type KnownPixelSource as i, type PixelEnvironment as j, type PixelPlatform as k, type PixelSource as l, type PixelTarget as m, type TransportBackpressureConfig as n, type TransportBackpressurePolicy as o, type TransportBatchConfig as p, type TransportCircuitBreakerConfig as q, type TransportCompressionConfig as r, type TransportCoordinationConfig as s, type TransportDeadLetterConfig as t, type TransportExternalSenderConfig as u, type TransportFlushConfig as v, type TransportInternalSenderConfig as w, type TransportOfflineConfig as x, type TransportOrderingConfig as y, type TransportPersistenceConfig as z };
|