react-lgpd-consent 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -232,24 +232,220 @@ var init_CategoriesContext = __esm({
232
232
  }
233
233
  });
234
234
 
235
+ // src/utils/SafeThemeProvider.tsx
236
+ function SafeThemeProvider({
237
+ theme,
238
+ children
239
+ }) {
240
+ const safeTheme = React3.useMemo(() => createSafeTheme(theme), [theme]);
241
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_styles.ThemeProvider, { theme: safeTheme, children });
242
+ }
243
+ var React3, import_styles, import_jsx_runtime2, createSafeTheme;
244
+ var init_SafeThemeProvider = __esm({
245
+ "src/utils/SafeThemeProvider.tsx"() {
246
+ "use strict";
247
+ React3 = __toESM(require("react"), 1);
248
+ import_styles = require("@mui/material/styles");
249
+ import_jsx_runtime2 = require("react/jsx-runtime");
250
+ createSafeTheme = (userTheme) => {
251
+ const baseTheme = (0, import_styles.createTheme)({
252
+ palette: {
253
+ primary: {
254
+ main: "#1976d2",
255
+ dark: "#1565c0",
256
+ light: "#42a5f5",
257
+ contrastText: "#ffffff"
258
+ },
259
+ secondary: {
260
+ main: "#dc004e",
261
+ dark: "#9a0036",
262
+ light: "#e33371",
263
+ contrastText: "#ffffff"
264
+ },
265
+ background: {
266
+ default: "#fafafa",
267
+ paper: "#ffffff"
268
+ },
269
+ text: {
270
+ primary: "#333333",
271
+ secondary: "#666666"
272
+ }
273
+ },
274
+ transitions: {
275
+ duration: {
276
+ shortest: 150,
277
+ shorter: 200,
278
+ short: 250,
279
+ standard: 300,
280
+ complex: 375,
281
+ enteringScreen: 225,
282
+ leavingScreen: 195
283
+ }
284
+ }
285
+ });
286
+ if (!userTheme) {
287
+ return baseTheme;
288
+ }
289
+ return (0, import_styles.createTheme)({
290
+ ...baseTheme,
291
+ ...userTheme,
292
+ palette: {
293
+ ...baseTheme.palette,
294
+ ...userTheme.palette,
295
+ primary: {
296
+ ...baseTheme.palette.primary,
297
+ ...userTheme.palette?.primary
298
+ },
299
+ secondary: {
300
+ ...baseTheme.palette.secondary,
301
+ ...userTheme.palette?.secondary
302
+ },
303
+ background: {
304
+ ...baseTheme.palette.background,
305
+ ...userTheme.palette?.background
306
+ },
307
+ text: {
308
+ ...baseTheme.palette.text,
309
+ ...userTheme.palette?.text
310
+ }
311
+ },
312
+ transitions: {
313
+ ...baseTheme.transitions,
314
+ ...userTheme.transitions,
315
+ duration: {
316
+ ...baseTheme.transitions.duration,
317
+ ...userTheme.transitions?.duration
318
+ }
319
+ }
320
+ });
321
+ };
322
+ }
323
+ });
324
+
325
+ // src/utils/logger.ts
326
+ function setDebugLogging(enabled, level = 2 /* INFO */) {
327
+ logger.setEnabled(enabled);
328
+ logger.setLevel(level);
329
+ logger.info(
330
+ `Debug logging ${enabled ? "enabled" : "disabled"} with level ${LogLevel[level]}`
331
+ );
332
+ }
333
+ var IS_DEVELOPMENT, LOG_PREFIX, LogLevel, ConsentLogger, logger;
334
+ var init_logger = __esm({
335
+ "src/utils/logger.ts"() {
336
+ "use strict";
337
+ IS_DEVELOPMENT = typeof window !== "undefined" && window.__REACT_DEVTOOLS_GLOBAL_HOOK__ || typeof globalThis !== "undefined" && globalThis.process?.env?.NODE_ENV === "development";
338
+ LOG_PREFIX = "[react-lgpd-consent]";
339
+ LogLevel = /* @__PURE__ */ ((LogLevel2) => {
340
+ LogLevel2[LogLevel2["ERROR"] = 0] = "ERROR";
341
+ LogLevel2[LogLevel2["WARN"] = 1] = "WARN";
342
+ LogLevel2[LogLevel2["INFO"] = 2] = "INFO";
343
+ LogLevel2[LogLevel2["DEBUG"] = 3] = "DEBUG";
344
+ return LogLevel2;
345
+ })(LogLevel || {});
346
+ ConsentLogger = class {
347
+ constructor() {
348
+ this.enabled = IS_DEVELOPMENT;
349
+ this.level = 2 /* INFO */;
350
+ }
351
+ setEnabled(enabled) {
352
+ this.enabled = enabled;
353
+ }
354
+ setLevel(level) {
355
+ this.level = level;
356
+ }
357
+ error(...args) {
358
+ if (this.enabled && this.level >= 0 /* ERROR */) {
359
+ console.error(LOG_PREFIX, "[ERROR]", ...args);
360
+ }
361
+ }
362
+ warn(...args) {
363
+ if (this.enabled && this.level >= 1 /* WARN */) {
364
+ console.warn(LOG_PREFIX, "[WARN]", ...args);
365
+ }
366
+ }
367
+ info(...args) {
368
+ if (this.enabled && this.level >= 2 /* INFO */) {
369
+ console.info(LOG_PREFIX, "[INFO]", ...args);
370
+ }
371
+ }
372
+ debug(...args) {
373
+ if (this.enabled && this.level >= 3 /* DEBUG */) {
374
+ console.debug(LOG_PREFIX, "[DEBUG]", ...args);
375
+ }
376
+ }
377
+ // Logs específicos para troubleshooting
378
+ themeCompatibility(themeInfo) {
379
+ this.debug("Theme compatibility check:", {
380
+ hasTheme: !!themeInfo,
381
+ hasPalette: !!themeInfo?.palette,
382
+ hasPrimary: !!themeInfo?.palette?.primary,
383
+ hasTransitions: !!themeInfo?.transitions,
384
+ hasDuration: !!themeInfo?.transitions?.duration
385
+ });
386
+ }
387
+ consentState(action, state) {
388
+ this.debug(`Consent state change [${action}]:`, {
389
+ consented: state.consented,
390
+ isModalOpen: state.isModalOpen,
391
+ preferencesCount: Object.keys(state.preferences || {}).length
392
+ });
393
+ }
394
+ cookieOperation(operation, cookieName, data) {
395
+ this.debug(`Cookie ${operation}:`, {
396
+ name: cookieName,
397
+ hasData: !!data,
398
+ dataSize: data ? JSON.stringify(data).length : 0
399
+ });
400
+ }
401
+ componentRender(componentName, props) {
402
+ this.debug(`Component render [${componentName}]:`, {
403
+ hasProps: !!props,
404
+ propsKeys: props ? Object.keys(props) : []
405
+ });
406
+ }
407
+ scriptIntegration(scriptName, action, success) {
408
+ this.info(
409
+ `Script ${action} [${scriptName}]:`,
410
+ success ? "SUCCESS" : "FAILED"
411
+ );
412
+ }
413
+ apiUsage(method, params) {
414
+ this.debug(`API call [${method}]:`, params);
415
+ }
416
+ };
417
+ logger = new ConsentLogger();
418
+ }
419
+ });
420
+
235
421
  // src/utils/cookieUtils.ts
