@react-lgpd-consent/core 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11,6 +11,219 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
11
11
  throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
13
 
14
+ // src/types/advancedTexts.ts
15
+ var EXPANDED_DEFAULT_TEXTS = {
16
+ // Textos adicionais
17
+ confirm: "Confirmar",
18
+ cancel: "Cancelar",
19
+ loading: "Carregando...",
20
+ // Feedback
21
+ feedback: {
22
+ saveSuccess: "Prefer\xEAncias salvas com sucesso!",
23
+ saveError: "Erro ao salvar prefer\xEAncias. Tente novamente.",
24
+ consentUpdated: "Consentimento atualizado.",
25
+ cookiesRejected: "Cookies opcionais rejeitados.",
26
+ settingsReset: "Configura\xE7\xF5es resetadas."
27
+ },
28
+ // Acessibilidade
29
+ accessibility: {
30
+ bannerLabel: "Banner de consentimento de cookies",
31
+ modalLabel: "Modal de prefer\xEAncias de cookies",
32
+ keyboardNavigation: "Use Tab para navegar, Enter para selecionar",
33
+ toggleState: {
34
+ enabled: "Habilitado",
35
+ disabled: "Desabilitado"
36
+ },
37
+ liveRegion: "Regi\xE3o de an\xFAncios din\xE2micos"
38
+ },
39
+ // Categorias
40
+ categories: {
41
+ necessary: {
42
+ name: "Cookies Necess\xE1rios",
43
+ description: "Essenciais para o funcionamento b\xE1sico do site e n\xE3o podem ser desativados",
44
+ examples: "Sess\xE3o, seguran\xE7a, prefer\xEAncias de idioma"
45
+ },
46
+ analytics: {
47
+ name: "Cookies de Analytics",
48
+ description: "Opcionais. Ajudam a entender como os visitantes usam o site",
49
+ examples: "Google Analytics, contadores de p\xE1gina"
50
+ },
51
+ marketing: {
52
+ name: "Cookies de Marketing",
53
+ description: "Opcionais. Usados para personalizar an\xFAncios e ofertas",
54
+ examples: "Facebook Pixel, Google Ads, remarketing"
55
+ },
56
+ functional: {
57
+ name: "Cookies Funcionais",
58
+ description: "Opcionais. Melhoram a funcionalidade e personaliza\xE7\xE3o",
59
+ examples: "Chat, mapas, v\xEDdeos embarcados"
60
+ },
61
+ performance: {
62
+ name: "Cookies de Performance",
63
+ description: "Opcionais. Coletam informa\xE7\xF5es sobre velocidade e estabilidade",
64
+ examples: "Monitoramento de erro, otimiza\xE7\xE3o de velocidade"
65
+ }
66
+ },
67
+ // Contextos específicos
68
+ contexts: {
69
+ ecommerce: {
70
+ cartAbandonment: "Lembramos dos produtos no seu carrinho",
71
+ personalizedOffers: "Ofertas personalizadas baseadas no seu hist\xF3rico",
72
+ paymentSecurity: "Seguran\xE7a adicional no processo de pagamento",
73
+ productRecommendations: "Sugest\xF5es de produtos relevantes"
74
+ },
75
+ saas: {
76
+ userAnalytics: "An\xE1lise de uso para melhorar funcionalidades",
77
+ performanceMonitoring: "Monitoramento de performance da aplica\xE7\xE3o",
78
+ featureUsage: "Estat\xEDsticas de uso de recursos",
79
+ customerSupport: "Suporte ao cliente mais eficiente"
80
+ },
81
+ government: {
82
+ citizenServices: "Melhoria dos servi\xE7os ao cidad\xE3o",
83
+ dataProtection: "Prote\xE7\xE3o rigorosa dos dados pessoais",
84
+ transparency: "Transpar\xEAncia no uso de dados",
85
+ accessibility: "Recursos de acessibilidade digital"
86
+ },
87
+ education: {
88
+ studentProgress: "Acompanhamento do progresso educacional",
89
+ learningAnalytics: "Analytics para melhorar o aprendizado",
90
+ accessibility: "Recursos educacionais acess\xEDveis",
91
+ parentalConsent: "Consentimento parental quando necess\xE1rio"
92
+ }
93
+ },
94
+ // Variações de tom
95
+ variants: {
96
+ formal: {
97
+ bannerMessage: "Este s\xEDtio eletr\xF4nico utiliza cookies para otimizar a experi\xEAncia de navega\xE7\xE3o.",
98
+ acceptAll: "Concordar com todos os cookies",
99
+ declineAll: "Recusar cookies opcionais",
100
+ modalTitle: "Configura\xE7\xE3o de Cookies"
101
+ },
102
+ casual: {
103
+ bannerMessage: "\u{1F36A} Ei! Usamos cookies para tornar sua experi\xEAncia ainda melhor!",
104
+ acceptAll: "Aceitar tudo",
105
+ declineAll: "S\xF3 o essencial",
106
+ modalTitle: "Seus Cookies"
107
+ },
108
+ concise: {
109
+ bannerMessage: "Usamos cookies. Voc\xEA aceita?",
110
+ acceptAll: "Sim",
111
+ declineAll: "N\xE3o",
112
+ modalTitle: "Cookies"
113
+ },
114
+ detailed: {
115
+ bannerMessage: "Utilizamos cookies e tecnologias similares para melhorar sua experi\xEAncia de navega\xE7\xE3o, personalizar conte\xFAdo, analisar tr\xE1fego e oferecer funcionalidades de redes sociais.",
116
+ acceptAll: "Aceitar todos os cookies e tecnologias",
117
+ declineAll: "Recusar todos os cookies opcionais",
118
+ modalTitle: "Centro de Prefer\xEAncias de Privacidade"
119
+ }
120
+ },
121
+ // Internacionalização simplificada (apenas textos básicos)
122
+ i18n: {
123
+ en: {
124
+ bannerMessage: "We use cookies to enhance your experience.",
125
+ acceptAll: "Accept All",
126
+ declineAll: "Decline",
127
+ preferences: "Preferences",
128
+ modalTitle: "Cookie Preferences",
129
+ modalIntro: "Customize your cookie preferences below.",
130
+ save: "Save Preferences",
131
+ necessaryAlwaysOn: "Necessary cookies (always active)"
132
+ },
133
+ es: {
134
+ bannerMessage: "Utilizamos cookies para mejorar su experiencia.",
135
+ acceptAll: "Aceptar Todo",
136
+ declineAll: "Rechazar",
137
+ preferences: "Preferencias",
138
+ modalTitle: "Preferencias de Cookies",
139
+ modalIntro: "Personalice sus preferencias de cookies a continuaci\xF3n.",
140
+ save: "Guardar Preferencias",
141
+ necessaryAlwaysOn: "Cookies necess\xE1rias (sempre ativas)"
142
+ },
143
+ fr: {
144
+ bannerMessage: "Nous utilisons des cookies pour am\xE9liorer votre exp\xE9rience.",
145
+ acceptAll: "Tout Accepter",
146
+ declineAll: "Refuser",
147
+ preferences: "Pr\xE9f\xE9rences",
148
+ modalTitle: "Pr\xE9f\xE9rences des Cookies",
149
+ modalIntro: "Personnalisez vos pr\xE9f\xE9rences de cookies ci-dessous.",
150
+ save: "Enregistrer les Pr\xE9f\xE9rences",
151
+ necessaryAlwaysOn: "Cookies n\xE9cessaires (toujours actifs)"
152
+ }
153
+ },
154
+ // Textos técnicos
155
+ technical: {
156
+ sessionCookies: "Cookies de sess\xE3o s\xE3o tempor\xE1rios e expiram quando voc\xEA fecha o navegador.",
157
+ persistentCookies: "Cookies persistentes permanecem no seu dispositivo at\xE9 expirarem ou serem removidos.",
158
+ thirdPartyCookies: "Cookies de terceiros s\xE3o definidos por dom\xEDnios diferentes do site que voc\xEA est\xE1 visitando.",
159
+ browserSettings: "Voc\xEA pode gerenciar cookies nas configura\xE7\xF5es do seu navegador.",
160
+ disablingImpact: "Desabilitar cookies pode afetar a funcionalidade do site."
161
+ },
162
+ // Cookie details
163
+ cookieDetails: {
164
+ tableHeaders: {
165
+ name: "Nome",
166
+ purpose: "Finalidade",
167
+ duration: "Dura\xE7\xE3o",
168
+ provider: "Fornecedor",
169
+ type: "Tipo"
170
+ },
171
+ noCookies: "Nenhum cookie encontrado para esta categoria.",
172
+ toggleDetails: {
173
+ expand: "Ver detalhes",
174
+ collapse: "Ocultar detalhes"
175
+ },
176
+ scriptLabelPrefix: "(script) ",
177
+ scriptPurpose: "Script de integra\xE7\xE3o ativo"
178
+ }
179
+ };
180
+ function resolveTexts(texts, options = {}) {
181
+ const { language = "pt", variant } = options;
182
+ let resolved = { ...texts };
183
+ if (variant && texts.variants?.[variant]) {
184
+ resolved = { ...resolved, ...texts.variants[variant] };
185
+ }
186
+ if (language !== "pt" && texts.i18n?.[language]) {
187
+ resolved = { ...resolved, ...texts.i18n[language] };
188
+ }
189
+ return resolved;
190
+ }
191
+ var TEXT_TEMPLATES = {
192
+ ecommerce: {
193
+ ...EXPANDED_DEFAULT_TEXTS,
194
+ bannerMessage: "Utilizamos cookies para personalizar ofertas e melhorar sua experi\xEAncia de compra.",
195
+ acceptAll: "Aceitar e continuar",
196
+ variants: {
197
+ casual: {
198
+ bannerMessage: "\u{1F6D2} Usamos cookies para encontrar as melhores ofertas para voc\xEA!",
199
+ acceptAll: "Quero ofertas personalizadas!"
200
+ }
201
+ }
202
+ },
203
+ saas: {
204
+ ...EXPANDED_DEFAULT_TEXTS,
205
+ bannerMessage: "Utilizamos cookies para otimizar o desempenho da aplica\xE7\xE3o e sua experi\xEAncia.",
206
+ acceptAll: "Aceitar e otimizar",
207
+ variants: {
208
+ formal: {
209
+ bannerMessage: "Esta aplica\xE7\xE3o utiliza cookies para an\xE1lise de performance e melhoria cont\xEDnua da experi\xEAncia do usu\xE1rio.",
210
+ acceptAll: "Autorizar coleta de dados de uso"
211
+ }
212
+ }
213
+ },
214
+ government: {
215
+ ...EXPANDED_DEFAULT_TEXTS,
216
+ bannerMessage: "Este portal utiliza cookies em conformidade com a LGPD para melhorar os servi\xE7os p\xFAblicos.",
217
+ acceptAll: "Aceitar em conformidade",
218
+ variants: {
219
+ formal: {
220
+ bannerMessage: "Este s\xEDtio eletr\xF4nico do governo utiliza cookies estritamente necess\xE1rios e opcionais, em conformidade com a Lei Geral de Prote\xE7\xE3o de Dados.",
221
+ acceptAll: "Concordar com o uso de cookies"
222
+ }
223
+ }
224
+ }
225
+ };
226
+
14
227
  // src/utils/categoryUtils.ts
