@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.cjs CHANGED
@@ -35,6 +35,219 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
35
35
  throw Error('Dynamic require of "' + x + '" is not supported');
36
36
  });
37
37
 
38
+ // src/types/advancedTexts.ts
39
+ var EXPANDED_DEFAULT_TEXTS = {
40
+ // Textos adicionais
41
+ confirm: "Confirmar",
42
+ cancel: "Cancelar",
43
+ loading: "Carregando...",
44
+ // Feedback
45
+ feedback: {
46
+ saveSuccess: "Prefer\xEAncias salvas com sucesso!",
47
+ saveError: "Erro ao salvar prefer\xEAncias. Tente novamente.",
48
+ consentUpdated: "Consentimento atualizado.",
49
+ cookiesRejected: "Cookies opcionais rejeitados.",
50
+ settingsReset: "Configura\xE7\xF5es resetadas."
51
+ },
52
+ // Acessibilidade
53
+ accessibility: {
54
+ bannerLabel: "Banner de consentimento de cookies",
55
+ modalLabel: "Modal de prefer\xEAncias de cookies",
56
+ keyboardNavigation: "Use Tab para navegar, Enter para selecionar",
57
+ toggleState: {
58
+ enabled: "Habilitado",
59
+ disabled: "Desabilitado"
60
+ },
61
+ liveRegion: "Regi\xE3o de an\xFAncios din\xE2micos"
62
+ },
63
+ // Categorias
64
+ categories: {
65
+ necessary: {
66
+ name: "Cookies Necess\xE1rios",
67
+ description: "Essenciais para o funcionamento b\xE1sico do site e n\xE3o podem ser desativados",
68
+ examples: "Sess\xE3o, seguran\xE7a, prefer\xEAncias de idioma"
69
+ },
70
+ analytics: {
71
+ name: "Cookies de Analytics",
72
+ description: "Opcionais. Ajudam a entender como os visitantes usam o site",
73
+ examples: "Google Analytics, contadores de p\xE1gina"
74
+ },
75
+ marketing: {
76
+ name: "Cookies de Marketing",
77
+ description: "Opcionais. Usados para personalizar an\xFAncios e ofertas",
78
+ examples: "Facebook Pixel, Google Ads, remarketing"
79
+ },
80
+ functional: {
81
+ name: "Cookies Funcionais",
82
+ description: "Opcionais. Melhoram a funcionalidade e personaliza\xE7\xE3o",
83
+ examples: "Chat, mapas, v\xEDdeos embarcados"
84
+ },
85
+ performance: {
86
+ name: "Cookies de Performance",
87
+ description: "Opcionais. Coletam informa\xE7\xF5es sobre velocidade e estabilidade",
88
+ examples: "Monitoramento de erro, otimiza\xE7\xE3o de velocidade"
89
+ }
90
+ },
91
+ // Contextos específicos
92
+ contexts: {
93
+ ecommerce: {
94
+ cartAbandonment: "Lembramos dos produtos no seu carrinho",
95
+ personalizedOffers: "Ofertas personalizadas baseadas no seu hist\xF3rico",
96
+ paymentSecurity: "Seguran\xE7a adicional no processo de pagamento",
97
+ productRecommendations: "Sugest\xF5es de produtos relevantes"
98
+ },
99
+ saas: {
100
+ userAnalytics: "An\xE1lise de uso para melhorar funcionalidades",
101
+ performanceMonitoring: "Monitoramento de performance da aplica\xE7\xE3o",
102
+ featureUsage: "Estat\xEDsticas de uso de recursos",
103
+ customerSupport: "Suporte ao cliente mais eficiente"
104
+ },
105
+ government: {
106
+ citizenServices: "Melhoria dos servi\xE7os ao cidad\xE3o",
107
+ dataProtection: "Prote\xE7\xE3o rigorosa dos dados pessoais",
108
+ transparency: "Transpar\xEAncia no uso de dados",
109
+ accessibility: "Recursos de acessibilidade digital"
110
+ },
111
+ education: {
112
+ studentProgress: "Acompanhamento do progresso educacional",
113
+ learningAnalytics: "Analytics para melhorar o aprendizado",
114
+ accessibility: "Recursos educacionais acess\xEDveis",
115
+ parentalConsent: "Consentimento parental quando necess\xE1rio"
116
+ }
117
+ },
118
+ // Variações de tom
119
+ variants: {
120
+ formal: {
121
+ bannerMessage: "Este s\xEDtio eletr\xF4nico utiliza cookies para otimizar a experi\xEAncia de navega\xE7\xE3o.",
122
+ acceptAll: "Concordar com todos os cookies",
123
+ declineAll: "Recusar cookies opcionais",
124
+ modalTitle: "Configura\xE7\xE3o de Cookies"
125
+ },
126
+ casual: {
127
+ bannerMessage: "\u{1F36A} Ei! Usamos cookies para tornar sua experi\xEAncia ainda melhor!",
128
+ acceptAll: "Aceitar tudo",
129
+ declineAll: "S\xF3 o essencial",
130
+ modalTitle: "Seus Cookies"
131
+ },
132
+ concise: {
133
+ bannerMessage: "Usamos cookies. Voc\xEA aceita?",
134
+ acceptAll: "Sim",
135
+ declineAll: "N\xE3o",
136
+ modalTitle: "Cookies"
137
+ },
138
+ detailed: {
139
+ 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.",
140
+ acceptAll: "Aceitar todos os cookies e tecnologias",
141
+ declineAll: "Recusar todos os cookies opcionais",
142
+ modalTitle: "Centro de Prefer\xEAncias de Privacidade"
143
+ }
144
+ },
145
+ // Internacionalização simplificada (apenas textos básicos)
146
+ i18n: {
147
+ en: {
148
+ bannerMessage: "We use cookies to enhance your experience.",
149
+ acceptAll: "Accept All",
150
+ declineAll: "Decline",
151
+ preferences: "Preferences",
152
+ modalTitle: "Cookie Preferences",
153
+ modalIntro: "Customize your cookie preferences below.",
154
+ save: "Save Preferences",
155
+ necessaryAlwaysOn: "Necessary cookies (always active)"
156
+ },
157
+ es: {
158
+ bannerMessage: "Utilizamos cookies para mejorar su experiencia.",
159
+ acceptAll: "Aceptar Todo",
160
+ declineAll: "Rechazar",
161
+ preferences: "Preferencias",
162
+ modalTitle: "Preferencias de Cookies",
163
+ modalIntro: "Personalice sus preferencias de cookies a continuaci\xF3n.",
164
+ save: "Guardar Preferencias",
165
+ necessaryAlwaysOn: "Cookies necess\xE1rias (sempre ativas)"
166
+ },
167
+ fr: {
168
+ bannerMessage: "Nous utilisons des cookies pour am\xE9liorer votre exp\xE9rience.",
169
+ acceptAll: "Tout Accepter",
170
+ declineAll: "Refuser",
171
+ preferences: "Pr\xE9f\xE9rences",
172
+ modalTitle: "Pr\xE9f\xE9rences des Cookies",
173
+ modalIntro: "Personnalisez vos pr\xE9f\xE9rences de cookies ci-dessous.",
174
+ save: "Enregistrer les Pr\xE9f\xE9rences",
175
+ necessaryAlwaysOn: "Cookies n\xE9cessaires (toujours actifs)"
176
+ }
177
+ },
178
+ // Textos técnicos
179
+ technical: {
180
+ sessionCookies: "Cookies de sess\xE3o s\xE3o tempor\xE1rios e expiram quando voc\xEA fecha o navegador.",
181
+ persistentCookies: "Cookies persistentes permanecem no seu dispositivo at\xE9 expirarem ou serem removidos.",
182
+ thirdPartyCookies: "Cookies de terceiros s\xE3o definidos por dom\xEDnios diferentes do site que voc\xEA est\xE1 visitando.",
183
+ browserSettings: "Voc\xEA pode gerenciar cookies nas configura\xE7\xF5es do seu navegador.",
184
+ disablingImpact: "Desabilitar cookies pode afetar a funcionalidade do site."
185
+ },
186
+ // Cookie details
187
+ cookieDetails: {
188
+ tableHeaders: {
189
+ name: "Nome",
190
+ purpose: "Finalidade",
191
+ duration: "Dura\xE7\xE3o",
192
+ provider: "Fornecedor",
193
+ type: "Tipo"
194
+ },
195
+ noCookies: "Nenhum cookie encontrado para esta categoria.",
196
+ toggleDetails: {
197
+ expand: "Ver detalhes",
198
+ collapse: "Ocultar detalhes"
199
+ },
200
+ scriptLabelPrefix: "(script) ",
201
+ scriptPurpose: "Script de integra\xE7\xE3o ativo"
202
+ }
203
+ };
204
+ function resolveTexts(texts, options = {}) {
205
+ const { language = "pt", variant } = options;
206
+ let resolved = { ...texts };
207
+ if (variant && texts.variants?.[variant]) {
208
+ resolved = { ...resolved, ...texts.variants[variant] };
209
+ }
210
+ if (language !== "pt" && texts.i18n?.[language]) {
211
+ resolved = { ...resolved, ...texts.i18n[language] };
212
+ }
213
+ return resolved;
214
+ }
215
+ var TEXT_TEMPLATES = {
216
+ ecommerce: {
217
+ ...EXPANDED_DEFAULT_TEXTS,
218
+ bannerMessage: "Utilizamos cookies para personalizar ofertas e melhorar sua experi\xEAncia de compra.",
219
+ acceptAll: "Aceitar e continuar",
220
+ variants: {
221
+ casual: {
222
+ bannerMessage: "\u{1F6D2} Usamos cookies para encontrar as melhores ofertas para voc\xEA!",
223
+ acceptAll: "Quero ofertas personalizadas!"
224
+ }
225
+ }
226
+ },
227
+ saas: {
228
+ ...EXPANDED_DEFAULT_TEXTS,
229
+ bannerMessage: "Utilizamos cookies para otimizar o desempenho da aplica\xE7\xE3o e sua experi\xEAncia.",
230
+ acceptAll: "Aceitar e otimizar",
231
+ variants: {
232
+ formal: {
233
+ bannerMessage: "Esta aplica\xE7\xE3o utiliza cookies para an\xE1lise de performance e melhoria cont\xEDnua da experi\xEAncia do usu\xE1rio.",
234
+ acceptAll: "Autorizar coleta de dados de uso"
235
+ }
236
+ }
237
+ },
238
+ government: {
239
+ ...EXPANDED_DEFAULT_TEXTS,
240
+ bannerMessage: "Este portal utiliza cookies em conformidade com a LGPD para melhorar os servi\xE7os p\xFAblicos.",
241
+ acceptAll: "Aceitar em conformidade",
242
+ variants: {
243
+ formal: {
244
+ 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.",
245
+ acceptAll: "Concordar com o uso de cookies"
246
+ }
247
+ }
248
+ }
249
+ };
250
+
38
251
  // src/utils/categoryUtils.ts
