@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
@@ -168,7 +168,7 @@ code { font-size: 0.85em; }
168
168
  </div>
169
169
  </div>
170
170
 
171
- <script src="../../../dist/v2/global.global.js"></script>
171
+ <script src="../../../v2/global.global.js"></script>
172
172
  <script>
173
173
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
174
174
  const API_ENDPOINT =
@@ -195,10 +195,19 @@ code { font-size: 0.85em; }
195
195
 
196
196
  function removeFromCartDetectorConfig() {
197
197
  return {
198
- enabled: true,
199
- selector: ['[data-track="remove_from_cart"]'],
200
- selectorType: 'css',
201
- };
198
+ enabled: true,
199
+ sources: [
200
+ {
201
+ name: 'removeFromCart-selector',
202
+ type: 'selector',
203
+ selector: [
204
+ '[data-track=\'remove_from_cart\']'
205
+ ],
206
+ selectorType: 'css',
207
+ trigger: 'click'
208
+ }
209
+ ]
210
+ };
202
211
  }
203
212
 
204
213
  function buildConfig() {
@@ -212,11 +221,116 @@ code { font-size: 0.85em; }
212
221
  debug: true,
213
222
  },
214
223
  transport: {
215
- ...DEFAULT_PIXEL_CONFIG.transport,
216
- apiEndpoint: API_ENDPOINT,
217
- timeoutMs: 10000,
224
+ ...base.transport,
225
+ enabled: true,
226
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
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
+ maxWaitMs: 5000,
256
+ },
257
+ timeout: { enabled: true, timeoutMs: 10000 },
258
+ offline: { enabled: true },
259
+ flush: {
260
+ enabled: true,
261
+ flushOnDestroy: true,
262
+ prepareUnloadHooks: true,
263
+ },
218
264
  },
219
265
  identity: { ...base.identity, pixelId: PIXEL_ID },