236
422
  function readConsentCookie(name = DEFAULT_COOKIE_OPTS.name) {
237
- if (typeof document === "undefined") return null;
423
+ logger.debug("Reading consent cookie", { name });
424
+ if (typeof document === "undefined") {
425
+ logger.debug("Cookie read skipped: server-side environment");
426
+ return null;
427
+ }
238
428
  const raw = import_js_cookie.default.get(name);
239
- if (!raw) return null;
429
+ if (!raw) {
430
+ logger.debug("No consent cookie found");
431
+ return null;
432
+ }
240
433
  try {
241
434
  const data = JSON.parse(raw);
435
+ logger.cookieOperation("read", name, data);
242
436
  if (!data.version) {
437
+ logger.debug("Migrating legacy cookie format");
243
438
  return migrateLegacyCookie(data);
244
439
  }
245
440
  if (data.version !== COOKIE_SCHEMA_VERSION) {
246
- console.warn(
247
- `[react-lgpd-consent] Cookie version mismatch: ${data.version} != ${COOKIE_SCHEMA_VERSION}`
441
+ logger.warn(
442
+ `Cookie version mismatch: ${data.version} != ${COOKIE_SCHEMA_VERSION}`
248
443
  );
249
444
  return null;
250
445
  }
251
446
  return data;
252
- } catch {
447
+ } catch (error) {
448
+ logger.error("Error parsing consent cookie", error);
253
449
  return null;
254
450
  }
255
451
  }
@@ -273,7 +469,10 @@ function migrateLegacyCookie(legacyData) {
273
469
  }
274
470
  }
