@beworke/pixel 0.1.0-rc.1 → 0.1.0-rc.6

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 (156) hide show
  1. package/CHANGELOG.md +260 -4
  2. package/README.md +65 -118
  3. package/RELEASE_CANDIDATE.md +181 -36
  4. package/dist/{StorageFactory-BhpbB6Jj.d.mts → StorageFactory-CPghDPBj.d.mts} +2 -2
  5. package/dist/{StorageFactory-CAkJJqVD.d.ts → StorageFactory-tjfzk57c.d.ts} +2 -2
  6. package/dist/config/index.cjs.js +1 -1
  7. package/dist/config/index.cjs.js.map +1 -1
  8. package/dist/config/index.d.mts +4 -3
  9. package/dist/config/index.d.ts +4 -3
  10. package/dist/config/index.esm.js +1 -1
  11. package/dist/config/index.esm.js.map +1 -1
  12. package/dist/events/index.cjs.js +1 -1
  13. package/dist/events/index.cjs.js.map +1 -1
  14. package/dist/events/index.d.mts +2 -1
  15. package/dist/events/index.d.ts +2 -1
  16. package/dist/events/index.esm.js +1 -1
  17. package/dist/events/index.esm.js.map +1 -1
  18. package/dist/examples/html-script/README.md +24 -2
  19. package/dist/examples/html-script/RELEASE_CANDIDATE.md +20 -6
  20. package/dist/examples/html-script/add-payment-info/README.md +3 -3
  21. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +66 -48
  22. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +66 -48
  23. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +65 -47
  24. package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +73 -47
  25. package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +65 -47
  26. package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +56 -47
  27. package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +65 -47
  28. package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +65 -47
  29. package/dist/examples/html-script/add-to-cart/README.md +3 -3
  30. package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +90 -70
  31. package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +103 -81
  32. package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +101 -78
  33. package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +90 -70
  34. package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +81 -67
  35. package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +90 -70
  36. package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +104 -81
  37. package/dist/examples/html-script/behavior/example-behavior-engagement.html +489 -0
  38. package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +350 -0
  39. package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +433 -0
  40. package/dist/examples/html-script/behavior/example-behavior-viewport.html +397 -0
  41. package/dist/examples/html-script/{example-behavior.html → behavior/example-behavior.html} +23 -17
  42. package/dist/examples/html-script/example-checkout-commerce.html +825 -0
  43. package/dist/examples/html-script/example-integration.html +5 -5
  44. package/dist/examples/html-script/example-landing-commerce.html +380 -0
  45. package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
  46. package/dist/examples/html-script/example-transport.html +5 -5
  47. package/dist/examples/html-script/full-funnel/README.md +64 -0
  48. package/dist/examples/html-script/full-funnel/checkout.html +116 -0
  49. package/dist/examples/html-script/full-funnel/downsell.html +58 -0
  50. package/dist/examples/html-script/full-funnel/landing.html +99 -0
  51. package/dist/examples/html-script/full-funnel/thank-you.html +85 -0
  52. package/dist/examples/html-script/full-funnel/upsell.html +64 -0
  53. package/dist/examples/html-script/initiate-checkout/README.md +6 -6
  54. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +94 -74
  55. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +102 -80
  56. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +103 -80
  57. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +86 -72
  58. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +95 -75
  59. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +103 -83
  60. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +105 -82
  61. package/dist/examples/html-script/lead/README.md +9 -7
  62. package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +67 -47
  63. package/dist/examples/html-script/lead/example-lead-trigger-auto.html +78 -56
  64. package/dist/examples/html-script/lead/example-lead-trigger-click.html +78 -55
  65. package/dist/examples/html-script/release-candidate.html +187 -76
  66. package/dist/examples/html-script/remove-from-cart/README.md +1 -1
  67. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +93 -73
  68. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +93 -73
  69. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +93 -73
  70. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +84 -70
  71. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +94 -74
  72. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +95 -75
  73. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +98 -76
  74. package/dist/examples/html-script/search/README.md +1 -1
  75. package/dist/examples/html-script/search/example-search-attribute.html +66 -51
  76. package/dist/examples/html-script/search/example-search-button-sync.html +66 -51
  77. package/dist/examples/html-script/search/example-search-dedupe.html +66 -51
  78. package/dist/examples/html-script/search/example-search-input.html +67 -51
  79. package/dist/examples/html-script/search/example-search-manual.html +57 -48
  80. package/dist/examples/html-script/search/example-search-submit.html +66 -51
  81. package/dist/examples/html-script/search/example-search-text.html +71 -51
  82. package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +63 -0
  83. package/dist/examples/html-script/url-context/example-url-context-landing.html +70 -0
  84. package/dist/examples/html-script/url-context/example-url-context-upsell.html +67 -0
  85. package/dist/examples/html-script/url-context/example-url-context.html +171 -0
  86. package/dist/examples/html-script/view-content/README.md +1 -1
  87. package/dist/examples/html-script/view-content/example-view-content-attribute.html +85 -70
  88. package/dist/examples/html-script/view-content/example-view-content-css.html +85 -70
  89. package/dist/examples/html-script/view-content/example-view-content-dedupe.html +85 -70
  90. package/dist/examples/html-script/view-content/example-view-content-empty.html +85 -70
  91. package/dist/examples/html-script/view-content/example-view-content-manual.html +76 -67
  92. package/dist/examples/html-script/view-content/example-view-content-product-card.html +85 -70
  93. package/dist/examples/html-script/view-content/example-view-content-text.html +90 -73
  94. package/dist/examples/v2/README.md +4 -1
  95. package/dist/{index-DUfFzniE.d.ts → index-CQAyT5Od.d.ts} +170 -3
  96. package/dist/{index-DUfFzniE.d.mts → index-JlKPz4pp.d.mts} +170 -3
  97. package/dist/index.cjs.js +1 -1
  98. package/dist/index.cjs.js.map +1 -1
  99. package/dist/index.d.mts +435 -12
  100. package/dist/index.d.ts +435 -12
  101. package/dist/index.esm.js +1 -1
  102. package/dist/index.esm.js.map +1 -1
  103. package/dist/{pixel-CbeF25mD.d.mts → pixel-BxZZx8l5.d.ts} +248 -72
  104. package/dist/{pixel-CbeF25mD.d.ts → pixel-CKc4OQUx.d.mts} +248 -72
  105. package/dist/{pixel-default-config-1VgLFOiL.d.mts → pixel-default-config-CJl-eypl.d.mts} +1 -1
  106. package/dist/{pixel-default-config-Bxb-Vdd8.d.ts → pixel-default-config-aAOujzwp.d.ts} +1 -1
  107. package/dist/runtime/index.cjs.js +1 -1
  108. package/dist/runtime/index.cjs.js.map +1 -1
  109. package/dist/runtime/index.d.mts +19 -26
  110. package/dist/runtime/index.d.ts +19 -26
  111. package/dist/runtime/index.esm.js +1 -1
  112. package/dist/runtime/index.esm.js.map +1 -1
  113. package/dist/services/index.cjs.js +1 -1
  114. package/dist/services/index.cjs.js.map +1 -1
  115. package/dist/services/index.d.mts +14 -6
  116. package/dist/services/index.d.ts +14 -6
  117. package/dist/services/index.esm.js +1 -1
  118. package/dist/services/index.esm.js.map +1 -1
  119. package/dist/types-BP8dz1gP.d.mts +19 -0
  120. package/dist/types-C75pQP31.d.ts +19 -0
  121. package/dist/types-DMhzHSVC.d.mts +293 -0
  122. package/dist/types-D_SsCur9.d.ts +293 -0
  123. package/dist/url-context-BjAsQoVl.d.mts +85 -0
  124. package/dist/url-context-BjAsQoVl.d.ts +85 -0
  125. package/dist/v2/global.global.js +1 -1
  126. package/dist/v2/global.global.js.map +1 -1
  127. package/dist/v2/index.cjs.js +1 -1
  128. package/dist/v2/index.cjs.js.map +1 -1
  129. package/dist/v2/index.d.mts +8 -6
  130. package/dist/v2/index.d.ts +8 -6
  131. package/dist/v2/index.esm.js +1 -1
  132. package/dist/v2/index.esm.js.map +1 -1
  133. package/docs/public/README.md +75 -0
  134. package/docs/public/api/exports.md +47 -0
  135. package/docs/public/api/pixel.md +65 -0
  136. package/docs/public/configuration/commerce.md +44 -0
  137. package/docs/public/configuration/modules.md +66 -0
  138. package/docs/public/configuration/overview.md +66 -0
  139. package/docs/public/events/catalog.md +65 -0
  140. package/docs/public/getting-started/installation.md +75 -0
  141. package/docs/public/getting-started/quick-start.md +77 -0
  142. package/docs/public/getting-started/react-nextjs.md +55 -0
  143. package/docs/public/getting-started/script-tag.md +57 -0
  144. package/docs/public/guides/funnel-checkout.md +52 -0
  145. package/docs/public/guides/funnel-downsell.md +53 -0
  146. package/docs/public/guides/funnel-full.md +64 -0
  147. package/docs/public/guides/funnel-landing.md +68 -0
  148. package/docs/public/guides/funnel-thank-you.md +48 -0
  149. package/docs/public/guides/funnel-upsell.md +72 -0
  150. package/docs/public/limitations.md +32 -0
  151. package/docs/public/privacy/limitations.md +33 -0
  152. package/docs/public/release-candidate/validation.md +37 -0
  153. package/docs/public/troubleshooting.md +55 -0
  154. package/package.json +13 -1
  155. package/dist/types-CTpRvFKZ.d.ts +0 -71
  156. package/dist/types-DGlBdsAy.d.mts +0 -71
