react-lgpd-consent 0.4.4 → 0.5.1

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 CHANGED
@@ -4,6 +4,78 @@ Todas as mudanças notáveis neste projeto serão documentadas neste arquivo.
4
4
 
5
5
  O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/), e este projeto segue [Semantic Versioning](https://semver.org/lang/pt-BR/).
6
6
 
7
+ ## [0.4.5] - 2025-10-25 — DataLayer Events e CI/CD
8
+
9
+ ### 📊 **DataLayer Events para Google Tag Manager**
10
+
11
+ - **Eventos Padronizados**: Implementado contrato de eventos `consent_initialized` e `consent_updated` no `window.dataLayer`
12
+ - `consent_initialized`: Disparado após hidratação inicial do `ConsentProvider`
13
+ - `consent_updated`: Disparado quando usuário altera preferências via banner, modal ou API
14
+ - Payload inclui: `event`, `consent_version`, `timestamp` (ISO 8601), `categories`, `origin`, `changed_categories`
15
+
16
+ - **Rastreamento de Origem**: Campo `origin` identifica fonte da mudança de consentimento
17
+ - `'banner'`: Decisão feita no CookieBanner
18
+ - `'modal'`: Ajuste feito no PreferencesModal
19
+ - `'reset'`: Reset programático via API
20
+ - `'programmatic'`: Mudança via `setPreference()` ou `acceptAll()`
21
+
22
+ - **API Pública**: Novas funções exportadas para uso customizado
23
+ - `pushConsentInitializedEvent(categories: ConsentPreferences)`
24
+ - `pushConsentUpdatedEvent(categories: ConsentPreferences, origin: ConsentEventOrigin, previousCategories?: ConsentPreferences)`
25
+ - Tipos: `ConsentEventOrigin`, `ConsentInitializedEvent`, `ConsentUpdatedEvent`, `ConsentEvent`
26
+
27
+ - **Integração Automática**: Eventos disparados automaticamente pelo `ConsentContext`
28
+ - Ref `previousPreferencesRef` rastreia estado anterior para calcular `changed_categories`
29
+ - Logger integrado para debug de eventos em desenvolvimento
30
+ - SSR-safe: não quebra quando `window` é undefined
31
+
32
+ - **Documentação GTM**: Seção completa adicionada em `INTEGRACOES.md`
33
+ - Schemas dos eventos com exemplos
34
+ - Passo a passo de configuração do Google Tag Manager
35
+ - Exemplos TypeScript de triggers e tags customizados
36
+ - Casos de uso: auditoria LGPD, análise de conversão, triggers condicionais
37
+
38
+ ### 🔧 **CI/CD e Build**
39
+
40
+ - **Migração para pnpm**: Workflows atualizados de npm para pnpm
41
+ - `ci.yml`: Adicionado `pnpm/action-setup@v4`, substituído `npm ci` por `pnpm install --frozen-lockfile`
42
+ - `package-check.yml`: Migrado para pnpm
43
+ - `publish-github-packages.yml`: Migrado para pnpm
44
+ - `deploy-docs.yml`: Migrado para pnpm
45
+ - **Problema Resolvido**: Conflitos `ERESOLVE` com `@eslint/js` eliminados
46
+ - `.gitignore`: Adicionado `package-lock.json` para evitar conflitos
47
+
48
+ - **Dependências**: Adicionado `@eslint/js@9.38.0` para resolver missing dependency error
49
+
50
+ ### 🧪 **Testes**
51
+
52
+ - **dataLayerEvents.test.ts**: 10 novos testes cobrindo eventos dataLayer
53
+ - Push de eventos `consent_initialized` e `consent_updated`
54
+ - Cálculo correto de `changed_categories`
55
+ - Diferentes origens (banner, modal, reset, programmatic)
56
+ - Inicialização do dataLayer se não existir
57
+ - SSR-safety (não quebra quando window é undefined)
58
+ - Formato ISO 8601 de timestamps
59
+ - **Solução de Isolamento**: Testes usam estratégia de "pegar último evento" para evitar acúmulo entre testes
60
+
61
+ ### 📚 **Documentação**
62
+
63
+ - **INTEGRACOES.md**: Nova seção "Eventos dataLayer (Google Tag Manager)" com 200+ linhas
64
+ - **README.md**: Seção "Novidades v0.4.5" com resumo de features
65
+ - **README.en.md**: Tradução da seção "What's New in v0.4.5"
66
+ - **tsconfig.typedoc.json**: Corrigido para excluir `*.test.ts` (além de `*.test.tsx`)
67
+ - **API Pública**: Exportações documentadas com TSDoc completo
68
+
69
+ ### 📦 **Build**
70
+
71
+ - **Versão**: Bump de `0.4.4` → `0.4.5`
72
+ - **Tamanho**: Build otimizado mantém tree-shaking e SSR-safety
73
+ - ESM: `dist/index.js` ~32.59 KB
74
+ - CJS: `dist/index.cjs` ~38.17 KB
75
+ - Types: `dist/index.d.ts` ~132.13 KB
76
+
77
+ ---
78
+
7
79
  ## [0.4.4] - 2025-10-06 — Correções de CI/CD e Publicação
8
80
 
9
81
  ### 🔧 **Correções de CI/CD**
package/README.en.md CHANGED
@@ -50,6 +50,21 @@ npm install react-lgpd-consent @mui/material @emotion/react @emotion/styled js-c
50
50
 
51
51
  ---
52
52
 
53
+ ## ✨ What's New in v0.4.5
54
+
55
+ ### 📊 DataLayer Events for Google Tag Manager
56
+ - **Standardized Events**: `consent_initialized` and `consent_updated` automatically dispatched
57
+ - **Origin Tracking**: Identifies whether decision came from banner, modal, reset, or programmatic API
58
+ - **LGPD Audit**: Complete change history with `changed_categories` and ISO 8601 timestamps
59
+ - **GTM Integration**: Full documentation with trigger and tag examples
60
+ - **Public API**: Exported `pushConsentInitializedEvent` and `pushConsentUpdatedEvent` functions
61
+
62
+ ### 🔧 CI/CD Improvements
63
+ - **Migration to pnpm**: Workflows updated from npm to pnpm, resolving dependency conflicts
64
+ - **Optimized Build**: Faster and more reliable pipeline
65
+
66
+ ---
67
+
53
68
  ## 📖 Basic Usage
54
69
 
55
70
  Wrap your app with `ConsentProvider` (minimal example):