39
252
  function createProjectPreferences(config, defaultValue = false) {
40
253
  const preferences = {
@@ -344,26 +557,31 @@ function buildConsentStorageKey(options) {
344
557
  var DEFAULT_COOKIE_OPTS = {
345
558
  name: "cookieConsent",
346
559
  maxAge: DEFAULT_MAX_AGE_SECONDS,
347
- maxAgeDays: 365,
348
560
  sameSite: "Lax",
349
- secure: globalThis.window === void 0 ? false : globalThis.window.location.protocol === "https:",
561
+ secure: false,
350
562
  path: "/",
351
563
  domain: void 0
352
564
  };
353
565
  function resolveCookieOptions(opts) {
354
- const protocols = [
355
- typeof globalThis.window !== "undefined" ? globalThis.window?.location?.protocol : void 0,
356
- typeof globalThis.location !== "undefined" ? globalThis.location?.protocol : void 0
357
- ].filter(Boolean);
566
+ const currentWindow = globalThis.window;
567
+ const currentLocation = globalThis.location;
568
+ const protocols = [currentWindow?.location?.protocol, currentLocation?.protocol].filter(Boolean);
358
569
  const forceHttps = globalThis.__LGPD_FORCE_HTTPS__ === true;
359
570
  const isHttps = forceHttps || protocols.includes("https:");
360
- const maxAgeSecondsFromDays = typeof opts?.maxAgeDays === "number" ? Math.max(0, opts.maxAgeDays * 24 * 60 * 60) : null;
361
- const maxAgeSeconds = typeof opts?.maxAge === "number" ? Math.max(0, opts.maxAge) : maxAgeSecondsFromDays ?? DEFAULT_MAX_AGE_SECONDS;
571
+ 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;
572
+ let secure;
573
+ if (typeof opts?.secure === "boolean") {
574
+ secure = opts.secure;
575
+ } else if (isHttps) {
576
+ secure = true;
577
+ } else {
578
+ secure = DEFAULT_COOKIE_OPTS.secure;
579
+ }
362
580
  return {
363
581
  name: opts?.name ?? DEFAULT_COOKIE_OPTS.name,
364
582
  maxAge: maxAgeSeconds,
365
583
  sameSite: opts?.sameSite ?? DEFAULT_COOKIE_OPTS.sameSite ?? "Lax",
366
- secure: typeof opts?.secure === "boolean" ? opts.secure : isHttps ? true : DEFAULT_COOKIE_OPTS.secure ?? false,
584
+ secure,
367
585
  path: opts?.path ?? DEFAULT_COOKIE_OPTS.path ?? "/",
368
586
  domain: opts?.domain ?? DEFAULT_COOKIE_OPTS.domain ?? void 0
369
587
  };
@@ -371,7 +589,7 @@ function resolveCookieOptions(opts) {
371
589
  var COOKIE_SCHEMA_VERSION = "1.0";
372
590
  function readConsentCookie(name = DEFAULT_COOKIE_OPTS.name) {
373
591
  logger.debug("Reading consent cookie", { name });
374
- if (typeof document === "undefined") {
592
+ if (globalThis.document === void 0) {
375
593
  logger.debug("Cookie read skipped: server-side environment");
376
594
  return null;
377
595
  }
@@ -422,7 +640,7 @@ function migrateLegacyCookie(legacyData) {
422
640
  }
423
641
  }
424
642
  function writeConsentCookie(state, config, opts, source = "banner") {
425
- if (typeof document === "undefined" || typeof window === "undefined" || globalThis.__LGPD_SSR__ === true) {
643
+ if (globalThis.document === void 0 || globalThis.window === void 0 || globalThis.__LGPD_SSR__ === true) {
426
644
  logger.debug("Cookie write skipped: server-side environment");
427
645
  return;
428
646
  }
@@ -471,7 +689,7 @@ function createConsentAuditEntry(state, params) {
471
689
  };
472
690
  }
473
691
  function removeConsentCookie(opts) {
474
- if (typeof document === "undefined") {
692
+ if (globalThis.document === void 0) {
475
693
  logger.debug("Cookie removal skipped: server-side environment");
476
694
  return;
477
695
  }
@@ -482,14 +700,23 @@ function removeConsentCookie(opts) {
482
700
  }
483
701
 
484
702
  // src/utils/dataLayerEvents.ts
485
- var LIBRARY_VERSION = "0.7.1";
703
+ var LIBRARY_VERSION = "0.8.0";
486
704
  function ensureDataLayer() {
487
- var _a;
488
- if (globalThis.window === void 0) return;
489
- (_a = globalThis.window).dataLayer ?? (_a.dataLayer = []);
705
+ const currentWindow = globalThis.window;
706
+ if (!currentWindow) return;
707
+ const currentLayer = currentWindow.dataLayer;
708
+ if (currentLayer == null) {
709
+ currentWindow.dataLayer = [];
710
+ return;
711
+ }
712
+ if (typeof currentLayer.push !== "function") {
713
+ const env = globalThis.process?.env?.NODE_ENV ?? "production";
714
+ if (env !== "production") {
715
+ console.warn("[LGPD-CONSENT] dataLayer presente mas sem push; eventos n\xE3o ser\xE3o registrados.");
716
+ }
717
+ }
490
718
  }
491
719
  function pushConsentInitializedEvent(categories) {
492
- if (globalThis.window === void 0) return;
493
720
  ensureDataLayer();
494
721
  const event = {
495
722
  event: "consent_initialized",
@@ -498,10 +725,12 @@ function pushConsentInitializedEvent(categories) {
498
725
  categories,
499
726
  preferences: categories
500
727
  };
501
- globalThis.window.dataLayer?.push(event);
728
+ const layer = globalThis.window?.dataLayer;
729
+ if (layer && typeof layer.push === "function") {
730
+ layer.push(event);
731
+ }
502
732
  }
503
733
  function pushConsentUpdatedEvent(categories, origin, previousCategories) {
504
- if (globalThis.window === void 0) return;
505
734
  ensureDataLayer();
506
735
  const changedCategories = previousCategories ? Object.keys(categories).filter((key) => categories[key] !== previousCategories[key]) : [];
507
736
  const event = {
@@ -513,7 +742,10 @@ function pushConsentUpdatedEvent(categories, origin, previousCategories) {
513
742
  preferences: categories,
514
743
  changed_categories: changedCategories
515
744
  };
516
- globalThis.window.dataLayer?.push(event);
745
+ const layer = globalThis.window?.dataLayer;
746
+ if (layer && typeof layer.push === "function") {
747
+ layer.push(event);
748
+ }
517
749
  }
518
750
  function useDataLayerEvents() {
519
751
  return {
@@ -843,7 +1075,7 @@ function analyzeDeveloperConfiguration(config) {
843
1075
  const gt = globalThis;
844
1076
  const implied = (gt.__LGPD_REQUIRED_CATEGORIES__ || []).filter(Boolean);
845
1077
  implied.forEach((id) => {
846
- if (!guidance.activeCategoriesInfo.find((c) => c.id === id)) {
1078
+ if (!guidance.activeCategoriesInfo.some((c) => c.id === id)) {
847
1079
  const info = NAMES[id];
848
1080
  if (info) {
849
1081
  guidance.activeCategoriesInfo.push({
@@ -883,6 +1115,27 @@ function analyzeDeveloperConfiguration(config) {
883
1115
  'Apenas cookies necess\xE1rios est\xE3o configurados. Para compliance LGPD, considere adicionar categorias como "analytics" ou "functional" conforme uso real.',
884
1116
  "compliance"
885
1117
  );
1118
+ } else {
1119
+ addMessage(
1120
+ "info",
1121
+ "Cookies n\xE3o necess\xE1rios devem iniciar desativados e exigir consentimento expresso, sem pr\xE9-sele\xE7\xE3o e sem consentimento t\xE1cito.",
1122
+ "consent"
1123
+ );
1124
+ addMessage(
1125
+ "info",
1126
+ "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.",
1127
+ "consent"
1128
+ );
1129
+ addMessage(
1130
+ "info",
1131
+ "Informe finalidades espec\xEDficas, per\xEDodo de reten\xE7\xE3o e compartilhamento com terceiros em pol\xEDtica/aviso de cookies.",
1132
+ "transparency"
1133
+ );
1134
+ addMessage(
1135
+ "info",
1136
+ "Disponibilize mecanismo pr\xF3prio de gerenciamento de cookies; configura\xE7\xF5es do navegador s\xE3o apenas complementares.",
1137
+ "transparency"
1138
+ );
886
1139
  }
887
1140
  if (totalToggleable > 5) {
888
1141
  addMessage(
@@ -907,7 +1160,7 @@ function getComplianceScoreColor(score) {
907
1160
  function logComplianceScore(prefix, score) {
908
1161
  const color = getComplianceScoreColor(score);
909
1162
  console.log(
910
- `%c${prefix} Score de Conformidade LGPD: ${score}/100`,
1163
+ `%c${prefix} Score de Conformidade LGPD (orientativo): ${score}/100`,
911
1164
  `color: ${color}; font-weight: bold; font-size: 14px;`
912
1165
  );
913
1166
  }
@@ -1002,7 +1255,7 @@ function logServerSideIfAvailable(guidance) {
1002
1255
  }
1003
1256
  function logDeveloperGuidance(guidance, disableGuidanceProp, config) {
1004
1257
  const gt = globalThis;
1005
- const nodeEnv = typeof gt.process !== "undefined" ? gt.process?.env?.NODE_ENV : void 0;
1258
+ const nodeEnv = gt.process ? gt.process?.env?.NODE_ENV : void 0;
1006
1259
  const isProd = nodeEnv === "production" || gt.__LGPD_PRODUCTION__ === true;
1007
1260
  if (isProd || disableGuidanceProp) return;
1008
1261
  const guidanceHash = getGuidanceHash(guidance);
@@ -1060,11 +1313,21 @@ function logDeveloperGuidance(guidance, disableGuidanceProp, config) {
1060
1313
  "color: #9c27b0;",
1061
1314
  "color: #7b1fa2;"
1062
1315
  );
1316
+ console.info(
1317
+ `%c${PREFIX}%c Evite consentimento t\xE1cito e op\xE7\xF5es pr\xE9-selecionadas`,
1318
+ "color: #9c27b0;",
1319
+ "color: #7b1fa2;"
1320
+ );
1063
1321
  console.info(
1064
1322
  `%c${PREFIX}%c Documente pol\xEDticas claras por categoria`,
1065
1323
  "color: #9c27b0;",
1066
1324
  "color: #7b1fa2;"
1067
1325
  );
1326
+ console.info(
1327
+ `%c${PREFIX}%c Informe finalidades, reten\xE7\xE3o e revoga\xE7\xE3o simples e gratuita`,
1328
+ "color: #9c27b0;",
1329
+ "color: #7b1fa2;"
1330
+ );
1068
1331
  console.info(
1069
1332
  `%c${PREFIX}%c Registre consentimento com data/hora/origem`,
1070
1333
  "color: #9c27b0;",
@@ -1076,7 +1339,9 @@ function logDeveloperGuidance(guidance, disableGuidanceProp, config) {
1076
1339
  function useDeveloperGuidance(config, disableGuidanceProp, guidanceConfig) {
1077
1340
  const guidance = React4__namespace.default.useMemo(() => analyzeDeveloperConfiguration(config), [config]);
1078
1341
  React4__namespace.default.useEffect(() => {
1079
- if (!disableGuidanceProp) logDeveloperGuidance(guidance, disableGuidanceProp, guidanceConfig);
1342
+ if (globalThis.window !== void 0 && !disableGuidanceProp) {
1343
+ logDeveloperGuidance(guidance, disableGuidanceProp, guidanceConfig);
1344
+ }
1080
1345
  }, [guidance, disableGuidanceProp, guidanceConfig]);
1081
1346
  return guidance;
1082
1347
  }
@@ -1379,28 +1644,30 @@ function getMessages() {
1379
1644
  };
1380
1645
  }
1381
1646
  function detectMultipleReactInstances() {
1382
- if (globalThis.window === void 0) return false;
1647
+ const currentWindow = globalThis.window;
1648
+ if (currentWindow === void 0) return false;
1383
1649
  try {
1384
- const reactSymbols = Object.getOwnPropertySymbols(globalThis.window).map(String).filter((name) => name.includes("react"));
1650
+ const reactSymbols = Object.getOwnPropertySymbols(currentWindow).map(String).filter((name) => name.includes("react"));
1385
1651
  if (reactSymbols.length > 1) {
1386
1652
  return true;
1387
1653
  }
1388
- const ReactModule = window.React;
1654
+ const ReactModule = currentWindow.React;
1389
1655
  if (ReactModule && Array.isArray(ReactModule)) {
1390
1656
  return true;
1391
1657
  }
1392
- const hasMultipleVersions = window.__REACT_DEVTOOLS_GLOBAL_HOOK__?.renderers?.size > 1;
1658
+ const hasMultipleVersions = (currentWindow.__REACT_DEVTOOLS_GLOBAL_HOOK__?.renderers?.size ?? 0) > 1;
1393
1659
  return hasMultipleVersions || false;
1394
1660
  } catch {
1395
1661
  return false;
1396
1662
  }
1397
1663
  }
1398
1664
  function getPackageVersion(packageName) {
1399
- if (globalThis.window === void 0) return null;
1665
+ const currentWindow = globalThis.window;
1666
+ if (currentWindow === void 0) return null;
1400
1667
  try {
1401
- const pkg = window[packageName];
1668
+ const pkg = currentWindow[packageName];
1402
1669
  if (pkg?.version) return pkg.version;
1403
- const React6 = window.React;
1670
+ const React6 = currentWindow.React;
1404
1671
  if (packageName === "react" && React6?.version) {
1405
1672
  return React6.version;
1406
1673
  }
@@ -1424,7 +1691,8 @@ function checkPeerDeps(options = {}) {
1424
1691
  if (skipInProduction && isProduction) {
1425
1692
  return result;
1426
1693
  }
1427
- if (globalThis.window === void 0) {
1694
+ const currentWindow = globalThis.window;
1695
+ if (currentWindow === void 0) {
1428
1696
  return result;
1429
1697
  }
1430
1698
  const messages = getMessages();
@@ -1446,7 +1714,7 @@ function checkPeerDeps(options = {}) {
1446
1714
  }
1447
1715
  }
1448
1716
  }
1449
- const muiVersion = window["@mui/material"]?.version;
1717
+ const muiVersion = currentWindow["@mui/material"]?.version;
1450
1718
  if (muiVersion) {
1451
1719
  if (!isVersionInRange(muiVersion, 5, 7)) {
1452
1720
  result.warnings.push(messages.MUI_OUT_OF_RANGE(muiVersion));
@@ -1468,14 +1736,88 @@ function runPeerDepsCheck() {
1468
1736
 
1469
1737
  // src/utils/validation.ts
1470
1738
  var isDev = () => typeof process !== "undefined" && process.env.NODE_ENV !== "production";
1739
+ var sanitizeCategories = (categories) => {
1740
+ const enabled = [...new Set(categories.enabledCategories ?? [])];
1741
+ const sanitizedEnabled = enabled.filter((c) => c !== "necessary");
1742
+ return {
1743
+ enabled,
1744
+ sanitizedEnabled,
1745
+ custom: categories.customCategories ?? []
1746
+ };
1747
+ };
1748
+ var collectZodIssues = (z, categories, issues) => {
1749
+ if (!z || !categories) return;
1750
+ const CustomCategorySchema = z.object({
1751
+ id: z.string().min(1, "customCategories[].id deve ser uma string n\xE3o vazia"),
1752
+ name: z.string().min(1, "customCategories[].name deve ser uma string n\xE3o vazia"),
1753
+ description: z.string().min(1, "customCategories[].description deve ser uma string n\xE3o vazia"),
1754
+ essential: z.boolean().optional(),
1755
+ cookies: z.array(z.string().min(1)).optional()
1756
+ });
1757
+ const ProjectCategoriesConfigSchema = z.object({
1758
+ enabledCategories: z.array(z.string().min(1)).optional(),
1759
+ customCategories: z.array(CustomCategorySchema).optional()
1760
+ }).strict();
1761
+ const res = ProjectCategoriesConfigSchema.safeParse(categories);
1762
+ if (!res.success) {
1763
+ res.error.issues.forEach(
1764
+ (issue) => issues.push({ path: `categories.${issue.path.join(".")}`, message: issue.message })
1765
+ );
1766
+ }
1767
+ const customParse = z.array(CustomCategorySchema).safeParse(categories.customCategories ?? []);
1768
+ if (!customParse.success) {
1769
+ customParse.error.issues.forEach(
1770
+ (issue) => issues.push({ path: `customCategories.${issue.path.join(".")}`, message: issue.message })
1771
+ );
1772
+ }
1773
+ };
1774
+ var collectCategoryWarnings = (input) => {
1775
+ const warnings = [];
1776
+ const { enabled, sanitizedEnabled, custom } = input;
1777
+ if (enabled.includes("necessary")) {
1778
+ warnings.push("'necessary' \xE9 sempre inclu\xEDda automaticamente \u2014 remova de enabledCategories.");
1779
+ }
1780
+ const invalidEnabled = sanitizedEnabled.filter((c) => typeof c !== "string" || c.trim() === "");
1781
+ if (invalidEnabled.length > 0) {
1782
+ warnings.push(
1783
+ `enabledCategories cont\xE9m valores inv\xE1lidos: ${invalidEnabled.map(String).join(", ")} \u2014 remova ou corrija os IDs de categoria`
1784
+ );
1785
+ }
1786
+ const ids = /* @__PURE__ */ new Set();
1787
+ const dupes = [];
1788
+ ["necessary", ...sanitizedEnabled].forEach((id) => {
1789
+ if (ids.has(id)) dupes.push(id);
1790
+ ids.add(id);
1791
+ });
1792
+ custom?.forEach((c) => {
1793
+ if (ids.has(c.id)) dupes.push(c.id);
1794
+ ids.add(c.id);
1795
+ });
1796
+ if (dupes.length > 0) {
1797
+ warnings.push(
1798
+ `IDs de categoria duplicados detectados: ${Array.from(new Set(dupes)).join(
1799
+ ", "
1800
+ )} \u2014 verifique 'enabledCategories' e 'customCategories'.`
1801
+ );
1802
+ }
1803
+ return warnings;
1804
+ };
1805
+ var reportValidationMessages = (warnings, errors, issues) => {
1806
+ if (warnings.length > 0) {
1807
+ logger.warn("Valida\xE7\xE3o do ConsentProvider:", ...warnings);
1808
+ }
1809
+ if (errors.length > 0 || issues.length > 0) {
1810
+ issues.forEach((i) => errors.push(`Prop inv\xE1lida: ${i.path} \u2014 ${i.message}`));
1811
+ logger.error("Erros de configura\xE7\xE3o do ConsentProvider:", ...errors);
1812
+ }
1813
+ };
1471
1814
  function validateConsentProviderProps(props) {
1472
1815
  const warnings = [];
1473
1816
  const errors = [];
1474
1817
  const sanitized = {};
1475
1818
  if (!isDev()) {
1476
1819
  if (props.categories) {
1477
- const enabled = [...new Set(props.categories.enabledCategories ?? [])];
1478
- const sanitizedEnabled = enabled.filter((c) => c !== "necessary");
1820
+ const { sanitizedEnabled } = sanitizeCategories(props.categories);
1479
1821
  sanitized.categories = {
1480
1822
  enabledCategories: sanitizedEnabled,
1481
1823
  customCategories: props.categories.customCategories
@@ -1490,96 +1832,30 @@ function validateConsentProviderProps(props) {
1490
1832
  z = void 0;
1491
1833
  }
1492
1834
  const issues = [];
1493
- if (z) {
1494
- const CustomCategorySchema = z.object({
1495
- id: z.string().min(1, "customCategories[].id deve ser uma string n\xE3o vazia"),
1496
- name: z.string().min(1, "customCategories[].name deve ser uma string n\xE3o vazia"),
1497
- description: z.string().min(1, "customCategories[].description deve ser uma string n\xE3o vazia"),
1498
- essential: z.boolean().optional(),
1499
- cookies: z.array(z.string().min(1)).optional()
1500
- });
1501
- const ProjectCategoriesConfigSchema = z.object({
1502
- enabledCategories: z.array(z.string().min(1)).optional(),
1503
- customCategories: z.array(CustomCategorySchema).optional()
1504
- }).strict();
1505
- const res = ProjectCategoriesConfigSchema.safeParse(props.categories);
1506
- if (!res.success) {
1507
- res.error.issues.forEach(
1508
- (issue) => issues.push({ path: `categories.${issue.path.join(".")}`, message: issue.message })
1509
- );
1510
- }
1511
- }
1512
- if (!props.categories) {
1513
- warnings.push(
1514
- "Prop 'categories' n\xE3o fornecida \u2014 o ConsentProvider requer configura\xE7\xE3o de categorias."
1515
- );
1516
- } else {
1517
- const cat = props.categories;
1518
- const enabled = [...new Set(cat.enabledCategories ?? [])];
1519
- if (enabled.includes("necessary")) {
1520
- warnings.push("'necessary' \xE9 sempre inclu\xEDda automaticamente \u2014 remova de enabledCategories.");
1521
- }
1522
- const sanitizedEnabled = enabled.filter((c) => c !== "necessary");
1523
- const invalidEnabled = sanitizedEnabled.filter((c) => typeof c !== "string" || c.trim() === "");
1524
- if (invalidEnabled.length > 0) {
1525
- warnings.push(
1526
- `enabledCategories cont\xE9m valores inv\xE1lidos: ${invalidEnabled.map(String).join(", ")} \u2014 remova ou corrija os IDs de categoria`
1527
- );
1528
- }
1529
- const custom = cat.customCategories ?? [];
1530
- if (z) {
1531
- const CustomCategorySchema = z.object({
1532
- id: z.string().min(1),
1533
- name: z.string().min(1),
1534
- description: z.string().min(1),
1535
- essential: z.boolean().optional(),
1536
- cookies: z.array(z.string().min(1)).optional()
1537
- });
1538
- const customParse = z.array(CustomCategorySchema).safeParse(custom);
1539
- if (!customParse.success) {
1540
- customParse.error.issues.forEach(
1541
- (issue) => issues.push({ path: `customCategories.${issue.path.join(".")}`, message: issue.message })
1542
- );
1543
- }
1544
- }
1545
- const ids = /* @__PURE__ */ new Set();
1546
- const dupes = [];
1547
- ["necessary", ...sanitizedEnabled].forEach((id) => {
1548
- if (ids.has(id)) dupes.push(id);
1549
- ids.add(id);
1550
- });
1551
- custom.forEach((c) => {
1552
- if (ids.has(c.id)) dupes.push(c.id);
1553
- ids.add(c.id);
1554
- });
1555
- if (dupes.length > 0) {
1556
- warnings.push(
1557
- `IDs de categoria duplicados detectados: ${Array.from(new Set(dupes)).join(
1558
- ", "
1559
- )} \u2014 verifique 'enabledCategories' e 'customCategories'.`
1560
- );
1561
- }
1835
+ collectZodIssues(z, props.categories, issues);
1836
+ if (props.categories) {
1837
+ const { enabled, sanitizedEnabled, custom } = sanitizeCategories(props.categories);
1838
+ warnings.push(...collectCategoryWarnings({ enabled, sanitizedEnabled, custom }));
1562
1839
  sanitized.categories = {
1563
1840
  enabledCategories: sanitizedEnabled,
1564
1841
  customCategories: custom
1565
1842
  };
1843
+ } else {
1844
+ warnings.push(
1845
+ "Prop 'categories' n\xE3o fornecida \u2014 o ConsentProvider requer configura\xE7\xE3o de categorias."
1846
+ );
1566
1847
  }
1567
- if (warnings.length > 0) {
1568
- logger.warn("Valida\xE7\xE3o do ConsentProvider:", ...warnings);
1569
- }
1570
- if (errors.length > 0 || issues.length > 0) {
1571
- issues.forEach((i) => errors.push(`Prop inv\xE1lida: ${i.path} \u2014 ${i.message}`));
1572
- logger.error("Erros de configura\xE7\xE3o do ConsentProvider:", ...errors);
1573
- }
1848
+ reportValidationMessages(warnings, errors, issues);
1574
1849
  return { sanitized, warnings, errors };
1575
1850
  }
1576
1851
 
1577
1852
  // src/utils/cookieDiscovery.ts
1578
1853
  function discoverRuntimeCookies() {
1579
- if (typeof document === "undefined" || !document.cookie) return [];
1854
+ const currentDocument = globalThis.document;
1855
+ if (!currentDocument?.cookie) return [];
1580
1856
  const names = Array.from(
1581
1857
  new Set(
1582
- document.cookie.split(";").map((s) => s.trim()).filter(Boolean).map((s) => s.split("=")[0])
1858
+ currentDocument.cookie.split(";").map((s) => s.trim()).filter(Boolean).map((s) => s.split("=")[0])
1583
1859
  )
1584
1860
  );
1585
1861
  const list = names.map((name) => ({ name }));
@@ -1590,27 +1866,34 @@ function discoverRuntimeCookies() {
1590
1866
  }
1591
1867
  return list;
1592
1868
  }
1869
+ function tryDecode(val) {
1870
+ try {
1871
+ return decodeURIComponent(val);
1872
+ } catch {
1873
+ return val;
1874
+ }
1875
+ }
1876
+ function isConsentJson(val) {
1877
+ if (!val.startsWith("{")) return false;
1878
+ try {
1879
+ const obj = JSON.parse(val);
1880
+ return obj && typeof obj === "object" && "preferences" in obj && "version" in obj;
1881
+ } catch {
1882
+ return false;
1883
+ }
1884
+ }
1593
1885
  function detectConsentCookieName() {
1594
- if (typeof document === "undefined" || !document.cookie) return null;
1886
+ const currentDocument = globalThis.document;
1887
+ if (!currentDocument?.cookie) return null;
1595
1888
  try {
1596
- const pairs = document.cookie.split(";").map((s) => s.trim()).filter(Boolean);
1889
+ const pairs = currentDocument.cookie.split(";").map((s) => s.trim()).filter(Boolean);
1597
1890
  for (const p of pairs) {
1598
1891
  const [name, ...rest] = p.split("=");
1599
1892
  const raw = rest.join("=");
1600
1893
  if (!raw) continue;
1601
- let val = raw;
1602
- try {
1603
- val = decodeURIComponent(raw);
1604
- } catch {
1605
- }
1606
- if (val.startsWith("{")) {
1607
- try {
1608
- const obj = JSON.parse(val);
1609
- if (obj && typeof obj === "object" && "preferences" in obj && "version" in obj) {
1610
- return name;
1611
- }
1612
- } catch {
1613
- }
1894
+ const val = tryDecode(raw);
1895
+ if (isConsentJson(val)) {
1896
+ return name;
1614
1897
  }
1615
1898
  }
1616
1899
  } catch {
@@ -1652,15 +1935,6 @@ function CategoriesProvider({
1652
1935
  disableDiscoveryLog
1653
1936
  }) {
1654
1937
  const [impliedVersion, setImpliedVersion] = React4__namespace.useState(0);
1655
- React4__namespace.useEffect(() => {
1656
- const handler = () => setImpliedVersion((v) => v + 1);
1657
- if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
1658
- window.addEventListener("lgpd:requiredCategories", handler);
1659
- return () => window.removeEventListener("lgpd:requiredCategories", handler);
1660
- }
1661
- return () => {
1662
- };
1663
- }, []);
1664
1938
  const contextValue = React4__namespace.useMemo(() => {
1665
1939
  const finalConfig = config || DEFAULT_PROJECT_CATEGORIES;
1666
1940
  const guidance = analyzeDeveloperConfiguration(config);
@@ -1672,35 +1946,47 @@ function CategoriesProvider({
1672
1946
  allCategories: guidance.activeCategoriesInfo
1673
1947
  };
1674
1948
  }, [config, impliedVersion]);
1949
+ React4__namespace.useEffect(() => {
1950
+ const currentWindow = globalThis.window;
1951
+ if (!currentWindow || typeof currentWindow.addEventListener !== "function") return;
1952
+ const handler = () => {
1953
+ setImpliedVersion((current) => current + 1);
1954
+ };
1955
+ currentWindow.addEventListener("lgpd:requiredCategories", handler);
1956
+ return () => {
1957
+ currentWindow.removeEventListener("lgpd:requiredCategories", handler);
1958
+ };
1959
+ }, []);
1675
1960
  React4__namespace.useEffect(() => {
1676
1961
  logDeveloperGuidance(contextValue.guidance, disableDeveloperGuidance);
1677
1962
  }, [contextValue.guidance, disableDeveloperGuidance]);
1678
1963
  React4__namespace.useEffect(() => {
1679
1964
  try {
1680
1965
  const gt = globalThis;
1681
- const env = typeof gt.process !== "undefined" ? gt.process?.env?.NODE_ENV : void 0;
1966
+ const env = gt.process?.env?.NODE_ENV;
1682
1967
  const isDev2 = env === "development";
1683
- if (!isDev2 || gt.__LGPD_DISCOVERY_LOGGED__ === true || disableDiscoveryLog) return;
1684
- const discovered = discoverRuntimeCookies();
1685
- const consentName = detectConsentCookieName() || DEFAULT_COOKIE_OPTS.name;
1686
- const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
1687
- if (typeof console !== "undefined") {
1688
- try {
1689
- console.group(`${PREFIX} \u{1F50E} Descoberta de cookies (experimental)`);
1690
- const names = Array.from(
1691
- new Set([consentName, ...discovered.map((d) => d.name)].filter(Boolean))
1692
- );
1693
- const rows = names.map((n) => ({ Cookie: n }));
1694
- if (typeof console.table === "function") console.table(rows);
1695
- else console.log(rows);
1696
- console.info(
1697
- `${PREFIX} \u2139\uFE0F Estes nomes s\xE3o detectados em tempo de execu\xE7\xE3o. Ajuste ou categorize via APIs de override se necess\xE1rio.`
1698
- );
1699
- console.groupEnd();
1700
- } catch {
1968
+ if (isDev2 && gt.__LGPD_DISCOVERY_LOGGED__ !== true && !disableDiscoveryLog) {
1969
+ const discovered = discoverRuntimeCookies();
1970
+ const consentName = detectConsentCookieName() || DEFAULT_COOKIE_OPTS.name;
1971
+ const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
1972
+ if (typeof console !== "undefined") {
1973
+ try {
1974
+ console.group(`${PREFIX} \u{1F50E} Descoberta de cookies (experimental)`);
1975
+ const names = Array.from(
1976
+ new Set([consentName, ...discovered.map((d) => d.name)].filter(Boolean))
1977
+ );
1978
+ const rows = names.map((n) => ({ Cookie: n }));
1979
+ if (typeof console.table === "function") console.table(rows);
1980
+ else console.log(rows);
1981
+ console.info(
1982
+ `${PREFIX} \u2139\uFE0F Estes nomes s\xE3o detectados em tempo de execu\xE7\xE3o. Ajuste ou categorize via APIs de override se necess\xE1rio.`
1983
+ );
1984
+ console.groupEnd();
1985
+ } catch {
1986
+ }
1701
1987
  }
1988
+ gt.__LGPD_DISCOVERY_LOGGED__ = true;
1702
1989
  }
1703
- gt.__LGPD_DISCOVERY_LOGGED__ = true;
1704
1990
  } catch {
1705
1991
  }
1706
1992
  }, [disableDiscoveryLog]);
@@ -1750,21 +2036,21 @@ function createFullConsentState(consented, preferences, source, projectConfig, i
1750
2036
  isModalOpen
1751
2037
  };
1752
2038
  }
1753
- var DEFAULT_TEXTS = {
2039
+ var BASE_TEXTS = {
1754
2040
  // Textos básicos
1755
- bannerMessage: "Utilizamos cookies para melhorar sua experi\xEAncia.",
2041
+ 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.",
1756
2042
  acceptAll: "Aceitar todos",
1757
- declineAll: "Recusar",
2043
+ declineAll: "Rejeitar opcionais",
1758
2044
  preferences: "Prefer\xEAncias",
1759
- policyLink: "Saiba mais",
1760
- modalTitle: "Prefer\xEAncias de Cookies",
1761
- modalIntro: "Ajuste as categorias de cookies. Cookies necess\xE1rios s\xE3o sempre utilizados para funcionalidades b\xE1sicas.",
2045
+ policyLink: "Pol\xEDtica de privacidade",
2046
+ modalTitle: "Prefer\xEAncias de cookies",
2047
+ 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.",
1762
2048
  save: "Salvar prefer\xEAncias",
1763
2049
  necessaryAlwaysOn: "Cookies necess\xE1rios (sempre ativos)",
1764
2050
  // Textos adicionais para UI customizada
1765
- preferencesButton: "Configurar Cookies",
1766
- preferencesTitle: "Gerenciar Prefer\xEAncias de Cookies",
1767
- preferencesDescription: "Escolha quais tipos de cookies voc\xEA permite que sejam utilizados.",
2051
+ preferencesButton: "Gerenciar cookies",
2052
+ preferencesTitle: "Gerenciar prefer\xEAncias de cookies",
2053
+ preferencesDescription: "Escolha quais categorias opcionais voc\xEA permite. Cookies necess\xE1rios permanecem sempre ativos.",
1768
2054
  close: "Fechar",
1769
2055
  accept: "Aceitar",
1770
2056
  reject: "Rejeitar",
@@ -1787,6 +2073,10 @@ var DEFAULT_TEXTS = {
1787
2073
  transferCountries: void 0
1788
2074
  // Exibido se definido
1789
2075
  };
2076
+ var DEFAULT_TEXTS = {
2077
+ ...BASE_TEXTS,
2078
+ ...EXPANDED_DEFAULT_TEXTS
2079
+ };
1790
2080
  function reducer(state, action) {
1791
2081
  logger.consentState(action.type, state);
1792
2082
  switch (action.type) {
@@ -1870,6 +2160,8 @@ function ConsentProvider({
1870
2160
  initialState,
1871
2161
  categories,
1872
2162
  texts: textsProp,
2163
+ language,
2164
+ textVariant,
1873
2165
  designTokens,
1874
2166
  PreferencesModalComponent,
1875
2167
  preferencesModalProps = {},
@@ -1879,6 +2171,7 @@ function ConsentProvider({
1879
2171
  floatingPreferencesButtonProps = {},
1880
2172
  disableFloatingPreferencesButton = false,
1881
2173
  blocking = false,
2174
+ blockingMode = "soft",
1882
2175
  blockingStrategy = "auto",
1883
2176
  hideBranding: _hideBranding = false,
1884
2177
  onConsentGiven,
@@ -1894,7 +2187,11 @@ function ConsentProvider({
1894
2187
  onConsentChange,
1895
2188
  onAuditLog
1896
2189
  }) {
1897
- const texts = React4__namespace.useMemo(() => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }), [textsProp]);
2190
+ const mergedTexts = React4__namespace.useMemo(() => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }), [textsProp]);
2191
+ const texts = React4__namespace.useMemo(
2192
+ () => resolveTexts(mergedTexts, { language, variant: textVariant }),
2193
+ [mergedTexts, language, textVariant]
2194
+ );
1898
2195
  const cookie = React4__namespace.useMemo(() => {
1899
2196
  const base = { ...DEFAULT_COOKIE_OPTS, ...cookieOpts ?? {} };
1900
2197
  base.name = cookieOpts?.name ?? buildConsentStorageKey({
@@ -2152,6 +2449,7 @@ function ConsentProvider({
2152
2449
  hideBranding: incoming.hideBranding === void 0 ? _hideBranding : Boolean(incoming.hideBranding)
2153
2450
  };
2154
2451
  }, [cookieBannerProps, blocking, _hideBranding]);
2452
+ const hardBlockingActive = blocking && isHydrated && !state.consented && blockingMode === "hard";
2155
2453
  const content = /* @__PURE__ */ jsxRuntime.jsx(StateCtx.Provider, { value: state, children: /* @__PURE__ */ jsxRuntime.jsx(ActionsCtx.Provider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(TextsCtx.Provider, { value: texts, children: /* @__PURE__ */ jsxRuntime.jsx(HydrationCtx.Provider, { value: isHydrated, children: /* @__PURE__ */ jsxRuntime.jsx(DesignProvider, { tokens: designTokens, children: /* @__PURE__ */ jsxRuntime.jsxs(
2156
2454
  CategoriesProvider,
2157
2455
  {
@@ -2159,7 +2457,16 @@ function ConsentProvider({
2159
2457
  disableDeveloperGuidance,
2160
2458
  disableDiscoveryLog,
2161
2459
  children: [
2162
- children,
2460
+ /* @__PURE__ */ jsxRuntime.jsx(
2461
+ "div",
2462
+ {
2463
+ "data-testid": "lgpd-app-content",
2464
+ "aria-hidden": hardBlockingActive ? true : void 0,
2465
+ inert: hardBlockingActive,
2466
+ style: { display: "contents" },
2467
+ children
2468
+ }
2469
+ ),
2163
2470
  PreferencesModalComponent ? /* @__PURE__ */ jsxRuntime.jsx(
2164
2471
  PreferencesModalComponent,
2165
2472
  {
@@ -2311,8 +2618,9 @@ function hasCategoryConsent(snapshot, category) {
2311
2618
  return Boolean(snapshot.preferences?.[category]);
2312
2619
  }
2313
2620
  function loadScript(id, src, category = null, attrs = {}, nonce, options) {
2314
- if (typeof document === "undefined") return Promise.resolve();
2315
- if (document.getElementById(id)) return Promise.resolve();
2621
+ const currentDocument = globalThis.document;
2622
+ if (!src || currentDocument === void 0) return Promise.resolve();
2623
+ if (currentDocument.getElementById(id)) return Promise.resolve();
2316
2624
  const existingPromise = LOADING_SCRIPTS.get(id);
2317
2625
  if (existingPromise) return existingPromise;
2318
2626
  const pollInterval = options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL;
@@ -2320,7 +2628,7 @@ function loadScript(id, src, category = null, attrs = {}, nonce, options) {
2320
2628
  const mergedAttrs = { ...attrs };
2321
2629
  const promise = new Promise((resolve, reject) => {
2322
2630
  const inject = () => {
2323
- const s = document.createElement("script");
2631
+ const s = currentDocument.createElement("script");
2324
2632
  s.id = id;
2325
2633
  s.src = src;
2326
2634
  s.async = mergedAttrs.async !== "false";
@@ -2338,7 +2646,7 @@ function loadScript(id, src, category = null, attrs = {}, nonce, options) {
2338
2646
  LOADING_SCRIPTS.delete(id);
2339
2647
  reject(new Error(`Failed to load script: ${src}`));
2340
2648
  };
2341
- document.body.appendChild(s);
2649
+ currentDocument.body.appendChild(s);
2342
2650
  };
2343
2651
  const snapshot = options?.consentSnapshot;
2344
2652
  const skipChecks = options?.skipConsentCheck === true;
@@ -2826,6 +3134,31 @@ function useConsentScriptLoader() {
2826
3134
  }
2827
3135
 
2828
3136
  // src/utils/scriptIntegrations.ts
3137
+ function createSuggestedIntegration(config) {
3138
+ const suggested = suggestCategoryForScript(config.id)[0] ?? "analytics";
3139
+ const category = resolveCategory(suggested, config.category);
3140
+ const { category: _ignored, ...rest } = config;
3141
+ return { ...rest, category };
3142
+ }
3143
+ var resolveCategory = (fallback, override) => {
3144
+ if (typeof override === "string" && override.trim().length > 0) return override.trim();
3145
+ return fallback;
3146
+ };
3147
+ var isDevEnv = () => {
3148
+ const env = typeof globalThis !== "undefined" ? globalThis.process?.env?.NODE_ENV : void 0;
3149
+ return env !== "production";
3150
+ };
3151
+ var resolveRequiredString = (value, field, integrationId) => {
3152
+ if (typeof value !== "string" || value.trim().length === 0) {
3153
+ if (isDevEnv()) {
3154
+ console.error(
3155
+ `[LGPD-CONSENT] Config inv\xE1lida: integra\xE7\xE3o "${integrationId}" requer "${field}".`
3156
+ );
3157
+ }
3158
+ return null;
3159
+ }
3160
+ return value.trim();
3161
+ };
2829
3162
  function buildConsentModeSignals(preferences) {
2830
3163
  const analytics = preferences.analytics ? "granted" : "denied";
2831
3164
  const marketing = preferences.marketing ? "granted" : "denied";
@@ -2837,16 +3170,18 @@ function buildConsentModeSignals(preferences) {
2837
3170
  };
2838
3171
  }
2839
3172
  function pushToLayer(entry, dataLayerName) {
2840
- if (typeof globalThis.window === "undefined") return;
2841
- const registry = globalThis.window;
3173
+ const currentWindow = globalThis.window;
3174
+ if (currentWindow === void 0) return;
3175
+ const registry = currentWindow;
2842
3176
  const name = dataLayerName ?? "dataLayer";
2843
3177
  const layer = registry[name] ?? [];
2844
3178
  registry[name] = layer;
2845
3179
  layer.push(entry);
2846
3180
  }
2847
3181
  function ensureGtag(dataLayerName = "dataLayer") {
2848
- if (typeof globalThis.window === "undefined") return null;
2849
- const w = window;
3182
+ const currentWindow = globalThis.window;
3183
+ if (currentWindow === void 0) return null;
3184
+ const w = currentWindow;
2850
3185
  const registry = w;
2851
3186
  const layer = registry[dataLayerName] ?? [];
2852
3187
  registry[dataLayerName] = layer;
@@ -2878,10 +3213,45 @@ function applyConsentModeUpdate(preferences, dataLayerName) {
2878
3213
  pushToLayer(["consent", "update", payload], dataLayerName);
2879
3214
  }
2880
3215
  function createGoogleAnalyticsIntegration(config) {
2881
- const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtag/js?id=${config.measurementId}`;
3216
+ const category = resolveCategory("analytics", config.category);
3217
+ const measurementId = resolveRequiredString(
3218
+ config.measurementId,
3219
+ "measurementId",
3220
+ "google-analytics"
3221
+ );
3222
+ if (!measurementId) {
3223
+ return {
3224
+ id: "google-analytics",
3225
+ category,
3226
+ src: "",
3227
+ cookies: ["_ga", "_ga_*", "_gid"],
3228
+ cookiesInfo: [
3229
+ {
3230
+ name: "_ga",
3231
+ purpose: "Identifica\xE7\xE3o \xFAnica de visitantes para an\xE1lise de tr\xE1fego",
3232
+ duration: "2 anos",
3233
+ provider: "Google Analytics"
3234
+ },
3235
+ {
3236
+ name: "_ga_*",
3237
+ purpose: "Rastreamento de sess\xF5es e eventos espec\xEDficos do stream GA4",
3238
+ duration: "2 anos",
3239
+ provider: "Google Analytics"
3240
+ },
3241
+ {
3242
+ name: "_gid",
3243
+ purpose: "Distin\xE7\xE3o de visitantes \xFAnicos em per\xEDodo de 24h",
3244
+ duration: "24 horas",
3245
+ provider: "Google Analytics"
3246
+ }
3247
+ ],
3248
+ attrs: { async: "true" }
3249
+ };
3250
+ }
3251
+ const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtag/js?id=${measurementId}`;
2882
3252
  return {
2883
3253
  id: "google-analytics",
2884
- category: "analytics",
3254
+ category,
2885
3255
  src,
2886
3256
  cookies: ["_ga", "_ga_*", "_gid"],
2887
3257
  cookiesInfo: [
@@ -2914,16 +3284,26 @@ function createGoogleAnalyticsIntegration(config) {
2914
3284
  const gtag = ensureGtag();
2915
3285
  if (!gtag) return;
2916
3286
  gtag("js", /* @__PURE__ */ new Date());
2917
- gtag("config", config.measurementId, config.config ?? {});
3287
+ gtag("config", measurementId, config.config ?? {});
2918
3288
  },
2919
3289
  attrs: { async: "true" }
2920
3290
  };
2921
3291
  }
2922
3292
  function createGoogleTagManagerIntegration(config) {
2923
- const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtm.js?id=${config.containerId}`;
3293
+ const category = resolveCategory("analytics", config.category);
3294
+ const containerId = resolveRequiredString(config.containerId, "containerId", "google-tag-manager");
3295
+ if (!containerId) {
3296
+ return {
3297
+ id: "google-tag-manager",
3298
+ category,
3299
+ src: "",
3300
+ cookies: ["_gcl_au"]
3301
+ };
3302
+ }
3303
+ const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtm.js?id=${containerId}`;
2924
3304
  return {
2925
3305
  id: "google-tag-manager",
2926
- category: "analytics",
3306
+ category,
2927
3307
  src,
2928
3308
  cookies: ["_gcl_au"],
2929
3309
  bootstrap: () => {
@@ -2933,9 +3313,10 @@ function createGoogleTagManagerIntegration(config) {
2933
3313
  applyConsentModeUpdate(preferences, config.dataLayerName);
2934
3314
  },
2935
3315
  init: () => {
2936
- if (globalThis.window !== void 0) {
3316
+ const currentWindow = globalThis.window;
3317
+ if (currentWindow !== void 0) {
2937
3318
  const dataLayerName = config.dataLayerName || "dataLayer";
2938
- const w = window;
3319
+ const w = currentWindow;
2939
3320
  const layer = w[dataLayerName] ?? [];
2940
3321
  w[dataLayerName] = layer;
2941
3322
  layer.push({ "gtm.start": Date.now(), event: "gtm.js" });
@@ -2944,20 +3325,31 @@ function createGoogleTagManagerIntegration(config) {
2944
3325
  };
2945
3326
  }
2946
3327
  function createUserWayIntegration(config) {
3328
+ const category = resolveCategory("functional", config.category);
3329
+ const accountId = resolveRequiredString(config.accountId, "accountId", "userway");
3330
+ if (!accountId) {
3331
+ return {
3332
+ id: "userway",
3333
+ category,
3334
+ src: "",
3335
+ cookies: ["_userway_*"]
3336
+ };
3337
+ }
2947
3338
  const src = config.scriptUrl ?? "https://cdn.userway.org/widget.js";
2948
3339
  return {
2949
3340
  id: "userway",
2950
- category: "functional",
3341
+ category,
2951
3342
  src,
2952
3343
  cookies: ["_userway_*"],
2953
3344
  init: () => {
2954
- if (globalThis.window !== void 0) {
2955
- const w = window;
3345
+ const currentWindow = globalThis.window;
3346
+ if (currentWindow !== void 0) {
3347
+ const w = currentWindow;
2956
3348
  w.UserWayWidgetApp = w.UserWayWidgetApp || {};
2957
- w.UserWayWidgetApp.accountId = config.accountId;
3349
+ w.UserWayWidgetApp.accountId = accountId;
2958
3350
  }
2959
3351
  },
2960
- attrs: { "data-account": config.accountId }
3352
+ attrs: { "data-account": accountId }
2961
3353
  };
2962
3354
  }
2963
3355
  var COMMON_INTEGRATIONS = {
@@ -2966,15 +3358,26 @@ var COMMON_INTEGRATIONS = {
2966
3358
  userway: createUserWayIntegration
2967
3359
  };
2968
3360
  function createFacebookPixelIntegration(config) {
3361
+ const category = resolveCategory("marketing", config.category);
3362
+ const pixelId = resolveRequiredString(config.pixelId, "pixelId", "facebook-pixel");
3363
+ if (!pixelId) {
3364
+ return {
3365
+ id: "facebook-pixel",
3366
+ category,
3367
+ src: "",
3368
+ cookies: ["_fbp", "fr"]
3369
+ };
3370
+ }
2969
3371
  const src = config.scriptUrl ?? "https://connect.facebook.net/en_US/fbevents.js";
2970
3372
  return {
2971
3373
  id: "facebook-pixel",
2972
- category: "marketing",
3374
+ category,
2973
3375
  src,
2974
3376
  cookies: ["_fbp", "fr"],
2975
3377
  init: () => {
2976
- if (globalThis.window !== void 0) {
2977
- const w = window;
3378
+ const currentWindow = globalThis.window;
3379
+ if (currentWindow !== void 0) {
3380
+ const w = currentWindow;
2978
3381
  if (!w.fbq) {
2979
3382
  const fbq = (...args) => {
2980
3383
  if (w.fbq && typeof w.fbq.callMethod === "function") {
@@ -2987,18 +3390,34 @@ function createFacebookPixelIntegration(config) {
2987
3390
  fbq.loaded = true;
2988
3391
  w.fbq = fbq;
2989
3392
  }
2990
- w.fbq("init", config.pixelId, config.advancedMatching ?? {});
3393
+ w.fbq("init", pixelId, config.advancedMatching ?? {});
2991
3394
  if (config.autoTrack !== false) w.fbq("track", "PageView");
2992
3395
  }
2993
3396
  }
2994
3397
  };
2995
3398
  }
2996
3399
  function createHotjarIntegration(config) {
3400
+ const category = resolveCategory("analytics", config.category);
3401
+ const siteId = resolveRequiredString(config.siteId, "siteId", "hotjar");
2997
3402
  const v = config.version ?? 6;
2998
- const src = config.scriptUrl ?? `https://static.hotjar.com/c/hotjar-${config.siteId}.js?sv=${v}`;
3403
+ if (!siteId) {
3404
+ return {
3405
+ id: "hotjar",
3406
+ category,
3407
+ src: "",
3408
+ cookies: [
3409
+ "_hjSession_*",
3410
+ "_hjSessionUser_*",
3411
+ "_hjFirstSeen",
3412
+ "_hjIncludedInSessionSample",
3413
+ "_hjAbsoluteSessionInProgress"
3414
+ ]
3415
+ };
3416
+ }
3417
+ const src = config.scriptUrl ?? `https://static.hotjar.com/c/hotjar-${siteId}.js?sv=${v}`;
2999
3418
  return {
3000
3419
  id: "hotjar",
3001
- category: "analytics",
3420
+ category,
3002
3421
  src,
3003
3422
  cookies: [
3004
3423
  "_hjSession_*",
@@ -3040,9 +3459,10 @@ function createHotjarIntegration(config) {
3040
3459
  }
3041
3460
  ],
3042
3461
  init: () => {
3043
- if (globalThis.window !== void 0) {
3044
- const w = window;
3045
- w._hjSettings = { hjid: config.siteId, hjsv: v };
3462
+ const currentWindow = globalThis.window;
3463
+ if (currentWindow !== void 0) {
3464
+ const w = currentWindow;
3465
+ w._hjSettings = { hjid: siteId, hjsv: v };
3046
3466
  if (!w.hj) {
3047
3467
  const hj = (...args) => {
3048
3468
  hj.q = hj.q || [];
@@ -3051,17 +3471,35 @@ function createHotjarIntegration(config) {
3051
3471
  w.hj = hj;
3052
3472
  }
3053
3473
  if (config.debug && typeof console !== "undefined" && typeof console.info === "function") {
3054
- console.info("[Hotjar] initialized with siteId", config.siteId);
3474
+ console.info("[Hotjar] initialized with siteId", siteId);
3055
3475
  }
3056
3476
  }
3057
3477
  }
3058
3478
  };
3059
3479
  }
3060
3480
  function createMixpanelIntegration(config) {
3481
+ const category = resolveCategory("analytics", config.category);
3482
+ const token = resolveRequiredString(config.token, "token", "mixpanel");
3483
+ if (!token) {
3484
+ return {
3485
+ id: "mixpanel",
3486
+ category,
3487
+ src: "",
3488
+ cookies: ["mp_*"],
3489
+ cookiesInfo: [
3490
+ {
3491
+ name: "mp_*",
3492
+ purpose: "Rastreamento de eventos e propriedades do usu\xE1rio para analytics",
3493
+ duration: "1 ano",
3494
+ provider: "Mixpanel"
3495
+ }
3496
+ ]
3497
+ };
3498
+ }
3061
3499
  const src = config.scriptUrl ?? "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";
3062
3500
  return {
3063
3501
  id: "mixpanel",
3064
- category: "analytics",
3502
+ category,
3065
3503
  src,
3066
3504
  cookies: ["mp_*"],
3067
3505
  cookiesInfo: [
@@ -3073,12 +3511,13 @@ function createMixpanelIntegration(config) {
3073
3511
  }
3074
3512
  ],
3075
3513
  init: () => {
3076
- if (globalThis.window !== void 0) {
3077
- const w = window;
3514
+ const currentWindow = globalThis.window;
3515
+ if (currentWindow !== void 0) {
3516
+ const w = currentWindow;
3078
3517
  w.mixpanel = w.mixpanel || { init: () => void 0 };
3079
3518
  if (w.mixpanel && typeof w.mixpanel.init === "function") {
3080
3519
  try {
3081
- w.mixpanel.init(config.token, config.config ?? {}, config.api_host);
3520
+ w.mixpanel.init(token, config.config ?? {}, config.api_host);
3082
3521
  } catch (error) {
3083
3522
  if (typeof console !== "undefined" && typeof console.warn === "function") {
3084
3523
  console.warn("[Mixpanel] Failed to initialize:", error);
@@ -3090,15 +3529,26 @@ function createMixpanelIntegration(config) {
3090
3529
  };
3091
3530
  }
3092
3531
  function createClarityIntegration(config) {
3093
- const src = config.scriptUrl ?? `https://www.clarity.ms/tag/${config.projectId}`;
3532
+ const category = resolveCategory("analytics", config.category);
3533
+ const projectId = resolveRequiredString(config.projectId, "projectId", "clarity");
3534
+ if (!projectId) {
3535
+ return {
3536
+ id: "clarity",
3537
+ category,
3538
+ src: "",
3539
+ cookies: ["_clck", "_clsk", "CLID", "ANONCHK", "MR", "MUID", "SM"]
3540
+ };
3541
+ }
3542
+ const src = config.scriptUrl ?? `https://www.clarity.ms/tag/${projectId}`;
3094
3543
  return {
3095
3544
  id: "clarity",
3096
- category: "analytics",
3545
+ category,
3097
3546
  src,
3098
3547
  cookies: ["_clck", "_clsk", "CLID", "ANONCHK", "MR", "MUID", "SM"],
3099
3548
  init: () => {
3100
- if (globalThis.window !== void 0 && typeof config.upload !== "undefined") {
3101
- const w = window;
3549
+ const currentWindow = globalThis.window;
3550
+ if (currentWindow !== void 0 && typeof config.upload !== "undefined") {
3551
+ const w = currentWindow;
3102
3552
  if (typeof w.clarity === "function") {
3103
3553
  try {
3104
3554
  w.clarity("set", "upload", config.upload);
@@ -3113,18 +3563,29 @@ function createClarityIntegration(config) {
3113
3563
  };
3114
3564
  }
3115
3565
  function createIntercomIntegration(config) {
3116
- const src = config.scriptUrl ?? `https://widget.intercom.io/widget/${config.app_id}`;
3566
+ const category = resolveCategory("functional", config.category);
3567
+ const appId = resolveRequiredString(config.app_id, "app_id", "intercom");
3568
+ if (!appId) {
3569
+ return {
3570
+ id: "intercom",
3571
+ category,
3572
+ src: "",
3573
+ cookies: ["intercom-id-*", "intercom-session-*"]
3574
+ };
3575
+ }
3576
+ const src = config.scriptUrl ?? `https://widget.intercom.io/widget/${appId}`;
3117
3577
  return {
3118
3578
  id: "intercom",
3119
- category: "functional",
3579
+ category,
3120
3580
  src,
3121
3581
  cookies: ["intercom-id-*", "intercom-session-*"],
3122
3582
  init: () => {
3123
- if (globalThis.window !== void 0) {
3124
- const w = window;
3583
+ const currentWindow = globalThis.window;
3584
+ if (currentWindow !== void 0) {
3585
+ const w = currentWindow;
3125
3586
  if (typeof w.Intercom === "function") {
3126
3587
  try {
3127
- w.Intercom("boot", { app_id: config.app_id });
3588
+ w.Intercom("boot", { app_id: appId });
3128
3589
  } catch (error) {
3129
3590
  if (typeof console !== "undefined" && typeof console.warn === "function") {
3130
3591
  console.warn("[Intercom] Failed to boot:", error);
@@ -3136,18 +3597,29 @@ function createIntercomIntegration(config) {
3136
3597
  };
3137
3598
  }
3138
3599
  function createZendeskChatIntegration(config) {
3139
- const src = config.scriptUrl ?? `https://static.zdassets.com/ekr/snippet.js?key=${config.key}`;
3600
+ const category = resolveCategory("functional", config.category);
3601
+ const key = resolveRequiredString(config.key, "key", "zendesk-chat");
3602
+ if (!key) {
3603
+ return {
3604
+ id: "zendesk-chat",
3605
+ category,
3606
+ src: "",
3607
+ cookies: ["__zlcmid", "_zendesk_shared_session"]
3608
+ };
3609
+ }
3610
+ const src = config.scriptUrl ?? `https://static.zdassets.com/ekr/snippet.js?key=${key}`;
3140
3611
  return {
3141
3612
  id: "zendesk-chat",
3142
- category: "functional",
3613
+ category,
3143
3614
  src,
3144
3615
  cookies: ["__zlcmid", "_zendesk_shared_session"],
3145
3616
  init: () => {
3146
- if (globalThis.window !== void 0) {
3147
- const w = window;
3617
+ const currentWindow = globalThis.window;
3618
+ if (currentWindow !== void 0) {
3619
+ const w = currentWindow;
3148
3620
  if (typeof w.zE === "function") {
3149
3621
  try {
3150
- w.zE("webWidget", "identify", { key: config.key });
3622
+ w.zE("webWidget", "identify", { key });
3151
3623
  } catch (error) {
3152
3624
  if (typeof console !== "undefined" && typeof console.warn === "function") {
3153
3625
  console.warn("[Zendesk] Failed to identify:", error);
@@ -3269,217 +3741,6 @@ function createAnpdCategoriesConfig(options = {}) {
3269
3741
  };
3270
3742
  }
3271
3743
 
3272
- // src/types/advancedTexts.ts
3273
- var EXPANDED_DEFAULT_TEXTS = {
3274
- // Textos adicionais
3275
- confirm: "Confirmar",
3276
- cancel: "Cancelar",
3277
- loading: "Carregando...",
3278
- // Feedback
3279
- feedback: {
3280
- saveSuccess: "Prefer\xEAncias salvas com sucesso!",
3281
- saveError: "Erro ao salvar prefer\xEAncias. Tente novamente.",
3282
- consentUpdated: "Consentimento atualizado.",
3283
- cookiesRejected: "Cookies opcionais rejeitados.",
3284
- settingsReset: "Configura\xE7\xF5es resetadas."
3285
- },
3286
- // Acessibilidade
3287
- accessibility: {
3288
- bannerLabel: "Banner de consentimento de cookies",
3289
- modalLabel: "Modal de prefer\xEAncias de cookies",
3290
- keyboardNavigation: "Use Tab para navegar, Enter para selecionar",
3291
- toggleState: {
3292
- enabled: "Habilitado",
3293
- disabled: "Desabilitado"
3294
- },
3295
- liveRegion: "Regi\xE3o de an\xFAncios din\xE2micos"
3296
- },
3297
- // Categorias
3298
- categories: {
3299
- necessary: {
3300
- name: "Cookies Necess\xE1rios",
3301
- description: "Essenciais para o funcionamento b\xE1sico do site",
3302
- examples: "Sess\xE3o, seguran\xE7a, prefer\xEAncias de idioma"
3303
- },
3304
- analytics: {
3305
- name: "Cookies de Analytics",
3306
- description: "Ajudam a entender como os visitantes usam o site",
3307
- examples: "Google Analytics, contadores de p\xE1gina"
3308
- },
3309
- marketing: {
3310
- name: "Cookies de Marketing",
3311
- description: "Usados para personalizar an\xFAncios e ofertas",
3312
- examples: "Facebook Pixel, Google Ads, remarketing"
3313
- },
3314
- functional: {
3315
- name: "Cookies Funcionais",
3316
- description: "Melhoram a funcionalidade e personaliza\xE7\xE3o",
3317
- examples: "Chat, mapas, v\xEDdeos embarcados"
3318
- },
3319
- performance: {
3320
- name: "Cookies de Performance",
3321
- description: "Coletam informa\xE7\xF5es sobre velocidade e estabilidade",
3322
- examples: "Monitoramento de erro, otimiza\xE7\xE3o de velocidade"
3323
- }
3324
- },
3325
- // Contextos específicos
3326
- contexts: {
3327
- ecommerce: {
3328
- cartAbandonment: "Lembramos dos produtos no seu carrinho",
3329
- personalizedOffers: "Ofertas personalizadas baseadas no seu hist\xF3rico",
3330
- paymentSecurity: "Seguran\xE7a adicional no processo de pagamento",
3331
- productRecommendations: "Sugest\xF5es de produtos relevantes"
3332
- },
3333
- saas: {
3334
- userAnalytics: "An\xE1lise de uso para melhorar funcionalidades",
3335
- performanceMonitoring: "Monitoramento de performance da aplica\xE7\xE3o",
3336
- featureUsage: "Estat\xEDsticas de uso de recursos",
3337
- customerSupport: "Suporte ao cliente mais eficiente"
3338
- },
3339
- government: {
3340
- citizenServices: "Melhoria dos servi\xE7os ao cidad\xE3o",
3341
- dataProtection: "Prote\xE7\xE3o rigorosa dos dados pessoais",
3342
- transparency: "Transpar\xEAncia no uso de dados",
3343
- accessibility: "Recursos de acessibilidade digital"
3344
- },
3345
- education: {
3346
- studentProgress: "Acompanhamento do progresso educacional",
3347
- learningAnalytics: "Analytics para melhorar o aprendizado",
3348
- accessibility: "Recursos educacionais acess\xEDveis",
3349
- parentalConsent: "Consentimento parental quando necess\xE1rio"
3350
- }
3351
- },
3352
- // Variações de tom
3353
- variants: {
3354
- formal: {
3355
- bannerMessage: "Este s\xEDtio eletr\xF4nico utiliza cookies para otimizar a experi\xEAncia de navega\xE7\xE3o.",
3356
- acceptAll: "Concordar com todos os cookies",
3357
- declineAll: "Recusar cookies opcionais",
3358
- modalTitle: "Configura\xE7\xE3o de Cookies"
3359
- },
3360
- casual: {
3361
- bannerMessage: "\u{1F36A} Ei! Usamos cookies para tornar sua experi\xEAncia ainda melhor!",
3362
- acceptAll: "Aceitar tudo",
3363
- declineAll: "S\xF3 o essencial",
3364
- modalTitle: "Seus Cookies"
3365
- },
3366
- concise: {
3367
- bannerMessage: "Usamos cookies. Voc\xEA aceita?",
3368
- acceptAll: "Sim",
3369
- declineAll: "N\xE3o",
3370
- modalTitle: "Cookies"
3371
- },
3372
- detailed: {
3373
- 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.",
3374
- acceptAll: "Aceitar todos os cookies e tecnologias",
3375
- declineAll: "Recusar todos os cookies opcionais",
3376
- modalTitle: "Centro de Prefer\xEAncias de Privacidade"
3377
- }
3378
- },
3379
- // Internacionalização simplificada (apenas textos básicos)
3380
- i18n: {
3381
- en: {
3382
- bannerMessage: "We use cookies to enhance your experience.",
3383
- acceptAll: "Accept All",
3384
- declineAll: "Decline",
3385
- preferences: "Preferences",
3386
- modalTitle: "Cookie Preferences",
3387
- modalIntro: "Customize your cookie preferences below.",
3388
- save: "Save Preferences",
3389
- necessaryAlwaysOn: "Necessary cookies (always active)"
3390
- },
3391
- es: {
3392
- bannerMessage: "Utilizamos cookies para mejorar su experiencia.",
3393
- acceptAll: "Aceptar Todo",
3394
- declineAll: "Rechazar",
3395
- preferences: "Preferencias",
3396
- modalTitle: "Preferencias de Cookies",
3397
- modalIntro: "Personalice sus preferencias de cookies a continuaci\xF3n.",
3398
- save: "Guardar Preferencias",
3399
- necessaryAlwaysOn: "Cookies necess\xE1rias (sempre ativas)"
3400
- },
3401
- fr: {
3402
- bannerMessage: "Nous utilisons des cookies pour am\xE9liorer votre exp\xE9rience.",
3403
- acceptAll: "Tout Accepter",
3404
- declineAll: "Refuser",
3405
- preferences: "Pr\xE9f\xE9rences",
3406
- modalTitle: "Pr\xE9f\xE9rences des Cookies",
3407
- modalIntro: "Personnalisez vos pr\xE9f\xE9rences de cookies ci-dessous.",
3408
- save: "Enregistrer les Pr\xE9f\xE9rences",
3409
- necessaryAlwaysOn: "Cookies n\xE9cessaires (toujours actifs)"
3410
- }
3411
- },
3412
- // Textos técnicos
3413
- technical: {
3414
- sessionCookies: "Cookies de sess\xE3o s\xE3o tempor\xE1rios e expiram quando voc\xEA fecha o navegador.",
3415
- persistentCookies: "Cookies persistentes permanecem no seu dispositivo at\xE9 expirarem ou serem removidos.",
3416
- thirdPartyCookies: "Cookies de terceiros s\xE3o definidos por dom\xEDnios diferentes do site que voc\xEA est\xE1 visitando.",
3417
- browserSettings: "Voc\xEA pode gerenciar cookies nas configura\xE7\xF5es do seu navegador.",
3418
- disablingImpact: "Desabilitar cookies pode afetar a funcionalidade do site."
3419
- },
3420
- // Cookie details
3421
- cookieDetails: {
3422
- tableHeaders: {
3423
- name: "Nome",
3424
- purpose: "Finalidade",
3425
- duration: "Dura\xE7\xE3o",
3426
- provider: "Fornecedor",
3427
- type: "Tipo"
3428
- },
3429
- noCookies: "Nenhum cookie encontrado para esta categoria.",
3430
- toggleDetails: {
3431
- expand: "Ver detalhes",
3432
- collapse: "Ocultar detalhes"
3433
- }
3434
- }
3435
- };
3436
- function resolveTexts(texts, options = {}) {
3437
- const { language = "pt", variant } = options;
3438
- let resolved = { ...texts };
3439
- if (variant && texts.variants?.[variant]) {
3440
- resolved = { ...resolved, ...texts.variants[variant] };
3441
- }
3442
- if (language !== "pt" && texts.i18n?.[language]) {
3443
- resolved = { ...resolved, ...texts.i18n[language] };
3444
- }
3445
- return resolved;
3446
- }
3447
- var TEXT_TEMPLATES = {
3448
- ecommerce: {
3449
- ...EXPANDED_DEFAULT_TEXTS,
3450
- bannerMessage: "Utilizamos cookies para personalizar ofertas e melhorar sua experi\xEAncia de compra.",
3451
- acceptAll: "Aceitar e continuar",
3452
- variants: {
3453
- casual: {
3454
- bannerMessage: "\u{1F6D2} Usamos cookies para encontrar as melhores ofertas para voc\xEA!",
3455
- acceptAll: "Quero ofertas personalizadas!"
3456
- }
3457
- }
3458
- },
3459
- saas: {
3460
- ...EXPANDED_DEFAULT_TEXTS,
3461
- bannerMessage: "Utilizamos cookies para otimizar o desempenho da aplica\xE7\xE3o e sua experi\xEAncia.",
3462
- acceptAll: "Aceitar e otimizar",
3463
- variants: {
3464
- formal: {
3465
- bannerMessage: "Esta aplica\xE7\xE3o utiliza cookies para an\xE1lise de performance e melhoria cont\xEDnua da experi\xEAncia do usu\xE1rio.",
3466
- acceptAll: "Autorizar coleta de dados de uso"
3467
- }
3468
- }
3469
- },
3470
- government: {
3471
- ...EXPANDED_DEFAULT_TEXTS,
3472
- bannerMessage: "Este portal utiliza cookies em conformidade com a LGPD para melhorar os servi\xE7os p\xFAblicos.",
3473
- acceptAll: "Aceitar em conformidade",
3474
- variants: {
3475
- formal: {
3476
- 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.",
3477
- acceptAll: "Concordar com o uso de cookies"
3478
- }
3479
- }
3480
- }
3481
- };
3482
-
3483
3744
  exports.ANPD_CATEGORY_PRESETS = ANPD_CATEGORY_PRESETS;
3484
3745
  exports.COMMON_INTEGRATIONS = COMMON_INTEGRATIONS;
3485
3746
  exports.ConsentGate = ConsentGate;
@@ -3511,6 +3772,7 @@ exports.createIntercomIntegration = createIntercomIntegration;
3511
3772
  exports.createMixpanelIntegration = createMixpanelIntegration;
3512
3773
  exports.createProjectPreferences = createProjectPreferences;
3513
3774
  exports.createSaaSIntegrations = createSaaSIntegrations;
3775
+ exports.createSuggestedIntegration = createSuggestedIntegration;
3514
3776
  exports.createUserWayIntegration = createUserWayIntegration;
3515
3777
  exports.createZendeskChatIntegration = createZendeskChatIntegration;
3516
3778
  exports.defaultTexts = defaultTexts;