@@ -95,7 +95,7 @@ code { font-size: 0.85em; }
95
95
  <a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a></div>
96
96
  <div class="hint"><strong>Contexto:</strong> ao completar contato no checkout, dispara
97
97
  <code>ADD_TO_CART</code> automaticamente (input/change) com produto de
98
- <code>selectedItems</code> / catálogo. <code>fireOnce: true</code>.</div>
98
+ <code>initialItems</code> / catálogo. <code>fireOnce: true</code>.</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>Contato → add automático <span class="pill">selectorForm · auto</span></h2>
114
114
  <div class="ctx">
115
- selectedItems já tem <code>main_offer</code>. Completar email+phone
115
+ initialItems já tem <code>main_offer</code>. Completar email+phone
116
116
  dispara o add sem clicar.
117
117
  </div>
118
118
  <form id="checkout-contact-form">
@@ -141,7 +141,7 @@ code { font-size: 0.85em; }
141
141
  <li>[ ] Só email → não dispara</li>
142
142
  <li>[ ] Só phone → não dispara</li>
143
143
  <li>[ ] Ambos via input → <code>ADD_TO_CART</code> automático</li>
144
- <li>[ ] Payload enriquecido (catalog / selectedItems)</li>
144
+ <li>[ ] Payload enriquecido (catalog / initialItems)</li>
145
145
  <li>[ ] fireOnce impede duplicata</li>
