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

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 (191) hide show
  1. package/CHANGELOG.md +311 -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 +77 -0
  11. package/dist/browser/index.d.ts +77 -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/browser/pixel.internal-checkout.global.js +4 -0
  21. package/dist/browser/pixel.internal-checkout.global.js.map +1 -0
  22. package/dist/config/index.cjs.js +1 -1
  23. package/dist/config/index.cjs.js.map +1 -1
  24. package/dist/config/index.d.mts +16 -5
  25. package/dist/config/index.d.ts +16 -5
  26. package/dist/config/index.esm.js +1 -1
  27. package/dist/config/index.esm.js.map +1 -1
  28. package/dist/events/index.cjs.js +1 -1
  29. package/dist/events/index.cjs.js.map +1 -1
  30. package/dist/events/index.d.mts +2 -1
  31. package/dist/events/index.d.ts +2 -1
  32. package/dist/events/index.esm.js +1 -1
  33. package/dist/events/index.esm.js.map +1 -1
  34. package/dist/examples/html-script/README.md +21 -55
  35. package/dist/examples/html-script/RELEASE_CANDIDATE.md +39 -26
  36. package/dist/examples/html-script/add-payment-info/README.md +3 -3
  37. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +107 -96
  38. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +107 -96
  39. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +106 -95
  40. package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +114 -95
  41. package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +106 -95
  42. package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +97 -95
  43. package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +106 -95
  44. package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +106 -95
  45. package/dist/examples/html-script/add-to-cart/README.md +9 -6
  46. package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +133 -119
  47. package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +146 -130
  48. package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +144 -127
  49. package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +133 -119
  50. package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +590 -0
  51. package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +124 -116
  52. package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +133 -119
  53. package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +147 -130
  54. package/dist/examples/html-script/behavior/example-behavior-engagement.html +489 -0
  55. package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +350 -0
  56. package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +433 -0
  57. package/dist/examples/html-script/behavior/example-behavior-viewport.html +397 -0
  58. package/dist/examples/html-script/{example-behavior.html → behavior/example-behavior.html} +23 -17
  59. package/dist/examples/html-script/buygoods/example-buygoods-checkout.html +50 -0
  60. package/dist/examples/html-script/buygoods/ladding.html +184 -0
  61. package/dist/examples/html-script/example-basic.html +1 -1
  62. package/dist/examples/html-script/example-checkout-commerce.html +826 -0
  63. package/dist/examples/html-script/example-conversion.html +42 -49
  64. package/dist/examples/html-script/example-global-factory-classic.html +45 -0
  65. package/dist/examples/html-script/example-global-factory.html +40 -0
  66. package/dist/examples/html-script/example-integration.html +45 -51
  67. package/dist/examples/html-script/example-landing-commerce.html +416 -0
  68. package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
  69. package/dist/examples/html-script/example-transport.html +70 -63
  70. package/dist/examples/html-script/full-funnel/README.md +64 -0
  71. package/dist/examples/html-script/full-funnel/checkout.html +118 -0
  72. package/dist/examples/html-script/full-funnel/downsell.html +60 -0
  73. package/dist/examples/html-script/full-funnel/landing.html +153 -0
  74. package/dist/examples/html-script/full-funnel/thank-you.html +87 -0
  75. package/dist/examples/html-script/full-funnel/upsell.html +66 -0
  76. package/dist/examples/html-script/initiate-checkout/README.md +6 -6
  77. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +135 -122
  78. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +143 -128
  79. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +144 -128
  80. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +127 -120
  81. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +136 -123
  82. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +144 -131
  83. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +146 -130
  84. package/dist/examples/html-script/internal-checkout/example-cardioclear-checkout.html +57 -0
  85. package/dist/examples/html-script/internal-checkout/example-slimsoda-checkout.html +53 -0
  86. package/dist/examples/html-script/lead/README.md +9 -7
  87. package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +107 -94
  88. package/dist/examples/html-script/lead/example-lead-trigger-auto.html +118 -103
  89. package/dist/examples/html-script/lead/example-lead-trigger-click.html +118 -102
  90. package/dist/examples/html-script/release-candidate.html +219 -107
  91. package/dist/examples/html-script/remove-from-cart/README.md +4 -4
  92. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +134 -121
  93. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +134 -121
  94. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +141 -128
  95. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +125 -118
  96. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +135 -122
  97. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +136 -123
  98. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +139 -124
  99. package/dist/examples/html-script/search/README.md +1 -1
  100. package/dist/examples/html-script/search/example-search-attribute.html +107 -99
  101. package/dist/examples/html-script/search/example-search-button-sync.html +107 -99
  102. package/dist/examples/html-script/search/example-search-dedupe.html +107 -99
  103. package/dist/examples/html-script/search/example-search-input.html +108 -99
  104. package/dist/examples/html-script/search/example-search-manual.html +98 -96
  105. package/dist/examples/html-script/search/example-search-submit.html +107 -99
  106. package/dist/examples/html-script/search/example-search-text.html +112 -99
  107. package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +92 -0
  108. package/dist/examples/html-script/url-context/example-url-context-landing.html +110 -0
  109. package/dist/examples/html-script/url-context/example-url-context-upsell.html +105 -0
  110. package/dist/examples/html-script/url-context/example-url-context.html +205 -0
  111. package/dist/examples/html-script/view-content/README.md +1 -1
  112. package/dist/examples/html-script/view-content/example-view-content-attribute.html +126 -118
  113. package/dist/examples/html-script/view-content/example-view-content-css.html +126 -118
  114. package/dist/examples/html-script/view-content/example-view-content-dedupe.html +126 -118
  115. package/dist/examples/html-script/view-content/example-view-content-empty.html +126 -118
  116. package/dist/examples/html-script/view-content/example-view-content-manual.html +117 -115
  117. package/dist/examples/html-script/view-content/example-view-content-product-card.html +126 -118
  118. package/dist/examples/html-script/view-content/example-view-content-text.html +131 -121
  119. package/dist/examples/release-candidate/README.md +2 -1
  120. package/dist/examples/v2/README.md +16 -13
  121. package/dist/index-B8u_3PGG.d.ts +460 -0
  122. package/dist/index-BxT2d-TK.d.mts +460 -0
  123. package/dist/index.cjs.js +1 -1
  124. package/dist/index.cjs.js.map +1 -1
  125. package/dist/index.d.mts +23 -361
  126. package/dist/index.d.ts +23 -361
  127. package/dist/index.esm.js +1 -1
  128. package/dist/index.esm.js.map +1 -1
  129. package/dist/pixel-DNGbAN5C.d.ts +871 -0
  130. package/dist/pixel-_BSDpx4M.d.mts +871 -0
  131. package/dist/pixel-default-config-BMYaqs7i.d.ts +21 -0
  132. package/dist/pixel-default-config-DLRya1tl.d.mts +21 -0
  133. package/dist/pixel-settings-D-t9zQb4.d.ts +40 -0
  134. package/dist/pixel-settings-DGxl0MVm.d.mts +40 -0
  135. package/dist/runtime/index.cjs.js +1 -1
  136. package/dist/runtime/index.cjs.js.map +1 -1
  137. package/dist/runtime/index.d.mts +19 -26
  138. package/dist/runtime/index.d.ts +19 -26
  139. package/dist/runtime/index.esm.js +1 -1
  140. package/dist/runtime/index.esm.js.map +1 -1
  141. package/dist/services/index.cjs.js +1 -1
  142. package/dist/services/index.cjs.js.map +1 -1
  143. package/dist/services/index.d.mts +14 -6
  144. package/dist/services/index.d.ts +14 -6
  145. package/dist/services/index.esm.js +1 -1
  146. package/dist/services/index.esm.js.map +1 -1
  147. package/dist/types-B-Nzagpk.d.mts +19 -0
  148. package/dist/types-D0KVsgzs.d.mts +293 -0
  149. package/dist/types-D3kJ9bfT.d.ts +293 -0
  150. package/dist/types-Dfi9C49l.d.ts +19 -0
  151. package/dist/url-context-Ck2LK18V.d.mts +87 -0
  152. package/dist/url-context-Ck2LK18V.d.ts +87 -0
  153. package/dist/v2/global.global.js +1 -1
  154. package/dist/v2/global.global.js.map +1 -1
  155. package/dist/v2/index.cjs.js +1 -1
  156. package/dist/v2/index.cjs.js.map +1 -1
  157. package/dist/v2/index.d.mts +26 -6
  158. package/dist/v2/index.d.ts +26 -6
  159. package/dist/v2/index.esm.js +1 -1
  160. package/dist/v2/index.esm.js.map +1 -1
  161. package/docs/public/README.md +80 -0
  162. package/docs/public/api/exports.md +56 -0
  163. package/docs/public/api/pixel.md +86 -0
  164. package/docs/public/configuration/commerce.md +44 -0
  165. package/docs/public/configuration/modules.md +63 -0
  166. package/docs/public/configuration/overview.md +85 -0
  167. package/docs/public/configuration/transport.md +127 -0
  168. package/docs/public/events/catalog.md +67 -0
  169. package/docs/public/getting-started/installation.md +88 -0
  170. package/docs/public/getting-started/quick-start.md +142 -0
  171. package/docs/public/getting-started/react-nextjs.md +78 -0
  172. package/docs/public/getting-started/script-tag.md +102 -0
  173. package/docs/public/guides/funnel-checkout.md +52 -0
  174. package/docs/public/guides/funnel-downsell.md +53 -0
  175. package/docs/public/guides/funnel-full.md +64 -0
  176. package/docs/public/guides/funnel-landing.md +70 -0
  177. package/docs/public/guides/funnel-thank-you.md +48 -0
  178. package/docs/public/guides/funnel-upsell.md +72 -0
  179. package/docs/public/limitations.md +33 -0
  180. package/docs/public/privacy/limitations.md +33 -0
  181. package/docs/public/release-candidate/validation.md +42 -0
  182. package/docs/public/troubleshooting.md +56 -0
  183. package/package.json +41 -20
  184. package/dist/index-DUfFzniE.d.mts +0 -274
  185. package/dist/index-DUfFzniE.d.ts +0 -274
  186. package/dist/pixel-CbeF25mD.d.mts +0 -555
  187. package/dist/pixel-CbeF25mD.d.ts +0 -555
  188. package/dist/pixel-default-config-1VgLFOiL.d.mts +0 -5
  189. package/dist/pixel-default-config-Bxb-Vdd8.d.ts +0 -5
  190. package/dist/types-CTpRvFKZ.d.ts +0 -71
  191. package/dist/types-DGlBdsAy.d.mts +0 -71
