@react-lgpd-consent/core 0.5.1 → 0.6.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/dist/index.d.cts CHANGED
@@ -656,6 +656,58 @@ interface ConsentCookieOptions {
656
656
  secure: boolean;
657
657
  /** Caminho do cookie. Padrão: '/' */
658
658
  path: string;
659
+ /**
660
+ * Domínio do cookie (ex.: `.example.com` para compartilhar entre subdomínios).
661
+ * Se não definido, o navegador usa o domínio atual.
662
+ * @since 0.5.2
663
+ */
664
+ domain?: string;
665
+ }
666
+ /**
667
+ * Configuração de versionamento da chave de storage utilizada pelo consentimento.
668
+ * @category Types
669
+ * @since 0.5.2
670
+ * @public
671
+ *
672
+ * @remarks
673
+ * Combine `namespace` e `version` para gerar um nome de cookie único por aplicação
674
+ * e ciclo de consentimento. Ao alterar a `version`, o consentimento anterior é
675
+ * automaticamente considerado inválido, garantindo novo fluxo de consentimento.
676
+ */
677
+ interface ConsentStorageConfig {
678
+ /**
679
+ * Namespace lógico do consentimento (ex.: nome do produto ou domínio raiz).
680
+ * @defaultValue `'lgpd-consent'`
681
+ */
682
+ namespace?: string;
683
+ /**
684
+ * Versão do consentimento atual. Incrementar ou alterar o valor força re-consentimento.
685
+ * Use valores sem espaços (ex.: `'2025.10'`, `'marketing-v2'`).
686
+ * @defaultValue `'1'`
687
+ */
688
+ version?: string;
689
+ /**
690
+ * Domínio compartilhado do cookie (ex.: `.example.com` para múltiplos subdomínios).
691
+ * Se definido, sobrescreve `cookie.domain`.
692
+ */
693
+ domain?: string;
694
+ }
695
+ /**
696
+ * Payload entregue ao callback `onConsentVersionChange`.
697
+ * @category Types
698
+ * @since 0.5.2
699
+ * @public
700
+ */
701
+ interface ConsentVersionChangeContext {
702
+ /** Nome da chave anterior utilizada pelo armazenamento de consentimento (cookie). */
703
+ previousKey: string | null;
704
+ /** Nova chave aplicada após a mudança de namespace/versão. */
705
+ nextKey: string;
706
+ /**
707
+ * Helper para gatilhar o reset imediato do estado de consentimento.
708
+ * Útil para cenários onde o consumidor controla estado adicional (ex.: localStorage).
709
+ */
710
+ resetConsent: () => void;
659
711
  }
660
712
  /**
661
713
  * Tipo alias para valores de espaçamento que suportam eixos x/y.
@@ -1317,6 +1369,32 @@ interface ConsentProviderProps {
1317
1369
  * ```
1318
1370
  */
1319
1371
  guidanceConfig?: GuidanceConfig;
1372
+ /**
1373
+ * Configuração da chave de armazenamento (cookie/localStorage) do consentimento.
1374
+ * Permite definir namespace, versão e domínio compartilhado.
1375
+ * @since 0.5.2
1376
+ */
1377
+ storage?: ConsentStorageConfig;
1378
+ /**
1379
+ * Callback disparado quando a chave de armazenamento muda (ex.: bump de versão).
1380
+ * Recebe a chave anterior, a nova chave e um helper `resetConsent`.
1381
+ * @since 0.5.2
1382
+ *
1383
+ * @example
1384
+ * ```tsx
1385
+ * <ConsentProvider
1386
+ * storage={{ namespace: 'portal.gov.br', version: '2025-Q4' }}
1387
+ * onConsentVersionChange={({ previousKey, nextKey, resetConsent }) => {
1388
+ * console.info('[consent] versão alterada', { previousKey, nextKey })
1389
+ * analytics.clearUserStorage()
1390
+ * resetConsent()
1391
+ * }}
1392
+ * >
1393
+ * <App />
1394
+ * </ConsentProvider>
1395
+ * ```
1396
+ */
1397
+ onConsentVersionChange?: (context: ConsentVersionChangeContext) => void;
1320
1398
  /** Elementos filhos - toda a aplicação que precisa de contexto de consentimento. */
1321
1399
  children: React.ReactNode;
1322
1400
  }
@@ -1577,7 +1655,7 @@ type ConsentEvent = ConsentInitializedEvent | ConsentUpdatedEvent;
1577
1655
  * </ConsentProvider>
