@react-lgpd-consent/core 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -458,6 +458,44 @@ interface ConsentCookieData {
458
458
  */
459
459
  projectConfig?: ProjectCategoriesConfig;
460
460
  }
461
+ /**
462
+ * Ações possíveis registradas no log de auditoria de consentimento.
463
+ * @category Types
464
+ * @since 0.7.0
465
+ * @public
466
+ */
467
+ type ConsentAuditAction = 'init' | 'update' | 'reset';
468
+ /**
469
+ * Entrada de auditoria contendo os dados essenciais para comprovar consentimento.
470
+ * Inclui timestamps, versão configurada e snapshot das preferências.
471
+ * @category Types
472
+ * @since 0.7.0
473
+ * @public
474
+ */
475
+ interface ConsentAuditEntry {
476
+ /** Ação que originou o registro (inicialização, atualização ou reset). */
477
+ action: ConsentAuditAction;
478
+ /** Chave de armazenamento (cookie/localStorage) aplicada, incluindo namespace/versão. */
479
+ storageKey: string;
480
+ /** Versão lógica de consentimento configurada via `storage.version` (política/termo). */
481
+ consentVersion: string;
482
+ /** Timestamp ISO do registro de auditoria. */
483
+ timestamp: string;
484
+ /** Timestamp ISO da primeira decisão de consentimento. */
485
+ consentDate: string;
486
+ /** Timestamp ISO da última alteração de preferências. */
487
+ lastUpdate: string;
488
+ /** Estado atual de consentimento agregado. */
489
+ consented: boolean;
490
+ /** Preferências por categoria no momento do registro. */
491
+ preferences: ConsentPreferences;
492
+ /** Versão do schema do cookie. */
493
+ version: string;
494
+ /** Origem da decisão (banner, modal, reset, programmatic). */
495
+ source: ConsentEventOrigin;
496
+ /** Snapshot da configuração de categorias utilizada. */
497
+ projectConfig?: ProjectCategoriesConfig;
498
+ }
461
499
  /**
462
500
  * Estado interno completo do sistema de consentimento.
463
501
  * @category Types
@@ -1312,6 +1350,26 @@ interface ConsentProviderProps {
1312
1350
  * ```
1313
1351
  */
1314
1352
  onConsentGiven?: (state: ConsentState) => void;
1353
+ /** Callback disparado após hidratação inicial (consentimento existente ou não). */
1354
+ onConsentInit?: (state: ConsentState) => void;
1355
+ /** Callback disparado sempre que o consentimento muda (banner, modal ou programático/reset). */
1356
+ onConsentChange?: (state: ConsentState, context: {
1357
+ origin: ConsentState['source'] | 'reset';
1358
+ }) => void;
1359
+ /**
1360
+ * Callback de auditoria executado sempre que o consentimento é registrado, atualizado ou resetado.
1361
+ * Útil para persistir logs externos (ex.: backend, data lake) com carimbo de tempo e versão do termo.
1362
+ * @since 0.7.0
1363
+ *
1364
+ * @example
1365
+ * ```tsx
1366
+ * <ConsentProvider
1367
+ * storage={{ namespace: 'portal.gov', version: '2025-Q4' }}
1368
+ * onAuditLog={(audit) => api.auditConsent(audit)}
1369
+ * />
1370
+ * ```
1371
+ */
1372
+ onAuditLog?: (entry: ConsentAuditEntry) => void;
1315
1373
  /**
1316
1374
  * Callback executado quando usuário modifica preferências.
1317
1375
  * Executado após salvar as mudanças.
@@ -1412,6 +1470,8 @@ interface CustomCookieBannerProps {
1412
1470
  rejectAll: () => void;
1413
1471
  openPreferences: () => void;
1414
1472
  texts: ConsentTexts;
1473
+ /** Indica se o branding padrão deve ser ocultado. */
1474
+ hideBranding?: boolean;
1415
1475
  /**
1416
1476
  * Indica se o modo bloqueante está ativo no contexto.
1417
1477
  * Esta prop é apenas informativa para banners customizados ajustarem sua UI.
@@ -1656,7 +1716,7 @@ type ConsentEvent = ConsentInitializedEvent | ConsentUpdatedEvent;
1656
1716
  * </ConsentProvider>
1657
1717
  * ```
1658
1718
  */
