@beworke/pixel 0.1.0-rc.7 → 0.1.0-rc.9

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 (150) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +71 -56
  3. package/RELEASE_CANDIDATE.md +28 -62
  4. package/dist/Pixel-BnN86r4X.d.ts +797 -0
  5. package/dist/Pixel-BoUGqCbP.d.mts +797 -0
  6. package/dist/{StorageFactory-DeMaZ8wk.d.ts → StorageFactory-BfCArzMM.d.ts} +1 -1
  7. package/dist/{StorageFactory-Cq29vF32.d.mts → StorageFactory-C0prtNR7.d.mts} +1 -1
  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 +55 -0
  11. package/dist/browser/index.d.ts +55 -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.global.js +4 -0
  15. package/dist/browser/pixel.global.js.map +1 -0
  16. package/dist/config/index.cjs.js +1 -1
  17. package/dist/config/index.cjs.js.map +1 -1
  18. package/dist/config/index.d.mts +15 -5
  19. package/dist/config/index.d.ts +15 -5
  20. package/dist/config/index.esm.js +1 -1
  21. package/dist/config/index.esm.js.map +1 -1
  22. package/dist/examples/html-script/RELEASE_CANDIDATE.md +6 -8
  23. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +40 -47
  24. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +40 -47
  25. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +40 -47
  26. package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +40 -47
  27. package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +40 -47
  28. package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +40 -47
  29. package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +40 -47
  30. package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +40 -47
  31. package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +40 -47
  32. package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +40 -47
  33. package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +40 -47
  34. package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +40 -47
  35. package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +40 -47
  36. package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +40 -47
  37. package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +40 -47
  38. package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +40 -47
  39. package/dist/examples/html-script/behavior/example-behavior-engagement.html +4 -4
  40. package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +4 -4
  41. package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +4 -4
  42. package/dist/examples/html-script/behavior/example-behavior-viewport.html +4 -4
  43. package/dist/examples/html-script/buygoods/example-buygoods-checkout.html +156 -0
  44. package/dist/examples/html-script/example-checkout-commerce.html +31 -30
  45. package/dist/examples/html-script/example-conversion.html +41 -48
  46. package/dist/examples/html-script/example-global-factory-classic.html +45 -0
  47. package/dist/examples/html-script/example-global-factory.html +40 -0
  48. package/dist/examples/html-script/example-integration.html +39 -45
  49. package/dist/examples/html-script/example-landing-commerce.html +3 -8
  50. package/dist/examples/html-script/example-runtime-diagnostics.html +4 -4
  51. package/dist/examples/html-script/example-transport.html +59 -57
  52. package/dist/examples/html-script/full-funnel/checkout.html +3 -1
  53. package/dist/examples/html-script/full-funnel/downsell.html +3 -1
  54. package/dist/examples/html-script/full-funnel/landing.html +3 -1
  55. package/dist/examples/html-script/full-funnel/thank-you.html +3 -1
  56. package/dist/examples/html-script/full-funnel/upsell.html +3 -1
  57. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +40 -47
  58. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +40 -47
  59. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +40 -47
  60. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +40 -47
  61. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +40 -47
  62. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +40 -47
  63. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +40 -47
  64. package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +40 -47
  65. package/dist/examples/html-script/lead/example-lead-trigger-auto.html +40 -47
  66. package/dist/examples/html-script/lead/example-lead-trigger-click.html +40 -47
  67. package/dist/examples/html-script/release-candidate.html +31 -30
  68. package/dist/examples/html-script/remove-from-cart/README.md +3 -3
  69. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +40 -47
  70. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +40 -47
  71. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +47 -54
  72. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +40 -47
  73. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +40 -47
  74. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +40 -47
  75. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +40 -47
  76. package/dist/examples/html-script/search/example-search-attribute.html +40 -47
  77. package/dist/examples/html-script/search/example-search-button-sync.html +40 -47
  78. package/dist/examples/html-script/search/example-search-dedupe.html +40 -47
  79. package/dist/examples/html-script/search/example-search-input.html +40 -47
  80. package/dist/examples/html-script/search/example-search-manual.html +40 -47
  81. package/dist/examples/html-script/search/example-search-submit.html +40 -47
  82. package/dist/examples/html-script/search/example-search-text.html +40 -47
  83. package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +4 -4
  84. package/dist/examples/html-script/url-context/example-url-context-landing.html +4 -4
  85. package/dist/examples/html-script/url-context/example-url-context-upsell.html +4 -4
  86. package/dist/examples/html-script/url-context/example-url-context.html +4 -4
  87. package/dist/examples/html-script/view-content/example-view-content-attribute.html +40 -47
  88. package/dist/examples/html-script/view-content/example-view-content-css.html +40 -47
  89. package/dist/examples/html-script/view-content/example-view-content-dedupe.html +40 -47
  90. package/dist/examples/html-script/view-content/example-view-content-empty.html +40 -47
  91. package/dist/examples/html-script/view-content/example-view-content-manual.html +40 -47
  92. package/dist/examples/html-script/view-content/example-view-content-product-card.html +40 -47
  93. package/dist/examples/html-script/view-content/example-view-content-text.html +40 -47
  94. package/dist/index.cjs.js +1 -1
  95. package/dist/index.cjs.js.map +1 -1
  96. package/dist/index.d.mts +8 -6
  97. package/dist/index.d.ts +8 -6
  98. package/dist/index.esm.js +1 -1
  99. package/dist/index.esm.js.map +1 -1
  100. package/dist/{pixel-2uL4LSyC.d.ts → pixel-DNGbAN5C.d.ts} +117 -98
  101. package/dist/{pixel-DMwpppf_.d.mts → pixel-_BSDpx4M.d.mts} +117 -98
  102. package/dist/pixel-default-config-BMYaqs7i.d.ts +21 -0
  103. package/dist/pixel-default-config-DLRya1tl.d.mts +21 -0
  104. package/dist/pixel-settings-D-t9zQb4.d.ts +40 -0
  105. package/dist/pixel-settings-DGxl0MVm.d.mts +40 -0
  106. package/dist/runtime/index.cjs.js +1 -1
  107. package/dist/runtime/index.cjs.js.map +1 -1
  108. package/dist/runtime/index.d.mts +4 -4
  109. package/dist/runtime/index.d.ts +4 -4
  110. package/dist/runtime/index.esm.js +1 -1
  111. package/dist/runtime/index.esm.js.map +1 -1
  112. package/dist/services/index.cjs.js +1 -1
  113. package/dist/services/index.cjs.js.map +1 -1
  114. package/dist/services/index.d.mts +4 -4
  115. package/dist/services/index.d.ts +4 -4
  116. package/dist/services/index.esm.js +1 -1
  117. package/dist/services/index.esm.js.map +1 -1
  118. package/dist/{types-6HF3UlsL.d.mts → types-B-Nzagpk.d.mts} +2 -2
  119. package/dist/{types-CgrabttM.d.mts → types-D0KVsgzs.d.mts} +1 -1
  120. package/dist/{types-fFcQ1apy.d.ts → types-D3kJ9bfT.d.ts} +1 -1
  121. package/dist/{types-BqUEoZo0.d.ts → types-Dfi9C49l.d.ts} +2 -2
  122. package/dist/v2/global.global.js +1 -1
  123. package/dist/v2/global.global.js.map +1 -1
  124. package/dist/v2/index.cjs.js +1 -1
  125. package/dist/v2/index.cjs.js.map +1 -1
  126. package/dist/v2/index.d.mts +21 -787
  127. package/dist/v2/index.d.ts +21 -787
  128. package/dist/v2/index.esm.js +1 -1
  129. package/dist/v2/index.esm.js.map +1 -1
  130. package/docs/public/README.md +7 -4
  131. package/docs/public/api/exports.md +12 -8
  132. package/docs/public/api/pixel.md +27 -6
  133. package/docs/public/configuration/commerce.md +2 -2
  134. package/docs/public/configuration/modules.md +11 -14
  135. package/docs/public/configuration/overview.md +45 -26
  136. package/docs/public/configuration/transport.md +127 -0
  137. package/docs/public/events/catalog.md +3 -1
  138. package/docs/public/getting-started/installation.md +14 -12
  139. package/docs/public/getting-started/quick-start.md +95 -30
  140. package/docs/public/getting-started/react-nextjs.md +57 -34
  141. package/docs/public/getting-started/script-tag.md +55 -32
  142. package/docs/public/guides/funnel-checkout.md +1 -1
  143. package/docs/public/guides/funnel-landing.md +9 -7
  144. package/docs/public/limitations.md +5 -4
  145. package/docs/public/privacy/limitations.md +6 -6
  146. package/docs/public/release-candidate/validation.md +4 -4
  147. package/docs/public/troubleshooting.md +7 -6
  148. package/package.json +8 -3
  149. package/dist/pixel-default-config-BDPUVHse.d.ts +0 -5
  150. package/dist/pixel-default-config-C5uLt52W.d.mts +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @beworke/pixel