1578
1656
  * ```
1579
1657
  */
1580
- declare function ConsentProvider({ initialState, categories, texts: textsProp, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding: _hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, guidanceConfig, children, disableDiscoveryLog, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
1658
+ 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;
1581
1659
  declare const defaultTexts: ConsentTexts;
1582
1660
 
1583
1661
  /**
@@ -2245,6 +2323,24 @@ declare function ConsentGate(props: Readonly<{
2245
2323
  children: React$1.ReactNode;
2246
2324
  }>): react_jsx_runtime.JSX.Element | null;
2247
2325
 
2326
+ /**
2327
+ * @fileoverview
2328
+ * Utilitários para manipulação do cookie de consentimento.
2329
+ * A estrutura de dados do cookie é um JSON simples para atender aos requisitos da LGPD,
2330
+ * e não implementa o padrão IAB TCF, que é mais complexo.
2331
+ * Veja `src/types/types.ts` para a definição da estrutura `ConsentCookieData`.
2332
+ */
2333
+
2334
+ /**
2335
+ * Gera o nome da chave de armazenamento (cookie/localStorage) combinando namespace e versão.
2336
+ * @param options.namespace Namespace lógico do consentimento (ex.: domínio raiz).
2337
+ * @param options.version Versão atual do consentimento (ex.: lote de políticas).
2338
+ */
2339
+ declare function buildConsentStorageKey(options?: {
2340
+ namespace?: string | null;
2341
+ version?: string | null;
2342
+ }): string;
2343
+
2248
2344
  /** @module src/utils/scriptLoader */
2249
2345
  /**
2250
2346
  * @category Utils
@@ -3606,6 +3702,88 @@ declare const logger: ConsentLogger;
3606
3702
  */
3607
3703
  declare function setDebugLogging(enabled: boolean, level?: LogLevel): void;
3608
3704
 
3705
+ /**
3706
+ * @fileoverview
3707
+ * Sistema de diagnóstico de peer dependencies e compatibilidade de versões.
3708
+ * Detecta problemas comuns como múltiplas instâncias de React e versões de MUI fora do range suportado.
3709
+ *
3710
+ * @author Luciano Édipo
3711
+ * @since 0.5.4
3712
+ */
3713
+ /**
3714
+ * Resultado da verificação de peer dependencies.
3715
+ *
3716
+ * @category Utils
3717
+ * @since 0.5.4
3718
+ */
3719
+ interface PeerDepsCheckResult {
3720
+ /** Se todas as verificações passaram sem problemas críticos */
3721
+ ok: boolean;
3722
+ /** Lista de avisos detectados */
3723
+ warnings: string[];
3724
+ /** Lista de erros críticos detectados */
3725
+ errors: string[];
3726
+ }
3727
+ /**
3728
+ * Verifica compatibilidade de peer dependencies (React e MUI).
3729
+ *
3730
+ * @category Utils
3731
+ * @since 0.5.4
3732
+ *
3733
+ * @remarks
3734
+ * Esta função executa verificações em ambiente de desenvolvimento para detectar:
3735
+ * - Múltiplas instâncias de React (causa "Invalid hook call")
3736
+ * - Versões de React fora do range suportado (18-19)
3737
+ * - Versões de MUI fora do range suportado (5-7)
3738
+ *
3739
+ * As mensagens incluem:
3740
+ * - Descrição clara do problema
3741
+ * - Causa raiz provável
3742
+ * - Passos objetivos para resolver
3743
+ * - Links para documentação
3744
+ *
3745
+ * @param options - Opções de configuração
3746
+ * @param options.skipInProduction - Se true, pula verificação em produção (padrão: true)
3747
+ * @param options.logWarnings - Se true, loga avisos no console (padrão: true)
3748
+ *
3749
+ * @returns Resultado da verificação com lista de avisos e erros
3750
+ *
3751
+ * @example
3752
+ * ```typescript
3753
+ * import { checkPeerDeps } from '@react-lgpd-consent/core'
3754
+ *
3755
+ * // Verificar compatibilidade em desenvolvimento
3756
+ * const result = checkPeerDeps()
3757
+ * if (!result.ok) {
3758
+ * console.log('Problemas detectados:', result.errors)
3759
+ * }
3760
+ * ```
3761
+ */
3762
+ declare function checkPeerDeps(options?: {
3763
+ skipInProduction?: boolean;
3764
+ logWarnings?: boolean;
3765
+ }): PeerDepsCheckResult;
3766
+ /**
3767
+ * Executa verificação de peer dependencies e loga resultados automaticamente.
3768
+ * Versão conveniente de `checkPeerDeps` que sempre loga no console.
3769
+ *
3770
+ * @category Utils
3771
+ * @since 0.5.4
3772
+ *
3773
+ * @remarks
3774
+ * Esta função é chamada automaticamente pelo ConsentProvider em modo development.
3775
+ * Use `checkPeerDeps()` se precisar do resultado programaticamente sem logging.
3776
+ *
3777
+ * @example
3778
+ * ```typescript
3779
+ * import { runPeerDepsCheck } from '@react-lgpd-consent/core'
3780
+ *
3781
+ * // Executar verificação manual (já é automática no Provider)
3782
+ * runPeerDepsCheck()
3783
+ * ```
3784
+ */
3785
+ declare function runPeerDepsCheck(): void;
3786
+
3609
3787
  interface CookieCatalogOverrides {
3610
3788
  byCategory?: Record<string, CookieDescriptor[]>;
3611
3789
  byIntegration?: Record<string, CookieDescriptor[]>;
@@ -3666,6 +3844,12 @@ declare function getCookiesInfoForCategory(categoryId: Category, usedIntegration
3666
3844
  * ```
