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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +303 -4
  2. package/README.md +90 -128
  3. package/RELEASE_CANDIDATE.md +218 -101
  4. package/dist/Pixel-BnN86r4X.d.ts +797 -0
  5. package/dist/Pixel-BoUGqCbP.d.mts +797 -0
  6. package/dist/{StorageFactory-CAkJJqVD.d.ts → StorageFactory-BfCArzMM.d.ts} +2 -2
  7. package/dist/{StorageFactory-BhpbB6Jj.d.mts → StorageFactory-C0prtNR7.d.mts} +2 -2
  8. package/dist/browser/index.cjs.js +3 -0
  9. package/dist/browser/index.cjs.js.map +1 -0
  10. package/dist/browser/index.d.mts +71 -0
  11. package/dist/browser/index.d.ts +71 -0
  12. package/dist/browser/index.esm.js +3 -0
  13. package/dist/browser/index.esm.js.map +1 -0
  14. package/dist/browser/pixel.buygoods-checkout.global.js +4 -0
  15. package/dist/browser/pixel.buygoods-checkout.global.js.map +1 -0
  16. package/dist/browser/pixel.buygoods-landing.global.js +4 -0
  17. package/dist/browser/pixel.buygoods-landing.global.js.map +1 -0
  18. package/dist/browser/pixel.global.js +4 -0
  19. package/dist/browser/pixel.global.js.map +1 -0
  20. package/dist/config/index.cjs.js +1 -1
  21. package/dist/config/index.cjs.js.map +1 -1
  22. package/dist/config/index.d.mts +16 -5
  23. package/dist/config/index.d.ts +16 -5
  24. package/dist/config/index.esm.js +1 -1
  25. package/dist/config/index.esm.js.map +1 -1
  26. package/dist/events/index.cjs.js +1 -1
  27. package/dist/events/index.cjs.js.map +1 -1
  28. package/dist/events/index.d.mts +2 -1
  29. package/dist/events/index.d.ts +2 -1
  30. package/dist/events/index.esm.js +1 -1
  31. package/dist/events/index.esm.js.map +1 -1
  32. package/dist/examples/html-script/README.md +21 -55
  33. package/dist/examples/html-script/RELEASE_CANDIDATE.md +39 -26
  34. package/dist/examples/html-script/add-payment-info/README.md +3 -3
  35. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +107 -96
  36. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +107 -96
  37. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +106 -95
  38. package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +114 -95
  39. package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +106 -95
  40. package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +97 -95
  41. package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +106 -95
  42. package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +106 -95
  43. package/dist/examples/html-script/add-to-cart/README.md +9 -6
  44. package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +133 -119
  45. package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +146 -130
  46. package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +144 -127
  47. package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +133 -119
  48. package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +590 -0
  49. package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +124 -116
  50. package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +133 -119
  51. package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +147 -130
  52. package/dist/examples/html-script/behavior/example-behavior-engagement.html +489 -0
  53. package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +350 -0
  54. package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +433 -0
  55. package/dist/examples/html-script/behavior/example-behavior-viewport.html +397 -0
  56. package/dist/examples/html-script/{example-behavior.html → behavior/example-behavior.html} +23 -17
  57. package/dist/examples/html-script/buygoods/example-buygoods-checkout.html +50 -0
  58. package/dist/examples/html-script/buygoods/ladding.html +184 -0
  59. package/dist/examples/html-script/example-basic.html +1 -1
  60. package/dist/examples/html-script/example-checkout-commerce.html +826 -0
  61. package/dist/examples/html-script/example-conversion.html +42 -49
  62. package/dist/examples/html-script/example-global-factory-classic.html +45 -0
  63. package/dist/examples/html-script/example-global-factory.html +40 -0
  64. package/dist/examples/html-script/example-integration.html +45 -51
  65. package/dist/examples/html-script/example-landing-commerce.html +416 -0
  66. package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
  67. package/dist/examples/html-script/example-transport.html +70 -63
  68. package/dist/examples/html-script/full-funnel/README.md +64 -0
  69. package/dist/examples/html-script/full-funnel/checkout.html +118 -0
  70. package/dist/examples/html-script/full-funnel/downsell.html +60 -0
  71. package/dist/examples/html-script/full-funnel/landing.html +153 -0
  72. package/dist/examples/html-script/full-funnel/thank-you.html +87 -0
  73. package/dist/examples/html-script/full-funnel/upsell.html +66 -0
  74. package/dist/examples/html-script/initiate-checkout/README.md +6 -6
  75. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +135 -122
  76. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +143 -128
  77. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +144 -128
  78. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +127 -120
  79. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +136 -123
  80. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +144 -131
  81. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +146 -130
  82. package/dist/examples/html-script/internal-checkout/example-cardioclear-checkout.html +103 -0
  83. package/dist/examples/html-script/internal-checkout/example-slimsoda-checkout.html +103 -0
  84. package/dist/examples/html-script/lead/README.md +9 -7
  85. package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +107 -94
  86. package/dist/examples/html-script/lead/example-lead-trigger-auto.html +118 -103
  87. package/dist/examples/html-script/lead/example-lead-trigger-click.html +118 -102
  88. package/dist/examples/html-script/release-candidate.html +219 -107
  89. package/dist/examples/html-script/remove-from-cart/README.md +4 -4
  90. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +134 -121
  91. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +134 -121
  92. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +141 -128
  93. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +125 -118
  94. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +135 -122
  95. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +136 -123
  96. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +139 -124
  97. package/dist/examples/html-script/search/README.md +1 -1
  98. package/dist/examples/html-script/search/example-search-attribute.html +107 -99
  99. package/dist/examples/html-script/search/example-search-button-sync.html +107 -99
  100. package/dist/examples/html-script/search/example-search-dedupe.html +107 -99
  101. package/dist/examples/html-script/search/example-search-input.html +108 -99
  102. package/dist/examples/html-script/search/example-search-manual.html +98 -96
  103. package/dist/examples/html-script/search/example-search-submit.html +107 -99
  104. package/dist/examples/html-script/search/example-search-text.html +112 -99
  105. package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +92 -0
  106. package/dist/examples/html-script/url-context/example-url-context-landing.html +110 -0
  107. package/dist/examples/html-script/url-context/example-url-context-upsell.html +105 -0
  108. package/dist/examples/html-script/url-context/example-url-context.html +205 -0
  109. package/dist/examples/html-script/view-content/README.md +1 -1
  110. package/dist/examples/html-script/view-content/example-view-content-attribute.html +126 -118
  111. package/dist/examples/html-script/view-content/example-view-content-css.html +126 -118
  112. package/dist/examples/html-script/view-content/example-view-content-dedupe.html +126 -118
  113. package/dist/examples/html-script/view-content/example-view-content-empty.html +126 -118
  114. package/dist/examples/html-script/view-content/example-view-content-manual.html +117 -115
  115. package/dist/examples/html-script/view-content/example-view-content-product-card.html +126 -118
  116. package/dist/examples/html-script/view-content/example-view-content-text.html +131 -121
  117. package/dist/examples/release-candidate/README.md +2 -1
  118. package/dist/examples/v2/README.md +16 -13
  119. package/dist/index-B8u_3PGG.d.ts +460 -0
  120. package/dist/index-BxT2d-TK.d.mts +460 -0
  121. package/dist/index.cjs.js +1 -1
  122. package/dist/index.cjs.js.map +1 -1
  123. package/dist/index.d.mts +23 -361
  124. package/dist/index.d.ts +23 -361
  125. package/dist/index.esm.js +1 -1
  126. package/dist/index.esm.js.map +1 -1
  127. package/dist/pixel-DNGbAN5C.d.ts +871 -0
  128. package/dist/pixel-_BSDpx4M.d.mts +871 -0
  129. package/dist/pixel-default-config-BMYaqs7i.d.ts +21 -0
  130. package/dist/pixel-default-config-DLRya1tl.d.mts +21 -0
  131. package/dist/pixel-settings-D-t9zQb4.d.ts +40 -0
  132. package/dist/pixel-settings-DGxl0MVm.d.mts +40 -0
  133. package/dist/runtime/index.cjs.js +1 -1
  134. package/dist/runtime/index.cjs.js.map +1 -1
  135. package/dist/runtime/index.d.mts +19 -26
  136. package/dist/runtime/index.d.ts +19 -26
  137. package/dist/runtime/index.esm.js +1 -1
  138. package/dist/runtime/index.esm.js.map +1 -1
  139. package/dist/services/index.cjs.js +1 -1
  140. package/dist/services/index.cjs.js.map +1 -1
  141. package/dist/services/index.d.mts +14 -6
  142. package/dist/services/index.d.ts +14 -6
  143. package/dist/services/index.esm.js +1 -1
  144. package/dist/services/index.esm.js.map +1 -1
  145. package/dist/types-B-Nzagpk.d.mts +19 -0
  146. package/dist/types-D0KVsgzs.d.mts +293 -0
  147. package/dist/types-D3kJ9bfT.d.ts +293 -0
  148. package/dist/types-Dfi9C49l.d.ts +19 -0
  149. package/dist/url-context-Ck2LK18V.d.mts +87 -0
  150. package/dist/url-context-Ck2LK18V.d.ts +87 -0
  151. package/dist/v2/global.global.js +1 -1
  152. package/dist/v2/global.global.js.map +1 -1
  153. package/dist/v2/index.cjs.js +1 -1
  154. package/dist/v2/index.cjs.js.map +1 -1
  155. package/dist/v2/index.d.mts +26 -6
  156. package/dist/v2/index.d.ts +26 -6
  157. package/dist/v2/index.esm.js +1 -1
  158. package/dist/v2/index.esm.js.map +1 -1
  159. package/docs/public/README.md +80 -0
  160. package/docs/public/api/exports.md +55 -0
  161. package/docs/public/api/pixel.md +86 -0
  162. package/docs/public/configuration/commerce.md +44 -0
  163. package/docs/public/configuration/modules.md +63 -0
  164. package/docs/public/configuration/overview.md +85 -0
  165. package/docs/public/configuration/transport.md +127 -0
  166. package/docs/public/events/catalog.md +67 -0
  167. package/docs/public/getting-started/installation.md +87 -0
  168. package/docs/public/getting-started/quick-start.md +142 -0
  169. package/docs/public/getting-started/react-nextjs.md +78 -0
  170. package/docs/public/getting-started/script-tag.md +94 -0
  171. package/docs/public/guides/funnel-checkout.md +52 -0
  172. package/docs/public/guides/funnel-downsell.md +53 -0
  173. package/docs/public/guides/funnel-full.md +64 -0
  174. package/docs/public/guides/funnel-landing.md +70 -0
  175. package/docs/public/guides/funnel-thank-you.md +48 -0
  176. package/docs/public/guides/funnel-upsell.md +72 -0
  177. package/docs/public/limitations.md +33 -0
  178. package/docs/public/privacy/limitations.md +33 -0
  179. package/docs/public/release-candidate/validation.md +42 -0
  180. package/docs/public/troubleshooting.md +56 -0
  181. package/package.json +38 -20
  182. package/dist/index-DUfFzniE.d.mts +0 -274
  183. package/dist/index-DUfFzniE.d.ts +0 -274
  184. package/dist/pixel-CbeF25mD.d.mts +0 -555
  185. package/dist/pixel-CbeF25mD.d.ts +0 -555
  186. package/dist/pixel-default-config-1VgLFOiL.d.mts +0 -5
  187. package/dist/pixel-default-config-Bxb-Vdd8.d.ts +0 -5
  188. package/dist/types-CTpRvFKZ.d.ts +0 -71
  189. package/dist/types-DGlBdsAy.d.mts +0 -71
