@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.
Files changed (189) hide show
  1. package/CHANGELOG.md +303 -4
  2. package/README.md +90 -128
  3. package/RELEASE_CANDIDATE.md +218 -101
  4. package/dist/Pixel-BnN86r4X.d.ts +797 -0
  5. package/dist/Pixel-BoUGqCbP.d.mts +797 -0
  6. package/dist/{StorageFactory-CAkJJqVD.d.ts → StorageFactory-BfCArzMM.d.ts} +2 -2
  7. package/dist/{StorageFactory-BhpbB6Jj.d.mts → StorageFactory-C0prtNR7.d.mts} +2 -2
  8. package/dist/browser/index.cjs.js +3 -0
  9. package/dist/browser/index.cjs.js.map +1 -0
  10. package/dist/browser/index.d.mts +71 -0
  11. package/dist/browser/index.d.ts +71 -0
  12. package/dist/browser/index.esm.js +3 -0
  13. package/dist/browser/index.esm.js.map +1 -0
  14. package/dist/browser/pixel.buygoods-checkout.global.js +4 -0
  15. package/dist/browser/pixel.buygoods-checkout.global.js.map +1 -0
  16. package/dist/browser/pixel.buygoods-landing.global.js +4 -0
  17. package/dist/browser/pixel.buygoods-landing.global.js.map +1 -0
  18. package/dist/browser/pixel.global.js +4 -0
  19. package/dist/browser/pixel.global.js.map +1 -0
  20. package/dist/config/index.cjs.js +1 -1
  21. package/dist/config/index.cjs.js.map +1 -1
  22. package/dist/config/index.d.mts +16 -5
  23. package/dist/config/index.d.ts +16 -5
  24. package/dist/config/index.esm.js +1 -1
  25. package/dist/config/index.esm.js.map +1 -1
  26. package/dist/events/index.cjs.js +1 -1
  27. package/dist/events/index.cjs.js.map +1 -1
  28. package/dist/events/index.d.mts +2 -1
  29. package/dist/events/index.d.ts +2 -1
  30. package/dist/events/index.esm.js +1 -1
  31. package/dist/events/index.esm.js.map +1 -1
  32. package/dist/examples/html-script/README.md +21 -55
  33. package/dist/examples/html-script/RELEASE_CANDIDATE.md +39 -26
  34. package/dist/examples/html-script/add-payment-info/README.md +3 -3
  35. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +107 -96
  36. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +107 -96
  37. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +106 -95
  38. package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +114 -95
  39. package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +106 -95
  40. package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +97 -95
  41. package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +106 -95
  42. package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +106 -95
  43. package/dist/examples/html-script/add-to-cart/README.md +9 -6
  44. package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +133 -119
  45. package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +146 -130
  46. package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +144 -127
  47. package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +133 -119
  48. package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +590 -0
  49. package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +124 -116
  50. package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +133 -119
  51. package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +147 -130
  52. package/dist/examples/html-script/behavior/example-behavior-engagement.html +489 -0
  53. package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +350 -0
  54. package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +433 -0
  55. package/dist/examples/html-script/behavior/example-behavior-viewport.html +397 -0
  56. package/dist/examples/html-script/{example-behavior.html → behavior/example-behavior.html} +23 -17
  57. package/dist/examples/html-script/buygoods/example-buygoods-checkout.html +50 -0
  58. package/dist/examples/html-script/buygoods/ladding.html +184 -0
  59. package/dist/examples/html-script/example-basic.html +1 -1
  60. package/dist/examples/html-script/example-checkout-commerce.html +826 -0
  61. package/dist/examples/html-script/example-conversion.html +42 -49
  62. package/dist/examples/html-script/example-global-factory-classic.html +45 -0
  63. package/dist/examples/html-script/example-global-factory.html +40 -0
  64. package/dist/examples/html-script/example-integration.html +45 -51
  65. package/dist/examples/html-script/example-landing-commerce.html +416 -0
  66. package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
  67. package/dist/examples/html-script/example-transport.html +70 -63
  68. package/dist/examples/html-script/full-funnel/README.md +64 -0
  69. package/dist/examples/html-script/full-funnel/checkout.html +118 -0
  70. package/dist/examples/html-script/full-funnel/downsell.html +60 -0
  71. package/dist/examples/html-script/full-funnel/landing.html +153 -0
  72. package/dist/examples/html-script/full-funnel/thank-you.html +87 -0
  73. package/dist/examples/html-script/full-funnel/upsell.html +66 -0
  74. package/dist/examples/html-script/initiate-checkout/README.md +6 -6
  75. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +135 -122
  76. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +143 -128
  77. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +144 -128
  78. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +127 -120
  79. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +136 -123
  80. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +144 -131
  81. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +146 -130
  82. package/dist/examples/html-script/internal-checkout/example-cardioclear-checkout.html +103 -0
  83. package/dist/examples/html-script/internal-checkout/example-slimsoda-checkout.html +103 -0
  84. package/dist/examples/html-script/lead/README.md +9 -7
  85. package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +107 -94
  86. package/dist/examples/html-script/lead/example-lead-trigger-auto.html +118 -103
  87. package/dist/examples/html-script/lead/example-lead-trigger-click.html +118 -102
  88. package/dist/examples/html-script/release-candidate.html +219 -107
  89. package/dist/examples/html-script/remove-from-cart/README.md +4 -4
  90. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +134 -121
  91. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +134 -121
  92. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +141 -128
  93. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +125 -118
  94. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +135 -122
  95. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +136 -123
  96. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +139 -124
  97. package/dist/examples/html-script/search/README.md +1 -1
  98. package/dist/examples/html-script/search/example-search-attribute.html +107 -99
  99. package/dist/examples/html-script/search/example-search-button-sync.html +107 -99
  100. package/dist/examples/html-script/search/example-search-dedupe.html +107 -99
  101. package/dist/examples/html-script/search/example-search-input.html +108 -99
  102. package/dist/examples/html-script/search/example-search-manual.html +98 -96
  103. package/dist/examples/html-script/search/example-search-submit.html +107 -99
  104. package/dist/examples/html-script/search/example-search-text.html +112 -99
  105. package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +92 -0
  106. package/dist/examples/html-script/url-context/example-url-context-landing.html +110 -0
  107. package/dist/examples/html-script/url-context/example-url-context-upsell.html +105 -0
  108. package/dist/examples/html-script/url-context/example-url-context.html +205 -0
  109. package/dist/examples/html-script/view-content/README.md +1 -1
  110. package/dist/examples/html-script/view-content/example-view-content-attribute.html +126 -118
  111. package/dist/examples/html-script/view-content/example-view-content-css.html +126 -118
  112. package/dist/examples/html-script/view-content/example-view-content-dedupe.html +126 -118
  113. package/dist/examples/html-script/view-content/example-view-content-empty.html +126 -118
  114. package/dist/examples/html-script/view-content/example-view-content-manual.html +117 -115
  115. package/dist/examples/html-script/view-content/example-view-content-product-card.html +126 -118
  116. package/dist/examples/html-script/view-content/example-view-content-text.html +131 -121
  117. package/dist/examples/release-candidate/README.md +2 -1
  118. package/dist/examples/v2/README.md +16 -13
  119. package/dist/index-B8u_3PGG.d.ts +460 -0
  120. package/dist/index-BxT2d-TK.d.mts +460 -0
  121. package/dist/index.cjs.js +1 -1
  122. package/dist/index.cjs.js.map +1 -1
  123. package/dist/index.d.mts +23 -361
  124. package/dist/index.d.ts +23 -361
  125. package/dist/index.esm.js +1 -1
  126. package/dist/index.esm.js.map +1 -1
  127. package/dist/pixel-DNGbAN5C.d.ts +871 -0
  128. package/dist/pixel-_BSDpx4M.d.mts +871 -0
  129. package/dist/pixel-default-config-BMYaqs7i.d.ts +21 -0
  130. package/dist/pixel-default-config-DLRya1tl.d.mts +21 -0
  131. package/dist/pixel-settings-D-t9zQb4.d.ts +40 -0
  132. package/dist/pixel-settings-DGxl0MVm.d.mts +40 -0
  133. package/dist/runtime/index.cjs.js +1 -1
  134. package/dist/runtime/index.cjs.js.map +1 -1
  135. package/dist/runtime/index.d.mts +19 -26
  136. package/dist/runtime/index.d.ts +19 -26
  137. package/dist/runtime/index.esm.js +1 -1
  138. package/dist/runtime/index.esm.js.map +1 -1
  139. package/dist/services/index.cjs.js +1 -1
  140. package/dist/services/index.cjs.js.map +1 -1
  141. package/dist/services/index.d.mts +14 -6
  142. package/dist/services/index.d.ts +14 -6
  143. package/dist/services/index.esm.js +1 -1
  144. package/dist/services/index.esm.js.map +1 -1
  145. package/dist/types-B-Nzagpk.d.mts +19 -0
  146. package/dist/types-D0KVsgzs.d.mts +293 -0
  147. package/dist/types-D3kJ9bfT.d.ts +293 -0
  148. package/dist/types-Dfi9C49l.d.ts +19 -0
  149. package/dist/url-context-Ck2LK18V.d.mts +87 -0
  150. package/dist/url-context-Ck2LK18V.d.ts +87 -0
  151. package/dist/v2/global.global.js +1 -1
  152. package/dist/v2/global.global.js.map +1 -1
  153. package/dist/v2/index.cjs.js +1 -1
  154. package/dist/v2/index.cjs.js.map +1 -1
  155. package/dist/v2/index.d.mts +26 -6
  156. package/dist/v2/index.d.ts +26 -6
  157. package/dist/v2/index.esm.js +1 -1
  158. package/dist/v2/index.esm.js.map +1 -1
  159. package/docs/public/README.md +80 -0
  160. package/docs/public/api/exports.md +55 -0
  161. package/docs/public/api/pixel.md +86 -0
  162. package/docs/public/configuration/commerce.md +44 -0
  163. package/docs/public/configuration/modules.md +63 -0
  164. package/docs/public/configuration/overview.md +85 -0
  165. package/docs/public/configuration/transport.md +127 -0
  166. package/docs/public/events/catalog.md +67 -0
  167. package/docs/public/getting-started/installation.md +87 -0
  168. package/docs/public/getting-started/quick-start.md +142 -0
  169. package/docs/public/getting-started/react-nextjs.md +78 -0
  170. package/docs/public/getting-started/script-tag.md +94 -0
  171. package/docs/public/guides/funnel-checkout.md +52 -0
  172. package/docs/public/guides/funnel-downsell.md +53 -0
  173. package/docs/public/guides/funnel-full.md +64 -0
  174. package/docs/public/guides/funnel-landing.md +70 -0
  175. package/docs/public/guides/funnel-thank-you.md +48 -0
  176. package/docs/public/guides/funnel-upsell.md +72 -0
  177. package/docs/public/limitations.md +33 -0
  178. package/docs/public/privacy/limitations.md +33 -0
  179. package/docs/public/release-candidate/validation.md +42 -0
  180. package/docs/public/troubleshooting.md +56 -0
  181. package/package.json +38 -20
  182. package/dist/index-DUfFzniE.d.mts +0 -274
  183. package/dist/index-DUfFzniE.d.ts +0 -274
  184. package/dist/pixel-CbeF25mD.d.mts +0 -555
  185. package/dist/pixel-CbeF25mD.d.ts +0 -555
  186. package/dist/pixel-default-config-1VgLFOiL.d.mts +0 -5
  187. package/dist/pixel-default-config-Bxb-Vdd8.d.ts +0 -5
  188. package/dist/types-CTpRvFKZ.d.ts +0 -71
  189. package/dist/types-DGlBdsAy.d.mts +0 -71
