react-lgpd-consent 0.4.0 → 0.4.3
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 +226 -0
- package/QUICKSTART.en.md +34 -0
- package/QUICKSTART.md +562 -1
- package/README.en.md +25 -0
- package/README.md +37 -0
- package/dist/FloatingPreferencesButton-4AGBXNHH.cjs +11 -0
- package/dist/FloatingPreferencesButton-IY7TFD7D.js +2 -0
- package/dist/PreferencesModal-5KNHWW57.js +2 -0
- package/dist/PreferencesModal-YBCWCVUI.cjs +11 -0
- package/dist/chunk-25XEI2DZ.cjs +193 -0
- package/dist/chunk-FJKRAERJ.cjs +119 -0
- package/dist/chunk-N3QOW4SA.js +178 -0
- package/dist/chunk-ORI4PLVG.cjs +1899 -0
- package/dist/chunk-PJFGQMCI.js +92 -0
- package/dist/chunk-RWT2ORFE.js +1840 -0
- package/dist/index.cjs +872 -1560
- package/dist/index.d.cts +1794 -232
- package/dist/index.d.ts +1794 -232
- package/dist/index.js +707 -65
- package/package.json +73 -39
- package/dist/PreferencesModal-D2SEVH3N.js +0 -6
- package/dist/chunk-B5FNONG3.js +0 -1362
package/dist/index.d.cts
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
|
|
@@ -1606,11 +2083,28 @@ declare function useCategoryStatus(categoryId: string): {
|
|
|
1606
2083
|
description: string | undefined;
|
|
1607
2084
|
};
|
|
1608
2085
|
|
|
2086
|
+
/**
|
|
2087
|
+
* ConsentGate - renderiza children apenas se houver consentimento para a categoria.
|
|
2088
|
+
*
|
|
2089
|
+
* @remarks
|
|
2090
|
+
* Não usa React.memo pois o estado de preferências muda dinamicamente
|
|
2091
|
+
* e o componente precisa re-renderizar quando as preferências mudam.
|
|
2092
|
+
* A lógica é leve o suficiente para não justificar memoização.
|
|
2093
|
+
*/
|
|
1609
2094
|
declare function ConsentGate(props: Readonly<{
|
|
1610
2095
|
category: string;
|
|
1611
2096
|
children: React$1.ReactNode;
|
|
1612
2097
|
}>): react_jsx_runtime.JSX.Element | null;
|
|
1613
2098
|
|
|
2099
|
+
/** @module src/utils/scriptLoader */
|
|
2100
|
+
/**
|
|
2101
|
+
* @category Utils
|
|
2102
|
+
* @since 0.1.0
|
|
2103
|
+
* Utilitários para carregamento dinâmico e seguro de scripts externos no DOM.
|
|
2104
|
+
*
|
|
2105
|
+
* Fornece funções para carregar scripts de terceiros de forma condicional ao consentimento LGPD,
|
|
2106
|
+
* garantindo compatibilidade SSR e verificações de permissões por categoria.
|
|
2107
|
+
*/
|
|
1614
2108
|
/**
|
|
1615
2109
|
* @function
|
|
1616
2110
|
* @category Utils
|
|
@@ -1624,7 +2118,7 @@ declare function ConsentGate(props: Readonly<{
|
|
|
1624
2118
|
*
|
|
1625
2119
|
* @param {string} id Um identificador único para o elemento `<script>` a ser criado.
|
|
1626
2120
|
* @param {string} src A URL do script externo a ser carregado.
|
|
1627
|
-
* @param {
|
|
2121
|
+
* @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
2122
|
* @param {Record<string, string>} [attrs={}] Atributos adicionais a serem aplicados ao elemento `<script>` (ex: `{ async: 'true' }`).
|
|
1629
2123
|
* @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
2124
|
* @example
|
|
@@ -1635,11 +2129,64 @@ declare function ConsentGate(props: Readonly<{
|
|
|
1635
2129
|
* .catch(error => console.error('Erro ao carregar script:', error))
|
|
1636
2130
|
* ```
|
|
1637
2131
|
*/
|
|
2132
|
+
declare function loadScript(id: string, src: string, category?: string | null, attrs?: Record<string, string>): Promise<void>;
|
|
2133
|
+
|
|
2134
|
+
/**
|
|
2135
|
+
* Utilitários para descoberta e categorização de cookies em tempo de execução (experimental).
|
|
2136
|
+
*
|
|
2137
|
+
* Fornece funções para detectar cookies presentes no navegador, identificar o cookie de consentimento
|
|
2138
|
+
* e atribuir cookies descobertos a categorias LGPD usando heurísticas baseadas em padrões conhecidos.
|
|
2139
|
+
*
|
|
2140
|
+
* @category Utils
|
|
2141
|
+
* @since 0.4.1
|
|
2142
|
+
* @remarks Funcionalidades experimentais para auxiliar no mapeamento de cookies em conformidade com LGPD.
|
|
2143
|
+
* Recomenda-se uso em desenvolvimento para inspeção manual e merge com catálogo existente.
|
|
2144
|
+
*/
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* Descobre cookies em tempo de execução no navegador (experimental).
|
|
2148
|
+
*
|
|
2149
|
+
* - Lê `document.cookie` com segurança (SSR-safe)
|
|
2150
|
+
* - Retorna lista de cookies detectados (apenas nomes)
|
|
2151
|
+
* - Salva em `globalThis.__LGPD_DISCOVERED_COOKIES__` para inspeção/manual merge
|
|
2152
|
+
*
|
|
2153
|
+
* @category Utils
|
|
2154
|
+
* @since 0.4.1
|
|
2155
|
+
*/
|
|
2156
|
+
declare function discoverRuntimeCookies(): CookieDescriptor[];
|
|
2157
|
+
/**
|
|
2158
|
+
* Tenta detectar o nome do cookie de consentimento pela estrutura JSON armazenada.
|
|
2159
|
+
* Retorna o nome se for encontrado, caso contrário `null`.
|
|
2160
|
+
* @category Utils
|
|
2161
|
+
* @since 0.4.1
|
|
2162
|
+
*/
|
|
2163
|
+
declare function detectConsentCookieName(): string | null;
|
|
2164
|
+
/**
|
|
2165
|
+
* Heurística simples para atribuir cookies descobertos a categorias LGPD (experimental).
|
|
2166
|
+
*
|
|
2167
|
+
* - Usa padrões conhecidos por categoria
|
|
2168
|
+
* - Ignora `cookieConsent` (já tratado como necessary)
|
|
2169
|
+
* - Pode opcionalmente registrar overrides de catálogo por categoria
|
|
2170
|
+
*
|
|
2171
|
+
* @param discovered Lista de cookies descobertos (opcional: usa global se ausente)
|
|
2172
|
+
* @param registerOverrides Se `true`, registra em `setCookieCatalogOverrides`
|
|
2173
|
+
* @returns Mapa categoria -> descritores atribuídos
|
|
2174
|
+
* @category Utils
|
|
2175
|
+
* @since 0.4.1
|
|
2176
|
+
*/
|
|
2177
|
+
declare function categorizeDiscoveredCookies(discovered?: CookieDescriptor[], registerOverrides?: boolean): Record<Category, CookieDescriptor[]>;
|
|
1638
2178
|
|
|
1639
|
-
|
|
2179
|
+
/** @module src/utils/theme */
|
|
2180
|
+
/**
|
|
2181
|
+
* @category Utils
|
|
2182
|
+
* @since 0.1.0
|
|
2183
|
+
* Utilitários para criação e gerenciamento de temas Material-UI para componentes de consentimento LGPD.
|
|
2184
|
+
*
|
|
2185
|
+
* Fornece um tema padrão consistente e acessível, com opções de personalização.
|
|
2186
|
+
*/
|
|
1640
2187
|
|
|
1641
2188
|
/**
|
|
1642
|
-
* @
|
|
2189
|
+
* @function
|
|
1643
2190
|
* @category Utils
|
|
1644
2191
|
* @since 0.1.0
|
|
1645
2192
|
* Tema padrão utilizado pelos componentes de consentimento da biblioteca.
|
|
@@ -1647,6 +2194,16 @@ declare function loadScript(id: string, src: string, category?: Category | null,
|
|
|
1647
2194
|
* Inclui configurações de cores, tipografia e estilos para componentes Material-UI,
|
|
1648
2195
|
* garantindo aparência consistente e acessível conforme guidelines LGPD.
|
|
1649
2196
|
*
|
|
2197
|
+
* @returns {Theme} Instância do tema Material-UI configurado.
|
|
2198
|
+
*
|
|
2199
|
+
* @example
|
|
2200
|
+
* ```typescript
|
|
2201
|
+
* import { createDefaultConsentTheme } from 'react-lgpd-consent'
|
|
2202
|
+
*
|
|
2203
|
+
* const theme = createDefaultConsentTheme()
|
|
2204
|
+
* // Use com ThemeProvider
|
|
2205
|
+
* ```
|
|
2206
|
+
*
|
|
1650
2207
|
* @remarks
|
|
1651
2208
|
* Pode ser sobrescrito via ThemeProvider externo se necessário.
|
|
1652
2209
|
*/
|
|
@@ -1657,99 +2214,225 @@ declare function createDefaultConsentTheme(): Theme;
|
|
|
1657
2214
|
* @deprecated Use `createDefaultConsentTheme()` em vez de importar um tema criado no escopo do módulo.
|
|
1658
2215
|
* Importar um tema já instanciado pode causar side-effects em SSR e conflitos de contexto.
|
|
1659
2216
|
* Esta função retorna uma nova instância do tema quando chamada.
|
|
2217
|
+
*
|
|
2218
|
+
* @returns {Theme} Instância do tema Material-UI configurado.
|
|
2219
|
+
*
|
|
2220
|
+
* @example
|
|
2221
|
+
* ```typescript
|
|
2222
|
+
* import { defaultConsentTheme } from 'react-lgpd-consent'
|
|
2223
|
+
*
|
|
2224
|
+
* const theme = defaultConsentTheme()
|
|
2225
|
+
* // Deprecated, use createDefaultConsentTheme instead
|
|
2226
|
+
* ```
|
|
1660
2227
|
*/
|
|
1661
2228
|
declare const defaultConsentTheme: () => Theme;
|
|
1662
2229
|
|
|
1663
2230
|
/**
|
|
1664
|
-
* @
|
|
1665
|
-
*
|
|
2231
|
+
* @fileoverview
|
|
2232
|
+
* Integrações nativas de scripts (GA, GTM, Facebook Pixel, Hotjar, Mixpanel, Clarity, Intercom, Zendesk, UserWay)
|
|
2233
|
+
* com categorias LGPD padrão, cookies típicos e pontos de extensão para URLs.
|
|
2234
|
+
*
|
|
2235
|
+
* Princípios:
|
|
2236
|
+
* - Cada integração define uma categoria padrão (mais aderente ao uso no mercado)
|
|
2237
|
+
* - Cada cookie típico aparece em uma única categoria por padrão
|
|
2238
|
+
* - URLs possuem valores default atualizados e podem ser sobrescritos via `scriptUrl`
|
|
2239
|
+
* - SSR-safe: toda execução que toca `window` é protegida
|
|
2240
|
+
*/
|
|
2241
|
+
/**
|
|
2242
|
+
* Integração de script de terceiros condicionada a consentimento.
|
|
2243
|
+
*
|
|
2244
|
+
* @category Utils
|
|
2245
|
+
* @since 0.2.0
|
|
1666
2246
|
*
|
|
1667
2247
|
* @remarks
|
|
1668
|
-
*
|
|
1669
|
-
*
|
|
1670
|
-
*
|
|
2248
|
+
* **Breaking Change em v0.4.1**: O campo `category` mudou de `Category` para `string`
|
|
2249
|
+
* para suportar categorias customizadas. Código existente usando strings literais
|
|
2250
|
+
* continua funcionando sem alterações.
|
|
2251
|
+
*
|
|
2252
|
+
* @example
|
|
2253
|
+
* ```typescript
|
|
2254
|
+
* const integration: ScriptIntegration = {
|
|
2255
|
+
* id: 'my-script',
|
|
2256
|
+
* category: 'analytics',
|
|
2257
|
+
* src: 'https://example.com/script.js',
|
|
2258
|
+
* cookies: ['_example'],
|
|
2259
|
+
* init: () => console.log('Script initialized')
|
|
2260
|
+
* }
|
|
2261
|
+
* ```
|
|
1671
2262
|
*/
|
|
1672
|
-
|
|
1673
2263
|
interface ScriptIntegration {
|
|
1674
|
-
/**
|
|
2264
|
+
/** Identificador único da integração */
|
|
1675
2265
|
id: string;
|
|
1676
|
-
/**
|
|
1677
|
-
|
|
1678
|
-
|
|
2266
|
+
/**
|
|
2267
|
+
* Categoria LGPD à qual o script pertence.
|
|
2268
|
+
* Suporta tanto categorias predefinidas quanto customizadas.
|
|
2269
|
+
*/
|
|
2270
|
+
category: string;
|
|
2271
|
+
/** Nome legível da integração (opcional) */
|
|
2272
|
+
name?: string;
|
|
2273
|
+
/** URL do script a ser carregado */
|
|
1679
2274
|
src: string;
|
|
1680
|
-
/**
|
|
2275
|
+
/** Se o script deve ser carregado de forma assíncrona */
|
|
2276
|
+
async?: boolean;
|
|
2277
|
+
/** Se o script deve ser deferido */
|
|
2278
|
+
defer?: boolean;
|
|
2279
|
+
/** Configuração específica da integração */
|
|
2280
|
+
config?: Record<string, unknown>;
|
|
2281
|
+
/** Função de inicialização executada após carregamento do script */
|
|
1681
2282
|
init?: () => void;
|
|
1682
|
-
/**
|
|
2283
|
+
/** Atributos HTML adicionais para a tag script */
|
|
1683
2284
|
attrs?: Record<string, string>;
|
|
2285
|
+
/** Lista de cookies que o script pode definir */
|
|
2286
|
+
cookies?: string[];
|
|
2287
|
+
/** Informações detalhadas dos cookies (nome, finalidade, duração, fornecedor) */
|
|
2288
|
+
cookiesInfo?: Array<{
|
|
2289
|
+
name: string;
|
|
2290
|
+
purpose: string;
|
|
2291
|
+
duration: string;
|
|
2292
|
+
provider: string;
|
|
2293
|
+
}>;
|
|
1684
2294
|
}
|
|
1685
2295
|
/**
|
|
1686
|
-
*
|
|
1687
|
-
*
|
|
2296
|
+
* Configuração para integração do Google Analytics (GA4).
|
|
2297
|
+
*
|
|
2298
|
+
* @category Utils
|
|
2299
|
+
* @since 0.2.0
|
|
2300
|
+
*
|
|
2301
|
+
* @example
|
|
2302
|
+
* ```typescript
|
|
2303
|
+
* const config: GoogleAnalyticsConfig = {
|
|
2304
|
+
* measurementId: 'G-XXXXXXXXXX',
|
|
2305
|
+
* config: { anonymize_ip: true }
|
|
2306
|
+
* }
|
|
2307
|
+
* ```
|
|
1688
2308
|
*/
|
|
1689
2309
|
interface GoogleAnalyticsConfig {
|
|
1690
|
-
/**
|
|
2310
|
+
/** ID de medição do GA4 (formato: G-XXXXXXXXXX) */
|
|
1691
2311
|
measurementId: string;
|
|
1692
|
-
/**
|
|
2312
|
+
/** Configurações adicionais para o gtag */
|
|
1693
2313
|
config?: Record<string, unknown>;
|
|
2314
|
+
/** URL do script GA4. Se omitido usa o padrão oficial. */
|
|
2315
|
+
scriptUrl?: string;
|
|
1694
2316
|
}
|
|
1695
2317
|
/**
|
|
1696
|
-
*
|
|
1697
|
-
*
|
|
2318
|
+
* Configuração para integração do Google Tag Manager (GTM).
|
|
2319
|
+
*
|
|
2320
|
+
* @category Utils
|
|
2321
|
+
* @since 0.2.0
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```typescript
|
|
2325
|
+
* const config: GoogleTagManagerConfig = {
|
|
2326
|
+
* containerId: 'GTM-XXXXXXX',
|
|
2327
|
+
* dataLayerName: 'customDataLayer'
|
|
2328
|
+
* }
|
|
2329
|
+
* ```
|
|
1698
2330
|
*/
|
|
1699
2331
|
interface GoogleTagManagerConfig {
|
|
1700
|
-
/**
|
|
2332
|
+
/** ID do container GTM (formato: GTM-XXXXXXX) */
|
|
1701
2333
|
containerId: string;
|
|
1702
|
-
/**
|
|
2334
|
+
/** Nome customizado para o dataLayer. Padrão: 'dataLayer' */
|
|
1703
2335
|
dataLayerName?: string;
|
|
2336
|
+
/** URL do script GTM. Se omitido usa o padrão oficial. */
|
|
2337
|
+
scriptUrl?: string;
|
|
1704
2338
|
}
|
|
1705
2339
|
/**
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
2340
|
+
* Configuração para integração do UserWay (Acessibilidade).
|
|
2341
|
+
*
|
|
2342
|
+
* @category Utils
|
|
2343
|
+
* @since 0.2.0
|
|
2344
|
+
*
|
|
2345
|
+
* @example
|
|
2346
|
+
* ```typescript
|
|
2347
|
+
* const config: UserWayConfig = {
|
|
2348
|
+
* accountId: 'XXXXXXXXXX'
|
|
2349
|
+
* }
|
|
2350
|
+
* ```
|
|
1708
2351
|
*/
|
|
1709
2352
|
interface UserWayConfig {
|
|
1710
|
-
/**
|
|
2353
|
+
/** ID da conta UserWay */
|
|
1711
2354
|
accountId: string;
|
|
2355
|
+
/** URL do script UserWay. Se omitido usa o padrão oficial. */
|
|
2356
|
+
scriptUrl?: string;
|
|
1712
2357
|
}
|
|
1713
2358
|
/**
|
|
1714
|
-
*
|
|
2359
|
+
* Cria integração do Google Analytics (GA4).
|
|
2360
|
+
* Configura o gtag e inicializa o tracking com o measurement ID fornecido.
|
|
2361
|
+
*
|
|
1715
2362
|
* @category Utils
|
|
2363
|
+
* @param config - Configuração do Google Analytics
|
|
2364
|
+
* @returns Integração configurada para o GA4
|
|
1716
2365
|
* @since 0.2.0
|
|
1717
|
-
* Cria uma integração para Google Analytics 4 (GA4).
|
|
1718
2366
|
*
|
|
1719
|
-
* @
|
|
1720
|
-
*
|
|
2367
|
+
* @example
|
|
2368
|
+
* ```typescript
|
|
2369
|
+
* const ga = createGoogleAnalyticsIntegration({
|
|
2370
|
+
* measurementId: 'G-XXXXXXXXXX',
|
|
2371
|
+
* config: { anonymize_ip: true }
|
|
2372
|
+
* })
|
|
2373
|
+
* ```
|
|
2374
|
+
*
|
|
2375
|
+
* @remarks
|
|
2376
|
+
* - Define cookies: _ga, _ga_*, _gid
|
|
2377
|
+
* - Categoria padrão: 'analytics'
|
|
2378
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
1721
2379
|
*/
|
|
1722
2380
|
declare function createGoogleAnalyticsIntegration(config: GoogleAnalyticsConfig): ScriptIntegration;
|
|
1723
2381
|
/**
|
|
1724
|
-
*
|
|
2382
|
+
* Cria integração do Google Tag Manager (GTM).
|
|
2383
|
+
* Configura o dataLayer e inicializa o container GTM.
|
|
2384
|
+
*
|
|
1725
2385
|
* @category Utils
|
|
2386
|
+
* @param config - Configuração do Google Tag Manager
|
|
2387
|
+
* @returns Integração configurada para o GTM
|
|
1726
2388
|
* @since 0.2.0
|
|
1727
|
-
* Cria uma integração para Google Tag Manager (GTM).
|
|
1728
2389
|
*
|
|
1729
|
-
* @
|
|
1730
|
-
*
|
|
2390
|
+
* @example
|
|
2391
|
+
* ```typescript
|
|
2392
|
+
* const gtm = createGoogleTagManagerIntegration({
|
|
2393
|
+
* containerId: 'GTM-XXXXXXX',
|
|
2394
|
+
* dataLayerName: 'myDataLayer'
|
|
2395
|
+
* })
|
|
2396
|
+
* ```
|
|
2397
|
+
*
|
|
2398
|
+
* @remarks
|
|
2399
|
+
* - Define cookies: _gcl_au
|
|
2400
|
+
* - Categoria padrão: 'analytics'
|
|
2401
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
1731
2402
|
*/
|
|
1732
2403
|
declare function createGoogleTagManagerIntegration(config: GoogleTagManagerConfig): ScriptIntegration;
|
|
1733
2404
|
/**
|
|
1734
|
-
*
|
|
2405
|
+
* Cria integração do UserWay (Acessibilidade).
|
|
2406
|
+
* Configura o widget de acessibilidade UserWay.
|
|
2407
|
+
*
|
|
1735
2408
|
* @category Utils
|
|
2409
|
+
* @param config - Configuração do UserWay
|
|
2410
|
+
* @returns Integração configurada para o UserWay
|
|
1736
2411
|
* @since 0.2.0
|
|
1737
|
-
* Cria uma integração para o widget de acessibilidade UserWay.
|
|
1738
2412
|
*
|
|
1739
|
-
* @
|
|
1740
|
-
*
|
|
2413
|
+
* @example
|
|
2414
|
+
* ```typescript
|
|
2415
|
+
* const userway = createUserWayIntegration({
|
|
2416
|
+
* accountId: 'XXXXXXXXXX'
|
|
2417
|
+
* })
|
|
2418
|
+
* ```
|
|
2419
|
+
*
|
|
2420
|
+
* @remarks
|
|
2421
|
+
* - Define cookies: _userway_*
|
|
2422
|
+
* - Categoria padrão: 'functional'
|
|
2423
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
1741
2424
|
*/
|
|
1742
2425
|
declare function createUserWayIntegration(config: UserWayConfig): ScriptIntegration;
|
|
1743
2426
|
/**
|
|
1744
|
-
*
|
|
2427
|
+
* Funções fábricas para integrações comuns.
|
|
2428
|
+
* Fornece acesso direto às funções de criação de integrações pré-configuradas.
|
|
2429
|
+
*
|
|
1745
2430
|
* @category Utils
|
|
1746
2431
|
* @since 0.2.0
|
|
1747
|
-
* Objeto contendo as factory functions para as integrações pré-configuradas mais comuns.
|
|
1748
2432
|
*
|
|
1749
2433
|
* @example
|
|
1750
|
-
* ```
|
|
1751
|
-
*
|
|
1752
|
-
* const gaIntegration = COMMON_INTEGRATIONS.googleAnalytics({ measurementId: 'G-XYZ' });
|
|
2434
|
+
* ```typescript
|
|
2435
|
+
* const ga = COMMON_INTEGRATIONS.googleAnalytics({ measurementId: 'G-XXXXXXXXXX' })
|
|
1753
2436
|
* ```
|
|
1754
2437
|
*/
|
|
1755
2438
|
declare const COMMON_INTEGRATIONS: {
|
|
@@ -1757,6 +2440,485 @@ declare const COMMON_INTEGRATIONS: {
|
|
|
1757
2440
|
googleTagManager: typeof createGoogleTagManagerIntegration;
|
|
1758
2441
|
userway: typeof createUserWayIntegration;
|
|
1759
2442
|
};
|
|
2443
|
+
/**
|
|
2444
|
+
* Configuração para integração do Facebook Pixel.
|
|
2445
|
+
*
|
|
2446
|
+
* @category Utils
|
|
2447
|
+
* @since 0.4.1
|
|
2448
|
+
*
|
|
2449
|
+
* @example
|
|
2450
|
+
* ```typescript
|
|
2451
|
+
* const config: FacebookPixelConfig = {
|
|
2452
|
+
* pixelId: '1234567890123456',
|
|
2453
|
+
* autoTrack: true,
|
|
2454
|
+
* advancedMatching: { email: 'user@example.com' }
|
|
2455
|
+
* }
|
|
2456
|
+
* ```
|
|
2457
|
+
*/
|
|
2458
|
+
interface FacebookPixelConfig {
|
|
2459
|
+
/** ID do pixel do Facebook */
|
|
2460
|
+
pixelId: string;
|
|
2461
|
+
/** Se deve rastrear PageView automaticamente. Padrão: true */
|
|
2462
|
+
autoTrack?: boolean;
|
|
2463
|
+
/** Configuração de correspondência avançada */
|
|
2464
|
+
advancedMatching?: Record<string, unknown>;
|
|
2465
|
+
/** URL do script do Pixel. Se omitido usa o padrão oficial. */
|
|
2466
|
+
scriptUrl?: string;
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* Configuração para integração do Hotjar.
|
|
2470
|
+
*
|
|
2471
|
+
* @category Utils
|
|
2472
|
+
* @since 0.4.1
|
|
2473
|
+
*
|
|
2474
|
+
* @example
|
|
2475
|
+
* ```typescript
|
|
2476
|
+
* const config: HotjarConfig = {
|
|
2477
|
+
* siteId: '1234567',
|
|
2478
|
+
* version: 6,
|
|
2479
|
+
* debug: false
|
|
2480
|
+
* }
|
|
2481
|
+
* ```
|
|
2482
|
+
*/
|
|
2483
|
+
interface HotjarConfig {
|
|
2484
|
+
/** ID do site no Hotjar */
|
|
2485
|
+
siteId: string;
|
|
2486
|
+
/** Versão do script Hotjar. Padrão: 6 */
|
|
2487
|
+
version?: number;
|
|
2488
|
+
/** Ativar modo debug. Padrão: false */
|
|
2489
|
+
debug?: boolean;
|
|
2490
|
+
/** URL do script Hotjar. Se omitido usa o padrão oficial. */
|
|
2491
|
+
scriptUrl?: string;
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Configuração para integração do Mixpanel.
|
|
2495
|
+
*
|
|
2496
|
+
* @category Utils
|
|
2497
|
+
* @since 0.4.1
|
|
2498
|
+
*
|
|
2499
|
+
* @example
|
|
2500
|
+
* ```typescript
|
|
2501
|
+
* const config: MixpanelConfig = {
|
|
2502
|
+
* token: 'your-project-token',
|
|
2503
|
+
* config: { debug: true },
|
|
2504
|
+
* api_host: 'https://api.mixpanel.com'
|
|
2505
|
+
* }
|
|
2506
|
+
* ```
|
|
2507
|
+
*/
|
|
2508
|
+
interface MixpanelConfig {
|
|
2509
|
+
/** Token do projeto Mixpanel */
|
|
2510
|
+
token: string;
|
|
2511
|
+
/** Configurações adicionais do Mixpanel */
|
|
2512
|
+
config?: Record<string, unknown>;
|
|
2513
|
+
/** Host customizado da API Mixpanel */
|
|
2514
|
+
api_host?: string;
|
|
2515
|
+
/** URL do script Mixpanel. Se omitido usa o padrão oficial. */
|
|
2516
|
+
scriptUrl?: string;
|
|
2517
|
+
}
|
|
2518
|
+
/**
|
|
2519
|
+
* Configuração para integração do Microsoft Clarity.
|
|
2520
|
+
*
|
|
2521
|
+
* @category Utils
|
|
2522
|
+
* @since 0.4.1
|
|
2523
|
+
*
|
|
2524
|
+
* @example
|
|
2525
|
+
* ```typescript
|
|
2526
|
+
* const config: ClarityConfig = {
|
|
2527
|
+
* projectId: 'abcdefghij',
|
|
2528
|
+
* upload: true
|
|
2529
|
+
* }
|
|
2530
|
+
* ```
|
|
2531
|
+
*/
|
|
2532
|
+
interface ClarityConfig {
|
|
2533
|
+
/** ID do projeto no Microsoft Clarity */
|
|
2534
|
+
projectId: string;
|
|
2535
|
+
/** Configuração de upload de dados. Padrão: indefinido */
|
|
2536
|
+
upload?: boolean;
|
|
2537
|
+
/** URL do script Clarity. Se omitido usa o padrão oficial. */
|
|
2538
|
+
scriptUrl?: string;
|
|
2539
|
+
}
|
|
2540
|
+
/**
|
|
2541
|
+
* Configuração para integração do Intercom.
|
|
2542
|
+
*
|
|
2543
|
+
* @category Utils
|
|
2544
|
+
* @since 0.4.1
|
|
2545
|
+
*
|
|
2546
|
+
* @example
|
|
2547
|
+
* ```typescript
|
|
2548
|
+
* const config: IntercomConfig = {
|
|
2549
|
+
* app_id: 'your-app-id'
|
|
2550
|
+
* }
|
|
2551
|
+
* ```
|
|
2552
|
+
*/
|
|
2553
|
+
interface IntercomConfig {
|
|
2554
|
+
/** ID da aplicação Intercom */
|
|
2555
|
+
app_id: string;
|
|
2556
|
+
/** URL do script Intercom. Se omitido usa o padrão oficial. */
|
|
2557
|
+
scriptUrl?: string;
|
|
2558
|
+
}
|
|
2559
|
+
/**
|
|
2560
|
+
* Configuração para integração do Zendesk Chat.
|
|
2561
|
+
*
|
|
2562
|
+
* @category Utils
|
|
2563
|
+
* @since 0.4.1
|
|
2564
|
+
*
|
|
2565
|
+
* @example
|
|
2566
|
+
* ```typescript
|
|
2567
|
+
* const config: ZendeskConfig = {
|
|
2568
|
+
* key: 'your-zendesk-key'
|
|
2569
|
+
* }
|
|
2570
|
+
* ```
|
|
2571
|
+
*/
|
|
2572
|
+
interface ZendeskConfig {
|
|
2573
|
+
/** Chave de identificação do Zendesk */
|
|
2574
|
+
key: string;
|
|
2575
|
+
/** URL do script Zendesk. Se omitido usa o padrão oficial. */
|
|
2576
|
+
scriptUrl?: string;
|
|
2577
|
+
}
|
|
2578
|
+
/**
|
|
2579
|
+
* Cria integração do Facebook Pixel.
|
|
2580
|
+
* Configura o fbq e inicializa o pixel com tracking automático opcional.
|
|
2581
|
+
*
|
|
2582
|
+
* @category Utils
|
|
2583
|
+
* @param config - Configuração do Facebook Pixel
|
|
2584
|
+
* @returns Integração configurada para o Facebook Pixel
|
|
2585
|
+
* @since 0.4.1
|
|
2586
|
+
*
|
|
2587
|
+
* @example
|
|
2588
|
+
* ```typescript
|
|
2589
|
+
* const pixel = createFacebookPixelIntegration({
|
|
2590
|
+
* pixelId: '1234567890123456',
|
|
2591
|
+
* autoTrack: true
|
|
2592
|
+
* })
|
|
2593
|
+
* ```
|
|
2594
|
+
*
|
|
2595
|
+
* @remarks
|
|
2596
|
+
* - Define cookies: _fbp, fr
|
|
2597
|
+
* - Categoria padrão: 'marketing'
|
|
2598
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2599
|
+
*/
|
|
2600
|
+
declare function createFacebookPixelIntegration(config: FacebookPixelConfig): ScriptIntegration;
|
|
2601
|
+
/**
|
|
2602
|
+
* Cria integração do Hotjar.
|
|
2603
|
+
* Configura as configurações do Hotjar e inicializa o tracking de heatmaps e gravações.
|
|
2604
|
+
*
|
|
2605
|
+
* @category Utils
|
|
2606
|
+
* @param config - Configuração do Hotjar
|
|
2607
|
+
* @returns Integração configurada para o Hotjar
|
|
2608
|
+
* @since 0.4.1
|
|
2609
|
+
*
|
|
2610
|
+
* @example
|
|
2611
|
+
* ```typescript
|
|
2612
|
+
* const hotjar = createHotjarIntegration({
|
|
2613
|
+
* siteId: '1234567',
|
|
2614
|
+
* debug: true
|
|
2615
|
+
* })
|
|
2616
|
+
* ```
|
|
2617
|
+
*
|
|
2618
|
+
* @remarks
|
|
2619
|
+
* - Define cookies: _hjSession_*, _hjSessionUser_*, _hjFirstSeen, _hjIncludedInSessionSample, _hjAbsoluteSessionInProgress
|
|
2620
|
+
* - Categoria padrão: 'analytics'
|
|
2621
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2622
|
+
*/
|
|
2623
|
+
declare function createHotjarIntegration(config: HotjarConfig): ScriptIntegration;
|
|
2624
|
+
/**
|
|
2625
|
+
* Cria integração do Mixpanel.
|
|
2626
|
+
* Configura e inicializa o Mixpanel para analytics de eventos.
|
|
2627
|
+
*
|
|
2628
|
+
* @category Utils
|
|
2629
|
+
* @param config - Configuração do Mixpanel
|
|
2630
|
+
* @returns Integração configurada para o Mixpanel
|
|
2631
|
+
* @since 0.4.1
|
|
2632
|
+
*
|
|
2633
|
+
* @example
|
|
2634
|
+
* ```typescript
|
|
2635
|
+
* const mixpanel = createMixpanelIntegration({
|
|
2636
|
+
* token: 'your-project-token',
|
|
2637
|
+
* config: { debug: true }
|
|
2638
|
+
* })
|
|
2639
|
+
* ```
|
|
2640
|
+
*
|
|
2641
|
+
* @remarks
|
|
2642
|
+
* - Define cookies: mp_*
|
|
2643
|
+
* - Categoria padrão: 'analytics'
|
|
2644
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2645
|
+
* - Inclui tratamento de erro na inicialização
|
|
2646
|
+
*/
|
|
2647
|
+
declare function createMixpanelIntegration(config: MixpanelConfig): ScriptIntegration;
|
|
2648
|
+
/**
|
|
2649
|
+
* Cria integração do Microsoft Clarity.
|
|
2650
|
+
* Configura o Microsoft Clarity para heatmaps e analytics de comportamento.
|
|
2651
|
+
*
|
|
2652
|
+
* @category Utils
|
|
2653
|
+
* @param config - Configuração do Microsoft Clarity
|
|
2654
|
+
* @returns Integração configurada para o Clarity
|
|
2655
|
+
* @since 0.4.1
|
|
2656
|
+
*
|
|
2657
|
+
* @example
|
|
2658
|
+
* ```typescript
|
|
2659
|
+
* const clarity = createClarityIntegration({
|
|
2660
|
+
* projectId: 'abcdefghij',
|
|
2661
|
+
* upload: false
|
|
2662
|
+
* })
|
|
2663
|
+
* ```
|
|
2664
|
+
*
|
|
2665
|
+
* @remarks
|
|
2666
|
+
* - Define cookies: _clck, _clsk, CLID, ANONCHK, MR, MUID, SM
|
|
2667
|
+
* - Categoria padrão: 'analytics'
|
|
2668
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2669
|
+
* - Configuração de upload opcional
|
|
2670
|
+
*/
|
|
2671
|
+
declare function createClarityIntegration(config: ClarityConfig): ScriptIntegration;
|
|
2672
|
+
/**
|
|
2673
|
+
* Cria integração do Intercom.
|
|
2674
|
+
* Configura o widget de chat e suporte do Intercom.
|
|
2675
|
+
*
|
|
2676
|
+
* @category Utils
|
|
2677
|
+
* @param config - Configuração do Intercom
|
|
2678
|
+
* @returns Integração configurada para o Intercom
|
|
2679
|
+
* @since 0.4.1
|
|
2680
|
+
*
|
|
2681
|
+
* @example
|
|
2682
|
+
* ```typescript
|
|
2683
|
+
* const intercom = createIntercomIntegration({
|
|
2684
|
+
* app_id: 'your-app-id'
|
|
2685
|
+
* })
|
|
2686
|
+
* ```
|
|
2687
|
+
*
|
|
2688
|
+
* @remarks
|
|
2689
|
+
* - Define cookies: intercom-id-*, intercom-session-*
|
|
2690
|
+
* - Categoria padrão: 'functional'
|
|
2691
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2692
|
+
* - Inclui tratamento de erro na inicialização
|
|
2693
|
+
*/
|
|
2694
|
+
declare function createIntercomIntegration(config: IntercomConfig): ScriptIntegration;
|
|
2695
|
+
/**
|
|
2696
|
+
* Cria integração do Zendesk Chat.
|
|
2697
|
+
* Configura o widget de chat e suporte do Zendesk.
|
|
2698
|
+
*
|
|
2699
|
+
* @category Utils
|
|
2700
|
+
* @param config - Configuração do Zendesk Chat
|
|
2701
|
+
* @returns Integração configurada para o Zendesk Chat
|
|
2702
|
+
* @since 0.4.1
|
|
2703
|
+
*
|
|
2704
|
+
* @example
|
|
2705
|
+
* ```typescript
|
|
2706
|
+
* const zendesk = createZendeskChatIntegration({
|
|
2707
|
+
* key: 'your-zendesk-key'
|
|
2708
|
+
* })
|
|
2709
|
+
* ```
|
|
2710
|
+
*
|
|
2711
|
+
* @remarks
|
|
2712
|
+
* - Define cookies: __zlcmid, _zendesk_shared_session
|
|
2713
|
+
* - Categoria padrão: 'functional'
|
|
2714
|
+
* - SSR-safe: verifica disponibilidade do window
|
|
2715
|
+
* - Inclui tratamento de erro na identificação
|
|
2716
|
+
*/
|
|
2717
|
+
declare function createZendeskChatIntegration(config: ZendeskConfig): ScriptIntegration;
|
|
2718
|
+
/**
|
|
2719
|
+
* Configuração para conjunto de integrações de e-commerce.
|
|
2720
|
+
* Define configurações opcionais para múltiplas integrações otimizadas para e-commerce.
|
|
2721
|
+
*
|
|
2722
|
+
* @category Utils
|
|
2723
|
+
* @since 0.4.1
|
|
2724
|
+
*
|
|
2725
|
+
* @example
|
|
2726
|
+
* ```typescript
|
|
2727
|
+
* const config: ECommerceConfig = {
|
|
2728
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2729
|
+
* facebookPixel: { pixelId: '1234567890123456' }
|
|
2730
|
+
* }
|
|
2731
|
+
* ```
|
|
2732
|
+
*/
|
|
2733
|
+
interface ECommerceConfig {
|
|
2734
|
+
/** Configuração do Google Analytics */
|
|
2735
|
+
googleAnalytics?: GoogleAnalyticsConfig;
|
|
2736
|
+
/** Configuração do Facebook Pixel */
|
|
2737
|
+
facebookPixel?: FacebookPixelConfig;
|
|
2738
|
+
/** Configuração do Hotjar */
|
|
2739
|
+
hotjar?: HotjarConfig;
|
|
2740
|
+
/** Configuração do UserWay */
|
|
2741
|
+
userway?: UserWayConfig;
|
|
2742
|
+
}
|
|
2743
|
+
/**
|
|
2744
|
+
* Configuração para conjunto de integrações de SaaS.
|
|
2745
|
+
* Define configurações opcionais para múltiplas integrações otimizadas para SaaS.
|
|
2746
|
+
*
|
|
2747
|
+
* @category Utils
|
|
2748
|
+
* @since 0.4.1
|
|
2749
|
+
*
|
|
2750
|
+
* @example
|
|
2751
|
+
* ```typescript
|
|
2752
|
+
* const config: SaaSConfig = {
|
|
2753
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2754
|
+
* mixpanel: { token: 'your-token' },
|
|
2755
|
+
* intercom: { app_id: 'your-app-id' }
|
|
2756
|
+
* }
|
|
2757
|
+
* ```
|
|
2758
|
+
*/
|
|
2759
|
+
interface SaaSConfig {
|
|
2760
|
+
/** Configuração do Google Analytics */
|
|
2761
|
+
googleAnalytics?: GoogleAnalyticsConfig;
|
|
2762
|
+
/** Configuração do Mixpanel */
|
|
2763
|
+
mixpanel?: MixpanelConfig;
|
|
2764
|
+
/** Configuração do Intercom */
|
|
2765
|
+
intercom?: IntercomConfig;
|
|
2766
|
+
/** Configuração do Hotjar */
|
|
2767
|
+
hotjar?: HotjarConfig;
|
|
2768
|
+
}
|
|
2769
|
+
/**
|
|
2770
|
+
* Configuração para conjunto de integrações corporativas.
|
|
2771
|
+
* Define configurações opcionais para múltiplas integrações otimizadas para ambientes corporativos.
|
|
2772
|
+
*
|
|
2773
|
+
* @category Utils
|
|
2774
|
+
* @since 0.4.1
|
|
2775
|
+
*
|
|
2776
|
+
* @example
|
|
2777
|
+
* ```typescript
|
|
2778
|
+
* const config: CorporateConfig = {
|
|
2779
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2780
|
+
* clarity: { projectId: 'abcdefghij' },
|
|
2781
|
+
* userway: { accountId: 'XXXXXXXXXX' }
|
|
2782
|
+
* }
|
|
2783
|
+
* ```
|
|
2784
|
+
*/
|
|
2785
|
+
interface CorporateConfig {
|
|
2786
|
+
/** Configuração do Google Analytics */
|
|
2787
|
+
googleAnalytics?: GoogleAnalyticsConfig;
|
|
2788
|
+
/** Configuração do Microsoft Clarity */
|
|
2789
|
+
clarity?: ClarityConfig;
|
|
2790
|
+
/** Configuração do Zendesk Chat */
|
|
2791
|
+
zendesk?: ZendeskConfig;
|
|
2792
|
+
/** Configuração do UserWay */
|
|
2793
|
+
userway?: UserWayConfig;
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* Cria conjunto de integrações otimizado para e-commerce.
|
|
2797
|
+
* Combina analytics de conversão, remarketing e acessibilidade.
|
|
2798
|
+
*
|
|
2799
|
+
* @category Utils
|
|
2800
|
+
* @param cfg - Configuração das integrações de e-commerce
|
|
2801
|
+
* @returns Array de integrações configuradas
|
|
2802
|
+
* @since 0.4.1
|
|
2803
|
+
*
|
|
2804
|
+
* @example
|
|
2805
|
+
* ```typescript
|
|
2806
|
+
* const integrations = createECommerceIntegrations({
|
|
2807
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2808
|
+
* facebookPixel: { pixelId: '1234567890123456' }
|
|
2809
|
+
* })
|
|
2810
|
+
* ```
|
|
2811
|
+
*
|
|
2812
|
+
* @remarks
|
|
2813
|
+
* Combina categorias: analytics, marketing, functional
|
|
2814
|
+
*/
|
|
2815
|
+
declare function createECommerceIntegrations(cfg: ECommerceConfig): ScriptIntegration[];
|
|
2816
|
+
/**
|
|
2817
|
+
* Cria conjunto de integrações otimizado para SaaS.
|
|
2818
|
+
* Combina analytics de produto, suporte ao cliente e comportamento do usuário.
|
|
2819
|
+
*
|
|
2820
|
+
* @category Utils
|
|
2821
|
+
* @param cfg - Configuração das integrações de SaaS
|
|
2822
|
+
* @returns Array de integrações configuradas
|
|
2823
|
+
* @since 0.4.1
|
|
2824
|
+
*
|
|
2825
|
+
* @example
|
|
2826
|
+
* ```typescript
|
|
2827
|
+
* const integrations = createSaaSIntegrations({
|
|
2828
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2829
|
+
* mixpanel: { token: 'your-project-token' },
|
|
2830
|
+
* intercom: { app_id: 'your-app-id' }
|
|
2831
|
+
* })
|
|
2832
|
+
* ```
|
|
2833
|
+
*
|
|
2834
|
+
* @remarks
|
|
2835
|
+
* Combina categorias: analytics, functional
|
|
2836
|
+
*/
|
|
2837
|
+
declare function createSaaSIntegrations(cfg: SaaSConfig): ScriptIntegration[];
|
|
2838
|
+
/**
|
|
2839
|
+
* Cria conjunto de integrações otimizado para ambientes corporativos.
|
|
2840
|
+
* Combina analytics empresariais, compliance e suporte corporativo.
|
|
2841
|
+
*
|
|
2842
|
+
* @category Utils
|
|
2843
|
+
* @param cfg - Configuração das integrações corporativas
|
|
2844
|
+
* @returns Array de integrações configuradas
|
|
2845
|
+
* @since 0.4.1
|
|
2846
|
+
*
|
|
2847
|
+
* @example
|
|
2848
|
+
* ```typescript
|
|
2849
|
+
* const integrations = createCorporateIntegrations({
|
|
2850
|
+
* googleAnalytics: { measurementId: 'G-XXXXXXXXXX' },
|
|
2851
|
+
* clarity: { projectId: 'abcdefghij' },
|
|
2852
|
+
* userway: { accountId: 'XXXXXXXXXX' }
|
|
2853
|
+
* })
|
|
2854
|
+
* ```
|
|
2855
|
+
*
|
|
2856
|
+
* @remarks
|
|
2857
|
+
* Combina categorias: analytics, functional
|
|
2858
|
+
*/
|
|
2859
|
+
declare function createCorporateIntegrations(cfg: CorporateConfig): ScriptIntegration[];
|
|
2860
|
+
/**
|
|
2861
|
+
* Templates pré-configurados de integrações por tipo de negócio.
|
|
2862
|
+
* Define integrações essenciais e opcionais para cada contexto.
|
|
2863
|
+
*
|
|
2864
|
+
* @category Utils
|
|
2865
|
+
* @since 0.4.1
|
|
2866
|
+
*
|
|
2867
|
+
* @example
|
|
2868
|
+
* ```typescript
|
|
2869
|
+
* const template = INTEGRATION_TEMPLATES.ecommerce
|
|
2870
|
+
* console.log(template.essential) // ['google-analytics', 'facebook-pixel']
|
|
2871
|
+
* console.log(template.categories) // ['analytics', 'marketing', 'functional']
|
|
2872
|
+
* ```
|
|
2873
|
+
*
|
|
2874
|
+
* @remarks
|
|
2875
|
+
* Cada template define:
|
|
2876
|
+
* - essential: integrações obrigatórias/recomendadas
|
|
2877
|
+
* - optional: integrações complementares
|
|
2878
|
+
* - categories: categorias LGPD utilizadas
|
|
2879
|
+
*/
|
|
2880
|
+
declare const INTEGRATION_TEMPLATES: {
|
|
2881
|
+
ecommerce: {
|
|
2882
|
+
essential: string[];
|
|
2883
|
+
optional: string[];
|
|
2884
|
+
categories: string[];
|
|
2885
|
+
};
|
|
2886
|
+
saas: {
|
|
2887
|
+
essential: string[];
|
|
2888
|
+
optional: string[];
|
|
2889
|
+
categories: string[];
|
|
2890
|
+
};
|
|
2891
|
+
corporate: {
|
|
2892
|
+
essential: string[];
|
|
2893
|
+
optional: string[];
|
|
2894
|
+
categories: string[];
|
|
2895
|
+
};
|
|
2896
|
+
};
|
|
2897
|
+
/**
|
|
2898
|
+
* Sugere categorias LGPD apropriadas para um script baseado no nome/tipo.
|
|
2899
|
+
* Utiliza heurísticas para classificar scripts desconhecidos.
|
|
2900
|
+
*
|
|
2901
|
+
* @category Utils
|
|
2902
|
+
* @param name - Nome ou identificador do script
|
|
2903
|
+
* @returns Array de categorias sugeridas
|
|
2904
|
+
* @since 0.4.1
|
|
2905
|
+
*
|
|
2906
|
+
* @example
|
|
2907
|
+
* ```typescript
|
|
2908
|
+
* suggestCategoryForScript('facebook-pixel') // ['marketing']
|
|
2909
|
+
* suggestCategoryForScript('hotjar') // ['analytics']
|
|
2910
|
+
* suggestCategoryForScript('intercom-chat') // ['functional']
|
|
2911
|
+
* suggestCategoryForScript('unknown-script') // ['analytics']
|
|
2912
|
+
* ```
|
|
2913
|
+
*
|
|
2914
|
+
* @remarks
|
|
2915
|
+
* Heurísticas aplicadas:
|
|
2916
|
+
* - Scripts de ads/marketing → 'marketing'
|
|
2917
|
+
* - Scripts de analytics/tracking → 'analytics'
|
|
2918
|
+
* - Scripts de chat/suporte → 'functional'
|
|
2919
|
+
* - Padrão para desconhecidos → 'analytics'
|
|
2920
|
+
*/
|
|
2921
|
+
declare function suggestCategoryForScript(name: string): string[];
|
|
1760
2922
|
|
|
1761
2923
|
/**
|
|
1762
2924
|
* Componente que carrega scripts automaticamente baseado no consentimento.
|
|
@@ -1820,6 +2982,378 @@ declare function ConsentScriptLoader({ integrations, reloadOnChange, }: Readonly
|
|
|
1820
2982
|
*/
|
|
1821
2983
|
declare function useConsentScriptLoader(): (integration: ScriptIntegration) => Promise<boolean>;
|
|
1822
2984
|
|
|
2985
|
+
/**
|
|
2986
|
+
* @file autoConfigureCategories.ts
|
|
2987
|
+
* @description Sistema inteligente de auto-habilitação de categorias baseado nas integrações utilizadas
|
|
2988
|
+
* @since 0.4.1
|
|
2989
|
+
*/
|
|
2990
|
+
|
|
2991
|
+
/**
|
|
2992
|
+
* @interface CategoryAutoConfigResult
|
|
2993
|
+
* Resultado da análise e auto-configuração de categorias
|
|
2994
|
+
*/
|
|
2995
|
+
interface CategoryAutoConfigResult {
|
|
2996
|
+
/** Configuração original fornecida pelo desenvolvedor */
|
|
2997
|
+
originalConfig: ProjectCategoriesConfig;
|
|
2998
|
+
/** Configuração ajustada automaticamente pela biblioteca */
|
|
2999
|
+
adjustedConfig: ProjectCategoriesConfig;
|
|
3000
|
+
/** Categorias que foram automaticamente habilitadas */
|
|
3001
|
+
autoEnabledCategories: string[];
|
|
3002
|
+
/** Categorias requeridas pelas integrações mas não habilitadas */
|
|
3003
|
+
missingCategories: string[];
|
|
3004
|
+
/** Se algum ajuste foi necessário */
|
|
3005
|
+
wasAdjusted: boolean;
|
|
3006
|
+
/** Integrações que requerem cada categoria */
|
|
3007
|
+
categoryIntegrations: Record<string, string[]>;
|
|
3008
|
+
}
|
|
3009
|
+
/**
|
|
3010
|
+
* @function
|
|
3011
|
+
* @category Utils
|
|
3012
|
+
* @since 0.4.1
|
|
3013
|
+
* Analisa as integrações fornecidas e determina quais categorias são necessárias.
|
|
3014
|
+
*
|
|
3015
|
+
* @param integrations Array de integrações de script
|
|
3016
|
+
* @returns Record mapeando categoria para nomes das integrações que a utilizam
|
|
3017
|
+
*/
|
|
3018
|
+
declare function analyzeIntegrationCategories(integrations: ScriptIntegration[]): Record<string, string[]>;
|
|
3019
|
+
/**
|
|
3020
|
+
* @function
|
|
3021
|
+
* @category Utils
|
|
3022
|
+
* @since 0.4.1
|
|
3023
|
+
* Configura automaticamente as categorias necessárias baseado nas integrações utilizadas.
|
|
3024
|
+
*
|
|
3025
|
+
* Esta função implementa o comportamento inteligente da biblioteca:
|
|
3026
|
+
* 1. Detecta categorias requeridas pelas integrações
|
|
3027
|
+
* 2. Auto-habilita categorias em falta (modo padrão)
|
|
3028
|
+
* 3. Ou apenas avisa sobre categorias em falta (modo warning-only)
|
|
3029
|
+
* 4. Loga no console em modo DEV
|
|
3030
|
+
*
|
|
3031
|
+
* @param originalConfig Configuração original do ConsentProvider
|
|
3032
|
+
* @param integrations Array de integrações que serão utilizadas
|
|
3033
|
+
* @param options Opções de comportamento
|
|
3034
|
+
* @returns Resultado da análise e configuração automática
|
|
3035
|
+
*/
|
|
3036
|
+
declare function autoConfigureCategories(originalConfig: ProjectCategoriesConfig | undefined, integrations: ScriptIntegration[], options?: {
|
|
3037
|
+
/** Se true, apenas avisa mas não modifica a config (padrão: false - auto-habilita) */
|
|
3038
|
+
warningOnly?: boolean;
|
|
3039
|
+
/** Se true, desabilita logs no console (padrão: false) */
|
|
3040
|
+
silent?: boolean;
|
|
3041
|
+
}): CategoryAutoConfigResult;
|
|
3042
|
+
/**
|
|
3043
|
+
* @function
|
|
3044
|
+
* @category Utils
|
|
3045
|
+
* @since 0.4.1
|
|
3046
|
+
* Valida se todas as integrações têm suas categorias habilitadas.
|
|
3047
|
+
* Útil para validação em tempo de execução.
|
|
3048
|
+
*
|
|
3049
|
+
* @param integrations Array de integrações
|
|
3050
|
+
* @param enabledCategories Array de categorias habilitadas
|
|
3051
|
+
* @returns true se todas as categorias necessárias estão habilitadas
|
|
3052
|
+
*/
|
|
3053
|
+
declare function validateIntegrationCategories(integrations: ScriptIntegration[], enabledCategories: string[]): boolean;
|
|
3054
|
+
/**
|
|
3055
|
+
* @function
|
|
3056
|
+
* @category Utils
|
|
3057
|
+
* @since 0.4.1
|
|
3058
|
+
* Extrai categorias únicas de um array de integrações
|
|
3059
|
+
*
|
|
3060
|
+
* @param integrations Array de integrações
|
|
3061
|
+
* @returns Array de categorias únicas
|
|
3062
|
+
*/
|
|
3063
|
+
declare function extractCategoriesFromIntegrations(integrations: ScriptIntegration[]): string[];
|
|
3064
|
+
/**
|
|
3065
|
+
* @function
|
|
3066
|
+
* @category Utils
|
|
3067
|
+
* @since 0.4.1
|
|
3068
|
+
* Valida se integrações estão sendo incorretamente classificadas como "necessary".
|
|
3069
|
+
*
|
|
3070
|
+
* Esta função protege contra violações de GDPR/LGPD identificando scripts que
|
|
3071
|
+
* NUNCA devem ser considerados estritamente necessários.
|
|
3072
|
+
*
|
|
3073
|
+
* @param integrations Array de integrações para validar
|
|
3074
|
+
* @param enabledCategories Categorias habilitadas na configuração
|
|
3075
|
+
* @returns Lista de avisos sobre classificações incorretas
|
|
3076
|
+
*
|
|
3077
|
+
* @example
|
|
3078
|
+
* ```typescript
|
|
3079
|
+
* const warnings = validateNecessaryClassification([
|
|
3080
|
+
* createGoogleAnalyticsIntegration({...}), // ❌ NUNCA é necessary
|
|
3081
|
+
* createCustomIntegration({...}) // ✅ Pode ser necessary se apropriado
|
|
3082
|
+
* ], ['necessary', 'analytics'])
|
|
3083
|
+
*
|
|
3084
|
+
* if (warnings.length > 0) {
|
|
3085
|
+
* console.warn('Scripts incorretamente classificados como necessary:', warnings)
|
|
3086
|
+
* }
|
|
3087
|
+
* ```
|
|
3088
|
+
*/
|
|
3089
|
+
declare function validateNecessaryClassification(integrations: ScriptIntegration[], enabledCategories: Category[]): string[];
|
|
3090
|
+
|
|
3091
|
+
/**
|
|
3092
|
+
* @fileoverview
|
|
3093
|
+
* Sistema de textos expandido com suporte avançado a internacionalização,
|
|
3094
|
+
* contextos específicos e variações de tom.
|
|
3095
|
+
*
|
|
3096
|
+
* @author Luciano Édipo
|
|
3097
|
+
* @since 0.4.1
|
|
3098
|
+
*/
|
|
3099
|
+
|
|
3100
|
+
/**
|
|
3101
|
+
* Tipo auxiliar para variações de texto.
|
|
3102
|
+
*
|
|
3103
|
+
* Define um subconjunto opcional dos textos principais do banner e modal,
|
|
3104
|
+
* permitindo variações de t es: {
|
|
3105
|
+
bannerMessage: 'Utilizamos cookies para mejorar su experiencia y mostrar contenido personalizado.', (formal, casual, etc.) sem sobrescrever todos os textos.
|
|
3106
|
+
*
|
|
3107
|
+
* @category Types
|
|
3108
|
+
* @since 0.4.1
|
|
3109
|
+
*/
|
|
3110
|
+
type TextVariant = Partial<Pick<ConsentTexts, 'bannerMessage' | 'acceptAll' | 'declineAll' | 'modalTitle'>>;
|
|
3111
|
+
/**
|
|
3112
|
+
* Tipo auxiliar para textos de idioma.
|
|
3113
|
+
*
|
|
3114
|
+
* Define um subconjunto dos textos principais, excluindo propriedades específicas de internacionalização
|
|
3115
|
+
* e contextos, para uso em configurações multilíngues.
|
|
3116
|
+
*
|
|
3117
|
+
* @category Types
|
|
3118
|
+
* @since 0.4.1
|
|
3119
|
+
*/
|
|
3120
|
+
type LanguageTexts = Partial<Omit<ConsentTexts, 'i18n' | 'variants' | 'contexts'>>;
|
|
3121
|
+
/**
|
|
3122
|
+
* Sistema de textos avançado com suporte a internacionalização e contextos específicos.
|
|
3123
|
+
*
|
|
3124
|
+
* Interface expandida que permite personalização granular de todas as mensagens da biblioteca.
|
|
3125
|
+
* Suporta múltiplos idiomas, contextos específicos (e-commerce, SaaS, governo), variações
|
|
3126
|
+
* de tom, e compliance completo com LGPD/ANPD.
|
|
3127
|
+
*
|
|
3128
|
+
* @category Types
|
|
3129
|
+
* @since 0.4.1
|
|
3130
|
+
* @version 0.4.1 - Nova interface com suporte avançado a i18n e contextos
|
|
3131
|
+
*
|
|
3132
|
+
* @example Configuração multilíngue
|
|
3133
|
+
* ```typescript
|
|
3134
|
+
* const multiLangTexts: AdvancedConsentTexts = {
|
|
3135
|
+
* // Herda de ConsentTexts básico
|
|
3136
|
+
* bannerMessage: 'Utilizamos cookies para melhorar sua experiência.',
|
|
3137
|
+
* acceptAll: 'Aceitar todos',
|
|
3138
|
+
* declineAll: 'Recusar',
|
|
3139
|
+
* preferences: 'Preferências',
|
|
3140
|
+
* modalTitle: 'Preferências de Cookies',
|
|
3141
|
+
* modalIntro: 'Personalize suas preferências de cookies.',
|
|
3142
|
+
* save: 'Salvar',
|
|
3143
|
+
* necessaryAlwaysOn: 'Cookies necessários (sempre ativos)',
|
|
3144
|
+
*
|
|
3145
|
+
* // Textos expandidos
|
|
3146
|
+
* variants: {
|
|
3147
|
+
* formal: {
|
|
3148
|
+
* bannerMessage: 'Este sítio utiliza cookies para otimizar a experiência de navegação.',
|
|
3149
|
+
* acceptAll: 'Concordar com todos os cookies'
|
|
3150
|
+
* },
|
|
3151
|
+
* casual: {
|
|
3152
|
+
* bannerMessage: '🍪 Olá! Usamos cookies para tornar tudo mais gostoso aqui.',
|
|
3153
|
+
* acceptAll: 'Aceitar tudo'
|
|
3154
|
+
* }
|
|
3155
|
+
* },
|
|
3156
|
+
*
|
|
3157
|
+
* // Internacionalização
|
|
3158
|
+
* i18n: {
|
|
3159
|
+
* en: {
|
|
3160
|
+
* bannerMessage: 'We use cookies to enhance your experience.',
|
|
3161
|
+
* acceptAll: 'Accept All',
|
|
3162
|
+
* declineAll: 'Decline'
|
|
3163
|
+
* },
|
|
3164
|
+
* es: {
|
|
3165
|
+
* bannerMessage: 'Utilizamos cookies para mejorar su experiencia.',
|
|
3166
|
+
* acceptAll: 'Aceptar Todo',
|
|
3167
|
+
* declineAll: 'Rechazar'
|
|
3168
|
+
* }
|
|
3169
|
+
* }
|
|
3170
|
+
* }
|
|
3171
|
+
* ```
|
|
3172
|
+
*/
|
|
3173
|
+
interface AdvancedConsentTexts extends ConsentTexts {
|
|
3174
|
+
/** Texto para confirmar ação */
|
|
3175
|
+
confirm?: string;
|
|
3176
|
+
/** Texto para cancelar ação */
|
|
3177
|
+
cancel?: string;
|
|
3178
|
+
/** Texto de carregamento */
|
|
3179
|
+
loading?: string;
|
|
3180
|
+
/** Textos específicos para cada categoria de cookie */
|
|
3181
|
+
categories?: {
|
|
3182
|
+
necessary?: {
|
|
3183
|
+
name?: string;
|
|
3184
|
+
description?: string;
|
|
3185
|
+
examples?: string;
|
|
3186
|
+
};
|
|
3187
|
+
analytics?: {
|
|
3188
|
+
name?: string;
|
|
3189
|
+
description?: string;
|
|
3190
|
+
examples?: string;
|
|
3191
|
+
};
|
|
3192
|
+
marketing?: {
|
|
3193
|
+
name?: string;
|
|
3194
|
+
description?: string;
|
|
3195
|
+
examples?: string;
|
|
3196
|
+
};
|
|
3197
|
+
functional?: {
|
|
3198
|
+
name?: string;
|
|
3199
|
+
description?: string;
|
|
3200
|
+
examples?: string;
|
|
3201
|
+
};
|
|
3202
|
+
performance?: {
|
|
3203
|
+
name?: string;
|
|
3204
|
+
description?: string;
|
|
3205
|
+
examples?: string;
|
|
3206
|
+
};
|
|
3207
|
+
};
|
|
3208
|
+
/** Mensagens de feedback ao usuário */
|
|
3209
|
+
feedback?: {
|
|
3210
|
+
/** Preferências salvas com sucesso */
|
|
3211
|
+
saveSuccess?: string;
|
|
3212
|
+
/** Erro ao salvar preferências */
|
|
3213
|
+
saveError?: string;
|
|
3214
|
+
/** Consentimento atualizado */
|
|
3215
|
+
consentUpdated?: string;
|
|
3216
|
+
/** Cookies rejeitados */
|
|
3217
|
+
cookiesRejected?: string;
|
|
3218
|
+
/** Configurações resetadas */
|
|
3219
|
+
settingsReset?: string;
|
|
3220
|
+
};
|
|
3221
|
+
/** Labels ARIA e textos para leitores de tela */
|
|
3222
|
+
accessibility?: {
|
|
3223
|
+
/** Label do banner para leitores de tela */
|
|
3224
|
+
bannerLabel?: string;
|
|
3225
|
+
/** Label do modal para leitores de tela */
|
|
3226
|
+
modalLabel?: string;
|
|
3227
|
+
/** Instrução de navegação por teclado */
|
|
3228
|
+
keyboardNavigation?: string;
|
|
3229
|
+
/** Estado do toggle de categoria */
|
|
3230
|
+
toggleState?: {
|
|
3231
|
+
enabled?: string;
|
|
3232
|
+
disabled?: string;
|
|
3233
|
+
};
|
|
3234
|
+
/** Região live para anúncios dinâmicos */
|
|
3235
|
+
liveRegion?: string;
|
|
3236
|
+
};
|
|
3237
|
+
/** Textos otimizados para diferentes contextos */
|
|
3238
|
+
contexts?: {
|
|
3239
|
+
/** Contexto e-commerce */
|
|
3240
|
+
ecommerce?: {
|
|
3241
|
+
cartAbandonment?: string;
|
|
3242
|
+
personalizedOffers?: string;
|
|
3243
|
+
paymentSecurity?: string;
|
|
3244
|
+
productRecommendations?: string;
|
|
3245
|
+
};
|
|
3246
|
+
/** Contexto SaaS */
|
|
3247
|
+
saas?: {
|
|
3248
|
+
userAnalytics?: string;
|
|
3249
|
+
performanceMonitoring?: string;
|
|
3250
|
+
featureUsage?: string;
|
|
3251
|
+
customerSupport?: string;
|
|
3252
|
+
};
|
|
3253
|
+
/** Contexto governamental */
|
|
3254
|
+
government?: {
|
|
3255
|
+
citizenServices?: string;
|
|
3256
|
+
dataProtection?: string;
|
|
3257
|
+
transparency?: string;
|
|
3258
|
+
accessibility?: string;
|
|
3259
|
+
};
|
|
3260
|
+
/** Contexto educacional */
|
|
3261
|
+
education?: {
|
|
3262
|
+
studentProgress?: string;
|
|
3263
|
+
learningAnalytics?: string;
|
|
3264
|
+
accessibility?: string;
|
|
3265
|
+
parentalConsent?: string;
|
|
3266
|
+
};
|
|
3267
|
+
};
|
|
3268
|
+
/** Diferentes variações de tom para a mesma mensagem */
|
|
3269
|
+
variants?: {
|
|
3270
|
+
/** Tom formal/profissional */
|
|
3271
|
+
formal?: TextVariant;
|
|
3272
|
+
/** Tom casual/amigável */
|
|
3273
|
+
casual?: TextVariant;
|
|
3274
|
+
/** Tom conciso/direto */
|
|
3275
|
+
concise?: TextVariant;
|
|
3276
|
+
/** Tom detalhado/explicativo */
|
|
3277
|
+
detailed?: TextVariant;
|
|
3278
|
+
};
|
|
3279
|
+
/** Suporte a múltiplos idiomas */
|
|
3280
|
+
i18n?: {
|
|
3281
|
+
/** Textos em inglês */
|
|
3282
|
+
en?: LanguageTexts;
|
|
3283
|
+
/** Textos em espanhol */
|
|
3284
|
+
es?: LanguageTexts;
|
|
3285
|
+
/** Textos em francês */
|
|
3286
|
+
fr?: LanguageTexts;
|
|
3287
|
+
/** Textos em alemão */
|
|
3288
|
+
de?: LanguageTexts;
|
|
3289
|
+
/** Textos em italiano */
|
|
3290
|
+
it?: LanguageTexts;
|
|
3291
|
+
};
|
|
3292
|
+
/** Informações técnicas sobre cookies */
|
|
3293
|
+
technical?: {
|
|
3294
|
+
/** Explicação sobre cookies de sessão */
|
|
3295
|
+
sessionCookies?: string;
|
|
3296
|
+
/** Explicação sobre cookies persistentes */
|
|
3297
|
+
persistentCookies?: string;
|
|
3298
|
+
/** Explicação sobre cookies de terceiros */
|
|
3299
|
+
thirdPartyCookies?: string;
|
|
3300
|
+
/** Como desabilitar cookies no navegador */
|
|
3301
|
+
browserSettings?: string;
|
|
3302
|
+
/** Impacto de desabilitar cookies */
|
|
3303
|
+
disablingImpact?: string;
|
|
3304
|
+
};
|
|
3305
|
+
/** Cabeçalhos para tabela de detalhes de cookies */
|
|
3306
|
+
cookieDetails?: {
|
|
3307
|
+
tableHeaders?: {
|
|
3308
|
+
name?: string;
|
|
3309
|
+
purpose?: string;
|
|
3310
|
+
duration?: string;
|
|
3311
|
+
provider?: string;
|
|
3312
|
+
type?: string;
|
|
3313
|
+
};
|
|
3314
|
+
/** Texto quando não há cookies para mostrar */
|
|
3315
|
+
noCookies?: string;
|
|
3316
|
+
/** Botão para expandir/colapsar detalhes */
|
|
3317
|
+
toggleDetails?: {
|
|
3318
|
+
expand?: string;
|
|
3319
|
+
collapse?: string;
|
|
3320
|
+
};
|
|
3321
|
+
};
|
|
3322
|
+
}
|
|
3323
|
+
/**
|
|
3324
|
+
* Textos padrão expandidos para diferentes contextos e idiomas.
|
|
3325
|
+
*
|
|
3326
|
+
* @category Utils
|
|
3327
|
+
* @since 0.4.1
|
|
3328
|
+
*/
|
|
3329
|
+
declare const EXPANDED_DEFAULT_TEXTS: Partial<AdvancedConsentTexts>;
|
|
3330
|
+
/**
|
|
3331
|
+
* Utilitário para resolver textos baseado em idioma, contexto e variação.
|
|
3332
|
+
*
|
|
3333
|
+
* @category Utils
|
|
3334
|
+
* @since 0.4.1
|
|
3335
|
+
*
|
|
3336
|
+
* @param texts - Textos avançados configurados
|
|
3337
|
+
* @param options - Opções de resolução
|
|
3338
|
+
* @returns Textos resolvidos para o contexto
|
|
3339
|
+
*/
|
|
3340
|
+
declare function resolveTexts(texts: AdvancedConsentTexts, options?: {
|
|
3341
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
3342
|
+
context?: 'ecommerce' | 'saas' | 'government' | 'education';
|
|
3343
|
+
variant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
3344
|
+
}): ConsentTexts;
|
|
3345
|
+
/**
|
|
3346
|
+
* Templates pré-configurados para diferentes contextos.
|
|
3347
|
+
*
|
|
3348
|
+
* @category Utils
|
|
3349
|
+
* @since 0.4.1
|
|
3350
|
+
*/
|
|
3351
|
+
declare const TEXT_TEMPLATES: {
|
|
3352
|
+
readonly ecommerce: AdvancedConsentTexts;
|
|
3353
|
+
readonly saas: AdvancedConsentTexts;
|
|
3354
|
+
readonly government: AdvancedConsentTexts;
|
|
3355
|
+
};
|
|
3356
|
+
|
|
1823
3357
|
/**
|
|
1824
3358
|
* @enum LogLevel
|
|
1825
3359
|
* @category Utils
|
|
@@ -1859,6 +3393,17 @@ declare enum LogLevel {
|
|
|
1859
3393
|
*/
|
|
1860
3394
|
declare function setDebugLogging(enabled: boolean, level?: LogLevel): void;
|
|
1861
3395
|
|
|
3396
|
+
interface CookieCatalogOverrides {
|
|
3397
|
+
byCategory?: Record<string, CookieDescriptor[]>;
|
|
3398
|
+
byIntegration?: Record<string, CookieDescriptor[]>;
|
|
3399
|
+
}
|
|
3400
|
+
interface CookieCategoryOverrides {
|
|
3401
|
+
[cookieNameOrPattern: string]: Category;
|
|
3402
|
+
}
|
|
3403
|
+
declare function setCookieCatalogOverrides(overrides: CookieCatalogOverrides): void;
|
|
3404
|
+
declare function setCookieCategoryOverrides(map: CookieCategoryOverrides): void;
|
|
3405
|
+
declare function getCookiesInfoForCategory(categoryId: Category, usedIntegrations: string[]): CookieDescriptor[];
|
|
3406
|
+
|
|
1862
3407
|
/**
|
|
1863
3408
|
* Propriedades para customizar o comportamento e aparência do componente CookieBanner.
|
|
1864
3409
|
*
|
|
@@ -1921,6 +3466,11 @@ interface CookieBannerProps {
|
|
|
1921
3466
|
* @example "/privacy-policy" | "https://example.com/cookies"
|
|
1922
3467
|
*/
|
|
1923
3468
|
policyLinkUrl?: string;
|
|
3469
|
+
/**
|
|
3470
|
+
* URL para os termos de uso do site (opcional). Quando fornecida, será considerada uma rota "segura"
|
|
3471
|
+
* para não aplicar bloqueio total (overlay) mesmo em modo bloqueante.
|
|
3472
|
+
*/
|
|
3473
|
+
termsLinkUrl?: string;
|
|
1924
3474
|
/**
|
|
1925
3475
|
* Força exibição do banner em modo de debug, independente do consentimento.
|
|
1926
3476
|
*
|
|
@@ -2082,7 +3632,7 @@ interface CookieBannerProps {
|
|
|
2082
3632
|
* @public
|
|
2083
3633
|
* @since 0.1.0
|
|
2084
3634
|
*/
|
|
2085
|
-
declare function CookieBanner({ policyLinkUrl, debug, blocking, hideBranding, SnackbarProps, PaperProps, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
3635
|
+
declare function CookieBanner({ policyLinkUrl, termsLinkUrl, debug, blocking, hideBranding, SnackbarProps, PaperProps, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
2086
3636
|
|
|
2087
3637
|
/**
|
|
2088
3638
|
* Props para o componente FloatingPreferencesButton.
|
|
@@ -2098,7 +3648,7 @@ interface FloatingPreferencesButtonProps {
|
|
|
2098
3648
|
/** Offset da borda em pixels. Padrão: 24 */
|
|
2099
3649
|
offset?: number;
|
|
2100
3650
|
/** Ícone customizado. Padrão: CookieOutlined */
|
|
2101
|
-
icon?: React.ReactNode;
|
|
3651
|
+
icon?: React$1.ReactNode;
|
|
2102
3652
|
/** Tooltip customizado exibido ao passar o mouse */
|
|
2103
3653
|
tooltip?: string;
|
|
2104
3654
|
/** Props adicionais para o Fab do MUI */
|
|
@@ -2118,10 +3668,22 @@ interface FloatingPreferencesButtonProps {
|
|
|
2118
3668
|
* Você pode substituí-lo passando seu próprio componente para a prop `FloatingPreferencesButtonComponent`
|
|
2119
3669
|
* no `ConsentProvider`.
|
|
2120
3670
|
*
|
|
3671
|
+
* Componente memoizado para otimizar performance - só re-renderiza quando props mudam.
|
|
3672
|
+
*
|
|
2121
3673
|
* @param {Readonly<FloatingPreferencesButtonProps>} props As propriedades para customizar o botão.
|
|
2122
3674
|
* @returns {JSX.Element | null} O componente do botão flutuante ou `null` se não for necessário exibi-lo.
|
|
2123
3675
|
*/
|
|
2124
|
-
declare
|
|
3676
|
+
declare const FloatingPreferencesButton: React$1.NamedExoticComponent<Readonly<FloatingPreferencesButtonProps>>;
|
|
3677
|
+
|
|
3678
|
+
/** @module src/utils/categoryUtils */
|
|
3679
|
+
/**
|
|
3680
|
+
* @category Utils
|
|
3681
|
+
* @since 0.2.0
|
|
3682
|
+
* Utilitários para gerenciamento de categorias de consentimento LGPD.
|
|
3683
|
+
*
|
|
3684
|
+
* Fornece funções para criar, validar e recuperar definições de categorias de cookies,
|
|
3685
|
+
* garantindo conformidade com a LGPD e suporte a categorias customizadas.
|
|
3686
|
+
*/
|
|
2125
3687
|
|
|
2126
3688
|
/**
|
|
2127
3689
|
* Cria um objeto de preferências de consentimento inicial baseado na configuração de categorias do projeto.
|
|
@@ -2210,4 +3772,4 @@ declare function validateProjectPreferences(preferences: ConsentPreferences, con
|
|
|
2210
3772
|
*/
|
|
2211
3773
|
declare function getAllProjectCategories(config?: ProjectCategoriesConfig): CategoryDefinition[];
|
|
2212
3774
|
|
|
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 };
|
|
3775
|
+
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 };
|