@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,9 +94,9 @@ code { font-size: 0.85em; }
94
94
  <a href="example-remove-from-cart-dedupe.html" class="active">6. Dedupe</a>
95
95
  <a href="example-remove-from-cart-multi.html" class="">7. Multi item</a></div>
96
96
  <div class="hint"><div class="hint warn" style="margin:0;padding:0;border:0;background:transparent">
97
- <strong>Diferença vs ADD:</strong> chave
98
- <code>REMOVE_FROM_CART:product:{id}</code> — <em>sem</em> bucket de tempo.
99
- Segundo remove do mesmo <code>productId</code> na sessão é bloqueado até Reinitialize.
97
+ <strong>Igual ao ADD:</strong> chave
98
+ <code>REMOVE_FROM_CART:product:{id}:qty:{n}:bucket:{t}</code> — janela de 500ms.
99
+ Clique duplo no mesmo <code>productId</code> conta 1; depois da janela o remove dispara de novo.
100
100
  </div></div>
101
101
 
102
102
  <div class="card">
@@ -112,7 +112,7 @@ code { font-size: 0.85em; }
112
112
  <div class="grid">
113
113
  <div>
114
114
  <div class="card">
115
- <h2>Dedupe REMOVE <span class="pill">productId permanente</span></h2>
115
+ <h2>Dedupe REMOVE <span class="pill">janela 500ms</span></h2>
116
116
  <div class="actions">
117
117
  <button
118
118
  type="button"
@@ -131,7 +131,7 @@ code { font-size: 0.85em; }
131
131
  </button>
132
132
  </div>
133
133
  <p class="sub">
134
- 2x no mesmo id → count +1. Outro productId → dispara. Reinit limpa keys.
134
+ 2x no mesmo id na janela → count +1. Depois de 500ms dispara de novo.
135
135
  </p>
136
136
  </div>
137
137
  <div class="card">
@@ -140,8 +140,8 @@ code { font-size: 0.85em; }
140
140
  <li>[ ] 2 cliques no mesmo botão → count +1</li>
141
141
  <li>[ ] JS 2x síncrono → count +1</li>
142
142
  <li>[ ] Outro productId → novo evento</li>
143
- <li>[ ] Dedupe key: <code>REMOVE_FROM_CART:product:…</code></li>
144
- <li>[ ] Reinitialize permite remover de novo</li>
143
+ <li>[ ] Dedupe key: <code>REMOVE_FROM_CART:product:…:bucket:…</code></li>
144
+ <li>[ ] Após 500ms o mesmo productId dispara de novo</li>
145
145
  </ul>
146
146
  </div>
147
147
  </div>
@@ -174,7 +174,7 @@ code { font-size: 0.85em; }
174
174
  </div>
175
175
  </div>
176
176
 
177
- <script src="../../../dist/v2/global.global.js"></script>
177
+ <script src="../../../v2/global.global.js"></script>
178
178
  <script>
179
179
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
180
180
  const API_ENDPOINT =
@@ -201,10 +201,19 @@ code { font-size: 0.85em; }
201
201
 
202
202
  function removeFromCartDetectorConfig() {
203
203
  return {
204
- enabled: true,
205
- selector: ['[data-track="remove_from_cart"]'],
206
- selectorType: 'css',
207
- };
204
+ enabled: true,
205
+ sources: [
206
+ {
207
+ name: 'removeFromCart-selector',
208
+ type: 'selector',
209
+ selector: [
210
+ '[data-track=\'remove_from_cart\']'
211
+ ],
212
+ selectorType: 'css',
213
+ trigger: 'click'
214
+ }
215
+ ]
216
+ };
208
217
  }
209
218
 
210
219
  function buildConfig() {
@@ -218,11 +227,115 @@ code { font-size: 0.85em; }
218
227
  debug: true,
219
228
  },