1659
- declare function ConsentProvider({ initialState, categories, texts: textsProp, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding: _hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, storage, onConsentVersionChange, disableDeveloperGuidance, guidanceConfig, children, disableDiscoveryLog, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
1719
+ declare function ConsentProvider({ initialState, categories, texts: textsProp, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding: _hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, storage, onConsentVersionChange, disableDeveloperGuidance, guidanceConfig, children, disableDiscoveryLog, onConsentInit, onConsentChange, onAuditLog, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
1660
1720
  declare const defaultTexts: ConsentTexts;
1661
1721
 
1662
1722
  /**
@@ -2342,6 +2402,23 @@ declare function buildConsentStorageKey(options?: {
2342
2402
  namespace?: string | null;
2343
2403
  version?: string | null;
2344
2404
  }): string;
2405
+ /**
2406
+ * Cria um registro de auditoria com carimbo de tempo, versão e snapshot das preferências.
2407
+ * @category Utils
2408
+ * @since 0.7.0
2409
+ *
2410
+ * @param state Estado atual de consentimento.
2411
+ * @param params.storageKey Chave de armazenamento (cookie/localStorage) aplicada.
2412
+ * @param params.action Ação que disparou o registro.
2413
+ * @param params.consentVersion Versão lógica do consentimento (ex.: bump de política/termo).
2414
+ * @param params.origin Origem explícita da decisão (opcional).
2415
+ */
2416
+ declare function createConsentAuditEntry(state: ConsentState, params: {
2417
+ storageKey: string;
2418
+ action: ConsentAuditAction;
2419
+ consentVersion?: string | null;
2420
+ origin?: ConsentEventOrigin;
2421
+ }): ConsentAuditEntry;
2345
2422
 
2346
2423
  /** @module src/utils/scriptLoader */
2347
2424
  /**
@@ -2370,6 +2447,7 @@ declare function buildConsentStorageKey(options?: {
2370
2447
  * @param {string} src A URL do script externo a ser carregado.
2371
2448
  * @param {string | null} [category=null] A categoria de consentimento exigida para o script. Suporta tanto categorias predefinidas quanto customizadas. Se o consentimento para esta categoria não for dado, o script não será carregado.
2372
2449
  * @param {Record<string, string>} [attrs={}] Atributos adicionais a serem aplicados ao elemento `<script>` (ex: `{ async: 'true' }`).
2450
+ * @param {string | undefined} [nonce] Nonce CSP opcional aplicado ao script.
2373
2451
  * @returns {Promise<void>} Uma Promise que resolve quando o script é carregado com sucesso, ou rejeita se o consentimento não for dado ou ocorrer um erro de carregamento.
2374
2452
  * @example
2375
2453
  * ```ts
@@ -2379,7 +2457,7 @@ declare function buildConsentStorageKey(options?: {
2379
2457
  * .catch(error => console.error('Erro ao carregar script:', error))
2380
2458
  * ```
2381
2459
  */
2382
- declare function loadScript(id: string, src: string, category?: string | null, attrs?: Record<string, string>): Promise<void>;
2460
+ declare function loadScript(id: string, src: string, category?: string | null, attrs?: Record<string, string>, nonce?: string): Promise<void>;
2383
2461
 
2384
2462
  /**
2385
2463
  * Utilitários para descoberta e categorização de cookies em tempo de execução (experimental).
@@ -2481,6 +2559,8 @@ interface ScriptIntegration {
2481
2559
  init?: () => void;
2482
2560
  /** Atributos HTML adicionais para a tag script */
2483
2561
  attrs?: Record<string, string>;
2562
+ /** Nonce CSP opcional aplicado à tag script */
2563
+ nonce?: string;
2484
2564
  /** Lista de cookies que o script pode definir */
2485
2565
  cookies?: string[];
2486
2566
  /** Informações detalhadas dos cookies (nome, finalidade, duração, fornecedor) */
@@ -3129,6 +3209,8 @@ interface ConsentScriptLoaderProps {
3129
3209
  integrations: ScriptIntegration[];
3130
3210
  /** Se true, força recarregamento se consentimento mudar */
3131
3211
  reloadOnChange?: boolean;
3212
+ /** Nonce CSP aplicado às tags <script> geradas automaticamente (sobrescrevível por integração). */
3213
+ nonce?: string;
3132
3214
  }
3133
3215
  /**
3134
3216
  * @component
@@ -3151,7 +3233,7 @@ interface ConsentScriptLoaderProps {
3151
3233
  * <ConsentScriptLoader integrations={integrations} />
3152
3234
  * ```
3153
3235
  */
3154
- declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly<ConsentScriptLoaderProps>): null;
3236
+ declare function ConsentScriptLoader({ integrations, reloadOnChange, nonce, }: Readonly<ConsentScriptLoaderProps>): null;
3155
3237
  /**
3156
3238
  * @hook
3157
3239
  * @category Hooks
@@ -3179,7 +3261,7 @@ declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly
3179
3261
  * }, [loadScript]);
3180
3262
  * ```
3181
3263
  */
3182
- declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
3264
+ declare function useConsentScriptLoader(): (integration: ScriptIntegration, nonce?: string) => Promise<boolean>;
3183
3265
 
3184
3266
  /**
3185
3267
  * @file autoConfigureCategories.ts
@@ -3287,6 +3369,37 @@ declare function extractCategoriesFromIntegrations(integrations: ScriptIntegrati
3287
3369
  */
3288
3370
  declare function validateNecessaryClassification(integrations: ScriptIntegration[], enabledCategories: Category[]): string[];
3289
3371
 
3372
+ /**
3373
+ * Presets de categorias conforme usos típicos da LGPD/ANPD.
3374
+ *
3375
+ * @category Utils
3376
+ * @since 0.6.4
3377
+ */
3378
+ declare const ANPD_CATEGORY_PRESETS: Record<Category, CategoryDefinition>;
3379
+ type AnpdPresetCategory = keyof typeof ANPD_CATEGORY_PRESETS;
3380
+ interface CreateAnpdCategoriesOptions {
3381
+ /**
3382
+ * Lista de categorias que devem ser habilitadas (além de necessary que é sempre inclusa).
3383
+ * @default ['analytics', 'functional', 'marketing']
3384
+ */
3385
+ include?: AnpdPresetCategory[];
3386
+ /**
3387
+ * Overrides de descrições por categoria.
3388
+ */
3389
+ descriptions?: Partial<Record<AnpdPresetCategory, string>>;
3390
+ /**
3391
+ * Overrides de nomes por categoria.
3392
+ */
3393
+ names?: Partial<Record<AnpdPresetCategory, string>>;
3394
+ }
3395
+ /**
3396
+ * Gera um `ProjectCategoriesConfig` com presets LGPD/ANPD tipados.
3397
+ *
3398
+ * @category Utils
3399
+ * @since 0.6.4
3400
+ */
3401
+ declare function createAnpdCategoriesConfig(options?: CreateAnpdCategoriesOptions): ProjectCategoriesConfig;
3402
+
3290
3403
  /**
3291
3404
  * @fileoverview
3292
3405
  * Sistema de textos expandido com suporte avançado a internacionalização,
@@ -4032,4 +4145,4 @@ declare function useDataLayerEvents(): {
4032
4145
  pushUpdated: typeof pushConsentUpdatedEvent;
4033
4146
  };
4034
4147
 
4035
- export { type AdvancedConsentTexts, COMMON_INTEGRATIONS, type CategoriesContextValue, type Category, type CategoryAutoConfigResult, type CategoryDefinition, type ClarityConfig, type ConsentContextValue, type ConsentCookieData, type ConsentCookieOptions, type ConsentEvent, type ConsentEventOrigin, ConsentGate, type ConsentInitializedEvent, type ConsentPreferences, ConsentProvider, type ConsentProviderProps, ConsentScriptLoader, type ConsentScriptLoaderProps, type ConsentState, type ConsentStorageConfig, type ConsentTexts, type ConsentUpdatedEvent, type ConsentVersionChangeContext, type CookieDescriptor, type CorporateConfig, type CustomCookieBannerProps, type CustomFloatingPreferencesButtonProps, type CustomPreferencesModalProps, DEFAULT_PROJECT_CATEGORIES, DesignProvider, type DesignTokens, type DeveloperGuidance, type ECommerceConfig, EXPANDED_DEFAULT_TEXTS, type FacebookPixelConfig, GUIDANCE_PRESETS, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, type GuidanceConfig, type GuidanceMessage, type GuidanceSeverity, type HotjarConfig, INTEGRATION_TEMPLATES, type IntercomConfig, LogLevel, type MixpanelConfig, type PeerDepsCheckResult, type ProjectCategoriesConfig, type SaaSConfig, type ScriptIntegration, TEXT_TEMPLATES, type UserWayConfig, type ZendeskConfig, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, buildConsentStorageKey, categorizeDiscoveredCookies, checkPeerDeps, createClarityIntegration, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, ensureNecessaryAlwaysOn, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, loadScript, logDeveloperGuidance, logger, openPreferencesModal, pushConsentInitializedEvent, pushConsentUpdatedEvent, resolveTexts, runPeerDepsCheck, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDataLayerEvents, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };
4148
+ export { ANPD_CATEGORY_PRESETS, type AdvancedConsentTexts, type AnpdPresetCategory, COMMON_INTEGRATIONS, type CategoriesContextValue, type Category, type CategoryAutoConfigResult, type CategoryDefinition, type ClarityConfig, type ConsentAuditAction, type ConsentAuditEntry, type ConsentContextValue, type ConsentCookieData, type ConsentCookieOptions, type ConsentEvent, type ConsentEventOrigin, ConsentGate, type ConsentInitializedEvent, type ConsentPreferences, ConsentProvider, type ConsentProviderProps, ConsentScriptLoader, type ConsentScriptLoaderProps, type ConsentState, type ConsentStorageConfig, type ConsentTexts, type ConsentUpdatedEvent, type ConsentVersionChangeContext, type CookieDescriptor, type CorporateConfig, type CreateAnpdCategoriesOptions, type CustomCookieBannerProps, type CustomFloatingPreferencesButtonProps, type CustomPreferencesModalProps, DEFAULT_PROJECT_CATEGORIES, DesignProvider, type DesignTokens, type DeveloperGuidance, type ECommerceConfig, EXPANDED_DEFAULT_TEXTS, type FacebookPixelConfig, GUIDANCE_PRESETS, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, type GuidanceConfig, type GuidanceMessage, type GuidanceSeverity, type HotjarConfig, INTEGRATION_TEMPLATES, type IntercomConfig, LogLevel, type MixpanelConfig, type PeerDepsCheckResult, type ProjectCategoriesConfig, type SaaSConfig, type ScriptIntegration, TEXT_TEMPLATES, type UserWayConfig, type ZendeskConfig, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, buildConsentStorageKey, categorizeDiscoveredCookies, checkPeerDeps, createAnpdCategoriesConfig, createClarityIntegration, createConsentAuditEntry, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, ensureNecessaryAlwaysOn, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, loadScript, logDeveloperGuidance, logger, openPreferencesModal, pushConsentInitializedEvent, pushConsentUpdatedEvent, resolveTexts, runPeerDepsCheck, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDataLayerEvents, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };
package/dist/index.d.ts CHANGED
@@ -458,6 +458,44 @@ interface ConsentCookieData {
458
458
  */
459
459
  projectConfig?: ProjectCategoriesConfig;
460
460
  }
461
+ /**
462
+ * Ações possíveis registradas no log de auditoria de consentimento.
463
+ * @category Types
464
+ * @since 0.7.0
465
+ * @public
466
+ */
467
+ type ConsentAuditAction = 'init' | 'update' | 'reset';
468
+ /**
469
+ * Entrada de auditoria contendo os dados essenciais para comprovar consentimento.
470
+ * Inclui timestamps, versão configurada e snapshot das preferências.
471
+ * @category Types
472
+ * @since 0.7.0
473
+ * @public
474
+ */
475
+ interface ConsentAuditEntry {
476
+ /** Ação que originou o registro (inicialização, atualização ou reset). */
477
+ action: ConsentAuditAction;
478
+ /** Chave de armazenamento (cookie/localStorage) aplicada, incluindo namespace/versão. */
479
+ storageKey: string;
480
+ /** Versão lógica de consentimento configurada via `storage.version` (política/termo). */
481
+ consentVersion: string;
482
+ /** Timestamp ISO do registro de auditoria. */
483
+ timestamp: string;
484
+ /** Timestamp ISO da primeira decisão de consentimento. */
485
+ consentDate: string;
486
+ /** Timestamp ISO da última alteração de preferências. */
487
+ lastUpdate: string;
488
+ /** Estado atual de consentimento agregado. */
489
+ consented: boolean;
490
+ /** Preferências por categoria no momento do registro. */
491
+ preferences: ConsentPreferences;
492
+ /** Versão do schema do cookie. */
493
+ version: string;
494
+ /** Origem da decisão (banner, modal, reset, programmatic). */
495
+ source: ConsentEventOrigin;
496
+ /** Snapshot da configuração de categorias utilizada. */
497
+ projectConfig?: ProjectCategoriesConfig;
498
+ }
461
499
  /**
462
500
  * Estado interno completo do sistema de consentimento.
463
501
  * @category Types
@@ -1312,6 +1350,26 @@ interface ConsentProviderProps {
1312
1350
  * ```
1313
1351
  */
1314
1352
  onConsentGiven?: (state: ConsentState) => void;
1353
+ /** Callback disparado após hidratação inicial (consentimento existente ou não). */
1354
+ onConsentInit?: (state: ConsentState) => void;
1355
+ /** Callback disparado sempre que o consentimento muda (banner, modal ou programático/reset). */
1356
+ onConsentChange?: (state: ConsentState, context: {
1357
+ origin: ConsentState['source'] | 'reset';
1358
+ }) => void;
1359
+ /**
1360
+ * Callback de auditoria executado sempre que o consentimento é registrado, atualizado ou resetado.
1361
+ * Útil para persistir logs externos (ex.: backend, data lake) com carimbo de tempo e versão do termo.
1362
+ * @since 0.7.0
1363
+ *
1364
+ * @example
1365
+ * ```tsx
1366
+ * <ConsentProvider
1367
+ * storage={{ namespace: 'portal.gov', version: '2025-Q4' }}
1368
+ * onAuditLog={(audit) => api.auditConsent(audit)}
1369
+ * />
1370
+ * ```
1371
+ */
1372
+ onAuditLog?: (entry: ConsentAuditEntry) => void;
1315
1373
  /**
1316
1374
  * Callback executado quando usuário modifica preferências.
1317
1375
  * Executado após salvar as mudanças.
@@ -1412,6 +1470,8 @@ interface CustomCookieBannerProps {
1412
1470
  rejectAll: () => void;
1413
1471
  openPreferences: () => void;
1414
1472
  texts: ConsentTexts;
1473
+ /** Indica se o branding padrão deve ser ocultado. */
1474
+ hideBranding?: boolean;
1415
1475
  /**
1416
1476
  * Indica se o modo bloqueante está ativo no contexto.
1417
1477
  * Esta prop é apenas informativa para banners customizados ajustarem sua UI.
@@ -1656,7 +1716,7 @@ type ConsentEvent = ConsentInitializedEvent | ConsentUpdatedEvent;
1656
1716
  * </ConsentProvider>
1657
1717
  * ```
1658
1718
  */
1659
- declare function ConsentProvider({ initialState, categories, texts: textsProp, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding: _hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, storage, onConsentVersionChange, disableDeveloperGuidance, guidanceConfig, children, disableDiscoveryLog, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
1719
+ declare function ConsentProvider({ initialState, categories, texts: textsProp, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding: _hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, storage, onConsentVersionChange, disableDeveloperGuidance, guidanceConfig, children, disableDiscoveryLog, onConsentInit, onConsentChange, onAuditLog, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
1660
1720
  declare const defaultTexts: ConsentTexts;
1661
1721
 
1662
1722
  /**
@@ -2342,6 +2402,23 @@ declare function buildConsentStorageKey(options?: {
2342
2402
  namespace?: string | null;
2343
2403
  version?: string | null;
2344
2404
  }): string;
2405
+ /**
2406
+ * Cria um registro de auditoria com carimbo de tempo, versão e snapshot das preferências.
2407
+ * @category Utils
2408
+ * @since 0.7.0
2409
+ *
2410
+ * @param state Estado atual de consentimento.
2411
+ * @param params.storageKey Chave de armazenamento (cookie/localStorage) aplicada.
2412
+ * @param params.action Ação que disparou o registro.
2413
+ * @param params.consentVersion Versão lógica do consentimento (ex.: bump de política/termo).
2414
+ * @param params.origin Origem explícita da decisão (opcional).
2415
+ */
2416
+ declare function createConsentAuditEntry(state: ConsentState, params: {
2417
+ storageKey: string;
2418
+ action: ConsentAuditAction;
2419
+ consentVersion?: string | null;
2420
+ origin?: ConsentEventOrigin;
2421
+ }): ConsentAuditEntry;
2345
2422
 
2346
2423
  /** @module src/utils/scriptLoader */
2347
2424
  /**
@@ -2370,6 +2447,7 @@ declare function buildConsentStorageKey(options?: {
2370
2447
  * @param {string} src A URL do script externo a ser carregado.
2371
2448
  * @param {string | null} [category=null] A categoria de consentimento exigida para o script. Suporta tanto categorias predefinidas quanto customizadas. Se o consentimento para esta categoria não for dado, o script não será carregado.
2372
2449
  * @param {Record<string, string>} [attrs={}] Atributos adicionais a serem aplicados ao elemento `<script>` (ex: `{ async: 'true' }`).
2450
+ * @param {string | undefined} [nonce] Nonce CSP opcional aplicado ao script.
2373
2451
  * @returns {Promise<void>} Uma Promise que resolve quando o script é carregado com sucesso, ou rejeita se o consentimento não for dado ou ocorrer um erro de carregamento.
2374
2452
  * @example
2375
2453
  * ```ts
@@ -2379,7 +2457,7 @@ declare function buildConsentStorageKey(options?: {
2379
2457
  * .catch(error => console.error('Erro ao carregar script:', error))
2380
2458
  * ```
2381
2459
  */
2382
- declare function loadScript(id: string, src: string, category?: string | null, attrs?: Record<string, string>): Promise<void>;
2460
+ declare function loadScript(id: string, src: string, category?: string | null, attrs?: Record<string, string>, nonce?: string): Promise<void>;
2383
2461
 
2384
2462
  /**
2385
2463
  * Utilitários para descoberta e categorização de cookies em tempo de execução (experimental).
@@ -2481,6 +2559,8 @@ interface ScriptIntegration {
2481
2559
  init?: () => void;
2482
2560
  /** Atributos HTML adicionais para a tag script */
2483
2561
  attrs?: Record<string, string>;
2562
+ /** Nonce CSP opcional aplicado à tag script */
2563
+ nonce?: string;
2484
2564
  /** Lista de cookies que o script pode definir */
2485
2565
  cookies?: string[];
2486
2566
  /** Informações detalhadas dos cookies (nome, finalidade, duração, fornecedor) */
@@ -3129,6 +3209,8 @@ interface ConsentScriptLoaderProps {
3129
3209
  integrations: ScriptIntegration[];
3130
3210
  /** Se true, força recarregamento se consentimento mudar */
3131
3211
  reloadOnChange?: boolean;
3212
+ /** Nonce CSP aplicado às tags <script> geradas automaticamente (sobrescrevível por integração). */
3213
+ nonce?: string;
3132
3214
  }
3133
3215
  /**
3134
3216
  * @component
@@ -3151,7 +3233,7 @@ interface ConsentScriptLoaderProps {
3151
3233
  * <ConsentScriptLoader integrations={integrations} />
3152
3234
  * ```
3153
3235
  */
3154
- declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly<ConsentScriptLoaderProps>): null;
3236
+ declare function ConsentScriptLoader({ integrations, reloadOnChange, nonce, }: Readonly<ConsentScriptLoaderProps>): null;
3155
3237
  /**
3156
3238
  * @hook
3157
3239
  * @category Hooks
@@ -3179,7 +3261,7 @@ declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly
3179
3261
  * }, [loadScript]);
3180
3262
  * ```
3181
3263
  */
3182
- declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
3264
+ declare function useConsentScriptLoader(): (integration: ScriptIntegration, nonce?: string) => Promise<boolean>;
3183
3265
 
3184
3266
  /**
3185
3267
  * @file autoConfigureCategories.ts
@@ -3287,6 +3369,37 @@ declare function extractCategoriesFromIntegrations(integrations: ScriptIntegrati
3287
3369
  */
3288
3370
  declare function validateNecessaryClassification(integrations: ScriptIntegration[], enabledCategories: Category[]): string[];
3289
3371
 
3372
+ /**
3373
+ * Presets de categorias conforme usos típicos da LGPD/ANPD.
3374
+ *
3375
+ * @category Utils
3376
+ * @since 0.6.4
3377
+ */
3378
+ declare const ANPD_CATEGORY_PRESETS: Record<Category, CategoryDefinition>;
3379
+ type AnpdPresetCategory = keyof typeof ANPD_CATEGORY_PRESETS;
3380
+ interface CreateAnpdCategoriesOptions {
3381
+ /**
3382
+ * Lista de categorias que devem ser habilitadas (além de necessary que é sempre inclusa).
3383
+ * @default ['analytics', 'functional', 'marketing']
3384
+ */
3385
+ include?: AnpdPresetCategory[];
3386
+ /**
3387
+ * Overrides de descrições por categoria.
3388
+ */
3389
+ descriptions?: Partial<Record<AnpdPresetCategory, string>>;
3390
+ /**
3391
+ * Overrides de nomes por categoria.
3392
+ */
3393
+ names?: Partial<Record<AnpdPresetCategory, string>>;
3394
+ }
3395
+ /**
3396
+ * Gera um `ProjectCategoriesConfig` com presets LGPD/ANPD tipados.
3397
+ *
3398
+ * @category Utils
3399
+ * @since 0.6.4
3400
+ */
3401
+ declare function createAnpdCategoriesConfig(options?: CreateAnpdCategoriesOptions): ProjectCategoriesConfig;
3402
+
3290
3403
  /**
3291
3404
  * @fileoverview
3292
3405
  * Sistema de textos expandido com suporte avançado a internacionalização,
@@ -4032,4 +4145,4 @@ declare function useDataLayerEvents(): {
4032
4145
  pushUpdated: typeof pushConsentUpdatedEvent;
4033
4146
  };
4034
4147
 
4035
- export { type AdvancedConsentTexts, COMMON_INTEGRATIONS, type CategoriesContextValue, type Category, type CategoryAutoConfigResult, type CategoryDefinition, type ClarityConfig, type ConsentContextValue, type ConsentCookieData, type ConsentCookieOptions, type ConsentEvent, type ConsentEventOrigin, ConsentGate, type ConsentInitializedEvent, type ConsentPreferences, ConsentProvider, type ConsentProviderProps, ConsentScriptLoader, type ConsentScriptLoaderProps, type ConsentState, type ConsentStorageConfig, type ConsentTexts, type ConsentUpdatedEvent, type ConsentVersionChangeContext, type CookieDescriptor, type CorporateConfig, type CustomCookieBannerProps, type CustomFloatingPreferencesButtonProps, type CustomPreferencesModalProps, DEFAULT_PROJECT_CATEGORIES, DesignProvider, type DesignTokens, type DeveloperGuidance, type ECommerceConfig, EXPANDED_DEFAULT_TEXTS, type FacebookPixelConfig, GUIDANCE_PRESETS, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, type GuidanceConfig, type GuidanceMessage, type GuidanceSeverity, type HotjarConfig, INTEGRATION_TEMPLATES, type IntercomConfig, LogLevel, type MixpanelConfig, type PeerDepsCheckResult, type ProjectCategoriesConfig, type SaaSConfig, type ScriptIntegration, TEXT_TEMPLATES, type UserWayConfig, type ZendeskConfig, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, buildConsentStorageKey, categorizeDiscoveredCookies, checkPeerDeps, createClarityIntegration, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, ensureNecessaryAlwaysOn, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, loadScript, logDeveloperGuidance, logger, openPreferencesModal, pushConsentInitializedEvent, pushConsentUpdatedEvent, resolveTexts, runPeerDepsCheck, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDataLayerEvents, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };
4148
+ export { ANPD_CATEGORY_PRESETS, type AdvancedConsentTexts, type AnpdPresetCategory, COMMON_INTEGRATIONS, type CategoriesContextValue, type Category, type CategoryAutoConfigResult, type CategoryDefinition, type ClarityConfig, type ConsentAuditAction, type ConsentAuditEntry, type ConsentContextValue, type ConsentCookieData, type ConsentCookieOptions, type ConsentEvent, type ConsentEventOrigin, ConsentGate, type ConsentInitializedEvent, type ConsentPreferences, ConsentProvider, type ConsentProviderProps, ConsentScriptLoader, type ConsentScriptLoaderProps, type ConsentState, type ConsentStorageConfig, type ConsentTexts, type ConsentUpdatedEvent, type ConsentVersionChangeContext, type CookieDescriptor, type CorporateConfig, type CreateAnpdCategoriesOptions, type CustomCookieBannerProps, type CustomFloatingPreferencesButtonProps, type CustomPreferencesModalProps, DEFAULT_PROJECT_CATEGORIES, DesignProvider, type DesignTokens, type DeveloperGuidance, type ECommerceConfig, EXPANDED_DEFAULT_TEXTS, type FacebookPixelConfig, GUIDANCE_PRESETS, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, type GuidanceConfig, type GuidanceMessage, type GuidanceSeverity, type HotjarConfig, INTEGRATION_TEMPLATES, type IntercomConfig, LogLevel, type MixpanelConfig, type PeerDepsCheckResult, type ProjectCategoriesConfig, type SaaSConfig, type ScriptIntegration, TEXT_TEMPLATES, type UserWayConfig, type ZendeskConfig, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, buildConsentStorageKey, categorizeDiscoveredCookies, checkPeerDeps, createAnpdCategoriesConfig, createClarityIntegration, createConsentAuditEntry, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, ensureNecessaryAlwaysOn, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, loadScript, logDeveloperGuidance, logger, openPreferencesModal, pushConsentInitializedEvent, pushConsentUpdatedEvent, resolveTexts, runPeerDepsCheck, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDataLayerEvents, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };