@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,72 @@
1
+ # Funil — Upsell
2
+
3
+ ## Objetivo
4
+
5
+ Medir visualização e conversão de oferta adicional **após** compra inicial.
6
+
7
+ ## Importante (RC)
8
+
9
+ **Não existe** evento `UPSELL_*` no SDK. Use:
10
+
11
+ - `PAGE_VIEW` — página carregou
12
+ - `VIEW_CONTENT` — oferta upsell exibida / vídeo assistido
13
+ - `PURCHASE` — aceite da oferta (novo `transactionId` ou mesmo pedido conforme regra de negócio)
14
+
15
+ ## Config
16
+
17
+ ```typescript
18
+ identity: {
19
+ ...identity,
20
+ funnelStepId: 'upsell_step_01',
21
+ offerId: 'upsell_premium',
22
+ },
23
+ commerce: {
24
+ enabled: true,
25
+ catalog: {
26
+ products: [
27
+ { id: 'upsell_01', name: 'Upsell', type: 'upsell', price: 97, currency: 'BRL', quantity: 1 },
28
+ ],
29
+ },
30
+ },
31
+ ```
32
+
33
+ ## API manual
34
+
35
+ ```typescript
36
+ await pixel.init();
37
+
38
+ pixel.viewContent({
39
+ contentId: 'upsell_01',
40
+ contentName: 'Oferta complementar',
41
+ });
42
+
43
+ // Botão "Sim, quero adicionar"
44
+ pixel.purchase({
45
+ transactionId: 'upsell_tx_456',
46
+ value: 97,
47
+ currency: 'BRL',
48
+ });
49
+ ```
50
+
51
+ ## AutoTrack
52
+
53
+ Detector `viewContent` / `purchase` em botões da oferta (`data-track="upsell-accept"`).
54
+
55
+ ## Eventos esperados
56
+
57
+ 1. `PAGE_VIEW`
58
+ 2. `VIEW_CONTENT`
59
+ 3. `PURCHASE` (se aceito) ou saída sem conversão
60
+
61
+ ## QA
62
+
63
+ - [ ] `funnelStepId` distinto do checkout principal
64
+ - [ ] Produto upsell no `catalog`
65
+ - [ ] Não reutilizar `transactionId` do pedido principal sem regra explícita
66
+
67
+ ## Erros comuns
68
+
69
+ | Problema | Causa | Solução |
70
+ |----------|-------|---------|
71
+ | Upsell não aparece na API | Evento inventado | Usar `VIEW_CONTENT` / `PURCHASE` |
72
+ | Sessão quebrada | Novo domínio sem persistência | Mesmo `storage.persistence` cross-page |
@@ -0,0 +1,33 @@
1
+ # Limitações conhecidas do RC
2
+
3
+ A versão publicada está em `package.json`. Este documento descreve limitações do produto, não um número de RC.
4
+
5
+ ## Produto
6
+
7
+ | Limitação | Detalhe |
8
+ |-----------|---------|
9
+ | Consent / CMP | Incompleto — a aplicação controla quando inicializar; `waitForConsent` é um gate opcional no bootstrap |
10
+ | Auto-init | O bundle base **não** auto-inicializa ao ser carregado |
11
+ | Commerce Lifecycle | Etapa 21 não iniciada neste RC documental |
12
+ | Eventos upsell/downsell | Sem tipos dedicados; use `VIEW_CONTENT` + `PURCHASE` |
13
+ | `./diagnostics` | Não é export do pacote |
14
+ | APIs `@internal` | Playgrounds only — não suportadas publicamente |
15
+
16
+ ## Config / defaults
17
+
18
+ | Limitação | Detalhe |
19
+ |-----------|---------|
20
+ | `modules.behavior.enabled` | `false` por default — habilitar explicitamente |
21
+ | `modules.conversion.auto` | Auto detectors e rules continuam off; só a API manual vem ligada |
22
+ | Sessão | Persistência default em `sessionStorage` |
23
+
24
+ ## Distribuição
25
+
26
+ - Tarball local / npm privado — não há CDN público fixo documentado neste RC.
27
+ - Não altere versão sem política de release do time.
28
+
29
+ ## Validação
30
+
31
+ 670 testes automatizados (2 skipped). Smoke real requer endpoint configurado.
32
+
33
+ Veja também [RELEASE_CANDIDATE.md](../../RELEASE_CANDIDATE.md) e [PIXEL_V2_VALIDATION_MATRIX.md](../../../../PLAN_PIXEL/PIXEL_V2_VALIDATION_MATRIX.md).
@@ -0,0 +1,33 @@
1
+ # Privacidade e consentimento (RC)
2
+
3
+ ## Estado atual
4
+
5
+ - **Não há Consent Gate / CMP completo** integrado ao SDK.
6
+ - `bootstrapPixel(..., { waitForConsent })` e `PixelProvider` permitem abortar **antes** de criar a instância.
7
+ - `modules.core.consent` e `modules.privacy.consent` existem na config mas **defaults desligados**.
8
+ - O chamador controla o momento da inicialização. Este RC **não** declara conformidade LGPD/GDPR/CCPA.
9
+
10
+ ## Responsabilidade da aplicação
11
+
12
+ 1. **Quando inicializar** — só chame `Pixel(settings)`, `createPixel()` ou `pixel.init()` após obter consentimento do usuário, se exigido pela sua política.
13
+ 2. **Banner / CMP** — implemente no app (React, HTML, tag manager). O Pixel não substitui ferramenta de consentimento.
14
+ 3. **PII** — `modules.privacy.pii` (hash email/phone) off por default; você controla o que envia em `lead()` etc.
15
+
16
+ ## O que NÃO declarar
17
+
18
+ - Não afirmar **GDPR**, **LGPD** ou **CCPA compliant** apenas por usar este RC.
19
+ - Não documentar fluxos de opt-out automáticos que ainda não existem no SDK.
20
+
21
+ ## Padrão recomendado
22
+
23
+ ```typescript
24
+ async function onUserConsentGranted() {
25
+ const pixel = await createPixel(createConfig());
26
+ }
27
+
28
+ // Antes do consentimento: não chamar Pixel(settings) / createPixel() / init()
29
+ ```
30
+
31
+ ## Próximos passos (roadmap)
32
+
33
+ Consentimento completo e políticas de retenção/anonymization na Etapa 25. Até lá, trate o RC como **distribuição controlada ao time** com revisão jurídica da aplicação host.
@@ -0,0 +1,42 @@
1
+ # Validação do Release Candidate
2
+
3
+ ## Comandos (raiz do monorepo)
4
+
5
+ ```bash
6
+ pnpm type-check
7
+ pnpm test
8
+ pnpm build
9
+ pnpm --filter @beworke/pixel test:smoke:real
10
+ pnpm --filter @beworke/pixel test:transport
11
+ pnpm --filter @beworke/pixel test:integration
12
+
13
+ pnpm pack:pixel
14
+ pnpm validate:pixel-package
15
+ pnpm smoke:pixel-package
16
+ pnpm validate:public-docs
17
+ pnpm validate:public-examples
18
+ ```
19
+
20
+ O fluxo oficial de empacotamento é **`pnpm pack:pixel`** (tarball em `artifacts/`).
21
+ Não use `pnpm --filter @beworke/pixel pack` como fluxo principal.
22
+
23
+ ## Tarball
24
+
25
+ O nome do tarball segue a versão de `package.json` (veja `artifacts/latest-package.json`).
26
+ Manifesto: `artifacts/latest-package.json` (caminho relativo portátil).
27
+
28
+ Instalação em projeto limpo:
29
+
30
+ ```bash
31
+ npm install /caminho/para/artifacts/beworke-pixel-<versão>.tgz
32
+ ```
33
+
34
+ ## Checklist rápido
35
+
36
+ - [ ] Exports `.`, `./browser`, `./global`, `./v2`, `./config`, `./events`, `./services`, `./runtime`, `./logger`
37
+ - [ ] `window.Pixel` (factory) e `window.PixelV2` (compat) no build global
38
+ - [ ] Exemplos públicos sem `@internal` / sem import de `src/`
39
+ - [ ] Links em `packages/pixel/docs/public/` válidos
40
+ - [ ] README aponta para `packages/pixel/docs/public/`
41
+
42
+ Documentos: [RELEASE_CANDIDATE.md](../../../RELEASE_CANDIDATE.md), [PIXEL_V2_PUBLIC_RC_RELEASE_CHECKLIST.md](../../../../../PLAN_PIXEL/PIXEL_V2_PUBLIC_RC_RELEASE_CHECKLIST.md).
@@ -0,0 +1,56 @@
1
+ # Troubleshooting
2
+
3
+ ## Nenhum evento chega na API
4
+
5
+ 1. Confirme `transport.enabled: true`
6
+ 2. Use `transport.sender.mode: 'internal'` ou `'external'` (`'test'` não acessa a rede)
7
+ 3. Em `internal`, confira o `baseUrl` opcional; sem ele, vale o endpoint público padrão
8
+ 4. Em `external`, confira `endpoints.event` e a política de batch
9
+ 5. Confirme `identity.pixelId`
10
+ 6. DevTools → Network: requisições ao endpoint
11
+
12
+ ## `init()` falha ou trava
13
+
14
+ - Verifique DOM disponível (browser only)
15
+ - Em SSR, não chame `init()` no servidor
16
+ - Confira CORS no endpoint da API
17
+
18
+ ## Sessão / visitor inconsistentes
19
+
20
+ Configure persistência:
21
+
22
+ ```typescript
23
+ storage: {
24
+ persistence: {
25
+ visitor: 'localStorage',
26
+ session: 'sessionStorage',
27
+ attribution: 'localStorage',
28
+ },
29
+ },
30
+ ```
31
+
32
+ ## Duplicata de `PAGE_VIEW` ou `PURCHASE`
33
+
34
+ - Evite múltiplos `init()` sem `destroy()`
35
+ - Dedupe default: `modules.core.dedupe.windowMs: 2000`
36
+ - React Strict Mode pode montar duas vezes em dev — use singleton ou guard
37
+
38
+ ## Snapshot para debug
39
+
40
+ ```typescript
41
+ console.log(pixel.getDebugSnapshot());
42
+ ```
43
+
44
+ Não use `getDebugServices()` em apps de funil.
45
+
46
+ ## Instalação / tarball
47
+
48
+ ```bash
49
+ npm run validate:rc-package
50
+ ```
51
+
52
+ ## Links úteis
53
+
54
+ - [Configuração](./configuration/overview.md)
55
+ - [Transport](./configuration/transport.md)
56
+ - [Validação RC](./release-candidate/validation.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beworke/pixel",
3
- "version": "0.1.0-rc.1",
3
+ "version": "0.1.0-rc.11",
4
4
  "description": "Pixel v2 — SDK de analytics e conversão para API própria e destinos browser",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -11,8 +11,22 @@
11
11
  "import": "./dist/index.esm.js",
12
12
  "require": "./dist/index.cjs.js"
13
13
  },
