react-lgpd-consent 0.2.2 → 0.2.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/README.md +752 -739
- package/dist/{PreferencesModal-UL552BFP.js → PreferencesModal-SOVV24DU.js} +1 -1
- package/dist/{chunk-JAX63PBG.js → chunk-UKKWGQN7.js} +62 -26
- package/dist/index.cjs +63 -26
- package/dist/index.d.cts +177 -18
- package/dist/index.d.ts +177 -18
- package/dist/index.js +2 -2
- package/package.json +109 -105
|
@@ -112,34 +112,66 @@ function analyzeDeveloperConfiguration(config) {
|
|
|
112
112
|
}
|
|
113
113
|
return guidance;
|
|
114
114
|
}
|
|
115
|
-
function logDeveloperGuidance(guidance) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
function logDeveloperGuidance(guidance, disableGuidanceProp) {
|
|
116
|
+
try {
|
|
117
|
+
const isProduction = (
|
|
118
|
+
// 1. NODE_ENV de bundlers (Vite, webpack, etc.)
|
|
119
|
+
typeof globalThis.process !== "undefined" && globalThis.process.env?.NODE_ENV === "production" || // 2. Vite/bundler env vars (apenas em ESM)
|
|
120
|
+
typeof globalThis !== "undefined" && typeof globalThis.import !== "undefined" && globalThis.import.meta?.env?.PROD === true || // 3. Flag customizada para desabilitar logs
|
|
121
|
+
typeof globalThis !== "undefined" && globalThis.__LGPD_PRODUCTION__ || // 4. Flag de desenvolvimento desabilitada via window global (legado)
|
|
122
|
+
typeof window !== "undefined" && window.__LGPD_DISABLE_GUIDANCE__ || // 5. Flag de desenvolvimento desabilitada via prop do ConsentProvider (preferencial)
|
|
123
|
+
disableGuidanceProp
|
|
124
|
+
);
|
|
125
|
+
if (isProduction) return;
|
|
126
|
+
const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
|
|
127
|
+
if (guidance.warnings.length > 0) {
|
|
128
|
+
console.group(`${PREFIX} \u26A0\uFE0F Avisos de Configura\xE7\xE3o`);
|
|
129
|
+
guidance.warnings.forEach(
|
|
130
|
+
(warning) => console.warn(`${PREFIX} ${warning}`)
|
|
131
|
+
);
|
|
132
|
+
console.groupEnd();
|
|
133
|
+
}
|
|
134
|
+
if (guidance.suggestions.length > 0) {
|
|
135
|
+
console.group(`${PREFIX} \u{1F4A1} Sugest\xF5es`);
|
|
136
|
+
guidance.suggestions.forEach(
|
|
137
|
+
(suggestion) => console.info(`${PREFIX} ${suggestion}`)
|
|
138
|
+
);
|
|
139
|
+
console.groupEnd();
|
|
140
|
+
}
|
|
141
|
+
if (guidance.usingDefaults) {
|
|
142
|
+
console.info(
|
|
143
|
+
`${PREFIX} \u{1F4CB} Usando configura\xE7\xE3o padr\xE3o. Para personalizar, use a prop "categories" no ConsentProvider.`
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
console.group(`${PREFIX} \u{1F527} Categorias Ativas (para UI customizada)`);
|
|
147
|
+
console.table(
|
|
148
|
+
guidance.activeCategoriesInfo.map((cat) => ({
|
|
149
|
+
ID: cat.id,
|
|
150
|
+
Nome: cat.name,
|
|
151
|
+
"Toggle UI?": cat.uiRequired ? "\u2705 SIM" : "\u274C N\xC3O (sempre ativo)",
|
|
152
|
+
"Essencial?": cat.essential ? "\u{1F512} SIM" : "\u2699\uFE0F N\xC3O"
|
|
153
|
+
}))
|
|
154
|
+
);
|
|
129
155
|
console.info(
|
|
130
|
-
|
|
156
|
+
`${PREFIX} \u2139\uFE0F Use estes dados para criar componentes customizados adequados.`
|
|
131
157
|
);
|
|
158
|
+
console.groupEnd();
|
|
159
|
+
} catch (error) {
|
|
160
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
161
|
+
console.warn(
|
|
162
|
+
"[\u{1F36A} LGPD-CONSENT] Sistema de orienta\xE7\xF5es encontrou erro:",
|
|
163
|
+
error
|
|
164
|
+
);
|
|
165
|
+
}
|
|
132
166
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
);
|
|
142
|
-
console.groupEnd();
|
|
167
|
+
}
|
|
168
|
+
function useDeveloperGuidance(config, disableGuidanceProp) {
|
|
169
|
+
const guidance = analyzeDeveloperConfiguration(config);
|
|
170
|
+
const stringifiedConfig = React.useMemo(() => JSON.stringify(config), [config]);
|
|
171
|
+
React.useEffect(() => {
|
|
172
|
+
logDeveloperGuidance(guidance, disableGuidanceProp);
|
|
173
|
+
}, [guidance, stringifiedConfig, disableGuidanceProp]);
|
|
174
|
+
return guidance;
|
|
143
175
|
}
|
|
144
176
|
|
|
145
177
|
// src/context/CategoriesContext.tsx
|
|
@@ -359,7 +391,7 @@ var defaultConsentTheme = createTheme({
|
|
|
359
391
|
// src/context/ConsentContext.tsx
|
|
360
392
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
361
393
|
var PreferencesModal = React3.lazy(
|
|
362
|
-
() => import("./PreferencesModal-
|
|
394
|
+
() => import("./PreferencesModal-SOVV24DU.js").then((m) => ({
|
|
363
395
|
default: m.PreferencesModal
|
|
364
396
|
}))
|
|
365
397
|
);
|
|
@@ -492,6 +524,7 @@ function ConsentProvider({
|
|
|
492
524
|
customCategories,
|
|
493
525
|
// LEGACY: compatibilidade
|
|
494
526
|
scriptIntegrations,
|
|
527
|
+
// eslint-disable-line no-unused-vars
|
|
495
528
|
PreferencesModalComponent,
|
|
496
529
|
preferencesModalProps = {},
|
|
497
530
|
disableAutomaticModal = false,
|
|
@@ -499,6 +532,8 @@ function ConsentProvider({
|
|
|
499
532
|
onConsentGiven,
|
|
500
533
|
onPreferencesSaved,
|
|
501
534
|
cookie: cookieOpts,
|
|
535
|
+
disableDeveloperGuidance,
|
|
536
|
+
// NOVO: desabilita avisos de dev
|
|
502
537
|
children
|
|
503
538
|
}) {
|
|
504
539
|
const texts = React3.useMemo(
|
|
@@ -524,6 +559,7 @@ function ConsentProvider({
|
|
|
524
559
|
}
|
|
525
560
|
return void 0;
|
|
526
561
|
}, [categories, customCategories]);
|
|
562
|
+
useDeveloperGuidance(finalCategoriesConfig, disableDeveloperGuidance);
|
|
527
563
|
const boot = React3.useMemo(() => {
|
|
528
564
|
if (initialState) return { ...initialState, isModalOpen: false };
|
|
529
565
|
return createFullConsentState(
|
package/dist/index.cjs
CHANGED
|
@@ -279,34 +279,66 @@ function analyzeDeveloperConfiguration(config) {
|
|
|
279
279
|
}
|
|
280
280
|
return guidance;
|
|
281
281
|
}
|
|
282
|
-
function logDeveloperGuidance(guidance) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
282
|
+
function logDeveloperGuidance(guidance, disableGuidanceProp) {
|
|
283
|
+
try {
|
|
284
|
+
const isProduction = (
|
|
285
|
+
// 1. NODE_ENV de bundlers (Vite, webpack, etc.)
|
|
286
|
+
typeof globalThis.process !== "undefined" && globalThis.process.env?.NODE_ENV === "production" || // 2. Vite/bundler env vars (apenas em ESM)
|
|
287
|
+
typeof globalThis !== "undefined" && typeof globalThis.import !== "undefined" && globalThis.import.meta?.env?.PROD === true || // 3. Flag customizada para desabilitar logs
|
|
288
|
+
typeof globalThis !== "undefined" && globalThis.__LGPD_PRODUCTION__ || // 4. Flag de desenvolvimento desabilitada via window global (legado)
|
|
289
|
+
typeof window !== "undefined" && window.__LGPD_DISABLE_GUIDANCE__ || // 5. Flag de desenvolvimento desabilitada via prop do ConsentProvider (preferencial)
|
|
290
|
+
disableGuidanceProp
|
|
291
|
+
);
|
|
292
|
+
if (isProduction) return;
|
|
293
|
+
const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
|
|
294
|
+
if (guidance.warnings.length > 0) {
|
|
295
|
+
console.group(`${PREFIX} \u26A0\uFE0F Avisos de Configura\xE7\xE3o`);
|
|
296
|
+
guidance.warnings.forEach(
|
|
297
|
+
(warning) => console.warn(`${PREFIX} ${warning}`)
|
|
298
|
+
);
|
|
299
|
+
console.groupEnd();
|
|
300
|
+
}
|
|
301
|
+
if (guidance.suggestions.length > 0) {
|
|
302
|
+
console.group(`${PREFIX} \u{1F4A1} Sugest\xF5es`);
|
|
303
|
+
guidance.suggestions.forEach(
|
|
304
|
+
(suggestion) => console.info(`${PREFIX} ${suggestion}`)
|
|
305
|
+
);
|
|
306
|
+
console.groupEnd();
|
|
307
|
+
}
|
|
308
|
+
if (guidance.usingDefaults) {
|
|
309
|
+
console.info(
|
|
310
|
+
`${PREFIX} \u{1F4CB} Usando configura\xE7\xE3o padr\xE3o. Para personalizar, use a prop "categories" no ConsentProvider.`
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
console.group(`${PREFIX} \u{1F527} Categorias Ativas (para UI customizada)`);
|
|
314
|
+
console.table(
|
|
315
|
+
guidance.activeCategoriesInfo.map((cat) => ({
|
|
316
|
+
ID: cat.id,
|
|
317
|
+
Nome: cat.name,
|
|
318
|
+
"Toggle UI?": cat.uiRequired ? "\u2705 SIM" : "\u274C N\xC3O (sempre ativo)",
|
|
319
|
+
"Essencial?": cat.essential ? "\u{1F512} SIM" : "\u2699\uFE0F N\xC3O"
|
|
320
|
+
}))
|
|
321
|
+
);
|
|
296
322
|
console.info(
|
|
297
|
-
|
|
323
|
+
`${PREFIX} \u2139\uFE0F Use estes dados para criar componentes customizados adequados.`
|
|
298
324
|
);
|
|
325
|
+
console.groupEnd();
|
|
326
|
+
} catch (error) {
|
|
327
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
328
|
+
console.warn(
|
|
329
|
+
"[\u{1F36A} LGPD-CONSENT] Sistema de orienta\xE7\xF5es encontrou erro:",
|
|
330
|
+
error
|
|
331
|
+
);
|
|
332
|
+
}
|
|
299
333
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
);
|
|
309
|
-
console.groupEnd();
|
|
334
|
+
}
|
|
335
|
+
function useDeveloperGuidance(config, disableGuidanceProp) {
|
|
336
|
+
const guidance = analyzeDeveloperConfiguration(config);
|
|
337
|
+
const stringifiedConfig = React.useMemo(() => JSON.stringify(config), [config]);
|
|
338
|
+
React.useEffect(() => {
|
|
339
|
+
logDeveloperGuidance(guidance, disableGuidanceProp);
|
|
340
|
+
}, [guidance, stringifiedConfig, disableGuidanceProp]);
|
|
341
|
+
return guidance;
|
|
310
342
|
}
|
|
311
343
|
var React, DEFAULT_PROJECT_CATEGORIES;
|
|
312
344
|
var init_developerGuidance = __esm({
|
|
@@ -659,6 +691,7 @@ function ConsentProvider({
|
|
|
659
691
|
customCategories,
|
|
660
692
|
// LEGACY: compatibilidade
|
|
661
693
|
scriptIntegrations,
|
|
694
|
+
// eslint-disable-line no-unused-vars
|
|
662
695
|
PreferencesModalComponent,
|
|
663
696
|
preferencesModalProps = {},
|
|
664
697
|
disableAutomaticModal = false,
|
|
@@ -666,6 +699,8 @@ function ConsentProvider({
|
|
|
666
699
|
onConsentGiven,
|
|
667
700
|
onPreferencesSaved,
|
|
668
701
|
cookie: cookieOpts,
|
|
702
|
+
disableDeveloperGuidance,
|
|
703
|
+
// NOVO: desabilita avisos de dev
|
|
669
704
|
children
|
|
670
705
|
}) {
|
|
671
706
|
const texts = React3.useMemo(
|
|
@@ -691,6 +726,7 @@ function ConsentProvider({
|
|
|
691
726
|
}
|
|
692
727
|
return void 0;
|
|
693
728
|
}, [categories, customCategories]);
|
|
729
|
+
useDeveloperGuidance(finalCategoriesConfig, disableDeveloperGuidance);
|
|
694
730
|
const boot = React3.useMemo(() => {
|
|
695
731
|
if (initialState) return { ...initialState, isModalOpen: false };
|
|
696
732
|
return createFullConsentState(
|
|
@@ -793,6 +829,7 @@ var init_ConsentContext = __esm({
|
|
|
793
829
|
init_cookieUtils();
|
|
794
830
|
init_theme();
|
|
795
831
|
init_CategoriesContext();
|
|
832
|
+
init_developerGuidance();
|
|
796
833
|
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
797
834
|
PreferencesModal2 = React3.lazy(
|
|
798
835
|
() => Promise.resolve().then(() => (init_PreferencesModal(), PreferencesModal_exports)).then((m) => ({
|
|
@@ -1208,7 +1245,7 @@ function createGoogleAnalyticsIntegration(config) {
|
|
|
1208
1245
|
init: () => {
|
|
1209
1246
|
if (typeof window !== "undefined") {
|
|
1210
1247
|
let gtag2 = function(...args) {
|
|
1211
|
-
window.dataLayer.push(
|
|
1248
|
+
window.dataLayer.push(...args);
|
|
1212
1249
|
};
|
|
1213
1250
|
var gtag = gtag2;
|
|
1214
1251
|
window.dataLayer = window.dataLayer || [];
|
package/dist/index.d.cts
CHANGED
|
@@ -284,41 +284,198 @@ interface ConsentCookieOptions {
|
|
|
284
284
|
path: string;
|
|
285
285
|
}
|
|
286
286
|
/**
|
|
287
|
-
* Propriedades
|
|
287
|
+
* Propriedades do componente ConsentProvider - configuração principal da biblioteca.
|
|
288
|
+
*
|
|
289
|
+
* @example Uso básico (configuração mínima):
|
|
290
|
+
* ```tsx
|
|
291
|
+
* <ConsentProvider
|
|
292
|
+
* categories={{ enabledCategories: ['analytics'] }}
|
|
293
|
+
* >
|
|
294
|
+
* <App />
|
|
295
|
+
* </ConsentProvider>
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* @example Configuração completa com textos ANPD:
|
|
299
|
+
* ```tsx
|
|
300
|
+
* <ConsentProvider
|
|
301
|
+
* categories={{
|
|
302
|
+
* enabledCategories: ['analytics', 'functional'],
|
|
303
|
+
* customCategories: [{
|
|
304
|
+
* id: 'governo',
|
|
305
|
+
* name: 'Cookies Governamentais',
|
|
306
|
+
* description: 'Coleta para estatísticas públicas',
|
|
307
|
+
* essential: false
|
|
308
|
+
* }]
|
|
309
|
+
* }}
|
|
310
|
+
* texts={{
|
|
311
|
+
* bannerMessage: 'Utilizamos cookies conforme LGPD...',
|
|
312
|
+
* controllerInfo: 'Controlado por: Ministério XYZ - CNPJ: 00.000.000/0001-00',
|
|
313
|
+
* dataTypes: 'Coletamos: dados de navegação para análise estatística',
|
|
314
|
+
* userRights: 'Direitos: acessar, corrigir, excluir dados',
|
|
315
|
+
* contactInfo: 'DPO: dpo@ministerio.gov.br'
|
|
316
|
+
* }}
|
|
317
|
+
* onConsentGiven={(state) => console.log('Consentimento:', state)}
|
|
318
|
+
* >
|
|
319
|
+
* <App />
|
|
320
|
+
* </ConsentProvider>
|
|
321
|
+
* ```
|
|
288
322
|
*/
|
|
289
323
|
interface ConsentProviderProps {
|
|
290
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* Estado inicial do consentimento para hidratação SSR.
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```tsx
|
|
329
|
+
* // Em Next.js para evitar flash do banner
|
|
330
|
+
* <ConsentProvider initialState={{ consented: true, preferences: {...} }}>
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
291
333
|
initialState?: ConsentState;
|
|
292
|
-
/**
|
|
334
|
+
/**
|
|
335
|
+
* Configuração das categorias de cookies utilizadas no projeto.
|
|
336
|
+
* Define quais categorias padrão serão habilitadas e categorias customizadas.
|
|
337
|
+
*
|
|
338
|
+
* @example Apenas analytics:
|
|
339
|
+
* ```tsx
|
|
340
|
+
* categories={{ enabledCategories: ['analytics'] }}
|
|
341
|
+
* ```
|
|
342
|
+
*
|
|
343
|
+
* @example Com categoria customizada:
|
|
344
|
+
* ```tsx
|
|
345
|
+
* categories={{
|
|
346
|
+
* enabledCategories: ['analytics', 'marketing'],
|
|
347
|
+
* customCategories: [{
|
|
348
|
+
* id: 'pesquisa',
|
|
349
|
+
* name: 'Cookies de Pesquisa',
|
|
350
|
+
* description: 'Coleta feedback e opinião dos usuários',
|
|
351
|
+
* essential: false
|
|
352
|
+
* }]
|
|
353
|
+
* }}
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
293
356
|
categories?: ProjectCategoriesConfig;
|
|
294
|
-
/**
|
|
357
|
+
/**
|
|
358
|
+
* Textos customizados da interface (banner e modal).
|
|
359
|
+
* Todos os campos são opcionais - valores não fornecidos usam o padrão em português.
|
|
360
|
+
*
|
|
361
|
+
* @example Textos básicos:
|
|
362
|
+
* ```tsx
|
|
363
|
+
* texts={{
|
|
364
|
+
* bannerMessage: 'We use cookies...',
|
|
365
|
+
* acceptAll: 'Accept All',
|
|
366
|
+
* declineAll: 'Reject'
|
|
367
|
+
* }}
|
|
368
|
+
* ```
|
|
369
|
+
*
|
|
370
|
+
* @example Textos ANPD para compliance:
|
|
371
|
+
* ```tsx
|
|
372
|
+
* texts={{
|
|
373
|
+
* controllerInfo: 'Controlado por: Empresa XYZ - CNPJ: 12.345.678/0001-90',
|
|
374
|
+
* dataTypes: 'Coletamos: endereço IP, preferências de navegação',
|
|
375
|
+
* userRights: 'Você pode solicitar acesso, correção ou exclusão dos dados'
|
|
376
|
+
* }}
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
295
379
|
texts?: Partial<ConsentTexts>;
|
|
296
|
-
/**
|
|
380
|
+
/**
|
|
381
|
+
* Tema customizado Material-UI aplicado aos componentes.
|
|
382
|
+
* Aceita qualquer objeto que será passado para ThemeProvider.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```tsx
|
|
386
|
+
* theme={{
|
|
387
|
+
* palette: { primary: { main: '#1976d2' } },
|
|
388
|
+
* components: { MuiButton: { styleOverrides: { root: { borderRadius: 8 } } } }
|
|
389
|
+
* }}
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
297
392
|
theme?: any;
|
|
298
393
|
/**
|
|
299
|
-
* @deprecated
|
|
300
|
-
*
|
|
394
|
+
* @deprecated Usar `categories.customCategories` em vez disso.
|
|
395
|
+
* Mantido para compatibilidade com v0.1.x
|
|
301
396
|
*/
|
|
302
397
|
customCategories?: CategoryDefinition[];
|
|
303
|
-
/**
|
|
398
|
+
/**
|
|
399
|
+
* Integrações nativas de scripts terceiros (Google Analytics, etc.).
|
|
400
|
+
* Scripts são carregados automaticamente baseado no consentimento.
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```tsx
|
|
404
|
+
* import { createGoogleAnalyticsIntegration } from 'react-lgpd-consent'
|
|
405
|
+
*
|
|
406
|
+
* scriptIntegrations={[
|
|
407
|
+
* createGoogleAnalyticsIntegration('GA_MEASUREMENT_ID')
|
|
408
|
+
* ]}
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
304
411
|
scriptIntegrations?: ScriptIntegration[];
|
|
305
|
-
/**
|
|
412
|
+
/**
|
|
413
|
+
* Componente customizado para substituir o modal padrão de preferências.
|
|
414
|
+
* Deve implementar a lógica de consentimento usando os hooks da biblioteca.
|
|
415
|
+
*/
|
|
306
416
|
PreferencesModalComponent?: React.ComponentType<any>;
|
|
307
|
-
/** Props adicionais para o modal customizado. */
|
|
417
|
+
/** Props adicionais passadas para o modal customizado. */
|
|
308
418
|
preferencesModalProps?: Record<string, any>;
|
|
309
|
-
/**
|
|
419
|
+
/**
|
|
420
|
+
* Desabilita o modal automático de preferências.
|
|
421
|
+
* Útil quando se quer controle total sobre quando/como exibir as opções.
|
|
422
|
+
*/
|
|
310
423
|
disableAutomaticModal?: boolean;
|
|
311
|
-
/**
|
|
424
|
+
/**
|
|
425
|
+
* Comportamento do banner de consentimento:
|
|
426
|
+
* - `false` (padrão): Banner não-intrusivo, usuário pode navegar livremente
|
|
427
|
+
* - `true`: Banner bloqueia interação até decisão (compliance rigorosa)
|
|
428
|
+
*/
|
|
312
429
|
blocking?: boolean;
|
|
313
|
-
/**
|
|
430
|
+
/** Oculta o branding "fornecido por LÉdipO.eti.br" dos componentes. */
|
|
314
431
|
hideBranding?: boolean;
|
|
315
|
-
/**
|
|
432
|
+
/**
|
|
433
|
+
* Callback executado quando usuário dá consentimento pela primeira vez.
|
|
434
|
+
* Útil para inicializar analytics, registrar evento, etc.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```tsx
|
|
438
|
+
* onConsentGiven={(state) => {
|
|
439
|
+
* console.log('Consentimento registrado:', state)
|
|
440
|
+
* // Inicializar Google Analytics, etc.
|
|
441
|
+
* }}
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
316
444
|
onConsentGiven?: (state: ConsentState) => void;
|
|
317
|
-
/**
|
|
445
|
+
/**
|
|
446
|
+
* Callback executado quando usuário modifica preferências.
|
|
447
|
+
* Executado após salvar as mudanças.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```tsx
|
|
451
|
+
* onPreferencesSaved={(prefs) => {
|
|
452
|
+
* console.log('Novas preferências:', prefs)
|
|
453
|
+
* // Reconfigurar scripts baseado nas preferências
|
|
454
|
+
* }}
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
318
457
|
onPreferencesSaved?: (prefs: ConsentPreferences) => void;
|
|
319
|
-
/**
|
|
458
|
+
/**
|
|
459
|
+
* Configurações do cookie de consentimento.
|
|
460
|
+
* Valores não fornecidos usam padrões seguros para LGPD.
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```tsx
|
|
464
|
+
* cookie={{
|
|
465
|
+
* name: 'meuAppConsent',
|
|
466
|
+
* maxAgeDays: 180,
|
|
467
|
+
* sameSite: 'Strict'
|
|
468
|
+
* }}
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
320
471
|
cookie?: Partial<ConsentCookieOptions>;
|
|
321
|
-
/**
|
|
472
|
+
/**
|
|
473
|
+
* Desabilita os avisos e sugestões para desenvolvedores no console.
|
|
474
|
+
* Útil para ambientes de produção ou quando os avisos não são desejados.
|
|
475
|
+
* Por padrão, os avisos já são desabilitados em builds de produção.
|
|
476
|
+
*/
|
|
477
|
+
disableDeveloperGuidance?: boolean;
|
|
478
|
+
/** Elementos filhos - toda a aplicação que precisa de contexto de consentimento. */
|
|
322
479
|
children: React.ReactNode;
|
|
323
480
|
}
|
|
324
481
|
/**
|
|
@@ -364,7 +521,9 @@ interface ConsentContextValue {
|
|
|
364
521
|
*/
|
|
365
522
|
declare function ConsentProvider({ initialState, categories, // NOVO: configuração completa de categorias
|
|
366
523
|
texts: textsProp, theme, customCategories, // LEGACY: compatibilidade
|
|
367
|
-
scriptIntegrations,
|
|
524
|
+
scriptIntegrations, // eslint-disable-line no-unused-vars
|
|
525
|
+
PreferencesModalComponent, preferencesModalProps, disableAutomaticModal, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, // NOVO: desabilita avisos de dev
|
|
526
|
+
children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
368
527
|
|
|
369
528
|
/**
|
|
370
529
|
* Hook principal para acessar e manipular o estado de consentimento de cookies.
|