146
146
  </ul>
147
147
  </div>
@@ -199,18 +199,29 @@ code { font-size: 0.85em; }
199
199
 
200
200
  function addToCartDetectorConfig() {
201
201
  return {
202
- enabled: true,
203
- selector: ['#checkout-contact-form'],
204
- selectorType: 'css',
205
- selectorForm: {
206
- fields: ['email', 'phone'],
207
- mode: 'all',
208
- formSelector: '#checkout-contact-form',
209
- trigger: 'auto',
210
- debounceMs: 300,
211
- fireOnce: true,
212
- },
213
- };
202
+ enabled: true,
203
+ sources: [
204
+ {
205
+ name: 'addToCart-form',
206
+ type: 'form',
207
+ selectorForm: {
208
+ fields: [
209
+ 'email',
210
+ 'phone'
211
+ ],
212
+ mode: 'all',
213
+ formSelector: '#checkout-contact-form',
214
+ trigger: 'auto',
215
+ debounceMs: 300,
216
+ fireOnce: true
217
+ },
218
+ selector: [
219
+ '#checkout-contact-form'
220
+ ],
221
+ selectorType: 'css'
222
+ }
223
+ ]
224
+ };
214
225
  }
215
226
 
216
227
  function buildConfig() {
@@ -229,6 +240,70 @@ code { font-size: 0.85em; }
229
240
  timeoutMs: 10000,
230
241
  },