14
+ "./browser": {
15
+ "types": "./dist/browser/index.d.ts",
16
+ "import": "./dist/browser/index.esm.js",
17
+ "require": "./dist/browser/index.cjs.js"
18
+ },
14
19
  "./global": {
15
- "default": "./dist/v2/global.global.js"
20
+ "default": "./dist/browser/pixel.global.js"
21
+ },
22
+ "./buygoods-landing": {
23
+ "default": "./dist/browser/pixel.buygoods-landing.global.js"
24
+ },
25
+ "./buygoods-checkout": {
26
+ "default": "./dist/browser/pixel.buygoods-checkout.global.js"
27
+ },
28
+ "./internal-checkout": {
29
+ "default": "./dist/browser/pixel.internal-checkout.global.js"
16
30
  },
17
31
  "./config": {
18
32
  "types": "./dist/config/index.d.ts",
@@ -47,26 +61,11 @@
47
61
  },
48
62
  "files": [
49
63
  "dist",
64
+ "docs/public",
50
65
  "README.md",
51
66
  "CHANGELOG.md",
52
67
  "RELEASE_CANDIDATE.md"
53
68
  ],
54
- "scripts": {
55
- "dev": "tsup --watch",
56
- "build": "tsup",
57
- "test": "vitest run",
58
- "test:watch": "vitest",
59
- "test:smoke:real": "node ./scripts/run-smoke-real.mjs",
60
- "validate:rc-package": "node ./scripts/validate-rc-package.mjs",
61
- "lint": "eslint src --ext .ts,.tsx",
62
- "lint:fix": "eslint src --ext .ts,.tsx --fix",
63
- "format": "prettier --write src/**/*.{ts,tsx,js,jsx,json,css,md}",
64
- "type-check": "tsc --noEmit",
65
- "prepublishOnly": "pnpm build",
66
- "changeset": "changeset",
67
- "version": "changeset version",
68
- "release": "pnpm build && changeset publish"
69
- },
70
69
  "keywords": [
71
70
  "pixel",
72
71
  "tracking",
@@ -80,9 +79,10 @@
80
79
  ],
