@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
@@ -93,7 +93,7 @@ code { font-size: 0.85em; }
93
93
  <a href="example-initiate-checkout-text.html" class="">5. Text</a>
94
94
  <a href="example-initiate-checkout-manual.html" class="">6. Manual API</a>
95
95
  <a href="example-initiate-checkout-snapshot.html" class="active">7. Snapshot/value</a></div>
96
- <div class="hint"><strong>Contexto:</strong> selectedItems com main (197) + bump (47).
96
+ <div class="hint"><strong>Contexto:</strong> initialItems com main (197) + bump (47).
97
97
  Esperado: <code>value ≈ 244</code>, <code>numItems</code> / items com os dois.
98
98
  Painel “Checkout snapshot” destaca value/items.</div>
99
99
 
@@ -197,10 +197,19 @@ code { font-size: 0.85em; }
197
197
 
198
198
  function initiateCheckoutDetectorConfig() {
199
199
  return {
200
- enabled: true,
201
- selector: ['[data-track="initiate_checkout"]'],
202
- selectorType: 'css',
203
- };
200
+ enabled: true,
201
+ sources: [
202
+ {
203
+ name: 'initiateCheckout-selector',
204
+ type: 'selector',
205
+ selector: [
206
+ '[data-track=\'initiate_checkout\']'
207
+ ],
208
+ selectorType: 'css',
209
+ trigger: 'click'
210
+ }
211
+ ]
212
+ };
204
213
  }
205
214
 
206
215
  function buildConfig() {
@@ -219,6 +228,73 @@ code { font-size: 0.85em; }
219
228
  timeoutMs: 10000,
220
229
  },
221
230
  identity: { ...base.identity, pixelId: PIXEL_ID },
