react-lgpd-consent 0.1.13 → 0.2.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/README.md +641 -0
- package/dist/{PreferencesModal-2V2W3262.js → PreferencesModal-4WHKT67T.js} +1 -1
- package/dist/{chunk-XIHO7M77.js → chunk-QCERRRSC.js} +253 -87
- package/dist/index.cjs +442 -116
- package/dist/index.d.cts +195 -14
- package/dist/index.d.ts +195 -14
- package/dist/index.js +150 -3
- package/package.json +105 -100
package/dist/index.d.cts
CHANGED
|
@@ -100,24 +100,131 @@ interface FloatingPreferencesButtonProps {
|
|
|
100
100
|
declare function FloatingPreferencesButton({ position, offset, icon, tooltip, FabProps, hideWhenConsented, }: Readonly<FloatingPreferencesButtonProps>): react_jsx_runtime.JSX.Element | null;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
103
|
+
* Integrações nativas com scripts de terceiros.
|
|
104
|
+
* Facilita o carregamento automático baseado em consentimento.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
interface ScriptIntegration {
|
|
107
|
+
/** ID único da integração */
|
|
108
|
+
id: string;
|
|
109
|
+
/** Categoria de consentimento necessária */
|
|
110
|
+
category: string;
|
|
111
|
+
/** URL do script */
|
|
112
|
+
src: string;
|
|
113
|
+
/** Função de inicialização após carregamento */
|
|
114
|
+
init?: () => void;
|
|
115
|
+
/** Atributos adicionais do script */
|
|
116
|
+
attrs?: Record<string, string>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Configuração para Google Analytics 4.
|
|
120
|
+
*/
|
|
121
|
+
interface GoogleAnalyticsConfig {
|
|
122
|
+
measurementId: string;
|
|
123
|
+
config?: any;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Configuração para Google Tag Manager.
|
|
127
|
+
*/
|
|
128
|
+
interface GoogleTagManagerConfig {
|
|
129
|
+
containerId: string;
|
|
130
|
+
dataLayerName?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Configuração para UserWay (acessibilidade).
|
|
134
|
+
*/
|
|
135
|
+
interface UserWayConfig {
|
|
136
|
+
accountId: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Cria integração para Google Analytics 4.
|
|
140
|
+
*/
|
|
141
|
+
declare function createGoogleAnalyticsIntegration(config: GoogleAnalyticsConfig): ScriptIntegration;
|
|
142
|
+
/**
|
|
143
|
+
* Cria integração para Google Tag Manager.
|
|
144
|
+
*/
|
|
145
|
+
declare function createGoogleTagManagerIntegration(config: GoogleTagManagerConfig): ScriptIntegration;
|
|
107
146
|
/**
|
|
108
|
-
*
|
|
147
|
+
* Cria integração para UserWay (acessibilidade).
|
|
148
|
+
*/
|
|
149
|
+
declare function createUserWayIntegration(config: UserWayConfig): ScriptIntegration;
|
|
150
|
+
/**
|
|
151
|
+
* Integrações pré-configuradas mais comuns.
|
|
152
|
+
*/
|
|
153
|
+
declare const COMMON_INTEGRATIONS: {
|
|
154
|
+
googleAnalytics: typeof createGoogleAnalyticsIntegration;
|
|
155
|
+
googleTagManager: typeof createGoogleTagManagerIntegration;
|
|
156
|
+
userway: typeof createUserWayIntegration;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Categorias padrão de consentimento para cookies baseadas no Guia da ANPD.
|
|
161
|
+
*
|
|
162
|
+
* - necessary: Cookies essenciais (sempre ativos)
|
|
163
|
+
* - analytics: Análise e estatísticas
|
|
164
|
+
* - functional: Funcionalidades extras
|
|
165
|
+
* - marketing: Publicidade e marketing
|
|
166
|
+
* - social: Integração com redes sociais
|
|
167
|
+
* - personalization: Personalização de conteúdo
|
|
168
|
+
*/
|
|
169
|
+
type Category = 'necessary' | 'analytics' | 'functional' | 'marketing' | 'social' | 'personalization';
|
|
170
|
+
/**
|
|
171
|
+
* Definição detalhada de uma categoria de cookie.
|
|
172
|
+
*/
|
|
173
|
+
interface CategoryDefinition {
|
|
174
|
+
/** ID único da categoria */
|
|
175
|
+
id: string;
|
|
176
|
+
/** Nome amigável exibido na interface */
|
|
177
|
+
name: string;
|
|
178
|
+
/** Descrição detalhada da categoria */
|
|
179
|
+
description: string;
|
|
180
|
+
/** Se é uma categoria essencial (não pode ser desabilitada) */
|
|
181
|
+
essential?: boolean;
|
|
182
|
+
/** Scripts/cookies específicos desta categoria */
|
|
183
|
+
cookies?: string[];
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Configuração de categorias ativas no projeto.
|
|
187
|
+
* Define quais categorias fixas serão usadas (além de necessary)
|
|
188
|
+
* e quais categorias customizadas serão adicionadas.
|
|
189
|
+
*/
|
|
190
|
+
interface ProjectCategoriesConfig {
|
|
191
|
+
/** Categorias padrão que serão ativadas (necessary sempre incluída automaticamente) */
|
|
192
|
+
enabledCategories?: Category[];
|
|
193
|
+
/** Categorias customizadas específicas do projeto */
|
|
194
|
+
customCategories?: CategoryDefinition[];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Preferências de consentimento do usuário.
|
|
198
|
+
* Contém apenas as categorias realmente utilizadas no projeto.
|
|
109
199
|
*/
|
|
110
200
|
interface ConsentPreferences {
|
|
111
|
-
|
|
112
|
-
|
|
201
|
+
necessary: boolean;
|
|
202
|
+
[key: string]: boolean;
|
|
113
203
|
}
|
|
114
204
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
205
|
+
* Dados do cookie de consentimento em conformidade com LGPD/ANPD.
|
|
206
|
+
* Contém apenas informações essenciais para compliance e funcionamento.
|
|
117
207
|
*/
|
|
118
|
-
interface
|
|
208
|
+
interface ConsentCookieData {
|
|
209
|
+
/** Versão do esquema do cookie para migração futura */
|
|
210
|
+
version: string;
|
|
211
|
+
/** Se o usuário já prestou consentimento */
|
|
119
212
|
consented: boolean;
|
|
213
|
+
/** Preferências por categoria (apenas categorias ativas) */
|
|
120
214
|
preferences: ConsentPreferences;
|
|
215
|
+
/** Timestamp ISO da primeira interação com o banner */
|
|
216
|
+
consentDate: string;
|
|
217
|
+
/** Timestamp ISO da última modificação das preferências */
|
|
218
|
+
lastUpdate: string;
|
|
219
|
+
/** Origem da decisão de consentimento */
|
|
220
|
+
source: 'banner' | 'modal' | 'programmatic';
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Estado interno completo do consentimento (memória + UI).
|
|
224
|
+
* Inclui dados persistidos + estado da interface.
|
|
225
|
+
*/
|
|
226
|
+
interface ConsentState extends ConsentCookieData {
|
|
227
|
+
/** Se o modal de preferências está aberto (NÃO persistido) */
|
|
121
228
|
isModalOpen?: boolean;
|
|
122
229
|
}
|
|
123
230
|
/**
|
|
@@ -152,6 +259,14 @@ interface ConsentTexts {
|
|
|
152
259
|
modalIntro: string;
|
|
153
260
|
save: string;
|
|
154
261
|
necessaryAlwaysOn: string;
|
|
262
|
+
controllerInfo?: string;
|
|
263
|
+
dataTypes?: string;
|
|
264
|
+
thirdPartySharing?: string;
|
|
265
|
+
userRights?: string;
|
|
266
|
+
contactInfo?: string;
|
|
267
|
+
retentionPeriod?: string;
|
|
268
|
+
lawfulBasis?: string;
|
|
269
|
+
transferCountries?: string;
|
|
155
270
|
}
|
|
156
271
|
/**
|
|
157
272
|
* Opções para configuração do cookie de consentimento.
|
|
@@ -172,18 +287,29 @@ interface ConsentCookieOptions {
|
|
|
172
287
|
* Propriedades aceitas pelo componente ConsentProvider.
|
|
173
288
|
*/
|
|
174
289
|
interface ConsentProviderProps {
|
|
175
|
-
/** Estado inicial do consentimento. */
|
|
290
|
+
/** Estado inicial do consentimento (para SSR). */
|
|
176
291
|
initialState?: ConsentState;
|
|
292
|
+
/** Configuração de categorias ativas no projeto. */
|
|
293
|
+
categories?: ProjectCategoriesConfig;
|
|
177
294
|
/** Textos customizados para a interface. */
|
|
178
295
|
texts?: Partial<ConsentTexts>;
|
|
179
|
-
/** Tema customizado para os componentes MUI. */
|
|
296
|
+
/** Tema customizado para os componentes MUI. Aceita qualquer propriedade. */
|
|
180
297
|
theme?: any;
|
|
298
|
+
/**
|
|
299
|
+
* @deprecated Use `categories.customCategories` em vez disso.
|
|
300
|
+
* Categorias customizadas de cookies (complementa as padrão).
|
|
301
|
+
*/
|
|
302
|
+
customCategories?: CategoryDefinition[];
|
|
303
|
+
/** Integrações nativas de scripts (Google Analytics, etc.). */
|
|
304
|
+
scriptIntegrations?: ScriptIntegration[];
|
|
181
305
|
/** Componente customizado para modal de preferências. */
|
|
182
306
|
PreferencesModalComponent?: React.ComponentType<any>;
|
|
183
307
|
/** Props adicionais para o modal customizado. */
|
|
184
308
|
preferencesModalProps?: Record<string, any>;
|
|
185
309
|
/** Desabilita o modal automático (para usar componente totalmente customizado). */
|
|
186
310
|
disableAutomaticModal?: boolean;
|
|
311
|
+
/** Comportamento do banner: true = bloqueia até decisão, false = não bloqueia */
|
|
312
|
+
blocking?: boolean;
|
|
187
313
|
/** Esconde branding "fornecido por LÉdipO.eti.br". */
|
|
188
314
|
hideBranding?: boolean;
|
|
189
315
|
/** Callback chamado quando o consentimento é dado. */
|
|
@@ -236,7 +362,7 @@ interface ConsentContextValue {
|
|
|
236
362
|
* <App />
|
|
237
363
|
* </ConsentProvider>
|
|
238
364
|
*/
|
|
239
|
-
declare function ConsentProvider({ initialState, texts: textsProp, theme, PreferencesModalComponent, preferencesModalProps, disableAutomaticModal, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
365
|
+
declare function ConsentProvider({ initialState, texts: textsProp, theme, customCategories, scriptIntegrations, PreferencesModalComponent, preferencesModalProps, disableAutomaticModal, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
240
366
|
|
|
241
367
|
/**
|
|
242
368
|
* Hook principal para acessar e manipular o estado de consentimento de cookies.
|
|
@@ -271,8 +397,18 @@ declare function useConsentTexts(): ConsentTexts;
|
|
|
271
397
|
*/
|
|
272
398
|
declare function useConsentHydration(): boolean;
|
|
273
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Hook para acessar as categorias customizadas.
|
|
402
|
+
* Retorna apenas as categorias customizadas (não as padrão analytics/marketing).
|
|
403
|
+
*/
|
|
404
|
+
declare function useCustomCategories(): CategoryDefinition[];
|
|
405
|
+
/**
|
|
406
|
+
* Hook para obter todas as categorias (padrão + customizadas).
|
|
407
|
+
*/
|
|
408
|
+
declare function useAllCategories(): CategoryDefinition[];
|
|
409
|
+
|
|
274
410
|
declare function ConsentGate(props: Readonly<{
|
|
275
|
-
category:
|
|
411
|
+
category: string;
|
|
276
412
|
children: React$1.ReactNode;
|
|
277
413
|
}>): react_jsx_runtime.JSX.Element | null;
|
|
278
414
|
|
|
@@ -301,4 +437,49 @@ declare function loadScript(id: string, src: string, category?: 'analytics' | 'm
|
|
|
301
437
|
*/
|
|
302
438
|
declare const defaultConsentTheme: _mui_material_styles.Theme;
|
|
303
439
|
|
|
304
|
-
|
|
440
|
+
/**
|
|
441
|
+
* Componente que carrega scripts automaticamente baseado no consentimento.
|
|
442
|
+
* Facilita integração com ferramentas como Google Analytics, Tag Manager, etc.
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
interface ConsentScriptLoaderProps {
|
|
446
|
+
/** Lista de integrações de scripts para carregar baseado no consentimento */
|
|
447
|
+
integrations: ScriptIntegration[];
|
|
448
|
+
/** Se true, força recarregamento se consentimento mudar */
|
|
449
|
+
reloadOnChange?: boolean;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Componente para carregamento automático de scripts baseado no consentimento.
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```tsx
|
|
456
|
+
* const integrations = [
|
|
457
|
+
* createGoogleAnalyticsIntegration({ measurementId: 'GA_ID' }),
|
|
458
|
+
* createUserWayIntegration({ accountId: 'USERWAY_ID' })
|
|
459
|
+
* ]
|
|
460
|
+
*
|
|
461
|
+
* <ConsentScriptLoader integrations={integrations} />
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly<ConsentScriptLoaderProps>): null;
|
|
465
|
+
/**
|
|
466
|
+
* Hook para carregamento manual de scripts baseado no consentimento.
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```tsx
|
|
470
|
+
* function MyComponent() {
|
|
471
|
+
* const loadConsentScript = useConsentScriptLoader()
|
|
472
|
+
*
|
|
473
|
+
* React.useEffect(() => {
|
|
474
|
+
* loadConsentScript({
|
|
475
|
+
* id: 'my-script',
|
|
476
|
+
* category: 'analytics',
|
|
477
|
+
* src: 'https://example.com/script.js'
|
|
478
|
+
* })
|
|
479
|
+
* }, [])
|
|
480
|
+
* }
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
|
|
484
|
+
|
|
485
|
+
export { COMMON_INTEGRATIONS, type Category, type CategoryDefinition, type ConsentCookieOptions, ConsentGate, type ConsentPreferences, ConsentProvider, ConsentScriptLoader, type ConsentState, type ConsentTexts, CookieBanner, FloatingPreferencesButton, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, PreferencesModal, type ScriptIntegration, type UserWayConfig, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createUserWayIntegration, defaultConsentTheme, loadScript, useAllCategories, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useCustomCategories };
|
package/dist/index.d.ts
CHANGED
|
@@ -100,24 +100,131 @@ interface FloatingPreferencesButtonProps {
|
|
|
100
100
|
declare function FloatingPreferencesButton({ position, offset, icon, tooltip, FabProps, hideWhenConsented, }: Readonly<FloatingPreferencesButtonProps>): react_jsx_runtime.JSX.Element | null;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
103
|
+
* Integrações nativas com scripts de terceiros.
|
|
104
|
+
* Facilita o carregamento automático baseado em consentimento.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
interface ScriptIntegration {
|
|
107
|
+
/** ID único da integração */
|
|
108
|
+
id: string;
|
|
109
|
+
/** Categoria de consentimento necessária */
|
|
110
|
+
category: string;
|
|
111
|
+
/** URL do script */
|
|
112
|
+
src: string;
|
|
113
|
+
/** Função de inicialização após carregamento */
|
|
114
|
+
init?: () => void;
|
|
115
|
+
/** Atributos adicionais do script */
|
|
116
|
+
attrs?: Record<string, string>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Configuração para Google Analytics 4.
|
|
120
|
+
*/
|
|
121
|
+
interface GoogleAnalyticsConfig {
|
|
122
|
+
measurementId: string;
|
|
123
|
+
config?: any;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Configuração para Google Tag Manager.
|
|
127
|
+
*/
|
|
128
|
+
interface GoogleTagManagerConfig {
|
|
129
|
+
containerId: string;
|
|
130
|
+
dataLayerName?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Configuração para UserWay (acessibilidade).
|
|
134
|
+
*/
|
|
135
|
+
interface UserWayConfig {
|
|
136
|
+
accountId: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Cria integração para Google Analytics 4.
|
|
140
|
+
*/
|
|
141
|
+
declare function createGoogleAnalyticsIntegration(config: GoogleAnalyticsConfig): ScriptIntegration;
|
|
142
|
+
/**
|
|
143
|
+
* Cria integração para Google Tag Manager.
|
|
144
|
+
*/
|
|
145
|
+
declare function createGoogleTagManagerIntegration(config: GoogleTagManagerConfig): ScriptIntegration;
|
|
107
146
|
/**
|
|
108
|
-
*
|
|
147
|
+
* Cria integração para UserWay (acessibilidade).
|
|
148
|
+
*/
|
|
149
|
+
declare function createUserWayIntegration(config: UserWayConfig): ScriptIntegration;
|
|
150
|
+
/**
|
|
151
|
+
* Integrações pré-configuradas mais comuns.
|
|
152
|
+
*/
|
|
153
|
+
declare const COMMON_INTEGRATIONS: {
|
|
154
|
+
googleAnalytics: typeof createGoogleAnalyticsIntegration;
|
|
155
|
+
googleTagManager: typeof createGoogleTagManagerIntegration;
|
|
156
|
+
userway: typeof createUserWayIntegration;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Categorias padrão de consentimento para cookies baseadas no Guia da ANPD.
|
|
161
|
+
*
|
|
162
|
+
* - necessary: Cookies essenciais (sempre ativos)
|
|
163
|
+
* - analytics: Análise e estatísticas
|
|
164
|
+
* - functional: Funcionalidades extras
|
|
165
|
+
* - marketing: Publicidade e marketing
|
|
166
|
+
* - social: Integração com redes sociais
|
|
167
|
+
* - personalization: Personalização de conteúdo
|
|
168
|
+
*/
|
|
169
|
+
type Category = 'necessary' | 'analytics' | 'functional' | 'marketing' | 'social' | 'personalization';
|
|
170
|
+
/**
|
|
171
|
+
* Definição detalhada de uma categoria de cookie.
|
|
172
|
+
*/
|
|
173
|
+
interface CategoryDefinition {
|
|
174
|
+
/** ID único da categoria */
|
|
175
|
+
id: string;
|
|
176
|
+
/** Nome amigável exibido na interface */
|
|
177
|
+
name: string;
|
|
178
|
+
/** Descrição detalhada da categoria */
|
|
179
|
+
description: string;
|
|
180
|
+
/** Se é uma categoria essencial (não pode ser desabilitada) */
|
|
181
|
+
essential?: boolean;
|
|
182
|
+
/** Scripts/cookies específicos desta categoria */
|
|
183
|
+
cookies?: string[];
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Configuração de categorias ativas no projeto.
|
|
187
|
+
* Define quais categorias fixas serão usadas (além de necessary)
|
|
188
|
+
* e quais categorias customizadas serão adicionadas.
|
|
189
|
+
*/
|
|
190
|
+
interface ProjectCategoriesConfig {
|
|
191
|
+
/** Categorias padrão que serão ativadas (necessary sempre incluída automaticamente) */
|
|
192
|
+
enabledCategories?: Category[];
|
|
193
|
+
/** Categorias customizadas específicas do projeto */
|
|
194
|
+
customCategories?: CategoryDefinition[];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Preferências de consentimento do usuário.
|
|
198
|
+
* Contém apenas as categorias realmente utilizadas no projeto.
|
|
109
199
|
*/
|
|
110
200
|
interface ConsentPreferences {
|
|
111
|
-
|
|
112
|
-
|
|
201
|
+
necessary: boolean;
|
|
202
|
+
[key: string]: boolean;
|
|
113
203
|
}
|
|
114
204
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
205
|
+
* Dados do cookie de consentimento em conformidade com LGPD/ANPD.
|
|
206
|
+
* Contém apenas informações essenciais para compliance e funcionamento.
|
|
117
207
|
*/
|
|
118
|
-
interface
|
|
208
|
+
interface ConsentCookieData {
|
|
209
|
+
/** Versão do esquema do cookie para migração futura */
|
|
210
|
+
version: string;
|
|
211
|
+
/** Se o usuário já prestou consentimento */
|
|
119
212
|
consented: boolean;
|
|
213
|
+
/** Preferências por categoria (apenas categorias ativas) */
|
|
120
214
|
preferences: ConsentPreferences;
|
|
215
|
+
/** Timestamp ISO da primeira interação com o banner */
|
|
216
|
+
consentDate: string;
|
|
217
|
+
/** Timestamp ISO da última modificação das preferências */
|
|
218
|
+
lastUpdate: string;
|
|
219
|
+
/** Origem da decisão de consentimento */
|
|
220
|
+
source: 'banner' | 'modal' | 'programmatic';
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Estado interno completo do consentimento (memória + UI).
|
|
224
|
+
* Inclui dados persistidos + estado da interface.
|
|
225
|
+
*/
|
|
226
|
+
interface ConsentState extends ConsentCookieData {
|
|
227
|
+
/** Se o modal de preferências está aberto (NÃO persistido) */
|
|
121
228
|
isModalOpen?: boolean;
|
|
122
229
|
}
|
|
123
230
|
/**
|
|
@@ -152,6 +259,14 @@ interface ConsentTexts {
|
|
|
152
259
|
modalIntro: string;
|
|
153
260
|
save: string;
|
|
154
261
|
necessaryAlwaysOn: string;
|
|
262
|
+
controllerInfo?: string;
|
|
263
|
+
dataTypes?: string;
|
|
264
|
+
thirdPartySharing?: string;
|
|
265
|
+
userRights?: string;
|
|
266
|
+
contactInfo?: string;
|
|
267
|
+
retentionPeriod?: string;
|
|
268
|
+
lawfulBasis?: string;
|
|
269
|
+
transferCountries?: string;
|
|
155
270
|
}
|
|
156
271
|
/**
|
|
157
272
|
* Opções para configuração do cookie de consentimento.
|
|
@@ -172,18 +287,29 @@ interface ConsentCookieOptions {
|
|
|
172
287
|
* Propriedades aceitas pelo componente ConsentProvider.
|
|
173
288
|
*/
|
|
174
289
|
interface ConsentProviderProps {
|
|
175
|
-
/** Estado inicial do consentimento. */
|
|
290
|
+
/** Estado inicial do consentimento (para SSR). */
|
|
176
291
|
initialState?: ConsentState;
|
|
292
|
+
/** Configuração de categorias ativas no projeto. */
|
|
293
|
+
categories?: ProjectCategoriesConfig;
|
|
177
294
|
/** Textos customizados para a interface. */
|
|
178
295
|
texts?: Partial<ConsentTexts>;
|
|
179
|
-
/** Tema customizado para os componentes MUI. */
|
|
296
|
+
/** Tema customizado para os componentes MUI. Aceita qualquer propriedade. */
|
|
180
297
|
theme?: any;
|
|
298
|
+
/**
|
|
299
|
+
* @deprecated Use `categories.customCategories` em vez disso.
|
|
300
|
+
* Categorias customizadas de cookies (complementa as padrão).
|
|
301
|
+
*/
|
|
302
|
+
customCategories?: CategoryDefinition[];
|
|
303
|
+
/** Integrações nativas de scripts (Google Analytics, etc.). */
|
|
304
|
+
scriptIntegrations?: ScriptIntegration[];
|
|
181
305
|
/** Componente customizado para modal de preferências. */
|
|
182
306
|
PreferencesModalComponent?: React.ComponentType<any>;
|
|
183
307
|
/** Props adicionais para o modal customizado. */
|
|
184
308
|
preferencesModalProps?: Record<string, any>;
|
|
185
309
|
/** Desabilita o modal automático (para usar componente totalmente customizado). */
|
|
186
310
|
disableAutomaticModal?: boolean;
|
|
311
|
+
/** Comportamento do banner: true = bloqueia até decisão, false = não bloqueia */
|
|
312
|
+
blocking?: boolean;
|
|
187
313
|
/** Esconde branding "fornecido por LÉdipO.eti.br". */
|
|
188
314
|
hideBranding?: boolean;
|
|
189
315
|
/** Callback chamado quando o consentimento é dado. */
|
|
@@ -236,7 +362,7 @@ interface ConsentContextValue {
|
|
|
236
362
|
* <App />
|
|
237
363
|
* </ConsentProvider>
|
|
238
364
|
*/
|
|
239
|
-
declare function ConsentProvider({ initialState, texts: textsProp, theme, PreferencesModalComponent, preferencesModalProps, disableAutomaticModal, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
365
|
+
declare function ConsentProvider({ initialState, texts: textsProp, theme, customCategories, scriptIntegrations, PreferencesModalComponent, preferencesModalProps, disableAutomaticModal, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
240
366
|
|
|
241
367
|
/**
|
|
242
368
|
* Hook principal para acessar e manipular o estado de consentimento de cookies.
|
|
@@ -271,8 +397,18 @@ declare function useConsentTexts(): ConsentTexts;
|
|
|
271
397
|
*/
|
|
272
398
|
declare function useConsentHydration(): boolean;
|
|
273
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Hook para acessar as categorias customizadas.
|
|
402
|
+
* Retorna apenas as categorias customizadas (não as padrão analytics/marketing).
|
|
403
|
+
*/
|
|
404
|
+
declare function useCustomCategories(): CategoryDefinition[];
|
|
405
|
+
/**
|
|
406
|
+
* Hook para obter todas as categorias (padrão + customizadas).
|
|
407
|
+
*/
|
|
408
|
+
declare function useAllCategories(): CategoryDefinition[];
|
|
409
|
+
|
|
274
410
|
declare function ConsentGate(props: Readonly<{
|
|
275
|
-
category:
|
|
411
|
+
category: string;
|
|
276
412
|
children: React$1.ReactNode;
|
|
277
413
|
}>): react_jsx_runtime.JSX.Element | null;
|
|
278
414
|
|
|
@@ -301,4 +437,49 @@ declare function loadScript(id: string, src: string, category?: 'analytics' | 'm
|
|
|
301
437
|
*/
|
|
302
438
|
declare const defaultConsentTheme: _mui_material_styles.Theme;
|
|
303
439
|
|
|
304
|
-
|
|
440
|
+
/**
|
|
441
|
+
* Componente que carrega scripts automaticamente baseado no consentimento.
|
|
442
|
+
* Facilita integração com ferramentas como Google Analytics, Tag Manager, etc.
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
interface ConsentScriptLoaderProps {
|
|
446
|
+
/** Lista de integrações de scripts para carregar baseado no consentimento */
|
|
447
|
+
integrations: ScriptIntegration[];
|
|
448
|
+
/** Se true, força recarregamento se consentimento mudar */
|
|
449
|
+
reloadOnChange?: boolean;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Componente para carregamento automático de scripts baseado no consentimento.
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```tsx
|
|
456
|
+
* const integrations = [
|
|
457
|
+
* createGoogleAnalyticsIntegration({ measurementId: 'GA_ID' }),
|
|
458
|
+
* createUserWayIntegration({ accountId: 'USERWAY_ID' })
|
|
459
|
+
* ]
|
|
460
|
+
*
|
|
461
|
+
* <ConsentScriptLoader integrations={integrations} />
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly<ConsentScriptLoaderProps>): null;
|
|
465
|
+
/**
|
|
466
|
+
* Hook para carregamento manual de scripts baseado no consentimento.
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```tsx
|
|
470
|
+
* function MyComponent() {
|
|
471
|
+
* const loadConsentScript = useConsentScriptLoader()
|
|
472
|
+
*
|
|
473
|
+
* React.useEffect(() => {
|
|
474
|
+
* loadConsentScript({
|
|
475
|
+
* id: 'my-script',
|
|
476
|
+
* category: 'analytics',
|
|
477
|
+
* src: 'https://example.com/script.js'
|
|
478
|
+
* })
|
|
479
|
+
* }, [])
|
|
480
|
+
* }
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
|
|
484
|
+
|
|
485
|
+
export { COMMON_INTEGRATIONS, type Category, type CategoryDefinition, type ConsentCookieOptions, ConsentGate, type ConsentPreferences, ConsentProvider, ConsentScriptLoader, type ConsentState, type ConsentTexts, CookieBanner, FloatingPreferencesButton, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, PreferencesModal, type ScriptIntegration, type UserWayConfig, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createUserWayIntegration, defaultConsentTheme, loadScript, useAllCategories, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useCustomCategories };
|