@@ -0,0 +1,87 @@
1
+ <!doctype html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Full Funnel — Thank You</title>
7
+ <style>
8
+ body { font-family: system-ui, sans-serif; max-width: 720px; margin: 2rem auto; padding: 0 1rem; }
9
+ button { margin: 0.35rem 0.35rem 0 0; padding: 0.5rem 0.85rem; border-radius: 8px; border: 0; background: #0f766e; color: #fff; font: inherit; cursor: pointer; }
10
+ pre { background: #0f172a; color: #e2e8f0; padding: 0.75rem; border-radius: 8px; font-size: 0.75rem; overflow: auto; max-height: 360px; }
11
+ .hint { color: #64748b; font-size: 0.9rem; }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <h1>Thank you</h1>
16
+ <p class="hint">Snapshot final + destroy / reinit lifecycle.</p>
17
+ <p>
18
+ <button type="button" id="btn-snap">Log snapshot</button>
19
+ <button type="button" id="btn-destroy">Destroy</button>
20
+ <button type="button" id="btn-reinit">Reinit</button>
21
+ </p>
22
+ <pre id="out">init…</pre>
23
+ <script src="../../../v2/global.global.js"></script>
24
+ <script>
25
+ (async function () {
26
+ var out = document.getElementById('out');
27
+ var pixel = null;
28
+ var { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
29
+
30
+ function config() {
31
+ return {
32
+ ...DEFAULT_PIXEL_CONFIG,
33
+ app: { ...DEFAULT_PIXEL_CONFIG.app, debug: true },
34
+ identity: { ...DEFAULT_PIXEL_CONFIG.identity, pixelId: 'pix_ff_thanks' },
35
+ transport: {
36
+ ...DEFAULT_PIXEL_CONFIG.transport,
37
+ },
38
+ modules: {
39
+ ...DEFAULT_PIXEL_CONFIG.modules,
40
+ core: {
41
+ ...DEFAULT_PIXEL_CONFIG.modules.core,
42
+ urlContext: { enabled: true },
43
+ },
44
+ conversion: { ...DEFAULT_PIXEL_CONFIG.modules.conversion, enabled: false },
45
+ integrations: { ...DEFAULT_PIXEL_CONFIG.modules.integrations, enabled: false },
46
+ behavior: { ...DEFAULT_PIXEL_CONFIG.modules.behavior, enabled: false },
47
+ },
48
+ };
49
+ }
50
+
51
+ function log(label) {
52
+ var data = {
53
+ href: location.href,
54
+ enabled: pixel ? pixel.getDebugServices().urlContext.isEnabled() : false,
55
+ snapshot: pixel
56
+ ? pixel.getDebugServices().urlContext.getSnapshot()
57
+ : null,
58
+ };
59
+ out.textContent = label + '\n' + JSON.stringify(data, null, 2);
60
+ console.debug('[full-funnel thanks]', label, data);
61
+ }
62
+
63
+ async function boot() {
64
+ pixel = new Pixel(config());
65
+ await pixel.init();
66
+ log('ready');
67
+ }
68
+
69
+ await boot();
70
+ document.getElementById('btn-snap').onclick = function () {
71
+ if (!pixel) return;
72
+ log('snapshot');
73
+ };
74
+ document.getElementById('btn-destroy').onclick = async function () {
75
+ if (!pixel) return;
76
+ await pixel.destroy();
77
+ pixel = null;
78
+ log('destroyed');
79
+ };
80
+ document.getElementById('btn-reinit').onclick = async function () {
81
+ if (pixel) await pixel.destroy();
82
+ await boot();
83
+ };
84
+ })();
85
+ </script>
86
+ </body>
87
+ </html>
@@ -0,0 +1,66 @@
1
+ <!doctype html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Full Funnel — Upsell</title>
7
+ <style>
8
+ body { font-family: system-ui, sans-serif; max-width: 720px; margin: 2rem auto; padding: 0 1rem; }
9
+ a { display: inline-block; margin: 0.35rem 0.35rem 0 0; padding: 0.5rem 0.85rem; border-radius: 8px; background: #0f766e; color: #fff; text-decoration: none; }
10
+ a.secondary { background: #64748b; }
11
+ pre { background: #0f172a; color: #e2e8f0; padding: 0.75rem; border-radius: 8px; font-size: 0.75rem; overflow: auto; max-height: 320px; }
12
+ .hint { color: #64748b; font-size: 0.9rem; }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <h1>Upsell</h1>
17
+ <p class="hint">Links devem preservar <code>sid</code> / <code>order_id</code> / UTMs via UrlContext.</p>
18
+ <p>
19
+ <a id="accept" href="thank-you.html?accepted=1">Aceitar upsell</a>
20
+ <a id="decline" class="secondary" href="downsell.html">Recusar → downsell</a>
21
+ </p>
22
+ <pre id="out">init…</pre>
23
+ <script src="../../../v2/global.global.js"></script>
24
+ <script>
25
+ (async function () {
26
+ var { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
27
+ var pixel = new Pixel({
28
+ ...DEFAULT_PIXEL_CONFIG,
29
+ app: { ...DEFAULT_PIXEL_CONFIG.app, debug: true },
30
+ identity: { ...DEFAULT_PIXEL_CONFIG.identity, pixelId: 'pix_ff_upsell' },
31
+ transport: {
32
+ ...DEFAULT_PIXEL_CONFIG.transport,
33
+ },
34
+ modules: {
35
+ ...DEFAULT_PIXEL_CONFIG.modules,
36
+ core: {
37
+ ...DEFAULT_PIXEL_CONFIG.modules.core,
38
+ urlContext: {
39
+ enabled: true,
40
+ linkDecoration: {
41
+ enabled: true,
42
+ strategy: 'both',
43
+ allowedDomains: '*',
44
+ mergeDefaultExcludedDomains: false,
45
+ },
46
+ },
47
+ },
48
+ conversion: { ...DEFAULT_PIXEL_CONFIG.modules.conversion, enabled: true },
49
+ integrations: { ...DEFAULT_PIXEL_CONFIG.modules.integrations, enabled: false },
50
+ behavior: { ...DEFAULT_PIXEL_CONFIG.modules.behavior, enabled: false },
51
+ },
52
+ });
53
+ await pixel.init();
54
+ var snap = pixel.getDebugServices().urlContext.getSnapshot();
55
+ var debug = {
56
+ href: location.href,
57
+ snapshot: snap,
58
+ accept: document.getElementById('accept').getAttribute('href'),
59
+ decline: document.getElementById('decline').getAttribute('href'),
60
+ };
61
+ document.getElementById('out').textContent = JSON.stringify(debug, null, 2);
62
+ console.debug('[full-funnel upsell]', debug);
63
+ })();
64
+ </script>
65
+ </body>
66
+ </html>
@@ -2,16 +2,16 @@
2
2
 
3
3
  Cada HTML valida **um** comportamento. Abra um de cada vez.
4
4
 
5
- `initiateCheckout` **tem** `selectorForm` (como LEAD / ADD_TO_CART).
6
- O resolver monta snapshot (`items` / `value`) a partir de selectedItems + catálogo.
5
+ `initiateCheckout` usa `sources[]` com `type: form` (como LEAD / ADD_TO_CART).
6
+ O resolver monta snapshot (`items` / `value`) a partir de `cart.initialItems` + catálogo.
7
7
  **Não** escreve CommerceState.
8
8
 
9
9
  | # | Arquivo | Como dispara | O que valida |
10
10
  |---|---------|--------------|--------------|
11
11
  | 1 | [`example-initiate-checkout-attribute.html`](./example-initiate-checkout-attribute.html) | `[data-track="initiate_checkout"]` | SelectorDetector + snapshot |
12
- | 2 | [`example-initiate-checkout-click.html`](./example-initiate-checkout-click.html) | `selectorForm` + `trigger: click` | Gate email+phone |
13
- | 3 | [`example-initiate-checkout-submit.html`](./example-initiate-checkout-submit.html) | `selectorForm` + `trigger: submit` | Submit clássico + fireOnce |
14
- | 4 | [`example-initiate-checkout-auto.html`](./example-initiate-checkout-auto.html) | `selectorForm` + `trigger: auto` | Disparo ao completar contato |
12
+ | 2 | [`example-initiate-checkout-click.html`](./example-initiate-checkout-click.html) | source `type: form` + `trigger: click` | Gate email+phone |
13
+ | 3 | [`example-initiate-checkout-submit.html`](./example-initiate-checkout-submit.html) | source `type: form` + `trigger: submit` | Submit clássico + fireOnce |
14
+ | 4 | [`example-initiate-checkout-auto.html`](./example-initiate-checkout-auto.html) | source `type: form` + `trigger: auto` | Disparo ao completar contato |
15
15
  | 5 | [`example-initiate-checkout-text.html`](./example-initiate-checkout-text.html) | `text:Finalizar compra` | Match por texto + form |
16
16
  | 6 | [`example-initiate-checkout-manual.html`](./example-initiate-checkout-manual.html) | `pixel.initiateCheckout()` | API + override de value |
17
17
  | 7 | [`example-initiate-checkout-snapshot.html`](./example-initiate-checkout-snapshot.html) | atributo / manual | value = main+bump (≈244) |
@@ -20,7 +20,7 @@ O resolver monta snapshot (`items` / `value`) a partir de selectedItems + catál
20
20
 
21
21
  ```txt
22
22
  1. Payload manual (value/items preservados)
23
- 2. checkout.selectedItems
23
+ 2. `cart.initialItems` (estado runtime)
24
24
  3. catálogo commerce
25
25
  4. defaults (currency)
26
26
  ```
@@ -96,7 +96,7 @@ code { font-size: 0.85em; }
96
96
  <div class="hint"><strong>Contexto:</strong> CTA de checkout com
97
97
  <code>data-track="initiate_checkout"</code>. Sem <code>selectorForm</code> —
98
98
  clique dispara; <code>CommerceResolver</code> monta snapshot a partir de
99
- <code>selectedItems</code> + catálogo.</div>
99
+ <code>initialItems</code> + catálogo.</div>
100
100
 
101
101
  <div class="card">
102
102
  <h2>Lifecycle</h2>
@@ -112,7 +112,7 @@ code { font-size: 0.85em; }
112
112
  <div>
113
113
  <div class="card">
114
114
  <h2>Checkout por atributo <span class="pill">ConfiguredSelector</span></h2>
115
- <div class="ctx">selectedItems: main_offer (R$ 197).</div>
115
+ <div class="ctx">initialItems: main_offer (R$ 197).</div>
116
116
  <div class="product">
117
117
  <strong>Oferta Principal — R$ 197</strong>
118
118
  <div class="actions">
@@ -132,7 +132,7 @@ code { font-size: 0.85em; }
132
132
  <ul class="checklist">
133
133
  <li>[ ] Sem data-track → não dispara</li>
134
134
  <li>[ ] Com data-track → <code>INITIATE_CHECKOUT</code></li>
135
- <li>[ ] Snapshot com value/items do selectedItems</li>
135
+ <li>[ ] Snapshot com value/items do initialItems</li>
136
136
  <li>[ ] Detector: <code>ConfiguredSelector(INITIATE_CHECKOUT)</code></li>
137
137
  </ul>
138
138
  </div>
@@ -163,7 +163,7 @@ code { font-size: 0.85em; }
163
163
  </div>
164
164
  </div>
165
165
 
166
- <script src="../../../dist/v2/global.global.js"></script>
166
+ <script src="../../../v2/global.global.js"></script>
167
167
  <script>
168
168
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
169
169
  const API_ENDPOINT =
@@ -189,10 +189,19 @@ code { font-size: 0.85em; }
189
189
 
190
190
  function initiateCheckoutDetectorConfig() {
191
191
  return {
192
- enabled: true,
193
- selector: ['[data-track="initiate_checkout"]'],
194
- selectorType: 'css',
195
- };
192
+ enabled: true,
193
+ sources: [
194
+ {
195
+ name: 'initiateCheckout-selector',
196
+ type: 'selector',
197
+ selector: [
198
+ '[data-track=\'initiate_checkout\']'
199
+ ],
200
+ selectorType: 'css',
201
+ trigger: 'click'
202
+ }
203
+ ]
204
+ };
196
205
  }
197
206
 
198
207
  function buildConfig() {
@@ -206,11 +215,112 @@ code { font-size: 0.85em; }
206
215
  debug: true,
207
216
  },
208
217
  transport: {
209
- ...DEFAULT_PIXEL_CONFIG.transport,
210
- apiEndpoint: API_ENDPOINT,
211
- timeoutMs: 10000,
218
+ ...base.transport,
219
+ enabled: true,
220
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
221
+ persistence: { enabled: true },
222
+ replay: { enabled: true },
223
+ ordering: { enabled: true },
224
+ coordination: { enabled: true },
225
+ circuitBreaker: {
226
+ enabled: true,
227
+ failureThreshold: 5,
228
+ resetTimeoutMs: 30000,
229
+ halfOpenMaxAttempts: 2,
230
+ },
231
+ backpressure: {
232
+ enabled: true,
233
+ maxQueueSize: 500,
234
+ policy: 'drop_oldest',
235
+ sampleRate: 0.5,
236
+ },
237
+ deadLetter: { enabled: true, maxEntries: 200 },
238
+ compression: { enabled: true, strategy: 'identity' },
239
+ retry: {
240
+ enabled: true,
241
+ maxAttempts: 4,
242
+ baseDelayMs: 500,
243
+ maxDelayMs: 4000,
244
+ multiplier: 2,
245
+ },
246
+ batch: {
247
+ enabled: true,
248
+ batchSize: 10,
249
+ maxWaitMs: 5000,
250
+ },
251
+ timeout: { enabled: true, timeoutMs: 10000 },
252
+ offline: { enabled: true },
253
+ flush: {
254
+ enabled: true,
255
+ flushOnDestroy: true,
256
+ prepareUnloadHooks: true,
257
+ },
212
258
  },
213
259
  identity: { ...base.identity, pixelId: PIXEL_ID },
260
+ commerce: {
261
+ enabled: true,
262
+ currency: 'BRL',
263
+ catalog: { products: [
264
+ {
265
+ id: 'main_offer',
266
+ name: 'Oferta Principal',
267
+ type: 'main',
268
+ price: 197,
269
+ currency: 'BRL',
270
+ quantity: 1,
271
+ },
272
+ {
273
+ id: 'order_bump_01',
274
+ name: 'Order Bump Especial',
275
+ type: 'order_bump',
276
+ price: 47,
277
+ currency: 'BRL',
278
+ quantity: 1,
279
+ },
280
+ {
281
+ id: 'upsell_01',
282
+ name: 'Upsell 01',
283
+ type: 'upsell',
284
+ price: 97,
285
+ currency: 'BRL',
286
+ quantity: 1,
287
+ },
288
+ ] },
289
+ cart: {
290
+ mode: 'single_product',
291
+ initialItems: [{ productId: "main_offer", quantity: 1 }],
292
+ calculateValueFrom: 'cart',
293
+ allowDynamicItems: true,
294
+ },
295
+ mappings: {
296
+ attributes: {
297
+ productId: ['data-product-id', 'data-sku', 'data-offer-id'],
298
+ productName: ['data-product-name', 'data-name'],
299
+ price: ['data-product-price', 'data-price'],
300
+ quantity: ['data-quantity', 'data-qty'],
301
+ currency: ['data-currency'],
302
+ },
303
+ fields: {
304
+ productId: ['productId', 'product_id', 'offerId', 'sku'],
305
+ productName: ['productName', 'product_name'],
306
+ price: ['price', 'amount'],
307
+ quantity: ['quantity', 'qty'],
308
+ currency: ['currency'],
309
+ email: ['email', 'customerEmail'],
310
+ phone: ['phone', 'telefone', 'customerPhone'],
311
+ },
312
+ },
313
+ enrichment: {
314
+ pageView: { enabled: false, source: 'cart' },
315
+ viewContent: { enabled: true, source: 'event_or_cart' },
316
+ lead: { enabled: false, source: 'event_or_cart' },
317
+ addToCart: { enabled: true, source: 'event_or_cart' },
318
+ removeFromCart: { enabled: true, source: 'event_or_cart' },
319
+ initiateCheckout: { enabled: true, source: 'cart' },
320
+ addPaymentInfo: { enabled: true, source: 'cart' },
321
+ purchase: { enabled: true, source: 'cart' },
322
+ }
323
+ },
214
324
  modules: {
215
325
  ...base.modules,
216
326
  core: {
@@ -225,128 +335,31 @@ code { font-size: 0.85em; }
225
335
  },
226
336
  behavior: { ...base.modules.behavior, enabled: false },
227
337
  privacy: { ...base.modules.privacy, enabled: false },
228
- transport: {
229
- enabled: true,
230
- mockSender: { enabled: false },
231
- sender: { mode: 'http' },
232
- persistence: { enabled: true },
233
- replay: { enabled: true },
234
- ordering: { enabled: true },
235
- coordination: { enabled: true },
236
- circuitBreaker: {
237
- enabled: true,
238
- failureThreshold: 5,
239
- resetTimeoutMs: 30000,
240
- halfOpenMaxAttempts: 2,
241
- },
242
- backpressure: {
243
- enabled: true,
244
- maxQueueSize: 500,
245
- policy: 'drop_oldest',
246
- sampleRate: 0.5,
247
- },
248
- deadLetter: { enabled: true, maxEntries: 200 },
249
- compression: { enabled: true, strategy: 'identity' },
250
- retry: {
251
- enabled: true,
252
- maxAttempts: 4,
253
- baseDelayMs: 500,
254
- maxDelayMs: 4000,
255
- multiplier: 2,
256
- },
257
- batch: {
258
- enabled: true,
259
- batchSize: 10,
260
- flushIntervalMs: 2000,
261
- maxWaitMs: 5000,
262
- },
263
- timeout: { enabled: true, timeoutMs: 10000 },
264
- offline: { enabled: true },
265
- flush: {
266
- enabled: true,
267
- flushIntervalMs: 2000,
268
- flushOnDestroy: true,
269
- prepareUnloadHooks: true,
270
- },
271
- },
272
338
  integrations: { ...base.modules.integrations, enabled: false },
273
339
  conversion: {
274
340
  enabled: true,
275
- commerce: {
276
- currency: 'BRL',
277
- catalog: { products: [
278
- {
279
- id: 'main_offer',
280
- name: 'Oferta Principal',
281
- type: 'main',
282
- price: 197,
283
- currency: 'BRL',
284
- quantity: 1,
285
- },
286
- {
287
- id: 'order_bump_01',
288
- name: 'Order Bump Especial',
289
- type: 'order_bump',
290
- price: 47,
291
- currency: 'BRL',
292
- quantity: 1,
293
- },
294
- {
295
- id: 'upsell_01',
296
- name: 'Upsell 01',
297
- type: 'upsell',
298
- price: 97,
299
- currency: 'BRL',
300
- quantity: 1,
301
- },
302
- ] },
303
- checkout: {
304
- mode: 'single_product',
305
- selectedItems: [{ productId: "main_offer", quantity: 1 }],
306
- calculateValueFrom: 'selected_items',
307
- allowDynamicItems: true,
308
- },
309
- mappings: {
310
- attributes: {
311
- productId: ['data-product-id', 'data-sku', 'data-offer-id'],
312
- productName: ['data-product-name', 'data-name'],
313
- price: ['data-product-price', 'data-price'],
314
- quantity: ['data-quantity', 'data-qty'],
315
- currency: ['data-currency'],
316
- },
317
- fields: {
318
- productId: ['productId', 'product_id', 'offerId', 'sku'],
319
- productName: ['productName', 'product_name'],
320
- price: ['price', 'amount'],
321
- quantity: ['quantity', 'qty'],
322
- currency: ['currency'],
323
- email: ['email', 'customerEmail'],
324
- phone: ['phone', 'telefone', 'customerPhone'],
325
- },
326
- },
327
- },
328
341
  manual: {
329
342
  pageView: { enabled: false },
330
- purchase: { enabled: false },
331
- lead: { enabled: false },
332
- addToCart: { enabled: false },
333
- removeFromCart: { enabled: false },
343
+ purchase: { enabled: false, sources: [] },
344
+ lead: { enabled: false, sources: [] },
345
+ addToCart: { enabled: false, sources: [] },
346
+ removeFromCart: { enabled: false, sources: [] },
334
347
  initiateCheckout: { enabled: true },
335
- addPaymentInfo: { enabled: false },
336
- search: { enabled: false },
337
- viewContent: { enabled: false },
348
+ addPaymentInfo: { enabled: false, sources: [] },
349
+ search: { enabled: false, sources: [] },
350
+ viewContent: { enabled: false, sources: [] },
338
351
  },
339
352
  auto: {
340
353
  enabled: true,
341
354
  detectors: {
342
- lead: { enabled: false },
343
- purchase: { enabled: false },
344
- addToCart: { enabled: false },
345
- removeFromCart: { enabled: false },
355
+ lead: { enabled: false, sources: [] },
356
+ purchase: { enabled: false, sources: [] },
357
+ addToCart: { enabled: false, sources: [] },
358
+ removeFromCart: { enabled: false, sources: [] },
346
359
  initiateCheckout: initiateCheckoutDetectorConfig(),
347
- addPaymentInfo: { enabled: false },
348
- search: { enabled: false },
349
- viewContent: { enabled: false },
360
+ addPaymentInfo: { enabled: false, sources: [] },
361
+ search: { enabled: false, sources: [] },
362
+ viewContent: { enabled: false, sources: [] },
350
363
  },
351
364
  },
352
365
  rules: {