3667
3845
  */
3668
3846
  declare function createProjectPreferences(config?: ProjectCategoriesConfig, defaultValue?: boolean): ConsentPreferences;
3847
+ /**
3848
+ * Garante que a categoria `necessary` permaneça ativa em qualquer estrutura de preferências.
3849
+ * @category Utils
3850
+ * @since 0.5.2
3851
+ */
3852
+ declare function ensureNecessaryAlwaysOn(preferences: ConsentPreferences): ConsentPreferences;
3669
3853
  /**
3670
3854
  * Valida um objeto de preferências de consentimento, removendo categorias que não estão permitidas pela configuração do projeto.
3671
3855
  * @category Utils
@@ -3842,4 +4026,4 @@ declare function useDataLayerEvents(): {
3842
4026
  pushUpdated: typeof pushConsentUpdatedEvent;
3843
4027
  };
3844
4028
 
3845
- 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 ConsentTexts, type ConsentUpdatedEvent, 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 ProjectCategoriesConfig, type SaaSConfig, type ScriptIntegration, TEXT_TEMPLATES, type UserWayConfig, type ZendeskConfig, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, categorizeDiscoveredCookies, createClarityIntegration, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, loadScript, logDeveloperGuidance, logger, openPreferencesModal, pushConsentInitializedEvent, pushConsentUpdatedEvent, resolveTexts, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDataLayerEvents, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };
4029
+ 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 };
package/dist/index.d.ts CHANGED
@@ -656,6 +656,58 @@ interface ConsentCookieOptions {
656
656
  secure: boolean;
657
657
  /** Caminho do cookie. Padrão: '/' */
658
658
  path: string;
659
+ /**
660
+ * Domínio do cookie (ex.: `.example.com` para compartilhar entre subdomínios).
661
+ * Se não definido, o navegador usa o domínio atual.
662
+ * @since 0.5.2
663
+ */
664
+ domain?: string;
665
+ }
666
+ /**
667
+ * Configuração de versionamento da chave de storage utilizada pelo consentimento.
668
+ * @category Types
669
+ * @since 0.5.2
670
+ * @public
671
+ *
672
+ * @remarks
673
+ * Combine `namespace` e `version` para gerar um nome de cookie único por aplicação
674
+ * e ciclo de consentimento. Ao alterar a `version`, o consentimento anterior é
675
+ * automaticamente considerado inválido, garantindo novo fluxo de consentimento.
676
+ */
677
+ interface ConsentStorageConfig {
678
+ /**
679
+ * Namespace lógico do consentimento (ex.: nome do produto ou domínio raiz).
680
+ * @defaultValue `'lgpd-consent'`
681
+ */
682
+ namespace?: string;
683
+ /**
684
+ * Versão do consentimento atual. Incrementar ou alterar o valor força re-consentimento.
685
+ * Use valores sem espaços (ex.: `'2025.10'`, `'marketing-v2'`).
686
+ * @defaultValue `'1'`
687
+ */
688
+ version?: string;
689
+ /**
690
+ * Domínio compartilhado do cookie (ex.: `.example.com` para múltiplos subdomínios).
691
+ * Se definido, sobrescreve `cookie.domain`.
692
+ */
693
+ domain?: string;
694
+ }
695
+ /**
696
+ * Payload entregue ao callback `onConsentVersionChange`.
697
+ * @category Types
698
+ * @since 0.5.2
699
+ * @public
700
+ */
701
+ interface ConsentVersionChangeContext {
702
+ /** Nome da chave anterior utilizada pelo armazenamento de consentimento (cookie). */
703
+ previousKey: string | null;
704
+ /** Nova chave aplicada após a mudança de namespace/versão. */
705
+ nextKey: string;
706
+ /**
707
+ * Helper para gatilhar o reset imediato do estado de consentimento.
708
+ * Útil para cenários onde o consumidor controla estado adicional (ex.: localStorage).
709
+ */
710
+ resetConsent: () => void;
659
711
  }