15
228
  function createProjectPreferences(config, defaultValue = false) {
16
229
  const preferences = {
@@ -320,26 +533,31 @@ function buildConsentStorageKey(options) {
320
533
  var DEFAULT_COOKIE_OPTS = {
321
534
  name: "cookieConsent",
322
535
  maxAge: DEFAULT_MAX_AGE_SECONDS,
323
- maxAgeDays: 365,
324
536
  sameSite: "Lax",
325
- secure: globalThis.window === void 0 ? false : globalThis.window.location.protocol === "https:",
537
+ secure: false,
326
538
  path: "/",
327
539
  domain: void 0
328
540
  };
329
541
  function resolveCookieOptions(opts) {
330
- const protocols = [
331
- typeof globalThis.window !== "undefined" ? globalThis.window?.location?.protocol : void 0,
332
- typeof globalThis.location !== "undefined" ? globalThis.location?.protocol : void 0
333
- ].filter(Boolean);
542
+ const currentWindow = globalThis.window;
543
+ const currentLocation = globalThis.location;
544
+ const protocols = [currentWindow?.location?.protocol, currentLocation?.protocol].filter(Boolean);
334
545
  const forceHttps = globalThis.__LGPD_FORCE_HTTPS__ === true;
335
546
  const isHttps = forceHttps || protocols.includes("https:");
336
- const maxAgeSecondsFromDays = typeof opts?.maxAgeDays === "number" ? Math.max(0, opts.maxAgeDays * 24 * 60 * 60) : null;
337
- const maxAgeSeconds = typeof opts?.maxAge === "number" ? Math.max(0, opts.maxAge) : maxAgeSecondsFromDays ?? DEFAULT_MAX_AGE_SECONDS;
547
+ const maxAgeSeconds = typeof opts?.maxAge === "number" ? Math.max(0, opts.maxAge) : typeof opts?.maxAgeDays === "number" ? Math.max(0, opts.maxAgeDays) * 24 * 60 * 60 : DEFAULT_MAX_AGE_SECONDS;
548
+ let secure;
549
+ if (typeof opts?.secure === "boolean") {
550
+ secure = opts.secure;
551
+ } else if (isHttps) {
552
+ secure = true;
553
+ } else {
554
+ secure = DEFAULT_COOKIE_OPTS.secure;
555
+ }
338
556
  return {
339
557
  name: opts?.name ?? DEFAULT_COOKIE_OPTS.name,
340
558
  maxAge: maxAgeSeconds,
341
559
  sameSite: opts?.sameSite ?? DEFAULT_COOKIE_OPTS.sameSite ?? "Lax",
342
- secure: typeof opts?.secure === "boolean" ? opts.secure : isHttps ? true : DEFAULT_COOKIE_OPTS.secure ?? false,
560
+ secure,
343
561
  path: opts?.path ?? DEFAULT_COOKIE_OPTS.path ?? "/",
344
562
  domain: opts?.domain ?? DEFAULT_COOKIE_OPTS.domain ?? void 0
345
563
  };
@@ -347,7 +565,7 @@ function resolveCookieOptions(opts) {
347
565
  var COOKIE_SCHEMA_VERSION = "1.0";
348
566
  function readConsentCookie(name = DEFAULT_COOKIE_OPTS.name) {
349
567
  logger.debug("Reading consent cookie", { name });
350
- if (typeof document === "undefined") {
568
+ if (globalThis.document === void 0) {
351
569
  logger.debug("Cookie read skipped: server-side environment");
352
570
  return null;
353
571
  }
@@ -398,7 +616,7 @@ function migrateLegacyCookie(legacyData) {
398
616
  }
399
617
  }
400
618
  function writeConsentCookie(state, config, opts, source = "banner") {
401
- if (typeof document === "undefined" || typeof window === "undefined" || globalThis.__LGPD_SSR__ === true) {
619
+ if (globalThis.document === void 0 || globalThis.window === void 0 || globalThis.__LGPD_SSR__ === true) {
402
620
  logger.debug("Cookie write skipped: server-side environment");
403
621
  return;
404
622
  }
@@ -447,7 +665,7 @@ function createConsentAuditEntry(state, params) {
447
665
  };
448
666
  }
449
667
  function removeConsentCookie(opts) {
450
- if (typeof document === "undefined") {
668
+ if (globalThis.document === void 0) {
451
669
  logger.debug("Cookie removal skipped: server-side environment");
452
670
  return;
453
671
  }
@@ -458,14 +676,23 @@ function removeConsentCookie(opts) {
458
676
  }
459
677
 
460
678
  // src/utils/dataLayerEvents.ts
461
- var LIBRARY_VERSION = "0.7.1";
679
+ var LIBRARY_VERSION = "0.8.0";
462
680
  function ensureDataLayer() {
463
- var _a;
464
- if (globalThis.window === void 0) return;
465
- (_a = globalThis.window).dataLayer ?? (_a.dataLayer = []);
681
+ const currentWindow = globalThis.window;
682
+ if (!currentWindow) return;
683
+ const currentLayer = currentWindow.dataLayer;
684
+ if (currentLayer == null) {
685
+ currentWindow.dataLayer = [];
686
+ return;
687
+ }
688
+ if (typeof currentLayer.push !== "function") {
689
+ const env = globalThis.process?.env?.NODE_ENV ?? "production";
690
+ if (env !== "production") {
691
+ console.warn("[LGPD-CONSENT] dataLayer presente mas sem push; eventos n\xE3o ser\xE3o registrados.");
692
+ }
693
+ }
466
694
  }
467
695
  function pushConsentInitializedEvent(categories) {
468
- if (globalThis.window === void 0) return;
469
696
  ensureDataLayer();
470
697
  const event = {
471
698
  event: "consent_initialized",
@@ -474,10 +701,12 @@ function pushConsentInitializedEvent(categories) {
474
701
  categories,
475
702
  preferences: categories
476
703
  };
477
- globalThis.window.dataLayer?.push(event);
704
+ const layer = globalThis.window?.dataLayer;
705
+ if (layer && typeof layer.push === "function") {
706
+ layer.push(event);
707
+ }
478
708
  }
479
709
  function pushConsentUpdatedEvent(categories, origin, previousCategories) {
480
- if (globalThis.window === void 0) return;
481
710
  ensureDataLayer();
482
711
  const changedCategories = previousCategories ? Object.keys(categories).filter((key) => categories[key] !== previousCategories[key]) : [];
483
712
  const event = {
@@ -489,7 +718,10 @@ function pushConsentUpdatedEvent(categories, origin, previousCategories) {
489
718
  preferences: categories,
490
719
  changed_categories: changedCategories
491
720
  };
492
- globalThis.window.dataLayer?.push(event);
721
+ const layer = globalThis.window?.dataLayer;
722
+ if (layer && typeof layer.push === "function") {
723
+ layer.push(event);
724
+ }
493
725
  }
494
726
  function useDataLayerEvents() {
495
727
  return {
@@ -819,7 +1051,7 @@ function analyzeDeveloperConfiguration(config) {
819
1051
  const gt = globalThis;
820
1052
  const implied = (gt.__LGPD_REQUIRED_CATEGORIES__ || []).filter(Boolean);
821
1053
  implied.forEach((id) => {
822
- if (!guidance.activeCategoriesInfo.find((c) => c.id === id)) {
1054
+ if (!guidance.activeCategoriesInfo.some((c) => c.id === id)) {
823
1055
  const info = NAMES[id];
824
1056
  if (info) {
825
1057
  guidance.activeCategoriesInfo.push({
@@ -859,6 +1091,27 @@ function analyzeDeveloperConfiguration(config) {
859
1091
  'Apenas cookies necess\xE1rios est\xE3o configurados. Para compliance LGPD, considere adicionar categorias como "analytics" ou "functional" conforme uso real.',
860
1092
  "compliance"
861
1093
  );
1094
+ } else {
1095
+ addMessage(
1096
+ "info",
1097
+ "Cookies n\xE3o necess\xE1rios devem iniciar desativados e exigir consentimento expresso, sem pr\xE9-sele\xE7\xE3o e sem consentimento t\xE1cito.",
1098
+ "consent"
1099
+ );
1100
+ addMessage(
1101
+ "info",
1102
+ "Ofere\xE7a op\xE7\xF5es claras de aceitar, rejeitar e gerenciar prefer\xEAncias com o mesmo destaque, al\xE9m de revoga\xE7\xE3o simples e gratuita.",
1103
+ "consent"
1104
+ );
1105
+ addMessage(
1106
+ "info",
1107
+ "Informe finalidades espec\xEDficas, per\xEDodo de reten\xE7\xE3o e compartilhamento com terceiros em pol\xEDtica/aviso de cookies.",
1108
+ "transparency"
1109
+ );
1110
+ addMessage(
1111
+ "info",
1112
+ "Disponibilize mecanismo pr\xF3prio de gerenciamento de cookies; configura\xE7\xF5es do navegador s\xE3o apenas complementares.",
1113
+ "transparency"
1114
+ );
862
1115
  }
863
1116
  if (totalToggleable > 5) {
864
1117
  addMessage(
@@ -883,7 +1136,7 @@ function getComplianceScoreColor(score) {
883
1136
  function logComplianceScore(prefix, score) {
884
1137
  const color = getComplianceScoreColor(score);
885
1138
  console.log(
886
- `%c${prefix} Score de Conformidade LGPD: ${score}/100`,
1139
+ `%c${prefix} Score de Conformidade LGPD (orientativo): ${score}/100`,
887
1140
  `color: ${color}; font-weight: bold; font-size: 14px;`
888
1141
  );
889
1142
  }
@@ -978,7 +1231,7 @@ function logServerSideIfAvailable(guidance) {
978
1231
  }
979
1232
  function logDeveloperGuidance(guidance, disableGuidanceProp, config) {
980
1233
  const gt = globalThis;
981
- const nodeEnv = typeof gt.process !== "undefined" ? gt.process?.env?.NODE_ENV : void 0;
1234
+ const nodeEnv = gt.process ? gt.process?.env?.NODE_ENV : void 0;
982
1235
  const isProd = nodeEnv === "production" || gt.__LGPD_PRODUCTION__ === true;
983
1236
  if (isProd || disableGuidanceProp) return;
984
1237
  const guidanceHash = getGuidanceHash(guidance);
@@ -1036,11 +1289,21 @@ function logDeveloperGuidance(guidance, disableGuidanceProp, config) {
1036
1289
  "color: #9c27b0;",
1037
1290
  "color: #7b1fa2;"
1038
1291
  );
1292
+ console.info(
1293
+ `%c${PREFIX}%c Evite consentimento t\xE1cito e op\xE7\xF5es pr\xE9-selecionadas`,
1294
+ "color: #9c27b0;",
1295
+ "color: #7b1fa2;"
1296
+ );
1039
1297
  console.info(
1040
1298
  `%c${PREFIX}%c Documente pol\xEDticas claras por categoria`,
1041
1299
  "color: #9c27b0;",
1042
1300
  "color: #7b1fa2;"
1043
1301
  );
1302
+ console.info(
1303
+ `%c${PREFIX}%c Informe finalidades, reten\xE7\xE3o e revoga\xE7\xE3o simples e gratuita`,
1304
+ "color: #9c27b0;",
1305
+ "color: #7b1fa2;"
1306
+ );
1044
1307
  console.info(
1045
1308
  `%c${PREFIX}%c Registre consentimento com data/hora/origem`,
1046
1309
  "color: #9c27b0;",
@@ -1052,7 +1315,9 @@ function logDeveloperGuidance(guidance, disableGuidanceProp, config) {
1052
1315
  function useDeveloperGuidance(config, disableGuidanceProp, guidanceConfig) {
1053
1316
  const guidance = React4__default.useMemo(() => analyzeDeveloperConfiguration(config), [config]);
1054
1317
  React4__default.useEffect(() => {
1055
- if (!disableGuidanceProp) logDeveloperGuidance(guidance, disableGuidanceProp, guidanceConfig);
1318
+ if (globalThis.window !== void 0 && !disableGuidanceProp) {
1319
+ logDeveloperGuidance(guidance, disableGuidanceProp, guidanceConfig);
1320
+ }
1056
1321
  }, [guidance, disableGuidanceProp, guidanceConfig]);
1057
1322
  return guidance;
1058
1323
  }
@@ -1355,28 +1620,30 @@ function getMessages() {
1355
1620
  };
1356
1621
  }
1357
1622
  function detectMultipleReactInstances() {
1358
- if (globalThis.window === void 0) return false;
1623
+ const currentWindow = globalThis.window;
1624
+ if (currentWindow === void 0) return false;
1359
1625
  try {
1360
- const reactSymbols = Object.getOwnPropertySymbols(globalThis.window).map(String).filter((name) => name.includes("react"));
1626
+ const reactSymbols = Object.getOwnPropertySymbols(currentWindow).map(String).filter((name) => name.includes("react"));
1361
1627
  if (reactSymbols.length > 1) {
1362
1628
  return true;
1363
1629
  }
1364
- const ReactModule = window.React;
1630
+ const ReactModule = currentWindow.React;
1365
1631
  if (ReactModule && Array.isArray(ReactModule)) {
1366
1632
  return true;
1367
1633
  }
1368
- const hasMultipleVersions = window.__REACT_DEVTOOLS_GLOBAL_HOOK__?.renderers?.size > 1;
1634
+ const hasMultipleVersions = (currentWindow.__REACT_DEVTOOLS_GLOBAL_HOOK__?.renderers?.size ?? 0) > 1;
1369
1635
  return hasMultipleVersions || false;
1370
1636
  } catch {
1371
1637
  return false;
1372
1638
  }
1373
1639
  }
1374
1640
  function getPackageVersion(packageName) {
1375
- if (globalThis.window === void 0) return null;
1641
+ const currentWindow = globalThis.window;
1642
+ if (currentWindow === void 0) return null;
1376
1643
  try {
1377
- const pkg = window[packageName];
1644
+ const pkg = currentWindow[packageName];
1378
1645
  if (pkg?.version) return pkg.version;
1379
- const React6 = window.React;
1646
+ const React6 = currentWindow.React;
1380
1647
  if (packageName === "react" && React6?.version) {
1381
1648
  return React6.version;
1382
1649
  }
@@ -1400,7 +1667,8 @@ function checkPeerDeps(options = {}) {
1400
1667
  if (skipInProduction && isProduction) {
1401
1668
  return result;
1402
1669
  }
1403
- if (globalThis.window === void 0) {
1670
+ const currentWindow = globalThis.window;
1671
+ if (currentWindow === void 0) {
1404
1672
  return result;
1405
1673
  }
1406
1674
  const messages = getMessages();
@@ -1422,7 +1690,7 @@ function checkPeerDeps(options = {}) {
1422
1690
  }
1423
1691
  }
1424
1692
  }
1425
- const muiVersion = window["@mui/material"]?.version;
1693
+ const muiVersion = currentWindow["@mui/material"]?.version;
1426
1694
  if (muiVersion) {
1427
1695
  if (!isVersionInRange(muiVersion, 5, 7)) {
1428
1696
  result.warnings.push(messages.MUI_OUT_OF_RANGE(muiVersion));
@@ -1444,14 +1712,88 @@ function runPeerDepsCheck() {
1444
1712
 
1445
1713
  // src/utils/validation.ts
1446
1714
  var isDev = () => typeof process !== "undefined" && process.env.NODE_ENV !== "production";
1715
+ var sanitizeCategories = (categories) => {
1716
+ const enabled = [...new Set(categories.enabledCategories ?? [])];
1717
+ const sanitizedEnabled = enabled.filter((c) => c !== "necessary");
1718
+ return {
1719
+ enabled,
1720
+ sanitizedEnabled,
1721
+ custom: categories.customCategories ?? []
1722
+ };
1723
+ };
1724
+ var collectZodIssues = (z, categories, issues) => {
1725
+ if (!z || !categories) return;
1726
+ const CustomCategorySchema = z.object({
1727
+ id: z.string().min(1, "customCategories[].id deve ser uma string n\xE3o vazia"),
1728
+ name: z.string().min(1, "customCategories[].name deve ser uma string n\xE3o vazia"),
1729
+ description: z.string().min(1, "customCategories[].description deve ser uma string n\xE3o vazia"),
1730
+ essential: z.boolean().optional(),
1731
+ cookies: z.array(z.string().min(1)).optional()
1732
+ });
1733
+ const ProjectCategoriesConfigSchema = z.object({
1734
+ enabledCategories: z.array(z.string().min(1)).optional(),
1735
+ customCategories: z.array(CustomCategorySchema).optional()
1736
+ }).strict();
1737
+ const res = ProjectCategoriesConfigSchema.safeParse(categories);
1738
+ if (!res.success) {
1739
+ res.error.issues.forEach(
1740
+ (issue) => issues.push({ path: `categories.${issue.path.join(".")}`, message: issue.message })
1741
+ );
1742
+ }
1743
+ const customParse = z.array(CustomCategorySchema).safeParse(categories.customCategories ?? []);
1744
+ if (!customParse.success) {
1745
+ customParse.error.issues.forEach(
1746
+ (issue) => issues.push({ path: `customCategories.${issue.path.join(".")}`, message: issue.message })
1747
+ );
1748
+ }
1749
+ };
1750
+ var collectCategoryWarnings = (input) => {
1751
+ const warnings = [];
1752
+ const { enabled, sanitizedEnabled, custom } = input;
1753
+ if (enabled.includes("necessary")) {
1754
+ warnings.push("'necessary' \xE9 sempre inclu\xEDda automaticamente \u2014 remova de enabledCategories.");
1755
+ }
1756
+ const invalidEnabled = sanitizedEnabled.filter((c) => typeof c !== "string" || c.trim() === "");
1757
+ if (invalidEnabled.length > 0) {
1758
+ warnings.push(
1759
+ `enabledCategories cont\xE9m valores inv\xE1lidos: ${invalidEnabled.map(String).join(", ")} \u2014 remova ou corrija os IDs de categoria`
1760
+ );
1761
+ }
1762
+ const ids = /* @__PURE__ */ new Set();
1763
+ const dupes = [];
1764
+ ["necessary", ...sanitizedEnabled].forEach((id) => {
1765
+ if (ids.has(id)) dupes.push(id);
1766
+ ids.add(id);
1767
+ });
1768
+ custom?.forEach((c) => {
1769
+ if (ids.has(c.id)) dupes.push(c.id);
1770
+ ids.add(c.id);
1771
+ });
1772
+ if (dupes.length > 0) {
1773
+ warnings.push(
1774
+ `IDs de categoria duplicados detectados: ${Array.from(new Set(dupes)).join(
1775
+ ", "
1776
+ )} \u2014 verifique 'enabledCategories' e 'customCategories'.`
1777
+ );
1778
+ }
1779
+ return warnings;
1780
+ };
1781
+ var reportValidationMessages = (warnings, errors, issues) => {
1782
+ if (warnings.length > 0) {
1783
+ logger.warn("Valida\xE7\xE3o do ConsentProvider:", ...warnings);
1784
+ }
1785
+ if (errors.length > 0 || issues.length > 0) {
1786
+ issues.forEach((i) => errors.push(`Prop inv\xE1lida: ${i.path} \u2014 ${i.message}`));
1787
+ logger.error("Erros de configura\xE7\xE3o do ConsentProvider:", ...errors);
1788
+ }
1789
+ };
1447
1790
  function validateConsentProviderProps(props) {
1448
1791
  const warnings = [];
1449
1792
  const errors = [];
1450
1793
  const sanitized = {};
1451
1794
  if (!isDev()) {
1452
1795
  if (props.categories) {
1453
- const enabled = [...new Set(props.categories.enabledCategories ?? [])];
1454
- const sanitizedEnabled = enabled.filter((c) => c !== "necessary");
1796
+ const { sanitizedEnabled } = sanitizeCategories(props.categories);
1455
1797
  sanitized.categories = {
1456
1798
  enabledCategories: sanitizedEnabled,
1457
1799
  customCategories: props.categories.customCategories
@@ -1466,96 +1808,30 @@ function validateConsentProviderProps(props) {
1466
1808
  z = void 0;
1467
1809
  }
1468
1810
  const issues = [];
1469
- if (z) {
1470
- const CustomCategorySchema = z.object({
1471
- id: z.string().min(1, "customCategories[].id deve ser uma string n\xE3o vazia"),
1472
- name: z.string().min(1, "customCategories[].name deve ser uma string n\xE3o vazia"),
1473
- description: z.string().min(1, "customCategories[].description deve ser uma string n\xE3o vazia"),
1474
- essential: z.boolean().optional(),
1475
- cookies: z.array(z.string().min(1)).optional()
1476
- });
1477
- const ProjectCategoriesConfigSchema = z.object({
1478
- enabledCategories: z.array(z.string().min(1)).optional(),
1479
- customCategories: z.array(CustomCategorySchema).optional()
1480
- }).strict();
1481
- const res = ProjectCategoriesConfigSchema.safeParse(props.categories);
1482
- if (!res.success) {
1483
- res.error.issues.forEach(
1484
- (issue) => issues.push({ path: `categories.${issue.path.join(".")}`, message: issue.message })
1485
- );
1486
- }
1487
- }
1488
- if (!props.categories) {
1489
- warnings.push(
1490
- "Prop 'categories' n\xE3o fornecida \u2014 o ConsentProvider requer configura\xE7\xE3o de categorias."
1491
- );
1492
- } else {
1493
- const cat = props.categories;
1494
- const enabled = [...new Set(cat.enabledCategories ?? [])];
1495
- if (enabled.includes("necessary")) {
1496
- warnings.push("'necessary' \xE9 sempre inclu\xEDda automaticamente \u2014 remova de enabledCategories.");
1497
- }
1498
- const sanitizedEnabled = enabled.filter((c) => c !== "necessary");
1499
- const invalidEnabled = sanitizedEnabled.filter((c) => typeof c !== "string" || c.trim() === "");
1500
- if (invalidEnabled.length > 0) {
1501
- warnings.push(
1502
- `enabledCategories cont\xE9m valores inv\xE1lidos: ${invalidEnabled.map(String).join(", ")} \u2014 remova ou corrija os IDs de categoria`
1503
- );
1504
- }
1505
- const custom = cat.customCategories ?? [];
1506
- if (z) {
1507
- const CustomCategorySchema = z.object({
1508
- id: z.string().min(1),
1509
- name: z.string().min(1),
1510
- description: z.string().min(1),
1511
- essential: z.boolean().optional(),
1512
- cookies: z.array(z.string().min(1)).optional()
1513
- });
1514
- const customParse = z.array(CustomCategorySchema).safeParse(custom);
1515
- if (!customParse.success) {
1516
- customParse.error.issues.forEach(
1517
- (issue) => issues.push({ path: `customCategories.${issue.path.join(".")}`, message: issue.message })
1518
- );
1519
- }
1520
- }
1521
- const ids = /* @__PURE__ */ new Set();
1522
- const dupes = [];
1523
- ["necessary", ...sanitizedEnabled].forEach((id) => {
1524
- if (ids.has(id)) dupes.push(id);
1525
- ids.add(id);
1526
- });
1527
- custom.forEach((c) => {
1528
- if (ids.has(c.id)) dupes.push(c.id);
1529
- ids.add(c.id);
1530
- });
1531
- if (dupes.length > 0) {
1532
- warnings.push(
1533
- `IDs de categoria duplicados detectados: ${Array.from(new Set(dupes)).join(
1534
- ", "
1535
- )} \u2014 verifique 'enabledCategories' e 'customCategories'.`
1536
- );
1537
- }
1811
+ collectZodIssues(z, props.categories, issues);
1812
+ if (props.categories) {
1813
+ const { enabled, sanitizedEnabled, custom } = sanitizeCategories(props.categories);
1814
+ warnings.push(...collectCategoryWarnings({ enabled, sanitizedEnabled, custom }));
1538
1815
  sanitized.categories = {
1539
1816
  enabledCategories: sanitizedEnabled,
1540
1817
  customCategories: custom
1541
1818
  };
1819
+ } else {
1820
+ warnings.push(
1821
+ "Prop 'categories' n\xE3o fornecida \u2014 o ConsentProvider requer configura\xE7\xE3o de categorias."
1822
+ );
1542
1823
  }
1543
- if (warnings.length > 0) {
1544
- logger.warn("Valida\xE7\xE3o do ConsentProvider:", ...warnings);
1545
- }
1546
- if (errors.length > 0 || issues.length > 0) {
1547
- issues.forEach((i) => errors.push(`Prop inv\xE1lida: ${i.path} \u2014 ${i.message}`));
1548
- logger.error("Erros de configura\xE7\xE3o do ConsentProvider:", ...errors);
1549
- }
1824
+ reportValidationMessages(warnings, errors, issues);
1550
1825
  return { sanitized, warnings, errors };
1551
1826
  }
1552
1827
 
1553
1828
  // src/utils/cookieDiscovery.ts
1554
1829
  function discoverRuntimeCookies() {
1555
- if (typeof document === "undefined" || !document.cookie) return [];
1830
+ const currentDocument = globalThis.document;
1831
+ if (!currentDocument?.cookie) return [];
1556
1832
  const names = Array.from(
1557
1833
  new Set(
1558
- document.cookie.split(";").map((s) => s.trim()).filter(Boolean).map((s) => s.split("=")[0])
1834
+ currentDocument.cookie.split(";").map((s) => s.trim()).filter(Boolean).map((s) => s.split("=")[0])
1559
1835
  )
1560
1836
  );
1561
1837
  const list = names.map((name) => ({ name }));
@@ -1566,27 +1842,34 @@ function discoverRuntimeCookies() {
1566
1842
  }
1567
1843
  return list;
1568
1844
  }
1845
+ function tryDecode(val) {
1846
+ try {
1847
+ return decodeURIComponent(val);
1848
+ } catch {
1849
+ return val;
1850
+ }
1851
+ }
1852
+ function isConsentJson(val) {
1853
+ if (!val.startsWith("{")) return false;
1854
+ try {
1855
+ const obj = JSON.parse(val);
1856
+ return obj && typeof obj === "object" && "preferences" in obj && "version" in obj;
1857
+ } catch {
1858
+ return false;
1859
+ }
1860
+ }
1569
1861
  function detectConsentCookieName() {
1570
- if (typeof document === "undefined" || !document.cookie) return null;
1862
+ const currentDocument = globalThis.document;
1863
+ if (!currentDocument?.cookie) return null;
1571
1864
  try {
1572
- const pairs = document.cookie.split(";").map((s) => s.trim()).filter(Boolean);
1865
+ const pairs = currentDocument.cookie.split(";").map((s) => s.trim()).filter(Boolean);
1573
1866
  for (const p of pairs) {
1574
1867
  const [name, ...rest] = p.split("=");
1575
1868
  const raw = rest.join("=");
1576
1869
  if (!raw) continue;
1577
- let val = raw;
1578
- try {
1579
- val = decodeURIComponent(raw);
1580
- } catch {
1581
- }
1582
- if (val.startsWith("{")) {
1583
- try {
1584
- const obj = JSON.parse(val);
1585
- if (obj && typeof obj === "object" && "preferences" in obj && "version" in obj) {
1586
- return name;
1587
- }
1588
- } catch {
1589
- }
1870
+ const val = tryDecode(raw);
1871
+ if (isConsentJson(val)) {
1872
+ return name;
1590
1873
  }
1591
1874
  }
1592
1875
  } catch {
@@ -1628,15 +1911,6 @@ function CategoriesProvider({
1628
1911
  disableDiscoveryLog
1629
1912
  }) {
1630
1913
  const [impliedVersion, setImpliedVersion] = React4.useState(0);
1631
- React4.useEffect(() => {
1632
- const handler = () => setImpliedVersion((v) => v + 1);
1633
- if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
1634
- window.addEventListener("lgpd:requiredCategories", handler);
1635
- return () => window.removeEventListener("lgpd:requiredCategories", handler);
1636
- }
1637
- return () => {
1638
- };
1639
- }, []);
1640
1914
  const contextValue = React4.useMemo(() => {
1641
1915
  const finalConfig = config || DEFAULT_PROJECT_CATEGORIES;
1642
1916
  const guidance = analyzeDeveloperConfiguration(config);
@@ -1648,35 +1922,47 @@ function CategoriesProvider({
1648
1922
  allCategories: guidance.activeCategoriesInfo
1649
1923
  };
1650
1924
  }, [config, impliedVersion]);
1925
+ React4.useEffect(() => {
1926
+ const currentWindow = globalThis.window;
1927
+ if (!currentWindow || typeof currentWindow.addEventListener !== "function") return;
1928
+ const handler = () => {
1929
+ setImpliedVersion((current) => current + 1);
1930
+ };
1931
+ currentWindow.addEventListener("lgpd:requiredCategories", handler);
1932
+ return () => {
1933
+ currentWindow.removeEventListener("lgpd:requiredCategories", handler);
1934
+ };
1935
+ }, []);
1651
1936
  React4.useEffect(() => {
1652
1937
  logDeveloperGuidance(contextValue.guidance, disableDeveloperGuidance);
1653
1938
  }, [contextValue.guidance, disableDeveloperGuidance]);
1654
1939
  React4.useEffect(() => {
1655
1940
  try {
1656
1941
  const gt = globalThis;
1657
- const env = typeof gt.process !== "undefined" ? gt.process?.env?.NODE_ENV : void 0;
1942
+ const env = gt.process?.env?.NODE_ENV;
1658
1943
  const isDev2 = env === "development";
1659
- if (!isDev2 || gt.__LGPD_DISCOVERY_LOGGED__ === true || disableDiscoveryLog) return;
1660
- const discovered = discoverRuntimeCookies();
1661
- const consentName = detectConsentCookieName() || DEFAULT_COOKIE_OPTS.name;
1662
- const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
1663
- if (typeof console !== "undefined") {
1664
- try {
1665
- console.group(`${PREFIX} \u{1F50E} Descoberta de cookies (experimental)`);
1666
- const names = Array.from(
1667
- new Set([consentName, ...discovered.map((d) => d.name)].filter(Boolean))
1668
- );
1669
- const rows = names.map((n) => ({ Cookie: n }));
1670
- if (typeof console.table === "function") console.table(rows);
1671
- else console.log(rows);
1672
- console.info(
1673
- `${PREFIX} \u2139\uFE0F Estes nomes s\xE3o detectados em tempo de execu\xE7\xE3o. Ajuste ou categorize via APIs de override se necess\xE1rio.`
1674
- );
1675
- console.groupEnd();
1676
- } catch {
1944
+ if (isDev2 && gt.__LGPD_DISCOVERY_LOGGED__ !== true && !disableDiscoveryLog) {
1945
+ const discovered = discoverRuntimeCookies();
1946
+ const consentName = detectConsentCookieName() || DEFAULT_COOKIE_OPTS.name;
1947
+ const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
1948
+ if (typeof console !== "undefined") {
1949
+ try {
1950
+ console.group(`${PREFIX} \u{1F50E} Descoberta de cookies (experimental)`);
1951
+ const names = Array.from(
1952
+ new Set([consentName, ...discovered.map((d) => d.name)].filter(Boolean))
1953
+ );
1954
+ const rows = names.map((n) => ({ Cookie: n }));
1955
+ if (typeof console.table === "function") console.table(rows);
1956
+ else console.log(rows);
1957
+ console.info(
1958
+ `${PREFIX} \u2139\uFE0F Estes nomes s\xE3o detectados em tempo de execu\xE7\xE3o. Ajuste ou categorize via APIs de override se necess\xE1rio.`
1959
+ );
1960
+ console.groupEnd();
1961
+ } catch {
1962
+ }
1677
1963
  }
1964
+ gt.__LGPD_DISCOVERY_LOGGED__ = true;
1678
1965
  }
1679
- gt.__LGPD_DISCOVERY_LOGGED__ = true;
1680
1966
  } catch {
1681
1967
  }
1682
1968
  }, [disableDiscoveryLog]);
@@ -1726,21 +2012,21 @@ function createFullConsentState(consented, preferences, source, projectConfig, i
1726
2012
  isModalOpen
1727
2013
  };
1728
2014
  }
1729
- var DEFAULT_TEXTS = {
2015
+ var BASE_TEXTS = {
1730
2016
  // Textos básicos
1731
- bannerMessage: "Utilizamos cookies para melhorar sua experi\xEAncia.",
2017
+ bannerMessage: "Usamos cookies necess\xE1rios para o funcionamento do site. Os demais cookies s\xE3o opcionais e voc\xEA pode aceitar, rejeitar ou ajustar suas prefer\xEAncias.",
1732
2018
  acceptAll: "Aceitar todos",
1733
- declineAll: "Recusar",
2019
+ declineAll: "Rejeitar opcionais",
1734
2020
  preferences: "Prefer\xEAncias",
1735
- policyLink: "Saiba mais",
1736
- modalTitle: "Prefer\xEAncias de Cookies",
1737
- modalIntro: "Ajuste as categorias de cookies. Cookies necess\xE1rios s\xE3o sempre utilizados para funcionalidades b\xE1sicas.",
2021
+ policyLink: "Pol\xEDtica de privacidade",
2022
+ modalTitle: "Prefer\xEAncias de cookies",
2023
+ modalIntro: "Cookies necess\xE1rios s\xE3o sempre ativos. As demais categorias s\xE3o opcionais e voc\xEA pode ativ\xE1-las ou desativ\xE1-las a qualquer momento.",
1738
2024
  save: "Salvar prefer\xEAncias",
1739
2025
  necessaryAlwaysOn: "Cookies necess\xE1rios (sempre ativos)",
1740
2026
  // Textos adicionais para UI customizada
1741
- preferencesButton: "Configurar Cookies",
1742
- preferencesTitle: "Gerenciar Prefer\xEAncias de Cookies",
1743
- preferencesDescription: "Escolha quais tipos de cookies voc\xEA permite que sejam utilizados.",
2027
+ preferencesButton: "Gerenciar cookies",
2028
+ preferencesTitle: "Gerenciar prefer\xEAncias de cookies",
2029
+ preferencesDescription: "Escolha quais categorias opcionais voc\xEA permite. Cookies necess\xE1rios permanecem sempre ativos.",
1744
2030
  close: "Fechar",
1745
2031
  accept: "Aceitar",
1746
2032
  reject: "Rejeitar",
@@ -1763,6 +2049,10 @@ var DEFAULT_TEXTS = {
1763
2049
  transferCountries: void 0
1764
2050
  // Exibido se definido
1765
2051
  };
2052
+ var DEFAULT_TEXTS = {
2053
+ ...BASE_TEXTS,
2054
+ ...EXPANDED_DEFAULT_TEXTS
2055
+ };
1766
2056
  function reducer(state, action) {
1767
2057
  logger.consentState(action.type, state);
1768
2058
  switch (action.type) {
@@ -1846,6 +2136,8 @@ function ConsentProvider({
1846
2136
  initialState,
1847
2137
  categories,
1848
2138
  texts: textsProp,
2139
+ language,
2140
+ textVariant,
1849
2141
  designTokens,
1850
2142
  PreferencesModalComponent,
1851
2143
  preferencesModalProps = {},
@@ -1855,6 +2147,7 @@ function ConsentProvider({
1855
2147
  floatingPreferencesButtonProps = {},
1856
2148
  disableFloatingPreferencesButton = false,
1857
2149
  blocking = false,
2150
+ blockingMode = "soft",
1858
2151
  blockingStrategy = "auto",
1859
2152
  hideBranding: _hideBranding = false,
1860
2153
  onConsentGiven,
@@ -1870,7 +2163,11 @@ function ConsentProvider({
1870
2163
  onConsentChange,
1871
2164
  onAuditLog
1872
2165
  }) {
1873
- const texts = React4.useMemo(() => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }), [textsProp]);
2166
+ const mergedTexts = React4.useMemo(() => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }), [textsProp]);
2167
+ const texts = React4.useMemo(
2168
+ () => resolveTexts(mergedTexts, { language, variant: textVariant }),
2169
+ [mergedTexts, language, textVariant]
2170
+ );
1874
2171
  const cookie = React4.useMemo(() => {
1875
2172
  const base = { ...DEFAULT_COOKIE_OPTS, ...cookieOpts ?? {} };
1876
2173
  base.name = cookieOpts?.name ?? buildConsentStorageKey({
@@ -2128,6 +2425,7 @@ function ConsentProvider({
2128
2425
  hideBranding: incoming.hideBranding === void 0 ? _hideBranding : Boolean(incoming.hideBranding)
2129
2426
  };
2130
2427
  }, [cookieBannerProps, blocking, _hideBranding]);
2428
+ const hardBlockingActive = blocking && isHydrated && !state.consented && blockingMode === "hard";
2131
2429
  const content = /* @__PURE__ */ jsx(StateCtx.Provider, { value: state, children: /* @__PURE__ */ jsx(ActionsCtx.Provider, { value: api, children: /* @__PURE__ */ jsx(TextsCtx.Provider, { value: texts, children: /* @__PURE__ */ jsx(HydrationCtx.Provider, { value: isHydrated, children: /* @__PURE__ */ jsx(DesignProvider, { tokens: designTokens, children: /* @__PURE__ */ jsxs(
2132
2430
  CategoriesProvider,
2133
2431
  {
@@ -2135,7 +2433,16 @@ function ConsentProvider({
2135
2433
  disableDeveloperGuidance,
2136
2434
  disableDiscoveryLog,
2137
2435
  children: [
2138
- children,
2436
+ /* @__PURE__ */ jsx(
2437
+ "div",
2438
+ {
2439
+ "data-testid": "lgpd-app-content",
2440
+ "aria-hidden": hardBlockingActive ? true : void 0,
2441
+ inert: hardBlockingActive,
2442
+ style: { display: "contents" },
2443
+ children
2444
+ }
2445
+ ),
2139
2446
  PreferencesModalComponent ? /* @__PURE__ */ jsx(
2140
2447
  PreferencesModalComponent,
2141
2448
  {
@@ -2287,8 +2594,9 @@ function hasCategoryConsent(snapshot, category) {
2287
2594
  return Boolean(snapshot.preferences?.[category]);
2288
2595
  }
2289
2596
  function loadScript(id, src, category = null, attrs = {}, nonce, options) {
2290
- if (typeof document === "undefined") return Promise.resolve();
2291
- if (document.getElementById(id)) return Promise.resolve();
2597
+ const currentDocument = globalThis.document;
2598
+ if (!src || currentDocument === void 0) return Promise.resolve();
2599
+ if (currentDocument.getElementById(id)) return Promise.resolve();
2292
2600
  const existingPromise = LOADING_SCRIPTS.get(id);
2293
2601
  if (existingPromise) return existingPromise;
2294
2602
  const pollInterval = options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL;
@@ -2296,7 +2604,7 @@ function loadScript(id, src, category = null, attrs = {}, nonce, options) {
2296
2604
  const mergedAttrs = { ...attrs };
2297
2605
  const promise = new Promise((resolve, reject) => {
2298
2606
  const inject = () => {
2299
- const s = document.createElement("script");
2607
+ const s = currentDocument.createElement("script");
2300
2608
  s.id = id;
2301
2609
  s.src = src;
2302
2610
  s.async = mergedAttrs.async !== "false";
@@ -2314,7 +2622,7 @@ function loadScript(id, src, category = null, attrs = {}, nonce, options) {
2314
2622
  LOADING_SCRIPTS.delete(id);
2315
2623
  reject(new Error(`Failed to load script: ${src}`));
2316
2624
  };
2317
- document.body.appendChild(s);
2625
+ currentDocument.body.appendChild(s);
2318
2626
  };
2319
2627
  const snapshot = options?.consentSnapshot;
2320
2628
  const skipChecks = options?.skipConsentCheck === true;
@@ -2802,6 +3110,31 @@ function useConsentScriptLoader() {
2802
3110
  }
2803
3111
 
2804
3112
  // src/utils/scriptIntegrations.ts
3113
+ function createSuggestedIntegration(config) {
3114
+ const suggested = suggestCategoryForScript(config.id)[0] ?? "analytics";
3115
+ const category = resolveCategory(suggested, config.category);
3116
+ const { category: _ignored, ...rest } = config;
3117
+ return { ...rest, category };
3118
+ }
3119
+ var resolveCategory = (fallback, override) => {
3120
+ if (typeof override === "string" && override.trim().length > 0) return override.trim();
3121
+ return fallback;
3122
+ };
3123
+ var isDevEnv = () => {
3124
+ const env = typeof globalThis !== "undefined" ? globalThis.process?.env?.NODE_ENV : void 0;
3125
+ return env !== "production";
3126
+ };
3127
+ var resolveRequiredString = (value, field, integrationId) => {
3128
+ if (typeof value !== "string" || value.trim().length === 0) {
3129
+ if (isDevEnv()) {
3130
+ console.error(
3131
+ `[LGPD-CONSENT] Config inv\xE1lida: integra\xE7\xE3o "${integrationId}" requer "${field}".`
3132
+ );
3133
+ }
3134
+ return null;
3135
+ }
3136
+ return value.trim();
3137
+ };
2805
3138
  function buildConsentModeSignals(preferences) {
2806
3139
  const analytics = preferences.analytics ? "granted" : "denied";
2807
3140
  const marketing = preferences.marketing ? "granted" : "denied";
@@ -2813,16 +3146,18 @@ function buildConsentModeSignals(preferences) {
2813
3146
  };
2814
3147
  }
2815
3148
  function pushToLayer(entry, dataLayerName) {
2816
- if (typeof globalThis.window === "undefined") return;
2817
- const registry = globalThis.window;
3149
+ const currentWindow = globalThis.window;
3150
+ if (currentWindow === void 0) return;
3151
+ const registry = currentWindow;
2818
3152
  const name = dataLayerName ?? "dataLayer";
2819
3153
  const layer = registry[name] ?? [];
2820
3154
  registry[name] = layer;
2821
3155
  layer.push(entry);
2822
3156
  }
2823
3157
  function ensureGtag(dataLayerName = "dataLayer") {
2824
- if (typeof globalThis.window === "undefined") return null;
2825
- const w = window;
3158
+ const currentWindow = globalThis.window;
3159
+ if (currentWindow === void 0) return null;
3160
+ const w = currentWindow;
2826
3161
  const registry = w;
2827
3162
  const layer = registry[dataLayerName] ?? [];
2828
3163
  registry[dataLayerName] = layer;
@@ -2854,10 +3189,45 @@ function applyConsentModeUpdate(preferences, dataLayerName) {
2854
3189
  pushToLayer(["consent", "update", payload], dataLayerName);
2855
3190
  }
2856
3191
  function createGoogleAnalyticsIntegration(config) {
2857
- const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtag/js?id=${config.measurementId}`;
3192
+ const category = resolveCategory("analytics", config.category);
3193
+ const measurementId = resolveRequiredString(
3194
+ config.measurementId,
3195
+ "measurementId",
3196
+ "google-analytics"
3197
+ );
3198
+ if (!measurementId) {
3199
+ return {
3200
+ id: "google-analytics",
3201
+ category,
3202
+ src: "",
3203
+ cookies: ["_ga", "_ga_*", "_gid"],
3204
+ cookiesInfo: [
3205
+ {
3206
+ name: "_ga",
3207
+ purpose: "Identifica\xE7\xE3o \xFAnica de visitantes para an\xE1lise de tr\xE1fego",
3208
+ duration: "2 anos",
3209
+ provider: "Google Analytics"
3210
+ },
3211
+ {
3212
+ name: "_ga_*",
3213
+ purpose: "Rastreamento de sess\xF5es e eventos espec\xEDficos do stream GA4",
3214
+ duration: "2 anos",
3215
+ provider: "Google Analytics"
3216
+ },
3217
+ {
3218
+ name: "_gid",
3219
+ purpose: "Distin\xE7\xE3o de visitantes \xFAnicos em per\xEDodo de 24h",
3220
+ duration: "24 horas",
3221
+ provider: "Google Analytics"
3222
+ }
3223
+ ],
3224
+ attrs: { async: "true" }
3225
+ };
3226
+ }
3227
+ const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtag/js?id=${measurementId}`;
2858
3228
  return {
2859
3229
  id: "google-analytics",
2860
- category: "analytics",
3230
+ category,
2861
3231
  src,
2862
3232
  cookies: ["_ga", "_ga_*", "_gid"],
2863
3233
  cookiesInfo: [
@@ -2890,16 +3260,26 @@ function createGoogleAnalyticsIntegration(config) {
2890
3260
  const gtag = ensureGtag();
2891
3261
  if (!gtag) return;
2892
3262
  gtag("js", /* @__PURE__ */ new Date());
2893
- gtag("config", config.measurementId, config.config ?? {});
3263
+ gtag("config", measurementId, config.config ?? {});
2894
3264
  },
2895
3265
  attrs: { async: "true" }
2896
3266
  };
2897
3267
  }
2898
3268
  function createGoogleTagManagerIntegration(config) {
2899
- const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtm.js?id=${config.containerId}`;
3269
+ const category = resolveCategory("analytics", config.category);
3270
+ const containerId = resolveRequiredString(config.containerId, "containerId", "google-tag-manager");
3271
+ if (!containerId) {
3272
+ return {
3273
+ id: "google-tag-manager",
3274
+ category,
3275
+ src: "",
3276
+ cookies: ["_gcl_au"]
3277
+ };
3278
+ }
3279
+ const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtm.js?id=${containerId}`;
2900
3280
  return {
2901
3281
  id: "google-tag-manager",
2902
- category: "analytics",
3282
+ category,
2903
3283
  src,
2904
3284
  cookies: ["_gcl_au"],
2905
3285
  bootstrap: () => {
@@ -2909,9 +3289,10 @@ function createGoogleTagManagerIntegration(config) {
2909
3289
  applyConsentModeUpdate(preferences, config.dataLayerName);
2910
3290
  },
2911
3291
  init: () => {
2912
- if (globalThis.window !== void 0) {
3292
+ const currentWindow = globalThis.window;
3293
+ if (currentWindow !== void 0) {
2913
3294
  const dataLayerName = config.dataLayerName || "dataLayer";
2914
- const w = window;
3295
+ const w = currentWindow;
2915
3296
  const layer = w[dataLayerName] ?? [];
2916
3297
  w[dataLayerName] = layer;
2917
3298
  layer.push({ "gtm.start": Date.now(), event: "gtm.js" });
@@ -2920,20 +3301,31 @@ function createGoogleTagManagerIntegration(config) {
2920
3301
  };
2921
3302
  }
2922
3303
  function createUserWayIntegration(config) {
3304
+ const category = resolveCategory("functional", config.category);
3305
+ const accountId = resolveRequiredString(config.accountId, "accountId", "userway");
3306
+ if (!accountId) {
3307
+ return {
3308
+ id: "userway",
3309
+ category,
3310
+ src: "",
3311
+ cookies: ["_userway_*"]
3312
+ };
3313
+ }
2923
3314
  const src = config.scriptUrl ?? "https://cdn.userway.org/widget.js";
2924
3315
  return {
2925
3316
  id: "userway",
2926
- category: "functional",
3317
+ category,
2927
3318
  src,
2928
3319
  cookies: ["_userway_*"],
2929
3320
  init: () => {
2930
- if (globalThis.window !== void 0) {
2931
- const w = window;
3321
+ const currentWindow = globalThis.window;
3322
+ if (currentWindow !== void 0) {
3323
+ const w = currentWindow;
2932
3324
  w.UserWayWidgetApp = w.UserWayWidgetApp || {};
2933
- w.UserWayWidgetApp.accountId = config.accountId;
3325
+ w.UserWayWidgetApp.accountId = accountId;
2934
3326
  }
2935
3327
  },
2936
- attrs: { "data-account": config.accountId }
3328
+ attrs: { "data-account": accountId }
2937
3329
  };
2938
3330
  }
2939
3331
  var COMMON_INTEGRATIONS = {
@@ -2942,15 +3334,26 @@ var COMMON_INTEGRATIONS = {
2942
3334
  userway: createUserWayIntegration
2943
3335
  };
2944
3336
  function createFacebookPixelIntegration(config) {
3337
+ const category = resolveCategory("marketing", config.category);
3338
+ const pixelId = resolveRequiredString(config.pixelId, "pixelId", "facebook-pixel");
3339
+ if (!pixelId) {
3340
+ return {
3341
+ id: "facebook-pixel",
3342
+ category,
3343
+ src: "",
3344
+ cookies: ["_fbp", "fr"]
3345
+ };
3346
+ }
2945
3347
  const src = config.scriptUrl ?? "https://connect.facebook.net/en_US/fbevents.js";
2946
3348
  return {
2947
3349
  id: "facebook-pixel",
2948
- category: "marketing",
3350
+ category,
2949
3351
  src,
2950
3352
  cookies: ["_fbp", "fr"],
2951
3353
  init: () => {
2952
- if (globalThis.window !== void 0) {
2953
- const w = window;
3354
+ const currentWindow = globalThis.window;
3355
+ if (currentWindow !== void 0) {
3356
+ const w = currentWindow;
2954
3357
  if (!w.fbq) {
2955
3358
  const fbq = (...args) => {
2956
3359
  if (w.fbq && typeof w.fbq.callMethod === "function") {
@@ -2963,18 +3366,34 @@ function createFacebookPixelIntegration(config) {
2963
3366
  fbq.loaded = true;
2964
3367
  w.fbq = fbq;
2965
3368
  }
2966
- w.fbq("init", config.pixelId, config.advancedMatching ?? {});
3369
+ w.fbq("init", pixelId, config.advancedMatching ?? {});
2967
3370
  if (config.autoTrack !== false) w.fbq("track", "PageView");
2968
3371
  }
2969
3372
  }
2970
3373
  };
2971
3374
  }
2972
3375
  function createHotjarIntegration(config) {
3376
+ const category = resolveCategory("analytics", config.category);
3377
+ const siteId = resolveRequiredString(config.siteId, "siteId", "hotjar");
2973
3378
  const v = config.version ?? 6;
2974
- const src = config.scriptUrl ?? `https://static.hotjar.com/c/hotjar-${config.siteId}.js?sv=${v}`;
3379
+ if (!siteId) {
3380
+ return {
3381
+ id: "hotjar",
3382
+ category,
3383
+ src: "",
3384
+ cookies: [
3385
+ "_hjSession_*",
3386
+ "_hjSessionUser_*",
3387
+ "_hjFirstSeen",
3388
+ "_hjIncludedInSessionSample",
3389
+ "_hjAbsoluteSessionInProgress"
3390
+ ]
3391
+ };
3392
+ }
3393
+ const src = config.scriptUrl ?? `https://static.hotjar.com/c/hotjar-${siteId}.js?sv=${v}`;
2975
3394
  return {
2976
3395
  id: "hotjar",
2977
- category: "analytics",
3396
+ category,
2978
3397
  src,
2979
3398
  cookies: [
2980
3399
  "_hjSession_*",
@@ -3016,9 +3435,10 @@ function createHotjarIntegration(config) {
3016
3435
  }
3017
3436
  ],
3018
3437
  init: () => {
3019
- if (globalThis.window !== void 0) {
3020
- const w = window;
3021
- w._hjSettings = { hjid: config.siteId, hjsv: v };
3438
+ const currentWindow = globalThis.window;
3439
+ if (currentWindow !== void 0) {
3440
+ const w = currentWindow;
3441
+ w._hjSettings = { hjid: siteId, hjsv: v };
3022
3442
  if (!w.hj) {
3023
3443
  const hj = (...args) => {
3024
3444
  hj.q = hj.q || [];
@@ -3027,17 +3447,35 @@ function createHotjarIntegration(config) {
3027
3447
  w.hj = hj;
3028
3448
  }
3029
3449
  if (config.debug && typeof console !== "undefined" && typeof console.info === "function") {
3030
- console.info("[Hotjar] initialized with siteId", config.siteId);
3450
+ console.info("[Hotjar] initialized with siteId", siteId);
3031
3451
  }
3032
3452
  }
3033
3453
  }
3034
3454
  };
3035
3455
  }
3036
3456
  function createMixpanelIntegration(config) {
3457
+ const category = resolveCategory("analytics", config.category);
3458
+ const token = resolveRequiredString(config.token, "token", "mixpanel");
3459
+ if (!token) {
3460
+ return {
3461
+ id: "mixpanel",
3462
+ category,
3463
+ src: "",
3464
+ cookies: ["mp_*"],
3465
+ cookiesInfo: [
3466
+ {
3467
+ name: "mp_*",
3468
+ purpose: "Rastreamento de eventos e propriedades do usu\xE1rio para analytics",
3469
+ duration: "1 ano",
3470
+ provider: "Mixpanel"
3471
+ }
3472
+ ]
3473
+ };
3474
+ }
3037
3475
  const src = config.scriptUrl ?? "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";
3038
3476
  return {
3039
3477
  id: "mixpanel",
3040
- category: "analytics",
3478
+ category,
3041
3479
  src,
3042
3480
  cookies: ["mp_*"],
3043
3481
  cookiesInfo: [
@@ -3049,12 +3487,13 @@ function createMixpanelIntegration(config) {
3049
3487
  }
3050
3488
  ],
3051
3489
  init: () => {
3052
- if (globalThis.window !== void 0) {
3053
- const w = window;
3490
+ const currentWindow = globalThis.window;
3491
+ if (currentWindow !== void 0) {
3492
+ const w = currentWindow;
3054
3493
  w.mixpanel = w.mixpanel || { init: () => void 0 };
3055
3494
  if (w.mixpanel && typeof w.mixpanel.init === "function") {
3056
3495
  try {
3057
- w.mixpanel.init(config.token, config.config ?? {}, config.api_host);
3496
+ w.mixpanel.init(token, config.config ?? {}, config.api_host);
3058
3497
  } catch (error) {
3059
3498
  if (typeof console !== "undefined" && typeof console.warn === "function") {
3060
3499
  console.warn("[Mixpanel] Failed to initialize:", error);
@@ -3066,15 +3505,26 @@ function createMixpanelIntegration(config) {
3066
3505
  };
3067
3506
  }
3068
3507
  function createClarityIntegration(config) {
3069
- const src = config.scriptUrl ?? `https://www.clarity.ms/tag/${config.projectId}`;
3508
+ const category = resolveCategory("analytics", config.category);
3509
+ const projectId = resolveRequiredString(config.projectId, "projectId", "clarity");
3510
+ if (!projectId) {
3511
+ return {
3512
+ id: "clarity",
3513
+ category,
3514
+ src: "",
3515
+ cookies: ["_clck", "_clsk", "CLID", "ANONCHK", "MR", "MUID", "SM"]
3516
+ };
3517
+ }
3518
+ const src = config.scriptUrl ?? `https://www.clarity.ms/tag/${projectId}`;
3070
3519
  return {
3071
3520
  id: "clarity",
3072
- category: "analytics",
3521
+ category,
3073
3522
  src,
3074
3523
  cookies: ["_clck", "_clsk", "CLID", "ANONCHK", "MR", "MUID", "SM"],
3075
3524
  init: () => {
3076
- if (globalThis.window !== void 0 && typeof config.upload !== "undefined") {
3077
- const w = window;
3525
+ const currentWindow = globalThis.window;
3526
+ if (currentWindow !== void 0 && typeof config.upload !== "undefined") {
3527
+ const w = currentWindow;
3078
3528
  if (typeof w.clarity === "function") {
3079
3529
  try {
3080
3530
  w.clarity("set", "upload", config.upload);
@@ -3089,18 +3539,29 @@ function createClarityIntegration(config) {
3089
3539
  };
3090
3540
  }
3091
3541
  function createIntercomIntegration(config) {
3092
- const src = config.scriptUrl ?? `https://widget.intercom.io/widget/${config.app_id}`;
3542
+ const category = resolveCategory("functional", config.category);
3543
+ const appId = resolveRequiredString(config.app_id, "app_id", "intercom");
3544
+ if (!appId) {
3545
+ return {
3546
+ id: "intercom",
3547
+ category,
3548
+ src: "",
3549
+ cookies: ["intercom-id-*", "intercom-session-*"]
3550
+ };
3551
+ }
3552
+ const src = config.scriptUrl ?? `https://widget.intercom.io/widget/${appId}`;
3093
3553
  return {
3094
3554
  id: "intercom",
3095
- category: "functional",
3555
+ category,
3096
3556
  src,
3097
3557
  cookies: ["intercom-id-*", "intercom-session-*"],
3098
3558
  init: () => {
3099
- if (globalThis.window !== void 0) {
3100
- const w = window;
3559
+ const currentWindow = globalThis.window;
3560
+ if (currentWindow !== void 0) {
3561
+ const w = currentWindow;
3101
3562
  if (typeof w.Intercom === "function") {
3102
3563
  try {
3103
- w.Intercom("boot", { app_id: config.app_id });
3564
+ w.Intercom("boot", { app_id: appId });
3104
3565
  } catch (error) {
3105
3566
  if (typeof console !== "undefined" && typeof console.warn === "function") {
3106
3567
  console.warn("[Intercom] Failed to boot:", error);
@@ -3112,18 +3573,29 @@ function createIntercomIntegration(config) {
3112
3573
  };
3113
3574
  }
3114
3575
  function createZendeskChatIntegration(config) {
3115
- const src = config.scriptUrl ?? `https://static.zdassets.com/ekr/snippet.js?key=${config.key}`;
3576
+ const category = resolveCategory("functional", config.category);
3577
+ const key = resolveRequiredString(config.key, "key", "zendesk-chat");
3578
+ if (!key) {
3579
+ return {
3580
+ id: "zendesk-chat",
3581
+ category,
3582
+ src: "",
3583
+ cookies: ["__zlcmid", "_zendesk_shared_session"]
3584
+ };
3585
+ }
3586
+ const src = config.scriptUrl ?? `https://static.zdassets.com/ekr/snippet.js?key=${key}`;
3116
3587
  return {
3117
3588
  id: "zendesk-chat",
3118
- category: "functional",
3589
+ category,
3119
3590
  src,
3120
3591
  cookies: ["__zlcmid", "_zendesk_shared_session"],
3121
3592
  init: () => {
3122
- if (globalThis.window !== void 0) {
3123
- const w = window;
3593
+ const currentWindow = globalThis.window;
3594
+ if (currentWindow !== void 0) {
3595
+ const w = currentWindow;
3124
3596
  if (typeof w.zE === "function") {
3125
3597
  try {
3126
- w.zE("webWidget", "identify", { key: config.key });
3598
+ w.zE("webWidget", "identify", { key });
3127
3599
  } catch (error) {
3128
3600
  if (typeof console !== "undefined" && typeof console.warn === "function") {
3129
3601
  console.warn("[Zendesk] Failed to identify:", error);
@@ -3245,215 +3717,4 @@ function createAnpdCategoriesConfig(options = {}) {
3245
3717
  };
3246
3718
  }
3247
3719
 
3248
- // src/types/advancedTexts.ts
3249
- var EXPANDED_DEFAULT_TEXTS = {
3250
- // Textos adicionais
3251
- confirm: "Confirmar",
3252
- cancel: "Cancelar",
3253
- loading: "Carregando...",
3254
- // Feedback
3255
- feedback: {
3256
- saveSuccess: "Prefer\xEAncias salvas com sucesso!",
3257
- saveError: "Erro ao salvar prefer\xEAncias. Tente novamente.",
3258
- consentUpdated: "Consentimento atualizado.",
3259
- cookiesRejected: "Cookies opcionais rejeitados.",
3260
- settingsReset: "Configura\xE7\xF5es resetadas."
3261
- },
3262
- // Acessibilidade
3263
- accessibility: {
3264
- bannerLabel: "Banner de consentimento de cookies",
3265
- modalLabel: "Modal de prefer\xEAncias de cookies",
3266
- keyboardNavigation: "Use Tab para navegar, Enter para selecionar",
3267
- toggleState: {
3268
- enabled: "Habilitado",
3269
- disabled: "Desabilitado"
3270
- },
3271
- liveRegion: "Regi\xE3o de an\xFAncios din\xE2micos"
3272
- },
3273
- // Categorias
3274
- categories: {
3275
- necessary: {
3276
- name: "Cookies Necess\xE1rios",
3277
- description: "Essenciais para o funcionamento b\xE1sico do site",
3278
- examples: "Sess\xE3o, seguran\xE7a, prefer\xEAncias de idioma"
3279
- },
3280
- analytics: {
3281
- name: "Cookies de Analytics",
3282
- description: "Ajudam a entender como os visitantes usam o site",
3283
- examples: "Google Analytics, contadores de p\xE1gina"
3284
- },
3285
- marketing: {
3286
- name: "Cookies de Marketing",
3287
- description: "Usados para personalizar an\xFAncios e ofertas",
3288
- examples: "Facebook Pixel, Google Ads, remarketing"
3289
- },
3290
- functional: {
3291
- name: "Cookies Funcionais",
3292
- description: "Melhoram a funcionalidade e personaliza\xE7\xE3o",
3293
- examples: "Chat, mapas, v\xEDdeos embarcados"
3294
- },
3295
- performance: {
3296
- name: "Cookies de Performance",
3297
- description: "Coletam informa\xE7\xF5es sobre velocidade e estabilidade",
3298
- examples: "Monitoramento de erro, otimiza\xE7\xE3o de velocidade"
3299
- }
3300
- },
3301
- // Contextos específicos
3302
- contexts: {
3303
- ecommerce: {
3304
- cartAbandonment: "Lembramos dos produtos no seu carrinho",
3305
- personalizedOffers: "Ofertas personalizadas baseadas no seu hist\xF3rico",
3306
- paymentSecurity: "Seguran\xE7a adicional no processo de pagamento",
3307
- productRecommendations: "Sugest\xF5es de produtos relevantes"
3308
- },
3309
- saas: {
3310
- userAnalytics: "An\xE1lise de uso para melhorar funcionalidades",
3311
- performanceMonitoring: "Monitoramento de performance da aplica\xE7\xE3o",
3312
- featureUsage: "Estat\xEDsticas de uso de recursos",
3313
- customerSupport: "Suporte ao cliente mais eficiente"
3314
- },
3315
- government: {
3316
- citizenServices: "Melhoria dos servi\xE7os ao cidad\xE3o",
3317
- dataProtection: "Prote\xE7\xE3o rigorosa dos dados pessoais",
3318
- transparency: "Transpar\xEAncia no uso de dados",
3319
- accessibility: "Recursos de acessibilidade digital"
3320
- },
3321
- education: {
3322
- studentProgress: "Acompanhamento do progresso educacional",
3323
- learningAnalytics: "Analytics para melhorar o aprendizado",
3324
- accessibility: "Recursos educacionais acess\xEDveis",
3325
- parentalConsent: "Consentimento parental quando necess\xE1rio"
3326
- }
3327
- },
3328
- // Variações de tom
3329
- variants: {
3330
- formal: {
3331
- bannerMessage: "Este s\xEDtio eletr\xF4nico utiliza cookies para otimizar a experi\xEAncia de navega\xE7\xE3o.",
3332
- acceptAll: "Concordar com todos os cookies",
3333
- declineAll: "Recusar cookies opcionais",
3334
- modalTitle: "Configura\xE7\xE3o de Cookies"
3335
- },
3336
- casual: {
3337
- bannerMessage: "\u{1F36A} Ei! Usamos cookies para tornar sua experi\xEAncia ainda melhor!",
3338
- acceptAll: "Aceitar tudo",
3339
- declineAll: "S\xF3 o essencial",
3340
- modalTitle: "Seus Cookies"
3341
- },
3342
- concise: {
3343
- bannerMessage: "Usamos cookies. Voc\xEA aceita?",
3344
- acceptAll: "Sim",
3345
- declineAll: "N\xE3o",
3346
- modalTitle: "Cookies"
3347
- },
3348
- detailed: {
3349
- bannerMessage: "Utilizamos cookies e tecnologias similares para melhorar sua experi\xEAncia de navega\xE7\xE3o, personalizar conte\xFAdo, analisar tr\xE1fego e oferecer funcionalidades de redes sociais.",
3350
- acceptAll: "Aceitar todos os cookies e tecnologias",
3351
- declineAll: "Recusar todos os cookies opcionais",
3352
- modalTitle: "Centro de Prefer\xEAncias de Privacidade"
3353
- }
3354
- },
3355
- // Internacionalização simplificada (apenas textos básicos)
3356
- i18n: {
3357
- en: {
3358
- bannerMessage: "We use cookies to enhance your experience.",
3359
- acceptAll: "Accept All",
3360
- declineAll: "Decline",
3361
- preferences: "Preferences",
3362
- modalTitle: "Cookie Preferences",
3363
- modalIntro: "Customize your cookie preferences below.",
3364
- save: "Save Preferences",
3365
- necessaryAlwaysOn: "Necessary cookies (always active)"
3366
- },
3367
- es: {
3368
- bannerMessage: "Utilizamos cookies para mejorar su experiencia.",
3369
- acceptAll: "Aceptar Todo",
3370
- declineAll: "Rechazar",
3371
- preferences: "Preferencias",
3372
- modalTitle: "Preferencias de Cookies",
3373
- modalIntro: "Personalice sus preferencias de cookies a continuaci\xF3n.",
3374
- save: "Guardar Preferencias",
3375
- necessaryAlwaysOn: "Cookies necess\xE1rias (sempre ativas)"
3376
- },
3377
- fr: {
3378
- bannerMessage: "Nous utilisons des cookies pour am\xE9liorer votre exp\xE9rience.",
3379
- acceptAll: "Tout Accepter",
3380
- declineAll: "Refuser",
3381
- preferences: "Pr\xE9f\xE9rences",
3382
- modalTitle: "Pr\xE9f\xE9rences des Cookies",
3383
- modalIntro: "Personnalisez vos pr\xE9f\xE9rences de cookies ci-dessous.",
3384
- save: "Enregistrer les Pr\xE9f\xE9rences",
3385
- necessaryAlwaysOn: "Cookies n\xE9cessaires (toujours actifs)"
3386
- }
3387
- },
3388
- // Textos técnicos
3389
- technical: {
3390
- sessionCookies: "Cookies de sess\xE3o s\xE3o tempor\xE1rios e expiram quando voc\xEA fecha o navegador.",
3391
- persistentCookies: "Cookies persistentes permanecem no seu dispositivo at\xE9 expirarem ou serem removidos.",
3392
- thirdPartyCookies: "Cookies de terceiros s\xE3o definidos por dom\xEDnios diferentes do site que voc\xEA est\xE1 visitando.",
3393
- browserSettings: "Voc\xEA pode gerenciar cookies nas configura\xE7\xF5es do seu navegador.",
3394
- disablingImpact: "Desabilitar cookies pode afetar a funcionalidade do site."
3395
- },
3396
- // Cookie details
3397
- cookieDetails: {
3398
- tableHeaders: {
3399
- name: "Nome",
3400
- purpose: "Finalidade",
3401
- duration: "Dura\xE7\xE3o",
3402
- provider: "Fornecedor",
3403
- type: "Tipo"
3404
- },
3405
- noCookies: "Nenhum cookie encontrado para esta categoria.",
3406
- toggleDetails: {
3407
- expand: "Ver detalhes",
3408
- collapse: "Ocultar detalhes"
3409
- }
3410
- }
3411
- };
3412
- function resolveTexts(texts, options = {}) {
3413
- const { language = "pt", variant } = options;
3414
- let resolved = { ...texts };
3415
- if (variant && texts.variants?.[variant]) {
3416
- resolved = { ...resolved, ...texts.variants[variant] };
3417
- }
3418
- if (language !== "pt" && texts.i18n?.[language]) {
3419
- resolved = { ...resolved, ...texts.i18n[language] };
3420
- }
3421
- return resolved;
3422
- }
3423
- var TEXT_TEMPLATES = {
3424
- ecommerce: {
3425
- ...EXPANDED_DEFAULT_TEXTS,
3426
- bannerMessage: "Utilizamos cookies para personalizar ofertas e melhorar sua experi\xEAncia de compra.",
3427
- acceptAll: "Aceitar e continuar",
3428
- variants: {
3429
- casual: {
3430
- bannerMessage: "\u{1F6D2} Usamos cookies para encontrar as melhores ofertas para voc\xEA!",
3431
- acceptAll: "Quero ofertas personalizadas!"
3432
- }
3433
- }
3434
- },
3435
- saas: {
3436
- ...EXPANDED_DEFAULT_TEXTS,
3437
- bannerMessage: "Utilizamos cookies para otimizar o desempenho da aplica\xE7\xE3o e sua experi\xEAncia.",
3438
- acceptAll: "Aceitar e otimizar",
3439
- variants: {
3440
- formal: {
3441
- bannerMessage: "Esta aplica\xE7\xE3o utiliza cookies para an\xE1lise de performance e melhoria cont\xEDnua da experi\xEAncia do usu\xE1rio.",
3442
- acceptAll: "Autorizar coleta de dados de uso"
3443
- }
3444
- }
3445
- },
3446
- government: {
3447
- ...EXPANDED_DEFAULT_TEXTS,
3448
- bannerMessage: "Este portal utiliza cookies em conformidade com a LGPD para melhorar os servi\xE7os p\xFAblicos.",
3449
- acceptAll: "Aceitar em conformidade",
3450
- variants: {
3451
- formal: {
3452
- bannerMessage: "Este s\xEDtio eletr\xF4nico do governo utiliza cookies estritamente necess\xE1rios e opcionais, em conformidade com a Lei Geral de Prote\xE7\xE3o de Dados.",
3453
- acceptAll: "Concordar com o uso de cookies"
3454
- }
3455
- }
3456
- }
3457
- };
3458
-
3459
- export { ANPD_CATEGORY_PRESETS, COMMON_INTEGRATIONS, ConsentGate, ConsentProvider, ConsentScriptLoader, DEFAULT_PROJECT_CATEGORIES, DesignProvider, EXPANDED_DEFAULT_TEXTS, GUIDANCE_PRESETS, INTEGRATION_TEMPLATES, LogLevel, TEXT_TEMPLATES, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, buildConsentStorageKey, categorizeDiscoveredCookies, checkPeerDeps, createAnpdCategoriesConfig, createClarityIntegration, createConsentAuditEntry, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, ensureNecessaryAlwaysOn, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, getPeerDepsLocale, loadScript, logDeveloperGuidance, logger, openPreferencesModal, pushConsentInitializedEvent, pushConsentUpdatedEvent, registerScript, resetPeerDepsMessages, resolveTexts, runPeerDepsCheck, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, setPeerDepsLocale, setPeerDepsMessages, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDataLayerEvents, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };
3720
+ export { ANPD_CATEGORY_PRESETS, COMMON_INTEGRATIONS, ConsentGate, ConsentProvider, ConsentScriptLoader, DEFAULT_PROJECT_CATEGORIES, DesignProvider, EXPANDED_DEFAULT_TEXTS, GUIDANCE_PRESETS, INTEGRATION_TEMPLATES, LogLevel, TEXT_TEMPLATES, analyzeDeveloperConfiguration, analyzeIntegrationCategories, autoConfigureCategories, buildConsentStorageKey, categorizeDiscoveredCookies, checkPeerDeps, createAnpdCategoriesConfig, createClarityIntegration, createConsentAuditEntry, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createProjectPreferences, createSaaSIntegrations, createSuggestedIntegration, createUserWayIntegration, createZendeskChatIntegration, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, ensureNecessaryAlwaysOn, extractCategoriesFromIntegrations, getAllProjectCategories, getCookiesInfoForCategory, getPeerDepsLocale, loadScript, logDeveloperGuidance, logger, openPreferencesModal, pushConsentInitializedEvent, pushConsentUpdatedEvent, registerScript, resetPeerDepsMessages, resolveTexts, runPeerDepsCheck, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, setPeerDepsLocale, setPeerDepsMessages, suggestCategoryForScript, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentScriptLoader, useConsentTexts, useDataLayerEvents, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateIntegrationCategories, validateNecessaryClassification, validateProjectPreferences };