81
80
  "author": "",
82
81
  "license": "ISC",
83
- "packageManager": "pnpm@10.7.1",
82
+ "publishConfig": {
83
+ "access": "public"
84
+ },
84
85
  "devDependencies": {
85
- "@changesets/cli": "^2.29.7",
86
86
  "@types/node": "^20.0.0",
87
87
  "@typescript-eslint/eslint-plugin": "^6.0.0",
88
88
  "@typescript-eslint/parser": "^6.0.0",
@@ -91,11 +91,32 @@
91
91
  "eslint-plugin-prettier": "^5.0.0",
92
92
  "happy-dom": "^20.6.3",
93
93
  "prettier": "^3.0.0",
94
+ "rimraf": "^6.0.1",
94
95
  "tsup": "^8.5.0",
95
96
  "typescript": "^5.0.0",
96
97
  "vitest": "^4.0.18"
97
98
  },
98
99
  "dependencies": {
99
100
  "ua-parser-js": "^2.0.6"
101
+ },
102
+ "scripts": {
103
+ "dev": "tsup --watch",
104
+ "build": "tsup && node ../../scripts/copy-packaged-examples.mjs",
105
+ "test": "vitest run",
106
+ "test:watch": "vitest",
107
+ "test:smoke:real": "node ../../scripts/run-smoke-real.mjs",
108
+ "validate:rc-package": "node ../../scripts/validate-rc-package.mjs",
109
+ "validate:public-docs": "node ../../scripts/validate-public-docs.mjs",
110
+ "validate:public-examples": "node ../../scripts/validate-public-examples.mjs",
111
+ "publish:rc": "pnpm publish --access public --tag rc --no-git-checks && node -e \"require('child_process').execSync('npm dist-tag add @beworke/pixel@'+require('./package.json').version+' latest',{stdio:'inherit'})\"",
112
+ "test:integration": "vitest run src/integration",
113
+ "test:transport": "vitest run src/transport",
114
+ "test:full-funnel": "vitest run src/modules/core/url-context src/integration/stage-15b-module-matrix.test.ts",
115
+ "test:chaos": "vitest run src/transport/transport.resilience.test.ts src/transport/transport.advanced.test.ts",
116
+ "lint": "eslint src --ext .ts,.tsx",
117
+ "lint:fix": "eslint src --ext .ts,.tsx --fix",
118
+ "format": "prettier --write src/**/*.{ts,tsx,js,jsx,json,css,md}",
119
+ "type-check": "tsc --noEmit",
120
+ "clean": "rimraf dist coverage"
100
121
  }