660
712
  /**
661
713
  * Tipo alias para valores de espaçamento que suportam eixos x/y.
@@ -1317,6 +1369,32 @@ interface ConsentProviderProps {
1317
1369
  * ```
1318
1370
  */
1319
1371
  guidanceConfig?: GuidanceConfig;
1372
+ /**
1373
+ * Configuração da chave de armazenamento (cookie/localStorage) do consentimento.
1374
+ * Permite definir namespace, versão e domínio compartilhado.
1375
+ * @since 0.5.2
1376
+ */
1377
+ storage?: ConsentStorageConfig;
1378
+ /**
1379
+ * Callback disparado quando a chave de armazenamento muda (ex.: bump de versão).
1380
+ * Recebe a chave anterior, a nova chave e um helper `resetConsent`.
1381
+ * @since 0.5.2
1382
+ *
1383
+ * @example
1384
+ * ```tsx
1385
+ * <ConsentProvider
1386
+ * storage={{ namespace: 'portal.gov.br', version: '2025-Q4' }}
1387
+ * onConsentVersionChange={({ previousKey, nextKey, resetConsent }) => {
1388
+ * console.info('[consent] versão alterada', { previousKey, nextKey })
1389
+ * analytics.clearUserStorage()
1390
+ * resetConsent()
1391
+ * }}
1392
+ * >
1393
+ * <App />
1394
+ * </ConsentProvider>
1395
+ * ```
1396
+ */
1397
+ onConsentVersionChange?: (context: ConsentVersionChangeContext) => void;
1320
1398
  /** Elementos filhos - toda a aplicação que precisa de contexto de consentimento. */
1321
1399
  children: React.ReactNode;
1322
1400
  }
@@ -1577,7 +1655,7 @@ type ConsentEvent = ConsentInitializedEvent | ConsentUpdatedEvent;
1577
1655
  * </ConsentProvider>
