@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
@@ -195,7 +195,7 @@
195
195
  </div>
196
196
 
197
197
  <div class="card">
198
- <h2>Auto — LEAD (selectorForm · trigger auto)</h2>
198
+ <h2>Auto — LEAD (source form · trigger auto)</h2>
199
199
  <fieldset>
200
200
  <legend>Campos (mode: any · fireOnce)</legend>
201
201
  <div class="row">
@@ -235,22 +235,61 @@
235
235
  </div>
236
236
 
237
237
  <div class="card">
238
- <h2>Auto — INITIATE_CHECKOUT (submit)</h2>
238
+ <h2>Auto — Checkout (IC + ATC form + Payment)</h2>
239
+ <p class="sub">
240
+ lifecycle → IC no ready · email+phone → ATC form (1×) ·
241
+ editar address/cartão não re-dispara ATC · bump via data-track ·
242
+ cartão → ADD_PAYMENT_INFO (1×)
243
+ </p>
239
244
  <form id="checkout-form">
240
245
  <div class="row">
241
246
  <div>
242
247
  <label for="co-email">email</label>
243
- <input id="co-email" name="email" type="email" required />
248
+ <input id="co-email" name="email" type="email" autocomplete="email" />
244
249
  </div>
245
250
  <div>
246
251
  <label for="co-phone">phone</label>
247
- <input id="co-phone" name="phone" type="tel" required />
252
+ <input id="co-phone" name="phone" type="tel" autocomplete="tel" />
253
+ </div>
254
+ </div>
255
+ <div class="row">
256
+ <div>
257
+ <label for="co-address">address</label>
258
+ <input id="co-address" name="address" type="text" autocomplete="street-address" />
259
+ </div>
260
+ <div>
261
+ <label for="co-city">city</label>
262
+ <input id="co-city" name="city" type="text" autocomplete="address-level2" />
263
+ </div>
264
+ </div>
265
+ <div class="row">
266
+ <div>
267
+ <label for="co-postal">postal</label>
268
+ <input id="co-postal" name="postal" type="text" autocomplete="postal-code" />
269
+ </div>
270
+ <div>
271
+ <label for="co-card">card (só detecta início — não envia número)</label>
272
+ <input
273
+ id="co-card"
274
+ name="card_number"
275
+ type="text"
276
+ autocomplete="cc-number"
277
+ inputmode="numeric"
278
+ placeholder="4111…"
279
+ />
248
280
  </div>
249
281
  </div>
250
282
  <div class="actions">
251
283
  <button type="submit" class="primary" data-track="initiate_checkout">
252
284
  Finalizar checkout
253
285
  </button>
286
+ <button
287
+ type="button"
288
+ data-track="add_to_cart"
289
+ data-product-id="order_bump_01"
290
+ >
291
+ Order bump (selector ATC)
292
+ </button>
254
293
  </div>
255
294
  </form>
256
295
  </div>
@@ -281,26 +320,24 @@
281
320
  </div>
282
321
 
283
322
  <div class="card">
284
- <h2>Checklist manual 13A</h2>
323
+ <h2>Checklist manual 14C</h2>
285
324
  <ul class="checklist">
286
325
  <li>[ ] window.PixelV2 existe</li>
287
326
  <li>[ ] Pixel inicializa sem erro</li>