@@ -1,21 +1,43 @@
1
1
  # Pixel v2 — Release Candidate Notes
2
2
 
3
- **Pacote:** `@agenus-io/pixel`
4
- **Versão:** `0.0.15` (release candidate)
5
- **Data:** 2026-07-11
6
- **Status:** Pronto para publicar RC — **nenhuma pendência P0 conhecida**
3
+ **Pacote:** `@beworke/pixel`
4
+ **Versão:** consulte `package.json` (fonte de verdade; este arquivo é histórico do RC)
5
+ **Data:** 2026-07-14
6
+ **Status 20:** **Concluída** — Runtime Intelligence · [`PLAN_PIXEL/PIXEL_V2_STAGE_20_REPORT.md`](../../../PLAN_PIXEL/PIXEL_V2_STAGE_20_REPORT.md)
7
7
 
8
- > Guia do playground consumidor: [`examples/html-script/RELEASE_CANDIDATE.md`](./examples/html-script/RELEASE_CANDIDATE.md)
9
- > Backlog: [`PIXEL_V2_BACKLOG_PENDENCIAS_ISOLADO.md`](./PIXEL_V2_BACKLOG_PENDENCIAS_ISOLADO.md)
8
+ > Runtime e módulos implementados estão prontos para **validação controlada**.
9
+ > **Próxima etapa oficial: 21 — Commerce lifecycle** (Behavior Runtime Evolution 17–20 concluída).
10
+ > Privacy Module foi movido para o roadmap **Public SDK Hardening** (etapa 25).
11
+ > Será desenvolvido antes da primeira distribuição pública da SDK.
12
+ > **Não** faz parte do Runtime obrigatório da versão 1.0 interna.
13
+
14
+ > Guia do playground: [`apps/playground-html/RELEASE_CANDIDATE.md`](../../../apps/playground-html/RELEASE_CANDIDATE.md)
15
+ > Funil completo: [`apps/playground-html/full-funnel/`](../../../apps/playground-html/full-funnel/)
16
+ > Backlog: [`PLAN_PIXEL/PIXEL_V2_BACKLOG_PENDENCIAS_ISOLADO.md`](../../../PLAN_PIXEL/PIXEL_V2_BACKLOG_PENDENCIAS_ISOLADO.md)
10
17
 