101
122
  }
@@ -1,274 +0,0 @@
1
- type AttributionIdentifiers = {
2
- readonly fbclid?: string;
3
- readonly fbp?: string;
4
- readonly fbc?: string;
5
- readonly gclid?: string;
6
- readonly gbraid?: string;
7
- readonly wbraid?: string;
8
- readonly ga?: string;
9
- readonly gid?: string;
10
- readonly gclAu?: string;
11
- readonly ttclid?: string;
12
- readonly ttp?: string;
13
- readonly msclkid?: string;
14
- readonly liFatId?: string;
15
- readonly epik?: string;
16
- readonly customClickIds?: Readonly<Record<string, string>>;
17
- readonly firstCollectedAt?: number;
18
- readonly lastCollectedAt?: number;
19
- readonly landingUrl?: string;
20
- readonly referrer?: string;
21
- };
22
- type AttributionConfig = {
23
- readonly enabled: boolean;
24
- readonly ttlDays?: number;
25
- readonly persist?: boolean;
26
- readonly captureUrlParams?: boolean;
27
- readonly captureCookies?: boolean;
28
- readonly customClickIdParams?: string[];
29
- };
30
- declare const DEFAULT_ATTRIBUTION_CONFIG: AttributionConfig;
31
- declare const ATTRIBUTION_STORAGE_KEY = "attribution";
32
- interface AttributionService {
33
- init(): void;
34
- destroy(): void;
35
- collect(): AttributionIdentifiers;
36
- getSnapshot(): AttributionIdentifiers;
37
- update(partial: Partial<AttributionIdentifiers>): AttributionIdentifiers;
38
- clear(): void;
39
- }
40
-
41
- interface BasePixelEvent {
42
- readonly type: string;
43
- readonly timestamp: number;
44
- readonly path?: string;
45
- readonly url?: string;
46
- readonly hostname?: string;
47
- readonly language?: string;
48
- readonly timezone?: string;
49
- /** Attribution click IDs / cookies — anexados pelo BaseEventBuilder. */
50
- readonly identifiers?: AttributionIdentifiers;
51
- }
52
-
53
- interface PageViewEvent extends BasePixelEvent {
54
- readonly type: 'PAGE_VIEW';
55
- }
56
-
57
- type PixelEventCategory = 'ENGAGEMENT' | 'CONVERSION' | 'IDENTITY' | 'SESSION' | 'SYSTEM' | 'INTEGRATION';
58
- type EngagementEventCategory = 'ENGAGEMENT';
59
- type ConversionEventCategory = 'CONVERSION';
60
-
61
- interface ScrollEvent extends BasePixelEvent {
62
- readonly type: 'SCROLL';
63
- readonly category: EngagementEventCategory;
64
- readonly maxScrollPercent: number;
65
- readonly scrollEvents: number;
66
- readonly scrollVelocityAvg?: number;
67
- readonly lastScrollAt?: number;
68
- }
69
-
70
- interface ElementDescriptor {
71
- readonly tagName?: string;
72
- readonly id?: string;
73
- readonly classes?: string[];
74
- readonly text?: string;
75
- readonly role?: string;
76
- readonly name?: string;
77
- readonly dataset?: Record<string, string>;
78
- }
79
-
80
- interface PageClickEvent extends BasePixelEvent {
81
- readonly type: 'PAGE_CLICK';
82
- readonly category: EngagementEventCategory;
83
- readonly clickCount: number;
84
- readonly lastClickAt: number;
85
- readonly rageClickCount?: number;
86
- readonly target?: ElementDescriptor;
87
- readonly currentTarget?: ElementDescriptor;
88
- readonly clientX?: number;
89
- readonly clientY?: number;
90
- readonly pageX?: number;
91
- readonly pageY?: number;
92
- readonly offsetX?: number;
93
- readonly offsetY?: number;
94
- }
95
-
96
- interface RageClickEvent extends BasePixelEvent {
97
- readonly type: 'RAGE_CLICK';
98
- readonly category: EngagementEventCategory;
99
- readonly threshold: number;
100
- readonly windowMs: number;
101
- readonly clickCount: number;
102
- readonly target?: ElementDescriptor;
103
- }
104
-
105
- interface VisibilityChangeEvent extends BasePixelEvent {
106
- readonly type: 'VISIBILITY_CHANGE';
107
- readonly category: EngagementEventCategory;
108
- readonly isVisible: boolean;
109
- readonly visibleSince?: number;
110
- readonly hiddenAt?: number | null;
111
- }
112
-
113
- interface UserIdleEvent extends BasePixelEvent {
114
- readonly type: 'USER_IDLE';
115
- readonly category: EngagementEventCategory;
116
- readonly idleSince: number;
117
- readonly thresholdMs: number;
118
- }
119
-
120
- interface UserActiveEvent extends BasePixelEvent {
121
- readonly type: 'USER_ACTIVE';
122
- readonly category: EngagementEventCategory;
123
- readonly activeAt: number;
124
- readonly previousIdleDurationMs?: number;
125
- }
126
-
127
- interface ExitIntentEvent extends BasePixelEvent {
128
- readonly type: 'EXIT_INTENT';
129
- readonly category: EngagementEventCategory;
130
- readonly triggeredAt: number;
131
- readonly clientY?: number;
132
- }
133
-
134
- interface SessionRenewedEvent extends BasePixelEvent {
135
- readonly type: 'SESSION_RENEWED';
136
- readonly sessionId: string;
137
- readonly previousSessionId?: string;
138
- }
139
-
140
- interface SessionExpiredEvent extends BasePixelEvent {
141
- readonly type: 'SESSION_EXPIRED';
142
- readonly sessionId: string;
143
- }
144
-
145
- interface PixelItem {
146
- readonly id?: string;
147
- readonly name?: string;
148
- readonly category?: string;
149
- readonly price?: number;
150
- readonly quantity?: number;
151
- }
152
- interface PurchaseData {
153
- readonly value?: number;
154
- readonly currency?: string;
155
- readonly orderId?: string;
156
- readonly items?: PixelItem[];
157
- }
158
- interface LeadData {
159
- readonly email?: string;
160
- readonly phone?: string;
161
- readonly name?: string;
162
- readonly fields?: Record<string, unknown>;
163
- }
164
- interface AddToCartData {
165
- readonly productId?: string;
166
- readonly productName?: string;
167
- readonly price?: number;
168
- readonly currency?: string;
169
- readonly quantity?: number;
170
- }
171
- interface RemoveFromCartData {
172
- readonly productId?: string;
173
- readonly quantity?: number;
174
- }
175
- interface InitiateCheckoutData {
176
- readonly value?: number;
177
- readonly currency?: string;
178
- readonly items?: PixelItem[];
179
- }
180
- type PaymentMethod = 'CREDIT_CARD' | 'PIX' | 'BOLETO' | 'PAYPAL' | 'OTHER';
181
- interface AddPaymentInfoData {
182
- readonly paymentMethod?: PaymentMethod;
183
- }
184
- interface ViewContentData {
185
- readonly contentId?: string;
186
- readonly contentType?: string;
187
- readonly category?: string;
188
- readonly value?: number;
189
- readonly currency?: string;
190
- }
191
- interface SearchData {
192
- readonly query: string;
193
- }
194
- type ConversionEventData = PurchaseData | LeadData | AddToCartData | RemoveFromCartData | InitiateCheckoutData | AddPaymentInfoData | ViewContentData | SearchData;
195
-
196
- interface PurchaseEvent extends BasePixelEvent {
197
- readonly type: 'PURCHASE';
198
- readonly category: ConversionEventCategory;
199
- readonly data: PurchaseData;
200
- }
201
-
202
- interface LeadEvent extends BasePixelEvent {
203
- readonly type: 'LEAD';
204
- readonly category: ConversionEventCategory;
205
- readonly data: LeadData;
206
- }
207
-
208
- interface AddToCartEvent extends BasePixelEvent {
209
- readonly type: 'ADD_TO_CART';
210
- readonly category: ConversionEventCategory;
211
- readonly data: AddToCartData;
212
- }
213
-
214
- interface RemoveFromCartEvent extends BasePixelEvent {
215
- readonly type: 'REMOVE_FROM_CART';
216
- readonly category: ConversionEventCategory;
217
- readonly data: RemoveFromCartData;
218
- }
219
-
220
- interface InitiateCheckoutEvent extends BasePixelEvent {
221
- readonly type: 'INITIATE_CHECKOUT';
222
- readonly category: ConversionEventCategory;
223
- readonly data: InitiateCheckoutData;
224
- }
225
-
226
- interface AddPaymentInfoEvent extends BasePixelEvent {
227
- readonly type: 'ADD_PAYMENT_INFO';
228
- readonly category: ConversionEventCategory;
229
- readonly data: AddPaymentInfoData;
230
- }
231
-
232
- interface ViewContentEvent extends BasePixelEvent {
233
- readonly type: 'VIEW_CONTENT';
234
- readonly category: ConversionEventCategory;
235
- readonly data: ViewContentData;
236
- }
237
-
238
- interface SearchEvent extends BasePixelEvent {
239
- readonly type: 'SEARCH';
240
- readonly category: ConversionEventCategory;
241
- readonly data: SearchData;
242
- }
243
-
244
- type PixelEvent = PageViewEvent | SessionRenewedEvent | SessionExpiredEvent | ScrollEvent | PageClickEvent | RageClickEvent | VisibilityChangeEvent | UserIdleEvent | UserActiveEvent | ExitIntentEvent | PurchaseEvent | LeadEvent | AddToCartEvent | RemoveFromCartEvent | InitiateCheckoutEvent | AddPaymentInfoEvent | ViewContentEvent | SearchEvent;
245
-
246
- interface BrowserMetadata {
247
- readonly url?: string;
248
- readonly path?: string;
249
- readonly hostname?: string;
250
- readonly origin?: string;
251
- readonly title?: string;
252
- readonly referrer?: string;
253
- readonly language?: string;
254
- readonly timezone?: string;
255
- readonly userAgent?: string;
256
- readonly platform?: string;
257
- readonly screenWidth?: number;
258
- readonly screenHeight?: number;
259
- readonly colorDepth?: number;
260
- }
261
- interface BrowserMetadataService {
262
- getMetadata(): BrowserMetadata;
263
- }
264
-
265
- declare class BaseEventBuilder {
266
- private readonly metadataService;
267
- private readonly attribution;
268
- constructor(metadataService: BrowserMetadataService, attribution?: AttributionService | null);
269
- build<T extends {
270
- type: string;
271
- }>(event: T): T & BasePixelEvent;
272
- }
273
-
274
- export { type AttributionService as A, type BrowserMetadataService as B, type ConversionEventData as C, DEFAULT_ATTRIBUTION_CONFIG as D, type ExitIntentEvent as E, type PixelEventCategory as F, type EngagementEventCategory as G, type ConversionEventCategory as H, type InitiateCheckoutData as I, type ElementDescriptor as J, type LeadData as L, type PixelEvent as P, type RemoveFromCartData as R, type SessionRenewedEvent as S, type UserIdleEvent as U, type ViewContentData as V, BaseEventBuilder as a, type AttributionConfig as b, type AttributionIdentifiers as c, type BrowserMetadata as d, type BasePixelEvent as e, type PageViewEvent as f, type SessionExpiredEvent as g, ATTRIBUTION_STORAGE_KEY as h, type PurchaseData as i, type AddToCartData as j, type AddPaymentInfoData as k, type SearchData as l, type ScrollEvent as m, type PageClickEvent as n, type RageClickEvent as o, type VisibilityChangeEvent as p, type UserActiveEvent as q, type PurchaseEvent as r, type LeadEvent as s, type AddToCartEvent as t, type RemoveFromCartEvent as u, type InitiateCheckoutEvent as v, type AddPaymentInfoEvent as w, type ViewContentEvent as x, type SearchEvent as y, type PixelItem as z };