@@ -94,7 +94,7 @@ code { font-size: 0.85em; }
94
94
  <a href="example-initiate-checkout-manual.html" class="active">6. Manual API</a>
95
95
  <a href="example-initiate-checkout-snapshot.html" class="">7. Snapshot/value</a></div>
96
96
  <div class="hint"><strong>Contexto:</strong> API manual. Auto detector desligado.
97
- Valida snapshot de selectedItems, override de <code>value</code> e payload com items.</div>
97
+ Valida snapshot de initialItems, override de <code>value</code> e payload com items.</div>
98
98
 
99
99
  <div class="card">
100
100
  <h2>Lifecycle</h2>
@@ -110,7 +110,7 @@ code { font-size: 0.85em; }
110
110
  <div>
111
111
  <div class="card">
112
112
  <h2>API manual <span class="pill">TrackerFactory</span></h2>
113
- <div class="ctx">selectedItems: main_offer. Override deve preservar value manual.</div>
113
+ <div class="ctx">initialItems: main_offer. Override deve preservar value manual.</div>
114
114
  <div class="actions">
115
115
  <button id="btn-empty" class="primary" type="button">
116
116
  initiateCheckout()
@@ -123,13 +123,13 @@ code { font-size: 0.85em; }
123
123
  </button>
124
124
  </div>
