react-lgpd-consent 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -0
- package/QUICKSTART.en.md +34 -0
- package/QUICKSTART.md +308 -1
- package/README.en.md +19 -0
- package/README.md +30 -0
- package/dist/{PreferencesModal-D2SEVH3N.js → PreferencesModal-RNRD3JKB.js} +1 -1
- package/dist/{chunk-B5FNONG3.js → chunk-VOQUCGOA.js} +902 -242
- package/dist/index.cjs +1698 -277
- package/dist/index.d.cts +1782 -230
- package/dist/index.d.ts +1782 -230
- package/dist/index.js +738 -8
- package/package.json +32 -4
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,14 @@ import { PaperProps } from '@mui/material/Paper';
|
|
|
6
6
|
import { SnackbarProps } from '@mui/material/Snackbar';
|
|
7
7
|
import { FabProps } from '@mui/material/Fab';
|
|
8
8
|
|
|
9
|
+
declare global {
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
* Variável global para rastrear integrações usadas.
|
|
13
|
+
* Usado internamente para logging e análise de performance.
|
|
14
|
+
*/
|
|
15
|
+
var __LGPD_USED_INTEGRATIONS__: string[] | undefined;
|
|
16
|
+
}
|
|
9
17
|
/**
|
|
10
18
|
* @interface PreferencesModalProps
|
|
11
19
|
* Propriedades para customizar o componente `PreferencesModal`.
|
|
@@ -34,6 +42,96 @@ interface PreferencesModalProps {
|
|
|
34
42
|
*/
|
|
35
43
|
declare function PreferencesModal({ DialogProps, hideBranding, }: Readonly<PreferencesModalProps>): react_jsx_runtime.JSX.Element;
|
|
36
44
|
|
|
45
|
+
type GuidanceSeverity = 'info' | 'warning' | 'error';
|
|
46
|
+
interface GuidanceMessage {
|
|
47
|
+
severity: GuidanceSeverity;
|
|
48
|
+
message: string;
|
|
49
|
+
category?: string;
|
|
50
|
+
actionable?: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface GuidanceConfig {
|
|
53
|
+
/** Controla se avisos devem ser exibidos */
|
|
54
|
+
showWarnings?: boolean;
|
|
55
|
+
/** Controla se sugestões devem ser exibidas */
|
|
56
|
+
showSuggestions?: boolean;
|
|
57
|
+
/** Controla se a tabela de categorias deve ser exibida */
|
|
58
|
+
showCategoriesTable?: boolean;
|
|
59
|
+
/** Controla se as boas práticas devem ser exibidas */
|
|
60
|
+
showBestPractices?: boolean;
|
|
61
|
+
/** Controla se deve exibir score de conformidade */
|
|
62
|
+
showComplianceScore?: boolean;
|
|
63
|
+
/** Filtro de severidade mínima para exibir mensagens */
|
|
64
|
+
minimumSeverity?: GuidanceSeverity;
|
|
65
|
+
/** Callback personalizado para processar mensagens */
|
|
66
|
+
messageProcessor?: (messages: GuidanceMessage[]) => void;
|
|
67
|
+
}
|
|
68
|
+
interface DeveloperGuidance {
|
|
69
|
+
warnings: string[];
|
|
70
|
+
suggestions: string[];
|
|
71
|
+
messages: GuidanceMessage[];
|
|
72
|
+
activeCategoriesInfo: {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
essential: boolean;
|
|
77
|
+
uiRequired: boolean;
|
|
78
|
+
cookies?: string[];
|
|
79
|
+
}[];
|
|
80
|
+
usingDefaults: boolean;
|
|
81
|
+
complianceScore?: number;
|
|
82
|
+
}
|
|
83
|
+
declare const DEFAULT_PROJECT_CATEGORIES: ProjectCategoriesConfig;
|
|
84
|
+
/**
|
|
85
|
+
* Analisa configuração e integrações implícitas para orientar o dev.
|
|
86
|
+
*
|
|
87
|
+
* Since v0.4.0: inclui customCategories.
|
|
88
|
+
* Since v0.4.1: considera categorias/integrações implícitas e enriquece cookies por categoria.
|
|
89
|
+
*/
|
|
90
|
+
declare function analyzeDeveloperConfiguration(config?: ProjectCategoriesConfig): DeveloperGuidance;
|
|
91
|
+
declare function logDeveloperGuidance(guidance: DeveloperGuidance, disableGuidanceProp?: boolean, config?: GuidanceConfig): void;
|
|
92
|
+
declare function useDeveloperGuidance(config?: ProjectCategoriesConfig, disableGuidanceProp?: boolean, guidanceConfig?: GuidanceConfig): DeveloperGuidance;
|
|
93
|
+
/**
|
|
94
|
+
* Presets de configuração para diferentes ambientes
|
|
95
|
+
*/
|
|
96
|
+
declare const GUIDANCE_PRESETS: {
|
|
97
|
+
/** Configuração completa para desenvolvimento */
|
|
98
|
+
readonly development: {
|
|
99
|
+
readonly showWarnings: true;
|
|
100
|
+
readonly showSuggestions: true;
|
|
101
|
+
readonly showCategoriesTable: true;
|
|
102
|
+
readonly showBestPractices: true;
|
|
103
|
+
readonly showComplianceScore: true;
|
|
104
|
+
readonly minimumSeverity: "info";
|
|
105
|
+
};
|
|
106
|
+
/** Configuração silenciosa para produção */
|
|
107
|
+
readonly production: {
|
|
108
|
+
readonly showWarnings: false;
|
|
109
|
+
readonly showSuggestions: false;
|
|
110
|
+
readonly showCategoriesTable: false;
|
|
111
|
+
readonly showBestPractices: false;
|
|
112
|
+
readonly showComplianceScore: false;
|
|
113
|
+
readonly minimumSeverity: "error";
|
|
114
|
+
};
|
|
115
|
+
/** Apenas erros críticos */
|
|
116
|
+
readonly minimal: {
|
|
117
|
+
readonly showWarnings: true;
|
|
118
|
+
readonly showSuggestions: false;
|
|
119
|
+
readonly showCategoriesTable: false;
|
|
120
|
+
readonly showBestPractices: false;
|
|
121
|
+
readonly showComplianceScore: false;
|
|
122
|
+
readonly minimumSeverity: "error";
|
|
123
|
+
};
|
|
124
|
+
/** Focado em conformidade LGPD */
|
|
125
|
+
readonly compliance: {
|
|
126
|
+
readonly showWarnings: true;
|
|
127
|
+
readonly showSuggestions: true;
|
|
128
|
+
readonly showCategoriesTable: true;
|
|
129
|
+
readonly showBestPractices: true;
|
|
130
|
+
readonly showComplianceScore: true;
|
|
131
|
+
readonly minimumSeverity: "warning";
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
37
135
|
/**
|
|
38
136
|
* @fileoverview
|
|
39
137
|
* Definições de tipos TypeScript para o sistema de consentimento LGPD/ANPD.
|
|
@@ -127,6 +225,61 @@ interface CategoryDefinition {
|
|
|
127
225
|
* @example ['_ga', '_ga_*', '_gid']
|
|
128
226
|
*/
|
|
129
227
|
cookies?: string[];
|
|
228
|
+
/**
|
|
229
|
+
* Metadados detalhados sobre cookies típicos desta categoria.
|
|
230
|
+
* Não exaustivo; serve para orientar UI e documentação.
|
|
231
|
+
*/
|
|
232
|
+
cookiesInfo?: CookieDescriptor[];
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Descritor de cookie com metadados úteis para UI/documentação.
|
|
236
|
+
* @category Types
|
|
237
|
+
* @since 0.2.0
|
|
238
|
+
*
|
|
239
|
+
* @remarks
|
|
240
|
+
* Mantém compatibilidade com abordagens comuns no mercado.
|
|
241
|
+
* Fornece informações detalhadas sobre cookies para exibição em interfaces
|
|
242
|
+
* e documentação de compliance.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* const cookieInfo: CookieDescriptor = {
|
|
247
|
+
* name: '_ga',
|
|
248
|
+
* purpose: 'analytics',
|
|
249
|
+
* duration: '2 years',
|
|
250
|
+
* domain: '.example.com',
|
|
251
|
+
* provider: 'Google Analytics'
|
|
252
|
+
* };
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* @public
|
|
256
|
+
*/
|
|
257
|
+
interface CookieDescriptor {
|
|
258
|
+
/**
|
|
259
|
+
* Identificador ou padrão do cookie.
|
|
260
|
+
* @example '_ga'
|
|
261
|
+
*/
|
|
262
|
+
name: string;
|
|
263
|
+
/**
|
|
264
|
+
* Finalidade do cookie (opcional).
|
|
265
|
+
* @example 'analytics'
|
|
266
|
+
*/
|
|
267
|
+
purpose?: string;
|
|
268
|
+
/**
|
|
269
|
+
* Tempo de retenção do cookie (opcional).
|
|
270
|
+
* @example '2 years'
|
|
271
|
+
*/
|
|
272
|
+
duration?: string;
|
|
273
|
+
/**
|
|
274
|
+
* Domínio associado ao cookie (opcional).
|
|
275
|
+
* @example '.example.com'
|
|
276
|
+
*/
|
|
277
|
+
domain?: string;
|
|
278
|
+
/**
|
|
279
|
+
* Provedor ou serviço associado ao cookie (opcional).
|
|
280
|
+
* @example 'Google Analytics'
|
|
281
|
+
*/
|
|
282
|
+
provider?: string;
|
|
130
283
|
}
|
|
131
284
|
/**
|
|
132
285
|
* Configuração de categorias ativas no projeto.
|
|
@@ -531,6 +684,7 @@ interface ConsentTexts {
|
|
|
531
684
|
* Opções para configuração do cookie de consentimento.
|
|
532
685
|
* @category Types
|
|
533
686
|
* @since 0.1.0
|
|
687
|
+
* @public
|
|
534
688
|
*/
|
|
535
689
|
interface ConsentCookieOptions {
|
|
536
690
|
/** Nome do cookie. Padrão: 'cookieConsent' */
|
|
@@ -544,53 +698,451 @@ interface ConsentCookieOptions {
|
|
|
544
698
|
/** Caminho do cookie. Padrão: '/' */
|
|
545
699
|
path: string;
|
|
546
700
|
}
|
|
701
|
+
/**
|
|
702
|
+
* Tipo alias para valores de espaçamento que suportam eixos x/y.
|
|
703
|
+
* @category Types
|
|
704
|
+
* @since 0.1.3
|
|
705
|
+
* @remarks
|
|
706
|
+
* Permite especificar espaçamento como string, número ou objeto com eixos x e y separados.
|
|
707
|
+
* Útil para configurações de padding e margin em design tokens.
|
|
708
|
+
* @example
|
|
709
|
+
* ```typescript
|
|
710
|
+
* const spacing: SpacingValue = { x: 10, y: 20 };
|
|
711
|
+
* ```
|
|
712
|
+
*/
|
|
713
|
+
type SpacingValue = string | number | {
|
|
714
|
+
x?: string | number;
|
|
715
|
+
y?: string | number;
|
|
716
|
+
};
|
|
717
|
+
/**
|
|
718
|
+
* Tipo alias para cores com variações.
|
|
719
|
+
* @category Types
|
|
720
|
+
* @since 0.1.3
|
|
721
|
+
* @remarks
|
|
722
|
+
* Suporta cor simples ou objeto com variações light, main, dark e contrastText.
|
|
723
|
+
* Compatível com sistemas de design que precisam de paletas completas.
|
|
724
|
+
* @example
|
|
725
|
+
* ```typescript
|
|
726
|
+
* const color: ColorVariant = { main: '#1976d2', dark: '#1565c0' };
|
|
727
|
+
* ```
|
|
728
|
+
*/
|
|
729
|
+
type ColorVariant = string | {
|
|
730
|
+
light?: string;
|
|
731
|
+
main?: string;
|
|
732
|
+
dark?: string;
|
|
733
|
+
contrastText?: string;
|
|
734
|
+
};
|
|
735
|
+
/**
|
|
736
|
+
* Tipo alias para altura com auto.
|
|
737
|
+
* @category Types
|
|
738
|
+
* @since 0.1.3
|
|
739
|
+
* @remarks
|
|
740
|
+
* Permite 'auto' ou qualquer string válida para altura CSS, com type safety.
|
|
741
|
+
* Evita valores inválidos através de interseção com Record<never, never>.
|
|
742
|
+
* @example
|
|
743
|
+
* ```typescript
|
|
744
|
+
* const height: HeightValue = 'auto';
|
|
745
|
+
* const customHeight: HeightValue = '100px';
|
|
746
|
+
* ```
|
|
747
|
+
*/
|
|
748
|
+
type HeightValue = 'auto' | (string & Record<never, never>);
|
|
749
|
+
/**
|
|
750
|
+
* Tipo alias para configuração de backdrop.
|
|
751
|
+
* @category Types
|
|
752
|
+
* @since 0.1.3
|
|
753
|
+
* @remarks
|
|
754
|
+
* Define configuração do backdrop como booleano simples, string de cor ou objeto detalhado
|
|
755
|
+
* com propriedades como enabled, color, blur e opacity para controle granular.
|
|
756
|
+
* @example
|
|
757
|
+
* ```typescript
|
|
758
|
+
* const backdrop: BackdropConfig = { enabled: true, color: 'rgba(0,0,0,0.5)', blur: '4px' };
|
|
759
|
+
* ```
|
|
760
|
+
*/
|
|
761
|
+
type BackdropConfig = boolean | string | {
|
|
762
|
+
enabled?: boolean;
|
|
763
|
+
color?: string;
|
|
764
|
+
blur?: string;
|
|
765
|
+
opacity?: number;
|
|
766
|
+
};
|
|
547
767
|
/**
|
|
548
768
|
* Tokens de design para customização visual avançada dos componentes.
|
|
769
|
+
*
|
|
770
|
+
* Sistema robusto de design tokens que permite controle granular sobre todos os aspectos
|
|
771
|
+
* visuais da biblioteca. Suporta responsive design, estados interativos, acessibilidade
|
|
772
|
+
* e temas dark/light.
|
|
773
|
+
*
|
|
549
774
|
* @category Types
|
|
550
775
|
* @since 0.1.3
|
|
551
|
-
*
|
|
776
|
+
* @version 0.4.1 - Expandido substancialmente com novos tokens
|
|
777
|
+
* @public
|
|
778
|
+
*
|
|
779
|
+
* @example Configuração básica
|
|
780
|
+
* ```tsx
|
|
781
|
+
* const tokens: DesignTokens = {
|
|
782
|
+
* colors: {
|
|
783
|
+
* primary: '#1976d2',
|
|
784
|
+
* background: '#ffffff',
|
|
785
|
+
* text: '#333333'
|
|
786
|
+
* }
|
|
787
|
+
* }
|
|
788
|
+
* ```
|
|
789
|
+
*
|
|
790
|
+
* @example Configuração avançada com responsive e estados
|
|
791
|
+
* ```tsx
|
|
792
|
+
* const advancedTokens: DesignTokens = {
|
|
793
|
+
* colors: {
|
|
794
|
+
* primary: { light: '#42a5f5', main: '#1976d2', dark: '#1565c0' },
|
|
795
|
+
* semantic: {
|
|
796
|
+
* error: '#f44336',
|
|
797
|
+
* warning: '#ff9800',
|
|
798
|
+
* success: '#4caf50',
|
|
799
|
+
* info: '#2196f3'
|
|
800
|
+
* }
|
|
801
|
+
* },
|
|
802
|
+
* spacing: {
|
|
803
|
+
* responsive: {
|
|
804
|
+
* mobile: { padding: '12px', margin: '8px' },
|
|
805
|
+
* tablet: { padding: '16px', margin: '12px' },
|
|
806
|
+
* desktop: { padding: '24px', margin: '16px' }
|
|
807
|
+
* }
|
|
808
|
+
* }
|
|
809
|
+
* }
|
|
810
|
+
* ```
|
|
552
811
|
*/
|
|
553
812
|
interface DesignTokens {
|
|
813
|
+
/**
|
|
814
|
+
* Sistema de cores expandido com suporte a variações e semântica
|
|
815
|
+
*/
|
|
554
816
|
colors?: {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
secondary?:
|
|
817
|
+
/** Cor primária da aplicação */
|
|
818
|
+
primary?: ColorVariant;
|
|
819
|
+
/** Cor secundária */
|
|
820
|
+
secondary?: ColorVariant;
|
|
821
|
+
/** Cor de fundo principal */
|
|
822
|
+
background?: string | {
|
|
823
|
+
main?: string;
|
|
824
|
+
paper?: string;
|
|
825
|
+
overlay?: string;
|
|
826
|
+
default?: string;
|
|
827
|
+
};
|
|
828
|
+
/** Cor do texto */
|
|
829
|
+
text?: string | {
|
|
830
|
+
primary?: string;
|
|
831
|
+
secondary?: string;
|
|
832
|
+
disabled?: string;
|
|
833
|
+
};
|
|
834
|
+
/** Cor da borda */
|
|
835
|
+
border?: ColorVariant;
|
|
836
|
+
/** Cores semânticas para estados */
|
|
837
|
+
semantic?: {
|
|
838
|
+
error?: string;
|
|
839
|
+
warning?: string;
|
|
840
|
+
success?: string;
|
|
841
|
+
info?: string;
|
|
842
|
+
};
|
|
843
|
+
/** Cores específicas para componentes */
|
|
844
|
+
components?: {
|
|
845
|
+
banner?: {
|
|
846
|
+
background?: string;
|
|
847
|
+
text?: string;
|
|
848
|
+
border?: string;
|
|
849
|
+
shadow?: string;
|
|
850
|
+
};
|
|
851
|
+
modal?: {
|
|
852
|
+
background?: string;
|
|
853
|
+
text?: string;
|
|
854
|
+
overlay?: string;
|
|
855
|
+
border?: string;
|
|
856
|
+
};
|
|
857
|
+
button?: {
|
|
858
|
+
primary?: {
|
|
859
|
+
background?: string;
|
|
860
|
+
text?: string;
|
|
861
|
+
hover?: string;
|
|
862
|
+
};
|
|
863
|
+
secondary?: {
|
|
864
|
+
background?: string;
|
|
865
|
+
text?: string;
|
|
866
|
+
hover?: string;
|
|
867
|
+
};
|
|
868
|
+
outlined?: {
|
|
869
|
+
border?: string;
|
|
870
|
+
text?: string;
|
|
871
|
+
hover?: string;
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
};
|
|
559
875
|
};
|
|
876
|
+
/**
|
|
877
|
+
* Sistema tipográfico completo com hierarquia e responsive
|
|
878
|
+
*/
|
|
560
879
|
typography?: {
|
|
561
|
-
|
|
880
|
+
/** Família de fontes principal */
|
|
881
|
+
fontFamily?: string | {
|
|
882
|
+
primary?: string;
|
|
883
|
+
secondary?: string;
|
|
884
|
+
monospace?: string;
|
|
885
|
+
};
|
|
886
|
+
/** Tamanhos de fonte com hierarchy */
|
|
562
887
|
fontSize?: {
|
|
563
|
-
banner
|
|
564
|
-
|
|
888
|
+
/** Tamanhos para banner */
|
|
889
|
+
banner?: {
|
|
890
|
+
title?: string;
|
|
891
|
+
message?: string;
|
|
892
|
+
button?: string;
|
|
893
|
+
};
|
|
894
|
+
/** Tamanhos para modal */
|
|
895
|
+
modal?: {
|
|
896
|
+
title?: string;
|
|
897
|
+
body?: string;
|
|
898
|
+
button?: string;
|
|
899
|
+
caption?: string;
|
|
900
|
+
};
|
|
901
|
+
/** Scale tipográfica */
|
|
902
|
+
scale?: {
|
|
903
|
+
xs?: string;
|
|
904
|
+
sm?: string;
|
|
905
|
+
base?: string;
|
|
906
|
+
lg?: string;
|
|
907
|
+
xl?: string;
|
|
908
|
+
'2xl'?: string;
|
|
909
|
+
'3xl'?: string;
|
|
910
|
+
};
|
|
911
|
+
/** Tamanhos específicos de cabeçalhos */
|
|
912
|
+
h1?: string;
|
|
913
|
+
h2?: string;
|
|
914
|
+
h3?: string;
|
|
915
|
+
h4?: string;
|
|
916
|
+
h5?: string;
|
|
917
|
+
h6?: string;
|
|
565
918
|
};
|
|
919
|
+
/** Pesos de fonte */
|
|
566
920
|
fontWeight?: {
|
|
921
|
+
light?: number;
|
|
567
922
|
normal?: number;
|
|
923
|
+
medium?: number;
|
|
924
|
+
semibold?: number;
|
|
568
925
|
bold?: number;
|
|
569
926
|
};
|
|
927
|
+
/** Altura de linha */
|
|
928
|
+
lineHeight?: {
|
|
929
|
+
tight?: number;
|
|
930
|
+
normal?: number;
|
|
931
|
+
relaxed?: number;
|
|
932
|
+
loose?: number;
|
|
933
|
+
};
|
|
934
|
+
/** Espaçamento de letras */
|
|
935
|
+
letterSpacing?: {
|
|
936
|
+
tight?: string;
|
|
937
|
+
normal?: string;
|
|
938
|
+
wide?: string;
|
|
939
|
+
};
|
|
570
940
|
};
|
|
941
|
+
/**
|
|
942
|
+
* Sistema de espaçamento e dimensões flexível
|
|
943
|
+
*/
|
|
571
944
|
spacing?: {
|
|
945
|
+
/** Valores diretos de espaçamento */
|
|
946
|
+
xs?: string | number;
|
|
947
|
+
sm?: string | number;
|
|
948
|
+
md?: string | number;
|
|
949
|
+
lg?: string | number;
|
|
950
|
+
xl?: string | number;
|
|
951
|
+
/** Escala de espaçamento base */
|
|
952
|
+
scale?: {
|
|
953
|
+
xs?: string | number;
|
|
954
|
+
sm?: string | number;
|
|
955
|
+
md?: string | number;
|
|
956
|
+
lg?: string | number;
|
|
957
|
+
xl?: string | number;
|
|
958
|
+
'2xl'?: string | number;
|
|
959
|
+
'3xl'?: string | number;
|
|
960
|
+
};
|
|
961
|
+
/** Padding específico por componente */
|
|
572
962
|
padding?: {
|
|
573
|
-
banner?:
|
|
574
|
-
modal?:
|
|
963
|
+
banner?: SpacingValue;
|
|
964
|
+
modal?: SpacingValue;
|
|
965
|
+
button?: SpacingValue;
|
|
575
966
|
};
|
|
967
|
+
/** Margem específica por componente */
|
|
968
|
+
margin?: {
|
|
969
|
+
banner?: SpacingValue;
|
|
970
|
+
modal?: SpacingValue;
|
|
971
|
+
button?: SpacingValue;
|
|
972
|
+
};
|
|
973
|
+
/** Bordas arredondadas */
|
|
576
974
|
borderRadius?: {
|
|
577
975
|
banner?: string | number;
|
|
578
976
|
modal?: string | number;
|
|
977
|
+
button?: string | number;
|
|
978
|
+
/** Scale de border radius */
|
|
979
|
+
scale?: {
|
|
980
|
+
none?: string | number;
|
|
981
|
+
sm?: string | number;
|
|
982
|
+
md?: string | number;
|
|
983
|
+
lg?: string | number;
|
|
984
|
+
xl?: string | number;
|
|
985
|
+
full?: string | number;
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
/** Configurações responsive */
|
|
989
|
+
responsive?: {
|
|
990
|
+
mobile?: {
|
|
991
|
+
padding?: string | number;
|
|
992
|
+
margin?: string | number;
|
|
993
|
+
borderRadius?: string | number;
|
|
994
|
+
};
|
|
995
|
+
tablet?: {
|
|
996
|
+
padding?: string | number;
|
|
997
|
+
margin?: string | number;
|
|
998
|
+
borderRadius?: string | number;
|
|
999
|
+
};
|
|
1000
|
+
desktop?: {
|
|
1001
|
+
padding?: string | number;
|
|
1002
|
+
margin?: string | number;
|
|
1003
|
+
borderRadius?: string | number;
|
|
1004
|
+
};
|
|
579
1005
|
};
|
|
580
1006
|
};
|
|
1007
|
+
/**
|
|
1008
|
+
* Configurações de layout e posicionamento
|
|
1009
|
+
*/
|
|
581
1010
|
layout?: {
|
|
582
|
-
|
|
1011
|
+
/** Posição do banner */
|
|
1012
|
+
position?: 'bottom' | 'top' | 'floating' | 'center';
|
|
1013
|
+
/** Larguras por breakpoint */
|
|
583
1014
|
width?: {
|
|
584
1015
|
mobile?: string;
|
|
1016
|
+
tablet?: string;
|
|
1017
|
+
desktop?: string;
|
|
1018
|
+
max?: string;
|
|
1019
|
+
};
|
|
1020
|
+
/** Alturas específicas */
|
|
1021
|
+
height?: {
|
|
1022
|
+
banner?: HeightValue;
|
|
1023
|
+
modal?: HeightValue;
|
|
1024
|
+
button?: HeightValue;
|
|
1025
|
+
};
|
|
1026
|
+
/** Configuração do backdrop */
|
|
1027
|
+
backdrop?: BackdropConfig;
|
|
1028
|
+
/** Z-index para layering */
|
|
1029
|
+
zIndex?: {
|
|
1030
|
+
banner?: number;
|
|
1031
|
+
modal?: number;
|
|
1032
|
+
backdrop?: number;
|
|
1033
|
+
floatingButton?: number;
|
|
1034
|
+
};
|
|
1035
|
+
/** Breakpoints customizados */
|
|
1036
|
+
breakpoints?: {
|
|
1037
|
+
mobile?: string;
|
|
1038
|
+
tablet?: string;
|
|
585
1039
|
desktop?: string;
|
|
1040
|
+
wide?: string;
|
|
1041
|
+
};
|
|
1042
|
+
/** Border radius para componentes */
|
|
1043
|
+
borderRadius?: string | number | {
|
|
1044
|
+
banner?: string | number;
|
|
1045
|
+
modal?: string | number;
|
|
1046
|
+
button?: string | number;
|
|
1047
|
+
scale?: {
|
|
1048
|
+
none?: string | number;
|
|
1049
|
+
sm?: string | number;
|
|
1050
|
+
md?: string | number;
|
|
1051
|
+
lg?: string | number;
|
|
1052
|
+
xl?: string | number;
|
|
1053
|
+
full?: string | number;
|
|
1054
|
+
};
|
|
1055
|
+
};
|
|
1056
|
+
};
|
|
1057
|
+
/**
|
|
1058
|
+
* Efeitos visuais e interações
|
|
1059
|
+
*/
|
|
1060
|
+
effects?: {
|
|
1061
|
+
/** Sombras */
|
|
1062
|
+
shadow?: {
|
|
1063
|
+
banner?: string;
|
|
1064
|
+
modal?: string;
|
|
1065
|
+
button?: string;
|
|
1066
|
+
/** Scale de sombras */
|
|
1067
|
+
scale?: {
|
|
1068
|
+
none?: string;
|
|
1069
|
+
sm?: string;
|
|
1070
|
+
md?: string;
|
|
1071
|
+
lg?: string;
|
|
1072
|
+
xl?: string;
|
|
1073
|
+
};
|
|
1074
|
+
};
|
|
1075
|
+
/** Transições e animações */
|
|
1076
|
+
transitions?: {
|
|
1077
|
+
duration?: {
|
|
1078
|
+
fast?: string;
|
|
1079
|
+
normal?: string;
|
|
1080
|
+
slow?: string;
|
|
1081
|
+
};
|
|
1082
|
+
easing?: {
|
|
1083
|
+
linear?: string;
|
|
1084
|
+
easeIn?: string;
|
|
1085
|
+
easeOut?: string;
|
|
1086
|
+
easeInOut?: string;
|
|
1087
|
+
};
|
|
1088
|
+
/** Transições específicas */
|
|
1089
|
+
banner?: {
|
|
1090
|
+
enter?: string;
|
|
1091
|
+
exit?: string;
|
|
1092
|
+
};
|
|
1093
|
+
modal?: {
|
|
1094
|
+
enter?: string;
|
|
1095
|
+
exit?: string;
|
|
1096
|
+
};
|
|
1097
|
+
};
|
|
1098
|
+
/** Blur e filtros */
|
|
1099
|
+
filters?: {
|
|
1100
|
+
backdrop?: string;
|
|
1101
|
+
disabled?: string;
|
|
1102
|
+
};
|
|
1103
|
+
};
|
|
1104
|
+
/**
|
|
1105
|
+
* Configurações de acessibilidade
|
|
1106
|
+
*/
|
|
1107
|
+
accessibility?: {
|
|
1108
|
+
/** Contraste mínimo */
|
|
1109
|
+
contrast?: {
|
|
1110
|
+
normal?: number;
|
|
1111
|
+
enhanced?: number;
|
|
1112
|
+
};
|
|
1113
|
+
/** Configurações para motion */
|
|
1114
|
+
motion?: {
|
|
1115
|
+
respectPreferences?: boolean;
|
|
1116
|
+
reducedMotion?: {
|
|
1117
|
+
duration?: string;
|
|
1118
|
+
easing?: string;
|
|
1119
|
+
};
|
|
586
1120
|
};
|
|
587
|
-
|
|
1121
|
+
/** Focus indicators */
|
|
1122
|
+
focus?: {
|
|
1123
|
+
color?: string;
|
|
1124
|
+
width?: string;
|
|
1125
|
+
style?: 'solid' | 'dashed' | 'dotted';
|
|
1126
|
+
offset?: string;
|
|
1127
|
+
};
|
|
1128
|
+
};
|
|
1129
|
+
/**
|
|
1130
|
+
* Temas e variações
|
|
1131
|
+
*/
|
|
1132
|
+
themes?: {
|
|
1133
|
+
/** Configurações específicas para tema claro */
|
|
1134
|
+
light?: Partial<Omit<DesignTokens, 'themes'>>;
|
|
1135
|
+
/** Configurações específicas para tema escuro */
|
|
1136
|
+
dark?: Partial<Omit<DesignTokens, 'themes'>>;
|
|
1137
|
+
/** Auto-detecção baseada no sistema */
|
|
1138
|
+
auto?: boolean;
|
|
588
1139
|
};
|
|
589
1140
|
}
|
|
590
1141
|
/**
|
|
591
1142
|
* Propriedades do componente ConsentProvider - configuração principal da biblioteca.
|
|
592
1143
|
* @category Types
|
|
593
1144
|
* @since 0.1.0
|
|
1145
|
+
* @public
|
|
594
1146
|
*
|
|
595
1147
|
* @example Uso básico (configuração mínima):
|
|
596
1148
|
* ```tsx
|
|
@@ -664,7 +1216,7 @@ interface ConsentProviderProps {
|
|
|
664
1216
|
* texts={{
|
|
665
1217
|
* controllerInfo: 'Controlado por: Empresa XYZ - CNPJ: 12.345.678/0001-90',
|
|
666
1218
|
* dataTypes: 'Coletamos: endereço IP, preferências de navegação',
|
|
667
|
-
* userRights: 'Você pode solicitar acesso, correção ou exclusão dos dados'
|
|
1219
|
+
* userRights: 'Você pode solicitar acesso, correção ou exclusão dos seus dados'
|
|
668
1220
|
* }}
|
|
669
1221
|
* ```
|
|
670
1222
|
*/
|
|
@@ -799,6 +1351,31 @@ interface ConsentProviderProps {
|
|
|
799
1351
|
* Por padrão, os avisos já são desabilitados em builds de produção.
|
|
800
1352
|
*/
|
|
801
1353
|
disableDeveloperGuidance?: boolean;
|
|
1354
|
+
/**
|
|
1355
|
+
* Desabilita o log automático de descoberta de cookies em modo desenvolvimento.
|
|
1356
|
+
* Mesmo com `disableDeveloperGuidance` ativado, por padrão a descoberta é logada uma vez para ajudar o mapeamento.
|
|
1357
|
+
* Use esta prop para suprimir também esse log experimental.
|
|
1358
|
+
* @since 0.4.1
|
|
1359
|
+
*/
|
|
1360
|
+
disableDiscoveryLog?: boolean;
|
|
1361
|
+
/**
|
|
1362
|
+
* Configuração avançada para o sistema de developer guidance.
|
|
1363
|
+
* Permite controle granular sobre quais tipos de guias são exibidos e como.
|
|
1364
|
+
* @since 0.4.1
|
|
1365
|
+
* @example
|
|
1366
|
+
* ```tsx
|
|
1367
|
+
* // Usar preset de desenvolvimento
|
|
1368
|
+
* guidanceConfig={GUIDANCE_PRESETS.development}
|
|
1369
|
+
*
|
|
1370
|
+
* // Configuração personalizada
|
|
1371
|
+
* guidanceConfig={{
|
|
1372
|
+
* showWarnings: true,
|
|
1373
|
+
* showComplianceScore: true,
|
|
1374
|
+
* minimumSeverity: 'warning'
|
|
1375
|
+
* }}
|
|
1376
|
+
* ```
|
|
1377
|
+
*/
|
|
1378
|
+
guidanceConfig?: GuidanceConfig;
|
|
802
1379
|
/** Elementos filhos - toda a aplicação que precisa de contexto de consentimento. */
|
|
803
1380
|
children: React.ReactNode;
|
|
804
1381
|
}
|
|
@@ -806,6 +1383,7 @@ interface ConsentProviderProps {
|
|
|
806
1383
|
* Props esperadas por um componente customizado de CookieBanner.
|
|
807
1384
|
* @category Types
|
|
808
1385
|
* @since 0.3.1
|
|
1386
|
+
* @public
|
|
809
1387
|
* Fornece acesso ao estado de consentimento e ações necessárias para o banner.
|
|
810
1388
|
*/
|
|
811
1389
|
interface CustomCookieBannerProps {
|
|
@@ -825,6 +1403,7 @@ interface CustomCookieBannerProps {
|
|
|
825
1403
|
* Props esperadas por um componente customizado de PreferencesModal.
|
|
826
1404
|
* @category Types
|
|
827
1405
|
* @since 0.3.1
|
|
1406
|
+
* @public
|
|
828
1407
|
*
|
|
829
1408
|
* Fornece acesso às preferências atuais do usuário, funções para atualizar e salvar preferências,
|
|
830
1409
|
* fechar o modal e textos customizados da interface.
|
|
@@ -846,6 +1425,7 @@ interface CustomPreferencesModalProps {
|
|
|
846
1425
|
* Props esperadas por um componente customizado de FloatingPreferencesButton.
|
|
847
1426
|
* @category Types
|
|
848
1427
|
* @since 0.3.1
|
|
1428
|
+
* @public
|
|
849
1429
|
* Fornece acesso às ações de abertura do modal e ao estado de consentimento.
|
|
850
1430
|
*/
|
|
851
1431
|
interface CustomFloatingPreferencesButtonProps {
|
|
@@ -856,6 +1436,7 @@ interface CustomFloatingPreferencesButtonProps {
|
|
|
856
1436
|
* Valor do contexto de consentimento, incluindo estado e métodos de manipulação.
|
|
857
1437
|
* @category Types
|
|
858
1438
|
* @since 0.1.0
|
|
1439
|
+
* @public
|
|
859
1440
|
*/
|
|
860
1441
|
interface ConsentContextValue {
|
|
861
1442
|
/** Indica se o usuário consentiu. */
|
|
@@ -868,8 +1449,28 @@ interface ConsentContextValue {
|
|
|
868
1449
|
acceptAll: () => void;
|
|
869
1450
|
/** Rejeita todas as categorias de consentimento. */
|
|
870
1451
|
rejectAll: () => void;
|
|
871
|
-
/**
|
|
872
|
-
|
|
1452
|
+
/**
|
|
1453
|
+
* Define a preferência para uma categoria específica.
|
|
1454
|
+
* Suporta tanto categorias predefinidas quanto customizadas.
|
|
1455
|
+
*
|
|
1456
|
+
* @param cat - ID da categoria (predefinida ou customizada)
|
|
1457
|
+
* @param value - Valor do consentimento para a categoria
|
|
1458
|
+
*
|
|
1459
|
+
* @breakingChange
|
|
1460
|
+
* **v0.4.1**: Parâmetro `cat` mudou de `Category` para `string` para suportar
|
|
1461
|
+
* categorias customizadas. O uso com strings literais continua funcionando.
|
|
1462
|
+
*
|
|
1463
|
+
* @example
|
|
1464
|
+
* ```typescript
|
|
1465
|
+
* // ✅ Continua funcionando (categorias predefinidas)
|
|
1466
|
+
* setPreference('analytics', true)
|
|
1467
|
+
* setPreference('marketing', false)
|
|
1468
|
+
*
|
|
1469
|
+
* // ✅ Novo: categorias customizadas
|
|
1470
|
+
* setPreference('custom-tracking', true)
|
|
1471
|
+
* ```
|
|
1472
|
+
*/
|
|
1473
|
+
setPreference: (cat: string, value: boolean) => void;
|
|
873
1474
|
/** Define múltiplas preferências de uma vez e salva. */
|
|
874
1475
|
setPreferences: (preferences: ConsentPreferences) => void;
|
|
875
1476
|
/** Abre o modal de preferências. */
|
|
@@ -927,7 +1528,7 @@ interface ConsentContextValue {
|
|
|
927
1528
|
* </ConsentProvider>
|
|
928
1529
|
* ```
|
|
929
1530
|
*/
|
|
930
|
-
declare function ConsentProvider({ initialState, categories, texts: textsProp, theme, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
1531
|
+
declare function ConsentProvider({ initialState, categories, texts: textsProp, theme, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, guidanceConfig, children, disableDiscoveryLog, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
|
|
931
1532
|
declare const defaultTexts: ConsentTexts;
|
|
932
1533
|
|
|
933
1534
|
/**
|
|
@@ -1370,197 +1971,73 @@ declare function useConsentTexts(): ConsentTexts;
|
|
|
1370
1971
|
*/
|
|
1371
1972
|
declare function useConsentHydration(): boolean;
|
|
1372
1973
|
/**
|
|
1373
|
-
*
|
|
1374
|
-
* @hook
|
|
1974
|
+
* @function
|
|
1375
1975
|
* @category Hooks
|
|
1376
|
-
* @since 0.3.1
|
|
1377
|
-
*
|
|
1378
|
-
* Este hook oferece uma maneira ReactJS-idiomática de abrir o modal de preferências
|
|
1379
|
-
* em qualquer lugar da aplicação. Diferente do botão flutuante padrão, permite
|
|
1380
|
-
* controle total sobre quando e como o modal é acionado.
|
|
1381
|
-
*
|
|
1382
|
-
* ### Casos de Uso Principais
|
|
1383
|
-
* - **Links no footer/header**: "Configurações de Cookies", "Preferências"
|
|
1384
|
-
* - **Botões customizados**: Design próprio para abrir preferências
|
|
1385
|
-
* - **Fluxos condicionais**: Abrir modal baseado em ações do usuário
|
|
1386
|
-
* - **Integração com menus**: Adicionar item de menu para configurações
|
|
1387
|
-
*
|
|
1388
|
-
* ### Vantagens sobre função global
|
|
1389
|
-
* - **Type-safe**: TypeScript com tipagem completa
|
|
1390
|
-
* - **React-friendly**: Integra com ciclo de vida dos componentes
|
|
1391
|
-
* - **Automático**: Sem necessidade de verificar se ConsentProvider existe
|
|
1392
|
-
* - **Testável**: Fácil de mockar em testes unitários
|
|
1393
|
-
*
|
|
1394
|
-
* ### Performance
|
|
1395
|
-
* - Função estável: não causa re-renders quando usada como dependency
|
|
1396
|
-
* - Memoizada internamente para otimização
|
|
1397
|
-
* - Sem overhead: apenas proxy para ação interna do contexto
|
|
1398
|
-
*
|
|
1399
|
-
* @returns Uma função estável que abre o modal de preferências quando chamada
|
|
1400
|
-
*
|
|
1401
|
-
* @throws {Error} Se usado fora do ConsentProvider - verifique se está dentro de `<ConsentProvider>`
|
|
1402
|
-
*
|
|
1403
|
-
* @example Hook básico no footer
|
|
1404
|
-
* ```tsx
|
|
1405
|
-
* function MeuFooter() {
|
|
1406
|
-
* const abrirModal = useOpenPreferencesModal();
|
|
1407
|
-
*
|
|
1408
|
-
* return (
|
|
1409
|
-
* <footer>
|
|
1410
|
-
* <a href="#" onClick={abrirModal}>
|
|
1411
|
-
* Configurações de Cookies
|
|
1412
|
-
* </a>
|
|
1413
|
-
* </footer>
|
|
1414
|
-
* );
|
|
1415
|
-
* }
|
|
1416
|
-
* ```
|
|
1976
|
+
* @since 0.3.1
|
|
1977
|
+
* Hook para abrir o modal de preferências programaticamente.
|
|
1417
1978
|
*
|
|
1418
|
-
* @
|
|
1419
|
-
* ```tsx
|
|
1420
|
-
* import { Settings } from '@mui/icons-material';
|
|
1979
|
+
* @returns Função para abrir o modal de preferências.
|
|
1421
1980
|
*
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
1981
|
+
* @remarks
|
|
1982
|
+
* Este hook retorna uma função que pode ser usada para abrir o modal de preferências
|
|
1983
|
+
* de qualquer lugar dentro do contexto do ConsentProvider. É útil para criar botões
|
|
1984
|
+
* customizados ou trigger o modal baseado em eventos específicos.
|
|
1424
1985
|
*
|
|
1425
|
-
*
|
|
1426
|
-
* <button
|
|
1427
|
-
* onClick={openModal}
|
|
1428
|
-
* className="preferences-btn"
|
|
1429
|
-
* aria-label="Configurar cookies"
|
|
1430
|
-
* >
|
|
1431
|
-
* <Settings /> Cookies
|
|
1432
|
-
* </button>
|
|
1433
|
-
* );
|
|
1434
|
-
* }
|
|
1435
|
-
* ```
|
|
1986
|
+
* @throws {Error} Se usado fora do ConsentProvider
|
|
1436
1987
|
*
|
|
1437
|
-
* @example
|
|
1988
|
+
* @example
|
|
1438
1989
|
* ```tsx
|
|
1439
|
-
* function
|
|
1990
|
+
* function CustomButton() {
|
|
1440
1991
|
* const openPreferences = useOpenPreferencesModal();
|
|
1441
|
-
* const [menuOpen, setMenuOpen] = useState(false);
|
|
1442
1992
|
*
|
|
1443
1993
|
* return (
|
|
1444
|
-
* <
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1447
|
-
* </button>
|
|
1448
|
-
* {menuOpen && (
|
|
1449
|
-
* <ul>
|
|
1450
|
-
* <li><a href="/profile">Meu Perfil</a></li>
|
|
1451
|
-
* <li><a href="/settings">Configurações</a></li>
|
|
1452
|
-
* <li>
|
|
1453
|
-
* <button onClick={openPreferences}>
|
|
1454
|
-
* Preferências de Cookies
|
|
1455
|
-
* </button>
|
|
1456
|
-
* </li>
|
|
1457
|
-
* </ul>
|
|
1458
|
-
* )}
|
|
1459
|
-
* </div>
|
|
1994
|
+
* <button onClick={openPreferences}>
|
|
1995
|
+
* Configurar Cookies
|
|
1996
|
+
* </button>
|
|
1460
1997
|
* );
|
|
1461
1998
|
* }
|
|
1462
1999
|
* ```
|
|
2000
|
+
*/
|
|
2001
|
+
declare function useOpenPreferencesModal(): () => void;
|
|
2002
|
+
/**
|
|
2003
|
+
* @function
|
|
2004
|
+
* @category Utils
|
|
2005
|
+
* @since 0.3.1
|
|
2006
|
+
* Função global para abrir o modal de preferências de fora do contexto React.
|
|
1463
2007
|
*
|
|
1464
|
-
* @
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
*
|
|
1468
|
-
* const navigate = useNavigate(); // React Router
|
|
1469
|
-
*
|
|
1470
|
-
* React.useEffect(() => {
|
|
1471
|
-
* // Abre modal automaticamente na página de configurações
|
|
1472
|
-
* openModal();
|
|
1473
|
-
* }, [openModal]);
|
|
1474
|
-
*
|
|
1475
|
-
* const handleModalClose = () => {
|
|
1476
|
-
* // Volta para página anterior quando modal fechar
|
|
1477
|
-
* navigate(-1);
|
|
1478
|
-
* };
|
|
1479
|
-
*
|
|
1480
|
-
* return <div>Configurações de cookies carregando...</div>;
|
|
1481
|
-
* }
|
|
1482
|
-
* ```
|
|
2008
|
+
* @remarks
|
|
2009
|
+
* Esta função permite abrir o modal de preferências de código JavaScript puro,
|
|
2010
|
+
* sem precisar estar dentro do contexto React. É útil para integração com
|
|
2011
|
+
* código legado ou bibliotecas de terceiros.
|
|
1483
2012
|
*
|
|
1484
|
-
*
|
|
1485
|
-
*
|
|
1486
|
-
* function SmartCookieButton() {
|
|
1487
|
-
* const { consented } = useConsent();
|
|
1488
|
-
* const openPreferences = useOpenPreferencesModal();
|
|
2013
|
+
* A função é automaticamente registrada pelo ConsentProvider e limpa quando
|
|
2014
|
+
* o provider é desmontado.
|
|
1489
2015
|
*
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
2016
|
+
* @example
|
|
2017
|
+
* ```javascript
|
|
2018
|
+
* // Em código JavaScript puro
|
|
2019
|
+
* window.openPreferencesModal?.();
|
|
1494
2020
|
*
|
|
1495
|
-
*
|
|
1496
|
-
*
|
|
1497
|
-
*
|
|
1498
|
-
* className={consented ? 'modify-btn' : 'setup-btn'}
|
|
1499
|
-
* >
|
|
1500
|
-
* {buttonIcon} {buttonText}
|
|
1501
|
-
* </button>
|
|
1502
|
-
* );
|
|
1503
|
-
* }
|
|
2021
|
+
* // Ou importando diretamente
|
|
2022
|
+
* import { openPreferencesModal } from 'react-lgpd-consent';
|
|
2023
|
+
* openPreferencesModal();
|
|
1504
2024
|
* ```
|
|
1505
2025
|
*/
|
|
1506
|
-
declare function useOpenPreferencesModal(): () => void;
|
|
1507
2026
|
declare function openPreferencesModal(): void;
|
|
1508
2027
|
|
|
1509
2028
|
/**
|
|
1510
|
-
* @interface
|
|
1511
|
-
*
|
|
2029
|
+
* @interface CategoriesContextValue
|
|
2030
|
+
* O valor fornecido pelo `CategoriesContext`, contendo informações sobre as categorias de cookies ativas no projeto.
|
|
1512
2031
|
*/
|
|
1513
|
-
interface
|
|
1514
|
-
/**
|
|
1515
|
-
|
|
1516
|
-
/**
|
|
1517
|
-
|
|
1518
|
-
/** Um array de
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
description: string;
|
|
1523
|
-
essential: boolean;
|
|
1524
|
-
uiRequired: boolean;
|
|
1525
|
-
}[];
|
|
1526
|
-
/** Indica se a configuração padrão da biblioteca está sendo utilizada (quando nenhuma configuração explícita é fornecida). */
|
|
1527
|
-
usingDefaults: boolean;
|
|
1528
|
-
}
|
|
1529
|
-
/**
|
|
1530
|
-
* @constant
|
|
1531
|
-
* @category Utils
|
|
1532
|
-
* @since 0.2.2
|
|
1533
|
-
* Configuração padrão de categorias de cookies utilizada quando o desenvolvedor não especifica nenhuma configuração.
|
|
1534
|
-
* Inclui apenas a categoria 'analytics' além da 'necessary' (que é sempre incluída).
|
|
1535
|
-
*/
|
|
1536
|
-
declare const DEFAULT_PROJECT_CATEGORIES: ProjectCategoriesConfig;
|
|
1537
|
-
/**
|
|
1538
|
-
* @function
|
|
1539
|
-
* @category Utils
|
|
1540
|
-
* @since 0.2.2
|
|
1541
|
-
* Analisa a configuração de categorias do projeto e gera um objeto de orientação para o desenvolvedor.
|
|
1542
|
-
* Este objeto contém avisos, sugestões e informações detalhadas sobre as categorias ativas.
|
|
1543
|
-
*
|
|
1544
|
-
* @param {ProjectCategoriesConfig} [config] A configuração de categorias fornecida pelo desenvolvedor. Se não for fornecida, a configuração padrão será utilizada.
|
|
1545
|
-
* @returns {DeveloperGuidance} Um objeto `DeveloperGuidance` com a análise da configuração.
|
|
1546
|
-
*
|
|
1547
|
-
* Since v0.4.0: inclui `customCategories` em `activeCategoriesInfo` (com `uiRequired=false` se `essential=true`).
|
|
1548
|
-
*/
|
|
1549
|
-
declare function analyzeDeveloperConfiguration(config?: ProjectCategoriesConfig): DeveloperGuidance;
|
|
1550
|
-
|
|
1551
|
-
/**
|
|
1552
|
-
* @interface CategoriesContextValue
|
|
1553
|
-
* O valor fornecido pelo `CategoriesContext`, contendo informações sobre as categorias de cookies ativas no projeto.
|
|
1554
|
-
*/
|
|
1555
|
-
interface CategoriesContextValue {
|
|
1556
|
-
/** A configuração final das categorias, incluindo padrões aplicados. */
|
|
1557
|
-
config: ProjectCategoriesConfig;
|
|
1558
|
-
/** Análise e orientações para desenvolvedores, incluindo avisos e sugestões. */
|
|
1559
|
-
guidance: DeveloperGuidance;
|
|
1560
|
-
/** Um array de categorias que requerem um toggle na UI de preferências (não essenciais). */
|
|
1561
|
-
toggleableCategories: DeveloperGuidance['activeCategoriesInfo'];
|
|
1562
|
-
/** Um array contendo todas as categorias ativas no projeto (essenciais e não essenciais). */
|
|
1563
|
-
allCategories: DeveloperGuidance['activeCategoriesInfo'];
|
|
2032
|
+
interface CategoriesContextValue {
|
|
2033
|
+
/** A configuração final das categorias, incluindo padrões aplicados. */
|
|
2034
|
+
config: ProjectCategoriesConfig;
|
|
2035
|
+
/** Análise e orientações para desenvolvedores, incluindo avisos e sugestões. */
|
|
2036
|
+
guidance: DeveloperGuidance;
|
|
2037
|
+
/** Um array de categorias que requerem um toggle na UI de preferências (não essenciais). */
|
|
2038
|
+
toggleableCategories: DeveloperGuidance['activeCategoriesInfo'];
|
|
2039
|
+
/** Um array contendo todas as categorias ativas no projeto (essenciais e não essenciais). */
|
|
2040
|
+
allCategories: DeveloperGuidance['activeCategoriesInfo'];
|
|
1564
2041
|
}
|
|
1565
2042
|
/**
|
|
1566
2043
|
* @hook
|
|
@@ -1611,6 +2088,15 @@ declare function ConsentGate(props: Readonly<{
|
|
|
1611
2088
|
children: React$1.ReactNode;
|
|
1612
2089
|
}>): react_jsx_runtime.JSX.Element | null;
|
|
1613
2090
|
|
|
2091
|
+
/** @module src/utils/scriptLoader */
|
|
2092
|
+
/**
|
|
2093
|
+
* @category Utils
|
|
2094
|
+
* @since 0.1.0
|
|
2095
|
+
* Utilitários para carregamento dinâmico e seguro de scripts externos no DOM.
|
|
2096
|
+
*
|
|
2097
|
+
* Fornece funções para carregar scripts de terceiros de forma condicional ao consentimento LGPD,
|
|
2098
|
+
* garantindo compatibilidade SSR e verificações de permissões por categoria.
|
|
2099
|
+
*/
|
|
1614
2100
|
/**
|
|
1615
2101
|
* @function
|
|
1616
2102
|
* @category Utils
|
|
@@ -1624,7 +2110,7 @@ declare function ConsentGate(props: Readonly<{
|
|
|
1624
2110
|
*
|
|
1625
2111
|
* @param {string} id Um identificador único para o elemento `<script>` a ser criado.
|
|
1626
2112
|
* @param {string} src A URL do script externo a ser carregado.
|
|
1627
|
-
* @param {
|
|
2113
|
+
* @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.
|
|
1628
2114
|
* @param {Record<string, string>} [attrs={}] Atributos adicionais a serem aplicados ao elemento `<script>` (ex: `{ async: 'true' }`).
|
|
1629
2115
|
* @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.
|
|
1630
2116
|
* @example
|
|
@@ -1635,11 +2121,64 @@ declare function ConsentGate(props: Readonly<{
|
|
|
1635
2121
|
* .catch(error => console.error('Erro ao carregar script:', error))
|
|
1636
2122
|
* ```
|
|
1637
2123
|
*/
|
|
2124
|
+
declare function loadScript(id: string, src: string, category?: string | null, attrs?: Record<string, string>): Promise<void>;
|
|
1638
2125
|
|
|
1639
|
-
|
|
2126
|
+
/**
|
|
2127
|
+
* Utilitários para descoberta e categorização de cookies em tempo de execução (experimental).
|
|
2128
|
+
*
|
|
2129
|
+
* Fornece funções para detectar cookies presentes no navegador, identificar o cookie de consentimento
|
|
2130
|
+
* e atribuir cookies descobertos a categorias LGPD usando heurísticas baseadas em padrões conhecidos.
|
|
2131
|
+
*
|
|
2132
|
+
* @category Utils
|
|
2133
|
+
* @since 0.4.1
|
|
2134
|
+
* @remarks Funcionalidades experimentais para auxiliar no mapeamento de cookies em conformidade com LGPD.
|
|
2135
|
+
* Recomenda-se uso em desenvolvimento para inspeção manual e merge com catálogo existente.
|
|
2136
|
+
*/
|
|
1640
2137
|
|
|
1641
2138
|
/**
|
|
1642
|
-
*
|
|
2139
|
+
* Descobre cookies em tempo de execução no navegador (experimental).
|
|
2140
|
+
*
|
|
2141
|
+
* - Lê `document.cookie` com segurança (SSR-safe)
|
|
2142
|
+
* - Retorna lista de cookies detectados (apenas nomes)
|
|
2143
|
+
* - Salva em `globalThis.__LGPD_DISCOVERED_COOKIES__` para inspeção/manual merge
|
|
2144
|
+
*
|
|
2145
|
+
* @category Utils
|
|
2146
|
+
* @since 0.4.1
|
|
2147
|
+
*/
|
|
2148
|
+
declare function discoverRuntimeCookies(): CookieDescriptor[];
|
|
2149
|
+
/**
|
|
2150
|
+
* Tenta detectar o nome do cookie de consentimento pela estrutura JSON armazenada.
|
|
2151
|
+
* Retorna o nome se for encontrado, caso contrário `null`.
|
|
2152
|
+
* @category Utils
|
|
2153
|
+
* @since 0.4.1
|
|
2154
|
+
*/
|
|
2155
|
+
declare function detectConsentCookieName(): string | null;
|
|
2156
|
+
/**
|
|
2157
|
+
* Heurística simples para atribuir cookies descobertos a categorias LGPD (experimental).
|
|
2158
|
+
*
|
|
2159
|
+
* - Usa padrões conhecidos por categoria
|
|
2160
|
+
* - Ignora `cookieConsent` (já tratado como necessary)
|
|
2161
|
+
* - Pode opcionalmente registrar overrides de catálogo por categoria
|
|
2162
|
+
*
|
|
2163
|
+
* @param discovered Lista de cookies descobertos (opcional: usa global se ausente)
|
|
2164
|
+
* @param registerOverrides Se `true`, registra em `setCookieCatalogOverrides`
|
|
2165
|
+
* @returns Mapa categoria -> descritores atribuídos
|
|
2166
|
+
* @category Utils
|
|
2167
|
+
* @since 0.4.1
|
|
2168
|
+
*/
|
|
2169
|
+
declare function categorizeDiscoveredCookies(discovered?: CookieDescriptor[], registerOverrides?: boolean): Record<Category, CookieDescriptor[]>;
|
|
2170
|
+
|
|
2171
|
+
/** @module src/utils/theme */
|
|
2172
|
+
/**
|
|
2173
|
+
* @category Utils
|
|
2174
|
+
* @since 0.1.0
|
|
2175
|
+
* Utilitários para criação e gerenciamento de temas Material-UI para componentes de consentimento LGPD.
|
|
2176
|
+
*
|
|
2177
|
+
* Fornece um tema padrão consistente e acessível, com opções de personalização.
|
|
2178
|
+
*/
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* @function
|
|
1643
2182
|
* @category Utils
|
|
1644
2183
|
* @since 0.1.0
|
|
1645
2184
|
* Tema padrão utilizado pelos componentes de consentimento da biblioteca.
|
|
@@ -1647,6 +2186,16 @@ declare function loadScript(id: string, src: string, category?: Category | null,
|
|
|
1647
2186
|
* Inclui configurações de cores, tipografia e estilos para componentes Material-UI,
|
|
1648
2187
|
* garantindo aparência consistente e acessível conforme guidelines LGPD.
|
|
1649
2188
|
*
|
|
2189
|
+
* @returns {Theme} Instância do tema Material-UI configurado.
|
|
2190
|
+
*
|
|
2191
|
+
* @example
|
|
2192
|
+
* ```typescript
|
|
2193
|
+
* import { createDefaultConsentTheme } from 'react-lgpd-consent'
|
|
2194
|
+
*
|
|
2195
|
+
* const theme = createDefaultConsentTheme()
|
|
2196
|
+
* // Use com ThemeProvider
|
|
2197
|
+
* ```
|
|
2198
|
+
*
|
|
1650
2199
|
* @remarks
|
|
1651
2200
|
* Pode ser sobrescrito via ThemeProvider externo se necessário.
|
|
1652
2201
|
*/
|
|
@@ -1657,99 +2206,225 @@ declare function createDefaultConsentTheme(): Theme;
|
|
|
1657
2206
|
* @deprecated Use `createDefaultConsentTheme()` em vez de importar um tema criado no escopo do módulo.
|
|
1658
2207
|
* Importar um tema já instanciado pode causar side-effects em SSR e conflitos de contexto.
|
|
1659
2208
|
* Esta função retorna uma nova instância do tema quando chamada.
|
|
2209
|
+
*
|
|
2210
|
+
* @returns {Theme} Instância do tema Material-UI configurado.
|
|
2211
|
+
*
|
|
2212
|
+
* @example
|
|
2213
|
+
* ```typescript
|
|
2214
|
+
* import { defaultConsentTheme } from 'react-lgpd-consent'
|
|
2215
|
+
*
|
|
2216
|
+
* const theme = defaultConsentTheme()
|
|
2217
|
+
* // Deprecated, use createDefaultConsentTheme instead
|
|
2218
|
+
* ```
|
|
1660
2219
|
*/
|
|
1661
2220
|
declare const defaultConsentTheme: () => Theme;
|
|
1662
2221
|
|
|
1663
2222
|
/**
|
|
1664
|
-
* @
|
|
1665
|
-
*
|
|
2223
|
+
* @fileoverview
|
|
2224
|
+
* Integrações nativas de scripts (GA, GTM, Facebook Pixel, Hotjar, Mixpanel, Clarity, Intercom, Zendesk, UserWay)
|
|
2225
|
+
* com categorias LGPD padrão, cookies típicos e pontos de extensão para URLs.
|
|
2226
|
+
*
|
|
2227
|
+
* Princípios:
|
|
2228
|
+
* - Cada integração define uma categoria padrão (mais aderente ao uso no mercado)
|
|
2229
|
+
* - Cada cookie típico aparece em uma única categoria por padrão
|
|
2230
|
+
* - URLs possuem valores default atualizados e podem ser sobrescritos via `scriptUrl`
|
|
2231
|
+
* - SSR-safe: toda execução que toca `window` é protegida
|
|
2232
|
+
*/
|
|
2233
|
+
/**
|
|
2234
|
+
* Integração de script de terceiros condicionada a consentimento.
|
|
2235
|
+
*
|
|
2236
|
+
* @category Utils
|
|
2237
|
+
* @since 0.2.0
|
|
1666
2238
|
*
|
|
1667
2239
|
* @remarks
|
|
1668
|
-
*
|
|
1669
|
-
*
|
|
1670
|
-
*
|
|
2240
|
+
* **Breaking Change em v0.4.1**: O campo `category` mudou de `Category` para `string`
|
|
2241
|
+
* para suportar categorias customizadas. Código existente usando strings literais
|
|
2242
|
+
* continua funcionando sem alterações.
|
|
2243
|
+
*
|
|
2244
|
+
* @example
|
|
2245
|
+
* ```typescript
|
|
2246
|
+
* const integration: ScriptIntegration = {
|
|
2247
|
+
* id: 'my-script',
|
|
2248
|
+
* category: 'analytics',
|
|
2249
|
+
* src: 'https://example.com/script.js',
|
|
2250
|
+
* cookies: ['_example'],
|
|
2251
|
+
* init: () => console.log('Script initialized')
|
|
2252
|
+
* }
|
|
2253
|
+
* ```
|
|
1671
2254
|
*/
|
|
1672
|
-
|
|
1673
2255
|
interface ScriptIntegration {
|
|
1674
|
-
/**
|
|
2256
|
+
/** Identificador único da integração */
|
|
1675
2257
|
id: string;
|
|
1676
|
-
/**
|
|
1677
|
-
|
|
1678
|
-
|
|
2258
|
+
/**
|
|
2259
|
+
* Categoria LGPD à qual o script pertence.
|
|
2260
|
+
* Suporta tanto categorias predefinidas quanto customizadas.
|
|
2261
|
+
*/
|
|
2262
|
+
category: string;
|
|
2263
|
+
/** Nome legível da integração (opcional) */
|
|
2264
|
+
name?: string;
|
|
2265
|
+
/** URL do script a ser carregado */
|
|
1679
2266
|
src: string;
|
|
1680
|
-
/**
|
|
2267
|
+
/** Se o script deve ser carregado de forma assíncrona */
|
|
2268
|
+
async?: boolean;
|
|
2269
|
+
/** Se o script deve ser deferido */
|
|
2270
|
+
defer?: boolean;
|
|
2271
|
+
/** Configuração específica da integração */
|
|
2272
|
+
config?: Record<string, unknown>;
|
|
2273
|
+
/** Função de inicialização executada após carregamento do script */
|
|
1681
2274
|
init?: () => void;
|
|
1682
|
-
/**
|
|
2275
|
+
/** Atributos HTML adicionais para a tag script */
|
|
1683
2276
|
attrs?: Record<string, string>;
|
|
2277
|
+
/** Lista de cookies que o script pode definir */
|
|
2278
|
+
cookies?: string[];
|
|
2279
|
+
/** Informações detalhadas dos cookies (nome, finalidade, duração, fornecedor) */
|
|
2280
|
+
cookiesInfo?: Array<{
|
|
2281
|
+
name: string;
|
|
2282
|
+
purpose: string;
|
|
2283
|
+
duration: string;
|
|
2284
|
+
provider: string;
|
|
2285
|
+
}>;
|
|
1684
2286
|
}
|
|
1685
2287
|
/**
|
|
1686
|
-
*
|
|
1687
|
-
*
|
|
2288
|
+
* Configuração para integração do Google Analytics (GA4).
|
|
2289
|
+
*
|
|
2290
|
+
* @category Utils
|
|
2291
|
+
* @since 0.2.0
|
|
2292
|
+
*
|
|
2293
|
+
* @example
|
|
2294
|
+
* ```typescript
|
|
2295
|
+
* const config: GoogleAnalyticsConfig = {
|
|
2296
|
+
* measurementId: 'G-XXXXXXXXXX',
|
|
2297
|
+
* config: { anonymize_ip: true }
|
|
2298
|
+
* }
|
|
2299
|
+
* ```
|
|
1688
2300
|
*/
|
|
1689
2301
|
interface GoogleAnalyticsConfig {
|
|
1690
|
-
/**
|
|
2302
|
+
/** ID de medição do GA4 (formato: G-XXXXXXXXXX) */
|
|
1691
2303
|
measurementId: string;
|
|
1692
|
-
/**
|
|
2304
|
+
/** Configurações adicionais para o gtag */
|
|
1693
2305
|
config?: Record<string, unknown>;
|
|
2306
|
+
/** URL do script GA4. Se omitido usa o padrão oficial. */
|
|
2307
|
+
scriptUrl?: string;
|
|
1694
2308
|
}
|
|
1695
2309
|
/**
|
|
1696
|
-
*
|
|
1697
|
-
*
|
|
2310
|
+
* Configuração para integração do Google Tag Manager (GTM).
|
|
2311
|
+
*
|
|
2312
|
+
* @category Utils
|
|
2313
|
+
* @since 0.2.0
|
|
2314
|
+
*
|
|
2315
|
+
* @example
|
|
2316
|
+
* ```typescript
|
|
2317
|
+
* const config: GoogleTagManagerConfig = {
|
|
2318
|
+
* containerId: 'GTM-XXXXXXX',
|
|
2319
|
+
* dataLayerName: 'customDataLayer'
|
|
2320
|
+
* }
|
|
2321
|
+
* ```
|
|
1698
2322
|
*/
|
|
1699
2323
|
interface GoogleTagManagerConfig {
|
|
1700
|
-
/**
|
|
2324
|
+
/** ID do container GTM (formato: GTM-XXXXXXX) */
|
|
1701
2325
|
containerId: string;
|
|
1702
|
-
/**
|
|
2326
|
+
/** Nome customizado para o dataLayer. Padrão: 'dataLayer' */
|
|
1703
2327
|
dataLayerName?: string;
|
|
2328
|
+
/** URL do script GTM. Se omitido usa o padrão oficial. */
|
|
2329
|
+
scriptUrl?: string;
|
|
1704
2330
|
}
|
|
1705
2331
|
/**
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
2332
|
+
* Configuração para integração do UserWay (Acessibilidade).
|
|
2333
|
+
*
|
|
2334
|
+
* @category Utils
|
|
2335
|
+
* @since 0.2.0
|
|
2336
|
+
*
|
|
2337
|
+
* @example
|
|
2338
|
+
* ```typescript
|
|
2339
|
+
* const config: UserWayConfig = {
|
|
2340
|
+
* accountId: 'XXXXXXXXXX'
|
|
2341
|
+
* }
|
|
2342
|
+
* ```
|
|
1708
2343
|
*/
|
|
1709
2344
|
interface UserWayConfig {
|
|
1710
|
-
/**
|
|
2345
|
+
/** ID da conta UserWay */
|
|
1711
2346
|
accountId: string;
|
|
2347
|
+
/** URL do script UserWay. Se omitido usa o padrão oficial. */
|
|
2348
|
+
scriptUrl?: string;
|
|
1712
2349
|
}
|
|
1713
2350
|
/**
|
|
1714
|
-
*
|
|
2351
|
+
* Cria integração do Google Analytics (GA4).
|
|
2352
|
+
* Configura o gtag e inicializa o tracking com o measurement ID fornecido.
|
|
2353
|
+
*
|
|
1715
2354
|
* @category Utils
|
|
2355
|
+
* @param config - Configuração do Google Analytics
|
|
2356
|
+
* @returns Integração configurada para o GA4
|
|
1716
2357
|
* @since 0.2.0
|
|
1717
|
-
* Cria uma integração para Google Analytics 4 (GA4).
|
|
1718
2358
|
*
|
|
1719
|
-
* @
|
|
1720
|
-
*
|
|
2359
|
+
* @example
|
|
2360
|
+
* ```typescript
|
|
2361
|
+
* const ga = createGoogleAnalyticsIntegration({
|
|
2362
|
+
* measurementId: 'G-XXXXXXXXXX',
|
|
2363
|
+
* config: { anonymize_ip: true }
|
|
2364
|
+
* })
|
|
2365
|
+
* ```
|
|
2366
|
+
*
|
|
2367
|
+
* @remarks
|
|
2368
|
+
* - Define cookies: _ga, _ga_*, _gid
|
|
2369
|
+
* - Categoria padrão: 'analytics'
|
|
2370
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
1721
2371
|
*/
|
|
1722
2372
|
declare function createGoogleAnalyticsIntegration(config: GoogleAnalyticsConfig): ScriptIntegration;
|
|
1723
2373
|
/**
|
|
1724
|
-
*
|
|
2374
|
+
* Cria integração do Google Tag Manager (GTM).
|
|
2375
|
+
* Configura o dataLayer e inicializa o container GTM.
|
|
2376
|
+
*
|
|
1725
2377
|
* @category Utils
|
|
2378
|
+
* @param config - Configuração do Google Tag Manager
|
|
2379
|
+
* @returns Integração configurada para o GTM
|
|
1726
2380
|
* @since 0.2.0
|
|
1727
|
-
* Cria uma integração para Google Tag Manager (GTM).
|
|
1728
2381
|
*
|
|
1729
|
-
* @
|
|
1730
|
-
*
|
|
2382
|
+
* @example
|
|
2383
|
+
* ```typescript
|
|
2384
|
+
* const gtm = createGoogleTagManagerIntegration({
|
|
2385
|
+
* containerId: 'GTM-XXXXXXX',
|
|
2386
|
+
* dataLayerName: 'myDataLayer'
|
|
2387
|
+
* })
|
|
2388
|
+
* ```
|
|
2389
|
+
*
|
|
2390
|
+
* @remarks
|
|
2391
|
+
* - Define cookies: _gcl_au
|
|
2392
|
+
* - Categoria padrão: 'analytics'
|
|
2393
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
1731
2394
|
*/
|
|
1732
2395
|
declare function createGoogleTagManagerIntegration(config: GoogleTagManagerConfig): ScriptIntegration;
|
|
1733
2396
|
/**
|
|
1734
|
-
*
|
|
2397
|
+
* Cria integração do UserWay (Acessibilidade).
|
|
2398
|
+
* Configura o widget de acessibilidade UserWay.
|
|
2399
|
+
*
|
|
1735
2400
|
* @category Utils
|
|
2401
|
+
* @param config - Configuração do UserWay
|
|
2402
|
+
* @returns Integração configurada para o UserWay
|
|
1736
2403
|
* @since 0.2.0
|
|
1737
|
-
* Cria uma integração para o widget de acessibilidade UserWay.
|
|
1738
2404
|
*
|
|
1739
|
-
* @
|
|
1740
|
-
*
|
|
2405
|
+
* @example
|
|
2406
|
+
* ```typescript
|
|
2407
|
+
* const userway = createUserWayIntegration({
|
|
2408
|
+
* accountId: 'XXXXXXXXXX'
|
|
2409
|
+
* })
|
|
2410
|
+
* ```
|
|
2411
|
+
*
|
|
2412
|
+
* @remarks
|
|
2413
|
+
* - Define cookies: _userway_*
|
|
2414
|
+
* - Categoria padrão: 'functional'
|
|
2415
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
1741
2416
|
*/
|
|
1742
2417
|
declare function createUserWayIntegration(config: UserWayConfig): ScriptIntegration;
|
|
1743
2418
|
/**
|
|
1744
|
-
*
|
|
2419
|
+
* Funções fábricas para integrações comuns.
|
|
2420
|
+
* Fornece acesso direto às funções de criação de integrações pré-configuradas.
|
|
2421
|
+
*
|
|
1745
2422
|
* @category Utils
|
|
1746
2423
|
* @since 0.2.0
|
|
1747
|
-
* Objeto contendo as factory functions para as integrações pré-configuradas mais comuns.
|
|
1748
2424
|
*
|
|
1749
2425
|
* @example
|
|
1750
|
-
* ```
|
|
1751
|
-
*
|
|
1752
|
-
* const gaIntegration = COMMON_INTEGRATIONS.googleAnalytics({ measurementId: 'G-XYZ' });
|
|
2426
|
+
* ```typescript
|
|
2427
|
+
* const ga = COMMON_INTEGRATIONS.googleAnalytics({ measurementId: 'G-XXXXXXXXXX' })
|
|
1753
2428
|
* ```
|
|
1754
2429
|
*/
|
|
1755
2430
|
declare const COMMON_INTEGRATIONS: {
|
|
@@ -1757,6 +2432,485 @@ declare const COMMON_INTEGRATIONS: {
|
|
|
1757
2432
|
googleTagManager: typeof createGoogleTagManagerIntegration;
|
|
1758
2433
|
userway: typeof createUserWayIntegration;
|
|
1759
2434
|
};
|
|
2435
|
+
/**
|
|
2436
|
+
* Configuração para integração do Facebook Pixel.
|
|
2437
|
+
*
|
|
2438
|
+
* @category Utils
|
|
2439
|
+
* @since 0.4.1
|
|
2440
|
+
*
|
|
2441
|
+
* @example
|
|
2442
|
+
* ```typescript
|
|
2443
|
+
* const config: FacebookPixelConfig = {
|
|
2444
|
+
* pixelId: '1234567890123456',
|
|
2445
|
+
* autoTrack: true,
|
|
2446
|
+
* advancedMatching: { email: 'user@example.com' }
|
|
2447
|
+
* }
|
|
2448
|
+
* ```
|
|
2449
|
+
*/
|
|
2450
|
+
interface FacebookPixelConfig {
|
|
2451
|
+
/** ID do pixel do Facebook */
|
|
2452
|
+
pixelId: string;
|
|
2453
|
+
/** Se deve rastrear PageView automaticamente. Padrão: true */
|
|
2454
|
+
autoTrack?: boolean;
|
|
2455
|
+
/** Configuração de correspondência avançada */
|
|
2456
|
+
advancedMatching?: Record<string, unknown>;
|
|
2457
|
+
/** URL do script do Pixel. Se omitido usa o padrão oficial. */
|
|
2458
|
+
scriptUrl?: string;
|
|
2459
|
+
}
|
|
2460
|
+
/**
|
|
2461
|
+
* Configuração para integração do Hotjar.
|
|
2462
|
+
*
|
|
2463
|
+
* @category Utils
|
|
2464
|
+
* @since 0.4.1
|
|
2465
|
+
*
|
|
2466
|
+
* @example
|
|
2467
|
+
* ```typescript
|
|
2468
|
+
* const config: HotjarConfig = {
|
|
2469
|
+
* siteId: '1234567',
|
|
2470
|
+
* version: 6,
|
|
2471
|
+
* debug: false
|
|
2472
|
+
* }
|
|
2473
|
+
* ```
|
|
2474
|
+
*/
|
|
2475
|
+
interface HotjarConfig {
|
|
2476
|
+
/** ID do site no Hotjar */
|
|
2477
|
+
siteId: string;
|
|
2478
|
+
/** Versão do script Hotjar. Padrão: 6 */
|
|
2479
|
+
version?: number;
|
|
2480
|
+
/** Ativar modo debug. Padrão: false */
|
|
2481
|
+
debug?: boolean;
|
|
2482
|
+
/** URL do script Hotjar. Se omitido usa o padrão oficial. */
|
|
2483
|
+
scriptUrl?: string;
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* Configuração para integração do Mixpanel.
|
|
2487
|
+
*
|
|
2488
|
+
* @category Utils
|
|
2489
|
+
* @since 0.4.1
|
|
2490
|
+
*
|
|
2491
|
+
* @example
|
|
2492
|
+
* ```typescript
|
|
2493
|
+
* const config: MixpanelConfig = {
|
|
2494
|
+
* token: 'your-project-token',
|
|
2495
|
+
* config: { debug: true },
|
|
2496
|
+
* api_host: 'https://api.mixpanel.com'
|
|
2497
|
+
* }
|
|
2498
|
+
* ```
|
|
2499
|
+
*/
|
|
2500
|
+
interface MixpanelConfig {
|
|
2501
|
+
/** Token do projeto Mixpanel */
|
|
2502
|
+
token: string;
|
|
2503
|
+
/** Configurações adicionais do Mixpanel */
|
|
2504
|
+
config?: Record<string, unknown>;
|
|
2505
|
+
/** Host customizado da API Mixpanel */
|
|
2506
|
+
api_host?: string;
|
|
2507
|
+
/** URL do script Mixpanel. Se omitido usa o padrão oficial. */
|
|
2508
|
+
scriptUrl?: string;
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Configuração para integração do Microsoft Clarity.
|
|
2512
|
+
*
|
|
2513
|
+
* @category Utils
|
|
2514
|
+
* @since 0.4.1
|
|
2515
|
+
*
|
|
2516
|
+
* @example
|
|
2517
|
+
* ```typescript
|
|
2518
|
+
* const config: ClarityConfig = {
|
|
2519
|
+
* projectId: 'abcdefghij',
|
|
2520
|
+
* upload: true
|
|
2521
|
+
* }
|
|
2522
|
+
* ```
|
|
2523
|
+
*/
|
|
2524
|
+
interface ClarityConfig {
|
|
2525
|
+
/** ID do projeto no Microsoft Clarity */
|
|
2526
|
+
projectId: string;
|
|
2527
|
+
/** Configuração de upload de dados. Padrão: indefinido */
|
|
2528
|
+
upload?: boolean;
|
|
2529
|
+
/** URL do script Clarity. Se omitido usa o padrão oficial. */
|
|
2530
|
+
scriptUrl?: string;
|
|
2531
|
+
}
|
|
2532
|
+
/**
|
|
2533
|
+
* Configuração para integração do Intercom.
|
|
2534
|
+
*
|
|
2535
|
+
* @category Utils
|
|
2536
|
+
* @since 0.4.1
|
|
2537
|
+
*
|
|
2538
|
+
* @example
|
|
2539
|
+
* ```typescript
|
|
2540
|
+
* const config: IntercomConfig = {
|
|
2541
|
+
* app_id: 'your-app-id'
|
|
2542
|
+
* }
|
|
2543
|
+
* ```
|
|
2544
|
+
*/
|
|
2545
|
+
interface IntercomConfig {
|
|
2546
|
+
/** ID da aplicação Intercom */
|
|
2547
|
+
app_id: string;
|
|
2548
|
+
/** URL do script Intercom. Se omitido usa o padrão oficial. */
|
|
2549
|
+
scriptUrl?: string;
|
|
2550
|
+
}
|
|
2551
|
+
/**
|
|
2552
|
+
* Configuração para integração do Zendesk Chat.
|
|
2553
|
+
*
|
|
2554
|
+
* @category Utils
|
|
2555
|
+
* @since 0.4.1
|
|
2556
|
+
*
|
|
2557
|
+
* @example
|
|
2558
|
+
* ```typescript
|
|
2559
|
+
* const config: ZendeskConfig = {
|
|
2560
|
+
* key: 'your-zendesk-key'
|
|
2561
|
+
* }
|
|
2562
|
+
* ```
|
|
2563
|
+
*/
|
|
2564
|
+
interface ZendeskConfig {
|
|
2565
|
+
/** Chave de identificação do Zendesk */
|
|
2566
|
+
key: string;
|
|
2567
|
+
/** URL do script Zendesk. Se omitido usa o padrão oficial. */
|
|
2568
|
+
scriptUrl?: string;
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Cria integração do Facebook Pixel.
|
|
2572
|
+
* Configura o fbq e inicializa o pixel com tracking automático opcional.
|
|
2573
|
+
*
|
|
2574
|
+
* @category Utils
|
|
2575
|
+
* @param config - Configuração do Facebook Pixel
|
|
2576
|
+
* @returns Integração configurada para o Facebook Pixel
|
|
2577
|
+
* @since 0.4.1
|
|
2578
|
+
*
|
|
2579
|
+
* @example
|
|
2580
|
+
* ```typescript
|
|
2581
|
+
* const pixel = createFacebookPixelIntegration({
|
|
2582
|
+
* pixelId: '1234567890123456',
|
|
2583
|
+
* autoTrack: true
|
|
2584
|
+
* })
|
|
2585
|
+
* ```
|
|
2586
|
+
*
|
|
2587
|
+
* @remarks
|
|
2588
|
+
* - Define cookies: _fbp, fr
|
|
2589
|
+
* - Categoria padrão: 'marketing'
|
|
2590
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2591
|
+
*/
|
|
2592
|
+
declare function createFacebookPixelIntegration(config: FacebookPixelConfig): ScriptIntegration;
|
|
2593
|
+
/**
|
|
2594
|
+
* Cria integração do Hotjar.
|
|
2595
|
+
* Configura as configurações do Hotjar e inicializa o tracking de heatmaps e gravações.
|
|
2596
|
+
*
|
|
2597
|
+
* @category Utils
|
|
2598
|
+
* @param config - Configuração do Hotjar
|
|
2599
|
+
* @returns Integração configurada para o Hotjar
|
|
2600
|
+
* @since 0.4.1
|
|
2601
|
+
*
|
|
2602
|
+
* @example
|
|
2603
|
+
* ```typescript
|
|
2604
|
+
* const hotjar = createHotjarIntegration({
|
|
2605
|
+
* siteId: '1234567',
|
|
2606
|
+
* debug: true
|
|
2607
|
+
* })
|
|
2608
|
+
* ```
|
|
2609
|
+
*
|
|
2610
|
+
* @remarks
|
|
2611
|
+
* - Define cookies: _hjSession_*, _hjSessionUser_*, _hjFirstSeen, _hjIncludedInSessionSample, _hjAbsoluteSessionInProgress
|
|
2612
|
+
* - Categoria padrão: 'analytics'
|
|
2613
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2614
|
+
*/
|
|
2615
|
+
declare function createHotjarIntegration(config: HotjarConfig): ScriptIntegration;
|
|
2616
|
+
/**
|
|
2617
|
+
* Cria integração do Mixpanel.
|
|
2618
|
+
* Configura e inicializa o Mixpanel para analytics de eventos.
|
|
2619
|
+
*
|
|
2620
|
+
* @category Utils
|
|
2621
|
+
* @param config - Configuração do Mixpanel
|
|
2622
|
+
* @returns Integração configurada para o Mixpanel
|
|
2623
|
+
* @since 0.4.1
|
|
2624
|
+
*
|
|
2625
|
+
* @example
|
|
2626
|
+
* ```typescript
|
|
2627
|
+
* const mixpanel = createMixpanelIntegration({
|
|
2628
|
+
* token: 'your-project-token',
|
|
2629
|
+
* config: { debug: true }
|
|
2630
|
+
* })
|
|
2631
|
+
* ```
|
|
2632
|
+
*
|
|
2633
|
+
* @remarks
|
|
2634
|
+
* - Define cookies: mp_*
|
|
2635
|
+
* - Categoria padrão: 'analytics'
|
|
2636
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2637
|
+
* - Inclui tratamento de erro na inicialização
|
|
2638
|
+
*/
|
|
2639
|
+
declare function createMixpanelIntegration(config: MixpanelConfig): ScriptIntegration;
|
|
2640
|
+
/**
|
|
2641
|
+
* Cria integração do Microsoft Clarity.
|
|
2642
|
+
* Configura o Microsoft Clarity para heatmaps e analytics de comportamento.
|
|
2643
|
+
*
|
|
2644
|
+
* @category Utils
|
|
2645
|
+
* @param config - Configuração do Microsoft Clarity
|
|
2646
|
+
* @returns Integração configurada para o Clarity
|
|
2647
|
+
* @since 0.4.1
|
|
2648
|
+
*
|
|
2649
|
+
* @example
|
|
2650
|
+
* ```typescript
|
|
2651
|
+
* const clarity = createClarityIntegration({
|
|
2652
|
+
* projectId: 'abcdefghij',
|
|
2653
|
+
* upload: false
|
|
2654
|
+
* })
|
|
2655
|
+
* ```
|
|
2656
|
+
*
|
|
2657
|
+
* @remarks
|
|
2658
|
+
* - Define cookies: _clck, _clsk, CLID, ANONCHK, MR, MUID, SM
|
|
2659
|
+
* - Categoria padrão: 'analytics'
|
|
2660
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2661
|
+
* - Configuração de upload opcional
|
|
2662
|
+
*/
|
|
2663
|
+
declare function createClarityIntegration(config: ClarityConfig): ScriptIntegration;
|
|
2664
|
+
/**
|
|
2665
|
+
* Cria integração do Intercom.
|
|
2666
|
+
* Configura o widget de chat e suporte do Intercom.
|
|
2667
|
+
*
|
|
2668
|
+
* @category Utils
|
|
2669
|
+
* @param config - Configuração do Intercom
|
|
2670
|
+
* @returns Integração configurada para o Intercom
|
|
2671
|
+
* @since 0.4.1
|
|
2672
|
+
*
|
|
2673
|
+
* @example
|
|
2674
|
+
* ```typescript
|
|
2675
|
+
* const intercom = createIntercomIntegration({
|
|
2676
|
+
* app_id: 'your-app-id'
|
|
2677
|
+
* })
|
|
2678
|
+
* ```
|
|
2679
|
+
*
|
|
2680
|
+
* @remarks
|
|
2681
|
+
* - Define cookies: intercom-id-*, intercom-session-*
|
|
2682
|
+
* - Categoria padrão: 'functional'
|
|
2683
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2684
|
+
* - Inclui tratamento de erro na inicialização
|
|
2685
|
+
*/
|
|
2686
|
+
declare function createIntercomIntegration(config: IntercomConfig): ScriptIntegration;
|
|
2687
|
+
/**
|
|
2688
|
+
* Cria integração do Zendesk Chat.
|
|
2689
|
+
* Configura o widget de chat e suporte do Zendesk.
|
|
2690
|
+
*
|
|
2691
|
+
* @category Utils
|
|
2692
|
+
* @param config - Configuração do Zendesk Chat
|
|
2693
|
+
* @returns Integração configurada para o Zendesk Chat
|
|
2694
|
+
* @since 0.4.1
|
|
2695
|
+
*
|
|
2696
|
+
* @example
|
|
2697
|
+
* ```typescript
|
|
2698
|
+
* const zendesk = createZendeskChatIntegration({
|
|
2699
|
+
* key: 'your-zendesk-key'
|
|
2700
|
+
* })
|
|
2701
|
+
* ```
|
|
2702
|
+
*
|
|
2703
|
+
* @remarks
|
|
2704
|
+
* - Define cookies: __zlcmid, _zendesk_shared_session
|
|
2705
|
+
* - Categoria padrão: 'functional'
|
|
2706
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2707
|
+
* - Inclui tratamento de erro na identificação
|
|
2708
|
+
*/
|
|
2709
|
+
declare function createZendeskChatIntegration(config: ZendeskConfig): ScriptIntegration;
|
|
2710
|
+
/**
|
|
2711
|
+
* Configuração para conjunto de integrações de e-commerce.
|
|
2712
|
+
* Define configurações opcionais para múltiplas integrações otimizadas para e-commerce.
|
|
2713
|
+
*
|
|
2714
|
+
* @category Utils
|
|
2715
|
+
* @since 0.4.1
|
|
2716
|
+
*
|
|
2717
|
+
* @example
|
|
2718
|
+
* ```typescript
|
|
2719
|
+
* const config: ECommerceConfig = {
|
|
2720
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2721
|
+
* facebookPixel: { pixelId: '1234567890123456' }
|
|
2722
|
+
* }
|
|
2723
|
+
* ```
|
|
2724
|
+
*/
|
|
2725
|
+
interface ECommerceConfig {
|
|
2726
|
+
/** Configuração do Google Analytics */
|
|
2727
|
+
googleAnalytics?: GoogleAnalyticsConfig;
|
|
2728
|
+
/** Configuração do Facebook Pixel */
|
|
2729
|
+
facebookPixel?: FacebookPixelConfig;
|
|
2730
|
+
/** Configuração do Hotjar */
|
|
2731
|
+
hotjar?: HotjarConfig;
|
|
2732
|
+
/** Configuração do UserWay */
|
|
2733
|
+
userway?: UserWayConfig;
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Configuração para conjunto de integrações de SaaS.
|
|
2737
|
+
* Define configurações opcionais para múltiplas integrações otimizadas para SaaS.
|
|
2738
|
+
*
|
|
2739
|
+
* @category Utils
|
|
2740
|
+
* @since 0.4.1
|
|
2741
|
+
*
|
|
2742
|
+
* @example
|
|
2743
|
+
* ```typescript
|
|
2744
|
+
* const config: SaaSConfig = {
|
|
2745
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2746
|
+
* mixpanel: { token: 'your-token' },
|
|
2747
|
+
* intercom: { app_id: 'your-app-id' }
|
|
2748
|
+
* }
|
|
2749
|
+
* ```
|
|
2750
|
+
*/
|
|
2751
|
+
interface SaaSConfig {
|
|
2752
|
+
/** Configuração do Google Analytics */
|
|
2753
|
+
googleAnalytics?: GoogleAnalyticsConfig;
|
|
2754
|
+
/** Configuração do Mixpanel */
|
|
2755
|
+
mixpanel?: MixpanelConfig;
|
|
2756
|
+
/** Configuração do Intercom */
|
|
2757
|
+
intercom?: IntercomConfig;
|
|
2758
|
+
/** Configuração do Hotjar */
|
|
2759
|
+
hotjar?: HotjarConfig;
|
|
2760
|
+
}
|
|
2761
|
+
/**
|
|
2762
|
+
* Configuração para conjunto de integrações corporativas.
|
|
2763
|
+
* Define configurações opcionais para múltiplas integrações otimizadas para ambientes corporativos.
|
|
2764
|
+
*
|
|
2765
|
+
* @category Utils
|
|
2766
|
+
* @since 0.4.1
|
|
2767
|
+
*
|
|
2768
|
+
* @example
|
|
2769
|
+
* ```typescript
|
|
2770
|
+
* const config: CorporateConfig = {
|
|
2771
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2772
|
+
* clarity: { projectId: 'abcdefghij' },
|
|
2773
|
+
* userway: { accountId: 'XXXXXXXXXX' }
|
|
2774
|
+
* }
|
|
2775
|
+
* ```
|
|
2776
|
+
*/
|
|
2777
|
+
interface CorporateConfig {
|
|
2778
|
+
/** Configuração do Google Analytics */
|
|
2779
|
+
googleAnalytics?: GoogleAnalyticsConfig;
|
|
2780
|
+
/** Configuração do Microsoft Clarity */
|
|
2781
|
+
clarity?: ClarityConfig;
|
|
2782
|
+
/** Configuração do Zendesk Chat */
|
|
2783
|
+
zendesk?: ZendeskConfig;
|
|
2784
|
+
/** Configuração do UserWay */
|
|
2785
|
+
userway?: UserWayConfig;
|
|
2786
|
+
}
|
|
2787
|
+
/**
|
|
2788
|
+
* Cria conjunto de integrações otimizado para e-commerce.
|
|
2789
|
+
* Combina analytics de conversão, remarketing e acessibilidade.
|
|
2790
|
+
*
|
|
2791
|
+
* @category Utils
|
|
2792
|
+
* @param cfg - Configuração das integrações de e-commerce
|
|
2793
|
+
* @returns Array de integrações configuradas
|
|
2794
|
+
* @since 0.4.1
|
|
2795
|
+
*
|
|
2796
|
+
* @example
|
|
2797
|
+
* ```typescript
|
|
2798
|
+
* const integrations = createECommerceIntegrations({
|
|
2799
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2800
|
+
* facebookPixel: { pixelId: '1234567890123456' }
|
|
2801
|
+
* })
|
|
2802
|
+
* ```
|
|
2803
|
+
*
|
|
2804
|
+
* @remarks
|
|
2805
|
+
* Combina categorias: analytics, marketing, functional
|
|
2806
|
+
*/
|
|
2807
|
+
declare function createECommerceIntegrations(cfg: ECommerceConfig): ScriptIntegration[];
|
|
2808
|
+
/**
|
|
2809
|
+
* Cria conjunto de integrações otimizado para SaaS.
|
|
2810
|
+
* Combina analytics de produto, suporte ao cliente e comportamento do usuário.
|
|
2811
|
+
*
|
|
2812
|
+
* @category Utils
|
|
2813
|
+
* @param cfg - Configuração das integrações de SaaS
|
|
2814
|
+
* @returns Array de integrações configuradas
|
|
2815
|
+
* @since 0.4.1
|
|
2816
|
+
*
|
|
2817
|
+
* @example
|
|
2818
|
+
* ```typescript
|
|
2819
|
+
* const integrations = createSaaSIntegrations({
|
|
2820
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2821
|
+
* mixpanel: { token: 'your-project-token' },
|
|
2822
|
+
* intercom: { app_id: 'your-app-id' }
|
|
2823
|
+
* })
|
|
2824
|
+
* ```
|
|
2825
|
+
*
|
|
2826
|
+
* @remarks
|
|
2827
|
+
* Combina categorias: analytics, functional
|
|
2828
|
+
*/
|
|
2829
|
+
declare function createSaaSIntegrations(cfg: SaaSConfig): ScriptIntegration[];
|
|
2830
|
+
/**
|
|
2831
|
+
* Cria conjunto de integrações otimizado para ambientes corporativos.
|
|
2832
|
+
* Combina analytics empresariais, compliance e suporte corporativo.
|
|
2833
|
+
*
|
|
2834
|
+
* @category Utils
|
|
2835
|
+
* @param cfg - Configuração das integrações corporativas
|
|
2836
|
+
* @returns Array de integrações configuradas
|
|
2837
|
+
* @since 0.4.1
|
|
2838
|
+
*
|
|
2839
|
+
* @example
|
|
2840
|
+
* ```typescript
|
|
2841
|
+
* const integrations = createCorporateIntegrations({
|
|
2842
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2843
|
+
* clarity: { projectId: 'abcdefghij' },
|
|
2844
|
+
* userway: { accountId: 'XXXXXXXXXX' }
|
|
2845
|
+
* })
|
|
2846
|
+
* ```
|
|
2847
|
+
*
|
|
2848
|
+
* @remarks
|
|
2849
|
+
* Combina categorias: analytics, functional
|
|
2850
|
+
*/
|
|
2851
|
+
declare function createCorporateIntegrations(cfg: CorporateConfig): ScriptIntegration[];
|
|
2852
|
+
/**
|
|
2853
|
+
* Templates pré-configurados de integrações por tipo de negócio.
|
|
2854
|
+
* Define integrações essenciais e opcionais para cada contexto.
|
|
2855
|
+
*
|
|
2856
|
+
* @category Utils
|
|
2857
|
+
* @since 0.4.1
|
|
2858
|
+
*
|
|
2859
|
+
* @example
|
|
2860
|
+
* ```typescript
|
|
2861
|
+
* const template = INTEGRATION_TEMPLATES.ecommerce
|
|
2862
|
+
* console.log(template.essential) // ['google-analytics', 'facebook-pixel']
|
|
2863
|
+
* console.log(template.categories) // ['analytics', 'marketing', 'functional']
|
|
2864
|
+
* ```
|
|
2865
|
+
*
|
|
2866
|
+
* @remarks
|
|
2867
|
+
* Cada template define:
|
|
2868
|
+
* - essential: integrações obrigatórias/recomendadas
|
|
2869
|
+
* - optional: integrações complementares
|
|
2870
|
+
* - categories: categorias LGPD utilizadas
|
|
2871
|
+
*/
|
|
2872
|
+
declare const INTEGRATION_TEMPLATES: {
|
|
2873
|
+
ecommerce: {
|
|
2874
|
+
essential: string[];
|
|
2875
|
+
optional: string[];
|
|
2876
|
+
categories: string[];
|
|
2877
|
+
};
|
|
2878
|
+
saas: {
|
|
2879
|
+
essential: string[];
|
|
2880
|
+
optional: string[];
|
|
2881
|
+
categories: string[];
|
|
2882
|
+
};
|
|
2883
|
+
corporate: {
|
|
2884
|
+
essential: string[];
|
|
2885
|
+
optional: string[];
|
|
2886
|
+
categories: string[];
|
|
2887
|
+
};
|
|
2888
|
+
};
|
|
2889
|
+
/**
|
|
2890
|
+
* Sugere categorias LGPD apropriadas para um script baseado no nome/tipo.
|
|
2891
|
+
* Utiliza heurísticas para classificar scripts desconhecidos.
|
|
2892
|
+
*
|
|
2893
|
+
* @category Utils
|
|
2894
|
+
* @param name - Nome ou identificador do script
|
|
2895
|
+
* @returns Array de categorias sugeridas
|
|
2896
|
+
* @since 0.4.1
|
|
2897
|
+
*
|
|
2898
|
+
* @example
|
|
2899
|
+
* ```typescript
|
|
2900
|
+
* suggestCategoryForScript('facebook-pixel') // ['marketing']
|
|
2901
|
+
* suggestCategoryForScript('hotjar') // ['analytics']
|
|
2902
|
+
* suggestCategoryForScript('intercom-chat') // ['functional']
|
|
2903
|
+
* suggestCategoryForScript('unknown-script') // ['analytics']
|
|
2904
|
+
* ```
|
|
2905
|
+
*
|
|
2906
|
+
* @remarks
|
|
2907
|
+
* Heurísticas aplicadas:
|
|
2908
|
+
* - Scripts de ads/marketing → 'marketing'
|
|
2909
|
+
* - Scripts de analytics/tracking → 'analytics'
|
|
2910
|
+
* - Scripts de chat/suporte → 'functional'
|
|
2911
|
+
* - Padrão para desconhecidos → 'analytics'
|
|
2912
|
+
*/
|
|
2913
|
+
declare function suggestCategoryForScript(name: string): string[];
|
|
1760
2914
|
|
|
1761
2915
|
/**
|
|
1762
2916
|
* Componente que carrega scripts automaticamente baseado no consentimento.
|
|
@@ -1820,6 +2974,378 @@ declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly
|
|
|
1820
2974
|
*/
|
|
1821
2975
|
declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
|
|
1822
2976
|
|
|
2977
|
+
/**
|
|
2978
|
+
* @file autoConfigureCategories.ts
|
|
2979
|
+
* @description Sistema inteligente de auto-habilitação de categorias baseado nas integrações utilizadas
|
|
2980
|
+
* @since 0.4.1
|
|
2981
|
+
*/
|
|
2982
|
+
|
|
2983
|
+
/**
|
|
2984
|
+
* @interface CategoryAutoConfigResult
|
|
2985
|
+
* Resultado da análise e auto-configuração de categorias
|
|
2986
|
+
*/
|
|
2987
|
+
interface CategoryAutoConfigResult {
|
|
2988
|
+
/** Configuração original fornecida pelo desenvolvedor */
|
|
2989
|
+
originalConfig: ProjectCategoriesConfig;
|
|
2990
|
+
/** Configuração ajustada automaticamente pela biblioteca */
|
|
2991
|
+
adjustedConfig: ProjectCategoriesConfig;
|
|
2992
|
+
/** Categorias que foram automaticamente habilitadas */
|
|
2993
|
+
autoEnabledCategories: string[];
|
|
2994
|
+
/** Categorias requeridas pelas integrações mas não habilitadas */
|
|
2995
|
+
missingCategories: string[];
|
|
2996
|
+
/** Se algum ajuste foi necessário */
|
|
2997
|
+
wasAdjusted: boolean;
|
|
2998
|
+
/** Integrações que requerem cada categoria */
|
|
2999
|
+
categoryIntegrations: Record<string, string[]>;
|
|
3000
|
+
}
|
|
3001
|
+
/**
|
|
3002
|
+
* @function
|
|
3003
|
+
* @category Utils
|
|
3004
|
+
* @since 0.4.1
|
|
3005
|
+
* Analisa as integrações fornecidas e determina quais categorias são necessárias.
|
|
3006
|
+
*
|
|
3007
|
+
* @param integrations Array de integrações de script
|
|
3008
|
+
* @returns Record mapeando categoria para nomes das integrações que a utilizam
|
|
3009
|
+
*/
|
|
3010
|
+
declare function analyzeIntegrationCategories(integrations: ScriptIntegration[]): Record<string, string[]>;
|
|
3011
|
+
/**
|
|
3012
|
+
* @function
|
|
3013
|
+
* @category Utils
|
|
3014
|
+
* @since 0.4.1
|
|
3015
|
+
* Configura automaticamente as categorias necessárias baseado nas integrações utilizadas.
|
|
3016
|
+
*
|
|
3017
|
+
* Esta função implementa o comportamento inteligente da biblioteca:
|
|
3018
|
+
* 1. Detecta categorias requeridas pelas integrações
|
|
3019
|
+
* 2. Auto-habilita categorias em falta (modo padrão)
|
|
3020
|
+
* 3. Ou apenas avisa sobre categorias em falta (modo warning-only)
|
|
3021
|
+
* 4. Loga no console em modo DEV
|
|
3022
|
+
*
|
|
3023
|
+
* @param originalConfig Configuração original do ConsentProvider
|
|
3024
|
+
* @param integrations Array de integrações que serão utilizadas
|
|
3025
|
+
* @param options Opções de comportamento
|
|
3026
|
+
* @returns Resultado da análise e configuração automática
|
|
3027
|
+
*/
|
|
3028
|
+
declare function autoConfigureCategories(originalConfig: ProjectCategoriesConfig | undefined, integrations: ScriptIntegration[], options?: {
|
|
3029
|
+
/** Se true, apenas avisa mas não modifica a config (padrão: false - auto-habilita) */
|
|
3030
|
+
warningOnly?: boolean;
|
|
3031
|
+
/** Se true, desabilita logs no console (padrão: false) */
|
|
3032
|
+
silent?: boolean;
|
|
3033
|
+
}): CategoryAutoConfigResult;
|
|
3034
|
+
/**
|
|
3035
|
+
* @function
|
|
3036
|
+
* @category Utils
|
|
3037
|
+
* @since 0.4.1
|
|
3038
|
+
* Valida se todas as integrações têm suas categorias habilitadas.
|
|
3039
|
+
* Útil para validação em tempo de execução.
|
|
3040
|
+
*
|
|
3041
|
+
* @param integrations Array de integrações
|
|
3042
|
+
* @param enabledCategories Array de categorias habilitadas
|
|
3043
|
+
* @returns true se todas as categorias necessárias estão habilitadas
|
|
3044
|
+
*/
|
|
3045
|
+
declare function validateIntegrationCategories(integrations: ScriptIntegration[], enabledCategories: string[]): boolean;
|
|
3046
|
+
/**
|
|
3047
|
+
* @function
|
|
3048
|
+
* @category Utils
|
|
3049
|
+
* @since 0.4.1
|
|
3050
|
+
* Extrai categorias únicas de um array de integrações
|
|
3051
|
+
*
|
|
3052
|
+
* @param integrations Array de integrações
|
|
3053
|
+
* @returns Array de categorias únicas
|
|
3054
|
+
*/
|
|
3055
|
+
declare function extractCategoriesFromIntegrations(integrations: ScriptIntegration[]): string[];
|
|
3056
|
+
/**
|
|
3057
|
+
* @function
|
|
3058
|
+
* @category Utils
|
|
3059
|
+
* @since 0.4.1
|
|
3060
|
+
* Valida se integrações estão sendo incorretamente classificadas como "necessary".
|
|
3061
|
+
*
|
|
3062
|
+
* Esta função protege contra violações de GDPR/LGPD identificando scripts que
|
|
3063
|
+
* NUNCA devem ser considerados estritamente necessários.
|
|
3064
|
+
*
|
|
3065
|
+
* @param integrations Array de integrações para validar
|
|
3066
|
+
* @param enabledCategories Categorias habilitadas na configuração
|
|
3067
|
+
* @returns Lista de avisos sobre classificações incorretas
|
|
3068
|
+
*
|
|
3069
|
+
* @example
|
|
3070
|
+
* ```typescript
|
|
3071
|
+
* const warnings = validateNecessaryClassification([
|
|
3072
|
+
* createGoogleAnalyticsIntegration({...}), // ❌ NUNCA é necessary
|
|
3073
|
+
* createCustomIntegration({...}) // ✅ Pode ser necessary se apropriado
|
|
3074
|
+
* ], ['necessary', 'analytics'])
|
|
3075
|
+
*
|
|
3076
|
+
* if (warnings.length > 0) {
|
|
3077
|
+
* console.warn('Scripts incorretamente classificados como necessary:', warnings)
|
|
3078
|
+
* }
|
|
3079
|
+
* ```
|
|
3080
|
+
*/
|
|
3081
|
+
declare function validateNecessaryClassification(integrations: ScriptIntegration[], enabledCategories: Category[]): string[];
|
|
3082
|
+
|
|
3083
|
+
/**
|
|
3084
|
+
* @fileoverview
|
|
3085
|
+
* Sistema de textos expandido com suporte avançado a internacionalização,
|
|
3086
|
+
* contextos específicos e variações de tom.
|
|
3087
|
+
*
|
|
3088
|
+
* @author Luciano Édipo
|
|
3089
|
+
* @since 0.4.1
|
|
3090
|
+
*/
|
|
3091
|
+
|
|
3092
|
+
/**
|
|
3093
|
+
* Tipo auxiliar para variações de texto.
|
|
3094
|
+
*
|
|
3095
|
+
* Define um subconjunto opcional dos textos principais do banner e modal,
|
|
3096
|
+
* permitindo variações de t es: {
|
|
3097
|
+
bannerMessage: 'Utilizamos cookies para mejorar su experiencia y mostrar contenido personalizado.', (formal, casual, etc.) sem sobrescrever todos os textos.
|
|
3098
|
+
*
|
|
3099
|
+
* @category Types
|
|
3100
|
+
* @since 0.4.1
|
|
3101
|
+
*/
|
|
3102
|
+
type TextVariant = Partial<Pick<ConsentTexts, 'bannerMessage' | 'acceptAll' | 'declineAll' | 'modalTitle'>>;
|
|
3103
|
+
/**
|
|
3104
|
+
* Tipo auxiliar para textos de idioma.
|
|
3105
|
+
*
|
|
3106
|
+
* Define um subconjunto dos textos principais, excluindo propriedades específicas de internacionalização
|
|
3107
|
+
* e contextos, para uso em configurações multilíngues.
|
|
3108
|
+
*
|
|
3109
|
+
* @category Types
|
|
3110
|
+
* @since 0.4.1
|
|
3111
|
+
*/
|
|
3112
|
+
type LanguageTexts = Partial<Omit<ConsentTexts, 'i18n' | 'variants' | 'contexts'>>;
|
|
3113
|
+
/**
|
|
3114
|
+
* Sistema de textos avançado com suporte a internacionalização e contextos específicos.
|
|
3115
|
+
*
|
|
3116
|
+
* Interface expandida que permite personalização granular de todas as mensagens da biblioteca.
|
|
3117
|
+
* Suporta múltiplos idiomas, contextos específicos (e-commerce, SaaS, governo), variações
|
|
3118
|
+
* de tom, e compliance completo com LGPD/ANPD.
|
|
3119
|
+
*
|
|
3120
|
+
* @category Types
|
|
3121
|
+
* @since 0.4.1
|
|
3122
|
+
* @version 0.4.1 - Nova interface com suporte avançado a i18n e contextos
|
|
3123
|
+
*
|
|
3124
|
+
* @example Configuração multilíngue
|
|
3125
|
+
* ```typescript
|
|
3126
|
+
* const multiLangTexts: AdvancedConsentTexts = {
|
|
3127
|
+
* // Herda de ConsentTexts básico
|
|
3128
|
+
* bannerMessage: 'Utilizamos cookies para melhorar sua experiência.',
|
|
3129
|
+
* acceptAll: 'Aceitar todos',
|
|
3130
|
+
* declineAll: 'Recusar',
|
|
3131
|
+
* preferences: 'Preferências',
|
|
3132
|
+
* modalTitle: 'Preferências de Cookies',
|
|
3133
|
+
* modalIntro: 'Personalize suas preferências de cookies.',
|
|
3134
|
+
* save: 'Salvar',
|
|
3135
|
+
* necessaryAlwaysOn: 'Cookies necessários (sempre ativos)',
|
|
3136
|
+
*
|
|
3137
|
+
* // Textos expandidos
|
|
3138
|
+
* variants: {
|
|
3139
|
+
* formal: {
|
|
3140
|
+
* bannerMessage: 'Este sítio utiliza cookies para otimizar a experiência de navegação.',
|
|
3141
|
+
* acceptAll: 'Concordar com todos os cookies'
|
|
3142
|
+
* },
|
|
3143
|
+
* casual: {
|
|
3144
|
+
* bannerMessage: '🍪 Olá! Usamos cookies para tornar tudo mais gostoso aqui.',
|
|
3145
|
+
* acceptAll: 'Aceitar tudo'
|
|
3146
|
+
* }
|
|
3147
|
+
* },
|
|
3148
|
+
*
|
|
3149
|
+
* // Internacionalização
|
|
3150
|
+
* i18n: {
|
|
3151
|
+
* en: {
|
|
3152
|
+
* bannerMessage: 'We use cookies to enhance your experience.',
|
|
3153
|
+
* acceptAll: 'Accept All',
|
|
3154
|
+
* declineAll: 'Decline'
|
|
3155
|
+
* },
|
|
3156
|
+
* es: {
|
|
3157
|
+
* bannerMessage: 'Utilizamos cookies para mejorar su experiencia.',
|
|
3158
|
+
* acceptAll: 'Aceptar Todo',
|
|
3159
|
+
* declineAll: 'Rechazar'
|
|
3160
|
+
* }
|
|
3161
|
+
* }
|
|
3162
|
+
* }
|
|
3163
|
+
* ```
|
|
3164
|
+
*/
|
|
3165
|
+
interface AdvancedConsentTexts extends ConsentTexts {
|
|
3166
|
+
/** Texto para confirmar ação */
|
|
3167
|
+
confirm?: string;
|
|
3168
|
+
/** Texto para cancelar ação */
|
|
3169
|
+
cancel?: string;
|
|
3170
|
+
/** Texto de carregamento */
|
|
3171
|
+
loading?: string;
|
|
3172
|
+
/** Textos específicos para cada categoria de cookie */
|
|
3173
|
+
categories?: {
|
|
3174
|
+
necessary?: {
|
|
3175
|
+
name?: string;
|
|
3176
|
+
description?: string;
|
|
3177
|
+
examples?: string;
|
|
3178
|
+
};
|
|
3179
|
+
analytics?: {
|
|
3180
|
+
name?: string;
|
|
3181
|
+
description?: string;
|
|
3182
|
+
examples?: string;
|
|
3183
|
+
};
|
|
3184
|
+
marketing?: {
|
|
3185
|
+
name?: string;
|
|
3186
|
+
description?: string;
|
|
3187
|
+
examples?: string;
|
|
3188
|
+
};
|
|
3189
|
+
functional?: {
|
|
3190
|
+
name?: string;
|
|
3191
|
+
description?: string;
|
|
3192
|
+
examples?: string;
|
|
3193
|
+
};
|
|
3194
|
+
performance?: {
|
|
3195
|
+
name?: string;
|
|
3196
|
+
description?: string;
|
|
3197
|
+
examples?: string;
|
|
3198
|
+
};
|
|
3199
|
+
};
|
|
3200
|
+
/** Mensagens de feedback ao usuário */
|
|
3201
|
+
feedback?: {
|
|
3202
|
+
/** Preferências salvas com sucesso */
|
|
3203
|
+
saveSuccess?: string;
|
|
3204
|
+
/** Erro ao salvar preferências */
|
|
3205
|
+
saveError?: string;
|
|
3206
|
+
/** Consentimento atualizado */
|
|
3207
|
+
consentUpdated?: string;
|
|
3208
|
+
/** Cookies rejeitados */
|
|
3209
|
+
cookiesRejected?: string;
|
|
3210
|
+
/** Configurações resetadas */
|
|
3211
|
+
settingsReset?: string;
|
|
3212
|
+
};
|
|
3213
|
+
/** Labels ARIA e textos para leitores de tela */
|
|
3214
|
+
accessibility?: {
|
|
3215
|
+
/** Label do banner para leitores de tela */
|
|
3216
|
+
bannerLabel?: string;
|
|
3217
|
+
/** Label do modal para leitores de tela */
|
|
3218
|
+
modalLabel?: string;
|
|
3219
|
+
/** Instrução de navegação por teclado */
|
|
3220
|
+
keyboardNavigation?: string;
|
|
3221
|
+
/** Estado do toggle de categoria */
|
|
3222
|
+
toggleState?: {
|
|
3223
|
+
enabled?: string;
|
|
3224
|
+
disabled?: string;
|
|
3225
|
+
};
|
|
3226
|
+
/** Região live para anúncios dinâmicos */
|
|
3227
|
+
liveRegion?: string;
|
|
3228
|
+
};
|
|
3229
|
+
/** Textos otimizados para diferentes contextos */
|
|
3230
|
+
contexts?: {
|
|
3231
|
+
/** Contexto e-commerce */
|
|
3232
|
+
ecommerce?: {
|
|
3233
|
+
cartAbandonment?: string;
|
|
3234
|
+
personalizedOffers?: string;
|
|
3235
|
+
paymentSecurity?: string;
|
|
3236
|
+
productRecommendations?: string;
|
|
3237
|
+
};
|
|
3238
|
+
/** Contexto SaaS */
|
|
3239
|
+
saas?: {
|
|
3240
|
+
userAnalytics?: string;
|
|
3241
|
+
performanceMonitoring?: string;
|
|
3242
|
+
featureUsage?: string;
|
|
3243
|
+
customerSupport?: string;
|
|
3244
|
+
};
|
|
3245
|
+
/** Contexto governamental */
|
|
3246
|
+
government?: {
|
|
3247
|
+
citizenServices?: string;
|
|
3248
|
+
dataProtection?: string;
|
|
3249
|
+
transparency?: string;
|
|
3250
|
+
accessibility?: string;
|
|
3251
|
+
};
|
|
3252
|
+
/** Contexto educacional */
|
|
3253
|
+
education?: {
|
|
3254
|
+
studentProgress?: string;
|
|
3255
|
+
learningAnalytics?: string;
|
|
3256
|
+
accessibility?: string;
|
|
3257
|
+
parentalConsent?: string;
|
|
3258
|
+
};
|
|
3259
|
+
};
|
|
3260
|
+
/** Diferentes variações de tom para a mesma mensagem */
|
|
3261
|
+
variants?: {
|
|
3262
|
+
/** Tom formal/profissional */
|
|
3263
|
+
formal?: TextVariant;
|
|
3264
|
+
/** Tom casual/amigável */
|
|
3265
|
+
casual?: TextVariant;
|
|
3266
|
+
/** Tom conciso/direto */
|
|
3267
|
+
concise?: TextVariant;
|
|
3268
|
+
/** Tom detalhado/explicativo */
|
|
3269
|
+
detailed?: TextVariant;
|
|
3270
|
+
};
|
|
3271
|
+
/** Suporte a múltiplos idiomas */
|
|
3272
|
+
i18n?: {
|
|
3273
|
+
/** Textos em inglês */
|
|
3274
|
+
en?: LanguageTexts;
|
|
3275
|
+
/** Textos em espanhol */
|
|
3276
|
+
es?: LanguageTexts;
|
|
3277
|
+
/** Textos em francês */
|
|
3278
|
+
fr?: LanguageTexts;
|
|
3279
|
+
/** Textos em alemão */
|
|
3280
|
+
de?: LanguageTexts;
|
|
3281
|
+
/** Textos em italiano */
|
|
3282
|
+
it?: LanguageTexts;
|
|
3283
|
+
};
|
|
3284
|
+
/** Informações técnicas sobre cookies */
|
|
3285
|
+
technical?: {
|
|
3286
|
+
/** Explicação sobre cookies de sessão */
|
|
3287
|
+
sessionCookies?: string;
|
|
3288
|
+
/** Explicação sobre cookies persistentes */
|
|
3289
|
+
persistentCookies?: string;
|
|
3290
|
+
/** Explicação sobre cookies de terceiros */
|
|
3291
|
+
thirdPartyCookies?: string;
|
|
3292
|
+
/** Como desabilitar cookies no navegador */
|
|
3293
|
+
browserSettings?: string;
|
|
3294
|
+
/** Impacto de desabilitar cookies */
|
|
3295
|
+
disablingImpact?: string;
|
|
3296
|
+
};
|
|
3297
|
+
/** Cabeçalhos para tabela de detalhes de cookies */
|
|
3298
|
+
cookieDetails?: {
|
|
3299
|
+
tableHeaders?: {
|
|
3300
|
+
name?: string;
|
|
3301
|
+
purpose?: string;
|
|
3302
|
+
duration?: string;
|
|
3303
|
+
provider?: string;
|
|
3304
|
+
type?: string;
|
|
3305
|
+
};
|
|
3306
|
+
/** Texto quando não há cookies para mostrar */
|
|
3307
|
+
noCookies?: string;
|
|
3308
|
+
/** Botão para expandir/colapsar detalhes */
|
|
3309
|
+
toggleDetails?: {
|
|
3310
|
+
expand?: string;
|
|
3311
|
+
collapse?: string;
|
|
3312
|
+
};
|
|
3313
|
+
};
|
|
3314
|
+
}
|
|
3315
|
+
/**
|
|
3316
|
+
* Textos padrão expandidos para diferentes contextos e idiomas.
|
|
3317
|
+
*
|
|
3318
|
+
* @category Utils
|
|
3319
|
+
* @since 0.4.1
|
|
3320
|
+
*/
|
|
3321
|
+
declare const EXPANDED_DEFAULT_TEXTS: Partial<AdvancedConsentTexts>;
|
|
3322
|
+
/**
|
|
3323
|
+
* Utilitário para resolver textos baseado em idioma, contexto e variação.
|
|
3324
|
+
*
|
|
3325
|
+
* @category Utils
|
|
3326
|
+
* @since 0.4.1
|
|
3327
|
+
*
|
|
3328
|
+
* @param texts - Textos avançados configurados
|
|
3329
|
+
* @param options - Opções de resolução
|
|
3330
|
+
* @returns Textos resolvidos para o contexto
|
|
3331
|
+
*/
|
|
3332
|
+
declare function resolveTexts(texts: AdvancedConsentTexts, options?: {
|
|
3333
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
3334
|
+
context?: 'ecommerce' | 'saas' | 'government' | 'education';
|
|
3335
|
+
variant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
3336
|
+
}): ConsentTexts;
|
|
3337
|
+
/**
|
|
3338
|
+
* Templates pré-configurados para diferentes contextos.
|
|
3339
|
+
*
|
|
3340
|
+
* @category Utils
|
|
3341
|
+
* @since 0.4.1
|
|
3342
|
+
*/
|
|
3343
|
+
declare const TEXT_TEMPLATES: {
|
|
3344
|
+
readonly ecommerce: AdvancedConsentTexts;
|
|
3345
|
+
readonly saas: AdvancedConsentTexts;
|
|
3346
|
+
readonly government: AdvancedConsentTexts;
|
|
3347
|
+
};
|
|
3348
|
+
|
|
1823
3349
|
/**
|
|
1824
3350
|
* @enum LogLevel
|
|
1825
3351
|
* @category Utils
|
|
@@ -1859,6 +3385,17 @@ declare enum LogLevel {
|
|
|
1859
3385
|
*/
|
|
1860
3386
|
declare function setDebugLogging(enabled: boolean, level?: LogLevel): void;
|
|
1861
3387
|
|
|
3388
|
+
interface CookieCatalogOverrides {
|
|
3389
|
+
byCategory?: Record<string, CookieDescriptor[]>;
|
|
3390
|
+
byIntegration?: Record<string, CookieDescriptor[]>;
|
|
3391
|
+
}
|
|
3392
|
+
interface CookieCategoryOverrides {
|
|
3393
|
+
[cookieNameOrPattern: string]: Category;
|
|
3394
|
+
}
|
|
3395
|
+
declare function setCookieCatalogOverrides(overrides: CookieCatalogOverrides): void;
|
|
3396
|
+
declare function setCookieCategoryOverrides(map: CookieCategoryOverrides): void;
|
|
3397
|
+
declare function getCookiesInfoForCategory(categoryId: Category, usedIntegrations: string[]): CookieDescriptor[];
|
|
3398
|
+
|
|
1862
3399
|
/**
|
|
1863
3400
|
* Propriedades para customizar o comportamento e aparência do componente CookieBanner.
|
|
1864
3401
|
*
|
|
@@ -1921,6 +3458,11 @@ interface CookieBannerProps {
|
|
|
1921
3458
|
* @example "/privacy-policy" | "https://example.com/cookies"
|
|
1922
3459
|
*/
|
|
1923
3460
|
policyLinkUrl?: string;
|
|
3461
|
+
/**
|
|
3462
|
+
* URL para os termos de uso do site (opcional). Quando fornecida, será considerada uma rota "segura"
|
|
3463
|
+
* para não aplicar bloqueio total (overlay) mesmo em modo bloqueante.
|
|
3464
|
+
*/
|
|
3465
|
+
termsLinkUrl?: string;
|
|
1924
3466
|
/**
|
|
1925
3467
|
* Força exibição do banner em modo de debug, independente do consentimento.
|
|
1926
3468
|
*
|
|
@@ -2082,7 +3624,7 @@ interface CookieBannerProps {
|
|
|
2082
3624
|
* @public
|
|
2083
3625
|
* @since 0.1.0
|
|
2084
3626
|
*/
|
|
2085
|
-
declare function CookieBanner({ policyLinkUrl, debug, blocking, hideBranding, SnackbarProps, PaperProps, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
3627
|
+
declare function CookieBanner({ policyLinkUrl, termsLinkUrl, debug, blocking, hideBranding, SnackbarProps, PaperProps, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
2086
3628
|
|
|
2087
3629
|
/**
|
|
2088
3630
|
* Props para o componente FloatingPreferencesButton.
|
|
@@ -2123,6 +3665,16 @@ interface FloatingPreferencesButtonProps {
|
|
|
2123
3665
|
*/
|
|
2124
3666
|
declare function FloatingPreferencesButton({ position, offset, icon, tooltip, FabProps, hideWhenConsented, }: Readonly<FloatingPreferencesButtonProps>): react_jsx_runtime.JSX.Element | null;
|
|
2125
3667
|
|
|
3668
|
+
/** @module src/utils/categoryUtils */
|
|
3669
|
+
/**
|
|
3670
|
+
* @category Utils
|
|
3671
|
+
* @since 0.2.0
|
|
3672
|
+
* Utilitários para gerenciamento de categorias de consentimento LGPD.
|
|
3673
|
+
*
|
|
3674
|
+
* Fornece funções para criar, validar e recuperar definições de categorias de cookies,
|
|
3675
|
+
* garantindo conformidade com a LGPD e suporte a categorias customizadas.
|
|
3676
|
+
*/
|
|
3677
|
+
|
|
2126
3678
|
/**
|
|
2127
3679
|
* Cria um objeto de preferências de consentimento inicial baseado na configuração de categorias do projeto.
|
|
2128
3680
|
* @category Utils
|
|
@@ -2210,4 +3762,4 @@ declare function validateProjectPreferences(preferences: ConsentPreferences, con
|
|
|
2210
3762
|
*/
|
|
2211
3763
|
declare function getAllProjectCategories(config?: ProjectCategoriesConfig): CategoryDefinition[];
|
|
2212
3764
|
|
|
2213
|
-
export { COMMON_INTEGRATIONS, type CategoriesContextValue, type Category, type CategoryDefinition, type ConsentContextValue, type ConsentCookieData, type ConsentCookieOptions, ConsentGate, type ConsentPreferences, ConsentProvider, type ConsentProviderProps, ConsentScriptLoader, type ConsentScriptLoaderProps, type ConsentState, type ConsentTexts, CookieBanner, type CookieBannerProps, type CustomCookieBannerProps, type CustomFloatingPreferencesButtonProps, type CustomPreferencesModalProps, DEFAULT_PROJECT_CATEGORIES, type DesignTokens, type DeveloperGuidance, FloatingPreferencesButton, type FloatingPreferencesButtonProps, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, LogLevel, PreferencesModal, type PreferencesModalProps, type ProjectCategoriesConfig, type ScriptIntegration, type UserWayConfig, analyzeDeveloperConfiguration, createDefaultConsentTheme, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createProjectPreferences, createUserWayIntegration, defaultConsentTheme, defaultTexts, getAllProjectCategories, loadScript, openPreferencesModal, setDebugLogging, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useOpenPreferencesModal, validateProjectPreferences };
|
|
3765
|
+
export { type AdvancedConsentTexts, COMMON_INTEGRATIONS, type CategoriesContextValue, type Category, type CategoryAutoConfigResult, type CategoryDefinition, type ClarityConfig, type ConsentContextValue, type ConsentCookieData, type ConsentCookieOptions, ConsentGate, type ConsentPreferences, ConsentProvider, type ConsentProviderProps, ConsentScriptLoader, type ConsentScriptLoaderProps, type ConsentState, type ConsentTexts, CookieBanner, type CookieBannerProps, type CookieDescriptor, type CorporateConfig, type CustomCookieBannerProps, type CustomFloatingPreferencesButtonProps, type CustomPreferencesModalProps, DEFAULT_PROJECT_CATEGORIES, type DesignTokens, type DeveloperGuidance, type ECommerceConfig, EXPANDED_DEFAULT_TEXTS, type FacebookPixelConfig, FloatingPreferencesButton, type FloatingPreferencesButtonProps, GUIDANCE_PRESETS, type GoogleAnalyticsConfig, type GoogleTagManagerConfig, type GuidanceConfig, type GuidanceMessage, type GuidanceSeverity, type HotjarConfig, INTEGRATION_TEMPLATES, type IntercomConfig, LogLevel, type MixpanelConfig, PreferencesModal, type PreferencesModalProps, type ProjectCategoriesConfig, type SaaSConfig, type ScriptIntegration, TEXT_TEMPLATES, type UserWayConfig, type ZendeskConfig, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, categorizeDiscoveredCookies, createClarityIntegration, createCorporateIntegrations, createDefaultConsentTheme, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, defaultConsentTheme, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, loadScript, logDeveloperGuidance, openPreferencesModal, resolveTexts, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };
|