2
2
 
3
+ ## 0.1.0-rc.9 — app.source livre, platform e payload `app`
4
+
5
+ ### Added
6
+
7
+ - `app.source` aceita os valores conhecidos (`pageus`, `gomarke`, `bemony`, `custom`) **e qualquer outra string** (ex.: `hwaffiliate`)
8
+ - `app.platform` (default `''`; conhecido: `buygoods`; string livre ok)
9
+ - Payload HTTP inclui `app` (`source`, `target`, `platform`, `environment`) no evento e no batch; os mesmos campos também vão em `meta`
10
+ - Exemplo BuyGoods (`apps/playground-html/buygoods`) sobe o Pixel do iframe de Funnel Pixels para `window.top`
11
+
12
+ ### Changed
13
+
14
+ - Checkout BuyGoods dispara `PAGE_VIEW` no init e desliga `INITIATE_CHECKOUT`
15
+
16
+ ## 0.1.0-rc.8 — factory, browser bootstrap, global callable
17
+
18
+ ### Added
19
+
20
+ - `createPixel()` no entry principal (instâncias independentes)
21
+ - Subpath `@beworke/pixel/browser` (`bootstrapPixel`, getters, destroy, `PixelBootstrapError`)
22
+ - Bundle `dist/browser/pixel.global.js` com `window.Pixel(settings)` callable
23
+ - Compatibilidade: `window.PixelV2` ganha `createPixel` / `bootstrap` / `getInstance` / `destroy`
24
+ - Pacote `@beworke/pixel-react` (`PixelProvider` / `usePixel`)
25
+ - `SDK_VERSION` centralizada e validada contra `package.json`
26
+ - `PixelSettings` (input público parcial) + `resolvePixelConfig()` no construtor de `Pixel`
27
+ - AutoTrack `selector` aceita `trigger: 'hover'` e `'visible'`; `viewContent` default liga os 3 em `[data-track="view_content"]`. `data-trigger` no HTML restringe o modo (`click` / `hover` / `visible`); sem o atributo, dispara nos 3
28
+ - `PixelConfigurationError` para `pixelId` inválido
29
+
30
+ ### Fixed
31
+
32
+ - `REMOVE_FROM_CART` usa a mesma janela de 500ms do `ADD_TO_CART` — add → remove → add → remove do mesmo produto volta a disparar
33
+ - `force: true` durante pending destrói a instância anterior (generation token)
34
+ - `window.PixelV2` continua disponível quando `window.Pixel` estrangeiro bloqueia o global
35
+
3
36
  ## 0.1.0-rc.6 — Public RC docs on npm + install fix