220
229
  transport: {
221
- ...DEFAULT_PIXEL_CONFIG.transport,
222
- apiEndpoint: API_ENDPOINT,
223
- timeoutMs: 10000,
230
+ ...base.transport,
231
+ enabled: true,
232
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
233
+ persistence: { enabled: true },
234
+ replay: { enabled: true },
235
+ ordering: { enabled: true },
236
+ coordination: { enabled: true },
237
+ circuitBreaker: {
238
+ enabled: true,
239
+ failureThreshold: 5,
240
+ resetTimeoutMs: 30000,
241
+ halfOpenMaxAttempts: 2,
242
+ },
243
+ backpressure: {
244
+ enabled: true,
245
+ maxQueueSize: 500,
246
+ policy: 'drop_oldest',
247
+ sampleRate: 0.5,
248
+ },
249
+ deadLetter: { enabled: true, maxEntries: 200 },
250
+ compression: { enabled: true, strategy: 'identity' },
251
+ retry: {
252
+ enabled: true,
253
+ maxAttempts: 4,
254
+ baseDelayMs: 500,
255
+ maxDelayMs: 4000,
256
+ multiplier: 2,
257
+ },
258
+ batch: {
259
+ enabled: true,
260
+ batchSize: 10,
261
+ maxWaitMs: 5000,
262
+ },
263
+ timeout: { enabled: true, timeoutMs: 10000 },
264
+ offline: { enabled: true },
265
+ flush: {
266
+ enabled: true,
267
+ flushOnDestroy: true,
268
+ prepareUnloadHooks: true,
269
+ },
224
270
  },
225
271
  identity: { ...base.identity, pixelId: PIXEL_ID },
272
+ commerce: {
273
+ enabled: true,
274
+ currency: 'BRL',
275
+ catalog: { products: [
276
+ {
277
+ id: 'main_offer',
278
+ name: 'Oferta Principal',
279
+ type: 'main',
280
+ price: 197,
281
+ currency: 'BRL',
282
+ quantity: 1,
283
+ },
284
+ {
285
+ id: 'order_bump_01',
286
+ name: 'Order Bump Especial',
287
+ type: 'order_bump',
288
+ price: 47,
289
+ currency: 'BRL',
290
+ quantity: 1,
291
+ },
292
+ {
293
+ id: 'upsell_01',
294
+ name: 'Upsell 01',
295
+ type: 'upsell',
296
+ price: 97,
297
+ currency: 'BRL',
298
+ quantity: 1,
299
+ },
300
+ ] },
301
+ cart: {
302
+ mode: 'single_product',
303
+ initialItems: [
304
+ { productId: 'main_offer', quantity: 1 },
305
+ { productId: 'order_bump_01', quantity: 1 },
306
+ ],
307
+ calculateValueFrom: 'cart',
308
+ allowDynamicItems: true,
309
+ },
310
+ mappings: {
311
+ attributes: {
312
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
313
+ productName: ['data-product-name', 'data-name'],
314
+ price: ['data-product-price', 'data-price'],
315
+ quantity: ['data-quantity', 'data-qty'],
316
+ currency: ['data-currency'],
317
+ },
318
+ fields: {
319
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
320
+ productName: ['productName', 'product_name'],
321
+ price: ['price', 'amount'],
322
+ quantity: ['quantity', 'qty'],
323
+ currency: ['currency'],
324
+ email: ['email', 'customerEmail'],
325
+ phone: ['phone', 'telefone', 'customerPhone'],
326
+ },
327
+ },
328
+ enrichment: {
329
+ pageView: { enabled: false, source: 'cart' },
330
+ viewContent: { enabled: true, source: 'event_or_cart' },
331
+ lead: { enabled: false, source: 'event_or_cart' },
332
+ addToCart: { enabled: true, source: 'event_or_cart' },
333
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
334
+ initiateCheckout: { enabled: true, source: 'cart' },
335
+ addPaymentInfo: { enabled: true, source: 'cart' },
336
+ purchase: { enabled: true, source: 'cart' },
337
+ }
338
+ },
226
339
  modules: {
227
340
  ...base.modules,
228
341
  core: {
@@ -237,131 +350,31 @@ code { font-size: 0.85em; }
237
350
  },
238
351
  behavior: { ...base.modules.behavior, enabled: false },
239
352
  privacy: { ...base.modules.privacy, enabled: false },
240
- transport: {
241
- enabled: true,
242
- mockSender: { enabled: false },
243
- sender: { mode: 'http' },
244
- persistence: { enabled: true },
245
- replay: { enabled: true },
246
- ordering: { enabled: true },
247
- coordination: { enabled: true },
248
- circuitBreaker: {
249
- enabled: true,
250
- failureThreshold: 5,
251
- resetTimeoutMs: 30000,
252
- halfOpenMaxAttempts: 2,
253
- },
254
- backpressure: {
255
- enabled: true,
256
- maxQueueSize: 500,
257
- policy: 'drop_oldest',
258
- sampleRate: 0.5,
259
- },
260
- deadLetter: { enabled: true, maxEntries: 200 },
261
- compression: { enabled: true, strategy: 'identity' },
262
- retry: {
263
- enabled: true,
264
- maxAttempts: 4,
265
- baseDelayMs: 500,
266
- maxDelayMs: 4000,
267
- multiplier: 2,
268
- },
269
- batch: {
270
- enabled: true,
271
- batchSize: 10,
272
- flushIntervalMs: 2000,
273
- maxWaitMs: 5000,
274
- },
275
- timeout: { enabled: true, timeoutMs: 10000 },
276
- offline: { enabled: true },
277
- flush: {
278
- enabled: true,
279
- flushIntervalMs: 2000,
280
- flushOnDestroy: true,
281
- prepareUnloadHooks: true,
282
- },
283
- },
284
353
  integrations: { ...base.modules.integrations, enabled: false },
285
354
  conversion: {
286
355
  enabled: true,
287
- commerce: {
288
- currency: 'BRL',
289
- catalog: { products: [
290
- {
291
- id: 'main_offer',
292
- name: 'Oferta Principal',
293
- type: 'main',
294
- price: 197,
295
- currency: 'BRL',
296
- quantity: 1,
297
- },
298
- {
299
- id: 'order_bump_01',
300
- name: 'Order Bump Especial',
301
- type: 'order_bump',
302
- price: 47,
303
- currency: 'BRL',
304
- quantity: 1,
305
- },
306
- {
307
- id: 'upsell_01',
308
- name: 'Upsell 01',
309
- type: 'upsell',
310
- price: 97,
311
- currency: 'BRL',
312
- quantity: 1,
313
- },
314
- ] },
315
- checkout: {
316
- mode: 'single_product',
317
- selectedItems: [
318
- { productId: 'main_offer', quantity: 1 },
319
- { productId: 'order_bump_01', quantity: 1 },
320
- ],
321
- calculateValueFrom: 'selected_items',
322
- allowDynamicItems: true,
323
- },
324
- mappings: {
325
- attributes: {
326
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
327
- productName: ['data-product-name', 'data-name'],
328
- price: ['data-product-price', 'data-price'],
329
- quantity: ['data-quantity', 'data-qty'],
330
- currency: ['data-currency'],
331
- },
332
- fields: {
333
- productId: ['productId', 'product_id', 'offerId', 'sku'],
334
- productName: ['productName', 'product_name'],
335
- price: ['price', 'amount'],
336
- quantity: ['quantity', 'qty'],
337
- currency: ['currency'],
338
- email: ['email', 'customerEmail'],
339
- phone: ['phone', 'telefone', 'customerPhone'],
340
- },
341
- },
342
- },
343
356
  manual: {
344
357
  pageView: { enabled: false },
345
- purchase: { enabled: false },
346
- lead: { enabled: false },
358
+ purchase: { enabled: false, sources: [] },
359
+ lead: { enabled: false, sources: [] },
347
360
  addToCart: { enabled: true },
348
361
  removeFromCart: { enabled: true },
349
- initiateCheckout: { enabled: false },
350
- addPaymentInfo: { enabled: false },
351
- search: { enabled: false },
352
- viewContent: { enabled: false },
362
+ initiateCheckout: { enabled: false, sources: [] },
363
+ addPaymentInfo: { enabled: false, sources: [] },
364
+ search: { enabled: false, sources: [] },
365
+ viewContent: { enabled: false, sources: [] },
353
366
  },
354
367
  auto: {
355
368
  enabled: true,
356
369
  detectors: {
357
- lead: { enabled: false },
358
- purchase: { enabled: false },
359
- addToCart: { enabled: false },
370
+ lead: { enabled: false, sources: [] },
371
+ purchase: { enabled: false, sources: [] },
372
+ addToCart: { enabled: false, sources: [] },
360
373
  removeFromCart: removeFromCartDetectorConfig(),
361
- initiateCheckout: { enabled: false },
362
- addPaymentInfo: { enabled: false },
363
- search: { enabled: false },
364
- viewContent: { enabled: false },
374
+ initiateCheckout: { enabled: false, sources: [] },
375
+ addPaymentInfo: { enabled: false, sources: [] },
376
+ search: { enabled: false, sources: [] },
377
+ viewContent: { enabled: false, sources: [] },
365
378
  },
366
379
  },
367
380
  rules: {
@@ -167,7 +167,7 @@ code { font-size: 0.85em; }
167
167
  </div>
168
168
  </div>
169
169
 
170
- <script src="../../../dist/v2/global.global.js"></script>
170
+ <script src="../../../v2/global.global.js"></script>
171
171
  <script>
172
172
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
173
173
  const API_ENDPOINT =
@@ -193,7 +193,10 @@ code { font-size: 0.85em; }
193
193
  const cartMirror = {};
194
194
 
195
195
  function removeFromCartDetectorConfig() {
196
- return { enabled: false };
196
+ return {
197
+ enabled: false,
198
+ sources: []
199
+ };
197
200
  }
198
201
 
199
202
  function buildConfig() {
@@ -207,11 +210,115 @@ code { font-size: 0.85em; }
207
210
  debug: true,
208
211
  },
209
212
  transport: {
210
- ...DEFAULT_PIXEL_CONFIG.transport,
211
- apiEndpoint: API_ENDPOINT,
212
- timeoutMs: 10000,
213
+ ...base.transport,
214
+ enabled: true,
215
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
216
+ persistence: { enabled: true },
217
+ replay: { enabled: true },
218
+ ordering: { enabled: true },
219
+ coordination: { enabled: true },
220
+ circuitBreaker: {
221
+ enabled: true,
222
+ failureThreshold: 5,
223
+ resetTimeoutMs: 30000,
224
+ halfOpenMaxAttempts: 2,
225
+ },
226
+ backpressure: {
227
+ enabled: true,
228
+ maxQueueSize: 500,
229
+ policy: 'drop_oldest',
230
+ sampleRate: 0.5,
231
+ },
232
+ deadLetter: { enabled: true, maxEntries: 200 },
233
+ compression: { enabled: true, strategy: 'identity' },
234
+ retry: {
235
+ enabled: true,
236
+ maxAttempts: 4,
237
+ baseDelayMs: 500,
238
+ maxDelayMs: 4000,
239
+ multiplier: 2,
240
+ },
241
+ batch: {
242
+ enabled: true,
243
+ batchSize: 10,
244
+ maxWaitMs: 5000,
245
+ },
246
+ timeout: { enabled: true, timeoutMs: 10000 },
247
+ offline: { enabled: true },
248
+ flush: {
249
+ enabled: true,
250
+ flushOnDestroy: true,
251
+ prepareUnloadHooks: true,
252
+ },
213
253
  },
214
254
  identity: { ...base.identity, pixelId: PIXEL_ID },
255
+ commerce: {
256
+ enabled: true,
257
+ currency: 'BRL',
258
+ catalog: { products: [
259
+ {
260
+ id: 'main_offer',
261
+ name: 'Oferta Principal',
262
+ type: 'main',
263
+ price: 197,
264
+ currency: 'BRL',
265
+ quantity: 1,
266
+ },
267
+ {
268
+ id: 'order_bump_01',
269
+ name: 'Order Bump Especial',
270
+ type: 'order_bump',
271
+ price: 47,
272
+ currency: 'BRL',
273
+ quantity: 1,
274
+ },
275
+ {
276
+ id: 'upsell_01',
277
+ name: 'Upsell 01',
278
+ type: 'upsell',
279
+ price: 97,
280
+ currency: 'BRL',
281
+ quantity: 1,
282
+ },
283
+ ] },
284
+ cart: {
285
+ mode: 'single_product',
286
+ initialItems: [
287
+ { productId: 'main_offer', quantity: 1 },
288
+ { productId: 'order_bump_01', quantity: 1 },
289
+ ],
290
+ calculateValueFrom: 'cart',
291
+ allowDynamicItems: true,
292
+ },
293
+ mappings: {
294
+ attributes: {
295
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
296
+ productName: ['data-product-name', 'data-name'],
297
+ price: ['data-product-price', 'data-price'],
298
+ quantity: ['data-quantity', 'data-qty'],
299
+ currency: ['data-currency'],
300
+ },
301
+ fields: {
302
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
303
+ productName: ['productName', 'product_name'],
304
+ price: ['price', 'amount'],
305
+ quantity: ['quantity', 'qty'],
306
+ currency: ['currency'],
307
+ email: ['email', 'customerEmail'],
308
+ phone: ['phone', 'telefone', 'customerPhone'],
309
+ },
310
+ },
311
+ enrichment: {
312
+ pageView: { enabled: false, source: 'cart' },
313
+ viewContent: { enabled: true, source: 'event_or_cart' },
314
+ lead: { enabled: false, source: 'event_or_cart' },
315
+ addToCart: { enabled: true, source: 'event_or_cart' },
316
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
317
+ initiateCheckout: { enabled: true, source: 'cart' },
318
+ addPaymentInfo: { enabled: true, source: 'cart' },
319
+ purchase: { enabled: true, source: 'cart' },
320
+ }
321
+ },
215
322
  modules: {
216
323
  ...base.modules,
217
324
  core: {
@@ -226,131 +333,31 @@ code { font-size: 0.85em; }
226
333
  },
227
334
  behavior: { ...base.modules.behavior, enabled: false },
228
335
  privacy: { ...base.modules.privacy, enabled: false },
229
- transport: {
230
- enabled: true,
231
- mockSender: { enabled: false },
232
- sender: { mode: 'http' },
233
- persistence: { enabled: true },
234
- replay: { enabled: true },
235
- ordering: { enabled: true },
236
- coordination: { enabled: true },
237
- circuitBreaker: {
238
- enabled: true,
239
- failureThreshold: 5,
240
- resetTimeoutMs: 30000,
241
- halfOpenMaxAttempts: 2,
242
- },
243
- backpressure: {
244
- enabled: true,
245
- maxQueueSize: 500,
246
- policy: 'drop_oldest',
247
- sampleRate: 0.5,
248
- },
249
- deadLetter: { enabled: true, maxEntries: 200 },
250
- compression: { enabled: true, strategy: 'identity' },
251
- retry: {
252
- enabled: true,
253
- maxAttempts: 4,
254
- baseDelayMs: 500,
255
- maxDelayMs: 4000,
256
- multiplier: 2,
257
- },
258
- batch: {
259
- enabled: true,
260
- batchSize: 10,
261
- flushIntervalMs: 2000,
262
- maxWaitMs: 5000,
263
- },
264
- timeout: { enabled: true, timeoutMs: 10000 },
265
- offline: { enabled: true },
266
- flush: {
267
- enabled: true,
268
- flushIntervalMs: 2000,
269
- flushOnDestroy: true,
270
- prepareUnloadHooks: true,
271
- },
272
- },
273
336
  integrations: { ...base.modules.integrations, enabled: false },
274
337
  conversion: {
275
338
  enabled: true,
276
- commerce: {
277
- currency: 'BRL',
278
- catalog: { products: [
279
- {
280
- id: 'main_offer',
281
- name: 'Oferta Principal',
282
- type: 'main',
283
- price: 197,
284
- currency: 'BRL',
285
- quantity: 1,
286
- },
287
- {
288
- id: 'order_bump_01',
289
- name: 'Order Bump Especial',
290
- type: 'order_bump',
291
- price: 47,
292
- currency: 'BRL',
293
- quantity: 1,
294
- },
295
- {
296
- id: 'upsell_01',
297
- name: 'Upsell 01',
298
- type: 'upsell',
299
- price: 97,
300
- currency: 'BRL',
301
- quantity: 1,
302
- },
303
- ] },
304
- checkout: {
305
- mode: 'single_product',
306
- selectedItems: [
307
- { productId: 'main_offer', quantity: 1 },
308
- { productId: 'order_bump_01', quantity: 1 },
309
- ],
310
- calculateValueFrom: 'selected_items',
311
- allowDynamicItems: true,
312
- },
313
- mappings: {
314
- attributes: {
315
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
316
- productName: ['data-product-name', 'data-name'],
317
- price: ['data-product-price', 'data-price'],
318
- quantity: ['data-quantity', 'data-qty'],
319
- currency: ['data-currency'],
320
- },
321
- fields: {
322
- productId: ['productId', 'product_id', 'offerId', 'sku'],
323
- productName: ['productName', 'product_name'],
324
- price: ['price', 'amount'],
325
- quantity: ['quantity', 'qty'],
326
- currency: ['currency'],
327
- email: ['email', 'customerEmail'],
328
- phone: ['phone', 'telefone', 'customerPhone'],
329
- },
330
- },
331
- },
332
339
  manual: {
333
340
  pageView: { enabled: false },
334
- purchase: { enabled: false },
335
- lead: { enabled: false },
341
+ purchase: { enabled: false, sources: [] },
342
+ lead: { enabled: false, sources: [] },
336
343
  addToCart: { enabled: true },
337
344
  removeFromCart: { enabled: true },
338
- initiateCheckout: { enabled: false },
339
- addPaymentInfo: { enabled: false },
340
- search: { enabled: false },
341
- viewContent: { enabled: false },
345
+ initiateCheckout: { enabled: false, sources: [] },
346
+ addPaymentInfo: { enabled: false, sources: [] },
347
+ search: { enabled: false, sources: [] },
348
+ viewContent: { enabled: false, sources: [] },
342
349
  },
343
350
  auto: {
344
351
  enabled: true,
345
352
  detectors: {
346
- lead: { enabled: false },
347
- purchase: { enabled: false },
348
- addToCart: { enabled: false },
353
+ lead: { enabled: false, sources: [] },
354
+ purchase: { enabled: false, sources: [] },
355
+ addToCart: { enabled: false, sources: [] },
349
356
  removeFromCart: removeFromCartDetectorConfig(),
350
- initiateCheckout: { enabled: false },
351
- addPaymentInfo: { enabled: false },
352
- search: { enabled: false },
353
- viewContent: { enabled: false },
357
+ initiateCheckout: { enabled: false, sources: [] },
358
+ addPaymentInfo: { enabled: false, sources: [] },
359
+ search: { enabled: false, sources: [] },
360
+ viewContent: { enabled: false, sources: [] },
354
361
  },
355
362
  },
356
363
  rules: {