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