react-lgpd-consent 0.2.5 → 0.3.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 +481 -0
- package/COMPLIANCE.md +73 -287
- package/README.md +540 -553
- package/dist/{PreferencesModal-B6N62JYB.js → PreferencesModal-J27W5XAJ.js} +1 -1
- package/dist/chunk-VFAOBR3X.js +1380 -0
- package/dist/index.cjs +1054 -633
- package/dist/index.d.cts +193 -125
- package/dist/index.d.ts +193 -125
- package/dist/index.js +13 -180
- package/package.json +16 -4
- package/dist/chunk-4LLZREFO.js +0 -829
package/dist/index.d.ts
CHANGED
|
@@ -1,44 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { PaperProps } from '@mui/material/Paper';
|
|
3
|
-
import { SnackbarProps } from '@mui/material/Snackbar';
|
|
4
2
|
import { DialogProps } from '@mui/material/Dialog';
|
|
5
|
-
import { FabProps } from '@mui/material/Fab';
|
|
6
3
|
import * as React$1 from 'react';
|
|
7
4
|
import * as _mui_material_styles from '@mui/material/styles';
|
|
8
5
|
|
|
9
|
-
/**
|
|
10
|
-
* Props para o componente CookieBanner.
|
|
11
|
-
*
|
|
12
|
-
* @property policyLinkUrl URL da política de privacidade (opcional).
|
|
13
|
-
* @property debug Força exibição do banner para QA/debug (opcional).
|
|
14
|
-
* @property blocking Se true, bloqueia interação até decisão do usuário (default: true).
|
|
15
|
-
* @property hideBranding Se true, oculta o branding "fornecido por LÉdipO.eti.br" (opcional).
|
|
16
|
-
* @property SnackbarProps Props adicionais para o componente MUI Snackbar (opcional).
|
|
17
|
-
* @property PaperProps Props adicionais para o componente MUI Paper (opcional).
|
|
18
|
-
*/
|
|
19
|
-
interface CookieBannerProps {
|
|
20
|
-
policyLinkUrl?: string;
|
|
21
|
-
debug?: boolean;
|
|
22
|
-
blocking?: boolean;
|
|
23
|
-
hideBranding?: boolean;
|
|
24
|
-
SnackbarProps?: Partial<SnackbarProps>;
|
|
25
|
-
PaperProps?: Partial<PaperProps>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Banner de consentimento de cookies conforme LGPD.
|
|
29
|
-
*
|
|
30
|
-
* Exibe mensagem informativa, botões de ação e link para política de privacidade.
|
|
31
|
-
* Compatível com modo bloqueante (overlay) e não bloqueante (Snackbar).
|
|
32
|
-
*
|
|
33
|
-
* - Textos em pt-BR, customizáveis via contexto.
|
|
34
|
-
* - Acessível e responsivo.
|
|
35
|
-
* - Branding opcional.
|
|
36
|
-
*
|
|
37
|
-
* @param props Propriedades do banner de consentimento.
|
|
38
|
-
*/
|
|
39
|
-
declare function CookieBanner({ policyLinkUrl, debug, blocking, // Por padrão, bloqueia até decisão
|
|
40
|
-
hideBranding, SnackbarProps, PaperProps, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
41
|
-
|
|
42
6
|
/**
|
|
43
7
|
* Props para o componente PreferencesModal.
|
|
44
8
|
*
|
|
@@ -60,45 +24,6 @@ interface PreferencesModalProps {
|
|
|
60
24
|
*/
|
|
61
25
|
declare function PreferencesModal({ DialogProps, hideBranding, }: Readonly<PreferencesModalProps>): react_jsx_runtime.JSX.Element;
|
|
62
26
|
|
|
63
|
-
/**
|
|
64
|
-
* Props para o componente FloatingPreferencesButton.
|
|
65
|
-
*
|
|
66
|
-
* Permite configurar posição, ícone, tooltip, e comportamento de exibição do botão flutuante
|
|
67
|
-
* para abrir o modal de preferências de cookies LGPD.
|
|
68
|
-
*
|
|
69
|
-
* Todos os campos são opcionais e possuem valores padrão.
|
|
70
|
-
*/
|
|
71
|
-
interface FloatingPreferencesButtonProps {
|
|
72
|
-
/** Posição do botão flutuante. Padrão: 'bottom-right' */
|
|
73
|
-
position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
|
|
74
|
-
/** Offset da borda em pixels. Padrão: 24 */
|
|
75
|
-
offset?: number;
|
|
76
|
-
/** Ícone customizado. Padrão: CookieOutlined */
|
|
77
|
-
icon?: React.ReactNode;
|
|
78
|
-
/** Tooltip customizado exibido ao passar o mouse */
|
|
79
|
-
tooltip?: string;
|
|
80
|
-
/** Props adicionais para o Fab do MUI */
|
|
81
|
-
FabProps?: Partial<FabProps>;
|
|
82
|
-
/** Se deve esconder quando consentimento já foi dado. Padrão: false */
|
|
83
|
-
hideWhenConsented?: boolean;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Botão flutuante para abrir o modal de preferências de cookies.
|
|
87
|
-
*
|
|
88
|
-
* Permite ao usuário acessar rapidamente as configurações de consentimento LGPD.
|
|
89
|
-
* Pode ser posicionado em qualquer canto da tela e customizado via props.
|
|
90
|
-
*
|
|
91
|
-
* @param position Posição do botão na tela. Padrão: 'bottom-right'.
|
|
92
|
-
* @param offset Distância da borda em pixels. Padrão: 24.
|
|
93
|
-
* @param icon Ícone customizado para o botão. Padrão: CookieOutlined.
|
|
94
|
-
* @param tooltip Texto do tooltip exibido ao passar o mouse. Padrão: 'Gerenciar Preferências de Cookies'.
|
|
95
|
-
* @param FabProps Props adicionais para o componente Fab do MUI.
|
|
96
|
-
* @param hideWhenConsented Se verdadeiro, esconde o botão após consentimento. Padrão: false.
|
|
97
|
-
*
|
|
98
|
-
* @returns JSX.Element | null
|
|
99
|
-
*/
|
|
100
|
-
declare function FloatingPreferencesButton({ position, offset, icon, tooltip, FabProps, hideWhenConsented, }: Readonly<FloatingPreferencesButtonProps>): react_jsx_runtime.JSX.Element | null;
|
|
101
|
-
|
|
102
27
|
/**
|
|
103
28
|
* Integrações nativas com scripts de terceiros.
|
|
104
29
|
* Facilita o carregamento automático baseado em consentimento.
|
|
@@ -137,14 +62,24 @@ interface UserWayConfig {
|
|
|
137
62
|
}
|
|
138
63
|
/**
|
|
139
64
|
* Cria integração para Google Analytics 4.
|
|
65
|
+
*
|
|
66
|
+
* @param config Configuração do Google Analytics, contendo o `measurementId`.
|
|
67
|
+
* @returns Um objeto de integração de script para ser usado com `ConsentScriptLoader`.
|
|
140
68
|
*/
|
|
141
69
|
declare function createGoogleAnalyticsIntegration(config: GoogleAnalyticsConfig): ScriptIntegration;
|
|
142
70
|
/**
|
|
143
71
|
* Cria integração para Google Tag Manager.
|
|
72
|
+
*
|
|
73
|
+
* @param config Configuração do GTM, contendo o `containerId`.
|
|
74
|
+
* @returns Um objeto de integração de script.
|
|
144
75
|
*/
|
|
145
76
|
declare function createGoogleTagManagerIntegration(config: GoogleTagManagerConfig): ScriptIntegration;
|
|
146
77
|
/**
|
|
147
|
-
* Cria integração para UserWay (acessibilidade).
|
|
78
|
+
* Cria integração para UserWay (widget de acessibilidade).
|
|
79
|
+
* A categoria padrão foi alterada para 'functional', por ser mais apropriada.
|
|
80
|
+
*
|
|
81
|
+
* @param config Configuração do UserWay, contendo o `accountId`.
|
|
82
|
+
* @returns Um objeto de integração de script.
|
|
148
83
|
*/
|
|
149
84
|
declare function createUserWayIntegration(config: UserWayConfig): ScriptIntegration;
|
|
150
85
|
/**
|
|
@@ -157,14 +92,16 @@ declare const COMMON_INTEGRATIONS: {
|
|
|
157
92
|
};
|
|
158
93
|
|
|
159
94
|
/**
|
|
160
|
-
*
|
|
95
|
+
* Tipos de categorias padrão de consentimento para cookies, conforme definido pela ANPD.
|
|
161
96
|
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* -
|
|
165
|
-
* -
|
|
166
|
-
* -
|
|
167
|
-
* -
|
|
97
|
+
* @remarks
|
|
98
|
+
* Use este tipo para identificar as categorias principais de cookies suportadas nativamente pela biblioteca.
|
|
99
|
+
* - `'necessary'`: Cookies essenciais para funcionamento do site (sempre ativos).
|
|
100
|
+
* - `'analytics'`: Cookies para análise e estatísticas de uso.
|
|
101
|
+
* - `'functional'`: Cookies para funcionalidades extras e preferências do usuário.
|
|
102
|
+
* - `'marketing'`: Cookies para publicidade e marketing direcionado.
|
|
103
|
+
* - `'social'`: Cookies para integração com redes sociais.
|
|
104
|
+
* - `'personalization'`: Cookies para personalização de conteúdo e experiência.
|
|
168
105
|
*/
|
|
169
106
|
type Category = 'necessary' | 'analytics' | 'functional' | 'marketing' | 'social' | 'personalization';
|
|
170
107
|
/**
|
|
@@ -190,8 +127,6 @@ interface CategoryDefinition {
|
|
|
190
127
|
interface ProjectCategoriesConfig {
|
|
191
128
|
/** Categorias padrão que serão ativadas (necessary sempre incluída automaticamente) */
|
|
192
129
|
enabledCategories?: Category[];
|
|
193
|
-
/** Categorias customizadas específicas do projeto */
|
|
194
|
-
customCategories?: CategoryDefinition[];
|
|
195
130
|
}
|
|
196
131
|
/**
|
|
197
132
|
* Preferências de consentimento do usuário.
|
|
@@ -218,6 +153,8 @@ interface ConsentCookieData {
|
|
|
218
153
|
lastUpdate: string;
|
|
219
154
|
/** Origem da decisão de consentimento */
|
|
220
155
|
source: 'banner' | 'modal' | 'programmatic';
|
|
156
|
+
/** Snapshot da configuração de categorias usada para este consentimento */
|
|
157
|
+
projectConfig?: ProjectCategoriesConfig;
|
|
221
158
|
}
|
|
222
159
|
/**
|
|
223
160
|
* Estado interno completo do consentimento (memória + UI).
|
|
@@ -259,6 +196,13 @@ interface ConsentTexts {
|
|
|
259
196
|
modalIntro: string;
|
|
260
197
|
save: string;
|
|
261
198
|
necessaryAlwaysOn: string;
|
|
199
|
+
preferencesButton?: string;
|
|
200
|
+
preferencesTitle?: string;
|
|
201
|
+
preferencesDescription?: string;
|
|
202
|
+
close?: string;
|
|
203
|
+
accept?: string;
|
|
204
|
+
reject?: string;
|
|
205
|
+
brandingPoweredBy?: string;
|
|
262
206
|
controllerInfo?: string;
|
|
263
207
|
dataTypes?: string;
|
|
264
208
|
thirdPartySharing?: string;
|
|
@@ -283,6 +227,47 @@ interface ConsentCookieOptions {
|
|
|
283
227
|
/** Caminho do cookie. Padrão: '/' */
|
|
284
228
|
path: string;
|
|
285
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Tokens de design para customização visual avançada dos componentes.
|
|
232
|
+
* Permite um controle mais direto sobre a aparência sem a necessidade de `sx` props complexas.
|
|
233
|
+
*/
|
|
234
|
+
interface DesignTokens {
|
|
235
|
+
colors?: {
|
|
236
|
+
background?: string;
|
|
237
|
+
text?: string;
|
|
238
|
+
primary?: string;
|
|
239
|
+
secondary?: string;
|
|
240
|
+
};
|
|
241
|
+
typography?: {
|
|
242
|
+
fontFamily?: string;
|
|
243
|
+
fontSize?: {
|
|
244
|
+
banner?: string;
|
|
245
|
+
modal?: string;
|
|
246
|
+
};
|
|
247
|
+
fontWeight?: {
|
|
248
|
+
normal?: number;
|
|
249
|
+
bold?: number;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
spacing?: {
|
|
253
|
+
padding?: {
|
|
254
|
+
banner?: string | number;
|
|
255
|
+
modal?: string | number;
|
|
256
|
+
};
|
|
257
|
+
borderRadius?: {
|
|
258
|
+
banner?: string | number;
|
|
259
|
+
modal?: string | number;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
layout?: {
|
|
263
|
+
position?: 'bottom' | 'top' | 'floating';
|
|
264
|
+
width?: {
|
|
265
|
+
mobile?: string;
|
|
266
|
+
desktop?: string;
|
|
267
|
+
};
|
|
268
|
+
backdrop?: boolean;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
286
271
|
/**
|
|
287
272
|
* Propriedades do componente ConsentProvider - configuração principal da biblioteca.
|
|
288
273
|
*
|
|
@@ -300,12 +285,6 @@ interface ConsentCookieOptions {
|
|
|
300
285
|
* <ConsentProvider
|
|
301
286
|
* categories={{
|
|
302
287
|
* 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
288
|
* }}
|
|
310
289
|
* texts={{
|
|
311
290
|
* bannerMessage: 'Utilizamos cookies conforme LGPD...',
|
|
@@ -333,24 +312,16 @@ interface ConsentProviderProps {
|
|
|
333
312
|
initialState?: ConsentState;
|
|
334
313
|
/**
|
|
335
314
|
* Configuração das categorias de cookies utilizadas no projeto.
|
|
336
|
-
* Define quais categorias padrão serão habilitadas
|
|
315
|
+
* Define quais categorias padrão serão habilitadas.
|
|
337
316
|
*
|
|
338
317
|
* @example Apenas analytics:
|
|
339
318
|
* ```tsx
|
|
340
319
|
* categories={{ enabledCategories: ['analytics'] }}
|
|
341
320
|
* ```
|
|
342
321
|
*
|
|
343
|
-
* @example Com categoria
|
|
322
|
+
* @example Com categoria padrão apenas:
|
|
344
323
|
* ```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
|
-
* }}
|
|
324
|
+
* categories={{ enabledCategories: ['analytics', 'marketing'] }}
|
|
354
325
|
* ```
|
|
355
326
|
*/
|
|
356
327
|
categories?: ProjectCategoriesConfig;
|
|
@@ -391,10 +362,19 @@ interface ConsentProviderProps {
|
|
|
391
362
|
*/
|
|
392
363
|
theme?: any;
|
|
393
364
|
/**
|
|
394
|
-
*
|
|
395
|
-
*
|
|
365
|
+
* Tokens de design para customização visual avançada.
|
|
366
|
+
* Oferece controle direto sobre cores, fontes, espaçamento e layout.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```tsx
|
|
370
|
+
* designTokens={{
|
|
371
|
+
* colors: { background: '#000', text: '#fff' },
|
|
372
|
+
* typography: { fontFamily: ''Inter', sans-serif' },
|
|
373
|
+
* spacing: { borderRadius: { banner: 0 } }
|
|
374
|
+
* }}
|
|
375
|
+
* ```
|
|
396
376
|
*/
|
|
397
|
-
|
|
377
|
+
designTokens?: DesignTokens;
|
|
398
378
|
/**
|
|
399
379
|
* Integrações nativas de scripts terceiros (Google Analytics, etc.).
|
|
400
380
|
* Scripts são carregados automaticamente baseado no consentimento.
|
|
@@ -411,16 +391,32 @@ interface ConsentProviderProps {
|
|
|
411
391
|
scriptIntegrations?: ScriptIntegration[];
|
|
412
392
|
/**
|
|
413
393
|
* Componente customizado para substituir o modal padrão de preferências.
|
|
414
|
-
* Deve implementar a lógica de consentimento usando
|
|
394
|
+
* Deve implementar a lógica de consentimento usando as props definidas em `CustomPreferencesModalProps`.
|
|
415
395
|
*/
|
|
416
|
-
PreferencesModalComponent?: React.ComponentType<
|
|
396
|
+
PreferencesModalComponent?: React.ComponentType<CustomPreferencesModalProps>;
|
|
417
397
|
/** Props adicionais passadas para o modal customizado. */
|
|
418
398
|
preferencesModalProps?: Record<string, any>;
|
|
419
399
|
/**
|
|
420
|
-
*
|
|
421
|
-
*
|
|
400
|
+
* Componente customizado para substituir o banner padrão de cookies.
|
|
401
|
+
* Se não fornecido, o `CookieBanner` padrão será renderizado.
|
|
402
|
+
* Deve implementar a lógica de consentimento usando as props definidas em `CustomCookieBannerProps`.
|
|
422
403
|
*/
|
|
423
|
-
|
|
404
|
+
CookieBannerComponent?: React.ComponentType<CustomCookieBannerProps>;
|
|
405
|
+
/** Props adicionais passadas para o banner customizado. */
|
|
406
|
+
cookieBannerProps?: Record<string, any>;
|
|
407
|
+
/**
|
|
408
|
+
* Componente customizado para substituir o botão flutuante de preferências.
|
|
409
|
+
* Se não fornecido, o `FloatingPreferencesButton` padrão será renderizado.
|
|
410
|
+
* Deve implementar a lógica de consentimento usando as props definidas em `CustomFloatingPreferencesButtonProps`.
|
|
411
|
+
*/
|
|
412
|
+
FloatingPreferencesButtonComponent?: React.ComponentType<CustomFloatingPreferencesButtonProps>;
|
|
413
|
+
/** Props adicionais passadas para o botão flutuante customizado. */
|
|
414
|
+
floatingPreferencesButtonProps?: Record<string, any>;
|
|
415
|
+
/**
|
|
416
|
+
* Desabilita o botão flutuante de preferências.
|
|
417
|
+
* Útil quando o usuário da lib quer ter controle total sobre o acesso às preferências.
|
|
418
|
+
*/
|
|
419
|
+
disableFloatingPreferencesButton?: boolean;
|
|
424
420
|
/**
|
|
425
421
|
* Comportamento do banner de consentimento:
|
|
426
422
|
* - `false` (padrão): Banner não-intrusivo, usuário pode navegar livremente
|
|
@@ -478,6 +474,44 @@ interface ConsentProviderProps {
|
|
|
478
474
|
/** Elementos filhos - toda a aplicação que precisa de contexto de consentimento. */
|
|
479
475
|
children: React.ReactNode;
|
|
480
476
|
}
|
|
477
|
+
/**
|
|
478
|
+
* Props esperadas por um componente customizado de CookieBanner.
|
|
479
|
+
* Fornece acesso ao estado de consentimento e ações necessárias para o banner.
|
|
480
|
+
*/
|
|
481
|
+
interface CustomCookieBannerProps {
|
|
482
|
+
consented: boolean;
|
|
483
|
+
acceptAll: () => void;
|
|
484
|
+
rejectAll: () => void;
|
|
485
|
+
openPreferences: () => void;
|
|
486
|
+
texts: ConsentTexts;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Props esperadas por um componente customizado de PreferencesModal.
|
|
490
|
+
*
|
|
491
|
+
* Fornece acesso às preferências atuais do usuário, funções para atualizar e salvar preferências,
|
|
492
|
+
* fechar o modal e textos customizados da interface.
|
|
493
|
+
*
|
|
494
|
+
* @property preferences Preferências atuais de consentimento do usuário.
|
|
495
|
+
* @property setPreferences Função para atualizar e salvar as preferências.
|
|
496
|
+
* @property closePreferences Função para fechar o modal de preferências.
|
|
497
|
+
* @property isModalOpen Indica se o modal está aberto (opcional).
|
|
498
|
+
* @property texts Textos customizados da interface de consentimento.
|
|
499
|
+
*/
|
|
500
|
+
interface CustomPreferencesModalProps {
|
|
501
|
+
preferences: ConsentPreferences;
|
|
502
|
+
setPreferences: (preferences: ConsentPreferences) => void;
|
|
503
|
+
closePreferences: () => void;
|
|
504
|
+
isModalOpen?: boolean;
|
|
505
|
+
texts: ConsentTexts;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Props esperadas por um componente customizado de FloatingPreferencesButton.
|
|
509
|
+
* Fornece acesso às ações de abertura do modal e ao estado de consentimento.
|
|
510
|
+
*/
|
|
511
|
+
interface CustomFloatingPreferencesButtonProps {
|
|
512
|
+
openPreferences: () => void;
|
|
513
|
+
consented: boolean;
|
|
514
|
+
}
|
|
481
515
|
/**
|
|
482
516
|
* Valor do contexto de consentimento, incluindo estado e métodos de manipulação.
|
|
483
517
|
*/
|
|
@@ -519,11 +553,9 @@ interface ConsentContextValue {
|
|
|
519
553
|
* <App />
|
|
520
554
|
* </ConsentProvider>
|
|
521
555
|
*/
|
|
522
|
-
declare function ConsentProvider({ initialState, categories, //
|
|
523
|
-
texts: textsProp, theme,
|
|
524
|
-
|
|
525
|
-
PreferencesModalComponent, preferencesModalProps, disableAutomaticModal, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, // NOVO: desabilita avisos de dev
|
|
526
|
-
children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
556
|
+
declare function ConsentProvider({ initialState, categories, // Nova prop para configuração de categorias
|
|
557
|
+
texts: textsProp, theme, designTokens, scriptIntegrations, // eslint-disable-line no-unused-vars
|
|
558
|
+
PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
527
559
|
|
|
528
560
|
/**
|
|
529
561
|
* Hook principal para acessar e manipular o estado de consentimento de cookies.
|
|
@@ -557,6 +589,27 @@ declare function useConsentTexts(): ConsentTexts;
|
|
|
557
589
|
* Útil para evitar flash do banner antes de verificar cookies existentes.
|
|
558
590
|
*/
|
|
559
591
|
declare function useConsentHydration(): boolean;
|
|
592
|
+
/**
|
|
593
|
+
* Hook para abrir o modal de preferências programaticamente.
|
|
594
|
+
* Útil quando você tem controle customizado sobre como o modal é aberto.
|
|
595
|
+
*
|
|
596
|
+
* @returns Função para abrir o modal de preferências.
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```tsx
|
|
600
|
+
* function CustomAccessibilityDock() {
|
|
601
|
+
* const openPreferencesModal = useOpenPreferencesModal()
|
|
602
|
+
*
|
|
603
|
+
* return (
|
|
604
|
+
* <button onClick={openPreferencesModal}>
|
|
605
|
+
* ⚙️ Configurar Cookies
|
|
606
|
+
* </button>
|
|
607
|
+
* )
|
|
608
|
+
* }
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
declare function useOpenPreferencesModal(): () => void;
|
|
612
|
+
declare function openPreferencesModal(): void;
|
|
560
613
|
|
|
561
614
|
/**
|
|
562
615
|
* Sistema de orientações para developers sobre configuração de categorias.
|
|
@@ -601,8 +654,6 @@ interface CategoriesContextValue {
|
|
|
601
654
|
toggleableCategories: DeveloperGuidance['activeCategoriesInfo'];
|
|
602
655
|
/** Todas as categorias ativas */
|
|
603
656
|
allCategories: DeveloperGuidance['activeCategoriesInfo'];
|
|
604
|
-
/** LEGACY: Apenas categorias customizadas (backward compatibility) */
|
|
605
|
-
legacyCategories: CategoryDefinition[];
|
|
606
657
|
}
|
|
607
658
|
/**
|
|
608
659
|
* Hook para acessar informações sobre categorias ativas.
|
|
@@ -619,13 +670,6 @@ declare function useCategoryStatus(categoryId: string): {
|
|
|
619
670
|
name: string | undefined;
|
|
620
671
|
description: string | undefined;
|
|
621
672
|
};
|
|
622
|
-
/**
|
|
623
|
-
* LEGACY: Hook para acessar as categorias customizadas.
|
|
624
|
-
* Mantido para backward compatibility.
|
|
625
|
-
*
|
|
626
|
-
* @deprecated Use useCategories() ao invés disso para acesso completo às categorias.
|
|
627
|
-
*/
|
|
628
|
-
declare function useCustomCategories(): CategoryDefinition[];
|
|
629
673
|
|
|
630
674
|
declare function ConsentGate(props: Readonly<{
|
|
631
675
|
category: string;
|
|
@@ -702,4 +746,28 @@ declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly
|
|
|
702
746
|
*/
|
|
703
747
|
declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
|
|
704
748
|
|
|
705
|
-
|
|
749
|
+
/**
|
|
750
|
+
* Sistema de logging interno da biblioteca para facilitar debug e troubleshooting.
|
|
751
|
+
* Os logs são desabilitados automaticamente em production builds.
|
|
752
|
+
*/
|
|
753
|
+
declare enum LogLevel {
|
|
754
|
+
ERROR = 0,
|
|
755
|
+
WARN = 1,
|
|
756
|
+
INFO = 2,
|
|
757
|
+
DEBUG = 3
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Função para habilitar/desabilitar logs de debug externamente.
|
|
761
|
+
* Útil para troubleshooting em produção quando necessário.
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* ```typescript
|
|
765
|
+
* import { setDebugLogging } from 'react-lgpd-consent'
|
|
766
|
+
*
|
|
767
|
+
* // Habilitar logs detalhados
|
|
768
|
+
* setDebugLogging(true, LogLevel.DEBUG)
|
|
769
|
+
* ```
|
|
770
|
+
*/
|
|
771
|
+
declare function setDebugLogging(enabled: boolean, level?: LogLevel): void;
|
|
772
|
+
|
|
773
|
+
export { COMMON_INTEGRATIONS, type Category, type CategoryDefinition, type ConsentCookieOptions, ConsentGate, type ConsentPreferences, ConsentProvider, type ConsentProviderProps, ConsentScriptLoader, type ConsentState, type ConsentTexts, type CustomCookieBannerProps, type CustomFloatingPreferencesButtonProps, type CustomPreferencesModalProps, DEFAULT_PROJECT_CATEGORIES, type DeveloperGuidance, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, LogLevel, PreferencesModal, type ProjectCategoriesConfig, type ScriptIntegration, type UserWayConfig, analyzeDeveloperConfiguration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createUserWayIntegration, defaultConsentTheme, loadScript, openPreferencesModal, setDebugLogging, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useOpenPreferencesModal };
|