4
37
 
5
38
  ### Fixed
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  SDK de analytics e conversão para web — implemente funis (landing, checkout, upsell, thank-you) em React, Next.js, SPA ou HTML puro **sem conhecer a arquitetura interna**.
4
4
 
5
- **Versão RC:** `0.1.0-rc.6` · **Etapas concluídas:** 1–20 · **Próxima etapa funcional:** 21 — Commerce Lifecycle
5
+ A versão publicada está em `package.json`. Instale a tag `@rc` para receber a release candidate atual.
6
6
 
7
7
  ## Instalação (npm — sem token)
8
8
 
@@ -10,11 +10,9 @@ Pacote **público**. Qualquer dev instala **sem login** no npm:
10
10
 
11
11
  ```bash
12
12
  npm install @beworke/pixel@rc
13
- # ou versão fixa:
14
- npm install @beworke/pixel@0.1.0-rc.6
15
13
  ```
16
14
 
17
- > **Importante:** `npm install @beworke/pixel` sem tag usa `latest`. Use `@rc` ou `@0.1.0-rc.6` até alinhar tags.
15
+ > **Importante:** `npm install @beworke/pixel` sem tag usa `latest`. Use `@rc` até alinhar tags.
18
16
 
19
17
  ## Documentação pública
20
18
 