11
18
  ---
12
19
 
13
20
  ## 1. Status do RC
14
21
 
15
22
  ```txt
16
- Pixel v2 está pronto para release candidate.
17
- Nenhuma pendência P0 conhecida.
18
- npm publish NÃO foi executado nesta etapa (13B).
23
+ Pixel v2 RC 0.1.0-rc.5 — Etapas 1–20 concluídas.
24
+ Runtime Intelligence (20): RateLimit + Buffer + StateMachine + SessionSummary → BEHAVIOR_SESSION_SUMMARY via Dispatcher.
25
+ Engagement (19): `modules.behavior.engagement` (score determinístico 0..100 via ManagedScheduler) → `ENGAGEMENT_UPDATE`/`ENGAGEMENT_SUMMARY` via Dispatcher.
26
+ Hardening 19.1 (gate 20): ApiEventType inclui ENGAGEMENT_UPDATE/SUMMARY; ordem init; playground summary; SignalBus reinit.
27
+ Viewport (18): `modules.behavior.trackers.viewport` (targets[] + IntersectionObserver/MutationObserver) → `VIEWPORT_ENTER`/`VIEWPORT_EXIT` via Dispatcher.
28
+ Hardening 18.1: mutation rescan cleanup→scan; Dispatcher listener failure isolation; testes limite/SSR/observers.
29
+ Heartbeat (17): `modules.behavior.heartbeat` (único contrato; `intervalMs` / `hiddenIntervalMs`) → `BEHAVIOR_HEARTBEAT` via Dispatcher.
30
+ Core UrlContext (15A): query_params + url_context em eventos.
31
+ Commerce é root config (cart.initialItems + enrichment) — plano fechado em rc.3.
32
+ Contrato auto oficial: detectors[event].sources[].
33
+ Matriz oficial de testes: PIXEL_V2_VALIDATION_MATRIX.md
34
+ npm publish NÃO executado nesta etapa.
35
+ git tag NÃO criada nesta etapa.
36
+ Breaking vs 0.1.0-rc.5 pré-18: contrato stub `trackers.viewport` (selector/selectorType/visibilityThreshold) removido — nunca esteve wired em produção.
37
+ Breaking vs 0.1.0-rc.5 pré-17: nenhum (adição aditiva Heartbeat).
38
+ Breaking vs 0.1.0-rc.3: nenhum (adição UrlContext apenas).
39
+ Breaking vs 0.1.0-rc.2: modules.conversion.commerce removido; checkout→cart; selectedItems→initialItems.
40
+ Breaking vs 0.1.0-rc.1: detectors usam sources[] (campos soltos no detector removidos).
19
41
  ```