288
- <li>[ ] PAGE_VIEW dispara no init (Core) — ver Transport sentCount ≥ 1</li>
289
- <li>[ ] LEAD manual dispara</li>
290
- <li>[ ] LEAD automático dispara com email/phone</li>
291
- <li>[ ] LEAD vazio não dispara</li>
292
- <li>[ ] ADD_TO_CART manual parcial completa pelo catálogo</li>
293
- <li>[ ] ADD_TO_CART automático por data-track dispara</li>
294
- <li>[ ] ADD_TO_CART por text:Comprar agora dispara</li>
295
- <li>[ ] ADD_TO_CART rápido não duplica (&lt;500ms)</li>
296
- <li>[ ] ADD_TO_CART depois de 500ms dispara novamente</li>
297
- <li>[ ] REMOVE_FROM_CART remove do state</li>
298
- <li>[ ] INITIATE_CHECKOUT usa selectedItems</li>
299
- <li>[ ] PURCHASE parcial completa items/value/currency</li>
300
- <li>[ ] destroy remove listeners</li>
301
- <li>[ ] reinit não duplica listeners</li>
302
- <li>[ ] Transport Event real recebe ACK (HTTP)</li>
303
- <li>[ ] Transport Batch real recebe ACK (modo Batch)</li>
327
+ <li>[ ] PAGE_VIEW dispara no init — sem commerce (pageView enrichment off)</li>
328
+ <li>[ ] INITIATE_CHECKOUT dispara por lifecycle no ready</li>
329
+ <li>[ ] email+phone no #checkout-form → ADD_TO_CART form (1×)</li>
330
+ <li>[ ] ADD_TO_CART form contém productId=main_offer</li>
331
+ <li>[ ] ADD_TO_CART form contém price/currency/quantity</li>
332
+ <li>[ ] editar address/city/postal depois não re-dispara ATC form</li>
333
+ <li>[ ] data-track="add_to_cart" / bump → ADD_TO_CART selector</li>
334
+ <li>[ ] ADD_TO_CART selector order bump contém productId=order_bump_01</li>
335
+ <li>[ ] preencher cartão → ADD_PAYMENT_INFO (1×, sem número no payload)</li>
336
+ <li>[ ] LEAD / ATC / IC / PURCHASE manuais funcionam</li>
337
+ <li>[ ] dedupe ATC &lt;500ms</li>
338
+ <li>[ ] Transport ACK / Flush</li>
339
+ <li>[ ] destroy remove listeners / reinit não duplica</li>
340
+ <li>[ ] Transport Event/Batch real recebe ACK (HTTP)</li>
304
341
  </ul>
305
342
  </div>
306
343
  </div>
@@ -458,6 +495,46 @@
458
495
  apiEndpoint: endpoint || '',
459
496
  timeoutMs: 15000,
460
497
  },
498
+ commerce: {
499
+ enabled: true,
500
+ currency: 'BRL',
501
+ catalog: {
502
+ products: [
503
+ {
504
+ id: 'main_offer',
505
+ name: 'Oferta Principal RC',
506
+ type: 'main',
507
+ price: 197,
508
+ currency: 'BRL',
509
+ quantity: 1,
510
+ },
511
+ {
512
+ id: 'order_bump_01',
513
+ name: 'Order Bump RC',
514
+ type: 'order_bump',
515
+ price: 47,
516
+ currency: 'BRL',
517
+ quantity: 1,
518
+ },
519
+ ],
520
+ },
521
+ cart: {
522
+ mode: 'single_product',
523
+ initialItems: [{ productId: 'main_offer', quantity: 1 }],
524
+ calculateValueFrom: 'cart',
525
+ allowDynamicItems: true,
526
+ },
527
+ enrichment: {
528
+ pageView: { enabled: false, source: 'cart' },
529
+ viewContent: { enabled: true, source: 'event_or_cart' },
530
+ lead: { enabled: false, source: 'event_or_cart' },
531
+ addToCart: { enabled: true, source: 'event_or_cart' },
532
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
533
+ initiateCheckout: { enabled: true, source: 'cart' },
534
+ addPaymentInfo: { enabled: true, source: 'cart' },
535
+ purchase: { enabled: true, source: 'cart' },
536
+ }
537
+ },
461
538
  modules: {
462
539
  ...DEFAULT_PIXEL_CONFIG.modules,
463
540
  privacy: { ...DEFAULT_PIXEL_CONFIG.modules.privacy, enabled: false },
@@ -475,39 +552,22 @@
475
552
  trackInitialPageView: true,
476
553
  spa: false,
477
554
  },
555
+ // sid público ≠ session_id interno do Pixel
556
+ urlContext: {
557
+ enabled: true,
558
+ linkDecoration: {
559
+ enabled: true,
560
+ strategy: 'on_click',
561
+ allowedDomains: [
562
+ 'checkout.bemony.com',
563
+ 'security.bemony.com',
564
+ ],
565
+ },
566
+ },
478
567
  },
