react-lgpd-consent 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,23 @@
1
- // src/components/PreferencesModal.tsx
2
- import Box2 from "@mui/material/Box";
3
- import Button2 from "@mui/material/Button";
4
- import Dialog from "@mui/material/Dialog";
5
- import DialogActions from "@mui/material/DialogActions";
6
- import DialogContent from "@mui/material/DialogContent";
7
- import DialogTitle from "@mui/material/DialogTitle";
8
- import FormControlLabel from "@mui/material/FormControlLabel";
9
- import FormGroup from "@mui/material/FormGroup";
10
- import Switch from "@mui/material/Switch";
11
- import Typography3 from "@mui/material/Typography";
12
- import { useEffect as useEffect3, useState as useState3 } from "react";
1
+ import * as React4 from 'react';
2
+ import React4__default from 'react';
3
+ import Cookies from 'js-cookie';
4
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
+ import Link from '@mui/material/Link';
6
+ import Typography from '@mui/material/Typography';
7
+ import { ThemeProvider } from '@mui/material/styles';
8
+ import Button from '@mui/material/Button';
9
+ import Box from '@mui/material/Box';
10
+ import Paper from '@mui/material/Paper';
11
+ import Snackbar from '@mui/material/Snackbar';
12
+ import Stack from '@mui/material/Stack';
13
13
 
14
- // src/context/CategoriesContext.tsx
15
- import * as React2 from "react";
14
+ // react-lgpd-consent - Tree-shakeable ESM build
15
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
16
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
17
+ }) : x)(function(x) {
18
+ if (typeof require !== "undefined") return require.apply(this, arguments);
19
+ throw Error('Dynamic require of "' + x + '" is not supported');
20
+ });
16
21
 
17
22
  // src/utils/cookieRegistry.ts
