@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.
- package/CHANGELOG.md +311 -4
- package/README.md +90 -128
- package/RELEASE_CANDIDATE.md +218 -101
- package/dist/Pixel-BnN86r4X.d.ts +797 -0
- package/dist/Pixel-BoUGqCbP.d.mts +797 -0
- package/dist/{StorageFactory-CAkJJqVD.d.ts → StorageFactory-BfCArzMM.d.ts} +2 -2
- package/dist/{StorageFactory-BhpbB6Jj.d.mts → StorageFactory-C0prtNR7.d.mts} +2 -2
- package/dist/browser/index.cjs.js +3 -0
- package/dist/browser/index.cjs.js.map +1 -0
- package/dist/browser/index.d.mts +77 -0
- package/dist/browser/index.d.ts +77 -0
- package/dist/browser/index.esm.js +3 -0
- package/dist/browser/index.esm.js.map +1 -0
- package/dist/browser/pixel.buygoods-checkout.global.js +4 -0
- package/dist/browser/pixel.buygoods-checkout.global.js.map +1 -0
- package/dist/browser/pixel.buygoods-landing.global.js +4 -0
- package/dist/browser/pixel.buygoods-landing.global.js.map +1 -0
- package/dist/browser/pixel.global.js +4 -0
- package/dist/browser/pixel.global.js.map +1 -0
- package/dist/browser/pixel.internal-checkout.global.js +4 -0
- package/dist/browser/pixel.internal-checkout.global.js.map +1 -0
- package/dist/config/index.cjs.js +1 -1
- package/dist/config/index.cjs.js.map +1 -1
- package/dist/config/index.d.mts +16 -5
- package/dist/config/index.d.ts +16 -5
- package/dist/config/index.esm.js +1 -1
- package/dist/config/index.esm.js.map +1 -1
- package/dist/events/index.cjs.js +1 -1
- package/dist/events/index.cjs.js.map +1 -1
- package/dist/events/index.d.mts +2 -1
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.esm.js +1 -1
- package/dist/events/index.esm.js.map +1 -1
- package/dist/examples/html-script/README.md +21 -55
- package/dist/examples/html-script/RELEASE_CANDIDATE.md +39 -26
- package/dist/examples/html-script/add-payment-info/README.md +3 -3
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +107 -96
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +107 -96
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +106 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +114 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +106 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +97 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +106 -95
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +106 -95
- package/dist/examples/html-script/add-to-cart/README.md +9 -6
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +133 -119
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +146 -130
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +144 -127
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +133 -119
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +590 -0
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +124 -116
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +133 -119
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +147 -130
- package/dist/examples/html-script/behavior/example-behavior-engagement.html +489 -0
- package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +350 -0
- package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +433 -0
- package/dist/examples/html-script/behavior/example-behavior-viewport.html +397 -0
- package/dist/examples/html-script/{example-behavior.html → behavior/example-behavior.html} +23 -17
- package/dist/examples/html-script/buygoods/example-buygoods-checkout.html +50 -0
- package/dist/examples/html-script/buygoods/ladding.html +184 -0
- package/dist/examples/html-script/example-basic.html +1 -1
- package/dist/examples/html-script/example-checkout-commerce.html +826 -0
- package/dist/examples/html-script/example-conversion.html +42 -49
- package/dist/examples/html-script/example-global-factory-classic.html +45 -0
- package/dist/examples/html-script/example-global-factory.html +40 -0
- package/dist/examples/html-script/example-integration.html +45 -51
- package/dist/examples/html-script/example-landing-commerce.html +416 -0
- package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
- package/dist/examples/html-script/example-transport.html +70 -63
- package/dist/examples/html-script/full-funnel/README.md +64 -0
- package/dist/examples/html-script/full-funnel/checkout.html +118 -0
- package/dist/examples/html-script/full-funnel/downsell.html +60 -0
- package/dist/examples/html-script/full-funnel/landing.html +153 -0
- package/dist/examples/html-script/full-funnel/thank-you.html +87 -0
- package/dist/examples/html-script/full-funnel/upsell.html +66 -0
- package/dist/examples/html-script/initiate-checkout/README.md +6 -6
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +135 -122
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +143 -128
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +144 -128
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +127 -120
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +136 -123
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +144 -131
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +146 -130
- package/dist/examples/html-script/internal-checkout/example-cardioclear-checkout.html +57 -0
- package/dist/examples/html-script/internal-checkout/example-slimsoda-checkout.html +53 -0
- package/dist/examples/html-script/lead/README.md +9 -7
- package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +107 -94
- package/dist/examples/html-script/lead/example-lead-trigger-auto.html +118 -103
- package/dist/examples/html-script/lead/example-lead-trigger-click.html +118 -102
- package/dist/examples/html-script/release-candidate.html +219 -107
- package/dist/examples/html-script/remove-from-cart/README.md +4 -4
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +134 -121
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +134 -121
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +141 -128
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +125 -118
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +135 -122
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +136 -123
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +139 -124
- package/dist/examples/html-script/search/README.md +1 -1
- package/dist/examples/html-script/search/example-search-attribute.html +107 -99
- package/dist/examples/html-script/search/example-search-button-sync.html +107 -99
- package/dist/examples/html-script/search/example-search-dedupe.html +107 -99
- package/dist/examples/html-script/search/example-search-input.html +108 -99
- package/dist/examples/html-script/search/example-search-manual.html +98 -96
- package/dist/examples/html-script/search/example-search-submit.html +107 -99
- package/dist/examples/html-script/search/example-search-text.html +112 -99
- package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +92 -0
- package/dist/examples/html-script/url-context/example-url-context-landing.html +110 -0
- package/dist/examples/html-script/url-context/example-url-context-upsell.html +105 -0
- package/dist/examples/html-script/url-context/example-url-context.html +205 -0
- package/dist/examples/html-script/view-content/README.md +1 -1
- package/dist/examples/html-script/view-content/example-view-content-attribute.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-css.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-dedupe.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-empty.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-manual.html +117 -115
- package/dist/examples/html-script/view-content/example-view-content-product-card.html +126 -118
- package/dist/examples/html-script/view-content/example-view-content-text.html +131 -121
- package/dist/examples/release-candidate/README.md +2 -1
- package/dist/examples/v2/README.md +16 -13
- package/dist/index-B8u_3PGG.d.ts +460 -0
- package/dist/index-BxT2d-TK.d.mts +460 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +23 -361
- package/dist/index.d.ts +23 -361
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/pixel-DNGbAN5C.d.ts +871 -0
- package/dist/pixel-_BSDpx4M.d.mts +871 -0
- package/dist/pixel-default-config-BMYaqs7i.d.ts +21 -0
- package/dist/pixel-default-config-DLRya1tl.d.mts +21 -0
- package/dist/pixel-settings-D-t9zQb4.d.ts +40 -0
- package/dist/pixel-settings-DGxl0MVm.d.mts +40 -0
- package/dist/runtime/index.cjs.js +1 -1
- package/dist/runtime/index.cjs.js.map +1 -1
- package/dist/runtime/index.d.mts +19 -26
- package/dist/runtime/index.d.ts +19 -26
- package/dist/runtime/index.esm.js +1 -1
- package/dist/runtime/index.esm.js.map +1 -1
- package/dist/services/index.cjs.js +1 -1
- package/dist/services/index.cjs.js.map +1 -1
- package/dist/services/index.d.mts +14 -6
- package/dist/services/index.d.ts +14 -6
- package/dist/services/index.esm.js +1 -1
- package/dist/services/index.esm.js.map +1 -1
- package/dist/types-B-Nzagpk.d.mts +19 -0
- package/dist/types-D0KVsgzs.d.mts +293 -0
- package/dist/types-D3kJ9bfT.d.ts +293 -0
- package/dist/types-Dfi9C49l.d.ts +19 -0
- package/dist/url-context-Ck2LK18V.d.mts +87 -0
- package/dist/url-context-Ck2LK18V.d.ts +87 -0
- package/dist/v2/global.global.js +1 -1
- package/dist/v2/global.global.js.map +1 -1
- package/dist/v2/index.cjs.js +1 -1
- package/dist/v2/index.cjs.js.map +1 -1
- package/dist/v2/index.d.mts +26 -6
- package/dist/v2/index.d.ts +26 -6
- package/dist/v2/index.esm.js +1 -1
- package/dist/v2/index.esm.js.map +1 -1
- package/docs/public/README.md +80 -0
- package/docs/public/api/exports.md +56 -0
- package/docs/public/api/pixel.md +86 -0
- package/docs/public/configuration/commerce.md +44 -0
- package/docs/public/configuration/modules.md +63 -0
- package/docs/public/configuration/overview.md +85 -0
- package/docs/public/configuration/transport.md +127 -0
- package/docs/public/events/catalog.md +67 -0
- package/docs/public/getting-started/installation.md +88 -0
- package/docs/public/getting-started/quick-start.md +142 -0
- package/docs/public/getting-started/react-nextjs.md +78 -0
- package/docs/public/getting-started/script-tag.md +102 -0
- package/docs/public/guides/funnel-checkout.md +52 -0
- package/docs/public/guides/funnel-downsell.md +53 -0
- package/docs/public/guides/funnel-full.md +64 -0
- package/docs/public/guides/funnel-landing.md +70 -0
- package/docs/public/guides/funnel-thank-you.md +48 -0
- package/docs/public/guides/funnel-upsell.md +72 -0
- package/docs/public/limitations.md +33 -0
- package/docs/public/privacy/limitations.md +33 -0
- package/docs/public/release-candidate/validation.md +42 -0
- package/docs/public/troubleshooting.md +56 -0
- package/package.json +41 -20
- package/dist/index-DUfFzniE.d.mts +0 -274
- package/dist/index-DUfFzniE.d.ts +0 -274
- package/dist/pixel-CbeF25mD.d.mts +0 -555
- package/dist/pixel-CbeF25mD.d.ts +0 -555
- package/dist/pixel-default-config-1VgLFOiL.d.mts +0 -5
- package/dist/pixel-default-config-Bxb-Vdd8.d.ts +0 -5
- package/dist/types-CTpRvFKZ.d.ts +0 -71
- package/dist/types-DGlBdsAy.d.mts +0 -71
package/RELEASE_CANDIDATE.md
CHANGED
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
# Pixel v2 — Release Candidate Notes
|
|
2
2
|
|
|
3
|
-
**Pacote:** `@
|
|
4
|
-
**Versão:** `
|
|
5
|
-
**Data:** 2026-07-
|
|
6
|
-
**Status:**
|
|
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
|
-
>
|
|
9
|
-
>
|
|
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
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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 @
|
|
75
|
+
pnpm add @beworke/pixel
|
|
53
76
|
# ou
|
|
54
|
-
npm install @
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
69
|
-
# ou
|
|
70
|
-
node scripts/validate-rc-package.mjs
|
|
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 {
|
|
107
|
+
import { createPixel } from '@beworke/pixel';
|
|
79
108
|
|
|
80
|
-
const pixel =
|
|
81
|
-
|
|
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 {
|
|
124
|
+
const { createPixel } = require('@beworke/pixel');
|
|
130
125
|
```
|
|
131
126
|
|
|
132
127
|
### Subpath `/v2`
|
|
133
128
|
|
|
134
129
|
```ts
|
|
135
|
-
import { Pixel } from '@
|
|
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
|
|
137
|
+
Bundle recomendado: `dist/browser/pixel.global.js` → **`window.Pixel(settings)`**
|
|
143
138
|
|
|
144
139
|
```html
|
|
145
|
-
<script src="./node_modules/@
|
|
146
|
-
<script>
|
|
147
|
-
const
|
|
148
|
-
|
|
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.
|
|
145
|
+
pixel.lead({ email: 'user@example.com' });
|
|
157
146
|
</script>
|
|
158
147
|
```
|
|
159
148
|
|
|
160
|
-
|
|
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
|
-
|
|
168
|
-
|
|
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
|
-
|
|
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
|
-
|
|
188
|
+
// Commerce global (raiz — Etapa 14A)
|
|
189
|
+
commerce: {
|
|
190
|
+
enabled: true,
|
|
194
191
|
currency: 'BRL',
|
|
195
|
-
catalog: { products: [{ id: 'main_offer',
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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 `
|
|
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
|
|
345
|
+
[x] npm run test:smoke:real
|
|
230
346
|
[x] npm pack --dry-run
|
|
231
|
-
[x] npm pack
|
|
347
|
+
[x] npm pack
|
|
232
348
|
[x] npm run validate:rc-package
|
|
233
|
-
[
|
|
234
|
-
[
|
|
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:**
|
|
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
|
-
**
|
|
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
|
|
367
|
+
## 11. Fora do Runtime 1.0 interno
|
|
251
368
|
|
|
252
369
|
```txt
|
|
253
370
|
CAPI / enrichments server-side
|
|
254
|
-
|
|
371
|
+
Public SDK Hardening (Privacy / Consent / CMP / GDPR / LGPD / CCPA)
|
|
255
372
|
Publicação automática npm / CDN
|
|
256
373
|
```
|