125
125
  <p class="sub">
126
- Vazio → value do selectedItems/catalog. value:999 → preserva 999.
126
+ Vazio → value do initialItems/catalog. value:999 → preserva 999.
127
127
  </p>
128
128
  </div>
129
129
  <div class="card">
130
130
  <h2>Checklist</h2>
131
131
  <ul class="checklist">
132
- <li>[ ] Sem args → snapshot de selectedItems (≈197)</li>
132
+ <li>[ ] Sem args → snapshot de initialItems (≈197)</li>
133
133
  <li>[ ] value:999 → snapshot.value = 999</li>
134
134
  <li>[ ] items manuais → usa/mescla items do payload</li>
135
135
  <li>[ ] Nenhum detector auto ativo</li>
@@ -162,7 +162,7 @@ code { font-size: 0.85em; }
162
162
  </div>
163
163
  </div>
164
164
 
165
- <script src="../../../dist/v2/global.global.js"></script>
165
+ <script src="../../../v2/global.global.js"></script>
166
166
  <script>
167
167
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
168
168
  const API_ENDPOINT =
@@ -187,7 +187,10 @@ code { font-size: 0.85em; }
187
187
  const counts = {};
188
188
 
189
189
  function initiateCheckoutDetectorConfig() {
190
- return { enabled: false };
190
+ return {
191
+ enabled: false,
192
+ sources: []
193
+ };
191
194
  }
