react-lgpd-consent 0.2.1 → 0.2.2

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
@@ -362,7 +362,9 @@ interface ConsentContextValue {
362
362
  * <App />
363
363
  * </ConsentProvider>
364
364
  */
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;
365
+ declare function ConsentProvider({ initialState, categories, // NOVO: configuração completa de categorias
366
+ texts: textsProp, theme, customCategories, // LEGACY: compatibilidade
367
+ scriptIntegrations, PreferencesModalComponent, preferencesModalProps, disableAutomaticModal, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
366
368
 
367
369
  /**
368
370
  * Hook principal para acessar e manipular o estado de consentimento de cookies.
@@ -398,14 +400,73 @@ declare function useConsentTexts(): ConsentTexts;
398
400
  declare function useConsentHydration(): boolean;
399
401
 
400
402
  /**
401
- * Hook para acessar as categorias customizadas.
402
- * Retorna apenas as categorias customizadas (não as padrão analytics/marketing).
403
+ * Sistema de orientações para developers sobre configuração de categorias.
404
+ * Ajuda a manter coerência entre configuração da lib e componentes customizados.
405
+ */
406
+ interface DeveloperGuidance {
407
+ /** Avisos sobre configuração inconsistente */
408
+ warnings: string[];
409
+ /** Sugestões de melhoria */
410
+ suggestions: string[];
411
+ /** Informações sobre categorias ativas */
412
+ activeCategoriesInfo: {
413
+ id: string;
414
+ name: string;
415
+ description: string;
416
+ essential: boolean;
417
+ uiRequired: boolean;
418
+ }[];
419
+ /** Se usa configuração padrão (não explícita) */
420
+ usingDefaults: boolean;
421
+ }
422
+ /**
423
+ * Configuração padrão quando developer não especifica categorias.
424
+ * Baseado nas necessidades mais comuns em conformidade LGPD.
403
425
  */
404
- declare function useCustomCategories(): CategoryDefinition[];
426
+ declare const DEFAULT_PROJECT_CATEGORIES: ProjectCategoriesConfig;
427
+ /**
428
+ * Analisa configuração do projeto e retorna orientações para o developer.
429
+ */
430
+ declare function analyzeDeveloperConfiguration(config?: ProjectCategoriesConfig): DeveloperGuidance;
431
+
432
+ /**
433
+ * Context para informações sobre categorias ativas no projeto.
434
+ * Fornece orientações e validações para components UI.
435
+ */
436
+ interface CategoriesContextValue {
437
+ /** Configuração final das categorias (com padrão aplicado) */
438
+ config: ProjectCategoriesConfig;
439
+ /** Análise e orientações para developers */
440
+ guidance: DeveloperGuidance;
441
+ /** Categorias que precisam de toggle na UI */
442
+ toggleableCategories: DeveloperGuidance['activeCategoriesInfo'];
443
+ /** Todas as categorias ativas */
444
+ allCategories: DeveloperGuidance['activeCategoriesInfo'];
445
+ /** LEGACY: Apenas categorias customizadas (backward compatibility) */
446
+ legacyCategories: CategoryDefinition[];
447
+ }
405
448
  /**
406
- * Hook para obter todas as categorias (padrão + customizadas).
449
+ * Hook para acessar informações sobre categorias ativas.
450
+ * Usado por componentes UI para renderizar adequadamente.
407
451
  */
408
- declare function useAllCategories(): CategoryDefinition[];
452
+ declare function useCategories(): CategoriesContextValue;
453
+ /**
454
+ * Hook de conveniência para verificar se uma categoria específica está ativa.
455
+ */
456
+ declare function useCategoryStatus(categoryId: string): {
457
+ isActive: boolean;
458
+ isEssential: boolean;
459
+ needsToggle: boolean;
460
+ name: string | undefined;
461
+ description: string | undefined;
462
+ };
463
+ /**
464
+ * LEGACY: Hook para acessar as categorias customizadas.
465
+ * Mantido para backward compatibility.
466
+ *
467
+ * @deprecated Use useCategories() ao invés disso para acesso completo às categorias.
468
+ */
469
+ declare function useCustomCategories(): CategoryDefinition[];
409
470
 
410
471
  declare function ConsentGate(props: Readonly<{
411
472
  category: string;
@@ -482,4 +543,4 @@ declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly
482
543
  */
483
544
  declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
484
545
 
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 };
546
+ export { COMMON_INTEGRATIONS, type Category, type CategoryDefinition, type ConsentCookieOptions, ConsentGate, type ConsentPreferences, ConsentProvider, ConsentScriptLoader, type ConsentState, type ConsentTexts, CookieBanner, DEFAULT_PROJECT_CATEGORIES, type DeveloperGuidance, FloatingPreferencesButton, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, PreferencesModal, type ProjectCategoriesConfig, type ScriptIntegration, type UserWayConfig, analyzeDeveloperConfiguration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createUserWayIntegration, defaultConsentTheme, loadScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useCustomCategories };
package/dist/index.d.ts CHANGED
@@ -362,7 +362,9 @@ interface ConsentContextValue {
362
362
  * <App />
363
363
  * </ConsentProvider>
364
364
  */
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;
365
+ declare function ConsentProvider({ initialState, categories, // NOVO: configuração completa de categorias
366
+ texts: textsProp, theme, customCategories, // LEGACY: compatibilidade
367
+ scriptIntegrations, PreferencesModalComponent, preferencesModalProps, disableAutomaticModal, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
366
368
 
367
369
  /**
368
370
  * Hook principal para acessar e manipular o estado de consentimento de cookies.
@@ -398,14 +400,73 @@ declare function useConsentTexts(): ConsentTexts;
398
400
  declare function useConsentHydration(): boolean;
399
401
 
400
402
  /**
401
- * Hook para acessar as categorias customizadas.
402
- * Retorna apenas as categorias customizadas (não as padrão analytics/marketing).
403
+ * Sistema de orientações para developers sobre configuração de categorias.
404
+ * Ajuda a manter coerência entre configuração da lib e componentes customizados.
405
+ */
406
+ interface DeveloperGuidance {
407
+ /** Avisos sobre configuração inconsistente */
408
+ warnings: string[];
409
+ /** Sugestões de melhoria */
410
+ suggestions: string[];
411
+ /** Informações sobre categorias ativas */
412
+ activeCategoriesInfo: {
413
+ id: string;
414
+ name: string;
415
+ description: string;
416
+ essential: boolean;
417
+ uiRequired: boolean;
418
+ }[];
419
+ /** Se usa configuração padrão (não explícita) */
420
+ usingDefaults: boolean;
421
+ }
422
+ /**
423
+ * Configuração padrão quando developer não especifica categorias.
424
+ * Baseado nas necessidades mais comuns em conformidade LGPD.
403
425
  */
404
- declare function useCustomCategories(): CategoryDefinition[];
426
+ declare const DEFAULT_PROJECT_CATEGORIES: ProjectCategoriesConfig;
427
+ /**
428
+ * Analisa configuração do projeto e retorna orientações para o developer.
429
+ */
430
+ declare function analyzeDeveloperConfiguration(config?: ProjectCategoriesConfig): DeveloperGuidance;
431
+
432
+ /**
433
+ * Context para informações sobre categorias ativas no projeto.
434
+ * Fornece orientações e validações para components UI.
435
+ */
436
+ interface CategoriesContextValue {
437
+ /** Configuração final das categorias (com padrão aplicado) */
438
+ config: ProjectCategoriesConfig;
439
+ /** Análise e orientações para developers */
440
+ guidance: DeveloperGuidance;
441
+ /** Categorias que precisam de toggle na UI */
442
+ toggleableCategories: DeveloperGuidance['activeCategoriesInfo'];
443
+ /** Todas as categorias ativas */
444
+ allCategories: DeveloperGuidance['activeCategoriesInfo'];
445
+ /** LEGACY: Apenas categorias customizadas (backward compatibility) */
446
+ legacyCategories: CategoryDefinition[];
447
+ }
405
448
  /**
406
- * Hook para obter todas as categorias (padrão + customizadas).
449
+ * Hook para acessar informações sobre categorias ativas.
450
+ * Usado por componentes UI para renderizar adequadamente.
407
451
  */
408
- declare function useAllCategories(): CategoryDefinition[];
452
+ declare function useCategories(): CategoriesContextValue;
453
+ /**
454
+ * Hook de conveniência para verificar se uma categoria específica está ativa.
455
+ */
456
+ declare function useCategoryStatus(categoryId: string): {
457
+ isActive: boolean;
458
+ isEssential: boolean;
459
+ needsToggle: boolean;
460
+ name: string | undefined;
461
+ description: string | undefined;
462
+ };
463
+ /**
464
+ * LEGACY: Hook para acessar as categorias customizadas.
465
+ * Mantido para backward compatibility.
466
+ *
467
+ * @deprecated Use useCategories() ao invés disso para acesso completo às categorias.
468
+ */
469
+ declare function useCustomCategories(): CategoryDefinition[];
409
470
 
410
471
  declare function ConsentGate(props: Readonly<{
411
472
  category: string;
@@ -482,4 +543,4 @@ declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly
482
543
  */
483
544
  declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
484
545
 
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 };
546
+ export { COMMON_INTEGRATIONS, type Category, type CategoryDefinition, type ConsentCookieOptions, ConsentGate, type ConsentPreferences, ConsentProvider, ConsentScriptLoader, type ConsentState, type ConsentTexts, CookieBanner, DEFAULT_PROJECT_CATEGORIES, type DeveloperGuidance, FloatingPreferencesButton, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, PreferencesModal, type ProjectCategoriesConfig, type ScriptIntegration, type UserWayConfig, analyzeDeveloperConfiguration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createUserWayIntegration, defaultConsentTheme, loadScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useCustomCategories };
package/dist/index.js CHANGED
@@ -1,14 +1,17 @@
1
1
  import {
2
2
  Branding,
3
3
  ConsentProvider,
4
+ DEFAULT_PROJECT_CATEGORIES,
4
5
  PreferencesModal,
6
+ analyzeDeveloperConfiguration,
5
7
  defaultConsentTheme,
6
- useAllCategories,
8
+ useCategories,
9
+ useCategoryStatus,
7
10
  useConsent,
8
11
  useConsentHydration,
9
12
  useConsentTexts,
10
13
  useCustomCategories
11
- } from "./chunk-QCERRRSC.js";
14
+ } from "./chunk-JAX63PBG.js";
12
15
 
13
16
  // src/components/CookieBanner.tsx
14
17
  import Button from "@mui/material/Button";
@@ -361,14 +364,17 @@ export {
361
364
  ConsentProvider,
362
365
  ConsentScriptLoader,
363
366
  CookieBanner,
367
+ DEFAULT_PROJECT_CATEGORIES,
364
368
  FloatingPreferencesButton,
365
369
  PreferencesModal,
370
+ analyzeDeveloperConfiguration,
366
371
  createGoogleAnalyticsIntegration,
367
372
  createGoogleTagManagerIntegration,
368
373
  createUserWayIntegration,
369
374
  defaultConsentTheme,
370
375
  loadScript,
371
- useAllCategories,
376
+ useCategories,
377
+ useCategoryStatus,
372
378
  useConsent,
373
379
  useConsentHydration,
374
380
  useConsentScriptLoader,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-lgpd-consent",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Biblioteca completa de consentimento LGPD com 6 categorias ANPD, integrações nativas e sistema extensível para React.",
5
5
  "keywords": [
6
6
  "lgpd",