@@ -22,59 +20,84 @@ O **npm não hospeda** arquivos `.md` como site (URLs tipo `npmjs.com/.../instal
22
20
 
23
21
  | Onde ler | Link |
24
22
  |----------|------|
25
- | **GitHub (recomendado no browser)** | [docs/public/README.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/README.md) |
23
+ | **GitHub (recomendado no browser)** | [docs/public/README.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/README.md) |
26
24
  | **Após `npm install`** | `node_modules/@beworke/pixel/docs/public/` |
27
25
 
28
26
  | Guia | GitHub |
29
27
  |------|--------|
30
- | Instalação | [getting-started/installation.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/getting-started/installation.md) |
31
- | Quick start | [getting-started/quick-start.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/getting-started/quick-start.md) |
32
- | API Pixel | [api/pixel.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/api/pixel.md) |
33
- | Eventos | [events/catalog.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/events/catalog.md) |
34
- | Configuração | [configuration/overview.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/configuration/overview.md) |
35
- | Funis | [guides/funnel-full.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/guides/funnel-full.md) |
36
- | Privacidade (RC) | [privacy/limitations.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/privacy/limitations.md) |
37
- | Limitações | [limitations.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/limitations.md) |
28
+ | Instalação | [getting-started/installation.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/getting-started/installation.md) |
29
+ | Quick start | [getting-started/quick-start.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/getting-started/quick-start.md) |
30
+ | API Pixel | [api/pixel.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/api/pixel.md) |
31
+ | Eventos | [events/catalog.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/events/catalog.md) |
32
+ | Configuração | [configuration/overview.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/configuration/overview.md) |
33
+ | Funis | [guides/funnel-full.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/guides/funnel-full.md) |
34
+ | Privacidade (RC) | [privacy/limitations.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/privacy/limitations.md) |
35
+ | Limitações | [limitations.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/limitations.md) |
38
36
 
39
- Repositório: https://github.com/techionext/Pixel-Global
37
+ Repositório: https://github.com/beworke-apps/Pixel-Global
40
38
 
41
- ## Quick start
39
+ ## Três níveis de uso
40
+
41
+ ### HTML simples (script tag)
42
+
43
+ Carregar o bundle **apenas registra** `window.Pixel`. Nada é inicializado até `Pixel(settings)` resolver. Top-level `await` exige `type="module"` (ou um IIFE/`then`).
44
+
45
+ ```html
46
+ <script src="https://unpkg.com/@beworke/pixel@rc/dist/browser/pixel.global.js"></script>
47
+ <script type="module">
48
+ const pixel = await Pixel({
49
+ identity: { pixelId: 'pix_YOUR_ID' },
50
+ });
51
+ pixel.lead({ email: 'user@example.com' });
52
+ </script>
53
+ ```
54
+
55
+ `Pixel(settings)` usa o bootstrap (uma instância por `window`). `window.PixelV2` permanece como compatibilidade / API de baixo nível.
56
+
57
+ ### NPM com factory
58
+
59
+ `createPixel` cria **instâncias independentes** (não é singleton).
42
60
 
43
61
  ```typescript
44
- import { Pixel, DEFAULT_PIXEL_CONFIG } from '@beworke/pixel';
62
+ import { createPixel } from '@beworke/pixel';
45
63
 
46
- const pixel = new Pixel({
47
- ...DEFAULT_PIXEL_CONFIG,
64
+ const pixel = await createPixel({
48
65
  identity: { pixelId: 'pix_YOUR_ID' },
49
- transport: {
50
- ...DEFAULT_PIXEL_CONFIG.transport,
51
- apiEndpoint: 'https://your-pixel-api.example.com',
52
- },
53
- storage: {
54
- ...DEFAULT_PIXEL_CONFIG.storage,
55
- persistence: {
56
- visitor: 'localStorage',
57
- session: 'sessionStorage',
58
- attribution: 'localStorage',
59
- },
60
- },
61
- modules: {
62
- ...DEFAULT_PIXEL_CONFIG.modules,
63
- core: { ...DEFAULT_PIXEL_CONFIG.modules.core, enabled: true },
64
- transport: {
65
- ...DEFAULT_PIXEL_CONFIG.modules.transport,
66
- enabled: true,
67
- sender: { mode: 'api' },
68
- },
69
- },
70
66
  });
71
67
 
72
- await pixel.init();
73
68
  pixel.lead({ email: 'user@example.com' });
74
- pixel.purchase({ transactionId: 'ord_1', value: 197, currency: 'BRL' });
75
- await pixel.destroy();
76
69
  ```
77
70
 
71
+ A classe continua disponível:
72
+
73
+ ```typescript
74
+ import { Pixel } from '@beworke/pixel';
75
+
76
+ const pixel = new Pixel({
77
+ identity: { pixelId: 'pix_YOUR_ID' },
78
+ });
79
+ await pixel.init();
80
+ ```
81
+
82
+ ### Browser avançado
83
+
84
+ `bootstrapPixel` gerencia **uma instância por `window`**. Para trocar a configuração, destrua explicitamente ou use `force`. Chamadas concorrentes compartilham a configuração da primeira chamada.
85
+
86
+ ```typescript
87
+ import { bootstrapPixel } from '@beworke/pixel/browser';
88
+
89
+ const pixel = await bootstrapPixel(
90
+ {
91
+ identity: { pixelId: 'pix_YOUR_ID' },
92
+ },
93
+ {
94
+ waitForConsent: () => window.consentGranted === true,
95
+ }
96
+ );
97
+ ```
98
+
99
+ React: use [`@beworke/pixel-react`](../pixel-react/README.md) (`PixelProvider` / `usePixel`).
100
+
78
101
  ## Métodos públicos
79
102
 
80
103
  | Método | Descrição |
@@ -84,27 +107,19 @@ await pixel.destroy();
84
107
  | `purchase`, `lead`, `addToCart`, `removeFromCart` | Conversão |
85
108
  | `initiateCheckout`, `addPaymentInfo`, `viewContent`, `search` | Conversão |
86
109
 
87
- Detalhes: [api/pixel.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/api/pixel.md)
88
-
89
- ## Script tag (CDN)
90
-
91
- ```html
92
- <script src="https://unpkg.com/@beworke/pixel@rc/dist/v2/global.global.js"></script>
93
- <script>
94
- const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
95
- </script>
96
- ```
110
+ Detalhes: [api/pixel.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/api/pixel.md)
97
111
 
98
- Global oficial: **`window.PixelV2`**.
112
+ Métodos internos de playground (`@internal`) **não** são API pública.
99
113
 
100
114
  ## Limitações do RC
101
115
 
102
- - Sem Consent Gate / CMP completo — a aplicação controla quando chamar `init()`
116
+ - O bundle **não** auto-inicializa; a aplicação controla quando chamar `Pixel(settings)` / `init()`
117
+ - Consent gate opcional no bootstrap — a aplicação decide quando há consentimento suficiente
103
118
  - Não declarar GDPR/LGPD/CCPA compliant com este RC
104
119
  - Sem eventos dedicados upsell/downsell — use `VIEW_CONTENT` + `PURCHASE`
105
120
 
106
- Lista: [limitations.md](https://github.com/techionext/Pixel-Global/blob/main/packages/pixel/docs/public/limitations.md)
121
+ Lista: [limitations.md](https://github.com/beworke-apps/Pixel-Global/blob/main/packages/pixel/docs/public/limitations.md)
107
122
 
108
123
  ## Contribuidores
109
124
 
110
- Arquitetura interna: [PLAN_PIXEL/ARCHITECTURE.md](https://github.com/techionext/Pixel-Global/blob/main/PLAN_PIXEL/ARCHITECTURE.md) · Playgrounds: `apps/playground-html/` no monorepo.
125
+ Arquitetura interna: [PLAN_PIXEL/ARCHITECTURE.md](https://github.com/beworke-apps/Pixel-Global/blob/main/PLAN_PIXEL/ARCHITECTURE.md) · Playgrounds: `apps/playground-html/` no monorepo.
@@ -1,7 +1,7 @@
1
1
  # Pixel v2 — Release Candidate Notes
2
2
 
3
3
  **Pacote:** `@beworke/pixel`
4
- **Versão:** `0.1.0-rc.5` (release candidate)
4
+ **Versão:** consulte `package.json` (fonte de verdade; este arquivo é histórico do RC)
5
5
  **Data:** 2026-07-14
6
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
 
@@ -104,58 +104,24 @@ node scripts/validate-rc-package.mjs artifacts/beworke-pixel-0.1.0-rc.6.tgz
104
104
  ## 4. Como usar via import (ESM)
105
105
 
106
106
  ```ts
107
- import { Pixel, DEFAULT_PIXEL_CONFIG } from '@beworke/pixel';
107
+ import { createPixel } from '@beworke/pixel';
108
108
 
109
- const pixel = new Pixel({
110
- ...DEFAULT_PIXEL_CONFIG,
111
- identity: {
112
- ...DEFAULT_PIXEL_CONFIG.identity,
113
- pixelId: 'pix_xxx',
114
- },
115
- transport: {
116
- ...DEFAULT_PIXEL_CONFIG.transport,
117
- apiEndpoint: 'https://sua-api.example.com',
118
- },
119
- modules: {
120
- ...DEFAULT_PIXEL_CONFIG.modules,
121
- core: {
122
- ...DEFAULT_PIXEL_CONFIG.modules.core,
123
- enabled: true,
124
- pageView: {
125
- ...DEFAULT_PIXEL_CONFIG.modules.core.pageView,
126
- enabled: true,
127
- trackInitialPageView: true,
128
- },
129
- },
130
- conversion: {
131
- ...DEFAULT_PIXEL_CONFIG.modules.conversion,
132
- enabled: true,
133
- manual: {
134
- ...DEFAULT_PIXEL_CONFIG.modules.conversion.manual,
135
- lead: { enabled: true },
136
- purchase: { enabled: true },
137
- },
138
- },
139
- transport: {
140
- ...DEFAULT_PIXEL_CONFIG.modules.transport,
141
- enabled: true,
142
- mockSender: { enabled: false },
143
- sender: { mode: 'http' },
144
- },
145
- },
109
+ const pixel = await createPixel({
110
+ identity: { pixelId: 'pix_xxx' },
146
111
  });
147
112
 
148
- await pixel.init();
149
113
  // PAGE_VIEW: emitido pelo Core (trackInitialPageView) — não existe pixel.pageView()
150
114
  pixel.lead({ email: 'user@example.com' });
151
115
  pixel.purchase({ orderId: '1', value: 99.9, currency: 'BRL' });
152
116
  await pixel.destroy();
153
117
  ```
154
118
 
119
+ Overrides parciais e `PixelConfig` completo continuam válidos. `DEFAULT_PIXEL_CONFIG` permanece para inspeção avançada.
120
+
155
121
  ### CJS
156
122
 
157
123
  ```js
158
- const { Pixel, DEFAULT_PIXEL_CONFIG } = require('@beworke/pixel');
124
+ const { createPixel } = require('@beworke/pixel');
159
125
  ```
160
126
 
161
127
  ### Subpath `/v2`
@@ -168,24 +134,20 @@ import { Pixel } from '@beworke/pixel/v2';
168
134
 
169
135
  ## 5. Como usar via script tag
170
136
 
171
- Bundle IIFE: `dist/v2/global.global.js` → **`window.PixelV2`**
137
+ Bundle recomendado: `dist/browser/pixel.global.js` → **`window.Pixel(settings)`**
172
138
 
173
139
  ```html
174
- <script src="./node_modules/@beworke/pixel/dist/v2/global.global.js"></script>
175
- <script>
176
- const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
177
- const pixel = new Pixel({
178
- ...DEFAULT_PIXEL_CONFIG,
179
- identity: { ...DEFAULT_PIXEL_CONFIG.identity, pixelId: 'pix_xxx' },
180
- transport: {
181
- ...DEFAULT_PIXEL_CONFIG.transport,
182
- apiEndpoint: 'https://sua-api.example.com',
183
- },
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' },
184
144
  });
185
- pixel.init();
145
+ pixel.lead({ email: 'user@example.com' });
186
146
  </script>
187
147
  ```
188
148
 
149
+ `window.PixelV2` permanece como compatibilidade / API de baixo nível.
150
+
189
151
  Export npm: `@beworke/pixel/global`.
190
152
 
191
153
  ---
@@ -193,20 +155,24 @@ Export npm: `@beworke/pixel/global`.
193
155
  ## 6. Transport real
194
156
 
195
157
  ```ts
196
- modules: {
197
- 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,
198
167
  enabled: true,
199
- mockSender: { enabled: false },
200
- sender: { mode: 'http' },
201
- batch: { enabled: true, batchSize: 1 }, // Event
202
- // batchSize: 10 → Batch
168
+ batchSize: 1, // Event; use 10 para Batch
203
169
  },
204
170
  },
205
- transport: {
206
- apiEndpoint: process.env.PIXEL_API_ENDPOINT, // não hardcodar em produção
207
- },
208
171
  ```
209
172
 
173
+ Para sender `test`, `internal` sem `baseUrl` e `external`, consulte
174
+ [`docs/public/configuration/transport.md`](./docs/public/configuration/transport.md).
175
+
210
176
  Endpoints oficiais do SDK:
211
177
 
212
178
  ```txt