20
42
 
21
43
  Validado em 13A (consumidor real) + 13B (pacote / instalação limpa).
@@ -27,7 +49,7 @@ Validado em 13A (consumidor real) + 13B (pacote / instalação limpa).
27
49
  ```txt
28
50
  Runtime v2 + bootstrap
29
51
  Core services (visitor, session, fingerprint, storage)
30
- Behavior tracking
52
+ Behavior tracking (P0 + Heartbeat + Viewport)
31
53
  Conversion tracking (manual + auto)
32
54
  Transport real Event + Batch (HttpSender)
33
55
  Resiliência (retry, offline, circuit breaker, DLQ, …)
@@ -35,7 +57,8 @@ Replay / Ordering / Coordination
35
57
  Browser destinations (Meta / Google / TikTok)
36
58
  Attribution
37
59
  Commerce + AutoTrack avançado (12A–12M)
38
- Playgrounds examples/html-script/*
60
+ Core UrlContext (15A — query_params, managed/forward, link decoration)
61
+ Playgrounds apps/playground-html/*
39
62
  Smoke real opcional (env)
40
63
  Release candidate HTML + pack validation (13A–13B)
41
64
  ```
@@ -49,25 +72,31 @@ Correção recente (pré-13B): match `text:` leaf-only — evita ADD_TO_CART em
49
72
  ### Registry (quando publicado)
