@react-lgpd-consent/core 0.5.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/CHANGELOG.md +4 -0
- package/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/index.cjs +2623 -0
- package/dist/index.d.cts +3845 -0
- package/dist/index.d.ts +3845 -0
- package/dist/index.js +2542 -0
- package/package.json +77 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 @lucianoedipo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @react-lgpd-consent/core
|
|
2
|
+
|
|
3
|
+
> Núcleo da biblioteca de consentimento LGPD para React - Estado, hooks e utilitários sem dependências de UI
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@react-lgpd-consent/core)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## 📦 Sobre
|
|
9
|
+
|
|
10
|
+
O pacote `@react-lgpd-consent/core` contém toda a lógica de negócio e gerenciamento de estado da biblioteca `react-lgpd-consent`, **sem dependências de componentes UI**.
|
|
11
|
+
|
|
12
|
+
### Ideal para:
|
|
13
|
+
- ✅ Criar sua própria camada de UI customizada
|
|
14
|
+
- ✅ Integrar com outras bibliotecas de componentes (não-MUI)
|
|
15
|
+
- ✅ Aplicações headless que precisam apenas da lógica de consentimento
|
|
16
|
+
- ✅ Reduzir o tamanho do bundle removendo dependências do Material-UI
|
|
17
|
+
|
|
18
|
+
## 📥 Instalação
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @react-lgpd-consent/core
|
|
22
|
+
# ou
|
|
23
|
+
pnpm add @react-lgpd-consent/core
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Peer Dependencies:** `react@^18.2.0 || ^19.0.0`, `react-dom@^18.2.0 || ^19.0.0`
|
|
27
|
+
|
|
28
|
+
## 🚀 Uso Básico
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { ConsentProvider, useConsent } from '@react-lgpd-consent/core'
|
|
32
|
+
|
|
33
|
+
function App() {
|
|
34
|
+
return (
|
|
35
|
+
<ConsentProvider categories={{ enabledCategories: ['analytics'] }}>
|
|
36
|
+
<MyCustomBanner />
|
|
37
|
+
<YourApp />
|
|
38
|
+
</ConsentProvider>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function MyCustomBanner() {
|
|
43
|
+
const { consented, acceptAll, rejectAll } = useConsent()
|
|
44
|
+
|
|
45
|
+
if (consented) return null
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div>
|
|
49
|
+
<p>Usamos cookies para melhorar sua experiência</p>
|
|
50
|
+
<button onClick={acceptAll}>Aceitar</button>
|
|
51
|
+
<button onClick={rejectAll}>Rejeitar</button>
|
|
52
|
+
</div>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 🎯 O que está incluído
|
|
58
|
+
|
|
59
|
+
- **Contextos:** `ConsentProvider`, `CategoriesContext`, `DesignContext`
|
|
60
|
+
- **Hooks:** `useConsent`, `useCategories`, `useConsentHydration`, e mais
|
|
61
|
+
- **Utilitários:** `ConsentScriptLoader`, `ConsentGate`, logging, cookies
|
|
62
|
+
- **Integrações:** Google Analytics, GTM, UserWay, Facebook Pixel, Hotjar, etc.
|
|
63
|
+
- **Tipos TypeScript:** Tipagem completa para toda a API
|
|
64
|
+
|
|
65
|
+
## 📚 Documentação
|
|
66
|
+
|
|
67
|
+
Para documentação completa, exemplos e API reference:
|
|
68
|
+
- [Documentação Principal](https://lucianoedipo.github.io/react-lgpd-consent/)
|
|
69
|
+
- [Guia de Início Rápido](../../QUICKSTART.md)
|
|
70
|
+
- [Conformidade LGPD](../../CONFORMIDADE.md)
|
|
71
|
+
|
|
72
|
+
## 🔗 Pacotes Relacionados
|
|
73
|
+
|
|
74
|
+
- [`@react-lgpd-consent/mui`](../mui) - Componentes prontos usando Material-UI
|
|
75
|
+
- [`react-lgpd-consent`](../react-lgpd-consent) - Pacote agregador (core + mui)
|
|
76
|
+
|
|
77
|
+
## 📄 Licença
|
|
78
|
+
|
|
79
|
+
MIT © [Luciano Édipo](https://github.com/lucianoedipo)
|
|
80
|
+
|