192
195
 
193
196
  function buildConfig() {
@@ -201,11 +204,112 @@ code { font-size: 0.85em; }
201
204
  debug: true,
202
205
  },
203
206
  transport: {
204
- ...DEFAULT_PIXEL_CONFIG.transport,
205
- apiEndpoint: API_ENDPOINT,
206
- timeoutMs: 10000,
207
+ ...base.transport,
208
+ enabled: true,
209
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
210
+ persistence: { enabled: true },
211
+ replay: { enabled: true },
212
+ ordering: { enabled: true },
213
+ coordination: { enabled: true },
214
+ circuitBreaker: {
215
+ enabled: true,
216
+ failureThreshold: 5,
217
+ resetTimeoutMs: 30000,
218
+ halfOpenMaxAttempts: 2,
219
+ },
220
+ backpressure: {
221
+ enabled: true,
222
+ maxQueueSize: 500,
223
+ policy: 'drop_oldest',
224
+ sampleRate: 0.5,
225
+ },
226
+ deadLetter: { enabled: true, maxEntries: 200 },
227
+ compression: { enabled: true, strategy: 'identity' },
228
+ retry: {
229
+ enabled: true,
230
+ maxAttempts: 4,
231
+ baseDelayMs: 500,
232
+ maxDelayMs: 4000,
233
+ multiplier: 2,
234
+ },
235
+ batch: {
236
+ enabled: true,
237
+ batchSize: 10,
238
+ maxWaitMs: 5000,
239
+ },
240
+ timeout: { enabled: true, timeoutMs: 10000 },
241
+ offline: { enabled: true },
242
+ flush: {
243
+ enabled: true,
244
+ flushOnDestroy: true,
245
+ prepareUnloadHooks: true,
246
+ },
207
247
  },
208
248
  identity: { ...base.identity, pixelId: PIXEL_ID },