50
73
 
51
74
  ```bash
52
- pnpm add @agenus-io/pixel
75
+ pnpm add @beworke/pixel
53
76
  # ou
54
- npm install @agenus-io/pixel
77
+ npm install @beworke/pixel
55
78
  ```
56
79
 
57
80
  ### Tarball local (RC sem publish)
58
81
 
82
+ Na raiz do monorepo:
83
+
59
84
  ```bash
60
- npm run build
61
- npm pack
62
- npm install ./agenus-io-pixel-0.0.15.tgz
85
+ pnpm pack:pixel
86
+ pnpm validate:pixel-package
87
+ # opcional: instalar o .tgz gerado em artifacts/
88
+ pnpm smoke:pixel-package
63
89
  ```
64
90
 
65
- Validar tarball:
91
+ O fluxo oficial é **`pnpm pack:pixel`** (escreve em `artifacts/`).
92
+ Não use `pnpm --filter @beworke/pixel pack` como fluxo principal.
93
+
94
+ Validar tarball (usa `artifacts/latest-package.json`):
66
95
 
67
96
  ```bash
68
- npm run validate:rc-package
69
- # ou
70
- node scripts/validate-rc-package.mjs ./agenus-io-pixel-0.0.15.tgz
97
+ pnpm validate:pixel-package
98
+ # ou caminho explícito:
99
+ node scripts/validate-rc-package.mjs artifacts/beworke-pixel-0.1.0-rc.6.tgz
71
100
  ```
72
101
 
73
102
  ---
@@ -75,109 +104,75 @@ node scripts/validate-rc-package.mjs ./agenus-io-pixel-0.0.15.tgz
75
104
  ## 4. Como usar via import (ESM)
76
105
 
77
106
  ```ts
78
- import { Pixel, DEFAULT_PIXEL_CONFIG } from '@agenus-io/pixel';
107
+ import { createPixel } from '@beworke/pixel';
79
108
 
80
- const pixel = new Pixel({
81
- ...DEFAULT_PIXEL_CONFIG,
82
- identity: {
83
- ...DEFAULT_PIXEL_CONFIG.identity,
84
- pixelId: 'pix_xxx',
85
- },
86
- transport: {
87
- ...DEFAULT_PIXEL_CONFIG.transport,
88
- apiEndpoint: 'https://sua-api.example.com',
89
- },
90
- modules: {
91
- ...DEFAULT_PIXEL_CONFIG.modules,
92
- core: {
93
- ...DEFAULT_PIXEL_CONFIG.modules.core,
94
- enabled: true,
95
- pageView: {
96
- ...DEFAULT_PIXEL_CONFIG.modules.core.pageView,
97
- enabled: true,
98
- trackInitialPageView: true,
99
- },
100
- },
101
- conversion: {
102
- ...DEFAULT_PIXEL_CONFIG.modules.conversion,
103
- enabled: true,
104
- manual: {
105
- ...DEFAULT_PIXEL_CONFIG.modules.conversion.manual,
106
- lead: { enabled: true },
107
- purchase: { enabled: true },
108
- },
109
- },
110
- transport: {
111
- ...DEFAULT_PIXEL_CONFIG.modules.transport,
112
- enabled: true,
113
- mockSender: { enabled: false },
114
- sender: { mode: 'http' },
115
- },
116
- },
109
+ const pixel = await createPixel({
110
+ identity: { pixelId: 'pix_xxx' },
117
111
  });
118
112
 
119
- await pixel.init();
120
113
  // PAGE_VIEW: emitido pelo Core (trackInitialPageView) — não existe pixel.pageView()
121
114
  pixel.lead({ email: 'user@example.com' });
122
115
  pixel.purchase({ orderId: '1', value: 99.9, currency: 'BRL' });
123
116
  await pixel.destroy();
124
117
  ```