231
+ commerce: {
232
+ enabled: true,
233
+ currency: 'BRL',
234
+ catalog: { products: [
235
+ {
236
+ id: 'main_offer',
237
+ name: 'Oferta Principal',
238
+ type: 'main',
239
+ price: 197,
240
+ currency: 'BRL',
241
+ quantity: 1,
242
+ },
243
+ {
244
+ id: 'order_bump_01',
245
+ name: 'Order Bump Especial',
246
+ type: 'order_bump',
247
+ price: 47,
248
+ currency: 'BRL',
249
+ quantity: 1,
250
+ },
251
+ {
252
+ id: 'upsell_01',
253
+ name: 'Upsell 01',
254
+ type: 'upsell',
255
+ price: 97,
256
+ currency: 'BRL',
257
+ quantity: 1,
258
+ },
259
+ ] },
260
+ cart: {
261
+ mode: 'single_product',
262
+ initialItems: [
263
+ { productId: 'main_offer', quantity: 1 },
264
+ { productId: 'order_bump_01', quantity: 1 },
265
+ ],
266
+ calculateValueFrom: 'cart',
267
+ allowDynamicItems: true,
268
+ },
269
+ mappings: {
270
+ attributes: {
271
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
272
+ productName: ['data-product-name', 'data-name'],
273
+ price: ['data-product-price', 'data-price'],
274
+ quantity: ['data-quantity', 'data-qty'],
275
+ currency: ['data-currency'],
276
+ },
277
+ fields: {
278
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
279
+ productName: ['productName', 'product_name'],
280
+ price: ['price', 'amount'],
281
+ quantity: ['quantity', 'qty'],
282
+ currency: ['currency'],
283
+ email: ['email', 'customerEmail'],
284
+ phone: ['phone', 'telefone', 'customerPhone'],
285
+ },
286
+ },
287
+ enrichment: {
288
+ pageView: { enabled: false, source: 'cart' },
289
+ viewContent: { enabled: true, source: 'event_or_cart' },
290
+ lead: { enabled: false, source: 'event_or_cart' },
291
+ addToCart: { enabled: true, source: 'event_or_cart' },
292
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
293
+ initiateCheckout: { enabled: true, source: 'cart' },
294
+ addPaymentInfo: { enabled: true, source: 'cart' },
295
+ purchase: { enabled: true, source: 'cart' },
296
+ }
297
+ },
222
298
  modules: {
223
299
  ...base.modules,
224
300
  core: {
@@ -280,84 +356,28 @@ code { font-size: 0.85em; }
280
356
  integrations: { ...base.modules.integrations, enabled: false },
281
357
  conversion: {
282
358
  enabled: true,
283
- commerce: {
284
- currency: 'BRL',
285
- catalog: { products: [
286
- {
287
- id: 'main_offer',
288
- name: 'Oferta Principal',
289
- type: 'main',
290
- price: 197,
291
- currency: 'BRL',
292
- quantity: 1,
293
- },
294
- {
295
- id: 'order_bump_01',
296
- name: 'Order Bump Especial',
297
- type: 'order_bump',
298
- price: 47,
299
- currency: 'BRL',
300
- quantity: 1,
301
- },
302
- {
303
- id: 'upsell_01',
304
- name: 'Upsell 01',
305
- type: 'upsell',
306
- price: 97,
307
- currency: 'BRL',
308
- quantity: 1,
309
- },
310
- ] },
311
- checkout: {
312
- mode: 'single_product',
313
- selectedItems: [
314
- { productId: 'main_offer', quantity: 1 },
315
- { productId: 'order_bump_01', quantity: 1 },
316
- ],
317
- calculateValueFrom: 'selected_items',
318
- allowDynamicItems: true,
319
- },
320
- mappings: {
321
- attributes: {
322
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
323
- productName: ['data-product-name', 'data-name'],
324
- price: ['data-product-price', 'data-price'],
325
- quantity: ['data-quantity', 'data-qty'],
326
- currency: ['data-currency'],
327
- },
328
- fields: {
329
- productId: ['productId', 'product_id', 'offerId', 'sku'],
330
- productName: ['productName', 'product_name'],
331
- price: ['price', 'amount'],
332
- quantity: ['quantity', 'qty'],
333
- currency: ['currency'],
334
- email: ['email', 'customerEmail'],
335
- phone: ['phone', 'telefone', 'customerPhone'],
336
- },
337
- },
338
- },
339
359
  manual: {
340
360
  pageView: { enabled: false },
341
- purchase: { enabled: false },
342
- lead: { enabled: false },
343
- addToCart: { enabled: false },
344
- removeFromCart: { enabled: false },
361
+ purchase: { enabled: false, sources: [] },
362
+ lead: { enabled: false, sources: [] },
363
+ addToCart: { enabled: false, sources: [] },
364
+ removeFromCart: { enabled: false, sources: [] },
345
365
  initiateCheckout: { enabled: true },
346
- addPaymentInfo: { enabled: false },
347
- search: { enabled: false },
348
- viewContent: { enabled: false },
366
+ addPaymentInfo: { enabled: false, sources: [] },
367
+ search: { enabled: false, sources: [] },
368
+ viewContent: { enabled: false, sources: [] },
349
369
  },
350
370
  auto: {
351
371
  enabled: true,
352
372
  detectors: {
353
- lead: { enabled: false },
354
- purchase: { enabled: false },
355
- addToCart: { enabled: false },
356
- removeFromCart: { enabled: false },
373
+ lead: { enabled: false, sources: [] },
374
+ purchase: { enabled: false, sources: [] },
375
+ addToCart: { enabled: false, sources: [] },
376
+ removeFromCart: { enabled: false, sources: [] },
357
377
  initiateCheckout: initiateCheckoutDetectorConfig(),
358
- addPaymentInfo: { enabled: false },
359
- search: { enabled: false },
360
- viewContent: { enabled: false },
378
+ addPaymentInfo: { enabled: false, sources: [] },
379
+ search: { enabled: false, sources: [] },
380
+ viewContent: { enabled: false, sources: [] },
361
381
  },
362
382
  },
363
383
  rules: {
@@ -193,22 +193,31 @@ code { font-size: 0.85em; }
193
193
 
194
194
  function initiateCheckoutDetectorConfig() {
195
195
  return {
196
- enabled: true,
197
- selector: [
198
- '[data-track="initiate_checkout"]',
199
- '#checkout-form',
200
- 'text:Finalizar compra',
201
- ],
202
- selectorType: 'css',
203
- selectorForm: {
204
- fields: ['email', 'phone'],
205
- mode: 'all',
206
- formSelector: '#checkout-form',
207
- trigger: 'submit',
208
- debounceMs: 100,
209
- fireOnce: true,
210
- },
211
- };
196
+ enabled: true,
197
+ sources: [
198
+ {
199
+ name: 'initiateCheckout-form',
200
+ type: 'form',
201
+ selectorForm: {
202
+ fields: [
203
+ 'email',
204
+ 'phone'
205
+ ],
206
+ mode: 'all',
207
+ formSelector: '#checkout-form',
208
+ trigger: 'submit',
209
+ debounceMs: 100,
210
+ fireOnce: true
211
+ },
212
+ selector: [
213
+ '[data-track=\'initiate_checkout\']',
214
+ '#checkout-form',
215
+ 'text:Finalizar compra'
216
+ ],
217
+ selectorType: 'css'
218
+ }
219
+ ]
220
+ };
212
221
  }
213
222
 
214
223
  function buildConfig() {
@@ -227,6 +236,70 @@ code { font-size: 0.85em; }
227
236
  timeoutMs: 10000,
228
237
  },
229
238
  identity: { ...base.identity, pixelId: PIXEL_ID },
239
+ commerce: {
240
+ enabled: true,
241
+ currency: 'BRL',
242
+ catalog: { products: [
243
+ {
244
+ id: 'main_offer',
245
+ name: 'Oferta Principal',
246
+ type: 'main',
247
+ price: 197,
248
+ currency: 'BRL',
249
+ quantity: 1,
250
+ },
251
+ {
252
+ id: 'order_bump_01',
253
+ name: 'Order Bump Especial',
254
+ type: 'order_bump',
255
+ price: 47,
256
+ currency: 'BRL',
257
+ quantity: 1,
258
+ },
259
+ {
260
+ id: 'upsell_01',
261
+ name: 'Upsell 01',
262
+ type: 'upsell',
263
+ price: 97,
264
+ currency: 'BRL',
265
+ quantity: 1,
266
+ },
267
+ ] },
268
+ cart: {
269
+ mode: 'single_product',
270
+ initialItems: [{ productId: "main_offer", quantity: 1 }],
271
+ calculateValueFrom: 'cart',
272
+ allowDynamicItems: true,
273
+ },
274
+ mappings: {
275
+ attributes: {
276
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
277
+ productName: ['data-product-name', 'data-name'],
278
+ price: ['data-product-price', 'data-price'],
279
+ quantity: ['data-quantity', 'data-qty'],
280
+ currency: ['data-currency'],
281
+ },
282
+ fields: {
283
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
284
+ productName: ['productName', 'product_name'],
285
+ price: ['price', 'amount'],
286
+ quantity: ['quantity', 'qty'],
287
+ currency: ['currency'],
288
+ email: ['email', 'customerEmail'],
289
+ phone: ['phone', 'telefone', 'customerPhone'],
290
+ },
291
+ },
292
+ enrichment: {
293
+ pageView: { enabled: false, source: 'cart' },
294
+ viewContent: { enabled: true, source: 'event_or_cart' },
295
+ lead: { enabled: false, source: 'event_or_cart' },
296
+ addToCart: { enabled: true, source: 'event_or_cart' },
297
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
298
+ initiateCheckout: { enabled: true, source: 'cart' },
299
+ addPaymentInfo: { enabled: true, source: 'cart' },
300
+ purchase: { enabled: true, source: 'cart' },
301
+ }
302
+ },
230
303
  modules: {
231
304
  ...base.modules,
232
305
  core: {
@@ -288,81 +361,28 @@ code { font-size: 0.85em; }
288
361
  integrations: { ...base.modules.integrations, enabled: false },
289
362
  conversion: {
290
363
  enabled: true,
291
- commerce: {
292
- currency: 'BRL',
293
- catalog: { products: [
294
- {
295
- id: 'main_offer',
296
- name: 'Oferta Principal',
297
- type: 'main',
298
- price: 197,
299
- currency: 'BRL',
300
- quantity: 1,
301
- },
302
- {
303
- id: 'order_bump_01',
304
- name: 'Order Bump Especial',
305
- type: 'order_bump',
306
- price: 47,
307
- currency: 'BRL',
308
- quantity: 1,
309
- },
310
- {
311
- id: 'upsell_01',
312
- name: 'Upsell 01',
313
- type: 'upsell',
314
- price: 97,
315
- currency: 'BRL',
316
- quantity: 1,
317
- },
318
- ] },
319
- checkout: {
320
- mode: 'single_product',
321
- selectedItems: [{ productId: "main_offer", quantity: 1 }],
322
- calculateValueFrom: 'selected_items',
323
- allowDynamicItems: true,
324
- },
325
- mappings: {
326
- attributes: {
327
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
328
- productName: ['data-product-name', 'data-name'],
329
- price: ['data-product-price', 'data-price'],
330
- quantity: ['data-quantity', 'data-qty'],
331
- currency: ['data-currency'],
332
- },
333
- fields: {
334
- productId: ['productId', 'product_id', 'offerId', 'sku'],
335
- productName: ['productName', 'product_name'],
336
- price: ['price', 'amount'],
337
- quantity: ['quantity', 'qty'],
338
- currency: ['currency'],
339
- email: ['email', 'customerEmail'],
340
- phone: ['phone', 'telefone', 'customerPhone'],
341
- },
342
- },
343
- },
344
364
  manual: {
345
365
  pageView: { enabled: false },
346
- purchase: { enabled: false },
347
- lead: { enabled: false },
348
- addToCart: { enabled: false },
349
- removeFromCart: { enabled: false },
366
+ purchase: { enabled: false, sources: [] },
367
+ lead: { enabled: false, sources: [] },
368
+ addToCart: { enabled: false, sources: [] },
369
+ removeFromCart: { enabled: false, sources: [] },
350
370
  initiateCheckout: { enabled: true },
351
- addPaymentInfo: { enabled: false },
352
- search: { enabled: false },
353
- viewContent: { enabled: false },
371
+ addPaymentInfo: { enabled: false, sources: [] },
372
+ search: { enabled: false, sources: [] },
373
+ viewContent: { enabled: false, sources: [] },
354
374
  },
355
375
  auto: {
356
376
  enabled: true,
357
377
  detectors: {
358
- lead: { enabled: false },
359
- purchase: { enabled: false },
360
- addToCart: { enabled: false },
361
- removeFromCart: { enabled: false },
378
+ lead: { enabled: false, sources: [] },
379
+ purchase: { enabled: false, sources: [] },
380
+ addToCart: { enabled: false, sources: [] },
381
+ removeFromCart: { enabled: false, sources: [] },
362
382
  initiateCheckout: initiateCheckoutDetectorConfig(),
363
- addPaymentInfo: { enabled: false },
364
- search: { enabled: false },
365
- viewContent: { enabled: false },
383
+ addPaymentInfo: { enabled: false, sources: [] },
384
+ search: { enabled: false, sources: [] },
385
+ viewContent: { enabled: false, sources: [] },
366
386
  },
367
387
  },
368
388
  rules: {
@@ -189,21 +189,33 @@ code { font-size: 0.85em; }
189
189
 
190
190
  function initiateCheckoutDetectorConfig() {
191
191
  return {
192
- enabled: true,
193
- selector: [
194
- 'text:Finalizar compra',
195
- { type: 'text', value: 'Finalizar compra' },
196
- ],
197
- selectorType: 'css',
198
- selectorForm: {
199
- fields: ['email', 'phone'],
200
- mode: 'all',
201
- formSelector: '#buy-form',
202
- trigger: 'click',
203
- debounceMs: 0,
204
- fireOnce: false,
205
- },
206
- };
192
+ enabled: true,
193
+ sources: [
194
+ {
195
+ name: 'initiateCheckout-form',
196
+ type: 'form',
197
+ selectorForm: {
198
+ fields: [
199
+ 'email',
200
+ 'phone'
201
+ ],
202
+ mode: 'all',
203
+ formSelector: '#buy-form',
204
+ trigger: 'click',
205
+ debounceMs: 0,
206
+ fireOnce: false
207
+ },
208
+ selector: [
209
+ 'text:Finalizar compra',
210
+ {
211
+ type: 'text',
212
+ value: 'Finalizar compra'
213
+ }
214
+ ],
215
+ selectorType: 'css'
216
+ }
217
+ ]
218
+ };
207
219
  }
208
220
 
209
221
  function buildConfig() {
@@ -222,6 +234,70 @@ code { font-size: 0.85em; }
222
234
  timeoutMs: 10000,
223
235
  },
224
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: [{ productId: "main_offer", quantity: 1 }],
269
+ calculateValueFrom: 'cart',
270
+ allowDynamicItems: true,
271
+ },
272
+ mappings: {
273
+ attributes: {
274
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
275
+ productName: ['data-product-name', 'data-name'],
276
+ price: ['data-product-price', 'data-price'],
277
+ quantity: ['data-quantity', 'data-qty'],
278
+ currency: ['data-currency'],
279
+ },
280
+ fields: {
281
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
282
+ productName: ['productName', 'product_name'],
283
+ price: ['price', 'amount'],
284
+ quantity: ['quantity', 'qty'],
285
+ currency: ['currency'],
286
+ email: ['email', 'customerEmail'],
287
+ phone: ['phone', 'telefone', 'customerPhone'],
288
+ },
289
+ },
290
+ enrichment: {
291
+ pageView: { enabled: false, source: 'cart' },
292
+ viewContent: { enabled: true, source: 'event_or_cart' },
293
+ lead: { enabled: false, source: 'event_or_cart' },
294
+ addToCart: { enabled: true, source: 'event_or_cart' },
295
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
296
+ initiateCheckout: { enabled: true, source: 'cart' },
297
+ addPaymentInfo: { enabled: true, source: 'cart' },
298
+ purchase: { enabled: true, source: 'cart' },
299
+ }
300
+ },
225
301
  modules: {
226
302
  ...base.modules,
227
303
  core: {
@@ -283,81 +359,28 @@ code { font-size: 0.85em; }
283
359
  integrations: { ...base.modules.integrations, enabled: false },
284
360
  conversion: {
285
361
  enabled: true,
286
- commerce: {
287
- currency: 'BRL',
288
- catalog: { products: [
289
- {
290
- id: 'main_offer',
291
- name: 'Oferta Principal',
292
- type: 'main',
293
- price: 197,
294
- currency: 'BRL',
295
- quantity: 1,
296
- },
297
- {
298
- id: 'order_bump_01',
299
- name: 'Order Bump Especial',
300
- type: 'order_bump',
301
- price: 47,
302
- currency: 'BRL',
303
- quantity: 1,
304
- },
305
- {
306
- id: 'upsell_01',
307
- name: 'Upsell 01',
308
- type: 'upsell',
309
- price: 97,
310
- currency: 'BRL',
311
- quantity: 1,
312
- },
313
- ] },
314
- checkout: {
315
- mode: 'single_product',
316
- selectedItems: [{ productId: "main_offer", quantity: 1 }],
317
- calculateValueFrom: 'selected_items',
318
- allowDynamicItems: true,
319
- },
320
- mappings: {
321
- attributes: {
322
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
323
- productName: ['data-product-name', 'data-name'],
324
- price: ['data-product-price', 'data-price'],
325
- quantity: ['data-quantity', 'data-qty'],
326
- currency: ['data-currency'],
327
- },
328
- fields: {
329
- productId: ['productId', 'product_id', 'offerId', 'sku'],
330
- productName: ['productName', 'product_name'],
331
- price: ['price', 'amount'],
332
- quantity: ['quantity', 'qty'],
333
- currency: ['currency'],
334
- email: ['email', 'customerEmail'],
335
- phone: ['phone', 'telefone', 'customerPhone'],
336
- },
337
- },
338
- },
339
362
  manual: {
340
363
  pageView: { enabled: false },
341
- purchase: { enabled: false },
342
- lead: { enabled: false },
343
- addToCart: { enabled: false },
344
- removeFromCart: { enabled: false },
364
+ purchase: { enabled: false, sources: [] },
365
+ lead: { enabled: false, sources: [] },
366
+ addToCart: { enabled: false, sources: [] },
367
+ removeFromCart: { enabled: false, sources: [] },
345
368
  initiateCheckout: { enabled: true },
346
- addPaymentInfo: { enabled: false },
347
- search: { enabled: false },
348
- viewContent: { enabled: false },
369
+ addPaymentInfo: { enabled: false, sources: [] },
370
+ search: { enabled: false, sources: [] },
371
+ viewContent: { enabled: false, sources: [] },
349
372
  },
350
373
  auto: {
351
374
  enabled: true,
352
375
  detectors: {
353
- lead: { enabled: false },
354
- purchase: { enabled: false },
355
- addToCart: { enabled: false },
356
- removeFromCart: { enabled: false },
376
+ lead: { enabled: false, sources: [] },
377
+ purchase: { enabled: false, sources: [] },
378
+ addToCart: { enabled: false, sources: [] },
379
+ removeFromCart: { enabled: false, sources: [] },
357
380
  initiateCheckout: initiateCheckoutDetectorConfig(),
358
- addPaymentInfo: { enabled: false },
359
- search: { enabled: false },
360
- viewContent: { enabled: false },
381
+ addPaymentInfo: { enabled: false, sources: [] },
382
+ search: { enabled: false, sources: [] },
383
+ viewContent: { enabled: false, sources: [] },
361
384
  },
362
385
  },
363
386
  rules: {
@@ -6,20 +6,22 @@ Cada HTML valida **um** comportamento. Abra um de cada vez.
6
6
 
7
7
  | Arquivo | Trigger | Contexto | Detector |
8
8
  |---------|---------|----------|----------|
9
- | [`example-lead-trigger-click.html`](./example-lead-trigger-click.html) | `click` | Newsletter — inscrição explícita | `ConfiguredForm` + `selectorForm` |
10
- | [`example-lead-trigger-auto.html`](./example-lead-trigger-auto.html) | `auto` | Checkout — contato preenchido | `ConfiguredForm` + `selectorForm` |
11
- | [`example-lead-trigger-attribute.html`](./example-lead-trigger-attribute.html) | clique no seletor | Atributo `data-track="lead"` | `ConfiguredSelector` (sem `selectorForm`) |
9
+ | [`example-lead-trigger-click.html`](./example-lead-trigger-click.html) | `click` | Newsletter — inscrição explícita | `ConfiguredForm` + source `type: form` |
10
+ | [`example-lead-trigger-auto.html`](./example-lead-trigger-auto.html) | `auto` | Checkout — contato preenchido | `ConfiguredForm` + source `type: form` |
11
+ | [`example-lead-trigger-attribute.html`](./example-lead-trigger-attribute.html) | clique no seletor | Atributo `data-track="lead"` | `ConfiguredSelector` (source `type: selector`) |
12
12
 
13
13
  ### Como abrir
14
14
 
15
- 1. Na raiz: `npm run build` (ou use `dist/v2/global.global.js` já gerado)
16
- 2. Abra o HTML (live server / file)
17
- 3. Script: `../../dist/v2/global.global.js`
15
+ 1. Na raiz: `npm run build` (gera `dist/v2/global.global.js`)
16
+ 2. Abra o HTML (Live Server na raiz do repo, ou `file://`)
17
+ 3. Script nos HTMLs: `../../../dist/v2/global.global.js` (3 níveis — pasta `lead/`)
18
+
19
+ Se o pill ficar **offline** e Active detectors vazio, o bundle não carregou (`window.PixelV2` undefined).
18
20
 
19
21
  ### Regras rápidas
20
22
 
21
23
  - **Click (newsletter):** `mode: 'all'` — email **e** phone + clique no CTA.
22
24
  - **Auto (checkout):** `mode: 'all'` — dispara no `input`/`change` quando ambos estão ok (`fireOnce`).
23
- - **Atributo:** sem `selectorForm` — clique em `[data-track="lead"]` + extract do form pai (email **ou** phone **ou** name).
25
+ - **Atributo:** source `type: selector` — clique em `[data-track="lead"]` + extract do form pai (email **ou** phone **ou** name).
24
26
 
25
27
  Demais eventos de commerce ficam desabilitados nestes playgrounds.