1578
1656
  * ```
1579
1657
  */
1580
- declare function ConsentProvider({ initialState, categories, texts: textsProp, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding: _hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, guidanceConfig, children, disableDiscoveryLog, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
1658
+ 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;
1581
1659
  declare const defaultTexts: ConsentTexts;
1582
1660
 
1583
1661
  /**
@@ -2245,6 +2323,24 @@ declare function ConsentGate(props: Readonly<{
2245
2323
  children: React$1.ReactNode;
2246
2324
  }>): react_jsx_runtime.JSX.Element | null;
2247
2325
 
2326
+ /**
2327
+ * @fileoverview
2328
+ * Utilitários para manipulação do cookie de consentimento.
2329
+ * A estrutura de dados do cookie é um JSON simples para atender aos requisitos da LGPD,
2330
+ * e não implementa o padrão IAB TCF, que é mais complexo.
2331
+ * Veja `src/types/types.ts` para a definição da estrutura `ConsentCookieData`.
2332
+ */
2333
+
2334
+ /**
2335
+ * Gera o nome da chave de armazenamento (cookie/localStorage) combinando namespace e versão.
2336
+ * @param options.namespace Namespace lógico do consentimento (ex.: domínio raiz).
2337
+ * @param options.version Versão atual do consentimento (ex.: lote de políticas).
2338
+ */
2339
+ declare function buildConsentStorageKey(options?: {
2340
+ namespace?: string | null;
2341
+ version?: string | null;
2342
+ }): string;
2343
+
2248
2344
  /** @module src/utils/scriptLoader */
2249
2345
  /**
2250
2346
  * @category Utils
@@ -3606,6 +3702,88 @@ declare const logger: ConsentLogger;
3606
3702
  */
3607
3703
  declare function setDebugLogging(enabled: boolean, level?: LogLevel): void;
3608
3704
 
3705
+ /**
3706
+ * @fileoverview
3707
+ * Sistema de diagnóstico de peer dependencies e compatibilidade de versões.
3708
+ * Detecta problemas comuns como múltiplas instâncias de React e versões de MUI fora do range suportado.
3709
+ *
3710
+ * @author Luciano Édipo
3711
+ * @since 0.5.4
3712
+ */
3713
+ /**
3714
+ * Resultado da verificação de peer dependencies.
3715
+ *
3716
+ * @category Utils
3717
+ * @since 0.5.4
3718
+ */
3719
+ interface PeerDepsCheckResult {
3720
+ /** Se todas as verificações passaram sem problemas críticos */
3721
+ ok: boolean;
3722
+ /** Lista de avisos detectados */
3723
+ warnings: string[];
3724
+ /** Lista de erros críticos detectados */
3725
+ errors: string[];
3726
+ }
3727
+ /**
3728
+ * Verifica compatibilidade de peer dependencies (React e MUI).
3729
+ *
3730
+ * @category Utils
3731
+ * @since 0.5.4
3732
+ *
3733
+ * @remarks
3734
+ * Esta função executa verificações em ambiente de desenvolvimento para detectar:
3735
+ * - Múltiplas instâncias de React (causa "Invalid hook call")
3736
+ * - Versões de React fora do range suportado (18-19)
3737
+ * - Versões de MUI fora do range suportado (5-7)
3738
+ *
3739
+ * As mensagens incluem:
3740
+ * - Descrição clara do problema
3741
+ * - Causa raiz provável
3742
+ * - Passos objetivos para resolver
3743
+ * - Links para documentação
3744
+ *
3745
+ * @param options - Opções de configuração
3746
+ * @param options.skipInProduction - Se true, pula verificação em produção (padrão: true)
3747
+ * @param options.logWarnings - Se true, loga avisos no console (padrão: true)
3748
+ *
3749
+ * @returns Resultado da verificação com lista de avisos e erros
3750
+ *
3751
+ * @example
3752
+ * ```typescript
3753
+ * import { checkPeerDeps } from '@react-lgpd-consent/core'
3754
+ *
3755
+ * // Verificar compatibilidade em desenvolvimento
3756
+ * const result = checkPeerDeps()
3757
+ * if (!result.ok) {
3758
+ * console.log('Problemas detectados:', result.errors)
3759
+ * }
3760
+ * ```
3761
+ */
3762
+ declare function checkPeerDeps(options?: {
3763
+ skipInProduction?: boolean;
3764
+ logWarnings?: boolean;
3765
+ }): PeerDepsCheckResult;
3766
+ /**
3767
+ * Executa verificação de peer dependencies e loga resultados automaticamente.
3768
+ * Versão conveniente de `checkPeerDeps` que sempre loga no console.
3769
+ *
3770
+ * @category Utils
3771
+ * @since 0.5.4
3772
+ *
3773
+ * @remarks
3774
+ * Esta função é chamada automaticamente pelo ConsentProvider em modo development.
3775
+ * Use `checkPeerDeps()` se precisar do resultado programaticamente sem logging.
3776
+ *
3777
+ * @example
3778
+ * ```typescript
3779
+ * import { runPeerDepsCheck } from '@react-lgpd-consent/core'
3780
+ *
3781
+ * // Executar verificação manual (já é automática no Provider)
3782
+ * runPeerDepsCheck()
3783
+ * ```
3784
+ */
3785
+ declare function runPeerDepsCheck(): void;
3786
+
3609
3787
  interface CookieCatalogOverrides {
3610
3788
  byCategory?: Record<string, CookieDescriptor[]>;
3611
3789
  byIntegration?: Record<string, CookieDescriptor[]>;
@@ -3666,6 +3844,12 @@ declare function getCookiesInfoForCategory(categoryId: Category, usedIntegration
3666
3844
  * ```
3667
3845
  */
3668
3846
  declare function createProjectPreferences(config?: ProjectCategoriesConfig, defaultValue?: boolean): ConsentPreferences;
3847
+ /**
3848
+ * Garante que a categoria `necessary` permaneça ativa em qualquer estrutura de preferências.
3849
+ * @category Utils
3850
+ * @since 0.5.2
3851
+ */
3852
+ declare function ensureNecessaryAlwaysOn(preferences: ConsentPreferences): ConsentPreferences;
3669
3853
  /**
3670
3854
  * Valida um objeto de preferências de consentimento, removendo categorias que não estão permitidas pela configuração do projeto.
3671
3855
  * @category Utils
@@ -3842,4 +4026,4 @@ declare function useDataLayerEvents(): {
3842
4026
  pushUpdated: typeof pushConsentUpdatedEvent;
3843
4027
  };
3844
4028
 
3845
- 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 ConsentTexts, type ConsentUpdatedEvent, 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 ProjectCategoriesConfig, type SaaSConfig, type ScriptIntegration, TEXT_TEMPLATES, type UserWayConfig, type ZendeskConfig, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, categorizeDiscoveredCookies, createClarityIntegration, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, loadScript, logDeveloperGuidance, logger, openPreferencesModal, pushConsentInitializedEvent, pushConsentUpdatedEvent, resolveTexts, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDataLayerEvents, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };
4029
+ 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 };