125
118
 
119
+ Overrides parciais e `PixelConfig` completo continuam válidos. `DEFAULT_PIXEL_CONFIG` permanece para inspeção avançada.
120
+
126
121
  ### CJS
127
122
 
128
123
  ```js
129
- const { Pixel, DEFAULT_PIXEL_CONFIG } = require('@agenus-io/pixel');
124
+ const { createPixel } = require('@beworke/pixel');
130
125
  ```
131
126
 
132
127
  ### Subpath `/v2`
133
128
 
134
129
  ```ts
135
- import { Pixel } from '@agenus-io/pixel/v2';
130
+ import { Pixel } from '@beworke/pixel/v2';
136
131
  ```
137
132
 
138
133
  ---
139
134
 
140
135
  ## 5. Como usar via script tag
141
136
 
142
- Bundle IIFE: `dist/v2/global.global.js` → **`window.PixelV2`**
137
+ Bundle recomendado: `dist/browser/pixel.global.js` → **`window.Pixel(settings)`**
143
138
 
144
139
  ```html
145
- <script src="./node_modules/@agenus-io/pixel/dist/v2/global.global.js"></script>
146
- <script>
147
- const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
148
- const pixel = new Pixel({
149
- ...DEFAULT_PIXEL_CONFIG,
150
- identity: { ...DEFAULT_PIXEL_CONFIG.identity, pixelId: 'pix_xxx' },
151
- transport: {
152
- ...DEFAULT_PIXEL_CONFIG.transport,
153
- apiEndpoint: 'https://sua-api.example.com',
154
- },
140
+ <script src="./node_modules/@beworke/pixel/dist/browser/pixel.global.js"></script>
141
+ <script type="module">
142
+ const pixel = await Pixel({
143
+ identity: { pixelId: 'pix_xxx' },
155
144
  });
156
- pixel.init();
145
+ pixel.lead({ email: 'user@example.com' });
157
146
  </script>
158
147
  ```
159
148
 
160
- Export npm: `@agenus-io/pixel/global`.
149
+ `window.PixelV2` permanece como compatibilidade / API de baixo nível.
150
+
151
+ Export npm: `@beworke/pixel/global`.
161
152
 
162
153
  ---
163
154
 
164
155
  ## 6. Transport real
165
156
 
166
157
  ```ts
167
- modules: {
168
- transport: {
158
+ transport: {
159
+ ...DEFAULT_TRANSPORT_CONFIG,
160
+ enabled: true,
161
+ sender: {
162
+ mode: 'internal',
163
+ baseUrl: process.env.PIXEL_API_ENDPOINT,
164
+ },
165
+ batch: {
166
+ ...DEFAULT_TRANSPORT_CONFIG.batch,
169
167
  enabled: true,
170
- mockSender: { enabled: false },
171
- sender: { mode: 'http' },
172
- batch: { enabled: true, batchSize: 1 }, // Event
173
- // batchSize: 10 → Batch
168
+ batchSize: 1, // Event; use 10 para Batch
174
169
  },
175
170
  },
176
- transport: {
177
- apiEndpoint: process.env.PIXEL_API_ENDPOINT, // não hardcodar em produção
178
- },
179
171
  ```
180
172
 
173
+ Para sender `test`, `internal` sem `baseUrl` e `external`, consulte
174
+ [`docs/public/configuration/transport.md`](./docs/public/configuration/transport.md).
175
+
181
176
  Endpoints oficiais do SDK:
182
177
 
183
178
  ```txt
@@ -187,21 +182,142 @@ POST {apiEndpoint}/pixels/public/event/batch
187
182
 
188
183
  ---
189
184
 
190
- ## 7. Commerce (resumo)
185
+ ## 7. Commerce + Auto Sources (resumo)
191
186
 
192
187
  ```ts