266
+ commerce: {
267
+ enabled: true,
268
+ currency: 'BRL',
269
+ catalog: { products: [
270
+ {
271
+ id: 'main_offer',
272
+ name: 'Oferta Principal',
273
+ type: 'main',
274
+ price: 197,
275
+ currency: 'BRL',
276
+ quantity: 1,
277
+ },
278
+ {
279
+ id: 'order_bump_01',
280
+ name: 'Order Bump Especial',
281
+ type: 'order_bump',
282
+ price: 47,
283
+ currency: 'BRL',
284
+ quantity: 1,
285
+ },
286
+ {
287
+ id: 'upsell_01',
288
+ name: 'Upsell 01',
289
+ type: 'upsell',
290
+ price: 97,
291
+ currency: 'BRL',
292
+ quantity: 1,
293
+ },
294
+ ] },
295
+ cart: {
296
+ mode: 'single_product',
297
+ initialItems: [
298
+ { productId: 'main_offer', quantity: 1 },
299
+ { productId: 'order_bump_01', quantity: 1 },
300
+ { productId: 'upsell_01', quantity: 1 },
301
+ ],
302
+ calculateValueFrom: 'cart',
303
+ allowDynamicItems: true,
304
+ },
305
+ mappings: {
306
+ attributes: {
307
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
308
+ productName: ['data-product-name', 'data-name'],
309
+ price: ['data-product-price', 'data-price'],
310
+ quantity: ['data-quantity', 'data-qty'],
311
+ currency: ['data-currency'],
312
+ },
313
+ fields: {
314
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
315
+ productName: ['productName', 'product_name'],
316
+ price: ['price', 'amount'],
317
+ quantity: ['quantity', 'qty'],
318
+ currency: ['currency'],
319
+ email: ['email', 'customerEmail'],
320
+ phone: ['phone', 'telefone', 'customerPhone'],
321
+ },
322
+ },
323
+ enrichment: {
324
+ pageView: { enabled: false, source: 'cart' },
325
+ viewContent: { enabled: true, source: 'event_or_cart' },
326
+ lead: { enabled: false, source: 'event_or_cart' },
327
+ addToCart: { enabled: true, source: 'event_or_cart' },
328
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
329
+ initiateCheckout: { enabled: true, source: 'cart' },
330
+ addPaymentInfo: { enabled: true, source: 'cart' },
331
+ purchase: { enabled: true, source: 'cart' },
332
+ }
333
+ },
220
334
  modules: {
221
335
  ...base.modules,
222
336
  core: {
@@ -231,132 +345,31 @@ code { font-size: 0.85em; }
231
345
  },
232
346
  behavior: { ...base.modules.behavior, enabled: false },
233
347
  privacy: { ...base.modules.privacy, enabled: false },
234
- transport: {
235
- enabled: true,
236
- mockSender: { enabled: false },
237
- sender: { mode: 'http' },
238
- persistence: { enabled: true },
239
- replay: { enabled: true },
240
- ordering: { enabled: true },
241
- coordination: { enabled: true },
242
- circuitBreaker: {
243
- enabled: true,
244
- failureThreshold: 5,
245
- resetTimeoutMs: 30000,
246
- halfOpenMaxAttempts: 2,
247
- },
248
- backpressure: {
249
- enabled: true,
250
- maxQueueSize: 500,
251
- policy: 'drop_oldest',
252
- sampleRate: 0.5,
253
- },
254
- deadLetter: { enabled: true, maxEntries: 200 },
255
- compression: { enabled: true, strategy: 'identity' },
256
- retry: {
257
- enabled: true,
258
- maxAttempts: 4,
259
- baseDelayMs: 500,
260
- maxDelayMs: 4000,
261
- multiplier: 2,
262
- },
263
- batch: {
264
- enabled: true,
265
- batchSize: 10,
266
- flushIntervalMs: 2000,
267
- maxWaitMs: 5000,
268
- },
269
- timeout: { enabled: true, timeoutMs: 10000 },
270
- offline: { enabled: true },
271
- flush: {
272
- enabled: true,
273
- flushIntervalMs: 2000,
274
- flushOnDestroy: true,
275
- prepareUnloadHooks: true,
276
- },
277
- },
278
348
  integrations: { ...base.modules.integrations, enabled: false },
279
349
  conversion: {
280
350
  enabled: true,
281
- commerce: {
282
- currency: 'BRL',
283
- catalog: { products: [
284
- {
285
- id: 'main_offer',
286
- name: 'Oferta Principal',
287
- type: 'main',
288
- price: 197,
289
- currency: 'BRL',
290
- quantity: 1,
291
- },
292
- {
293
- id: 'order_bump_01',
294
- name: 'Order Bump Especial',
295
- type: 'order_bump',
296
- price: 47,
297
- currency: 'BRL',
298
- quantity: 1,
299
- },
300
- {
301
- id: 'upsell_01',
302
- name: 'Upsell 01',
303
- type: 'upsell',
304
- price: 97,
305
- currency: 'BRL',
306
- quantity: 1,
307
- },
308
- ] },
309
- checkout: {
310
- mode: 'single_product',
311
- selectedItems: [
312
- { productId: 'main_offer', quantity: 1 },
313
- { productId: 'order_bump_01', quantity: 1 },
314
- { productId: 'upsell_01', quantity: 1 },
315
- ],
316
- calculateValueFrom: 'selected_items',
317
- allowDynamicItems: true,
318
- },
319
- mappings: {
320
- attributes: {
321
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
322
- productName: ['data-product-name', 'data-name'],
323
- price: ['data-product-price', 'data-price'],
324
- quantity: ['data-quantity', 'data-qty'],
325
- currency: ['data-currency'],
326
- },
327
- fields: {
328
- productId: ['productId', 'product_id', 'offerId', 'sku'],
329
- productName: ['productName', 'product_name'],
330
- price: ['price', 'amount'],
331
- quantity: ['quantity', 'qty'],
332
- currency: ['currency'],
333
- email: ['email', 'customerEmail'],
334
- phone: ['phone', 'telefone', 'customerPhone'],
335
- },
336
- },
337
- },
338
351
  manual: {
339
352
  pageView: { enabled: false },
340
- purchase: { enabled: false },
341
- lead: { enabled: false },
353
+ purchase: { enabled: false, sources: [] },
354
+ lead: { enabled: false, sources: [] },
342
355
  addToCart: { enabled: true },
343
356
  removeFromCart: { enabled: true },
344
- initiateCheckout: { enabled: false },
345
- addPaymentInfo: { enabled: false },
346
- search: { enabled: false },
347
- viewContent: { enabled: false },
357
+ initiateCheckout: { enabled: false, sources: [] },
358
+ addPaymentInfo: { enabled: false, sources: [] },
359
+ search: { enabled: false, sources: [] },
360
+ viewContent: { enabled: false, sources: [] },
348
361
  },
349
362
  auto: {
350
363
  enabled: true,
351
364
  detectors: {
352
- lead: { enabled: false },
353
- purchase: { enabled: false },
354
- addToCart: { enabled: false },
365
+ lead: { enabled: false, sources: [] },
366
+ purchase: { enabled: false, sources: [] },
367
+ addToCart: { enabled: false, sources: [] },
355
368
  removeFromCart: removeFromCartDetectorConfig(),
356
- initiateCheckout: { enabled: false },
357
- addPaymentInfo: { enabled: false },
358
- search: { enabled: false },
359
- viewContent: { enabled: false },
369
+ initiateCheckout: { enabled: false, sources: [] },
370
+ addPaymentInfo: { enabled: false, sources: [] },
371
+ search: { enabled: false, sources: [] },
372
+ viewContent: { enabled: false, sources: [] },
360
373
  },
361
374
  },
362
375
  rules: {
@@ -95,7 +95,7 @@ code { font-size: 0.85em; }
95
95
  <a href="example-remove-from-cart-multi.html" class="">7. Multi item</a></div>
96
96
  <div class="hint"><strong>Contexto:</strong> efeito no state — <code>REMOVE_FROM_CART</code>
97
97
  chama <code>removeItem</code> quando <code>allowDynamicItems=true</code>.
98
- Seed visual + selectedItems; remova e confira o mirror.</div>
98
+ Seed visual + initialItems; remova e confira o mirror.</div>
99
99
 
100
100
  <div class="card">
101
101
  <h2>Lifecycle</h2>
@@ -112,7 +112,7 @@ code { font-size: 0.85em; }
112
112
  <div class="card">
113
113
  <h2>State sync <span class="pill">removeItem</span></h2>
114
114
  <div class="ctx">
115
- selectedItems inicia com main + bump. Remover atualiza state interno
115
+ initialItems inicia com main + bump. Remover atualiza state interno
116
116
  (espelhado no painel via eventos).
117
117
  </div>
118
118
  <div class="product">
@@ -182,7 +182,7 @@ code { font-size: 0.85em; }
182
182
  </div>
183
183
  </div>
184
184
 
185
- <script src="../../../dist/v2/global.global.js"></script>
185
+ <script src="../../../v2/global.global.js"></script>
186
186
  <script>
187
187
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
188
188
  const API_ENDPOINT =
@@ -209,10 +209,19 @@ code { font-size: 0.85em; }
209
209
 
210
210
  function removeFromCartDetectorConfig() {
211
211
  return {
212
- enabled: true,
213
- selector: ['[data-track="remove_from_cart"]'],
214
- selectorType: 'css',
215
- };
212
+ enabled: true,
213
+ sources: [
214
+ {
215
+ name: 'removeFromCart-selector',
216
+ type: 'selector',
217
+ selector: [
218
+ '[data-track=\'remove_from_cart\']'
219
+ ],
220
+ selectorType: 'css',
221
+ trigger: 'click'
222
+ }
223
+ ]
224
+ };
216
225
  }
217
226
 
218
227
  function buildConfig() {
@@ -226,11 +235,115 @@ code { font-size: 0.85em; }
226
235
  debug: true,
227
236
  },
228
237
  transport: {
229
- ...DEFAULT_PIXEL_CONFIG.transport,
230
- apiEndpoint: API_ENDPOINT,
231
- timeoutMs: 10000,
238
+ ...base.transport,
239
+ enabled: true,
240
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
241
+ persistence: { enabled: true },
242
+ replay: { enabled: true },
243
+ ordering: { enabled: true },
244
+ coordination: { enabled: true },
245
+ circuitBreaker: {
246
+ enabled: true,
247
+ failureThreshold: 5,
248
+ resetTimeoutMs: 30000,
249
+ halfOpenMaxAttempts: 2,
250
+ },
251
+ backpressure: {
252
+ enabled: true,
253
+ maxQueueSize: 500,
254
+ policy: 'drop_oldest',
255
+ sampleRate: 0.5,
256
+ },
257
+ deadLetter: { enabled: true, maxEntries: 200 },
258
+ compression: { enabled: true, strategy: 'identity' },
259
+ retry: {
260
+ enabled: true,
261
+ maxAttempts: 4,
262
+ baseDelayMs: 500,
263
+ maxDelayMs: 4000,
264
+ multiplier: 2,
265
+ },
266
+ batch: {
267
+ enabled: true,
268
+ batchSize: 10,
269
+ maxWaitMs: 5000,
270
+ },
271
+ timeout: { enabled: true, timeoutMs: 10000 },
272
+ offline: { enabled: true },
273
+ flush: {
274
+ enabled: true,
275
+ flushOnDestroy: true,
276
+ prepareUnloadHooks: true,
277
+ },
232
278
  },
233
279
  identity: { ...base.identity, pixelId: PIXEL_ID },
280
+ commerce: {
281
+ enabled: true,
282
+ currency: 'BRL',
283
+ catalog: { products: [
284
+ {
285
+ id: 'main_offer',
286
+ name: 'Oferta Principal',
287
+ type: 'main',
288
+ price: 197,
289
+ currency: 'BRL',
290
+ quantity: 1,
291
+ },
292
+ {
293
+ id: 'order_bump_01',
294
+ name: 'Order Bump Especial',
295
+ type: 'order_bump',
296
+ price: 47,
297
+ currency: 'BRL',
298
+ quantity: 1,
299
+ },
300
+ {
301
+ id: 'upsell_01',
302
+ name: 'Upsell 01',
303
+ type: 'upsell',
304
+ price: 97,
305
+ currency: 'BRL',
306
+ quantity: 1,
307
+ },
308
+ ] },
309
+ cart: {
310
+ mode: 'single_product',
311
+ initialItems: [
312
+ { productId: 'main_offer', quantity: 1 },
313
+ { productId: 'order_bump_01', quantity: 1 },
314
+ ],
315
+ calculateValueFrom: 'cart',
316
+ allowDynamicItems: true,
317
+ },
318
+ mappings: {
319
+ attributes: {
320
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
321
+ productName: ['data-product-name', 'data-name'],
322
+ price: ['data-product-price', 'data-price'],
323
+ quantity: ['data-quantity', 'data-qty'],
324
+ currency: ['data-currency'],
325
+ },
326
+ fields: {
327
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
328
+ productName: ['productName', 'product_name'],
329
+ price: ['price', 'amount'],
330
+ quantity: ['quantity', 'qty'],
331
+ currency: ['currency'],
332
+ email: ['email', 'customerEmail'],
333
+ phone: ['phone', 'telefone', 'customerPhone'],
334
+ },
335
+ },
336
+ enrichment: {
337
+ pageView: { enabled: false, source: 'cart' },
338
+ viewContent: { enabled: true, source: 'event_or_cart' },
339
+ lead: { enabled: false, source: 'event_or_cart' },
340
+ addToCart: { enabled: true, source: 'event_or_cart' },
341
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
342
+ initiateCheckout: { enabled: true, source: 'cart' },
343
+ addPaymentInfo: { enabled: true, source: 'cart' },
344
+ purchase: { enabled: true, source: 'cart' },
345
+ }
346
+ },
234
347
  modules: {
235
348
  ...base.modules,
236
349
  core: {
@@ -245,131 +358,31 @@ code { font-size: 0.85em; }
245
358
  },
246
359
  behavior: { ...base.modules.behavior, enabled: false },
247
360
  privacy: { ...base.modules.privacy, enabled: false },
248
- transport: {
249
- enabled: true,
250
- mockSender: { enabled: false },
251
- sender: { mode: 'http' },
252
- persistence: { enabled: true },
253
- replay: { enabled: true },
254
- ordering: { enabled: true },
255
- coordination: { enabled: true },
256
- circuitBreaker: {
257
- enabled: true,
258
- failureThreshold: 5,
259
- resetTimeoutMs: 30000,
260
- halfOpenMaxAttempts: 2,
261
- },
262
- backpressure: {
263
- enabled: true,
264
- maxQueueSize: 500,
265
- policy: 'drop_oldest',
266
- sampleRate: 0.5,
267
- },
268
- deadLetter: { enabled: true, maxEntries: 200 },
269
- compression: { enabled: true, strategy: 'identity' },
270
- retry: {
271
- enabled: true,
272
- maxAttempts: 4,
273
- baseDelayMs: 500,
274
- maxDelayMs: 4000,
275
- multiplier: 2,
276
- },
277
- batch: {
278
- enabled: true,
279
- batchSize: 10,
280
- flushIntervalMs: 2000,
281
- maxWaitMs: 5000,
282
- },
283
- timeout: { enabled: true, timeoutMs: 10000 },
284
- offline: { enabled: true },
285
- flush: {
286
- enabled: true,
287
- flushIntervalMs: 2000,
288
- flushOnDestroy: true,
289
- prepareUnloadHooks: true,
290
- },
291
- },
292
361
  integrations: { ...base.modules.integrations, enabled: false },
293
362
  conversion: {
294
363
  enabled: true,
295
- commerce: {
296
- currency: 'BRL',
297
- catalog: { products: [
298
- {
299
- id: 'main_offer',
300
- name: 'Oferta Principal',
301
- type: 'main',
302
- price: 197,
303
- currency: 'BRL',
304
- quantity: 1,
305
- },
306
- {
307
- id: 'order_bump_01',
308
- name: 'Order Bump Especial',
309
- type: 'order_bump',
310
- price: 47,
311
- currency: 'BRL',
312
- quantity: 1,
313
- },
314
- {
315
- id: 'upsell_01',
316
- name: 'Upsell 01',
317
- type: 'upsell',
318
- price: 97,
319
- currency: 'BRL',
320
- quantity: 1,
321
- },
322
- ] },
323
- checkout: {
324
- mode: 'single_product',
325
- selectedItems: [
326
- { productId: 'main_offer', quantity: 1 },
327
- { productId: 'order_bump_01', quantity: 1 },
328
- ],
329
- calculateValueFrom: 'selected_items',
330
- allowDynamicItems: true,
331
- },
332
- mappings: {
333
- attributes: {
334
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
335
- productName: ['data-product-name', 'data-name'],
336
- price: ['data-product-price', 'data-price'],
337
- quantity: ['data-quantity', 'data-qty'],
338
- currency: ['data-currency'],
339
- },
340
- fields: {
341
- productId: ['productId', 'product_id', 'offerId', 'sku'],
342
- productName: ['productName', 'product_name'],
343
- price: ['price', 'amount'],
344
- quantity: ['quantity', 'qty'],
345
- currency: ['currency'],
346
- email: ['email', 'customerEmail'],
347
- phone: ['phone', 'telefone', 'customerPhone'],
348
- },
349
- },
350
- },
351
364
  manual: {
352
365
  pageView: { enabled: false },
353
- purchase: { enabled: false },
354
- lead: { enabled: false },
366
+ purchase: { enabled: false, sources: [] },
367
+ lead: { enabled: false, sources: [] },
355
368
  addToCart: { enabled: true },
356
369
  removeFromCart: { enabled: true },
357
- initiateCheckout: { enabled: false },
358
- addPaymentInfo: { enabled: false },
359
- search: { enabled: false },
360
- viewContent: { enabled: false },
370
+ initiateCheckout: { enabled: false, sources: [] },
371
+ addPaymentInfo: { enabled: false, sources: [] },
372
+ search: { enabled: false, sources: [] },
373
+ viewContent: { enabled: false, sources: [] },
361
374
  },
362
375
  auto: {
363
376
  enabled: true,
364
377
  detectors: {
365
- lead: { enabled: false },
366
- purchase: { enabled: false },
367
- addToCart: { enabled: false },
378
+ lead: { enabled: false, sources: [] },
379
+ purchase: { enabled: false, sources: [] },
380
+ addToCart: { enabled: false, sources: [] },
368
381
  removeFromCart: removeFromCartDetectorConfig(),
369
- initiateCheckout: { enabled: false },
370
- addPaymentInfo: { enabled: false },
371
- search: { enabled: false },
372
- viewContent: { enabled: false },
382
+ initiateCheckout: { enabled: false, sources: [] },
383
+ addPaymentInfo: { enabled: false, sources: [] },
384
+ search: { enabled: false, sources: [] },
385
+ viewContent: { enabled: false, sources: [] },
373
386
  },
374
387
  },
375
388
  rules: {