479
568
  conversion: {
480
569
  ...DEFAULT_PIXEL_CONFIG.modules.conversion,
481
570
  enabled: true,
482
- commerce: {
483
- currency: 'BRL',
484
- catalog: {
485
- products: [
486
- {
487
- id: 'main_offer',
488
- name: 'Oferta Principal RC',
489
- type: 'main',
490
- price: 197,
491
- currency: 'BRL',
492
- quantity: 1,
493
- },
494
- {
495
- id: 'order_bump_01',
496
- name: 'Order Bump RC',
497
- type: 'order_bump',
498
- price: 47,
499
- currency: 'BRL',
500
- quantity: 1,
501
- },
502
- ],
503
- },
504
- checkout: {
505
- mode: 'single_product',
506
- selectedItems: [{ productId: 'main_offer', quantity: 1 }],
507
- calculateValueFrom: 'selected_items',
508
- allowDynamicItems: true,
509
- },
510
- },
511
571
  manual: {
512
572
  pageView: { enabled: false },
513
573
  purchase: { enabled: true },
@@ -524,39 +584,90 @@
524
584
  detectors: {
525
585
  lead: {
526
586
  enabled: true,
527
- selector: '#lead-email, #lead-phone',
528
- selectorType: 'css',
529
- selectorForm: {
530
- fields: ['email', 'phone'],
531
- mode: 'any',
532
- trigger: 'auto',
533
- fireOnce: true,
534
- minRequired: 1,
535
- },
587
+ sources: [
588
+ {
589
+ name: 'lead-form',
590
+ type: 'form',
591
+ selector: '#lead-email, #lead-phone',
592
+ selectorType: 'css',
593
+ selectorForm: {
594
+ fields: ['email', 'phone'],
595
+ mode: 'any',
596
+ trigger: 'auto',
597
+ fireOnce: true,
598
+ minRequired: 1,
599
+ },
600
+ },
601
+ ],
536
602
  },
537
603
  addToCart: {
538
604
  enabled: true,
539
- // sem selectorForm → ConfiguredSelectorDetector (data-track + text)
540
- selector: ['[data-track="add_to_cart"]', 'text:Comprar agora'],
541
- selectorType: 'css',
605
+ sources: [
606
+ {
607
+ name: 'main-product-after-contact',
608
+ type: 'form',
609
+ selectorForm: {
610
+ fields: ['email', 'phone'],
611
+ mode: 'all',
612
+ formSelector: '#checkout-form',
613
+ trigger: 'input',
614
+ debounceMs: 300,
615
+ fireOnce: true,
616
+ },
617
+ },
618
+ {
619
+ name: 'product-or-bump-click',
620
+ type: 'selector',
621
+ selector: ['[data-track="add_to_cart"]', 'text:Comprar agora'],
622
+ selectorType: 'css',
623
+ trigger: 'click',
624
+ fireOnce: false,
625
+ },
626
+ ],
542
627
  },
543
628
  initiateCheckout: {
544
629
  enabled: true,
545
- selector: ['#checkout-form', '[data-track="initiate_checkout"]'],
546
- selectorType: 'css',
547
- selectorForm: {
548
- fields: ['email', 'phone'],
549
- mode: 'all',
550
- trigger: 'submit',
551
- fireOnce: false,
552
- minRequired: 2,
553
- },
630
+ sources: [
631
+ {
632
+ name: 'checkout-loaded',
633
+ type: 'lifecycle',
634
+ trigger: 'ready',
635
+ fireOnce: true,
636
+ },
637
+ {
638
+ name: 'checkout-form-submit',
639
+ type: 'form',
640
+ selector: ['#checkout-form', '[data-track="initiate_checkout"]'],
641
+ selectorType: 'css',
642
+ selectorForm: {
643
+ fields: ['email', 'phone'],
644
+ mode: 'all',
645
+ formSelector: '#checkout-form',
646
+ trigger: 'submit',
647
+ fireOnce: false,
648
+ minRequired: 2,
649
+ },
650
+ },
651
+ ],
652
+ },
653
+ purchase: { enabled: false, sources: [] },
654
+ removeFromCart: { enabled: false, sources: [] },
655
+ addPaymentInfo: {
656
+ enabled: true,
657
+ sources: [
658
+ {
659
+ name: 'credit-card-detection',
660
+ type: 'payment',
661
+ formSelector: '#checkout-form',
662
+ cardDetection: true,
663
+ autoDispatch: true,
664
+ fireOnce: true,
665
+ paymentMethod: 'CREDIT_CARD',
666
+ },
667
+ ],
554
668
  },
555
- purchase: { enabled: false },
556
- removeFromCart: { enabled: false },
557
- addPaymentInfo: { enabled: false },
558
- search: { enabled: false },
559
- viewContent: { enabled: false },
669
+ search: { enabled: false, sources: [] },
670
+ viewContent: { enabled: false, sources: [] },
560
671
  },
561
672
  },
562
673
  rules: {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Cada HTML valida **um** comportamento. Abra um de cada vez.
4
4
 
5
- > **Nota:** `removeFromCart` **não** tem `selectorForm` no contrato (só selector).
5
+ > **Nota:** `removeFromCart` **não** tem `sources[]` com `type: 'form'` (só selector).
6
6
  > Fontes: payload manual, `data-product-id`, commerce state.
7
7
 
8
8
  | # | Arquivo | Como dispara | O que valida |
@@ -203,10 +203,19 @@ code { font-size: 0.85em; }
203
203
 
204
204
  function removeFromCartDetectorConfig() {
205
205
  return {
206
- enabled: true,
207
- selector: ['[data-track="remove_from_cart"]'],
208
- selectorType: 'css',
209
- };
206
+ enabled: true,
207
+ sources: [
208
+ {
209
+ name: 'removeFromCart-selector',
210
+ type: 'selector',
211
+ selector: [
212
+ '[data-track=\'remove_from_cart\']'
213
+ ],
214
+ selectorType: 'css',
215
+ trigger: 'click'
216
+ }
217
+ ]
218
+ };
210
219
  }
211
220
 
212
221
  function buildConfig() {
@@ -225,6 +234,73 @@ code { font-size: 0.85em; }
225
234
  timeoutMs: 10000,
226
235
  },
227
236
  identity: { ...base.identity, pixelId: PIXEL_ID },
237
+ commerce: {
238
+ enabled: true,
239
+ currency: 'BRL',
240
+ catalog: { products: [
241
+ {
242
+ id: 'main_offer',
243
+ name: 'Oferta Principal',
244
+ type: 'main',
245
+ price: 197,
246
+ currency: 'BRL',
247
+ quantity: 1,
248
+ },
249
+ {
250
+ id: 'order_bump_01',
251
+ name: 'Order Bump Especial',
252
+ type: 'order_bump',
253
+ price: 47,
254
+ currency: 'BRL',
255
+ quantity: 1,
256
+ },
257
+ {
258
+ id: 'upsell_01',
259
+ name: 'Upsell 01',
260
+ type: 'upsell',
261
+ price: 97,
262
+ currency: 'BRL',
263
+ quantity: 1,
264
+ },
265
+ ] },
266
+ cart: {
267
+ mode: 'single_product',
268
+ initialItems: [
269
+ { productId: 'main_offer', quantity: 1 },
270
+ { productId: 'order_bump_01', quantity: 1 },
271
+ ],
272
+ calculateValueFrom: 'cart',
273
+ allowDynamicItems: true,
274
+ },
275
+ mappings: {
276
+ attributes: {
277
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
278
+ productName: ['data-product-name', 'data-name'],
279
+ price: ['data-product-price', 'data-price'],
280
+ quantity: ['data-quantity', 'data-qty'],
281
+ currency: ['data-currency'],
282
+ },
283
+ fields: {
284
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
285
+ productName: ['productName', 'product_name'],
286
+ price: ['price', 'amount'],
287
+ quantity: ['quantity', 'qty'],
288
+ currency: ['currency'],
289
+ email: ['email', 'customerEmail'],
290
+ phone: ['phone', 'telefone', 'customerPhone'],
291
+ },
292
+ },
293
+ enrichment: {
294
+ pageView: { enabled: false, source: 'cart' },
295
+ viewContent: { enabled: true, source: 'event_or_cart' },
296
+ lead: { enabled: false, source: 'event_or_cart' },
297
+ addToCart: { enabled: true, source: 'event_or_cart' },
298
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
299
+ initiateCheckout: { enabled: true, source: 'cart' },
300
+ addPaymentInfo: { enabled: true, source: 'cart' },
301
+ purchase: { enabled: true, source: 'cart' },
302
+ }
303
+ },
228
304
  modules: {
229
305
  ...base.modules,
230
306
  core: {
@@ -286,84 +362,28 @@ code { font-size: 0.85em; }
286
362
  integrations: { ...base.modules.integrations, enabled: false },
287
363
  conversion: {
288
364
  enabled: true,
289
- commerce: {
290
- currency: 'BRL',
291
- catalog: { products: [
292
- {
293
- id: 'main_offer',
294
- name: 'Oferta Principal',
295
- type: 'main',
296
- price: 197,
297
- currency: 'BRL',
298
- quantity: 1,
299
- },
300
- {
301
- id: 'order_bump_01',
302
- name: 'Order Bump Especial',
303
- type: 'order_bump',
304
- price: 47,
305
- currency: 'BRL',
306
- quantity: 1,
307
- },
308
- {
309
- id: 'upsell_01',
310
- name: 'Upsell 01',
311
- type: 'upsell',
312
- price: 97,
313
- currency: 'BRL',
314
- quantity: 1,
315
- },
316
- ] },
317
- checkout: {
318
- mode: 'single_product',
319
- selectedItems: [
320
- { productId: 'main_offer', quantity: 1 },
321
- { productId: 'order_bump_01', quantity: 1 },
322
- ],
323
- calculateValueFrom: 'selected_items',
324
- allowDynamicItems: true,
325
- },
326
- mappings: {
327
- attributes: {
328
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
329
- productName: ['data-product-name', 'data-name'],
330
- price: ['data-product-price', 'data-price'],
331
- quantity: ['data-quantity', 'data-qty'],
332
- currency: ['data-currency'],
333
- },
334
- fields: {
335
- productId: ['productId', 'product_id', 'offerId', 'sku'],
336
- productName: ['productName', 'product_name'],
337
- price: ['price', 'amount'],
338
- quantity: ['quantity', 'qty'],
339
- currency: ['currency'],
340
- email: ['email', 'customerEmail'],
341
- phone: ['phone', 'telefone', 'customerPhone'],
342
- },
343
- },
344
- },
345
365
  manual: {
346
366
  pageView: { enabled: false },
347
- purchase: { enabled: false },
348
- lead: { enabled: false },
367
+ purchase: { enabled: false, sources: [] },
368
+ lead: { enabled: false, sources: [] },
349
369
  addToCart: { enabled: true },
350
370
  removeFromCart: { enabled: true },
351
- initiateCheckout: { enabled: false },
352
- addPaymentInfo: { enabled: false },
353
- search: { enabled: false },
354
- viewContent: { enabled: false },
371
+ initiateCheckout: { enabled: false, sources: [] },
372
+ addPaymentInfo: { enabled: false, sources: [] },
373
+ search: { enabled: false, sources: [] },
374
+ viewContent: { enabled: false, sources: [] },
355
375
  },
356
376
  auto: {
357
377
  enabled: true,
358
378
  detectors: {
359
- lead: { enabled: false },
360
- purchase: { enabled: false },
361
- addToCart: { enabled: false },
379
+ lead: { enabled: false, sources: [] },
380
+ purchase: { enabled: false, sources: [] },
381
+ addToCart: { enabled: false, sources: [] },
362
382
  removeFromCart: removeFromCartDetectorConfig(),
363
- initiateCheckout: { enabled: false },
364
- addPaymentInfo: { enabled: false },
365
- search: { enabled: false },
366
- viewContent: { enabled: false },
383
+ initiateCheckout: { enabled: false, sources: [] },
384
+ addPaymentInfo: { enabled: false, sources: [] },
385
+ search: { enabled: false, sources: [] },
386
+ viewContent: { enabled: false, sources: [] },
367
387
  },
368
388
  },
369
389
  rules: {