react-lgpd-consent 0.5.2 β 0.5.4
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 +576 -0
- package/CHANGELOG.md +155 -1
- package/INTEGRACOES.md +393 -0
- package/QUICKSTART.en.md +7 -0
- package/QUICKSTART.md +97 -11
- package/README.en.md +67 -396
- package/README.md +71 -788
- package/package.json +7 -4
package/README.en.md
CHANGED
|
@@ -1,274 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- English README for the `react-lgpd-consent` aggregator package -->
|
|
2
|
+
# react-lgpd-consent πͺ
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
LGPD-compliant cookie consent management for React β this package is the aggregator that re-exports the MUI components for backwards compatibility. If you need a smaller bundle or headless API, prefer `@react-lgpd-consent/core` or `@react-lgpd-consent/mui`.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<div> <div>
|
|
10
|
-
|
|
11
|
-
<a href="https://www.npmjs.com/package/react-lgpd-consent"><img src="https://img.shields.io/npm/v/react-lgpd-consent?style=for-the-badge&logo=npm&color=cb3837&logoColor=white" alt="NPM Version"></a> <a href="https://www.npmjs.com/package/react-lgpd-consent"><img src="https://img.shields.io/npm/v/react-lgpd-consent?style=for-the-badge&logo=npm&color=cb3837&logoColor=white" alt="NPM Version"></a>
|
|
12
|
-
|
|
13
|
-
<a href="https://www.npmjs.com/package/react-lgpd-consent"><img src="https://img.shields.io/npm/dm/react-lgpd-consent?style=for-the-badge&logo=npm&color=ff6b35&logoColor=white" alt="Downloads"></a> <a href="https://www.npmjs.com/package/react-lgpd-consent"><img src="https://img.shields.io/npm/dm/react-lgpd-consent?style=for-the-badge&logo=npm&color=ff6b35&logoColor=white" alt="Downloads"></a>
|
|
14
|
-
|
|
15
|
-
<a href="https://github.com/lucianoedipo/react-lgpd-consent/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/react-lgpd-consent?style=for-the-badge&color=green&logoColor=white" alt="License"></a> <a href="https://github.com/lucianoedipo/react-lgpd-consent/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/react-lgpd-consent?style=for-the-badge&color=green&logoColor=white" alt="License"></a>
|
|
16
|
-
|
|
17
|
-
<a href="https://lucianoedipo.github.io/react-lgpd-consent/storybook/"><img src="https://img.shields.io/badge/Storybook-Playground-ff4785?style=for-the-badge&logo=storybook&logoColor=white" alt="Storybook"></a> <a href="https://lucianoedipo.github.io/react-lgpd-consent/storybook/"><img src="https://img.shields.io/badge/Storybook-Playground-ff4785?style=for-the-badge&logo=storybook&logoColor=white" alt="Storybook"></a>
|
|
18
|
-
|
|
19
|
-
</div> </div>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<div> <div>
|
|
24
|
-
|
|
25
|
-
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-3178c6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript Ready"></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-3178c6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript Ready"></a>
|
|
26
|
-
|
|
27
|
-
<a href="https://reactjs.org/"><img src="https://img.shields.io/badge/React-18%2B%2019-61dafb?style=for-the-badge&logo=react&logoColor=white" alt="React 18+19"></a> <a href="https://reactjs.org/"><img src="https://img.shields.io/badge/React-18+-61dafb?style=for-the-badge&logo=react&logoColor=white" alt="React 18+"></a>
|
|
28
|
-
|
|
29
|
-
<a href="https://nextjs.org/"><img src="https://img.shields.io/badge/Next.js-Compatible-000000?style=for-the-badge&logo=next.js&logoColor=white" alt="Next.js Compatible"></a> <a href="https://nextjs.org/"><img src="https://img.shields.io/badge/Next.js-Compatible-000000?style=for-the-badge&logo=next.js&logoColor=white" alt="Next.js Compatible"></a>
|
|
30
|
-
|
|
31
|
-
</div> </div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<div> <div>
|
|
36
|
-
|
|
37
|
-
<a href="https://codecov.io/gh/lucianoedipo/react-lgpd-consent"><img src="https://img.shields.io/codecov/c/github/lucianoedipo/react-lgpd-consent?style=for-the-badge&logo=codecov&logoColor=white" alt="Coverage"></a> <a href="https://codecov.io/gh/lucianoedipo/react-lgpd-consent"><img src="https://img.shields.io/codecov/c/github/lucianoedipo/react-lgpd-consent?style=for-the-badge&logo=codecov&logoColor=white" alt="Coverage"></a>
|
|
38
|
-
|
|
39
|
-
<a href="https://bundlephobia.com/package/react-lgpd-consent"><img src="https://img.shields.io/bundlephobia/minzip/react-lgpd-consent?style=for-the-badge&logo=webpack&logoColor=white&label=Bundle" alt="Bundle Size"></a> <a href="https://bundlephobia.com/package/react-lgpd-consent"><img src="https://img.shields.io/bundlephobia/minzip/react-lgpd-consent?style=for-the-badge&logo=webpack&logoColor=white" alt="Bundle Size"></a>
|
|
40
|
-
|
|
41
|
-
</div> <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/react-lgpd-consent?style=for-the-badge&logo=node.js&logoColor=white" alt="Node Version"></a>
|
|
42
|
-
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<br />
|
|
46
|
-
|
|
47
|
-
<br />
|
|
48
|
-
|
|
49
|
-
<p>
|
|
50
|
-
|
|
51
|
-
<a href="#-installation"><strong>Installation</strong></a> β’ <p>
|
|
52
|
-
|
|
53
|
-
<a href="#-quick-start"><strong>Quick Start</strong></a> β’ <a href="#installation"><strong>Installation</strong></a> β’
|
|
54
|
-
|
|
55
|
-
<a href="https://github.com/lucianoedipo/react-lgpd-consent/blob/main/QUICKSTART.en.md"><strong>π Complete Guide</strong></a> β’ <a href="#basic-usage"><strong>Basic Usage</strong></a> β’
|
|
56
|
-
|
|
57
|
-
<a href="#-documentation"><strong>Documentation</strong></a> β’ <a href="./QUICKSTART.md"><strong>π Quickstart</strong></a> β’
|
|
58
|
-
|
|
59
|
-
<a href="https://github.com/lucianoedipo/react-lgpd-consent/blob/main/packages/react-lgpd-consent/README.md">π§π· PortuguΓͺs</a> <a href="#documentation"><strong>Documentation</strong></a> β’
|
|
60
|
-
|
|
61
|
-
</p> <a href="#contributing"><strong>Contributing</strong></a>
|
|
62
|
-
|
|
63
|
-
</div> </p>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
--- <p align="center">
|
|
68
|
-
|
|
69
|
-
<a href="./QUICKSTART.en.md"><img src="https://img.shields.io/badge/Quickstart-Get%20Started-blue?style=for-the-badge&logo=book" alt="Quickstart"></a>
|
|
70
|
-
|
|
71
|
-
## π― What's New in v0.5.0 </p>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### ποΈ Modular Architecture (BREAKING CHANGE) <p align="center"><strong>Start here:</strong> follow the <a href="./QUICKSTART.en.md">Quickstart guide (QUICKSTART.en.md)</a> for step-by-step setup, TypeScript examples, props summary and MUI integration β recommended for new users.</p>
|
|
76
|
-
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
v0.5.0 introduces a **monorepo architecture** with 3 independent packages:
|
|
6
|
+
<!-- Badges -->
|
|
7
|
+
[](https://www.npmjs.com/package/react-lgpd-consent)
|
|
8
|
+
[](https://www.npmjs.com/package/react-lgpd-consent)
|
|
9
|
+
[](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/LICENSE)
|
|
80
10
|
|
|
81
11
|
---
|
|
82
12
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|---------|-------------|-------------|-------------|## π Installation
|
|
13
|
+
## Overview
|
|
86
14
|
|
|
87
|
-
|
|
15
|
+
`react-lgpd-consent` is the compatibility aggregator for the v0.5.x monorepo. It re-exports the ready-made MUI components and keeps the API compatible with previous releases. If you want to optimize your bundle, import only `@react-lgpd-consent/core` (headless) or `@react-lgpd-consent/mui` (MUI components).
|
|
88
16
|
|
|
89
|
-
|
|
17
|
+
Key features:
|
|
90
18
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
> **π‘ This package (`react-lgpd-consent`)** is the aggregator that maintains backward compatibility. It re-exports `@react-lgpd-consent/mui` and works exactly like v0.4.x, but with the new architecture.
|
|
96
|
-
|
|
97
|
-
**Peer dependencies:** `react`, `react-dom`, `@mui/material` and `js-cookie`.
|
|
98
|
-
|
|
99
|
-
### β¨ New Features in v0.5.0
|
|
19
|
+
- Cookie banner, preferences modal and floating button (MUI)
|
|
20
|
+
- Conditional script loading based on consent
|
|
21
|
+
- SSR-safe (Next.js / Remix compatible)
|
|
22
|
+
- Auditable events (consent_initialized, consent_updated)
|
|
100
23
|
|
|
101
24
|
---
|
|
102
25
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
- β
**Integrated MUI Theme**: Optional ThemeProvider support with `createDefaultConsentTheme()`## β¨ What's New in v0.4.5
|
|
106
|
-
|
|
107
|
-
- β
**Granular Control**: Props to disable individual components (`disableDefaultBanner`, `disableDefaultModal`, `disableDefaultFloatingButton`)
|
|
108
|
-
|
|
109
|
-
- β
**Developer Warnings**: Intelligent system that warns when UI components are missing (DEV only)### π DataLayer Events for Google Tag Manager
|
|
110
|
-
|
|
111
|
-
- β
**TypeScript Monorepo**: Configured paths for better IDE DX- **Standardized Events**: `consent_initialized` and `consent_updated` automatically dispatched
|
|
112
|
-
|
|
113
|
-
- **Origin Tracking**: Identifies whether decision came from banner, modal, reset, or programmatic API
|
|
114
|
-
|
|
115
|
-
### π¦ Migration from v0.4.x β v0.5.0- **LGPD Audit**: Complete change history with `changed_categories` and ISO 8601 timestamps
|
|
116
|
-
|
|
117
|
-
- **GTM Integration**: Full documentation with trigger and tag examples
|
|
118
|
-
|
|
119
|
-
**If you use `react-lgpd-consent` (this package):**- **Public API**: Exported `pushConsentInitializedEvent` and `pushConsentUpdatedEvent` functions
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
β
**No changes needed!** The API is 100% backward compatible.### π§ CI/CD Improvements
|
|
124
|
-
|
|
125
|
-
- **Migration to pnpm**: Workflows updated from npm to pnpm, resolving dependency conflicts
|
|
126
|
-
|
|
127
|
-
```tsx- **Optimized Build**: Faster and more reliable pipeline
|
|
128
|
-
|
|
129
|
-
// v0.4.x - still works
|
|
130
|
-
|
|
131
|
-
import { ConsentProvider, useConsent } from 'react-lgpd-consent'---
|
|
132
|
-
|
|
26
|
+
## Installation
|
|
133
27
|
|
|
28
|
+
Install the package and peer dependencies:
|
|
134
29
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
```Wrap your app with `ConsentProvider` (minimal example):
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
**If you want to optimize bundle size:**```tsx
|
|
144
|
-
|
|
145
|
-
import { ConsentProvider } from 'react-lgpd-consent'
|
|
146
|
-
|
|
147
|
-
```tsx
|
|
148
|
-
|
|
149
|
-
// Option 1: Core (headless) + your own UI (~86 KB)export default function App() {
|
|
150
|
-
|
|
151
|
-
import { ConsentProvider } from '@react-lgpd-consent/core' return (
|
|
152
|
-
|
|
153
|
-
<ConsentProvider categories={{ enabledCategories: ['analytics'] }}>
|
|
154
|
-
|
|
155
|
-
// Option 2: MUI with ready components (~104 KB) <YourApp />
|
|
156
|
-
|
|
157
|
-
import { ConsentProvider } from '@react-lgpd-consent/mui' </ConsentProvider>
|
|
158
|
-
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
// Option 3: Aggregator (compatibility) (~104 KB)}
|
|
162
|
-
|
|
163
|
-
import { ConsentProvider } from 'react-lgpd-consent' // This package```
|
|
164
|
-
|
|
30
|
+
```powershell
|
|
31
|
+
npm install react-lgpd-consent
|
|
32
|
+
# ensure peer deps are present in the host app
|
|
33
|
+
npm install react react-dom @mui/material @emotion/react @emotion/styled js-cookie --save-peer
|
|
165
34
|
```
|
|
166
35
|
|
|
167
|
-
-
|
|
168
|
-
|
|
169
|
-
----
|
|
170
|
-
|
|
171
|
-
- **[QUICKSTART.en.md](./QUICKSTART.en.md)** (recommended)
|
|
172
|
-
|
|
173
|
-
## π Installation - New in v0.4.0: `customCategories` support β see the βCustom categories (customCategories)β section in the Quickstart.
|
|
174
|
-
|
|
175
|
-
- New in v0.4.1: native integrations for Facebook Pixel, Hotjar, Mixpanel, Clarity, Intercom, and Zendesk β see [INTEGRACOES.md](./INTEGRACOES.md).
|
|
176
|
-
|
|
177
|
-
```bash - Tip: set `designTokens.layout.backdrop: 'auto'` for a theme-aware blocking banner backdrop.
|
|
178
|
-
|
|
179
|
-
npm install react-lgpd-consent - Auto-config of categories: the library detects required categories from integrations and surfaces toggles even if you forgot to enable them (initial value is always rejected). We still recommend explicitly listing them in `categories.enabledCategories` for clarity.
|
|
180
|
-
|
|
181
|
-
``` - Non-blocked Policy/Terms pages: if `policyLinkUrl` and/or `termsLinkUrl` point to the current page, the blocking overlay is not applied β ensuring readability of these pages.
|
|
182
|
-
|
|
183
|
-
- **[Docs / API](./API.md)**
|
|
184
|
-
|
|
185
|
-
### Peer Dependencies (auto-installed if not present)- **[LGPD Compliance](./CONFORMIDADE.md)**
|
|
186
|
-
|
|
187
|
-
- **[Integrations](./INTEGRACOES.md)**
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
|
|
191
|
-
npm install react react-dom @mui/material @emotion/react @emotion/styled### π¨ Interactive Documentation (GitHub Pages)
|
|
192
|
-
|
|
193
|
-
```- **[π Storybook - Interactive Playground](https://lucianoedipo.github.io/react-lgpd-consent/storybook/)**: Explore and test all components live with interactive controls.
|
|
194
|
-
|
|
195
|
-
- **[βοΈ TypeDoc - API Reference](https://lucianoedipo.github.io/react-lgpd-consent/docs/)**: Automatically generated complete API documentation.
|
|
196
|
-
|
|
197
|
-
---- **[π Documentation Portal](https://lucianoedipo.github.io/react-lgpd-consent/)**: Home page that navigates between all docs sites.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
## β‘ Quick Start### π§βπ« Developer Guidance (dev-only)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
### Basic Setup (3 lines of code)In development, the library prints a guidance panel in the console to help you configure correctly:
|
|
206
|
-
|
|
207
|
-
- Warns when using default categories; suggests making them explicit
|
|
208
|
-
|
|
209
|
-
```tsx- Lists active categories and which ones require a UI toggle
|
|
210
|
-
|
|
211
|
-
import { ConsentProvider } from 'react-lgpd-consent'- Detects integrations that require categories and suggests enabling them
|
|
212
|
-
|
|
213
|
-
- Flags excessive number of categories (UX)
|
|
214
|
-
|
|
215
|
-
export default function App() {- Highlights Brazilian LGPD best practices: opt-out by default, clear policy, consent logging, retention
|
|
216
|
-
|
|
217
|
-
return (- Silenced in production; SSR-safe
|
|
218
|
-
|
|
219
|
-
<ConsentProvider categories={{ enabledCategories: ['analytics', 'marketing'] }}>
|
|
220
|
-
|
|
221
|
-
<YourApp />### β οΈ Breaking Changes v0.4.1
|
|
222
|
-
|
|
223
|
-
</ConsentProvider>- **Custom categories support**: `setPreference` and `ScriptIntegration.category` now use `string` instead of `Category`
|
|
224
|
-
|
|
225
|
-
)- **Minimal impact**: Code using literal strings continues working without changes
|
|
226
|
-
|
|
227
|
-
}- **Migration guide**: See [CHANGELOG.md](./CHANGELOG.md) for complete details
|
|
228
|
-
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
**This already includes:**
|
|
234
|
-
|
|
235
|
-
- β
Cookie banner## π€ Contributing
|
|
236
|
-
|
|
237
|
-
- β
Preferences modal
|
|
238
|
-
|
|
239
|
-
- β
Floating button to reopen preferences1. Open an Issue for bugs or feature requests.
|
|
240
|
-
|
|
241
|
-
- β
Cookie persistence2. Follow `DEVELOPMENT.md` to submit a PR.
|
|
242
|
-
|
|
243
|
-
- β
SSR-safe (Next.js, Remix)
|
|
36
|
+
This package re-exports `@react-lgpd-consent/mui` for compatibility. Import only what you need to reduce bundle size.
|
|
244
37
|
|
|
245
38
|
---
|
|
246
39
|
|
|
247
|
-
|
|
40
|
+
## Quick Start
|
|
248
41
|
|
|
249
|
-
|
|
42
|
+
Minimal example (API compatible with v0.4.x):
|
|
250
43
|
|
|
251
44
|
```tsx
|
|
45
|
+
import React from 'react'
|
|
46
|
+
import { ConsentProvider, useConsent } from 'react-lgpd-consent'
|
|
252
47
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
48
|
+
export default function App() {
|
|
49
|
+
return (
|
|
50
|
+
<ConsentProvider categories={{ enabledCategories: ['analytics', 'marketing'] }}>
|
|
51
|
+
<YourApp />
|
|
52
|
+
</ConsentProvider>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
258
55
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
56
|
+
function YourApp() {
|
|
57
|
+
const { preferences, acceptCategory } = useConsent()
|
|
262
58
|
|
|
263
59
|
return (
|
|
264
|
-
<
|
|
265
|
-
Accept Marketing
|
|
266
|
-
</
|
|
60
|
+
<div>
|
|
61
|
+
<button onClick={() => acceptCategory('marketing')}>Accept Marketing</button>
|
|
62
|
+
</div>
|
|
267
63
|
)
|
|
268
64
|
}
|
|
269
65
|
```
|
|
270
66
|
|
|
271
|
-
|
|
67
|
+
Load a script only if the user granted the related category:
|
|
272
68
|
|
|
273
69
|
```tsx
|
|
274
70
|
import { ConsentScriptLoader } from 'react-lgpd-consent'
|
|
@@ -280,12 +76,7 @@ function Analytics() {
|
|
|
280
76
|
src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"
|
|
281
77
|
strategy="afterInteractive"
|
|
282
78
|
>
|
|
283
|
-
{`
|
|
284
|
-
window.dataLayer = window.dataLayer || [];
|
|
285
|
-
function gtag(){dataLayer.push(arguments);}
|
|
286
|
-
gtag('js', new Date());
|
|
287
|
-
gtag('config', 'GA_MEASUREMENT_ID');
|
|
288
|
-
`}
|
|
79
|
+
{`window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'GA_MEASUREMENT_ID');`}
|
|
289
80
|
</ConsentScriptLoader>
|
|
290
81
|
)
|
|
291
82
|
}
|
|
@@ -293,172 +84,52 @@ function Analytics() {
|
|
|
293
84
|
|
|
294
85
|
---
|
|
295
86
|
|
|
296
|
-
##
|
|
87
|
+
## Packages (monorepo)
|
|
297
88
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
<ConsentProvider
|
|
304
|
-
theme={createDefaultConsentTheme({
|
|
305
|
-
palette: {
|
|
306
|
-
primary: { main: '#your-brand-color' }
|
|
307
|
-
}
|
|
308
|
-
})}
|
|
309
|
-
categories={{ enabledCategories: ['analytics'] }}
|
|
310
|
-
>
|
|
311
|
-
<App />
|
|
312
|
-
</ConsentProvider>
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
### Disable Default Components
|
|
316
|
-
|
|
317
|
-
```tsx
|
|
318
|
-
import { ConsentProvider, CookieBanner, PreferencesModal } from 'react-lgpd-consent'
|
|
319
|
-
|
|
320
|
-
<ConsentProvider
|
|
321
|
-
categories={{ enabledCategories: ['analytics'] }}
|
|
322
|
-
disableDefaultBanner
|
|
323
|
-
disableDefaultModal
|
|
324
|
-
>
|
|
325
|
-
{/* Use your own components */}
|
|
326
|
-
<CookieBanner position="bottom-left" />
|
|
327
|
-
<PreferencesModal showBranding={false} />
|
|
328
|
-
<App />
|
|
329
|
-
</ConsentProvider>
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Advanced Design Tokens
|
|
333
|
-
|
|
334
|
-
```tsx
|
|
335
|
-
<ConsentProvider
|
|
336
|
-
categories={{ enabledCategories: ['analytics'] }}
|
|
337
|
-
designTokens={{
|
|
338
|
-
colors: {
|
|
339
|
-
primary: '#1976d2',
|
|
340
|
-
secondary: '#dc004e',
|
|
341
|
-
background: '#ffffff',
|
|
342
|
-
},
|
|
343
|
-
layout: {
|
|
344
|
-
backdropColor: 'rgba(0, 0, 0, 0.8)',
|
|
345
|
-
bannerPosition: 'bottom-center',
|
|
346
|
-
},
|
|
347
|
-
typography: {
|
|
348
|
-
fontFamily: 'Inter, sans-serif',
|
|
349
|
-
}
|
|
350
|
-
}}
|
|
351
|
-
>
|
|
352
|
-
<App />
|
|
353
|
-
</ConsentProvider>
|
|
354
|
-
```
|
|
89
|
+
| Package | Description |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `@react-lgpd-consent/core` | Headless logic (no UI) β build your own UI |
|
|
92
|
+
| `@react-lgpd-consent/mui` | Ready-to-use MUI components |
|
|
93
|
+
| `react-lgpd-consent` | Aggregator (re-exports MUI) β backward compatibility |
|
|
355
94
|
|
|
356
95
|
---
|
|
357
96
|
|
|
358
|
-
##
|
|
359
|
-
|
|
360
|
-
### π Complete Guides (GitHub)
|
|
361
|
-
|
|
362
|
-
- [**π Quickstart**](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/QUICKSTART.en.md): Step-by-step tutorial with TypeScript examples
|
|
363
|
-
- [**ποΈ API Reference**](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/API.md): Complete reference for components, hooks, and types
|
|
364
|
-
- [**βοΈ LGPD Compliance**](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/CONFORMIDADE.md): Details about compliance and auditing
|
|
365
|
-
- [**π Integrations**](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/INTEGRACOES.md): Google Analytics, GTM, Facebook Pixel, Hotjar, etc.
|
|
366
|
-
- [**ποΈ Architecture**](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/ARCHITECTURE.md): Monorepo architecture details for v0.5.0
|
|
367
|
-
- [**π Changelog**](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/CHANGELOG.md): Complete version history
|
|
97
|
+
## Documentation & Examples
|
|
368
98
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
-
|
|
372
|
-
-
|
|
373
|
-
-
|
|
99
|
+
- Quickstart: `QUICKSTART.en.md` (recommended)
|
|
100
|
+
- API Reference: `API.md`
|
|
101
|
+
- Integrations: `INTEGRACOES.md`
|
|
102
|
+
- Storybook: https://lucianoedipo.github.io/react-lgpd-consent/storybook/
|
|
103
|
+
- TypeDoc: https://lucianoedipo.github.io/react-lgpd-consent/docs/
|
|
374
104
|
|
|
375
105
|
---
|
|
376
106
|
|
|
377
|
-
##
|
|
378
|
-
|
|
379
|
-
The library includes ready-to-use integrations for:
|
|
107
|
+
## Contributing
|
|
380
108
|
|
|
381
|
-
|
|
382
|
-
- β
**Google Tag Manager** (GTM)
|
|
383
|
-
- β
**Facebook Pixel**
|
|
384
|
-
- β
**Hotjar**
|
|
385
|
-
- β
**Microsoft Clarity**
|
|
386
|
-
- β
**Mixpanel**
|
|
387
|
-
- β
**Intercom**
|
|
388
|
-
- β
**Zendesk**
|
|
389
|
-
- β
**UserWay** (Accessibility)
|
|
109
|
+
Follow `DEVELOPMENT.md` in the repo. Suggested flow:
|
|
390
110
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
[**See complete integrations guide β**](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/INTEGRACOES.md)
|
|
398
|
-
|
|
399
|
-
---
|
|
111
|
+
1. Fork
|
|
112
|
+
2. Branch: `git checkout -b feat/my-feature`
|
|
113
|
+
3. Commit: `git commit -m "feat: description"`
|
|
114
|
+
4. Push and open a PR
|
|
400
115
|
|
|
401
|
-
|
|
116
|
+
Before opening PR run the local pipeline:
|
|
402
117
|
|
|
118
|
+
```powershell
|
|
119
|
+
npm run type-check
|
|
120
|
+
npm test
|
|
121
|
+
npm run lint
|
|
122
|
+
npm run build
|
|
123
|
+
npm run docs:generate
|
|
403
124
|
```
|
|
404
|
-
react-lgpd-consent (this package - aggregator)
|
|
405
|
-
βββ @react-lgpd-consent/core # Headless (86 KB)
|
|
406
|
-
βββ @react-lgpd-consent/mui # MUI Components (104 KB)
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### When to use each package?
|
|
410
|
-
|
|
411
|
-
| Scenario | Recommended Package |
|
|
412
|
-
|----------|---------------------|
|
|
413
|
-
| **Migration from v0.4.x** | `react-lgpd-consent` (this) |
|
|
414
|
-
| **Complete custom UI** | `@react-lgpd-consent/core` |
|
|
415
|
-
| **Ready MUI components** | `@react-lgpd-consent/mui` |
|
|
416
|
-
| **New project with MUI** | `@react-lgpd-consent/mui` |
|
|
417
|
-
| **Optimized bundle** | `@react-lgpd-consent/core` |
|
|
418
125
|
|
|
419
126
|
---
|
|
420
127
|
|
|
421
|
-
##
|
|
128
|
+
## License
|
|
422
129
|
|
|
423
|
-
|
|
424
|
-
- β
**SSR-Safe**: Compatible with Next.js (App Router + Pages Router), Remix
|
|
425
|
-
- β
**Zero Config**: Works out-of-the-box with sensible defaults
|
|
426
|
-
- β
**Accessible**: WCAG 2.1 AA compliance, keyboard navigation, screen readers
|
|
427
|
-
- β
**Responsive**: Mobile-first design with adaptive breakpoints
|
|
428
|
-
- β
**Tree-shakeable**: Import only what you use
|
|
429
|
-
- β
**Themes**: Light/Dark/Auto with smooth transitions
|
|
430
|
-
- β
**i18n**: Multi-language support (pt-BR, en, es)
|
|
431
|
-
- β
**Auditable**: Developer logs and DataLayer events for GTM
|
|
130
|
+
MIT Β© Luciano Edipo β see the `LICENSE` file.
|
|
432
131
|
|
|
433
132
|
---
|
|
434
133
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
Contributions are welcome! See the [Development Guide](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/DEVELOPMENT.md).
|
|
438
|
-
|
|
439
|
-
1. Fork the repository
|
|
440
|
-
2. Create a branch: `git checkout -b feature/my-feature`
|
|
441
|
-
3. Commit: `git commit -m 'feat: my new feature'`
|
|
442
|
-
4. Push: `git push origin feature/my-feature`
|
|
443
|
-
5. Open a Pull Request
|
|
444
|
-
|
|
445
|
-
---
|
|
446
|
-
|
|
447
|
-
## π License
|
|
448
|
-
|
|
449
|
-
MIT Β© [Luciano Edipo](https://github.com/lucianoedipo)
|
|
450
|
-
|
|
451
|
-
---
|
|
452
|
-
|
|
453
|
-
## π Useful Links
|
|
454
|
-
|
|
455
|
-
- [**GitHub Repository**](https://github.com/lucianoedipo/react-lgpd-consent)
|
|
456
|
-
- [**NPM Package**](https://www.npmjs.com/package/react-lgpd-consent)
|
|
457
|
-
- [**Issues & Bugs**](https://github.com/lucianoedipo/react-lgpd-consent/issues)
|
|
458
|
-
- [**Changelog**](https://github.com/lucianoedipo/react-lgpd-consent/blob/main/CHANGELOG.md)
|
|
459
|
-
|
|
460
|
-
---
|
|
134
|
+
If you want the Portuguese README, see `README.md` in the same package.
|
|
461
135
|
|
|
462
|
-
<div align="center">
|
|
463
|
-
<sub>Made with β€οΈ for the React community</sub>
|
|
464
|
-
</div>
|