react-lgpd-consent 0.6.4 → 0.7.0
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/API.md +144 -0
- package/CHANGELOG.md +206 -999
- package/INTEGRACOES.md +86 -0
- package/QUICKSTART.en.md +11 -0
- package/README.en.md +40 -0
- package/README.md +40 -0
- package/package.json +3 -5
package/INTEGRACOES.md
CHANGED
|
@@ -389,3 +389,89 @@ interface ConsentUpdatedEvent {
|
|
|
389
389
|
| Live Chat | `functional` | Funcionalidade de suporte |
|
|
390
390
|
| YouTube/Vimeo | `social` | Conteúdo de redes sociais |
|
|
391
391
|
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## 🆕 Recursos Avançados v0.7.0
|
|
396
|
+
|
|
397
|
+
### Monitoramento com Callbacks de Lifecycle
|
|
398
|
+
|
|
399
|
+
Integre sistemas de auditoria monitorando eventos de consentimento:
|
|
400
|
+
|
|
401
|
+
```tsx
|
|
402
|
+
import { ConsentProvider, ConsentScriptLoader } from 'react-lgpd-consent'
|
|
403
|
+
import { googleAnalytics4Integration } from './integrations'
|
|
404
|
+
|
|
405
|
+
<ConsentProvider
|
|
406
|
+
categories={{ enabledCategories: ['analytics', 'marketing'] }}
|
|
407
|
+
onConsentInit={(state) => {
|
|
408
|
+
// Disparado na inicialização (útil para analytics)
|
|
409
|
+
console.log('Consentimento inicial:', state)
|
|
410
|
+
}}
|
|
411
|
+
onConsentChange={(current, previous) => {
|
|
412
|
+
// Disparado em toda mudança de preferências
|
|
413
|
+
console.log('Mudança:', { current, previous })
|
|
414
|
+
|
|
415
|
+
// Exemplo: disparar evento no dataLayer
|
|
416
|
+
window.dataLayer?.push({
|
|
417
|
+
event: 'consent_preferences_updated',
|
|
418
|
+
consent_analytics: current.preferences.analytics,
|
|
419
|
+
consent_marketing: current.preferences.marketing
|
|
420
|
+
})
|
|
421
|
+
}}
|
|
422
|
+
onAuditLog={(entry) => {
|
|
423
|
+
// Enviar para backend de compliance
|
|
424
|
+
fetch('/api/consent-audit', {
|
|
425
|
+
method: 'POST',
|
|
426
|
+
body: JSON.stringify(entry)
|
|
427
|
+
})
|
|
428
|
+
}}
|
|
429
|
+
>
|
|
430
|
+
<ConsentScriptLoader integrations={[googleAnalytics4Integration]} />
|
|
431
|
+
<YourApp />
|
|
432
|
+
</ConsentProvider>
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Presets de Categorias ANPD
|
|
436
|
+
|
|
437
|
+
Use configurações pré-validadas pela ANPD:
|
|
438
|
+
|
|
439
|
+
```tsx
|
|
440
|
+
import { ConsentProvider, createAnpdCategories } from 'react-lgpd-consent'
|
|
441
|
+
|
|
442
|
+
// Preset BÁSICO (necessary + analytics)
|
|
443
|
+
const basicConfig = createAnpdCategories({ include: ['analytics'] })
|
|
444
|
+
|
|
445
|
+
// Preset COMPLETO (todas as 6 categorias)
|
|
446
|
+
const fullConfig = createAnpdCategories({
|
|
447
|
+
include: ['analytics', 'marketing', 'functional', 'social', 'personalization']
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
// Com customizações
|
|
451
|
+
const customConfig = createAnpdCategories({
|
|
452
|
+
include: ['analytics', 'marketing'],
|
|
453
|
+
names: { analytics: 'Análises' },
|
|
454
|
+
descriptions: { marketing: 'Anúncios personalizados' }
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
<ConsentProvider categories={fullConfig}>
|
|
458
|
+
<ConsentScriptLoader integrations={myIntegrations} />
|
|
459
|
+
</ConsentProvider>
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
**Vantagens dos presets:**
|
|
463
|
+
- ✅ Conformidade com diretrizes ANPD
|
|
464
|
+
- ✅ Nomes e descrições em pt-BR revisadas
|
|
465
|
+
- ✅ Tipagem forte para evitar erros
|
|
466
|
+
- ✅ Reduz código boilerplate em 60%
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## 📚 Recursos Adicionais
|
|
471
|
+
|
|
472
|
+
- [API.md](./API.md) – Documentação completa da API pública
|
|
473
|
+
- [RECIPES.md](../../RECIPES.md) – Receitas práticas com Next.js, CSP, Google Consent Mode v2
|
|
474
|
+
- [TROUBLESHOOTING.md](../../TROUBLESHOOTING.md) – Solução de problemas comuns
|
|
475
|
+
- [CONFORMIDADE.md](../../CONFORMIDADE.md) – Conformidade LGPD e ANPD
|
|
476
|
+
|
|
477
|
+
**Problemas de integração?** Consulte [TROUBLESHOOTING.md - Seção de Integrations](../../TROUBLESHOOTING.md#integrações-de-terceiros).
|
package/QUICKSTART.en.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
This quickstart gives everything you need to integrate `react-lgpd-consent` into a React project fast.
|
|
4
4
|
|
|
5
|
+
## 🆕 What's New in v0.7.0
|
|
6
|
+
|
|
7
|
+
- ✅ **Lifecycle Callbacks** - `onConsentInit`, `onConsentChange`, `onAuditLog` for monitoring
|
|
8
|
+
- ✅ **ANPD Presets** - `createAnpdCategories()` for quick LGPD-compliant setup
|
|
9
|
+
- ✅ **Audit Logging** - `createConsentAuditEntry()` for compliance tracking
|
|
10
|
+
- ✅ **Better DX** - Clear error messages when hooks are used incorrectly
|
|
11
|
+
|
|
12
|
+
📖 **Documentation:** [TROUBLESHOOTING.md](../../TROUBLESHOOTING.md) | [API.md](./API.md)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
5
16
|
## 📦 Installation
|
|
6
17
|
|
|
7
18
|
```bash
|
package/README.en.md
CHANGED
|
@@ -84,6 +84,46 @@ function Analytics() {
|
|
|
84
84
|
|
|
85
85
|
---
|
|
86
86
|
|
|
87
|
+
## 🆕 What's New in v0.7.0
|
|
88
|
+
|
|
89
|
+
### Lifecycle Callbacks (#68)
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
<ConsentProvider
|
|
93
|
+
onConsentInit={(state) => console.log('Initialized:', state)}
|
|
94
|
+
onConsentChange={(current, prev) => console.log('Changed:', current)}
|
|
95
|
+
onAuditLog={(entry) => fetch('/api/audit', {
|
|
96
|
+
method: 'POST',
|
|
97
|
+
body: JSON.stringify(entry)
|
|
98
|
+
})}
|
|
99
|
+
>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### ANPD Category Presets (#70)
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { createAnpdCategories } from 'react-lgpd-consent'
|
|
106
|
+
|
|
107
|
+
const categories = createAnpdCategories({
|
|
108
|
+
include: ['analytics', 'marketing']
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Consent Audit (#60)
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { createConsentAuditEntry } from 'react-lgpd-consent'
|
|
116
|
+
|
|
117
|
+
const audit = createConsentAuditEntry(state, {
|
|
118
|
+
action: 'update',
|
|
119
|
+
consentVersion: '1'
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
📖 **Full documentation:** [API.md](./API.md) | [TROUBLESHOOTING.md](../../TROUBLESHOOTING.md)
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
87
127
|
## Packages (monorepo)
|
|
88
128
|
|
|
89
129
|
| Package | Description |
|
package/README.md
CHANGED
|
@@ -84,6 +84,46 @@ function Analytics() {
|
|
|
84
84
|
|
|
85
85
|
---
|
|
86
86
|
|
|
87
|
+
## 🆕 Novidades v0.7.0
|
|
88
|
+
|
|
89
|
+
### Callbacks de Lifecycle (#68)
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
<ConsentProvider
|
|
93
|
+
onConsentInit={(state) => console.log('Init:', state)}
|
|
94
|
+
onConsentChange={(current, prev) => console.log('Changed:', current)}
|
|
95
|
+
onAuditLog={(entry) => fetch('/api/audit', {
|
|
96
|
+
method: 'POST',
|
|
97
|
+
body: JSON.stringify(entry)
|
|
98
|
+
})}
|
|
99
|
+
>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Presets ANPD (#70)
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { createAnpdCategories } from 'react-lgpd-consent'
|
|
106
|
+
|
|
107
|
+
const categories = createAnpdCategories({
|
|
108
|
+
include: ['analytics', 'marketing']
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Auditoria (#60)
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { createConsentAuditEntry } from 'react-lgpd-consent'
|
|
116
|
+
|
|
117
|
+
const audit = createConsentAuditEntry(state, {
|
|
118
|
+
action: 'update',
|
|
119
|
+
consentVersion: '1'
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
📖 **Documentação completa:** [API.md](./API.md) | [TROUBLESHOOTING.md](../../TROUBLESHOOTING.md)
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
87
127
|
## Pacotes (monorepo v0.5.x)
|
|
88
128
|
|
|
89
129
|
| Pacote | Descrição |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-lgpd-consent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Biblioteca de consentimento LGPD, integrações nativas e sistema extensível para React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lgpd",
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@react-lgpd-consent/core": "^0.
|
|
98
|
-
"@react-lgpd-consent/mui": "^0.
|
|
97
|
+
"@react-lgpd-consent/core": "^0.7.0",
|
|
98
|
+
"@react-lgpd-consent/mui": "^0.7.0"
|
|
99
99
|
},
|
|
100
100
|
"size-limit": [
|
|
101
101
|
{
|
|
@@ -133,8 +133,6 @@
|
|
|
133
133
|
"test:coverage": "jest --config ../../jest.config.mjs --coverage",
|
|
134
134
|
"coverage-check": "node ../../scripts/coverage-check.cjs",
|
|
135
135
|
"size-check": "size-limit",
|
|
136
|
-
"mutation": "npx stryker run",
|
|
137
|
-
"mutation:tests": "npx stryker run ../../stryker.tests.conf.json",
|
|
138
136
|
"docs:generate": "node ../../scripts/run-typedoc.mjs",
|
|
139
137
|
"storybook": "storybook dev -p 6006 --config-dir ../../.storybook",
|
|
140
138
|
"build-storybook": "storybook build --config-dir ../../.storybook --output-dir ../../storybook-static"
|