249
+ commerce: {
250
+ enabled: true,
251
+ currency: 'BRL',
252
+ catalog: { products: [
253
+ {
254
+ id: 'main_offer',
255
+ name: 'Oferta Principal',
256
+ type: 'main',
257
+ price: 197,
258
+ currency: 'BRL',
259
+ quantity: 1,
260
+ },
261
+ {
262
+ id: 'order_bump_01',
263
+ name: 'Order Bump Especial',
264
+ type: 'order_bump',
265
+ price: 47,
266
+ currency: 'BRL',
267
+ quantity: 1,
268
+ },
269
+ {
270
+ id: 'upsell_01',
271
+ name: 'Upsell 01',
272
+ type: 'upsell',
273
+ price: 97,
274
+ currency: 'BRL',
275
+ quantity: 1,
276
+ },
277
+ ] },
278
+ cart: {
279
+ mode: 'single_product',
280
+ initialItems: [{ productId: "main_offer", quantity: 1 }],
281
+ calculateValueFrom: 'cart',
282
+ allowDynamicItems: true,
283
+ },
284
+ mappings: {
285
+ attributes: {
286
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
287
+ productName: ['data-product-name', 'data-name'],
288
+ price: ['data-product-price', 'data-price'],
289
+ quantity: ['data-quantity', 'data-qty'],
290
+ currency: ['data-currency'],
291
+ },
292
+ fields: {
293
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
294
+ productName: ['productName', 'product_name'],
295
+ price: ['price', 'amount'],
296
+ quantity: ['quantity', 'qty'],
297
+ currency: ['currency'],
298
+ email: ['email', 'customerEmail'],
299
+ phone: ['phone', 'telefone', 'customerPhone'],
300
+ },
301
+ },
302
+ enrichment: {
303
+ pageView: { enabled: false, source: 'cart' },
304
+ viewContent: { enabled: true, source: 'event_or_cart' },
305
+ lead: { enabled: false, source: 'event_or_cart' },
306
+ addToCart: { enabled: true, source: 'event_or_cart' },
307
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
308
+ initiateCheckout: { enabled: true, source: 'cart' },
309
+ addPaymentInfo: { enabled: true, source: 'cart' },
310
+ purchase: { enabled: true, source: 'cart' },
311
+ }
312
+ },
209
313
  modules: {
210
314
  ...base.modules,
211
315
  core: {
@@ -220,128 +324,31 @@ code { font-size: 0.85em; }
220
324
  },
221
325
  behavior: { ...base.modules.behavior, enabled: false },
222
326
  privacy: { ...base.modules.privacy, enabled: false },
223
- transport: {
224
- enabled: true,
225
- mockSender: { enabled: false },
226
- sender: { mode: 'http' },
227
- persistence: { enabled: true },
228
- replay: { enabled: true },
229
- ordering: { enabled: true },
230
- coordination: { enabled: true },
231
- circuitBreaker: {
232
- enabled: true,
233
- failureThreshold: 5,
234
- resetTimeoutMs: 30000,
235
- halfOpenMaxAttempts: 2,
236
- },
237
- backpressure: {
238
- enabled: true,
239
- maxQueueSize: 500,
240
- policy: 'drop_oldest',
241
- sampleRate: 0.5,
242
- },
243
- deadLetter: { enabled: true, maxEntries: 200 },
244
- compression: { enabled: true, strategy: 'identity' },
245
- retry: {
246
- enabled: true,
247
- maxAttempts: 4,
248
- baseDelayMs: 500,
249
- maxDelayMs: 4000,
250
- multiplier: 2,
251
- },
252
- batch: {
253
- enabled: true,
254
- batchSize: 10,
255
- flushIntervalMs: 2000,
256
- maxWaitMs: 5000,
257
- },
258
- timeout: { enabled: true, timeoutMs: 10000 },
259
- offline: { enabled: true },
260
- flush: {
261
- enabled: true,
262
- flushIntervalMs: 2000,
263
- flushOnDestroy: true,
264
- prepareUnloadHooks: true,
265
- },
266
- },
267
327
  integrations: { ...base.modules.integrations, enabled: false },
268
328
  conversion: {
269
329
  enabled: true,
270
- commerce: {
271
- currency: 'BRL',
272
- catalog: { products: [
273
- {
274
- id: 'main_offer',
275
- name: 'Oferta Principal',
276
- type: 'main',
277
- price: 197,
278
- currency: 'BRL',
279
- quantity: 1,
280
- },
281
- {
282
- id: 'order_bump_01',
283
- name: 'Order Bump Especial',
284
- type: 'order_bump',
285
- price: 47,
286
- currency: 'BRL',
287
- quantity: 1,
288
- },
289
- {
290
- id: 'upsell_01',
291
- name: 'Upsell 01',
292
- type: 'upsell',
293
- price: 97,
294
- currency: 'BRL',
295
- quantity: 1,
296
- },
297
- ] },
298
- checkout: {
299
- mode: 'single_product',
300
- selectedItems: [{ productId: "main_offer", quantity: 1 }],
301
- calculateValueFrom: 'selected_items',
302
- allowDynamicItems: true,
303
- },
304
- mappings: {
305
- attributes: {
306
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
307
- productName: ['data-product-name', 'data-name'],
308
- price: ['data-product-price', 'data-price'],
309
- quantity: ['data-quantity', 'data-qty'],
310
- currency: ['data-currency'],
311
- },
312
- fields: {
313
- productId: ['productId', 'product_id', 'offerId', 'sku'],
314
- productName: ['productName', 'product_name'],
315
- price: ['price', 'amount'],
316
- quantity: ['quantity', 'qty'],
317
- currency: ['currency'],
318
- email: ['email', 'customerEmail'],
319
- phone: ['phone', 'telefone', 'customerPhone'],
320
- },
321
- },
322
- },
323
330
  manual: {
324
331
  pageView: { enabled: false },
325
- purchase: { enabled: false },
326
- lead: { enabled: false },
327
- addToCart: { enabled: false },
328
- removeFromCart: { enabled: false },
332
+ purchase: { enabled: false, sources: [] },
333
+ lead: { enabled: false, sources: [] },
334
+ addToCart: { enabled: false, sources: [] },
335
+ removeFromCart: { enabled: false, sources: [] },
329
336
  initiateCheckout: { enabled: true },
330
- addPaymentInfo: { enabled: false },
331
- search: { enabled: false },
332
- viewContent: { enabled: false },
337
+ addPaymentInfo: { enabled: false, sources: [] },
338
+ search: { enabled: false, sources: [] },
339
+ viewContent: { enabled: false, sources: [] },
333
340
  },
334
341
  auto: {
335
342
  enabled: true,
336
343
  detectors: {
337
- lead: { enabled: false },
338
- purchase: { enabled: false },
339
- addToCart: { enabled: false },
340
- removeFromCart: { enabled: false },
344
+ lead: { enabled: false, sources: [] },
345
+ purchase: { enabled: false, sources: [] },
346
+ addToCart: { enabled: false, sources: [] },
347
+ removeFromCart: { enabled: false, sources: [] },
341
348
  initiateCheckout: initiateCheckoutDetectorConfig(),
342
- addPaymentInfo: { enabled: false },
343
- search: { enabled: false },
344
- viewContent: { enabled: false },
349
+ addPaymentInfo: { enabled: false, sources: [] },
350
+ search: { enabled: false, sources: [] },
351
+ viewContent: { enabled: false, sources: [] },
345
352
  },
346
353
  },
347
354
  rules: {
@@ -93,7 +93,7 @@ code { font-size: 0.85em; }
93
93
  <a href="example-initiate-checkout-text.html" class="">5. Text</a>
94
94
  <a href="example-initiate-checkout-manual.html" class="">6. Manual API</a>
95
95
  <a href="example-initiate-checkout-snapshot.html" class="active">7. Snapshot/value</a></div>
96
- <div class="hint"><strong>Contexto:</strong> selectedItems com main (197) + bump (47).
96
+ <div class="hint"><strong>Contexto:</strong> initialItems com main (197) + bump (47).
97
97
  Esperado: <code>value ≈ 244</code>, <code>numItems</code> / items com os dois.
98
98
  Painel “Checkout snapshot” destaca value/items.</div>
99
99
 
@@ -171,7 +171,7 @@ code { font-size: 0.85em; }
171
171
  </div>
172
172
  </div>
173
173
 
174
- <script src="../../../dist/v2/global.global.js"></script>
174
+ <script src="../../../v2/global.global.js"></script>
175
175
  <script>
176
176
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
177
177
  const API_ENDPOINT =
@@ -197,10 +197,19 @@ code { font-size: 0.85em; }
197
197
 
198
198
  function initiateCheckoutDetectorConfig() {
199
199
  return {
200
- enabled: true,
201
- selector: ['[data-track="initiate_checkout"]'],
202
- selectorType: 'css',
203
- };
200
+ enabled: true,
201
+ sources: [
202
+ {
203
+ name: 'initiateCheckout-selector',
204
+ type: 'selector',
205
+ selector: [
206
+ '[data-track=\'initiate_checkout\']'
207
+ ],
208
+ selectorType: 'css',
209
+ trigger: 'click'
210
+ }
211
+ ]
212
+ };
204
213
  }
205
214
 
206
215
  function buildConfig() {
@@ -214,11 +223,115 @@ code { font-size: 0.85em; }
214
223
  debug: true,
215
224
  },
216
225
  transport: {
217
- ...DEFAULT_PIXEL_CONFIG.transport,
218
- apiEndpoint: API_ENDPOINT,
219
- timeoutMs: 10000,
226
+ ...base.transport,
227
+ enabled: true,
228
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
229
+ persistence: { enabled: true },
230
+ replay: { enabled: true },
231
+ ordering: { enabled: true },
232
+ coordination: { enabled: true },
233
+ circuitBreaker: {
234
+ enabled: true,
235
+ failureThreshold: 5,
236
+ resetTimeoutMs: 30000,
237
+ halfOpenMaxAttempts: 2,
238
+ },
239
+ backpressure: {
240
+ enabled: true,
241
+ maxQueueSize: 500,
242
+ policy: 'drop_oldest',
243
+ sampleRate: 0.5,
244
+ },
245
+ deadLetter: { enabled: true, maxEntries: 200 },
246
+ compression: { enabled: true, strategy: 'identity' },
247
+ retry: {
248
+ enabled: true,
249
+ maxAttempts: 4,
250
+ baseDelayMs: 500,
251
+ maxDelayMs: 4000,
252
+ multiplier: 2,
253
+ },
254
+ batch: {
255
+ enabled: true,
256
+ batchSize: 10,
257
+ maxWaitMs: 5000,
258
+ },
259
+ timeout: { enabled: true, timeoutMs: 10000 },
260
+ offline: { enabled: true },
261
+ flush: {
262
+ enabled: true,
263
+ flushOnDestroy: true,
264
+ prepareUnloadHooks: true,
265
+ },
220
266
  },
221
267
  identity: { ...base.identity, pixelId: PIXEL_ID },
268
+ commerce: {
269
+ enabled: true,
270
+ currency: 'BRL',
271
+ catalog: { products: [
272
+ {
273
+ id: 'main_offer',
274
+ name: 'Oferta Principal',
275
+ type: 'main',
276
+ price: 197,
277
+ currency: 'BRL',
278
+ quantity: 1,
279
+ },
280
+ {
281
+ id: 'order_bump_01',
282
+ name: 'Order Bump Especial',
283
+ type: 'order_bump',
284
+ price: 47,
285
+ currency: 'BRL',
286
+ quantity: 1,
287
+ },
288
+ {
289
+ id: 'upsell_01',
290
+ name: 'Upsell 01',
291
+ type: 'upsell',
292
+ price: 97,
293
+ currency: 'BRL',
294
+ quantity: 1,
295
+ },
296
+ ] },
297
+ cart: {
298
+ mode: 'single_product',
299
+ initialItems: [
300
+ { productId: 'main_offer', quantity: 1 },
301
+ { productId: 'order_bump_01', quantity: 1 },
302
+ ],
303
+ calculateValueFrom: 'cart',
304
+ allowDynamicItems: true,
305
+ },
306
+ mappings: {
307
+ attributes: {
308
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
309
+ productName: ['data-product-name', 'data-name'],
310
+ price: ['data-product-price', 'data-price'],
311
+ quantity: ['data-quantity', 'data-qty'],
312
+ currency: ['data-currency'],
313
+ },
314
+ fields: {
315
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
316
+ productName: ['productName', 'product_name'],
317
+ price: ['price', 'amount'],
318
+ quantity: ['quantity', 'qty'],
319
+ currency: ['currency'],
320
+ email: ['email', 'customerEmail'],
321
+ phone: ['phone', 'telefone', 'customerPhone'],
322
+ },
323
+ },
324
+ enrichment: {
325
+ pageView: { enabled: false, source: 'cart' },
326
+ viewContent: { enabled: true, source: 'event_or_cart' },
327
+ lead: { enabled: false, source: 'event_or_cart' },
328
+ addToCart: { enabled: true, source: 'event_or_cart' },
329
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
330
+ initiateCheckout: { enabled: true, source: 'cart' },
331
+ addPaymentInfo: { enabled: true, source: 'cart' },
332
+ purchase: { enabled: true, source: 'cart' },
333
+ }
334
+ },
222
335
  modules: {
223
336
  ...base.modules,
224
337
  core: {
@@ -233,131 +346,31 @@ code { font-size: 0.85em; }
233
346
  },
234
347
  behavior: { ...base.modules.behavior, enabled: false },
235
348
  privacy: { ...base.modules.privacy, enabled: false },
236
- transport: {
237
- enabled: true,
238
- mockSender: { enabled: false },
239
- sender: { mode: 'http' },
240
- persistence: { enabled: true },
241
- replay: { enabled: true },
242
- ordering: { enabled: true },
243
- coordination: { enabled: true },
244
- circuitBreaker: {
245
- enabled: true,
246
- failureThreshold: 5,
247
- resetTimeoutMs: 30000,
248
- halfOpenMaxAttempts: 2,
249
- },
250
- backpressure: {
251
- enabled: true,
252
- maxQueueSize: 500,
253
- policy: 'drop_oldest',
254
- sampleRate: 0.5,
255
- },
256
- deadLetter: { enabled: true, maxEntries: 200 },
257
- compression: { enabled: true, strategy: 'identity' },
258
- retry: {
259
- enabled: true,
260
- maxAttempts: 4,
261
- baseDelayMs: 500,
262
- maxDelayMs: 4000,
263
- multiplier: 2,
264
- },
265
- batch: {
266
- enabled: true,
267
- batchSize: 10,
268
- flushIntervalMs: 2000,
269
- maxWaitMs: 5000,
270
- },
271
- timeout: { enabled: true, timeoutMs: 10000 },
272
- offline: { enabled: true },
273
- flush: {
274
- enabled: true,
275
- flushIntervalMs: 2000,
276
- flushOnDestroy: true,
277
- prepareUnloadHooks: true,
278
- },
279
- },
280
349
  integrations: { ...base.modules.integrations, enabled: false },
281
350
  conversion: {
282
351
  enabled: true,
283
- commerce: {
284
- currency: 'BRL',
285
- catalog: { products: [
286
- {
287
- id: 'main_offer',
288
- name: 'Oferta Principal',
289
- type: 'main',
290
- price: 197,
291
- currency: 'BRL',
292
- quantity: 1,
293
- },
294
- {
295
- id: 'order_bump_01',
296
- name: 'Order Bump Especial',
297
- type: 'order_bump',
298
- price: 47,
299
- currency: 'BRL',
300
- quantity: 1,
301
- },
302
- {
303
- id: 'upsell_01',
304
- name: 'Upsell 01',
305
- type: 'upsell',
306
- price: 97,
307
- currency: 'BRL',
308
- quantity: 1,
309
- },
310
- ] },
311
- checkout: {
312
- mode: 'single_product',
313
- selectedItems: [
314
- { productId: 'main_offer', quantity: 1 },
315
- { productId: 'order_bump_01', quantity: 1 },
316
- ],
317
- calculateValueFrom: 'selected_items',
318
- allowDynamicItems: true,
319
- },
320
- mappings: {
321
- attributes: {
322
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
323
- productName: ['data-product-name', 'data-name'],
324
- price: ['data-product-price', 'data-price'],
325
- quantity: ['data-quantity', 'data-qty'],
326
- currency: ['data-currency'],
327
- },
328
- fields: {
329
- productId: ['productId', 'product_id', 'offerId', 'sku'],
330
- productName: ['productName', 'product_name'],
331
- price: ['price', 'amount'],
332
- quantity: ['quantity', 'qty'],
333
- currency: ['currency'],
334
- email: ['email', 'customerEmail'],
335
- phone: ['phone', 'telefone', 'customerPhone'],
336
- },
337
- },
338
- },
339
352
  manual: {
340
353
  pageView: { enabled: false },
341
- purchase: { enabled: false },
342
- lead: { enabled: false },
343
- addToCart: { enabled: false },
344
- removeFromCart: { enabled: false },
354
+ purchase: { enabled: false, sources: [] },
355
+ lead: { enabled: false, sources: [] },
356
+ addToCart: { enabled: false, sources: [] },
357
+ removeFromCart: { enabled: false, sources: [] },
345
358
  initiateCheckout: { enabled: true },
346
- addPaymentInfo: { enabled: false },
347
- search: { enabled: false },
348
- viewContent: { enabled: false },
359
+ addPaymentInfo: { enabled: false, sources: [] },
360
+ search: { enabled: false, sources: [] },
361
+ viewContent: { enabled: false, sources: [] },
349
362
  },
350
363
  auto: {
351
364
  enabled: true,
352
365
  detectors: {
353
- lead: { enabled: false },
354
- purchase: { enabled: false },
355
- addToCart: { enabled: false },
356
- removeFromCart: { enabled: false },
366
+ lead: { enabled: false, sources: [] },
367
+ purchase: { enabled: false, sources: [] },
368
+ addToCart: { enabled: false, sources: [] },
369
+ removeFromCart: { enabled: false, sources: [] },
357
370
  initiateCheckout: initiateCheckoutDetectorConfig(),
358
- addPaymentInfo: { enabled: false },
359
- search: { enabled: false },
360
- viewContent: { enabled: false },
371
+ addPaymentInfo: { enabled: false, sources: [] },
372
+ search: { enabled: false, sources: [] },
373
+ viewContent: { enabled: false, sources: [] },
361
374
  },
362
375
  },
363
376
  rules: {