18
23
  var COOKIE_PATTERNS_BY_CATEGORY = {
@@ -265,9 +270,6 @@ function categorizeDiscoveredCookies(discovered, registerOverrides = false) {
265
270
  return out;
266
271
  }
267
272
 
268
- // src/utils/cookieUtils.ts
269
- import Cookies from "js-cookie";
270
-
271
273
  // src/utils/logger.ts
272
274
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
273
275
  LogLevel2[LogLevel2["ERROR"] = 0] = "ERROR";
@@ -307,55 +309,61 @@ var _ConsentLogger = class _ConsentLogger {
307
309
  }
308
310
  /**
309
311
  * Registra uma mensagem de aviso.
312
+ * Suprimido em produção por padrão (apenas se logging estiver explicitamente habilitado).
310
313
  * @param {...unknown[]} args Argumentos a serem logados.
311
314
  */
312
315
  warn(...args) {
313
- if (this.enabled && this.level >= 1 /* WARN */) {
316
+ if (this.enabled && this.level >= 1 /* WARN */ && !_ConsentLogger.IS_PRODUCTION) {
314
317
  console.warn(_ConsentLogger.LOG_PREFIX, "[WARN]", ...args);
315
318
  }
316
319
  }
317
320
  /**
318
321
  * Registra uma mensagem informativa.
322
+ * Suprimido em produção por padrão.
319
323
  * @param {...unknown[]} args Argumentos a serem logados.
320
324
  */
321
325
  info(...args) {
322
- if (this.enabled && this.level >= 2 /* INFO */) {
326
+ if (this.enabled && this.level >= 2 /* INFO */ && !_ConsentLogger.IS_PRODUCTION) {
323
327
  console.info(_ConsentLogger.LOG_PREFIX, "[INFO]", ...args);
324
328
  }
325
329
  }
326
330
  /**
327
331
  * Registra uma mensagem de depuração.
332
+ * Sempre suprimido em produção.
328
333
  * @param {...unknown[]} args Argumentos a serem logados.
329
334
  */
330
335
  debug(...args) {
331
- if (this.enabled && this.level >= 3 /* DEBUG */) {
336
+ if (this.enabled && this.level >= 3 /* DEBUG */ && !_ConsentLogger.IS_PRODUCTION) {
332
337
  console.debug(_ConsentLogger.LOG_PREFIX, "[DEBUG]", ...args);
333
338
  }
334
339
  }
335
340
  /**
336
341
  * Inicia um grupo de logs no console.
342
+ * Suprimido em produção.
337
343
  * @param {...unknown[]} args Argumentos para o título do grupo.
338
344
  */
339
345
  group(...args) {
340
- if (this.enabled && this.level >= 3 /* DEBUG */) {
346
+ if (this.enabled && this.level >= 3 /* DEBUG */ && !_ConsentLogger.IS_PRODUCTION) {
341
347
  console.group(_ConsentLogger.LOG_PREFIX, ...args);
342
348
  }
343
349
  }
344
350
  /**
345
351
  * Finaliza o grupo de logs mais recente no console.
352
+ * Suprimido em produção.
346
353
  */
347
354
  groupEnd() {
348
- if (this.enabled && this.level >= 3 /* DEBUG */) {
355
+ if (this.enabled && this.level >= 3 /* DEBUG */ && !_ConsentLogger.IS_PRODUCTION) {
349
356
  console.groupEnd();
350
357
  }
351
358
  }
352
359
  /**
353
360
  * Exibe dados tabulares no console.
361
+ * Suprimido em produção.
354
362
  * @param {unknown} tabularData Dados a serem exibidos na tabela.
355
363
  * @param {string[]} [properties] Propriedades opcionais para exibir.
356
364
  */
357
365
  table(tabularData, properties) {
358
- if (this.enabled && this.level >= 3 /* DEBUG */) {
366
+ if (this.enabled && this.level >= 3 /* DEBUG */ && !_ConsentLogger.IS_PRODUCTION) {
359
367
  console.table(tabularData, properties);
360
368
  }
361
369
  }
@@ -433,6 +441,7 @@ var _ConsentLogger = class _ConsentLogger {
433
441
  }
434
442
  };
435
443
  _ConsentLogger.IS_DEVELOPMENT = typeof globalThis !== "undefined" && globalThis.process?.env?.NODE_ENV === "development";
444
+ _ConsentLogger.IS_PRODUCTION = typeof globalThis !== "undefined" && globalThis.process?.env?.NODE_ENV === "production";
436
445
  _ConsentLogger.LOG_PREFIX = "[react-lgpd-consent]";
437
446
  var ConsentLogger = _ConsentLogger;
438
447
  var logger = new ConsentLogger();
@@ -441,102 +450,6 @@ function setDebugLogging(enabled, level = 2 /* INFO */) {
441
450
  logger.setLevel(level);
442
451
  logger.info(`Debug logging ${enabled ? "enabled" : "disabled"} with level ${LogLevel[level]}`);
443
452
  }
444
-
445
- // src/utils/cookieUtils.ts
446
- var DEFAULT_COOKIE_OPTS = {
447
- name: "cookieConsent",
448
- maxAgeDays: 365,
449
- sameSite: "Lax",
450
- secure: typeof window !== "undefined" ? window.location.protocol === "https:" : false,
451
- path: "/"
452
- };
453
- var COOKIE_SCHEMA_VERSION = "1.0";
454
- function readConsentCookie(name = DEFAULT_COOKIE_OPTS.name) {
455
- logger.debug("Reading consent cookie", { name });
456
- if (typeof document === "undefined") {
457
- logger.debug("Cookie read skipped: server-side environment");
458
- return null;
459
- }
460
- const raw = Cookies.get(name);
461
- if (!raw) {
462
- logger.debug("No consent cookie found");
463
- return null;
464
- }
465
- try {
466
- const data = JSON.parse(raw);
467
- logger.cookieOperation("read", name, data);
468
- if (!data.version) {
469
- logger.debug("Migrating legacy cookie format");
470
- return migrateLegacyCookie(data);
471
- }
472
- if (data.version !== COOKIE_SCHEMA_VERSION) {
473
- logger.warn(`Cookie version mismatch: ${data.version} != ${COOKIE_SCHEMA_VERSION}`);
474
- return null;
475
- }
476
- return data;
477
- } catch (error) {
478
- logger.error("Error parsing consent cookie", error);
479
- return null;
480
- }
481
- }
482
- function migrateLegacyCookie(legacyData) {
483
- try {
484
- const now = (/* @__PURE__ */ new Date()).toISOString();
485
- return {
486
- version: COOKIE_SCHEMA_VERSION,
487
- consented: Boolean(legacyData.consented) || false,
488
- preferences: legacyData.preferences && typeof legacyData.preferences === "object" ? legacyData.preferences : { necessary: true },
489
- consentDate: now,
490
- lastUpdate: now,
491
- source: "banner",
492
- isModalOpen: false
493
- };
494
- } catch {
495
- return null;
496
- }
497
- }
498
- function writeConsentCookie(state, config, opts, source = "banner") {
499
- if (typeof document === "undefined") {
500
- logger.debug("Cookie write skipped: server-side environment");
501
- return;
502
- }
503
- const now = (/* @__PURE__ */ new Date()).toISOString();
504
- const o = { ...DEFAULT_COOKIE_OPTS, ...opts };
505
- const cookieData = {
506
- version: COOKIE_SCHEMA_VERSION,
507
- consented: state.consented,
508
- preferences: state.preferences,
509
- consentDate: state.consentDate || now,
510
- lastUpdate: now,
511
- source,
512
- projectConfig: config
513
- };
514
- logger.cookieOperation("write", o.name, cookieData);
515
- Cookies.set(o.name, JSON.stringify(cookieData), {
516
- expires: o.maxAgeDays,
517
- sameSite: o.sameSite,
518
- secure: o.secure,
519
- path: o.path
520
- });
521
- logger.info("Consent cookie saved", {
522
- consented: cookieData.consented,
523
- source: cookieData.source,
524
- preferencesCount: Object.keys(cookieData.preferences).length
525
- });
526
- }
527
- function removeConsentCookie(opts) {
528
- if (typeof document === "undefined") {
529
- logger.debug("Cookie removal skipped: server-side environment");
530
- return;
531
- }
532
- const o = { ...DEFAULT_COOKIE_OPTS, ...opts };
533
- logger.cookieOperation("delete", o.name);
534
- Cookies.remove(o.name, { path: o.path });
535
- logger.info("Consent cookie removed");
536
- }
537
-
538
- // src/utils/developerGuidance.ts
539
- import React from "react";
540
453
  var DEFAULT_PROJECT_CATEGORIES = {
541
454
  enabledCategories: ["analytics"]
542
455
  };
@@ -859,8 +772,8 @@ function logDeveloperGuidance(guidance, disableGuidanceProp, config) {
859
772
  }
860
773
  }
861
774
  function useDeveloperGuidance(config, disableGuidanceProp, guidanceConfig) {
862
- const guidance = React.useMemo(() => analyzeDeveloperConfiguration(config), [config]);
863
- React.useEffect(() => {
775
+ const guidance = React4__default.useMemo(() => analyzeDeveloperConfiguration(config), [config]);
776
+ React4__default.useEffect(() => {
864
777
  if (!disableGuidanceProp) logDeveloperGuidance(guidance, disableGuidanceProp, guidanceConfig);
865
778
  }, [guidance, disableGuidanceProp, guidanceConfig]);
866
779
  return guidance;
@@ -903,18 +816,106 @@ var GUIDANCE_PRESETS = {
903
816
  minimumSeverity: "warning"
904
817
  }
905
818
  };
906
-
907
- // src/context/CategoriesContext.tsx
908
- import { jsx } from "react/jsx-runtime";
909
- var CategoriesContext = React2.createContext(null);
819
+ var DEFAULT_COOKIE_OPTS = {
820
+ name: "cookieConsent",
821
+ maxAgeDays: 365,
822
+ sameSite: "Lax",
823
+ secure: typeof window !== "undefined" ? window.location.protocol === "https:" : false,
824
+ path: "/"
825
+ };
826
+ var COOKIE_SCHEMA_VERSION = "1.0";
827
+ function readConsentCookie(name = DEFAULT_COOKIE_OPTS.name) {
828
+ logger.debug("Reading consent cookie", { name });
829
+ if (typeof document === "undefined") {
830
+ logger.debug("Cookie read skipped: server-side environment");
831
+ return null;
832
+ }
833
+ const raw = Cookies.get(name);
834
+ if (!raw) {
835
+ logger.debug("No consent cookie found");
836
+ return null;
837
+ }
838
+ try {
839
+ const data = JSON.parse(raw);
840
+ logger.cookieOperation("read", name, data);
841
+ if (!data.version) {
842
+ logger.debug("Migrating legacy cookie format");
843
+ return migrateLegacyCookie(data);
844
+ }
845
+ if (data.version !== COOKIE_SCHEMA_VERSION) {
846
+ logger.warn(`Cookie version mismatch: ${data.version} != ${COOKIE_SCHEMA_VERSION}`);
847
+ return null;
848
+ }
849
+ return data;
850
+ } catch (error) {
851
+ logger.error("Error parsing consent cookie", error);
852
+ return null;
853
+ }
854
+ }
855
+ function migrateLegacyCookie(legacyData) {
856
+ try {
857
+ const now = (/* @__PURE__ */ new Date()).toISOString();
858
+ return {
859
+ version: COOKIE_SCHEMA_VERSION,
860
+ consented: Boolean(legacyData.consented) || false,
861
+ preferences: legacyData.preferences && typeof legacyData.preferences === "object" ? legacyData.preferences : { necessary: true },
862
+ consentDate: now,
863
+ lastUpdate: now,
864
+ source: "banner",
865
+ isModalOpen: false
866
+ };
867
+ } catch {
868
+ return null;
869
+ }
870
+ }
871
+ function writeConsentCookie(state, config, opts, source = "banner") {
872
+ if (typeof document === "undefined") {
873
+ logger.debug("Cookie write skipped: server-side environment");
874
+ return;
875
+ }
876
+ const now = (/* @__PURE__ */ new Date()).toISOString();
877
+ const o = { ...DEFAULT_COOKIE_OPTS, ...opts };
878
+ const cookieData = {
879
+ version: COOKIE_SCHEMA_VERSION,
880
+ consented: state.consented,
881
+ preferences: state.preferences,
882
+ consentDate: state.consentDate || now,
883
+ lastUpdate: now,
884
+ source,
885
+ projectConfig: config
886
+ };
887
+ logger.cookieOperation("write", o.name, cookieData);
888
+ Cookies.set(o.name, JSON.stringify(cookieData), {
889
+ expires: o.maxAgeDays,
890
+ sameSite: o.sameSite,
891
+ secure: o.secure,
892
+ path: o.path
893
+ });
894
+ logger.info("Consent cookie saved", {
895
+ consented: cookieData.consented,
896
+ source: cookieData.source,
897
+ preferencesCount: Object.keys(cookieData.preferences).length
898
+ });
899
+ }
900
+ function removeConsentCookie(opts) {
901
+ if (typeof document === "undefined") {
902
+ logger.debug("Cookie removal skipped: server-side environment");
903
+ return;
904
+ }
905
+ const o = { ...DEFAULT_COOKIE_OPTS, ...opts };
906
+ logger.cookieOperation("delete", o.name);
907
+ Cookies.remove(o.name, { path: o.path });
908
+ logger.info("Consent cookie removed");
909
+ }
910
+ var CategoriesContext = React4.createContext(null);
910
911
  function CategoriesProvider({
911
912
  children,
912
913
  config,
913
914
  disableDeveloperGuidance,
914
915
  disableDiscoveryLog
915
916
  }) {
916
- const [impliedVersion, setImpliedVersion] = React2.useState(0);
917
- React2.useEffect(() => {
917
+ const [impliedVersion, setImpliedVersion] = React4.useState(0);
918
+ React4.useEffect(() => {
918
919
  const handler = () => setImpliedVersion((v) => v + 1);
919
920
  if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
920
921
  window.addEventListener("lgpd:requiredCategories", handler);
@@ -923,7 +924,7 @@ function CategoriesProvider({
923
924
  return () => {
924
925
  };
925
926
  }, []);
926
- const contextValue = React2.useMemo(() => {
927
+ const contextValue = React4.useMemo(() => {
927
928
  const finalConfig = config || DEFAULT_PROJECT_CATEGORIES;
928
929
  const guidance = analyzeDeveloperConfiguration(config);
929
930
  const toggleableCategories = guidance.activeCategoriesInfo.filter((cat) => cat.uiRequired);
@@ -934,15 +935,15 @@ function CategoriesProvider({
934
935
  allCategories: guidance.activeCategoriesInfo
935
936
  };
936
937
  }, [config, impliedVersion]);
937
- React2.useEffect(() => {
938
+ React4.useEffect(() => {
938
939
  logDeveloperGuidance(contextValue.guidance, disableDeveloperGuidance);
939
940
  }, [contextValue.guidance, disableDeveloperGuidance]);
940
- React2.useEffect(() => {
941
+ React4.useEffect(() => {
941
942
  try {
942
943
  const gt = globalThis;
943
944
  const env = typeof gt.process !== "undefined" ? gt.process?.env?.NODE_ENV : void 0;
944
- const isDev = env === "development";
945
- if (!isDev || gt.__LGPD_DISCOVERY_LOGGED__ === true || disableDiscoveryLog) return;
945
+ const isDev2 = env === "development";
946
+ if (!isDev2 || gt.__LGPD_DISCOVERY_LOGGED__ === true || disableDiscoveryLog) return;
946
947
  const discovered = discoverRuntimeCookies();
947
948
  const consentName = detectConsentCookieName() || DEFAULT_COOKIE_OPTS.name;
948
949
  const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
@@ -969,7 +970,7 @@ function CategoriesProvider({
969
970
  return /* @__PURE__ */ jsx(CategoriesContext.Provider, { value: contextValue, children });
970
971
  }
971
972
  function useCategories() {
972
- const context = React2.useContext(CategoriesContext);
973
+ const context = React4.useContext(CategoriesContext);
973
974
  if (!context) {
974
975
  throw new Error(
975
976
  "useCategories deve ser usado dentro de CategoriesProvider. Certifique-se de que o ConsentProvider est\xE1 envolvendo seu componente."
@@ -988,25 +989,17 @@ function useCategoryStatus(categoryId) {
988
989
  description: category?.description
989
990
  };
990
991
  }
991
-
992
- // src/context/DesignContext.tsx
993
- import * as React3 from "react";
994
- import { jsx as jsx2 } from "react/jsx-runtime";
995
- var DesignContext = React3.createContext(void 0);
992
+ var DesignContext = React4.createContext(void 0);
996
993
  function DesignProvider({
997
994
  tokens,
998
995
  children
999
996
  }) {
1000
- return /* @__PURE__ */ jsx2(DesignContext.Provider, { value: tokens, children });
997
+ return /* @__PURE__ */ jsx(DesignContext.Provider, { value: tokens, children });
1001
998
  }
1002
999
  function useDesignTokens() {
1003
- return React3.useContext(DesignContext);
1000
+ return React4.useContext(DesignContext);
1004
1001
  }
1005
1002
 
1006
- // src/context/ConsentContext.tsx
1007
- import { ThemeProvider } from "@mui/material/styles";
1008
- import * as React4 from "react";
1009
-
1010
1003
  // src/utils/categoryUtils.ts
1011
1004
  function createProjectPreferences(config, defaultValue = false) {
1012
1005
  const preferences = {
@@ -1112,80 +1105,113 @@ function getDefaultCategoryDefinition(category) {
1112
1105
  return definitions[category];
1113
1106
  }
1114
1107
 
1115
- // src/components/CookieBanner.tsx
1116
- import Button from "@mui/material/Button";
1117
- import Box from "@mui/material/Box";
1118
- import Paper from "@mui/material/Paper";
1119
- import Snackbar from "@mui/material/Snackbar";
1120
- import Stack from "@mui/material/Stack";
1121
- import Typography2 from "@mui/material/Typography";
1122
- import Link2 from "@mui/material/Link";
1123
-
1124
- // src/components/Branding.tsx
1125
- import Link from "@mui/material/Link";
1126
- import Typography from "@mui/material/Typography";
1127
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
1128
- var brandingStyles = {
1129
- banner: {
1130
- fontSize: "0.65rem",
1131
- textAlign: "right",
1132
- mt: 1,
1133
- opacity: 0.7,
1134
- fontStyle: "italic",
1135
- width: "100%"
1136
- },
1137
- modal: {
1138
- fontSize: "0.65rem",
1139
- textAlign: "right",
1140
- px: 3,
1141
- pb: 1,
1142
- opacity: 0.7,
1143
- fontStyle: "italic",
1144
- width: "100%"
1108
+ // src/utils/validation.ts
1109
+ var isDev = () => typeof process !== "undefined" && process?.env?.NODE_ENV !== "production";
1110
+ function validateConsentProviderProps(props) {
1111
+ const warnings = [];
1112
+ const errors = [];
1113
+ const sanitized = {};
1114
+ if (!isDev()) {
1115
+ if (props.categories) {
1116
+ const enabled = Array.from(/* @__PURE__ */ new Set([...props.categories.enabledCategories ?? []]));
1117
+ const sanitizedEnabled = enabled.filter((c) => c !== "necessary");
1118
+ sanitized.categories = {
1119
+ enabledCategories: sanitizedEnabled,
1120
+ customCategories: props.categories.customCategories
1121
+ };
1122
+ }
1123
+ return { sanitized, warnings, errors };
1145
1124
  }
1146
- };
1147
- var linkStyles = {
1148
- textDecoration: "none",
1149
- fontWeight: 500,
1150
- "&:hover": {
1151
- textDecoration: "underline"
1125
+ let z;
1126
+ try {
1127
+ z = __require("zod");
1128
+ } catch {
1129
+ z = void 0;
1152
1130
  }
1153
- };
1154
- function Branding({ variant, hidden = false }) {
1155
- const texts = useConsentTexts();
1156
- const designTokens = useDesignTokens();
1157
- if (hidden) return null;
1158
- return /* @__PURE__ */ jsxs(
1159
- Typography,
1160
- {
1161
- variant: "caption",
1162
- sx: (theme) => ({
1163
- ...brandingStyles[variant],
1164
- color: designTokens?.colors?.text ?? theme.palette.text.secondary
1165
- }),
1166
- children: [
1167
- texts.brandingPoweredBy || "fornecido por",
1168
- " ",
1169
- /* @__PURE__ */ jsx3(
1170
- Link,
1171
- {
1172
- href: "https://www.ledipo.eti.br",
1173
- target: "_blank",
1174
- rel: "noopener noreferrer",
1175
- sx: (theme) => ({
1176
- ...linkStyles,
1177
- color: designTokens?.colors?.primary ?? theme.palette.primary.main
1178
- }),
1179
- children: "L\xC9dipO.eti.br"
1180
- }
1181
- )
1182
- ]
1131
+ const issues = [];
1132
+ if (z) {
1133
+ const CustomCategorySchema = z.object({
1134
+ id: z.string().min(1, "customCategories[].id deve ser uma string n\xE3o vazia"),
1135
+ name: z.string().min(1, "customCategories[].name deve ser uma string n\xE3o vazia"),
1136
+ description: z.string().min(1, "customCategories[].description deve ser uma string n\xE3o vazia"),
1137
+ essential: z.boolean().optional(),
1138
+ cookies: z.array(z.string().min(1)).optional()
1139
+ });
1140
+ const ProjectCategoriesConfigSchema = z.object({
1141
+ enabledCategories: z.array(z.string().min(1)).optional(),
1142
+ customCategories: z.array(CustomCategorySchema).optional()
1143
+ }).strict();
1144
+ const res = ProjectCategoriesConfigSchema.safeParse(props.categories);
1145
+ if (!res.success) {
1146
+ res.error.issues.forEach(
1147
+ (issue) => issues.push({ path: `categories.${issue.path.join(".")}`, message: issue.message })
1148
+ );
1183
1149
  }
1184
- );
1150
+ }
1151
+ if (!props.categories) {
1152
+ warnings.push(
1153
+ "Prop 'categories' n\xE3o fornecida. A lib aplicar\xE1 um padr\xE3o seguro, mas recomenda-se definir 'categories.enabledCategories' explicitamente para clareza e auditoria."
1154
+ );
1155
+ } else {
1156
+ const cat = props.categories;
1157
+ const enabled = Array.from(/* @__PURE__ */ new Set([...cat.enabledCategories ?? []]));
1158
+ if (enabled.includes("necessary")) {
1159
+ warnings.push("'necessary' \xE9 sempre inclu\xEDda automaticamente \u2014 remova de enabledCategories.");
1160
+ }
1161
+ const sanitizedEnabled = enabled.filter((c) => c !== "necessary");
1162
+ const invalidEnabled = sanitizedEnabled.filter((c) => typeof c !== "string" || c.trim() === "");
1163
+ if (invalidEnabled.length > 0) {
1164
+ warnings.push(
1165
+ `enabledCategories cont\xE9m valores inv\xE1lidos: ${invalidEnabled.map((v) => String(v)).join(", ")} \u2014 remova ou corrija os IDs de categoria`
1166
+ );
1167
+ }
1168
+ const custom = cat.customCategories ?? [];
1169
+ if (z) {
1170
+ const CustomCategorySchema = z.object({
1171
+ id: z.string().min(1),
1172
+ name: z.string().min(1),
1173
+ description: z.string().min(1),
1174
+ essential: z.boolean().optional(),
1175
+ cookies: z.array(z.string().min(1)).optional()
1176
+ });
1177
+ const customParse = z.array(CustomCategorySchema).safeParse(custom);
1178
+ if (!customParse.success) {
1179
+ customParse.error.issues.forEach(
1180
+ (issue) => issues.push({ path: `customCategories.${issue.path.join(".")}`, message: issue.message })
1181
+ );
1182
+ }
1183
+ }
1184
+ const ids = /* @__PURE__ */ new Set();
1185
+ const dupes = [];
1186
+ ["necessary", ...sanitizedEnabled].forEach((id) => {
1187
+ if (ids.has(id)) dupes.push(id);
1188
+ ids.add(id);
1189
+ });
1190
+ custom.forEach((c) => {
1191
+ if (ids.has(c.id)) dupes.push(c.id);
1192
+ ids.add(c.id);
1193
+ });
1194
+ if (dupes.length > 0) {
1195
+ warnings.push(
1196
+ `IDs de categoria duplicados detectados: ${Array.from(new Set(dupes)).join(
1197
+ ", "
1198
+ )} \u2014 verifique 'enabledCategories' e 'customCategories'.`
1199
+ );
1200
+ }
1201
+ sanitized.categories = {
1202
+ enabledCategories: sanitizedEnabled,
1203
+ customCategories: custom
1204
+ };
1205
+ }
1206
+ if (warnings.length > 0) {
1207
+ logger.warn("Valida\xE7\xE3o do ConsentProvider:", ...warnings);
1208
+ }
1209
+ if (errors.length > 0 || issues.length > 0) {
1210
+ issues.forEach((i) => errors.push(`Prop inv\xE1lida: ${i.path} \u2014 ${i.message}`));
1211
+ logger.error("Erros de configura\xE7\xE3o do ConsentProvider:", ...errors);
1212
+ }
1213
+ return { sanitized, warnings, errors };
1185
1214
  }
1186
-
1187
- // src/components/CookieBanner.tsx
1188
- import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
1189
1215
  function CookieBanner({
1190
1216
  policyLinkUrl,
1191
1217
  termsLinkUrl,
@@ -1217,12 +1243,12 @@ function CookieBanner({
1217
1243
  borderRadius: designTokens?.spacing?.borderRadius?.banner,
1218
1244
  fontFamily: designTokens?.typography?.fontFamily
1219
1245
  });
1220
- const bannerContent = /* @__PURE__ */ jsx4(Paper, { elevation: 3, sx: bannerStyle, ...PaperProps, children: /* @__PURE__ */ jsxs2(Stack, { spacing: 1, children: [
1221
- /* @__PURE__ */ jsxs2(Typography2, { variant: "body2", sx: { fontSize: designTokens?.typography?.fontSize?.banner }, children: [
1246
+ const bannerContent = /* @__PURE__ */ jsx(Paper, { elevation: 3, sx: bannerStyle, ...PaperProps, children: /* @__PURE__ */ jsxs(Stack, { spacing: 1, children: [
1247
+ /* @__PURE__ */ jsxs(Typography, { variant: "body2", sx: { fontSize: designTokens?.typography?.fontSize?.banner }, children: [
1222
1248
  texts.bannerMessage,
1223
1249
  " ",
1224
- policyLinkUrl && /* @__PURE__ */ jsx4(
1225
- Link2,
1250
+ policyLinkUrl && /* @__PURE__ */ jsx(
1251
+ Link,
1226
1252
  {
1227
1253
  href: policyLinkUrl,
1228
1254
  underline: "hover",
@@ -1233,8 +1259,8 @@ function CookieBanner({
1233
1259
  }
1234
1260
  )
1235
1261
  ] }),
1236
- /* @__PURE__ */ jsxs2(Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, justifyContent: "flex-end", children: [
1237
- /* @__PURE__ */ jsx4(
1262
+ /* @__PURE__ */ jsxs(Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, justifyContent: "flex-end", children: [
1263
+ /* @__PURE__ */ jsx(
1238
1264
  Button,
1239
1265
  {
1240
1266
  variant: "outlined",
@@ -1246,7 +1272,7 @@ function CookieBanner({
1246
1272
  children: texts.declineAll
1247
1273
  }
1248
1274
  ),
1249
- /* @__PURE__ */ jsx4(
1275
+ /* @__PURE__ */ jsx(
1250
1276
  Button,
1251
1277
  {
1252
1278
  variant: "contained",
@@ -1258,7 +1284,7 @@ function CookieBanner({
1258
1284
  children: texts.acceptAll
1259
1285
  }
1260
1286
  ),
1261
- /* @__PURE__ */ jsx4(
1287
+ /* @__PURE__ */ jsx(
1262
1288
  Button,
1263
1289
  {
1264
1290
  variant: "text",
@@ -1271,7 +1297,7 @@ function CookieBanner({
1271
1297
  }
1272
1298
  )
1273
1299
  ] }),
1274
- !hideBranding && /* @__PURE__ */ jsx4(Branding, { variant: "banner" })
1300
+ !hideBranding && /* @__PURE__ */ jsx(Branding, { variant: "banner" })
1275
1301
  ] }) });
1276
1302
  const positionStyle = {
1277
1303
  position: "fixed",
@@ -1314,8 +1340,8 @@ function CookieBanner({
1314
1340
  })();
1315
1341
  const effectiveBlocking = blocking && !isSafeRoute;
1316
1342
  if (effectiveBlocking) {
1317
- return /* @__PURE__ */ jsxs2(Fragment, { children: [
1318
- /* @__PURE__ */ jsx4(
1343
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1344
+ /* @__PURE__ */ jsx(
1319
1345
  Box,
1320
1346
  {
1321
1347
  sx: (theme) => ({
@@ -1329,10 +1355,10 @@ function CookieBanner({
1329
1355
  })
1330
1356
  }
1331
1357
  ),
1332
- /* @__PURE__ */ jsx4(Box, { sx: positionStyle, children: bannerContent })
1358
+ /* @__PURE__ */ jsx(Box, { sx: positionStyle, children: bannerContent })
1333
1359
  ] });
1334
1360
  }
1335
- return /* @__PURE__ */ jsx4(
1361
+ return /* @__PURE__ */ jsx(
1336
1362
  Snackbar,
1337
1363
  {
1338
1364
  open,
@@ -1345,102 +1371,16 @@ function CookieBanner({
1345
1371
  }
1346
1372
  );
1347
1373
  }
1348
-
1349
- // src/components/FloatingPreferencesButton.tsx
1350
- import CookieOutlined from "@mui/icons-material/CookieOutlined";
1351
- import Fab from "@mui/material/Fab";
1352
- import Tooltip from "@mui/material/Tooltip";
1353
- import { useTheme } from "@mui/material/styles";
1354
- import { jsx as jsx5 } from "react/jsx-runtime";
1355
- function useThemeWithFallbacks() {
1356
- const theme = useTheme();
1357
- logger.themeCompatibility(theme);
1358
- return {
1359
- palette: {
1360
- primary: {
1361
- main: theme?.palette?.primary?.main || "#1976d2",
1362
- dark: theme?.palette?.primary?.dark || "#1565c0"
1363
- }
1364
- },
1365
- transitions: {
1366
- duration: {
1367
- shortest: theme?.transitions?.duration?.shortest || 150,
1368
- short: theme?.transitions?.duration?.short || 250
1369
- }
1370
- }
1371
- };
1372
- }
1373
- function FloatingPreferencesButton({
1374
- position = "bottom-right",
1375
- offset = 24,
1376
- icon = /* @__PURE__ */ jsx5(CookieOutlined, {}),
1377
- tooltip,
1378
- FabProps,
1379
- hideWhenConsented = false
1380
- }) {
1381
- const { openPreferences, consented } = useConsent();
1382
- const texts = useConsentTexts();
1383
- const safeTheme = useThemeWithFallbacks();
1384
- const designTokens = useDesignTokens();
1385
- logger.componentRender("FloatingPreferencesButton", {
1386
- position,
1387
- offset,
1388
- hideWhenConsented,
1389
- consented
1390
- });
1391
- if (hideWhenConsented && consented) {
1392
- logger.debug(
1393
- "FloatingPreferencesButton: Hidden due to hideWhenConsented=true and consented=true"
1394
- );
1395
- return null;
1396
- }
1397
- const tooltipText = tooltip ?? texts.preferencesButton ?? "Gerenciar Prefer\xEAncias de Cookies";
1398
- const getPosition = () => {
1399
- const styles = {
1400
- position: "fixed",
1401
- zIndex: 1200
1402
- };
1403
- switch (position) {
1404
- case "bottom-left":
1405
- return { ...styles, bottom: offset, left: offset };
1406
- case "bottom-right":
1407
- return { ...styles, bottom: offset, right: offset };
1408
- case "top-left":
1409
- return { ...styles, top: offset, left: offset };
1410
- case "top-right":
1411
- return { ...styles, top: offset, right: offset };
1412
- default:
1413
- return { ...styles, bottom: offset, right: offset };
1414
- }
1415
- };
1416
- return /* @__PURE__ */ jsx5(Tooltip, { title: tooltipText, placement: "top", children: /* @__PURE__ */ jsx5(
1417
- Fab,
1418
- {
1419
- size: "medium",
1420
- color: "primary",
1421
- onClick: openPreferences,
1422
- sx: {
1423
- ...getPosition(),
1424
- backgroundColor: designTokens?.colors?.primary ?? safeTheme.palette.primary.main,
1425
- "&:hover": {
1426
- backgroundColor: designTokens?.colors?.primary ? designTokens?.colors?.primary : safeTheme.palette.primary.dark
1427
- },
1428
- transition: `all ${safeTheme.transitions.duration.short}ms`
1429
- },
1430
- "aria-label": tooltipText,
1431
- ...FabProps,
1432
- children: icon
1433
- }
1434
- ) });
1435
- }
1436
-
1437
- // src/context/ConsentContext.tsx
1438
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1439
1374
  var PreferencesModal = React4.lazy(
1440
- () => import("./PreferencesModal-RNRD3JKB.js").then((m) => ({
1375
+ () => import('./PreferencesModal-5KNHWW57.js').then((m) => ({
1441
1376
  default: m.PreferencesModal
1442
1377
  }))
1443
1378
  );
1379
+ var FloatingPreferencesButton = React4.lazy(
1380
+ () => import('./FloatingPreferencesButton-IY7TFD7D.js').then((m) => ({
1381
+ default: m.FloatingPreferencesButton
1382
+ }))
1383
+ );
1444
1384
  function createFullConsentState(consented, preferences, source, projectConfig, isModalOpen = false, existingState) {
1445
1385
  const now = (/* @__PURE__ */ new Date()).toISOString();
1446
1386
  return {
@@ -1589,8 +1529,19 @@ function ConsentProvider({
1589
1529
  );
1590
1530
  const mergedTheme = theme;
1591
1531
  const finalCategoriesConfig = React4.useMemo(() => {
1592
- if (categories) return categories;
1593
- return DEFAULT_PROJECT_CATEGORIES;
1532
+ const isProd = typeof process !== "undefined" && process.env?.NODE_ENV === "production";
1533
+ if (!categories) return DEFAULT_PROJECT_CATEGORIES;
1534
+ if (isProd) return categories;
1535
+ const { sanitized } = validateConsentProviderProps({ categories });
1536
+ return sanitized.categories ?? categories;
1537
+ }, [categories]);
1538
+ React4.useEffect(() => {
1539
+ const isProd = typeof process !== "undefined" && process.env?.NODE_ENV === "production";
1540
+ if (!isProd && !categories) {
1541
+ logger.warn(
1542
+ "Prop 'categories' n\xE3o fornecida. A lib aplicar\xE1 um padr\xE3o seguro, mas recomenda-se definir 'categories.enabledCategories' explicitamente para clareza e auditoria."
1543
+ );
1544
+ }
1594
1545
  }, [categories]);
1595
1546
  useDeveloperGuidance(finalCategoriesConfig, disableDeveloperGuidance, guidanceConfig);
1596
1547
  React4.useEffect(() => {
@@ -1679,7 +1630,7 @@ function ConsentProvider({
1679
1630
  if (typeof backdrop === "string") return backdrop;
1680
1631
  return "rgba(0, 0, 0, 0.4)";
1681
1632
  }, [designTokens]);
1682
- const content = /* @__PURE__ */ jsx6(StateCtx.Provider, { value: state, children: /* @__PURE__ */ jsx6(ActionsCtx.Provider, { value: api, children: /* @__PURE__ */ jsx6(TextsCtx.Provider, { value: texts, children: /* @__PURE__ */ jsx6(HydrationCtx.Provider, { value: isHydrated, children: /* @__PURE__ */ jsx6(DesignProvider, { tokens: designTokens, children: /* @__PURE__ */ jsxs3(
1633
+ 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(
1683
1634
  CategoriesProvider,
1684
1635
  {
1685
1636
  config: finalCategoriesConfig,
@@ -1687,7 +1638,7 @@ function ConsentProvider({
1687
1638
  disableDiscoveryLog,
1688
1639
  children: [
1689
1640
  children,
1690
- /* @__PURE__ */ jsx6(React4.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ jsx6(
1641
+ /* @__PURE__ */ jsx(React4.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ jsx(
1691
1642
  PreferencesModalComponent,
1692
1643
  {
1693
1644
  preferences: api.preferences,
@@ -1697,8 +1648,8 @@ function ConsentProvider({
1697
1648
  texts,
1698
1649
  ...preferencesModalProps
1699
1650
  }
1700
- ) : /* @__PURE__ */ jsx6(PreferencesModal, { hideBranding }) }),
1701
- blocking && isHydrated && !state.consented && blockingStrategy === "provider" && /* @__PURE__ */ jsx6(
1651
+ ) : /* @__PURE__ */ jsx(PreferencesModal, { hideBranding }) }),
1652
+ blocking && isHydrated && !state.consented && blockingStrategy === "provider" && /* @__PURE__ */ jsx(
1702
1653
  "div",
1703
1654
  {
1704
1655
  style: {
@@ -1714,7 +1665,7 @@ function ConsentProvider({
1714
1665
  "aria-hidden": true
1715
1666
  }
1716
1667
  ),
1717
- !state.consented && isHydrated && (CookieBannerComponent ? /* @__PURE__ */ jsx6(
1668
+ !state.consented && isHydrated && (CookieBannerComponent ? /* @__PURE__ */ jsx(
1718
1669
  CookieBannerComponent,
1719
1670
  {
1720
1671
  consented: api.consented,
@@ -1725,7 +1676,7 @@ function ConsentProvider({
1725
1676
  blocking,
1726
1677
  ...cookieBannerProps
1727
1678
  }
1728
- ) : /* @__PURE__ */ jsx6(
1679
+ ) : /* @__PURE__ */ jsx(
1729
1680
  CookieBanner,
1730
1681
  {
1731
1682
  blocking,
@@ -1733,7 +1684,7 @@ function ConsentProvider({
1733
1684
  ...cookieBannerProps
1734
1685
  }
1735
1686
  )),
1736
- state.consented && !disableFloatingPreferencesButton && (FloatingPreferencesButtonComponent ? /* @__PURE__ */ jsx6(
1687
+ state.consented && !disableFloatingPreferencesButton && /* @__PURE__ */ jsx(React4.Suspense, { fallback: null, children: FloatingPreferencesButtonComponent ? /* @__PURE__ */ jsx(
1737
1688
  FloatingPreferencesButtonComponent,
1738
1689
  {
1739
1690
  openPreferences: api.openPreferences,
@@ -1742,18 +1693,18 @@ function ConsentProvider({
1742
1693
  }
1743
1694
  ) : (
1744
1695
  // Encaminha `floatingPreferencesButtonProps` para o componente padrão
1745
- /* @__PURE__ */ jsx6(
1696
+ /* @__PURE__ */ jsx(
1746
1697
  FloatingPreferencesButton,
1747
1698
  {
1748
1699
  ...floatingPreferencesButtonProps ?? {}
1749
1700
  }
1750
1701
  )
1751
- ))
1702
+ ) })
1752
1703
  ]
1753
1704
  }
1754
1705
  ) }) }) }) }) });
1755
1706
  if (mergedTheme) {
1756
- return /* @__PURE__ */ jsx6(ThemeProvider, { theme: mergedTheme, children: content });
1707
+ return /* @__PURE__ */ jsx(ThemeProvider, { theme: mergedTheme, children: content });
1757
1708
  }
1758
1709
  return content;
1759
1710
  }
@@ -1824,199 +1775,66 @@ function openPreferencesModal() {
1824
1775
  );
1825
1776
  }
1826
1777
  }
1827
-
1828
- // src/components/PreferencesModal.tsx
1829
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1830
- function PreferencesModal2({
1831
- DialogProps: DialogProps2,
1832
- hideBranding = false
1778
+ var brandingStyles = {
1779
+ banner: {
1780
+ fontSize: "0.65rem",
1781
+ textAlign: "right",
1782
+ mt: 1,
1783
+ opacity: 0.7,
1784
+ fontStyle: "italic",
1785
+ width: "100%"
1786
+ },
1787
+ modal: {
1788
+ fontSize: "0.65rem",
1789
+ textAlign: "right",
1790
+ px: 3,
1791
+ pb: 1,
1792
+ opacity: 0.7,
1793
+ fontStyle: "italic",
1794
+ width: "100%"
1795
+ }
1796
+ };
1797
+ var linkStyles = {
1798
+ textDecoration: "none",
1799
+ fontWeight: 500,
1800
+ "&:hover": {
1801
+ textDecoration: "underline"
1802
+ }
1803
+ };
1804
+ var Branding = React4.memo(function Branding2({
1805
+ variant,
1806
+ hidden = false
1833
1807
  }) {
1834
- const { preferences, setPreferences, closePreferences, isModalOpen } = useConsent();
1835
1808
  const texts = useConsentTexts();
1836
1809
  const designTokens = useDesignTokens();
1837
- const { toggleableCategories, allCategories } = useCategories();
1838
- const [tempPreferences, setTempPreferences] = useState3(() => {
1839
- const initialPrefs = { necessary: true };
1840
- toggleableCategories.forEach((category) => {
1841
- initialPrefs[category.id] = preferences[category.id] ?? false;
1842
- });
1843
- return initialPrefs;
1844
- });
1845
- useEffect3(() => {
1846
- if (isModalOpen) {
1847
- const syncedPrefs = { necessary: true };
1848
- toggleableCategories.forEach((category) => {
1849
- syncedPrefs[category.id] = preferences[category.id] ?? false;
1850
- });
1851
- setTempPreferences(syncedPrefs);
1852
- }
1853
- }, [isModalOpen, preferences, toggleableCategories]);
1854
- const open = DialogProps2?.open ?? isModalOpen ?? false;
1855
- const handleSave = () => {
1856
- setPreferences(tempPreferences);
1857
- };
1858
- const handleCancel = () => {
1859
- setTempPreferences(preferences);
1860
- closePreferences();
1861
- };
1862
- const modalTitleSx = (theme) => ({
1863
- fontSize: designTokens?.typography?.fontSize?.modal ?? void 0,
1864
- color: designTokens?.colors?.text ?? theme.palette.text.primary
1865
- });
1866
- const modalContentSx = (theme) => ({
1867
- p: designTokens?.spacing?.padding?.modal ?? void 0,
1868
- backgroundColor: designTokens?.colors?.background ?? theme.palette.background.paper,
1869
- color: designTokens?.colors?.text ?? theme.palette.text.primary
1870
- });
1871
- return /* @__PURE__ */ jsxs4(Dialog, { "aria-labelledby": "cookie-pref-title", open, onClose: handleCancel, ...DialogProps2, children: [
1872
- /* @__PURE__ */ jsx7(DialogTitle, { id: "cookie-pref-title", sx: modalTitleSx, children: texts.modalTitle }),
1873
- /* @__PURE__ */ jsxs4(DialogContent, { dividers: true, sx: modalContentSx, children: [
1874
- /* @__PURE__ */ jsx7(
1875
- Typography3,
1876
- {
1877
- variant: "body2",
1878
- sx: (theme) => ({
1879
- mb: 2,
1880
- fontSize: designTokens?.typography?.fontSize?.modal ?? void 0,
1881
- color: designTokens?.colors?.text ?? theme.palette.text.primary
1882
- }),
1883
- children: texts.modalIntro
1884
- }
1885
- ),
1886
- /* @__PURE__ */ jsxs4(FormGroup, { children: [
1887
- toggleableCategories.map((category) => {
1888
- const full = allCategories.find((c) => c.id === category.id);
1889
- const namesFromGuidance = full?.cookies ?? [];
1890
- const used = globalThis.__LGPD_USED_INTEGRATIONS__ || [];
1891
- const descriptors = getCookiesInfoForCategory(category.id, used);
1892
- const enrichedDescriptors = descriptors.map((desc) => {
1893
- if (desc.purpose && desc.duration && desc.provider) {
1894
- return desc;
1895
- }
1896
- return {
1897
- name: desc.name,
1898
- purpose: desc.purpose || "-",
1899
- duration: desc.duration || "-",
1900
- provider: desc.provider || "-"
1901
- };
1902
- });
1903
- const merged = [
1904
- ...enrichedDescriptors,
1905
- ...namesFromGuidance.filter((n) => !enrichedDescriptors.find((d) => d.name === n)).map((n) => ({ name: n, purpose: "-", duration: "-", provider: "-" }))
1906
- ];
1907
- let mergedFinal = merged;
1908
- try {
1909
- if (merged.length === 0) {
1910
- const gmap = globalThis.__LGPD_INTEGRATIONS_MAP__ || {};
1911
- const scriptRows = Object.entries(gmap).filter(([, cat]) => cat === category.id).map(([id]) => ({
1912
- name: `(script) ${id}`,
1913
- purpose: "Script de integra\xE7\xE3o ativo",
1914
- duration: "-",
1915
- provider: "-"
1916
- }));
1917
- if (scriptRows.length > 0) mergedFinal = scriptRows;
1918
- }
1919
- } catch {
1810
+ if (hidden) return null;
1811
+ return /* @__PURE__ */ jsxs(
1812
+ Typography,
1813
+ {
1814
+ variant: "caption",
1815
+ sx: (theme) => ({
1816
+ ...brandingStyles[variant],
1817
+ color: designTokens?.colors?.text ?? theme.palette.text.secondary
1818
+ }),
1819
+ children: [
1820
+ texts.brandingPoweredBy || "fornecido por",
1821
+ " ",
1822
+ /* @__PURE__ */ jsx(
1823
+ Link,
1824
+ {
1825
+ href: "https://www.ledipo.eti.br",
1826
+ target: "_blank",
1827
+ rel: "noopener noreferrer",
1828
+ sx: (theme) => ({
1829
+ ...linkStyles,
1830
+ color: designTokens?.colors?.primary ?? theme.palette.primary.main
1831
+ }),
1832
+ children: "L\xC9dipO.eti.br"
1920
1833
  }
1921
- return /* @__PURE__ */ jsxs4(Box2, { sx: { mb: 1 }, children: [
1922
- /* @__PURE__ */ jsx7(
1923
- FormControlLabel,
1924
- {
1925
- control: /* @__PURE__ */ jsx7(
1926
- Switch,
1927
- {
1928
- checked: tempPreferences[category.id] ?? false,
1929
- onChange: (e) => setTempPreferences((prev) => ({
1930
- ...prev,
1931
- [category.id]: e.target.checked
1932
- }))
1933
- }
1934
- ),
1935
- label: `${category.name} - ${category.description}`
1936
- }
1937
- ),
1938
- /* @__PURE__ */ jsxs4("details", { style: { marginLeft: 48 }, children: [
1939
- /* @__PURE__ */ jsx7("summary", { children: "Ver detalhes" }),
1940
- /* @__PURE__ */ jsx7(Box2, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxs4("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
1941
- /* @__PURE__ */ jsx7("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
1942
- /* @__PURE__ */ jsx7("th", { style: { textAlign: "left" }, children: "Cookie" }),
1943
- /* @__PURE__ */ jsx7("th", { style: { textAlign: "left" }, children: "Finalidade" }),
1944
- /* @__PURE__ */ jsx7("th", { style: { textAlign: "left" }, children: "Dura\xE7\xE3o" }),
1945
- /* @__PURE__ */ jsx7("th", { style: { textAlign: "left" }, children: "Fornecedor" })
1946
- ] }) }),
1947
- /* @__PURE__ */ jsx7("tbody", { children: mergedFinal.map((d, idx) => /* @__PURE__ */ jsxs4("tr", { children: [
1948
- /* @__PURE__ */ jsx7("td", { children: d.name }),
1949
- /* @__PURE__ */ jsx7("td", { children: d.purpose }),
1950
- /* @__PURE__ */ jsx7("td", { children: d.duration }),
1951
- /* @__PURE__ */ jsx7("td", { children: d.provider })
1952
- ] }, d.name + idx)) })
1953
- ] }) })
1954
- ] })
1955
- ] }, category.id);
1956
- }),
1957
- /* @__PURE__ */ jsx7(FormControlLabel, { control: /* @__PURE__ */ jsx7(Switch, { checked: true, disabled: true }), label: texts.necessaryAlwaysOn }),
1958
- /* @__PURE__ */ jsxs4("details", { style: { marginLeft: 48 }, children: [
1959
- /* @__PURE__ */ jsx7("summary", { children: "Ver detalhes" }),
1960
- /* @__PURE__ */ jsx7(Box2, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxs4("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
1961
- /* @__PURE__ */ jsx7("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
1962
- /* @__PURE__ */ jsx7("th", { style: { textAlign: "left" }, children: "Cookie" }),
1963
- /* @__PURE__ */ jsx7("th", { style: { textAlign: "left" }, children: "Finalidade" }),
1964
- /* @__PURE__ */ jsx7("th", { style: { textAlign: "left" }, children: "Dura\xE7\xE3o" }),
1965
- /* @__PURE__ */ jsx7("th", { style: { textAlign: "left" }, children: "Fornecedor" })
1966
- ] }) }),
1967
- /* @__PURE__ */ jsx7("tbody", { children: (() => {
1968
- const used = globalThis.__LGPD_USED_INTEGRATIONS__ || [];
1969
- const necessaryCookies = getCookiesInfoForCategory(
1970
- "necessary",
1971
- used
1972
- );
1973
- return necessaryCookies.map((d, idx) => /* @__PURE__ */ jsxs4("tr", { children: [
1974
- /* @__PURE__ */ jsx7("td", { children: d.name }),
1975
- /* @__PURE__ */ jsx7("td", { children: d.purpose || "-" }),
1976
- /* @__PURE__ */ jsx7("td", { children: d.duration || "-" }),
1977
- /* @__PURE__ */ jsx7("td", { children: d.provider || "-" })
1978
- ] }, d.name + idx));
1979
- })() })
1980
- ] }) })
1981
- ] })
1982
- ] })
1983
- ] }),
1984
- /* @__PURE__ */ jsxs4(DialogActions, { children: [
1985
- /* @__PURE__ */ jsx7(Button2, { variant: "outlined", onClick: handleCancel, children: texts.close }),
1986
- /* @__PURE__ */ jsx7(Button2, { variant: "contained", onClick: handleSave, children: texts.save })
1987
- ] }),
1988
- !hideBranding && /* @__PURE__ */ jsx7(Branding, { variant: "modal" })
1989
- ] });
1990
- }
1834
+ )
1835
+ ]
1836
+ }
1837
+ );
1838
+ });
1991
1839
 
1992
- export {
1993
- setCookieCatalogOverrides,
1994
- setCookieCategoryOverrides,
1995
- getCookiesInfoForCategory,
1996
- discoverRuntimeCookies,
1997
- detectConsentCookieName,
1998
- categorizeDiscoveredCookies,
1999
- LogLevel,
2000
- logger,
2001
- setDebugLogging,
2002
- DEFAULT_PROJECT_CATEGORIES,
2003
- analyzeDeveloperConfiguration,
2004
- logDeveloperGuidance,
2005
- useDeveloperGuidance,
2006
- GUIDANCE_PRESETS,
2007
- useCategories,
2008
- useCategoryStatus,
2009
- createProjectPreferences,
2010
- validateProjectPreferences,
2011
- getAllProjectCategories,
2012
- CookieBanner,
2013
- FloatingPreferencesButton,
2014
- ConsentProvider,
2015
- defaultTexts,
2016
- useConsent,
2017
- useConsentTexts,
2018
- useConsentHydration,
2019
- useOpenPreferencesModal,
2020
- openPreferencesModal,
2021
- PreferencesModal2 as PreferencesModal
2022
- };
1840
+ export { Branding, ConsentProvider, CookieBanner, DEFAULT_PROJECT_CATEGORIES, GUIDANCE_PRESETS, LogLevel, analyzeDeveloperConfiguration, categorizeDiscoveredCookies, createProjectPreferences, defaultTexts, detectConsentCookieName, discoverRuntimeCookies, getAllProjectCategories, getCookiesInfoForCategory, logDeveloperGuidance, logger, openPreferencesModal, setCookieCatalogOverrides, setCookieCategoryOverrides, setDebugLogging, useCategories, useCategoryStatus, useConsent, useConsentHydration, useConsentTexts, useDesignTokens, useDeveloperGuidance, useOpenPreferencesModal, validateProjectPreferences };