@beworke/pixel 0.1.0-rc.1 → 0.1.0-rc.6
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 +260 -4
- package/README.md +65 -118
- package/RELEASE_CANDIDATE.md +181 -36
- package/dist/{StorageFactory-BhpbB6Jj.d.mts → StorageFactory-CPghDPBj.d.mts} +2 -2
- package/dist/{StorageFactory-CAkJJqVD.d.ts → StorageFactory-tjfzk57c.d.ts} +2 -2
- package/dist/config/index.cjs.js +1 -1
- package/dist/config/index.cjs.js.map +1 -1
- package/dist/config/index.d.mts +4 -3
- package/dist/config/index.d.ts +4 -3
- 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 +24 -2
- package/dist/examples/html-script/RELEASE_CANDIDATE.md +20 -6
- 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 +66 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +66 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +65 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +73 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +65 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +56 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +65 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +65 -47
- package/dist/examples/html-script/add-to-cart/README.md +3 -3
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +90 -70
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +103 -81
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +101 -78
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +90 -70
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +81 -67
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +90 -70
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +104 -81
- 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/example-checkout-commerce.html +825 -0
- package/dist/examples/html-script/example-integration.html +5 -5
- package/dist/examples/html-script/example-landing-commerce.html +380 -0
- package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
- package/dist/examples/html-script/example-transport.html +5 -5
- package/dist/examples/html-script/full-funnel/README.md +64 -0
- package/dist/examples/html-script/full-funnel/checkout.html +116 -0
- package/dist/examples/html-script/full-funnel/downsell.html +58 -0
- package/dist/examples/html-script/full-funnel/landing.html +99 -0
- package/dist/examples/html-script/full-funnel/thank-you.html +85 -0
- package/dist/examples/html-script/full-funnel/upsell.html +64 -0
- package/dist/examples/html-script/initiate-checkout/README.md +6 -6
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +94 -74
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +102 -80
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +103 -80
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +86 -72
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +95 -75
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +103 -83
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +105 -82
- package/dist/examples/html-script/lead/README.md +9 -7
- package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +67 -47
- package/dist/examples/html-script/lead/example-lead-trigger-auto.html +78 -56
- package/dist/examples/html-script/lead/example-lead-trigger-click.html +78 -55
- package/dist/examples/html-script/release-candidate.html +187 -76
- package/dist/examples/html-script/remove-from-cart/README.md +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +93 -73
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +93 -73
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +93 -73
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +84 -70
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +94 -74
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +95 -75
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +98 -76
- package/dist/examples/html-script/search/README.md +1 -1
- package/dist/examples/html-script/search/example-search-attribute.html +66 -51
- package/dist/examples/html-script/search/example-search-button-sync.html +66 -51
- package/dist/examples/html-script/search/example-search-dedupe.html +66 -51
- package/dist/examples/html-script/search/example-search-input.html +67 -51
- package/dist/examples/html-script/search/example-search-manual.html +57 -48
- package/dist/examples/html-script/search/example-search-submit.html +66 -51
- package/dist/examples/html-script/search/example-search-text.html +71 -51
- package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +63 -0
- package/dist/examples/html-script/url-context/example-url-context-landing.html +70 -0
- package/dist/examples/html-script/url-context/example-url-context-upsell.html +67 -0
- package/dist/examples/html-script/url-context/example-url-context.html +171 -0
- package/dist/examples/html-script/view-content/README.md +1 -1
- package/dist/examples/html-script/view-content/example-view-content-attribute.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-css.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-dedupe.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-empty.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-manual.html +76 -67
- package/dist/examples/html-script/view-content/example-view-content-product-card.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-text.html +90 -73
- package/dist/examples/v2/README.md +4 -1
- package/dist/{index-DUfFzniE.d.ts → index-CQAyT5Od.d.ts} +170 -3
- package/dist/{index-DUfFzniE.d.mts → index-JlKPz4pp.d.mts} +170 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +435 -12
- package/dist/index.d.ts +435 -12
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/{pixel-CbeF25mD.d.mts → pixel-BxZZx8l5.d.ts} +248 -72
- package/dist/{pixel-CbeF25mD.d.ts → pixel-CKc4OQUx.d.mts} +248 -72
- package/dist/{pixel-default-config-1VgLFOiL.d.mts → pixel-default-config-CJl-eypl.d.mts} +1 -1
- package/dist/{pixel-default-config-Bxb-Vdd8.d.ts → pixel-default-config-aAOujzwp.d.ts} +1 -1
- 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-BP8dz1gP.d.mts +19 -0
- package/dist/types-C75pQP31.d.ts +19 -0
- package/dist/types-DMhzHSVC.d.mts +293 -0
- package/dist/types-D_SsCur9.d.ts +293 -0
- package/dist/url-context-BjAsQoVl.d.mts +85 -0
- package/dist/url-context-BjAsQoVl.d.ts +85 -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 +8 -6
- package/dist/v2/index.d.ts +8 -6
- package/dist/v2/index.esm.js +1 -1
- package/dist/v2/index.esm.js.map +1 -1
- package/docs/public/README.md +75 -0
- package/docs/public/api/exports.md +47 -0
- package/docs/public/api/pixel.md +65 -0
- package/docs/public/configuration/commerce.md +44 -0
- package/docs/public/configuration/modules.md +66 -0
- package/docs/public/configuration/overview.md +66 -0
- package/docs/public/events/catalog.md +65 -0
- package/docs/public/getting-started/installation.md +75 -0
- package/docs/public/getting-started/quick-start.md +77 -0
- package/docs/public/getting-started/react-nextjs.md +55 -0
- package/docs/public/getting-started/script-tag.md +57 -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 +68 -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 +32 -0
- package/docs/public/privacy/limitations.md +33 -0
- package/docs/public/release-candidate/validation.md +37 -0
- package/docs/public/troubleshooting.md +55 -0
- package/package.json +13 -1
- package/dist/types-CTpRvFKZ.d.ts +0 -71
- package/dist/types-DGlBdsAy.d.mts +0 -71
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,264 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @beworke/pixel
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.1.0-rc.6 — Public RC docs on npm + install fix
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- README npm com links **GitHub** (npm não hospeda páginas `.md` individuais)
|
|
8
|
+
- `docs/public/` incluído no tarball npm → `node_modules/@beworke/pixel/docs/public/`
|
|
9
|
+
- Instalação documentada: `npm install @beworke/pixel@rc` (público, sem token)
|
|
10
|
+
- `publish:rc` publica tags `rc` e `latest` juntas
|
|
11
|
+
|
|
12
|
+
## Unreleased — Etapa 20 Runtime Intelligence
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `modules.behavior.rateLimit` — limitador interno por instância (sliding window, critical bypass para IDLE/ACTIVITY/VISIBLE/HIDDEN/EXIT_INTENT)
|
|
17
|
+
- `modules.behavior.buffer` — agregação interna de sinais (drop_oldest / drop_newest / compress_similar; flush por size/age/hidden/destroy)
|
|
18
|
+
- `modules.behavior.stateMachine` — estados explícitos (NOT_INITIALIZED → … → DESTROYED) com tabela de transições e histórico limitado
|
|
19
|
+
- `modules.behavior.sessionSummary` — resumo consolidado da sessão com `emitOnHidden` / `emitOnDestroy` / `minimumSessionMs`
|
|
20
|
+
- `BehaviorRuntimeCoordinator` — pipeline SignalBus → RateLimit → Buffer → StateMachine → Accumulator → Dispatcher
|
|
21
|
+
- Evento tipado `BEHAVIOR_SESSION_SUMMARY` (categoria `ENGAGEMENT`) + `ApiEventType`
|
|
22
|
+
- Diagnostics: `behavior.rateLimit`, `behavior.buffer`, `behavior.stateMachine`, `behavior.sessionSummary`
|
|
23
|
+
- Health `degraded` isolado (high drop rate, buffer full, invalid transitions)
|
|
24
|
+
- Exemplo `examples/html-script/behavior/example-behavior-runtime-intelligence.html`
|
|
25
|
+
- Testes `src/modules/behavior/runtime-intelligence.test.ts` (38 casos)
|
|
26
|
+
|
|
27
|
+
### Notes
|
|
28
|
+
|
|
29
|
+
- Pacote permanece em `0.1.0-rc.5` (sem bump)
|
|
30
|
+
- Behavior Runtime Evolution **17–20 concluída**
|
|
31
|
+
- Próxima etapa oficial: 21 — Commerce lifecycle
|
|
32
|
+
|
|
33
|
+
## Unreleased — Hardening 19.1 (gate Etapa 20)
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- `ApiEventType` agora inclui `ENGAGEMENT_UPDATE` e `ENGAGEMENT_SUMMARY` (contrato HTTP reconhece os eventos; o cast em `EventPayloadBuilder` deixou de mascarar a ausência)
|
|
38
|
+
- Ordem de init do Behavior Runtime reordenada para `bus → Engagement → trackers → Heartbeat`: o Engagement passa a receber os sinais iniciais (`HIDDEN`/`VISIBLE` da inicialização do `VisibilityTracker` e `HEARTBEAT` de `fireImmediately`)
|
|
39
|
+
- `EngagementEngine.init()` faz `reset()` do `BehaviorSignalBus` próprio no reinit (apenas quando `ownsBus`); subscriptions voltam a funcionar após destroy/reinit
|
|
40
|
+
- Playground `example-behavior-engagement.html`: `destroy()` ocorre antes de `unsubscribe()` (captura `ENGAGEMENT_SUMMARY`); painel preserva o último snapshot; reinit mostra o summary anterior sem duplicar listener
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- `src/transport/engagement-transport.test.ts` — contrato HTTP (ApiEventType/EventPayloadBuilder/batch) + guard de compilação
|
|
45
|
+
- Testes de regressão em `engagement.test.ts`: ownership do SignalBus (bus próprio reinit / bus injetado não resetado / duplicate init / duplicate destroy) e ordem de init (HIDDEN/VISIBLE inicial, HEARTBEAT imediato, reinit sem vazamento)
|
|
46
|
+
|
|
47
|
+
### Notes
|
|
48
|
+
|
|
49
|
+
- Pacote permanece em `0.1.0-rc.5` (sem bump); 630 testes passando | 2 skipped
|
|
50
|
+
- Etapa 20 — Runtime Intelligence liberada
|
|
51
|
+
|
|
52
|
+
## Unreleased — Etapa 19 Engagement Runtime
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- `modules.behavior.engagement` — contrato oficial (`enabled`, `evaluationIntervalMs`, `emitOnChange`, `minScoreDelta`, `emitSummaryOnDestroy`, `weights`, `penalties`, `thresholds`; defaults seguros, `enabled: false`)
|
|
57
|
+
- `EngagementEngine` real: consome `BehaviorSignalBus`, produz score determinístico `0..100` via `ManagedScheduler` (sem `setInterval`), com componentes/pesos/penalidades/níveis
|
|
58
|
+
- Componentes: `EngagementSignalAccumulator`, `EngagementScoreCalculator`, `EngagementLevelResolver`, `EngagementEmissionPolicy`, `EngagementSummaryBuilder`
|
|
59
|
+
- Eventos tipados `ENGAGEMENT_UPDATE` / `ENGAGEMENT_SUMMARY` (categoria `ENGAGEMENT`)
|
|
60
|
+
- `resolveEngagementConfig` / `normalizeEngagementConfig` (clamp de intervalo/delta, normalização de pesos para somar 1, clamp de penalidades, validação de thresholds)
|
|
61
|
+
- Diagnostics: `getDebugSnapshot().behavior.engagement` (score/level/contadores/signalCounts, sanitizado) e `configuredEngines` inclui `engagement`
|
|
62
|
+
- Health `degraded` isolado quando o engine opcional tem drift excessivo ou falha de cálculo
|
|
63
|
+
- `ScrollTracker`/`ClickTracker` publicam `SCROLL`/`CLICK`/`RAGE_CLICK` no `BehaviorSignalBus`; `HeartbeatEngine` publica `HEARTBEAT`
|
|
64
|
+
- Exemplo `examples/html-script/behavior/example-behavior-engagement.html`
|
|
65
|
+
- Testes `src/modules/behavior/engagement.test.ts` (48 casos, incl. Hardening 19.1)
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
|
|
69
|
+
- Diagnostics: `configuredEngines` reporta `engagement` (antes: `engagement(stub)`)
|
|
70
|
+
|
|
71
|
+
### Breaking
|
|
72
|
+
|
|
73
|
+
- `modules.behavior.engagement` migrou do shape legado (`weights.{scroll,click,time}`, `thresholds.{low,medium}`) para o contrato da Etapa 19. Sem migration layer (config legada nunca esteve wired a runtime)
|
|
74
|
+
- Tipos públicos `EngagementWeights` / `EngagementThresholds` mudaram de shape; adicionado `EngagementPenalties`
|
|
75
|
+
|
|
76
|
+
### Notes
|
|
77
|
+
|
|
78
|
+
- Pacote permanece em `0.1.0-rc.5` (sem bump)
|
|
79
|
+
- Próxima etapa oficial: 20 — Runtime Intelligence
|
|
80
|
+
|
|
81
|
+
## Unreleased — Hardening 18.1 (gate Etapa 19)
|
|
82
|
+
|
|
83
|
+
### Fixed
|
|
84
|
+
|
|
85
|
+
- Viewport MutationObserver rescan: `cleanupDisconnectedElements` agora ocorre **antes** de `scanAndObserve` — evita regressão com `maxObservedElements` quando A é removido e B é adicionado na mesma batch
|
|
86
|
+
- Dispatcher: falha de um listener não interrompe os demais nem propaga ao produtor; log sanitizado `DISPATCHER_LISTENER_FAILED` (sem payload/PII)
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
|
|
90
|
+
- Testes explícitos Hardening 18.1: limites, SSR, IntersectionObserver/MutationObserver failures, mutation burst, isolamento Dispatcher ↔ Viewport/Heartbeat
|
|
91
|
+
|
|
92
|
+
### Notes
|
|
93
|
+
|
|
94
|
+
- Pacote permanece em `0.1.0-rc.5` (sem bump)
|
|
95
|
+
- Etapa 19 — Engagement liberada após gate 18.1
|
|
96
|
+
|
|
97
|
+
## Unreleased — Etapa 18 Viewport Runtime
|
|
98
|
+
|
|
99
|
+
### Added
|
|
100
|
+
|
|
101
|
+
- `modules.behavior.trackers.viewport` — config aditiva (`targets[]`, `rootMargin`, `observeMutations`, `mutationDebounceMs`, `maxObservedElements`; defaults seguros, `enabled: false`)
|
|
102
|
+
- `ViewportTracker` real com `IntersectionObserver` + `MutationObserver` (DOM dinâmico)
|
|
103
|
+
- Eventos tipados `VIEWPORT_ENTER` / `VIEWPORT_EXIT` (categoria `ENGAGEMENT`)
|
|
104
|
+
- `ViewportObserverFactory`, `ViewportTargetRegistry`, `ViewportStateStore`, `normalizeViewportConfig`, `describeViewportElement`
|
|
105
|
+
- `BehaviorSignalBus.createSignal()` — geração de ID de sinal por instância (sem estado module-level)
|
|
106
|
+
- Diagnostics: `getDebugSnapshot().behavior.viewport` + separação `configuredTrackers` (Scroll/Click/Idle/Visibility/ExitIntent/Viewport) vs `configuredEngines` (Heartbeat/Engagement)
|
|
107
|
+
- Health `degraded` quando `viewport.enabled === true` e `IntersectionObserver` indisponível
|
|
108
|
+
- Exemplo `examples/html-script/example-behavior-viewport.html`
|
|
109
|
+
- Testes `src/modules/behavior/viewport.test.ts`
|
|
110
|
+
|
|
111
|
+
### Changed
|
|
112
|
+
|
|
113
|
+
- `getDebugSnapshot().behavior` passa a expor `configuredTrackers` e `configuredEngines` separados (antes: apenas `configuredTrackers` misturando trackers e engines)
|
|
114
|
+
- `IdleTracker` / `VisibilityTracker` passam a usar `signalBus.createSignal()` em vez de sequência interna do bus
|
|
115
|
+
|
|
116
|
+
### Breaking
|
|
117
|
+
|
|
118
|
+
- **Removido** o contrato stub de `trackers.viewport` (`selector`, `selectorType`, `visibilityThreshold`) — substituído integralmente por `targets[]` + `rootMargin`/`observeMutations`/`mutationDebounceMs`/`maxObservedElements`. Sem migration layer (stub nunca esteve wired em produção).
|
|
119
|
+
|
|
120
|
+
### Notes
|
|
121
|
+
|
|
122
|
+
- Viewport mede visibilidade de elementos e publica via Dispatcher; **não** chama Transport/Queue/Sender
|
|
123
|
+
- Sem polling como fallback: se `IntersectionObserver` está indisponível, o tracker fica `available: false` e não observa nada
|
|
124
|
+
- `SignalBus` deixa de ter `signalSeq` module-level; cada instância de `BehaviorSignalBus` gera seus próprios IDs via `createSignal()`
|
|
125
|
+
- Pacote permanece em `0.1.0-rc.5` (sem bump de versão)
|
|
126
|
+
|
|
127
|
+
## Unreleased — Etapa 17 Heartbeat Runtime
|
|
128
|
+
|
|
129
|
+
### Added
|
|
130
|
+
|
|
131
|
+
- `modules.behavior.heartbeat` — config aditiva (defaults seguros, `enabled: false`)
|
|
132
|
+
- `HeartbeatEngine` + `ManagedScheduler` + `BehaviorSignalBus` + `HeartbeatPolicy` / `HeartbeatSnapshotBuilder`
|
|
133
|
+
- Evento tipado `BEHAVIOR_HEARTBEAT` (categoria `ENGAGEMENT`)
|
|
134
|
+
- Diagnostics: `getDebugSnapshot().behavior.heartbeat`
|
|
135
|
+
- Exemplo `examples/html-script/example-behavior-heartbeat.html`
|
|
136
|
+
- Testes `src/modules/behavior/heartbeat.test.ts`
|
|
137
|
+
|
|
138
|
+
### Changed (contrato Heartbeat consolidado)
|
|
139
|
+
|
|
140
|
+
- Removido `trackers.heartbeat` e qualquer fallback/legacy
|
|
141
|
+
- `engagement` movido para `modules.behavior.engagement` (irmão de `trackers`)
|
|
142
|
+
- Adicionado `hiddenIntervalMs` ao contrato oficial de Heartbeat
|
|
143
|
+
|
|
144
|
+
### Notes
|
|
145
|
+
|
|
146
|
+
- Heartbeat mede presença e publica via Dispatcher; **não** chama Transport/Queue/Sender
|
|
147
|
+
- Scheduler usa `intervalMs` (visível) ou `hiddenIntervalMs` (escondido); `emitWhenHidden` controla emissão
|
|
148
|
+
- Sequence reinicia a cada `init`
|
|
149
|
+
- Intervalo mínimo normalizado: 1000ms
|
|
150
|
+
|
|
151
|
+
## 0.1.0-rc.5 — Runtime Diagnostics (Etapa 16)
|
|
152
|
+
|
|
153
|
+
### Added
|
|
154
|
+
|
|
155
|
+
- `pixel.getDebugSnapshot()` — snapshot oficial read-only, imutável e sanitizado
|
|
156
|
+
- Módulo `diagnostics` (`RuntimeDiagnosticsModule` + `DebugSnapshotService`)
|
|
157
|
+
- Redaction de secrets/PII em snapshots
|
|
158
|
+
- Health evaluator (`healthy` / `degraded` / `unhealthy` / `unknown`)
|
|
159
|
+
- Exemplo `examples/html-script/example-runtime-diagnostics.html`
|
|
160
|
+
- Testes `src/diagnostics/diagnostics.test.ts`
|
|
161
|
+
|
|
162
|
+
### Notes
|
|
163
|
+
|
|
164
|
+
- `subscribeDebug` **não** implementado propositalmente (sem polling/timers); snapshot sob demanda apenas
|
|
165
|
+
- Sem alteração no pipeline de eventos / Transport / Conversion
|
|
166
|
+
- Hardening: sanitização ampliada; `modules[].id` (evita colisão com PII `name`); testes hardening
|
|
167
|
+
|
|
168
|
+
## 0.1.0-rc.4 — Etapa 15B Validation Hardening
|
|
169
|
+
|
|
170
|
+
### Added
|
|
171
|
+
|
|
172
|
+
- `PIXEL_V2_VALIDATION_MATRIX.md` — matriz oficial de validação integrada
|
|
173
|
+
- `PIXEL_V2_STAGE_15B_REPORT.md` — relatório da Etapa 15B
|
|
174
|
+
- Playground `examples/html-script/full-funnel/` (landing → checkout → upsell/downsell → thank-you)
|
|
175
|
+
- Scripts: `validate:15b`, `test:integration`, `test:transport`, `test:full-funnel`, `test:chaos`
|
|
176
|
+
- Teste de matriz de módulos `stage-15b-module-matrix.test.ts`
|
|
177
|
+
|
|
178
|
+
### Changed
|
|
179
|
+
|
|
180
|
+
- Documentação alinhada ao runtime real (Transport/Integrations implementados; Privacy stub; Behavior P1 pendente)
|
|
181
|
+
- Roadmap oficial 16–22 documentado (sem implementação)
|
|
182
|
+
- Hierarquia documental registrada em ARCHITECTURE / README / BACKLOG
|
|
183
|
+
|
|
184
|
+
### Fixed
|
|
185
|
+
|
|
186
|
+
- Referências “Transport futuro” / Dispatcher sem consumidor real
|
|
187
|
+
- Checklist RC inconsistente
|
|
188
|
+
- `examples/v2` / html-script RELEASE notes apontando rc.3 onde cabia rc.4
|
|
189
|
+
- Full-funnel: `commerce.catalog` + `cart.initialItems[{ productId }]`; `paymentMethod: CREDIT_CARD`; `order_id` antes do init
|
|
190
|
+
- Docs: status **1–15B concluídas** (sem “15B em andamento”)
|
|
191
|
+
|
|
192
|
+
## 0.1.0-rc.4 — Core UrlContext
|
|
193
|
+
|
|
194
|
+
### Added
|
|
195
|
+
|
|
196
|
+
- Core UrlContext module
|
|
197
|
+
- `query_params` / `url_context` on events
|
|
198
|
+
- managed URL params (public `sid`)
|
|
199
|
+
- forward params + link decoration
|
|
200
|
+
- denylist for sensitive params
|
|
201
|
+
- HTML examples for landing/checkout/upsell/allowedDomains
|
|
202
|
+
|
|
203
|
+
### Changed
|
|
204
|
+
|
|
205
|
+
- Event builder enriches centrally when `urlContext` enabled
|
|
206
|
+
|
|
207
|
+
### Fixed / Hardening (15A finalização)
|
|
208
|
+
|
|
209
|
+
- Decode seguro de query/cookie (`safeDecodeURIComponent`) — URI malformada não quebra init
|
|
210
|
+
- Link decorator idempotente (sem `sid=a&sid=a`); colapsa duplicados
|
|
211
|
+
- Preserva href relativo e ordem `?query#hash`
|
|
212
|
+
- Snapshot / payload com cópias congeladas (sem mutação externa nem refs compartilhadas)
|
|
213
|
+
- Cache de exclude domains/selectors no decorator (perf em milhares de links)
|
|
214
|
+
- `resolveUrlContextConfig` clona nested arrays/objects (defaults imutáveis)
|
|
215
|
+
- `dispose()` alias em engine/service
|
|
216
|
+
|
|
217
|
+
### Security
|
|
218
|
+
|
|
219
|
+
- Denylisted params not captured/forwarded
|
|
220
|
+
- Public `sid` ≠ internal `session_id`
|
|
221
|
+
|
|
222
|
+
## 0.1.0-rc.3 — Global Commerce Config + Hardening 14B/14C
|
|
223
|
+
|
|
224
|
+
### Changed
|
|
225
|
+
|
|
226
|
+
- Commerce global no root de `PixelConfig` (`config.commerce`)
|
|
227
|
+
- `commerce.checkout` → `commerce.cart`
|
|
228
|
+
- `selectedItems` na config → `commerce.cart.initialItems`
|
|
229
|
+
- Auto detectors usam `auto.detectors[event].sources[]`
|
|
230
|
+
- `calculateValueFrom: 'selected_items'` → `'cart'`
|
|
231
|
+
- Novo: `commerce.enrichment` por evento (`pageView`, `viewContent`, `lead`, …)
|
|
232
|
+
- Novo: `commerce.cart.mode` inclui `landing_page` e `checkout`
|
|
233
|
+
- Exemplos HTML, Next.js, docs e `example-landing-commerce.html` migrados
|
|
234
|
+
- Removidos aliases públicos `CommerceItem` / `CommerceCheckoutMode` e literais `selected_items` / `event_items` do tipo oficial
|
|
235
|
+
|
|
236
|
+
### Fixed
|
|
237
|
+
|
|
238
|
+
- Enrichment respeita `commerce.enabled` e `enrichment[event].enabled`
|
|
239
|
+
- `FormSource` respeita escopo (`selector` / `formSelector`) em todos os triggers
|
|
240
|
+
- `PaymentSource` respeita `formSelector` real do campo
|
|
241
|
+
- Docs normalizadas — removidos resíduos de contratos antigos
|
|
242
|
+
- **14C:** `ADD_TO_CART` sem `productId` usa item principal de `commerce.cart` (initialItems/runtime) quando enrichment permite
|
|
243
|
+
|
|
244
|
+
### Breaking
|
|
245
|
+
|
|
246
|
+
- Removido `modules.conversion.commerce`
|
|
247
|
+
- Removidos `selector`, `selectorForm`, `cardDetection`, `autoDispatch`, `paymentMethod` no nível do detector — use apenas dentro de `sources[]`
|
|
248
|
+
|
|
249
|
+
### 0.1.0-rc.2 — Etapa 14 Auto Sources Contract
|
|
250
|
+
|
|
251
|
+
- **Breaking (contrato auto):** detectors passam a usar `sources: AutoTrackSource[]`
|
|
252
|
+
- Removidos do nível do detector: `selector`, `selectorType`, `selectorForm`, `paymentMethod`, `cardDetection`, `autoDispatch`
|
|
253
|
+
- Types: `selector` | `form` | `payment` | `lifecycle` | `url`
|
|
254
|
+
- Múltiplas sources independentes por evento (ex.: ADD_TO_CART form + click)
|
|
255
|
+
- `AutoTrackerFactory` cria um detector por source
|
|
256
|
+
- Novo `LifecycleAutoDetector` (INITIATE_CHECKOUT on ready)
|
|
257
|
+
- Payment via `type: 'payment'` → `CardDetector`
|
|
258
|
+
- Defaults: todos os detectors com `sources: []`
|
|
259
|
+
- Exemplos / RC / Next checkout migrados
|
|
260
|
+
|
|
261
|
+
### Release Candidate (0.1.0-rc.1 / 0.0.15)
|
|
6
262
|
|
|
7
263
|
- Etapas 12A–12N Commerce + AutoTrack + docs/release readiness
|
|
8
264
|
- Etapa 13A — validação consumidor real (`PixelV2` + Transport Event/Batch)
|
|
@@ -156,7 +412,7 @@
|
|
|
156
412
|
- **Configuração Dinâmica**: Atualização de configuração em runtime
|
|
157
413
|
- **Múltiplos Seletores**: Suporte a class, id, attribute, tag, text, url, data-attribute, custom
|
|
158
414
|
- **Extração de Dados**: Seletores configuráveis para extrair dados de produtos/carrinho
|
|
159
|
-
- **Validação**: Sistema de validação de formulários com regras
|
|
415
|
+
- **Validação**: Sistema de validação de formulários com regras customizáveis
|
|
160
416
|
- **Callbacks Customizados**: Funções de callback para processamento customizado
|
|
161
417
|
|
|
162
418
|
#### 📊 **Monitoramento e Estatísticas**
|
package/README.md
CHANGED
|
@@ -1,163 +1,110 @@
|
|
|
1
|
-
# Pixel v2
|
|
1
|
+
# Pixel v2 (`@beworke/pixel`)
|
|
2
2
|
|
|
3
|
-
SDK de analytics e conversão para web —
|
|
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
|
-
**
|
|
5
|
+
**Versão RC:** `0.1.0-rc.6` · **Etapas concluídas:** 1–20 · **Próxima etapa funcional:** 21 — Commerce Lifecycle
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Instalação (npm — sem token)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
Pacote **público**. Qualquer dev instala **sem login** no npm:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @beworke/pixel@rc
|
|
13
|
+
# ou versão fixa:
|
|
14
|
+
npm install @beworke/pixel@0.1.0-rc.6
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
> **Importante:** `npm install @beworke/pixel` sem tag usa `latest`. Use `@rc` ou `@0.1.0-rc.6` até alinhar tags.
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
## Documentação pública
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
O **npm não hospeda** arquivos `.md` como site (URLs tipo `npmjs.com/.../installation.md` **não existem**).
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
| Onde ler | Link |
|
|
24
|
+
|----------|------|
|
|
25
|
+
| **GitHub (recomendado no browser)** | [docs/public/README.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/README.md) |
|
|
26
|
+
| **Após `npm install`** | `node_modules/@beworke/pixel/docs/public/` |
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
| Guia | GitHub |
|
|
29
|
+
|------|--------|
|
|
30
|
+
| Instalação | [getting-started/installation.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/getting-started/installation.md) |
|
|
31
|
+
| Quick start | [getting-started/quick-start.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/getting-started/quick-start.md) |
|
|
32
|
+
| API Pixel | [api/pixel.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/api/pixel.md) |
|
|
33
|
+
| Eventos | [events/catalog.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/events/catalog.md) |
|
|
34
|
+
| Configuração | [configuration/overview.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/configuration/overview.md) |
|
|
35
|
+
| Funis | [guides/funnel-full.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/guides/funnel-full.md) |
|
|
36
|
+
| Privacidade (RC) | [privacy/limitations.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/privacy/limitations.md) |
|
|
37
|
+
| Limitações | [limitations.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/limitations.md) |
|
|
26
38
|
|
|
27
|
-
|
|
28
|
-
npm pack
|
|
29
|
-
npm install ./agenus-io-pixel-0.0.15.tgz
|
|
30
|
-
npm run validate:rc-package
|
|
31
|
-
```
|
|
39
|
+
Repositório: https://github.com/techionext/Pixel-Global
|
|
32
40
|
|
|
33
|
-
##
|
|
41
|
+
## Quick start
|
|
34
42
|
|
|
35
|
-
```
|
|
36
|
-
import { Pixel, DEFAULT_PIXEL_CONFIG } from '@
|
|
43
|
+
```typescript
|
|
44
|
+
import { Pixel, DEFAULT_PIXEL_CONFIG } from '@beworke/pixel';
|
|
37
45
|
|
|
38
46
|
const pixel = new Pixel({
|
|
39
47
|
...DEFAULT_PIXEL_CONFIG,
|
|
40
|
-
identity: {
|
|
41
|
-
...DEFAULT_PIXEL_CONFIG.identity,
|
|
42
|
-
pixelId: 'pix_123',
|
|
43
|
-
},
|
|
48
|
+
identity: { pixelId: 'pix_YOUR_ID' },
|
|
44
49
|
transport: {
|
|
45
50
|
...DEFAULT_PIXEL_CONFIG.transport,
|
|
46
|
-
apiEndpoint: 'https://
|
|
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
|
+
},
|
|
47
60
|
},
|
|
48
61
|
modules: {
|
|
49
62
|
...DEFAULT_PIXEL_CONFIG.modules,
|
|
50
|
-
core: {
|
|
51
|
-
...DEFAULT_PIXEL_CONFIG.modules.core,
|
|
52
|
-
enabled: true,
|
|
53
|
-
pageView: {
|
|
54
|
-
...DEFAULT_PIXEL_CONFIG.modules.core.pageView,
|
|
55
|
-
enabled: true,
|
|
56
|
-
trackInitialPageView: true, // PAGE_VIEW no init — não há pixel.pageView()
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
conversion: {
|
|
60
|
-
...DEFAULT_PIXEL_CONFIG.modules.conversion,
|
|
61
|
-
enabled: true,
|
|
62
|
-
manual: {
|
|
63
|
-
...DEFAULT_PIXEL_CONFIG.modules.conversion.manual,
|
|
64
|
-
purchase: { enabled: true },
|
|
65
|
-
},
|
|
66
|
-
},
|
|
63
|
+
core: { ...DEFAULT_PIXEL_CONFIG.modules.core, enabled: true },
|
|
67
64
|
transport: {
|
|
68
65
|
...DEFAULT_PIXEL_CONFIG.modules.transport,
|
|
69
66
|
enabled: true,
|
|
70
|
-
|
|
71
|
-
sender: { mode: 'http' },
|
|
67
|
+
sender: { mode: 'api' },
|
|
72
68
|
},
|
|
73
69
|
},
|
|
74
70
|
});
|
|
75
71
|
|
|
76
72
|
await pixel.init();
|
|
77
|
-
pixel.
|
|
73
|
+
pixel.lead({ email: 'user@example.com' });
|
|
74
|
+
pixel.purchase({ transactionId: 'ord_1', value: 197, currency: 'BRL' });
|
|
78
75
|
await pixel.destroy();
|
|
79
76
|
```
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
const { Pixel, DEFAULT_PIXEL_CONFIG } = require('@agenus-io/pixel');
|
|
83
|
-
```
|
|
78
|
+
## Métodos públicos
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
| Método | Descrição |
|
|
81
|
+
|--------|-----------|
|
|
82
|
+
| `init()` / `destroy()` / `isInitialized()` | Ciclo de vida |
|
|
83
|
+
| `getDebugSnapshot()` | Snapshot read-only (dev/QA) |
|
|
84
|
+
| `purchase`, `lead`, `addToCart`, `removeFromCart` | Conversão |
|
|
85
|
+
| `initiateCheckout`, `addPaymentInfo`, `viewContent`, `search` | Conversão |
|
|
86
|
+
|
|
87
|
+
Detalhes: [api/pixel.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/api/pixel.md)
|
|
88
|
+
|
|
89
|
+
## Script tag (CDN)
|
|
86
90
|
|
|
87
91
|
```html
|
|
88
|
-
<script src="https://unpkg.com/@
|
|
92
|
+
<script src="https://unpkg.com/@beworke/pixel@rc/dist/v2/global.global.js"></script>
|
|
89
93
|
<script>
|
|
90
94
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
91
|
-
const pixel = new Pixel({
|
|
92
|
-
...DEFAULT_PIXEL_CONFIG,
|
|
93
|
-
identity: { ...DEFAULT_PIXEL_CONFIG.identity, pixelId: 'pix_123' },
|
|
94
|
-
transport: {
|
|
95
|
-
...DEFAULT_PIXEL_CONFIG.transport,
|
|
96
|
-
apiEndpoint: 'https://sua-api.example.com',
|
|
97
|
-
},
|
|
98
|
-
modules: {
|
|
99
|
-
...DEFAULT_PIXEL_CONFIG.modules,
|
|
100
|
-
core: {
|
|
101
|
-
...DEFAULT_PIXEL_CONFIG.modules.core,
|
|
102
|
-
enabled: true,
|
|
103
|
-
pageView: {
|
|
104
|
-
...DEFAULT_PIXEL_CONFIG.modules.core.pageView,
|
|
105
|
-
enabled: true,
|
|
106
|
-
trackInitialPageView: true,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
pixel.init();
|
|
112
95
|
</script>
|
|
113
96
|
```
|
|
114
97
|
|
|
115
|
-
|
|
98
|
+
Global oficial: **`window.PixelV2`**.
|
|
116
99
|
|
|
117
|
-
##
|
|
100
|
+
## Limitações do RC
|
|
118
101
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
| `@agenus-io/pixel/global` | IIFE `window.PixelV2` |
|
|
123
|
-
| `@agenus-io/pixel/v2` | Alias do entry principal |
|
|
124
|
-
| `@agenus-io/pixel/config` | Tipos e defaults de configuração |
|
|
125
|
-
| `@agenus-io/pixel/events` | Eventos tipados |
|
|
126
|
-
| `@agenus-io/pixel/services` | Services (attribution, session, etc.) |
|
|
127
|
-
| `@agenus-io/pixel/runtime` | Runtime e bootstrap |
|
|
128
|
-
| `@agenus-io/pixel/logger` | Logger |
|
|
102
|
+
- Sem Consent Gate / CMP completo — a aplicação controla quando chamar `init()`
|
|
103
|
+
- Não declarar GDPR/LGPD/CCPA compliant com este RC
|
|
104
|
+
- Sem eventos dedicados upsell/downsell — use `VIEW_CONTENT` + `PURCHASE`
|
|
129
105
|
|
|
130
|
-
|
|
106
|
+
Lista: [limitations.md](https://github.com/techionext/Pixel-Global/blob/main/docs/public/limitations.md)
|
|
131
107
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
- `release-candidate.html` — consumidor real (`window.PixelV2` + Transport)
|
|
135
|
-
- `RELEASE_CANDIDATE.md` — como testar o playground RC
|
|
136
|
-
- `example-basic.html`, `example-behavior.html`, `example-conversion.html`, …
|
|
137
|
-
- pastas por evento: `lead/`, `add-to-cart/`, …
|
|
138
|
-
|
|
139
|
-
Índice: [`examples/html-script/README.md`](./examples/html-script/README.md)
|
|
140
|
-
Release notes: [`RELEASE_CANDIDATE.md`](./RELEASE_CANDIDATE.md)
|
|
141
|
-
|
|
142
|
-
## Scripts
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
pnpm build # dist/
|
|
146
|
-
pnpm test # testes v2
|
|
147
|
-
pnpm type-check # tsc --noEmit
|
|
148
|
-
pnpm test:smoke:real # smoke Event/Batch (skip sem .env)
|
|
149
|
-
pnpm validate:rc-package # instalação limpa do .tgz
|
|
150
|
-
```
|
|
108
|
+
## Contribuidores
|
|
151
109
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
| v1 (removido) | v2 |
|
|
155
|
-
|---------------|-----|
|
|
156
|
-
| `GomarkePixel` | `Pixel` |
|
|
157
|
-
| `window.gomarkePixel` | `window.PixelV2` |
|
|
158
|
-
| `dist/index.global.js` | `dist/v2/global.global.js` |
|
|
159
|
-
| `src/core/**` | `modules/core` + `transport` |
|
|
160
|
-
| `src/behavior/**` | `modules/behavior` |
|
|
161
|
-
| `src/conversion/**` | `modules/conversion` |
|
|
162
|
-
| `getTrackingCookies` | `AttributionService` |
|
|
163
|
-
| `loadFacebookPixel` / `loadGoogleTag` | `IntegrationEngine` browser destinations |
|
|
110
|
+
Arquitetura interna: [ARCHITECTURE.md](https://github.com/techionext/Pixel-Global/blob/main/ARCHITECTURE.md) · Playgrounds: `examples/html-script/` no repositório.
|