275
471
  function writeConsentCookie(state, config, opts, source = "banner") {
276
- if (typeof document === "undefined") return;
472
+ if (typeof document === "undefined") {
473
+ logger.debug("Cookie write skipped: server-side environment");
474
+ return;
475
+ }
277
476
  const now = (/* @__PURE__ */ new Date()).toISOString();
278
477
  const o = { ...DEFAULT_COOKIE_OPTS, ...opts };
279
478
  const cookieData = {
@@ -287,23 +486,35 @@ function writeConsentCookie(state, config, opts, source = "banner") {
287
486
  projectConfig: config
288
487
  // isModalOpen NÃO é persistido (campo de UI apenas)
289
488
  };
489
+ logger.cookieOperation("write", o.name, cookieData);
290
490
  import_js_cookie.default.set(o.name, JSON.stringify(cookieData), {
291
491
  expires: o.maxAgeDays,
292
492
  sameSite: o.sameSite,
293
493
  secure: o.secure,
294
494
  path: o.path
295
495
  });
496
+ logger.info("Consent cookie saved", {
497
+ consented: cookieData.consented,
498
+ source: cookieData.source,
499
+ preferencesCount: Object.keys(cookieData.preferences).length
500
+ });
296
501
  }
297
502
  function removeConsentCookie(opts) {
298
- if (typeof document === "undefined") return;
503
+ if (typeof document === "undefined") {
504
+ logger.debug("Cookie removal skipped: server-side environment");
505
+ return;
506
+ }
299
507
  const o = { ...DEFAULT_COOKIE_OPTS, ...opts };
508
+ logger.cookieOperation("delete", o.name);
300
509
  import_js_cookie.default.remove(o.name, { path: o.path });
510
+ logger.info("Consent cookie removed");
301
511
  }
302
512
  var import_js_cookie, DEFAULT_COOKIE_OPTS, COOKIE_SCHEMA_VERSION;
303
513
  var init_cookieUtils = __esm({
304
514
  "src/utils/cookieUtils.ts"() {
305
515
  "use strict";
306
516
  import_js_cookie = __toESM(require("js-cookie"), 1);
517
+ init_logger();
307
518
  DEFAULT_COOKIE_OPTS = {
308
519
  name: "cookieConsent",
309
520
  maxAgeDays: 365,
@@ -349,12 +560,12 @@ var init_categoryUtils = __esm({
349
560
  });
350
561
 
351
562
  // src/utils/theme.ts
352
- var import_styles, defaultConsentTheme;
563
+ var import_styles2, defaultConsentTheme;
353
564
  var init_theme = __esm({
354
565
  "src/utils/theme.ts"() {
355
566
  "use strict";
356
- import_styles = require("@mui/material/styles");
357
- defaultConsentTheme = (0, import_styles.createTheme)({
567
+ import_styles2 = require("@mui/material/styles");
568
+ defaultConsentTheme = (0, import_styles2.createTheme)({
358
569
  palette: {
359
570
  primary: {
360
571
  main: "#1976d2",
@@ -427,25 +638,26 @@ function DesignProvider({
427
638
  tokens,
428
639
  children
429
640
  }) {
430
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DesignContext.Provider, { value: tokens, children });
641
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DesignContext.Provider, { value: tokens, children });
431
642
  }
432
643
  function useDesignTokens() {
433
- return React3.useContext(DesignContext);
644
+ return React4.useContext(DesignContext);
434
645
  }
435
- var React3, import_jsx_runtime2, DesignContext;
646
+ var React4, import_jsx_runtime3, DesignContext;
436
647
  var init_DesignContext = __esm({
437
648
  "src/context/DesignContext.tsx"() {
438
649
  "use strict";
439
- React3 = __toESM(require("react"), 1);
440
- import_jsx_runtime2 = require("react/jsx-runtime");
441
- DesignContext = React3.createContext(void 0);
650
+ React4 = __toESM(require("react"), 1);
651
+ import_jsx_runtime3 = require("react/jsx-runtime");
652
+ DesignContext = React4.createContext(void 0);
442
653
  }
443
654
  });
444
655
 
445
656
  // src/components/Branding.tsx
446
657
  function Branding({ variant, hidden = false }) {
658
+ const texts = useConsentTexts();
447
659
  if (hidden) return null;
448
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
660
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
449
661
  import_Typography.default,
450
662
  {
451
663
  variant: "caption",
@@ -454,9 +666,9 @@ function Branding({ variant, hidden = false }) {
454
666
  color: theme.palette.text.secondary
455
667
  }),
456
668
  children: [
457
- "fornecido por",
669
+ texts.brandingPoweredBy || "fornecido por",
458
670
  " ",
459
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
671
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
460
672
  import_Link.default,
461
673
  {
462
674
  href: "https://www.ledipo.eti.br",
@@ -473,13 +685,14 @@ function Branding({ variant, hidden = false }) {
473
685
  }
474
686
  );
475
687
  }
476
- var import_Link, import_Typography, import_jsx_runtime3, brandingStyles, linkStyles;
688
+ var import_Link, import_Typography, import_jsx_runtime4, brandingStyles, linkStyles;
477
689
  var init_Branding = __esm({
478
690
  "src/components/Branding.tsx"() {
479
691
  "use strict";
692
+ init_useConsent();
480
693
  import_Link = __toESM(require("@mui/material/Link"), 1);
481
694
  import_Typography = __toESM(require("@mui/material/Typography"), 1);
482
- import_jsx_runtime3 = require("react/jsx-runtime");
695
+ import_jsx_runtime4 = require("react/jsx-runtime");
483
696
  brandingStyles = {
484
697
  banner: {
485
698
  fontSize: "0.65rem",
@@ -523,6 +736,13 @@ function CookieBanner({
523
736
  const isHydrated = useConsentHydration();
524
737
  const designTokens = useDesignTokens();
525
738
  const open = debug ? true : isHydrated && !consented;
739
+ logger.componentRender("CookieBanner", {
740
+ open,
741
+ consented,
742
+ isHydrated,
743
+ blocking,
744
+ hideBranding
745
+ });
526
746
  if (!open) return null;
527
747
  const bannerStyle = {
528
748
  p: designTokens?.spacing?.padding?.banner ?? 2,
@@ -533,8 +753,8 @@ function CookieBanner({
533
753
  borderRadius: designTokens?.spacing?.borderRadius?.banner,
534
754
  fontFamily: designTokens?.typography?.fontFamily
535
755
  };
536
- const bannerContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_Paper.default, { elevation: 3, sx: bannerStyle, ...PaperProps, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_Stack.default, { spacing: 1, children: [
537
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
756
+ const bannerContent = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Paper.default, { elevation: 3, sx: bannerStyle, ...PaperProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Stack.default, { spacing: 1, children: [
757
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
538
758
  import_Typography2.default,
539
759
  {
540
760
  variant: "body2",
@@ -542,7 +762,7 @@ function CookieBanner({
542
762
  children: [
543
763
  texts.bannerMessage,
544
764
  " ",
545
- policyLinkUrl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
765
+ policyLinkUrl && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
546
766
  import_Link2.default,
547
767
  {
548
768
  href: policyLinkUrl,
@@ -556,36 +776,45 @@ function CookieBanner({
556
776
  ]
557
777
  }
558
778
  ),
559
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
779
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
560
780
  import_Stack.default,
561
781
  {
562
782
  direction: { xs: "column", sm: "row" },
563
783
  spacing: 1,
564
784
  justifyContent: "flex-end",
565
785
  children: [
566
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
786
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
567
787
  import_Button.default,
568
788
  {
569
789
  variant: "outlined",
570
- onClick: rejectAll,
790
+ onClick: () => {
791
+ logger.apiUsage("rejectAll", { source: "banner" });
792
+ rejectAll();
793
+ },
571
794
  sx: { color: designTokens?.colors?.secondary },
572
795
  children: texts.declineAll
573
796
  }
574
797
  ),
575
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
798
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
576
799
  import_Button.default,
577
800
  {
578
801
  variant: "contained",
579
- onClick: acceptAll,
802
+ onClick: () => {
803
+ logger.apiUsage("acceptAll", { source: "banner" });
804
+ acceptAll();
805
+ },
580
806
  sx: { backgroundColor: designTokens?.colors?.primary },
581
807
  children: texts.acceptAll
582
808
  }
583
809
  ),
584
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
810
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
585
811
  import_Button.default,
586
812
  {
587
813
  variant: "text",
588
- onClick: openPreferences,
814
+ onClick: () => {
815
+ logger.apiUsage("openPreferences", { source: "banner" });
816
+ openPreferences();
817
+ },
589
818
  sx: { color: designTokens?.colors?.text },
590
819
  children: texts.preferences
591
820
  }
@@ -593,7 +822,7 @@ function CookieBanner({
593
822
  ]
594
823
  }
595
824
  ),
596
- !hideBranding && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Branding, { variant: "banner" })
825
+ !hideBranding && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Branding, { variant: "banner" })
597
826
  ] }) });
598
827
  const positionStyle = {
599
828
  position: "fixed",
@@ -605,8 +834,8 @@ function CookieBanner({
605
834
  p: 2
606
835
  };
607
836
  if (blocking) {
608
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
609
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
837
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
838
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
610
839
  import_Box.default,
611
840
  {
612
841
  sx: {
@@ -620,10 +849,10 @@ function CookieBanner({
620
849
  }
621
850
  }
622
851
  ),
623
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_Box.default, { sx: positionStyle, children: bannerContent })
852
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Box.default, { sx: positionStyle, children: bannerContent })
624
853
  ] });
625
854
  }
626
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
855
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
627
856
  import_Snackbar.default,
628
857
  {
629
858
  open,
@@ -636,7 +865,7 @@ function CookieBanner({
636
865
  }
637
866
  );
638
867
  }
639
- var import_Button, import_Box, import_Paper, import_Snackbar, import_Stack, import_Typography2, import_Link2, import_jsx_runtime4;
868
+ var import_Button, import_Box, import_Paper, import_Snackbar, import_Stack, import_Typography2, import_Link2, import_jsx_runtime5;
640
869
  var init_CookieBanner = __esm({
641
870
  "src/components/CookieBanner.tsx"() {
642
871
  "use strict";
@@ -650,25 +879,54 @@ var init_CookieBanner = __esm({
650
879
  init_useConsent();
651
880
  init_DesignContext();
652
881
  init_Branding();
653
- import_jsx_runtime4 = require("react/jsx-runtime");
882
+ init_logger();
883
+ import_jsx_runtime5 = require("react/jsx-runtime");
654
884
  }
655
885
  });
656
886
 
657
887
  // src/components/FloatingPreferencesButton.tsx
888
+ function useThemeWithFallbacks() {
889
+ const theme = (0, import_styles3.useTheme)();
890
+ logger.themeCompatibility(theme);
891
+ return {
892
+ palette: {
893
+ primary: {
894
+ main: theme?.palette?.primary?.main || "#1976d2",
895
+ dark: theme?.palette?.primary?.dark || "#1565c0"
896
+ }
897
+ },
898
+ transitions: {
899
+ duration: {
900
+ shortest: theme?.transitions?.duration?.shortest || 150,
901
+ short: theme?.transitions?.duration?.short || 250
902
+ }
903
+ }
904
+ };
905
+ }
658
906
  function FloatingPreferencesButton({
659
907
  position = "bottom-right",
660
908
  offset = 24,
661
- icon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_CookieOutlined.default, {}),
909
+ icon = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_CookieOutlined.default, {}),
662
910
  tooltip,
663
911
  FabProps,
664
912
  hideWhenConsented = false
665
913
  }) {
666
914
  const { openPreferences, consented } = useConsent();
667
- const theme = (0, import_styles2.useTheme)();
915
+ const texts = useConsentTexts();
916
+ const safeTheme = useThemeWithFallbacks();
917
+ logger.componentRender("FloatingPreferencesButton", {
918
+ position,
919
+ offset,
920
+ hideWhenConsented,
921
+ consented
922
+ });
668
923
  if (hideWhenConsented && consented) {
924
+ logger.debug(
925
+ "FloatingPreferencesButton: Hidden due to hideWhenConsented=true and consented=true"
926
+ );
669
927
  return null;
670
928
  }
671
- const tooltipText = tooltip ?? "Gerenciar Prefer\xEAncias de Cookies";
929
+ const tooltipText = tooltip ?? texts.preferencesButton ?? "Gerenciar Prefer\xEAncias de Cookies";
672
930
  const getPosition = () => {
673
931
  const styles = {
674
932
  position: "fixed",
@@ -687,7 +945,7 @@ function FloatingPreferencesButton({
687
945
  return { ...styles, bottom: offset, right: offset };
688
946
  }
689
947
  };
690
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Tooltip.default, { title: tooltipText, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
948
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Tooltip.default, { title: tooltipText, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
691
949
  import_Fab.default,
692
950
  {
693
951
  size: "medium",
@@ -695,10 +953,11 @@ function FloatingPreferencesButton({
695
953
  onClick: openPreferences,
696
954
  sx: {
697
955
  ...getPosition(),
698
- backgroundColor: theme.palette.primary.main,
956
+ backgroundColor: safeTheme.palette.primary.main,
699
957
  "&:hover": {
700
- backgroundColor: theme.palette.primary.dark
701
- }
958
+ backgroundColor: safeTheme.palette.primary.dark
959
+ },
960
+ transition: `all ${safeTheme.transitions.duration.short}ms`
702
961
  },
703
962
  "aria-label": tooltipText,
704
963
  ...FabProps,
@@ -706,16 +965,17 @@ function FloatingPreferencesButton({
706
965
  }
707
966
  ) });
708
967
  }
709
- var import_CookieOutlined, import_Fab, import_Tooltip, import_styles2, import_jsx_runtime5;
968
+ var import_CookieOutlined, import_Fab, import_Tooltip, import_styles3, import_jsx_runtime6;
710
969
  var init_FloatingPreferencesButton = __esm({
711
970
  "src/components/FloatingPreferencesButton.tsx"() {
712
971
  "use strict";
713
972
  import_CookieOutlined = __toESM(require("@mui/icons-material/CookieOutlined"), 1);
714
973
  import_Fab = __toESM(require("@mui/material/Fab"), 1);
715
974
  import_Tooltip = __toESM(require("@mui/material/Tooltip"), 1);
716
- import_styles2 = require("@mui/material/styles");
975
+ import_styles3 = require("@mui/material/styles");
717
976
  init_useConsent();
718
- import_jsx_runtime5 = require("react/jsx-runtime");
977
+ init_logger();
978
+ import_jsx_runtime6 = require("react/jsx-runtime");
719
979
  }
720
980
  });
721
981
 
@@ -734,10 +994,14 @@ function createFullConsentState(consented, preferences, source, projectConfig, i
734
994
  };
735
995
  }
736
996
  function reducer(state, action) {
997
+ log.debug("State transition:", {
998
+ action: action.type,
999
+ currentState: state.consented
1000
+ });
737
1001
  switch (action.type) {
738
1002
  case "ACCEPT_ALL": {
739
1003
  const prefs = createProjectPreferences(action.config, true);
740
- return createFullConsentState(
1004
+ const newState = createFullConsentState(
741
1005
  true,
742
1006
  prefs,
743
1007
  "banner",
@@ -745,10 +1009,14 @@ function reducer(state, action) {
745
1009
  false,
746
1010
  state
747
1011
  );
1012
+ log.info("User accepted all cookies", {
1013
+ preferences: newState.preferences
1014
+ });
1015
+ return newState;
748
1016
  }
749
1017
  case "REJECT_ALL": {
750
1018
  const prefs = createProjectPreferences(action.config, false);
751
- return createFullConsentState(
1019
+ const newState = createFullConsentState(
752
1020
  true,
753
1021
  prefs,
754
1022
  "banner",
@@ -756,8 +1024,16 @@ function reducer(state, action) {
756
1024
  false,
757
1025
  state
758
1026
  );
1027
+ log.info("User rejected all cookies", {
1028
+ preferences: newState.preferences
1029
+ });
1030
+ return newState;
759
1031
  }
760
1032
  case "SET_CATEGORY":
1033
+ log.debug("Category preference changed", {
1034
+ category: action.category,
1035
+ value: action.value
1036
+ });
761
1037
  return {
762
1038
  ...state,
763
1039
  preferences: {
@@ -767,6 +1043,7 @@ function reducer(state, action) {
767
1043
  lastUpdate: (/* @__PURE__ */ new Date()).toISOString()
768
1044
  };
769
1045
  case "SET_PREFERENCES":
1046
+ log.info("Preferences saved", { preferences: action.preferences });
770
1047
  return createFullConsentState(
771
1048
  true,
772
1049
  action.preferences,
@@ -833,24 +1110,24 @@ function ConsentProvider({
833
1110
  disableDeveloperGuidance,
834
1111
  children
835
1112
  }) {
836
- const texts = React4.useMemo(
1113
+ const texts = React5.useMemo(
837
1114
  () => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }),
838
1115
  [textsProp]
839
1116
  );
840
- const cookie = React4.useMemo(
1117
+ const cookie = React5.useMemo(
841
1118
  () => ({ ...DEFAULT_COOKIE_OPTS, ...cookieOpts ?? {} }),
842
1119
  [cookieOpts]
843
1120
  );
844
- const appliedTheme = React4.useMemo(
1121
+ const appliedTheme = React5.useMemo(
845
1122
  () => theme || defaultConsentTheme,
846
1123
  [theme]
847
1124
  );
848
- const finalCategoriesConfig = React4.useMemo(() => {
1125
+ const finalCategoriesConfig = React5.useMemo(() => {
849
1126
  if (categories) return categories;
850
1127
  return DEFAULT_PROJECT_CATEGORIES;
851
1128
  }, [categories]);
852
1129
  useDeveloperGuidance(finalCategoriesConfig, disableDeveloperGuidance);
853
- const boot = React4.useMemo(() => {
1130
+ const boot = React5.useMemo(() => {
854
1131
  if (initialState) return { ...initialState, isModalOpen: false };
855
1132
  return createFullConsentState(
856
1133
  false,
@@ -860,9 +1137,9 @@ function ConsentProvider({
860
1137
  false
861
1138
  );
862
1139
  }, [initialState, finalCategoriesConfig]);
863
- const [state, dispatch] = React4.useReducer(reducer, boot);
864
- const [isHydrated, setIsHydrated] = React4.useState(false);
865
- React4.useEffect(() => {
1140
+ const [state, dispatch] = React5.useReducer(reducer, boot);
1141
+ const [isHydrated, setIsHydrated] = React5.useState(false);
1142
+ React5.useEffect(() => {
866
1143
  if (!initialState) {
867
1144
  const saved = readConsentCookie(cookie.name);
868
1145
  if (saved?.consented) {
@@ -875,18 +1152,18 @@ function ConsentProvider({
875
1152
  }
876
1153
  setIsHydrated(true);
877
1154
  }, [cookie.name, initialState, finalCategoriesConfig]);
878
- React4.useEffect(() => {
1155
+ React5.useEffect(() => {
879
1156
  if (state.consented)
880
1157
  writeConsentCookie(state, finalCategoriesConfig, cookie);
881
1158
  }, [state, cookie, finalCategoriesConfig]);
882
- const prevConsented = React4.useRef(state.consented);
883
- React4.useEffect(() => {
1159
+ const prevConsented = React5.useRef(state.consented);
1160
+ React5.useEffect(() => {
884
1161
  if (!prevConsented.current && state.consented && onConsentGiven) {
885
1162
  setTimeout(() => onConsentGiven(state), 150);
886
1163
  }
887
1164
  prevConsented.current = state.consented;
888
1165
  }, [state, onConsentGiven]);
889
- const api = React4.useMemo(() => {
1166
+ const api = React5.useMemo(() => {
890
1167
  const acceptAll = () => dispatch({ type: "ACCEPT_ALL", config: finalCategoriesConfig });
891
1168
  const rejectAll = () => dispatch({ type: "REJECT_ALL", config: finalCategoriesConfig });
892
1169
  const setPreference = (category, value) => dispatch({ type: "SET_CATEGORY", category, value });
@@ -919,14 +1196,18 @@ function ConsentProvider({
919
1196
  resetConsent
920
1197
  };
921
1198
  }, [state, cookie, finalCategoriesConfig, onPreferencesSaved]);
922
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_styles3.ThemeProvider, { theme: appliedTheme, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StateCtx.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ActionsCtx.Provider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TextsCtx.Provider, { value: texts, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HydrationCtx.Provider, { value: isHydrated, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DesignProvider, { tokens: designTokens, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1199
+ React5.useEffect(() => {
1200
+ _registerGlobalOpenPreferences(api.openPreferences);
1201
+ return () => _unregisterGlobalOpenPreferences();
1202
+ }, [api.openPreferences]);
1203
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SafeThemeProvider, { theme: appliedTheme, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StateCtx.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ActionsCtx.Provider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TextsCtx.Provider, { value: texts, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HydrationCtx.Provider, { value: isHydrated, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DesignProvider, { tokens: designTokens, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
923
1204
  CategoriesProvider,
924
1205
  {
925
1206
  config: finalCategoriesConfig,
926
1207
  disableDeveloperGuidance,
927
1208
  children: [
928
1209
  children,
929
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(React4.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1210
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(React5.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
930
1211
  PreferencesModalComponent,
931
1212
  {
932
1213
  preferences: api.preferences,
@@ -936,8 +1217,8 @@ function ConsentProvider({
936
1217
  texts,
937
1218
  ...preferencesModalProps
938
1219
  }
939
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PreferencesModal, { hideBranding }) }),
940
- !state.consented && isHydrated && (CookieBannerComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1220
+ ) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PreferencesModal, { hideBranding }) }),
1221
+ !state.consented && isHydrated && (CookieBannerComponent ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
941
1222
  CookieBannerComponent,
942
1223
  {
943
1224
  consented: api.consented,
@@ -947,54 +1228,67 @@ function ConsentProvider({
947
1228
  texts,
948
1229
  ...cookieBannerProps
949
1230
  }
950
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CookieBanner, {})),
951
- state.consented && !disableFloatingPreferencesButton && (FloatingPreferencesButtonComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1231
+ ) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CookieBanner, {})),
1232
+ state.consented && !disableFloatingPreferencesButton && (FloatingPreferencesButtonComponent ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
952
1233
  FloatingPreferencesButtonComponent,
953
1234
  {
954
1235
  openPreferences: api.openPreferences,
955
1236
  consented: api.consented,
956
1237
  ...floatingPreferencesButtonProps
957
1238
  }
958
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FloatingPreferencesButton, {}))
1239
+ ) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FloatingPreferencesButton, {}))
959
1240
  ]
960
1241
  }
961
1242
  ) }) }) }) }) }) });
962
1243
  }
963
1244
  function useConsentStateInternal() {
964
- const ctx = React4.useContext(StateCtx);
1245
+ const ctx = React5.useContext(StateCtx);
965
1246
  if (!ctx)
966
1247
  throw new Error("useConsentState must be used within ConsentProvider");
967
1248
  return ctx;
968
1249
  }
969
1250
  function useConsentActionsInternal() {
970
- const ctx = React4.useContext(ActionsCtx);
1251
+ const ctx = React5.useContext(ActionsCtx);
971
1252
  if (!ctx)
972
1253
  throw new Error("useConsentActions must be used within ConsentProvider");
973
1254
  return ctx;
974
1255
  }
975
1256
  function useConsentTextsInternal() {
976
- const ctx = React4.useContext(TextsCtx);
1257
+ const ctx = React5.useContext(TextsCtx);
977
1258
  return ctx;
978
1259
  }
979
1260
  function useConsentHydrationInternal() {
980
- return React4.useContext(HydrationCtx);
1261
+ return React5.useContext(HydrationCtx);
981
1262
  }
982
- var React4, import_styles3, import_jsx_runtime6, PreferencesModal, DEFAULT_TEXTS, StateCtx, ActionsCtx, TextsCtx, HydrationCtx;
1263
+ var React5, import_jsx_runtime7, log, PreferencesModal, DEFAULT_TEXTS, StateCtx, ActionsCtx, TextsCtx, HydrationCtx;
983
1264
  var init_ConsentContext = __esm({
984
1265
  "src/context/ConsentContext.tsx"() {
985
1266
  "use strict";
986
- React4 = __toESM(require("react"), 1);
987
- import_styles3 = require("@mui/material/styles");
1267
+ React5 = __toESM(require("react"), 1);
1268
+ init_SafeThemeProvider();
988
1269
  init_cookieUtils();
989
1270
  init_categoryUtils();
990
1271
  init_theme();
991
1272
  init_CategoriesContext();
992
1273
  init_DesignContext();
993
1274
  init_developerGuidance();
1275
+ init_useConsent();
994
1276
  init_CookieBanner();
995
1277
  init_FloatingPreferencesButton();
996
- import_jsx_runtime6 = require("react/jsx-runtime");
997
- PreferencesModal = React4.lazy(
1278
+ import_jsx_runtime7 = require("react/jsx-runtime");
1279
+ log = {
1280
+ debug: (message, data) => {
1281
+ if (typeof window !== "undefined" && window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
1282
+ console.debug("[react-lgpd-consent] [DEBUG]", message, data);
1283
+ }
1284
+ },
1285
+ info: (message, data) => {
1286
+ if (typeof window !== "undefined" && window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
1287
+ console.info("[react-lgpd-consent] [INFO]", message, data);
1288
+ }
1289
+ }
1290
+ };
1291
+ PreferencesModal = React5.lazy(
998
1292
  () => Promise.resolve().then(() => (init_PreferencesModal(), PreferencesModal_exports)).then((m) => ({
999
1293
  default: m.PreferencesModal
1000
1294
  }))
@@ -1010,7 +1304,15 @@ var init_ConsentContext = __esm({
1010
1304
  modalIntro: "Ajuste as categorias de cookies. Cookies necess\xE1rios s\xE3o sempre utilizados para funcionalidades b\xE1sicas.",
1011
1305
  save: "Salvar prefer\xEAncias",
1012
1306
  necessaryAlwaysOn: "Cookies necess\xE1rios (sempre ativos)",
1307
+ // Textos adicionais para UI customizada
1308
+ preferencesButton: "Configurar Cookies",
1309
+ preferencesTitle: "Gerenciar Prefer\xEAncias de Cookies",
1310
+ preferencesDescription: "Escolha quais tipos de cookies voc\xEA permite que sejam utilizados.",
1311
+ close: "Fechar",
1312
+ accept: "Aceitar",
1313
+ reject: "Rejeitar",
1013
1314
  // Textos ANPD expandidos (opcionais)
1315
+ brandingPoweredBy: "fornecido por",
1014
1316
  controllerInfo: void 0,
1015
1317
  // Exibido se definido
1016
1318
  dataTypes: void 0,
@@ -1028,10 +1330,10 @@ var init_ConsentContext = __esm({
1028
1330
  transferCountries: void 0
1029
1331
  // Exibido se definido
1030
1332
  };
1031
- StateCtx = React4.createContext(null);
1032
- ActionsCtx = React4.createContext(null);
1033
- TextsCtx = React4.createContext(DEFAULT_TEXTS);
1034
- HydrationCtx = React4.createContext(false);
1333
+ StateCtx = React5.createContext(null);
1334
+ ActionsCtx = React5.createContext(null);
1335
+ TextsCtx = React5.createContext(DEFAULT_TEXTS);
1336
+ HydrationCtx = React5.createContext(false);
1035
1337
  }
1036
1338
  });
1037
1339
 
@@ -1058,10 +1360,31 @@ function useConsentTexts() {
1058
1360
  function useConsentHydration() {
1059
1361
  return useConsentHydrationInternal();
1060
1362
  }
1363
+ function useOpenPreferencesModal() {
1364
+ const { openPreferences } = useConsent();
1365
+ return openPreferences;
1366
+ }
1367
+ function openPreferencesModal() {
1368
+ if (globalOpenPreferences) {
1369
+ globalOpenPreferences();
1370
+ } else {
1371
+ console.warn(
1372
+ "openPreferencesModal: ConsentProvider n\xE3o foi inicializado ou n\xE3o est\xE1 dispon\xEDvel."
1373
+ );
1374
+ }
1375
+ }
1376
+ function _registerGlobalOpenPreferences(openPreferences) {
1377
+ globalOpenPreferences = openPreferences;
1378
+ }
1379
+ function _unregisterGlobalOpenPreferences() {
1380
+ globalOpenPreferences = null;
1381
+ }
1382
+ var globalOpenPreferences;
1061
1383
  var init_useConsent = __esm({
1062
1384
  "src/hooks/useConsent.ts"() {
1063
1385
  "use strict";
1064
1386
  init_ConsentContext();
1387
+ globalOpenPreferences = null;
1065
1388
  }
1066
1389
  });
1067
1390
 
@@ -1103,7 +1426,7 @@ function PreferencesModal2({
1103
1426
  setTempPreferences(preferences);
1104
1427
  closePreferences();
1105
1428
  };
1106
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1429
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1107
1430
  import_Dialog.default,
1108
1431
  {
1109
1432
  "aria-labelledby": "cookie-pref-title",
@@ -1111,14 +1434,14 @@ function PreferencesModal2({
1111
1434
  onClose: handleCancel,
1112
1435
  ...DialogProps2,
1113
1436
  children: [
1114
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_DialogTitle.default, { id: "cookie-pref-title", children: texts.modalTitle }),
1115
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_DialogContent.default, { dividers: true, children: [
1116
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Typography3.default, { variant: "body2", sx: { mb: 2 }, children: texts.modalIntro }),
1117
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_FormGroup.default, { children: [
1118
- toggleableCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1437
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_DialogTitle.default, { id: "cookie-pref-title", children: texts.modalTitle }),
1438
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_DialogContent.default, { dividers: true, children: [
1439
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Typography3.default, { variant: "body2", sx: { mb: 2 }, children: texts.modalIntro }),
1440
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_FormGroup.default, { children: [
1441
+ toggleableCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1119
1442
  import_FormControlLabel.default,
1120
1443
  {
1121
- control: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1444
+ control: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1122
1445
  import_Switch.default,
1123
1446
  {
1124
1447
  checked: tempPreferences[category.id] ?? false,
@@ -1132,25 +1455,25 @@ function PreferencesModal2({
1132
1455
  },
1133
1456
  category.id
1134
1457
  )),
1135
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1458
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1136
1459
  import_FormControlLabel.default,
1137
1460
  {
1138
- control: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Switch.default, { checked: true, disabled: true }),
1461
+ control: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Switch.default, { checked: true, disabled: true }),
1139
1462
  label: texts.necessaryAlwaysOn
1140
1463
  }
1141
1464
  )
1142
1465
  ] })
1143
1466
  ] }),
1144
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_DialogActions.default, { children: [
1145
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Button2.default, { variant: "outlined", onClick: handleCancel, children: "Cancelar" }),
1146
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Button2.default, { variant: "contained", onClick: handleSave, children: texts.save })
1467
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_DialogActions.default, { children: [
1468
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Button2.default, { variant: "outlined", onClick: handleCancel, children: texts.close }),
1469
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Button2.default, { variant: "contained", onClick: handleSave, children: texts.save })
1147
1470
  ] }),
1148
- !hideBranding && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Branding, { variant: "modal" })
1471
+ !hideBranding && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Branding, { variant: "modal" })
1149
1472
  ]
1150
1473
  }
1151
1474
  );
1152
1475
  }
1153
- var import_Button2, import_Dialog, import_DialogActions, import_DialogContent, import_DialogTitle, import_FormControlLabel, import_FormGroup, import_Switch, import_Typography3, import_react, import_jsx_runtime7;
1476
+ var import_Button2, import_Dialog, import_DialogActions, import_DialogContent, import_DialogTitle, import_FormControlLabel, import_FormGroup, import_Switch, import_Typography3, import_react, import_jsx_runtime8;
1154
1477
  var init_PreferencesModal = __esm({
1155
1478
  "src/components/PreferencesModal.tsx"() {
1156
1479
  "use strict";
@@ -1167,7 +1490,7 @@ var init_PreferencesModal = __esm({
1167
1490
  init_CategoriesContext();
1168
1491
  init_useConsent();
1169
1492
  init_Branding();
1170
- import_jsx_runtime7 = require("react/jsx-runtime");
1493
+ import_jsx_runtime8 = require("react/jsx-runtime");
1171
1494
  }
1172
1495
  });
1173
1496
 
@@ -1179,6 +1502,7 @@ __export(index_exports, {
1179
1502
  ConsentProvider: () => ConsentProvider,
1180
1503
  ConsentScriptLoader: () => ConsentScriptLoader,
1181
1504
  DEFAULT_PROJECT_CATEGORIES: () => DEFAULT_PROJECT_CATEGORIES,
1505
+ LogLevel: () => LogLevel,
1182
1506
  PreferencesModal: () => PreferencesModal2,
1183
1507
  analyzeDeveloperConfiguration: () => analyzeDeveloperConfiguration,
1184
1508
  createGoogleAnalyticsIntegration: () => createGoogleAnalyticsIntegration,
@@ -1186,12 +1510,15 @@ __export(index_exports, {
1186
1510
  createUserWayIntegration: () => createUserWayIntegration,
1187
1511
  defaultConsentTheme: () => defaultConsentTheme,
1188
1512
  loadScript: () => loadScript,
1513
+ openPreferencesModal: () => openPreferencesModal,
1514
+ setDebugLogging: () => setDebugLogging,
1189
1515
  useCategories: () => useCategories,
1190
1516
  useCategoryStatus: () => useCategoryStatus,
1191
1517
  useConsent: () => useConsent,
1192
1518
  useConsentHydration: () => useConsentHydration,
1193
1519
  useConsentScriptLoader: () => useConsentScriptLoader,
1194
- useConsentTexts: () => useConsentTexts
1520
+ useConsentTexts: () => useConsentTexts,
1521
+ useOpenPreferencesModal: () => useOpenPreferencesModal
1195
1522
  });
1196
1523
  module.exports = __toCommonJS(index_exports);
1197
1524
  init_PreferencesModal();
@@ -1201,11 +1528,11 @@ init_CategoriesContext();
1201
1528
 
1202
1529
  // src/utils/ConsentGate.tsx
1203
1530
  init_useConsent();
1204
- var import_jsx_runtime8 = require("react/jsx-runtime");
1531
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1205
1532
  function ConsentGate(props) {
1206
1533
  const { preferences } = useConsent();
1207
1534
  if (!preferences[props.category]) return null;
1208
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: props.children });
1535
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: props.children });
1209
1536
  }
1210
1537
 
1211
1538
  // src/utils/scriptLoader.ts
@@ -1249,15 +1576,15 @@ function loadScript(id, src, category = null, attrs = {}) {
1249
1576
  init_theme();
1250
1577
 
1251
1578
  // src/utils/ConsentScriptLoader.tsx
1252
- var React5 = __toESM(require("react"), 1);
1579
+ var React6 = __toESM(require("react"), 1);
1253
1580
  init_useConsent();
1254
1581
  function ConsentScriptLoader({
1255
1582
  integrations,
1256
1583
  reloadOnChange = false
1257
1584
  }) {
1258
1585
  const { preferences, consented } = useConsent();
1259
- const loadedScripts = React5.useRef(/* @__PURE__ */ new Set());
1260
- React5.useEffect(() => {
1586
+ const loadedScripts = React6.useRef(/* @__PURE__ */ new Set());
1587
+ React6.useEffect(() => {
1261
1588
  if (!consented) return;
1262
1589
  integrations.forEach(async (integration) => {
1263
1590
  const shouldLoad = preferences[integration.category];
@@ -1285,7 +1612,7 @@ function ConsentScriptLoader({
1285
1612
  }
1286
1613
  function useConsentScriptLoader() {
1287
1614
  const { preferences, consented } = useConsent();
1288
- return React5.useCallback(
1615
+ return React6.useCallback(
1289
1616
  async (integration) => {
1290
1617
  if (!consented) {
1291
1618
  console.warn(
@@ -1382,6 +1709,7 @@ var COMMON_INTEGRATIONS = {
1382
1709
 
1383
1710
  // src/index.ts
1384
1711
  init_developerGuidance();
1712
+ init_logger();
1385
1713
  // Annotate the CommonJS export names for ESM import in node:
1386
1714
  0 && (module.exports = {
1387
1715
  COMMON_INTEGRATIONS,
@@ -1389,6 +1717,7 @@ init_developerGuidance();
1389
1717
  ConsentProvider,
1390
1718
  ConsentScriptLoader,
1391
1719
  DEFAULT_PROJECT_CATEGORIES,
1720
+ LogLevel,
1392
1721
  PreferencesModal,
1393
1722
  analyzeDeveloperConfiguration,
1394
1723
  createGoogleAnalyticsIntegration,
@@ -1396,10 +1725,13 @@ init_developerGuidance();
1396
1725
  createUserWayIntegration,
1397
1726
  defaultConsentTheme,
1398
1727
  loadScript,
1728
+ openPreferencesModal,
1729
+ setDebugLogging,
1399
1730
  useCategories,
1400
1731
  useCategoryStatus,
1401
1732
  useConsent,
1402
1733
  useConsentHydration,
1403
1734
  useConsentScriptLoader,
1404
- useConsentTexts
1735
+ useConsentTexts,
1736
+ useOpenPreferencesModal
1405
1737
  });