231
242
  identity: { ...base.identity, pixelId: PIXEL_ID },
243
+ commerce: {
244
+ enabled: true,
245
+ currency: 'BRL',
246
+ catalog: { products: [
247
+ {
248
+ id: 'main_offer',
249
+ name: 'Oferta Principal',
250
+ type: 'main',
251
+ price: 197,
252
+ currency: 'BRL',
253
+ quantity: 1,
254
+ },
255
+ {
256
+ id: 'order_bump_01',
257
+ name: 'Order Bump Especial',
258
+ type: 'order_bump',
259
+ price: 47,
260
+ currency: 'BRL',
261
+ quantity: 1,
262
+ },
263
+ {
264
+ id: 'upsell_01',
265
+ name: 'Upsell 01',
266
+ type: 'upsell',
267
+ price: 97,
268
+ currency: 'BRL',
269
+ quantity: 1,
270
+ },
271
+ ] },
272
+ cart: {
273
+ mode: 'single_product',
274
+ initialItems: [{ productId: "main_offer", quantity: 1 }],
275
+ calculateValueFrom: 'cart',
276
+ allowDynamicItems: true,
277
+ },
278
+ mappings: {
279
+ attributes: {
280
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
281
+ productName: ['data-product-name', 'data-name'],
282
+ price: ['data-product-price', 'data-price'],
283
+ quantity: ['data-quantity', 'data-qty'],
284
+ currency: ['data-currency'],
285
+ },
286
+ fields: {
287
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
288
+ productName: ['productName', 'product_name'],
289
+ price: ['price', 'amount'],
290
+ quantity: ['quantity', 'qty'],
291
+ currency: ['currency'],
292
+ email: ['email', 'customerEmail'],
293
+ phone: ['phone', 'telefone', 'customerPhone'],
294
+ },
295
+ },
296
+ enrichment: {
297
+ pageView: { enabled: false, source: 'cart' },
298
+ viewContent: { enabled: true, source: 'event_or_cart' },
299
+ lead: { enabled: false, source: 'event_or_cart' },
300
+ addToCart: { enabled: true, source: 'event_or_cart' },
301
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
302
+ initiateCheckout: { enabled: true, source: 'cart' },
303
+ addPaymentInfo: { enabled: true, source: 'cart' },
304
+ purchase: { enabled: true, source: 'cart' },
305
+ }
306
+ },
232
307
  modules: {
233
308
  ...base.modules,
234
309
  core: {
@@ -290,81 +365,28 @@ code { font-size: 0.85em; }
290
365
  integrations: { ...base.modules.integrations, enabled: false },
291
366
  conversion: {
292
367
  enabled: true,
293
- commerce: {
294
- currency: 'BRL',
295
- catalog: { products: [
296
- {
297
- id: 'main_offer',
298
- name: 'Oferta Principal',
299
- type: 'main',
300
- price: 197,
301
- currency: 'BRL',
302
- quantity: 1,
303
- },
304
- {
305
- id: 'order_bump_01',
306
- name: 'Order Bump Especial',
307
- type: 'order_bump',
308
- price: 47,
309
- currency: 'BRL',
310
- quantity: 1,
311
- },
312
- {
313
- id: 'upsell_01',
314
- name: 'Upsell 01',
315
- type: 'upsell',
316
- price: 97,
317
- currency: 'BRL',
318
- quantity: 1,
319
- },
320
- ] },
321
- checkout: {
322
- mode: 'single_product',
323
- selectedItems: [{ productId: "main_offer", quantity: 1 }],
324
- calculateValueFrom: 'selected_items',
325
- allowDynamicItems: true,
326
- },
327
- mappings: {
328
- attributes: {
329
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
330
- productName: ['data-product-name', 'data-name'],
331
- price: ['data-product-price', 'data-price'],
332
- quantity: ['data-quantity', 'data-qty'],
333
- currency: ['data-currency'],
334
- },
335
- fields: {
336
- productId: ['productId', 'product_id', 'offerId', 'sku'],
337
- productName: ['productName', 'product_name'],
338
- price: ['price', 'amount'],
339
- quantity: ['quantity', 'qty'],
340
- currency: ['currency'],
341
- email: ['email', 'customerEmail'],
342
- phone: ['phone', 'telefone', 'customerPhone'],
343
- },
344
- },
345
- },
346
368
  manual: {
347
369
  pageView: { enabled: false },
348
- purchase: { enabled: false },
349
- lead: { enabled: false },
370
+ purchase: { enabled: false, sources: [] },
371
+ lead: { enabled: false, sources: [] },
350
372
  addToCart: { enabled: true },
351
373
  removeFromCart: { enabled: true },
352
- initiateCheckout: { enabled: false },
353
- addPaymentInfo: { enabled: false },
354
- search: { enabled: false },
355
- viewContent: { enabled: false },
374
+ initiateCheckout: { enabled: false, sources: [] },
375
+ addPaymentInfo: { enabled: false, sources: [] },
376
+ search: { enabled: false, sources: [] },
377
+ viewContent: { enabled: false, sources: [] },
356
378
  },
357
379
  auto: {
358
380
  enabled: true,
359
381
  detectors: {
360
- lead: { enabled: false },
361
- purchase: { enabled: false },
382
+ lead: { enabled: false, sources: [] },
383
+ purchase: { enabled: false, sources: [] },
362
384
  addToCart: addToCartDetectorConfig(),
363
- removeFromCart: { enabled: false },
364
- initiateCheckout: { enabled: false },
365
- addPaymentInfo: { enabled: false },
366
- search: { enabled: false },
367
- viewContent: { enabled: false },
385
+ removeFromCart: { enabled: false, sources: [] },
386
+ initiateCheckout: { enabled: false, sources: [] },
387
+ addPaymentInfo: { enabled: false, sources: [] },
388
+ search: { enabled: false, sources: [] },
389
+ viewContent: { enabled: false, sources: [] },
368
390
  },
369
391
  },
370
392
  rules: {
@@ -206,18 +206,30 @@ code { font-size: 0.85em; }
206
206
 
207
207
  function addToCartDetectorConfig() {
208
208
  return {
209
- enabled: true,
210
- selector: ['[data-track="add_to_cart"]', 'text:Adicionar ao carrinho'],
211
- selectorType: 'css',
212
- selectorForm: {
213
- fields: ['email', 'phone'],
214
- mode: 'all',
215
- formSelector: '#checkout-form',
216
- trigger: 'click',
217
- debounceMs: 0,
218
- fireOnce: false,
219
- },
220
- };
209
+ enabled: true,
210
+ sources: [
211
+ {
212
+ name: 'addToCart-form',
213
+ type: 'form',
214
+ selectorForm: {
215
+ fields: [
216
+ 'email',
217
+ 'phone'
218
+ ],
219
+ mode: 'all',
220
+ formSelector: '#checkout-form',
221
+ trigger: 'click',
222
+ debounceMs: 0,
223
+ fireOnce: false
224
+ },
225
+ selector: [
226
+ '[data-track=\'add_to_cart\']',
227
+ 'text:Adicionar ao carrinho'
228
+ ],
229
+ selectorType: 'css'
230
+ }
231
+ ]
232
+ };
221
233
  }
222
234
 
223
235
  function buildConfig() {
@@ -236,6 +248,70 @@ code { font-size: 0.85em; }
236
248
  timeoutMs: 10000,
237
249
  },
238
250
  identity: { ...base.identity, pixelId: PIXEL_ID },
251
+ commerce: {
252
+ enabled: true,
253
+ currency: 'BRL',
254
+ catalog: { products: [
255
+ {
256
+ id: 'main_offer',
257
+ name: 'Oferta Principal',
258
+ type: 'main',
259
+ price: 197,
260
+ currency: 'BRL',
261
+ quantity: 1,
262
+ },
263
+ {
264
+ id: 'order_bump_01',
265
+ name: 'Order Bump Especial',
266
+ type: 'order_bump',
267
+ price: 47,
268
+ currency: 'BRL',
269
+ quantity: 1,
270
+ },
271
+ {
272
+ id: 'upsell_01',
273
+ name: 'Upsell 01',
274
+ type: 'upsell',
275
+ price: 97,
276
+ currency: 'BRL',
277
+ quantity: 1,
278
+ },
279
+ ] },
280
+ cart: {
281
+ mode: 'single_product',
282
+ initialItems: [{ productId: "main_offer", quantity: 1 }],
283
+ calculateValueFrom: 'cart',
284
+ allowDynamicItems: true,
285
+ },
286
+ mappings: {
287
+ attributes: {
288
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
289
+ productName: ['data-product-name', 'data-name'],
290
+ price: ['data-product-price', 'data-price'],
291
+ quantity: ['data-quantity', 'data-qty'],
292
+ currency: ['data-currency'],
293
+ },
294
+ fields: {
295
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
296
+ productName: ['productName', 'product_name'],
297
+ price: ['price', 'amount'],
298
+ quantity: ['quantity', 'qty'],
299
+ currency: ['currency'],
300
+ email: ['email', 'customerEmail'],
301
+ phone: ['phone', 'telefone', 'customerPhone'],
302
+ },
303
+ },
304
+ enrichment: {
305
+ pageView: { enabled: false, source: 'cart' },
306
+ viewContent: { enabled: true, source: 'event_or_cart' },
307
+ lead: { enabled: false, source: 'event_or_cart' },
308
+ addToCart: { enabled: true, source: 'event_or_cart' },
309
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
310
+ initiateCheckout: { enabled: true, source: 'cart' },
311
+ addPaymentInfo: { enabled: true, source: 'cart' },
312
+ purchase: { enabled: true, source: 'cart' },
313
+ }
314
+ },
239
315
  modules: {
240
316
  ...base.modules,
241
317
  core: {
@@ -297,81 +373,28 @@ code { font-size: 0.85em; }
297
373
  integrations: { ...base.modules.integrations, enabled: false },
298
374
  conversion: {
299
375
  enabled: true,
300
- commerce: {
301
- currency: 'BRL',
302
- catalog: { products: [
303
- {
304
- id: 'main_offer',
305
- name: 'Oferta Principal',
306
- type: 'main',
307
- price: 197,
308
- currency: 'BRL',
309
- quantity: 1,
310
- },
311
- {
312
- id: 'order_bump_01',
313
- name: 'Order Bump Especial',
314
- type: 'order_bump',
315
- price: 47,
316
- currency: 'BRL',
317
- quantity: 1,
318
- },
319
- {
320
- id: 'upsell_01',
321
- name: 'Upsell 01',
322
- type: 'upsell',
323
- price: 97,
324
- currency: 'BRL',
325
- quantity: 1,
326
- },
327
- ] },
328
- checkout: {
329
- mode: 'single_product',
330
- selectedItems: [{ productId: "main_offer", quantity: 1 }],
331
- calculateValueFrom: 'selected_items',
332
- allowDynamicItems: true,
333
- },
334
- mappings: {
335
- attributes: {
336
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
337
- productName: ['data-product-name', 'data-name'],
338
- price: ['data-product-price', 'data-price'],
339
- quantity: ['data-quantity', 'data-qty'],
340
- currency: ['data-currency'],
341
- },
342
- fields: {
343
- productId: ['productId', 'product_id', 'offerId', 'sku'],
344
- productName: ['productName', 'product_name'],
345
- price: ['price', 'amount'],
346
- quantity: ['quantity', 'qty'],
347
- currency: ['currency'],
348
- email: ['email', 'customerEmail'],
349
- phone: ['phone', 'telefone', 'customerPhone'],
350
- },
351
- },
352
- },
353
376
  manual: {
354
377
  pageView: { enabled: false },
355
- purchase: { enabled: false },
356
- lead: { enabled: false },
378
+ purchase: { enabled: false, sources: [] },
379
+ lead: { enabled: false, sources: [] },
357
380
  addToCart: { enabled: true },
358
381
  removeFromCart: { enabled: true },
359
- initiateCheckout: { enabled: false },
360
- addPaymentInfo: { enabled: false },
361
- search: { enabled: false },
362
- viewContent: { enabled: false },
382
+ initiateCheckout: { enabled: false, sources: [] },
383
+ addPaymentInfo: { enabled: false, sources: [] },
384
+ search: { enabled: false, sources: [] },
385
+ viewContent: { enabled: false, sources: [] },
363
386
  },
364
387
  auto: {
365
388
  enabled: true,
366
389
  detectors: {
367
- lead: { enabled: false },
368
- purchase: { enabled: false },
390
+ lead: { enabled: false, sources: [] },
391
+ purchase: { enabled: false, sources: [] },
369
392
  addToCart: addToCartDetectorConfig(),
370
- removeFromCart: { enabled: false },
371
- initiateCheckout: { enabled: false },
372
- addPaymentInfo: { enabled: false },
373
- search: { enabled: false },
374
- viewContent: { enabled: false },
393
+ removeFromCart: { enabled: false, sources: [] },
394
+ initiateCheckout: { enabled: false, sources: [] },
395
+ addPaymentInfo: { enabled: false, sources: [] },
396
+ search: { enabled: false, sources: [] },
397
+ viewContent: { enabled: false, sources: [] },
375
398
  },
376
399
  },
377
400
  rules: {
@@ -194,10 +194,19 @@ code { font-size: 0.85em; }
194
194
 
195
195
  function addToCartDetectorConfig() {
196
196
  return {
197
- enabled: true,
198
- selector: ['[data-track="add_to_cart"]'],
199
- selectorType: 'css',
200
- };
197
+ enabled: true,
198
+ sources: [
199
+ {
200
+ name: 'addToCart-selector',
201
+ type: 'selector',
202
+ selector: [
203
+ '[data-track=\'add_to_cart\']'
204
+ ],
205
+ selectorType: 'css',
206
+ trigger: 'click'
207
+ }
208
+ ]
209
+ };
201
210
  }
202
211
 
203
212
  function buildConfig() {
@@ -216,6 +225,70 @@ code { font-size: 0.85em; }
216
225
  timeoutMs: 10000,
217
226
  },
218
227
  identity: { ...base.identity, pixelId: PIXEL_ID },
228
+ commerce: {
229
+ enabled: true,
230
+ currency: 'BRL',
231
+ catalog: { products: [
232
+ {
233
+ id: 'main_offer',
234
+ name: 'Oferta Principal',
235
+ type: 'main',
236
+ price: 197,
237
+ currency: 'BRL',
238
+ quantity: 1,
239
+ },
240
+ {
241
+ id: 'order_bump_01',
242
+ name: 'Order Bump Especial',
243
+ type: 'order_bump',
244
+ price: 47,
245
+ currency: 'BRL',
246
+ quantity: 1,
247
+ },
248
+ {
249
+ id: 'upsell_01',
250
+ name: 'Upsell 01',
251
+ type: 'upsell',
252
+ price: 97,
253
+ currency: 'BRL',
254
+ quantity: 1,
255
+ },
256
+ ] },
257
+ cart: {
258
+ mode: 'single_product',
259
+ initialItems: [{ productId: "main_offer", quantity: 1 }],
260
+ calculateValueFrom: 'cart',
261
+ allowDynamicItems: true,
262
+ },
263
+ mappings: {
264
+ attributes: {
265
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
266
+ productName: ['data-product-name', 'data-name'],
267
+ price: ['data-product-price', 'data-price'],
268
+ quantity: ['data-quantity', 'data-qty'],
269
+ currency: ['data-currency'],
270
+ },
271
+ fields: {
272
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
273
+ productName: ['productName', 'product_name'],
274
+ price: ['price', 'amount'],
275
+ quantity: ['quantity', 'qty'],
276
+ currency: ['currency'],
277
+ email: ['email', 'customerEmail'],
278
+ phone: ['phone', 'telefone', 'customerPhone'],
279
+ },
280
+ },
281
+ enrichment: {
282
+ pageView: { enabled: false, source: 'cart' },
283
+ viewContent: { enabled: true, source: 'event_or_cart' },
284
+ lead: { enabled: false, source: 'event_or_cart' },
285
+ addToCart: { enabled: true, source: 'event_or_cart' },
286
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
287
+ initiateCheckout: { enabled: true, source: 'cart' },
288
+ addPaymentInfo: { enabled: true, source: 'cart' },
289
+ purchase: { enabled: true, source: 'cart' },
290
+ }
291
+ },
219
292
  modules: {
220
293
  ...base.modules,
221
294
  core: {
@@ -277,81 +350,28 @@ code { font-size: 0.85em; }
277
350
  integrations: { ...base.modules.integrations, enabled: false },
278
351
  conversion: {
279
352
  enabled: true,
280
- commerce: {
281
- currency: 'BRL',
282
- catalog: { products: [
283
- {
284
- id: 'main_offer',
285
- name: 'Oferta Principal',
286
- type: 'main',
287
- price: 197,
288
- currency: 'BRL',
289
- quantity: 1,
290
- },
291
- {
292
- id: 'order_bump_01',
293
- name: 'Order Bump Especial',
294
- type: 'order_bump',
295
- price: 47,
296
- currency: 'BRL',
297
- quantity: 1,
298
- },
299
- {
300
- id: 'upsell_01',
301
- name: 'Upsell 01',
302
- type: 'upsell',
303
- price: 97,
304
- currency: 'BRL',
305
- quantity: 1,
306
- },
307
- ] },
308
- checkout: {
309
- mode: 'single_product',
310
- selectedItems: [{ productId: "main_offer", quantity: 1 }],
311
- calculateValueFrom: 'selected_items',
312
- allowDynamicItems: true,
313
- },
314
- mappings: {
315
- attributes: {
316
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
317
- productName: ['data-product-name', 'data-name'],
318
- price: ['data-product-price', 'data-price'],
319
- quantity: ['data-quantity', 'data-qty'],
320
- currency: ['data-currency'],
321
- },
322
- fields: {
323
- productId: ['productId', 'product_id', 'offerId', 'sku'],
324
- productName: ['productName', 'product_name'],
325
- price: ['price', 'amount'],
326
- quantity: ['quantity', 'qty'],
327
- currency: ['currency'],
328
- email: ['email', 'customerEmail'],
329
- phone: ['phone', 'telefone', 'customerPhone'],
330
- },
331
- },
332
- },
333
353
  manual: {
334
354
  pageView: { enabled: false },
335
- purchase: { enabled: false },
336
- lead: { enabled: false },
355
+ purchase: { enabled: false, sources: [] },
356
+ lead: { enabled: false, sources: [] },
337
357
  addToCart: { enabled: true },
338
358
  removeFromCart: { enabled: true },
339
- initiateCheckout: { enabled: false },
340
- addPaymentInfo: { enabled: false },
341
- search: { enabled: false },
342
- viewContent: { enabled: false },
359
+ initiateCheckout: { enabled: false, sources: [] },
360
+ addPaymentInfo: { enabled: false, sources: [] },
361
+ search: { enabled: false, sources: [] },
362
+ viewContent: { enabled: false, sources: [] },
343
363
  },
344
364
  auto: {
345
365
  enabled: true,
346
366
  detectors: {
347
- lead: { enabled: false },
348
- purchase: { enabled: false },
367
+ lead: { enabled: false, sources: [] },
368
+ purchase: { enabled: false, sources: [] },
349
369
  addToCart: addToCartDetectorConfig(),
350
- removeFromCart: { enabled: false },
351
- initiateCheckout: { enabled: false },
352
- addPaymentInfo: { enabled: false },
353
- search: { enabled: false },
354
- viewContent: { enabled: false },
370
+ removeFromCart: { enabled: false, sources: [] },
371
+ initiateCheckout: { enabled: false, sources: [] },
372
+ addPaymentInfo: { enabled: false, sources: [] },
373
+ search: { enabled: false, sources: [] },
374
+ viewContent: { enabled: false, sources: [] },
355
375
  },
356
376
  },
357
377
  rules: {