193
- modules.conversion.commerce = {
188
+ // Commerce global (raiz — Etapa 14A)
189
+ commerce: {
190
+ enabled: true,
194
191
  currency: 'BRL',
195
- catalog: { products: [{ id: 'main_offer', name: '…', price: 197, … }] },
196
- checkout: {
197
- selectedItems: [{ productId: 'main_offer', quantity: 1 }],
198
- calculateValueFrom: 'selected_items',
192
+ catalog: { products: [{ id: 'main_offer', price: 197, type: 'main' }] },
193
+ cart: {
194
+ mode: 'checkout',
195
+ initialItems: [{ productId: 'main_offer', quantity: 1 }],
199
196
  allowDynamicItems: true,
197
+ calculateValueFrom: 'cart',
198
+ },
199
+ enrichment: {
200
+ pageView: { enabled: false, source: 'cart' },
201
+ initiateCheckout: { enabled: true, source: 'cart' },
202
+ },
203
+ },
204
+
205
+ modules.conversion.auto = {
206
+ enabled: true,
207
+ detectors: {
208
+ addToCart: {
209
+ enabled: true,
210
+ sources: [
211
+ {
212
+ name: 'main-product-after-contact',
213
+ type: 'form',
214
+ selectorForm: {
215
+ fields: ['email', 'phone'],
216
+ mode: 'all',
217
+ formSelector: '#checkout-form',
218
+ trigger: 'input',
219
+ fireOnce: true,
220
+ },
221
+ },
222
+ {
223
+ name: 'product-or-bump-click',
224
+ type: 'selector',
225
+ selector: ['[data-track="add_to_cart"]', 'text:Comprar agora'],
226
+ selectorType: 'css',
227
+ trigger: 'click',
228
+ fireOnce: false,
229
+ },
230
+ ],
231
+ },
232
+ initiateCheckout: {
233
+ enabled: true,
234
+ sources: [
235
+ {
236
+ name: 'checkout-loaded',
237
+ type: 'lifecycle',
238
+ trigger: 'ready',
239
+ fireOnce: true,
240
+ },
241
+ ],
242
+ },
243
+ addPaymentInfo: {
244
+ enabled: true,
245
+ sources: [
246
+ {
247
+ name: 'credit-card-detection',
248
+ type: 'payment',
249
+ paymentMethod: 'CREDIT_CARD',
250
+ cardDetection: true,
251
+ autoDispatch: true,
252
+ fireOnce: true,
253
+ },
254
+ ],
255
+ },
200
256
  },
201
257
  };
202
258
  ```
203
259
 
204
- Detalhes: `PIXEL_V2_COMMERCE_AUTOTRACK_PLAN.md` · playgrounds em `examples/html-script/`.
260
+ Detalhes: `PLAN_PIXEL/PIXEL_V2_COMMERCE_AUTOTRACK_PLAN.md` · playgrounds em `apps/playground-html/`.
261
+
262
+ ---
263
+
264
+ ## Hardening 14B
265
+
266
+ Etapa final de hardening antes de testes reais em produção:
267
+
268
+ - **`commerce.enabled`** controla enrichment global — sem `enabled: true`, nenhum evento é enriquecido pelo CommerceResolver
269
+ - **`commerce.enrichment[event]`** controla enriquecimento por evento (`pageView`, `viewContent`, `addToCart`, …)
270
+ - **`FormSource`** respeita `selector` / `formSelector` em todos os triggers (`input`, `change`, `submit`, `click`)
271
+ - **`PaymentSource`** respeita o `formSelector` real do campo de pagamento
272
+ - **API pública** aceita payload opcional onde o cart resolve (ex.: `pixel.initiateCheckout()` sem args)
273
+ - **Docs normalizadas** para rc.3 — removidos resíduos de `commerce.checkout`, `selectedItems`, detector solto
274
+
275
+ ## Fechamento 14C
276
+
277
+ - ADD_TO_CART por FormSource sem `productId` agora usa `commerce.cart.initialItems` (item principal do cart runtime) como fallback quando enrichment permite.
278
+ - Payload manual continua tendo prioridade.
279
+ - Cart fallback respeita `commerce.enabled` e `commerce.enrichment.addToCart.enabled`.
280
+ - Docs limpas de aliases públicos antigos (`CommerceItem`, `CommerceCheckoutMode`, `selected_items` / `event_items` no tipo oficial).
281
+ - Exemplos CDN ajustados para `@rc` / versão fixa (não `@latest`).
282
+
283
+ ---
284
+
285
+ ## Etapa 15A — Core UrlContext
286
+
287
+ Checklist de validação (rc.4 — Production Ready):
288
+
289
+ ```txt
290
+ [x] example-url-context.html — checkout + upsell com link decoration
291
+ [x] example-url-context-landing.html — landing gera sid público na URL
292
+ [x] example-url-context-upsell.html — forward params entre páginas do funil
293
+ [x] example-url-context-allowed-domains.html — allowedDomains restringe decoração
294
+ [x] Eventos carregam query_params quando urlContext enabled
295
+ [x] Eventos carregam url_context.managed / forwarded / source
296
+ [x] sid público na URL ≠ session_id interno do Pixel
297
+ [x] Params da denylist (token, password, cvv) não capturados nem encaminhados
298
+ [x] order_id permitido na URL; token de pagamento não exposto no SDK
299
+ [x] Hardening: hash/relativos, encoding, idempotência, snapshot freeze, destroy
300
+ [x] npm run type-check / npm test / npm run build
301
+ [x] npm pack → beworke-pixel-0.1.0-rc.4.tgz
302
+ [x] npm run validate:rc-package
303
+ [ ] npm publish --tag rc # manual
304
+ [ ] git tag # manual
305
+ ```
306
+
307
+ ---
308
+
309
+ ## Etapa 15B — Validation Matrix (fechamento)
310
+
311
+ ```txt
312
+ [x] PIXEL_V2_VALIDATION_MATRIX.md
313
+ [x] PIXEL_V2_STAGE_15B_REPORT.md
314
+ [x] full-funnel playground (contrato oficial commerce + PaymentMethod)
315
+ [x] validate:15b / module matrix
316
+ [x] docs alinhadas (1–15B concluídas)
317
+ [x] npm run type-check / test / build / smoke / pack / validate:rc-package
318
+ [ ] npm publish --tag rc
319
+ [ ] git tag
320
+ ```
205
321
 
206
322
  ---
207
323
 
@@ -226,31 +342,32 @@ npm run test:smoke:real
226
342
  [x] npm run type-check
227
343
  [x] npm test
228
344
  [x] npm run build
229
- [x] npm run test:smoke:real (skip sem env / ACK com env)
345
+ [x] npm run test:smoke:real
230
346
  [x] npm pack --dry-run
231
- [x] npm pack → agenus-io-pixel-0.0.15.tgz
347
+ [x] npm pack
232
348
  [x] npm run validate:rc-package
233
- [x] dist/v2/global.global.js no tarball
234
- [x] types .d.ts no tarball
235
- [x] sem .env / credenciais no tarball
236
- [ ] npm publish --tag rc # manual, fora da 13B
237
- [ ] git tag # manual, fora da 13B
349
+ [ ] npm publish --tag rc
350
+ [ ] git tag
238
351
  ```
239
352
 
353
+ Evidências: `PIXEL_V2_STAGE_15B_REPORT.md`.
354
+
240
355
  ---
241
356
 
242
357
  ## 10. Pendências conhecidas (não bloqueiam RC)
243
358
 
244
- **P1:** PrivacyModule/Consent · Behavior P1 · debug snapshot · limpeza CommerceState pós-purchase · docs públicas
359
+ **P1 (Runtime):** Heartbeat (17) ✅ · Viewport (18) ✅ · Engagement (19) ✅ · Runtime Intelligence (20) ✅ · Commerce lifecycle (21) · Event contract · Attribution bridge · Observabilidade
360
+
361
+ **P2:** destinations extras · CAPI/server-side (**backend**, não SDK) · sampling
245
362
 
246
- **P2:** destinations extras · CAPI/server-side (**backend**, não SDK) · sampling · observabilidade
363
+ **Public SDK Hardening (25):** Privacy Module · Consent Gate · CMP · GDPR / LGPD / CCPA — **não** bloqueiam 1.0 interna
247
364
 
248
365
  ---
249
366
 
250
- ## 11. Fora do SDK
367
+ ## 11. Fora do Runtime 1.0 interno
251
368
 
252
369
  ```txt
253
370
  CAPI / enrichments server-side
254
- Consent gate completo (PrivacyModule ainda stub)
371
+ Public SDK Hardening (Privacy / Consent / CMP / GDPR / LGPD / CCPA)
255
372
  Publicação automática npm / CDN
256
373
  ```