react-lgpd-consent 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -3
- package/LICENSE +21 -21
- package/QUICKSTART.en.md +245 -0
- package/QUICKSTART.md +617 -0
- package/README.en.md +86 -0
- package/README.md +46 -81
- package/dist/{PreferencesModal-HTTMUZND.js → PreferencesModal-KAZMVPBD.js} +1 -1
- package/dist/{chunk-GPLNN3FD.js → chunk-MHCQFGRJ.js} +131 -218
- package/dist/index.cjs +226 -253
- package/dist/index.d.cts +36 -6
- package/dist/index.d.ts +36 -6
- package/dist/index.js +73 -2
- package/package.json +33 -17
package/dist/index.cjs
CHANGED
|
@@ -211,93 +211,6 @@ var init_CategoriesContext = __esm({
|
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
-
// src/utils/SafeThemeProvider.tsx
|
|
215
|
-
function SafeThemeProvider({ theme, children }) {
|
|
216
|
-
const safeTheme = React3.useMemo(() => createSafeTheme(theme), [theme]);
|
|
217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_styles.ThemeProvider, { theme: safeTheme, children });
|
|
218
|
-
}
|
|
219
|
-
var React3, import_styles, import_jsx_runtime2, createSafeTheme;
|
|
220
|
-
var init_SafeThemeProvider = __esm({
|
|
221
|
-
"src/utils/SafeThemeProvider.tsx"() {
|
|
222
|
-
"use strict";
|
|
223
|
-
React3 = __toESM(require("react"), 1);
|
|
224
|
-
import_styles = require("@mui/material/styles");
|
|
225
|
-
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
226
|
-
createSafeTheme = (userTheme) => {
|
|
227
|
-
const baseTheme = (0, import_styles.createTheme)({
|
|
228
|
-
palette: {
|
|
229
|
-
primary: {
|
|
230
|
-
main: "#1976d2",
|
|
231
|
-
dark: "#1565c0",
|
|
232
|
-
light: "#42a5f5",
|
|
233
|
-
contrastText: "#ffffff"
|
|
234
|
-
},
|
|
235
|
-
secondary: {
|
|
236
|
-
main: "#dc004e",
|
|
237
|
-
dark: "#9a0036",
|
|
238
|
-
light: "#e33371",
|
|
239
|
-
contrastText: "#ffffff"
|
|
240
|
-
},
|
|
241
|
-
background: {
|
|
242
|
-
default: "#fafafa",
|
|
243
|
-
paper: "#ffffff"
|
|
244
|
-
},
|
|
245
|
-
text: {
|
|
246
|
-
primary: "#333333",
|
|
247
|
-
secondary: "#666666"
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
transitions: {
|
|
251
|
-
duration: {
|
|
252
|
-
shortest: 150,
|
|
253
|
-
shorter: 200,
|
|
254
|
-
short: 250,
|
|
255
|
-
standard: 300,
|
|
256
|
-
complex: 375,
|
|
257
|
-
enteringScreen: 225,
|
|
258
|
-
leavingScreen: 195
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
if (!userTheme) {
|
|
263
|
-
return baseTheme;
|
|
264
|
-
}
|
|
265
|
-
return (0, import_styles.createTheme)({
|
|
266
|
-
...baseTheme,
|
|
267
|
-
...userTheme,
|
|
268
|
-
palette: {
|
|
269
|
-
...baseTheme.palette,
|
|
270
|
-
...userTheme.palette,
|
|
271
|
-
primary: {
|
|
272
|
-
...baseTheme.palette.primary,
|
|
273
|
-
...userTheme.palette?.primary
|
|
274
|
-
},
|
|
275
|
-
secondary: {
|
|
276
|
-
...baseTheme.palette.secondary,
|
|
277
|
-
...userTheme.palette?.secondary
|
|
278
|
-
},
|
|
279
|
-
background: {
|
|
280
|
-
...baseTheme.palette.background,
|
|
281
|
-
...userTheme.palette?.background
|
|
282
|
-
},
|
|
283
|
-
text: {
|
|
284
|
-
...baseTheme.palette.text,
|
|
285
|
-
...userTheme.palette?.text
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
transitions: {
|
|
289
|
-
...baseTheme.transitions,
|
|
290
|
-
...userTheme.transitions,
|
|
291
|
-
duration: {
|
|
292
|
-
...baseTheme.transitions.duration,
|
|
293
|
-
...userTheme.transitions?.duration
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
|
|
301
214
|
// src/utils/logger.ts
|
|
302
215
|
function setDebugLogging(enabled, level = 2 /* INFO */) {
|
|
303
216
|
logger.setEnabled(enabled);
|
|
@@ -664,116 +577,43 @@ var init_categoryUtils = __esm({
|
|
|
664
577
|
}
|
|
665
578
|
});
|
|
666
579
|
|
|
667
|
-
// src/utils/theme.ts
|
|
668
|
-
var import_styles2, defaultConsentTheme;
|
|
669
|
-
var init_theme = __esm({
|
|
670
|
-
"src/utils/theme.ts"() {
|
|
671
|
-
"use strict";
|
|
672
|
-
import_styles2 = require("@mui/material/styles");
|
|
673
|
-
defaultConsentTheme = (0, import_styles2.createTheme)({
|
|
674
|
-
palette: {
|
|
675
|
-
primary: {
|
|
676
|
-
main: "#1976d2",
|
|
677
|
-
contrastText: "#ffffff"
|
|
678
|
-
},
|
|
679
|
-
secondary: {
|
|
680
|
-
main: "#dc004e",
|
|
681
|
-
contrastText: "#ffffff"
|
|
682
|
-
},
|
|
683
|
-
background: {
|
|
684
|
-
default: "#fafafa",
|
|
685
|
-
paper: "#ffffff"
|
|
686
|
-
},
|
|
687
|
-
text: {
|
|
688
|
-
primary: "#333333",
|
|
689
|
-
secondary: "#666666"
|
|
690
|
-
},
|
|
691
|
-
action: {
|
|
692
|
-
hover: "rgba(25, 118, 210, 0.04)"
|
|
693
|
-
}
|
|
694
|
-
},
|
|
695
|
-
typography: {
|
|
696
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
697
|
-
body2: {
|
|
698
|
-
fontSize: "0.875rem",
|
|
699
|
-
lineHeight: 1.43
|
|
700
|
-
},
|
|
701
|
-
button: {
|
|
702
|
-
fontWeight: 500,
|
|
703
|
-
textTransform: "none"
|
|
704
|
-
}
|
|
705
|
-
},
|
|
706
|
-
components: {
|
|
707
|
-
MuiButton: {
|
|
708
|
-
styleOverrides: {
|
|
709
|
-
root: {
|
|
710
|
-
borderRadius: 8,
|
|
711
|
-
paddingX: 16,
|
|
712
|
-
paddingY: 8
|
|
713
|
-
},
|
|
714
|
-
contained: {
|
|
715
|
-
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
716
|
-
"&:hover": {
|
|
717
|
-
boxShadow: "0 4px 8px rgba(0,0,0,0.15)"
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
},
|
|
722
|
-
MuiPaper: {
|
|
723
|
-
styleOverrides: {
|
|
724
|
-
root: {
|
|
725
|
-
borderRadius: 12
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
},
|
|
729
|
-
MuiDialog: {
|
|
730
|
-
styleOverrides: {
|
|
731
|
-
paper: {
|
|
732
|
-
borderRadius: 16
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
|
|
741
580
|
// src/context/DesignContext.tsx
|
|
742
581
|
function DesignProvider({
|
|
743
582
|
tokens,
|
|
744
583
|
children
|
|
745
584
|
}) {
|
|
746
|
-
return /* @__PURE__ */ (0,
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DesignContext.Provider, { value: tokens, children });
|
|
747
586
|
}
|
|
748
587
|
function useDesignTokens() {
|
|
749
|
-
return
|
|
588
|
+
return React3.useContext(DesignContext);
|
|
750
589
|
}
|
|
751
|
-
var
|
|
590
|
+
var React3, import_jsx_runtime2, DesignContext;
|
|
752
591
|
var init_DesignContext = __esm({
|
|
753
592
|
"src/context/DesignContext.tsx"() {
|
|
754
593
|
"use strict";
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
DesignContext =
|
|
594
|
+
React3 = __toESM(require("react"), 1);
|
|
595
|
+
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
596
|
+
DesignContext = React3.createContext(void 0);
|
|
758
597
|
}
|
|
759
598
|
});
|
|
760
599
|
|
|
761
600
|
// src/components/Branding.tsx
|
|
762
601
|
function Branding({ variant, hidden = false }) {
|
|
763
602
|
const texts = useConsentTexts();
|
|
603
|
+
const designTokens = useDesignTokens();
|
|
764
604
|
if (hidden) return null;
|
|
765
|
-
return /* @__PURE__ */ (0,
|
|
605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
766
606
|
import_Typography.default,
|
|
767
607
|
{
|
|
768
608
|
variant: "caption",
|
|
769
609
|
sx: (theme) => ({
|
|
770
610
|
...brandingStyles[variant],
|
|
771
|
-
color: theme.palette.text.secondary
|
|
611
|
+
color: designTokens?.colors?.text ?? theme.palette.text.secondary
|
|
772
612
|
}),
|
|
773
613
|
children: [
|
|
774
614
|
texts.brandingPoweredBy || "fornecido por",
|
|
775
615
|
" ",
|
|
776
|
-
/* @__PURE__ */ (0,
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
777
617
|
import_Link.default,
|
|
778
618
|
{
|
|
779
619
|
href: "https://www.ledipo.eti.br",
|
|
@@ -781,7 +621,7 @@ function Branding({ variant, hidden = false }) {
|
|
|
781
621
|
rel: "noopener noreferrer",
|
|
782
622
|
sx: (theme) => ({
|
|
783
623
|
...linkStyles,
|
|
784
|
-
color: theme.palette.primary.main
|
|
624
|
+
color: designTokens?.colors?.primary ?? theme.palette.primary.main
|
|
785
625
|
}),
|
|
786
626
|
children: "L\xC9dipO.eti.br"
|
|
787
627
|
}
|
|
@@ -790,14 +630,15 @@ function Branding({ variant, hidden = false }) {
|
|
|
790
630
|
}
|
|
791
631
|
);
|
|
792
632
|
}
|
|
793
|
-
var import_Link, import_Typography,
|
|
633
|
+
var import_Link, import_Typography, import_jsx_runtime3, brandingStyles, linkStyles;
|
|
794
634
|
var init_Branding = __esm({
|
|
795
635
|
"src/components/Branding.tsx"() {
|
|
796
636
|
"use strict";
|
|
797
637
|
init_useConsent();
|
|
638
|
+
init_DesignContext();
|
|
798
639
|
import_Link = __toESM(require("@mui/material/Link"), 1);
|
|
799
640
|
import_Typography = __toESM(require("@mui/material/Typography"), 1);
|
|
800
|
-
|
|
641
|
+
import_jsx_runtime3 = require("react/jsx-runtime");
|
|
801
642
|
brandingStyles = {
|
|
802
643
|
banner: {
|
|
803
644
|
fontSize: "0.65rem",
|
|
@@ -858,11 +699,11 @@ function CookieBanner({
|
|
|
858
699
|
borderRadius: designTokens?.spacing?.borderRadius?.banner,
|
|
859
700
|
fontFamily: designTokens?.typography?.fontFamily
|
|
860
701
|
};
|
|
861
|
-
const bannerContent = /* @__PURE__ */ (0,
|
|
862
|
-
/* @__PURE__ */ (0,
|
|
702
|
+
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: [
|
|
703
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_Typography2.default, { variant: "body2", sx: { fontSize: designTokens?.typography?.fontSize?.banner }, children: [
|
|
863
704
|
texts.bannerMessage,
|
|
864
705
|
" ",
|
|
865
|
-
policyLinkUrl && /* @__PURE__ */ (0,
|
|
706
|
+
policyLinkUrl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
866
707
|
import_Link2.default,
|
|
867
708
|
{
|
|
868
709
|
href: policyLinkUrl,
|
|
@@ -874,8 +715,8 @@ function CookieBanner({
|
|
|
874
715
|
}
|
|
875
716
|
)
|
|
876
717
|
] }),
|
|
877
|
-
/* @__PURE__ */ (0,
|
|
878
|
-
/* @__PURE__ */ (0,
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_Stack.default, { direction: { xs: "column", sm: "row" }, spacing: 1, justifyContent: "flex-end", children: [
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
879
720
|
import_Button.default,
|
|
880
721
|
{
|
|
881
722
|
variant: "outlined",
|
|
@@ -887,7 +728,7 @@ function CookieBanner({
|
|
|
887
728
|
children: texts.declineAll
|
|
888
729
|
}
|
|
889
730
|
),
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
891
732
|
import_Button.default,
|
|
892
733
|
{
|
|
893
734
|
variant: "contained",
|
|
@@ -899,7 +740,7 @@ function CookieBanner({
|
|
|
899
740
|
children: texts.acceptAll
|
|
900
741
|
}
|
|
901
742
|
),
|
|
902
|
-
/* @__PURE__ */ (0,
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
903
744
|
import_Button.default,
|
|
904
745
|
{
|
|
905
746
|
variant: "text",
|
|
@@ -912,7 +753,7 @@ function CookieBanner({
|
|
|
912
753
|
}
|
|
913
754
|
)
|
|
914
755
|
] }),
|
|
915
|
-
!hideBranding && /* @__PURE__ */ (0,
|
|
756
|
+
!hideBranding && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Branding, { variant: "banner" })
|
|
916
757
|
] }) });
|
|
917
758
|
const positionStyle = {
|
|
918
759
|
position: "fixed",
|
|
@@ -923,10 +764,16 @@ function CookieBanner({
|
|
|
923
764
|
width: designTokens?.layout?.width?.desktop ?? "100%",
|
|
924
765
|
p: 2
|
|
925
766
|
};
|
|
926
|
-
|
|
767
|
+
let backdropColor = "rgba(0, 0, 0, 0.4)";
|
|
768
|
+
const backdropToken = designTokens?.layout?.backdrop;
|
|
769
|
+
if (backdropToken === false) {
|
|
770
|
+
backdropColor = "transparent";
|
|
771
|
+
} else if (typeof backdropToken === "string") {
|
|
772
|
+
backdropColor = backdropToken;
|
|
773
|
+
}
|
|
927
774
|
if (blocking) {
|
|
928
|
-
return /* @__PURE__ */ (0,
|
|
929
|
-
/* @__PURE__ */ (0,
|
|
775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
930
777
|
import_Box.default,
|
|
931
778
|
{
|
|
932
779
|
sx: {
|
|
@@ -940,10 +787,10 @@ function CookieBanner({
|
|
|
940
787
|
}
|
|
941
788
|
}
|
|
942
789
|
),
|
|
943
|
-
/* @__PURE__ */ (0,
|
|
790
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_Box.default, { sx: positionStyle, children: bannerContent })
|
|
944
791
|
] });
|
|
945
792
|
}
|
|
946
|
-
return /* @__PURE__ */ (0,
|
|
793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
947
794
|
import_Snackbar.default,
|
|
948
795
|
{
|
|
949
796
|
open,
|
|
@@ -956,7 +803,7 @@ function CookieBanner({
|
|
|
956
803
|
}
|
|
957
804
|
);
|
|
958
805
|
}
|
|
959
|
-
var import_Button, import_Box, import_Paper, import_Snackbar, import_Stack, import_Typography2, import_Link2,
|
|
806
|
+
var import_Button, import_Box, import_Paper, import_Snackbar, import_Stack, import_Typography2, import_Link2, import_jsx_runtime4;
|
|
960
807
|
var init_CookieBanner = __esm({
|
|
961
808
|
"src/components/CookieBanner.tsx"() {
|
|
962
809
|
"use strict";
|
|
@@ -971,13 +818,13 @@ var init_CookieBanner = __esm({
|
|
|
971
818
|
init_DesignContext();
|
|
972
819
|
init_Branding();
|
|
973
820
|
init_logger();
|
|
974
|
-
|
|
821
|
+
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
975
822
|
}
|
|
976
823
|
});
|
|
977
824
|
|
|
978
825
|
// src/components/FloatingPreferencesButton.tsx
|
|
979
826
|
function useThemeWithFallbacks() {
|
|
980
|
-
const theme = (0,
|
|
827
|
+
const theme = (0, import_styles.useTheme)();
|
|
981
828
|
logger.themeCompatibility(theme);
|
|
982
829
|
return {
|
|
983
830
|
palette: {
|
|
@@ -997,7 +844,7 @@ function useThemeWithFallbacks() {
|
|
|
997
844
|
function FloatingPreferencesButton({
|
|
998
845
|
position = "bottom-right",
|
|
999
846
|
offset = 24,
|
|
1000
|
-
icon = /* @__PURE__ */ (0,
|
|
847
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_CookieOutlined.default, {}),
|
|
1001
848
|
tooltip,
|
|
1002
849
|
FabProps,
|
|
1003
850
|
hideWhenConsented = false
|
|
@@ -1005,6 +852,7 @@ function FloatingPreferencesButton({
|
|
|
1005
852
|
const { openPreferences, consented } = useConsent();
|
|
1006
853
|
const texts = useConsentTexts();
|
|
1007
854
|
const safeTheme = useThemeWithFallbacks();
|
|
855
|
+
const designTokens = useDesignTokens();
|
|
1008
856
|
logger.componentRender("FloatingPreferencesButton", {
|
|
1009
857
|
position,
|
|
1010
858
|
offset,
|
|
@@ -1036,7 +884,7 @@ function FloatingPreferencesButton({
|
|
|
1036
884
|
return { ...styles, bottom: offset, right: offset };
|
|
1037
885
|
}
|
|
1038
886
|
};
|
|
1039
|
-
return /* @__PURE__ */ (0,
|
|
887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Tooltip.default, { title: tooltipText, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1040
888
|
import_Fab.default,
|
|
1041
889
|
{
|
|
1042
890
|
size: "medium",
|
|
@@ -1044,9 +892,9 @@ function FloatingPreferencesButton({
|
|
|
1044
892
|
onClick: openPreferences,
|
|
1045
893
|
sx: {
|
|
1046
894
|
...getPosition(),
|
|
1047
|
-
backgroundColor: safeTheme.palette.primary.main,
|
|
895
|
+
backgroundColor: designTokens?.colors?.primary ?? safeTheme.palette.primary.main,
|
|
1048
896
|
"&:hover": {
|
|
1049
|
-
backgroundColor: safeTheme.palette.primary.dark
|
|
897
|
+
backgroundColor: designTokens?.colors?.primary ? designTokens?.colors?.primary : safeTheme.palette.primary.dark
|
|
1050
898
|
},
|
|
1051
899
|
transition: `all ${safeTheme.transitions.duration.short}ms`
|
|
1052
900
|
},
|
|
@@ -1056,17 +904,18 @@ function FloatingPreferencesButton({
|
|
|
1056
904
|
}
|
|
1057
905
|
) });
|
|
1058
906
|
}
|
|
1059
|
-
var import_CookieOutlined, import_Fab, import_Tooltip,
|
|
907
|
+
var import_CookieOutlined, import_Fab, import_Tooltip, import_styles, import_jsx_runtime5;
|
|
1060
908
|
var init_FloatingPreferencesButton = __esm({
|
|
1061
909
|
"src/components/FloatingPreferencesButton.tsx"() {
|
|
1062
910
|
"use strict";
|
|
1063
911
|
import_CookieOutlined = __toESM(require("@mui/icons-material/CookieOutlined"), 1);
|
|
1064
912
|
import_Fab = __toESM(require("@mui/material/Fab"), 1);
|
|
1065
913
|
import_Tooltip = __toESM(require("@mui/material/Tooltip"), 1);
|
|
1066
|
-
|
|
914
|
+
import_styles = require("@mui/material/styles");
|
|
915
|
+
init_DesignContext();
|
|
1067
916
|
init_useConsent();
|
|
1068
917
|
init_logger();
|
|
1069
|
-
|
|
918
|
+
import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1070
919
|
}
|
|
1071
920
|
});
|
|
1072
921
|
|
|
@@ -1160,6 +1009,8 @@ function ConsentProvider({
|
|
|
1160
1009
|
FloatingPreferencesButtonComponent,
|
|
1161
1010
|
floatingPreferencesButtonProps = {},
|
|
1162
1011
|
disableFloatingPreferencesButton = false,
|
|
1012
|
+
blocking = false,
|
|
1013
|
+
blockingStrategy = "auto",
|
|
1163
1014
|
hideBranding = false,
|
|
1164
1015
|
onConsentGiven,
|
|
1165
1016
|
onPreferencesSaved,
|
|
@@ -1167,18 +1018,18 @@ function ConsentProvider({
|
|
|
1167
1018
|
disableDeveloperGuidance,
|
|
1168
1019
|
children
|
|
1169
1020
|
}) {
|
|
1170
|
-
const texts =
|
|
1171
|
-
const cookie =
|
|
1021
|
+
const texts = React4.useMemo(() => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }), [textsProp]);
|
|
1022
|
+
const cookie = React4.useMemo(
|
|
1172
1023
|
() => ({ ...DEFAULT_COOKIE_OPTS, ...cookieOpts ?? {} }),
|
|
1173
1024
|
[cookieOpts]
|
|
1174
1025
|
);
|
|
1175
|
-
const
|
|
1176
|
-
const finalCategoriesConfig =
|
|
1026
|
+
const mergedTheme = theme;
|
|
1027
|
+
const finalCategoriesConfig = React4.useMemo(() => {
|
|
1177
1028
|
if (categories) return categories;
|
|
1178
1029
|
return DEFAULT_PROJECT_CATEGORIES;
|
|
1179
1030
|
}, [categories]);
|
|
1180
1031
|
useDeveloperGuidance(finalCategoriesConfig, disableDeveloperGuidance);
|
|
1181
|
-
const boot =
|
|
1032
|
+
const boot = React4.useMemo(() => {
|
|
1182
1033
|
if (initialState) return { ...initialState, isModalOpen: false };
|
|
1183
1034
|
return createFullConsentState(
|
|
1184
1035
|
false,
|
|
@@ -1188,9 +1039,9 @@ function ConsentProvider({
|
|
|
1188
1039
|
false
|
|
1189
1040
|
);
|
|
1190
1041
|
}, [initialState, finalCategoriesConfig]);
|
|
1191
|
-
const [state, dispatch] =
|
|
1192
|
-
const [isHydrated, setIsHydrated] =
|
|
1193
|
-
|
|
1042
|
+
const [state, dispatch] = React4.useReducer(reducer, boot);
|
|
1043
|
+
const [isHydrated, setIsHydrated] = React4.useState(false);
|
|
1044
|
+
React4.useEffect(() => {
|
|
1194
1045
|
if (!initialState) {
|
|
1195
1046
|
const saved = readConsentCookie(cookie.name);
|
|
1196
1047
|
if (saved?.consented) {
|
|
@@ -1203,17 +1054,17 @@ function ConsentProvider({
|
|
|
1203
1054
|
}
|
|
1204
1055
|
setIsHydrated(true);
|
|
1205
1056
|
}, [cookie.name, initialState, finalCategoriesConfig]);
|
|
1206
|
-
|
|
1057
|
+
React4.useEffect(() => {
|
|
1207
1058
|
if (state.consented) writeConsentCookie(state, finalCategoriesConfig, cookie);
|
|
1208
1059
|
}, [state, cookie, finalCategoriesConfig]);
|
|
1209
|
-
const prevConsented =
|
|
1210
|
-
|
|
1060
|
+
const prevConsented = React4.useRef(state.consented);
|
|
1061
|
+
React4.useEffect(() => {
|
|
1211
1062
|
if (!prevConsented.current && state.consented && onConsentGiven) {
|
|
1212
1063
|
setTimeout(() => onConsentGiven(state), 150);
|
|
1213
1064
|
}
|
|
1214
1065
|
prevConsented.current = state.consented;
|
|
1215
1066
|
}, [state, onConsentGiven]);
|
|
1216
|
-
const api =
|
|
1067
|
+
const api = React4.useMemo(() => {
|
|
1217
1068
|
const acceptAll = () => dispatch({ type: "ACCEPT_ALL", config: finalCategoriesConfig });
|
|
1218
1069
|
const rejectAll = () => dispatch({ type: "REJECT_ALL", config: finalCategoriesConfig });
|
|
1219
1070
|
const setPreference = (category, value) => dispatch({ type: "SET_CATEGORY", category, value });
|
|
@@ -1246,18 +1097,24 @@ function ConsentProvider({
|
|
|
1246
1097
|
resetConsent
|
|
1247
1098
|
};
|
|
1248
1099
|
}, [state, cookie, finalCategoriesConfig, onPreferencesSaved]);
|
|
1249
|
-
|
|
1100
|
+
React4.useEffect(() => {
|
|
1250
1101
|
_registerGlobalOpenPreferences(api.openPreferences);
|
|
1251
1102
|
return () => _unregisterGlobalOpenPreferences();
|
|
1252
1103
|
}, [api.openPreferences]);
|
|
1253
|
-
|
|
1104
|
+
const providerBackdropColor = React4.useMemo(() => {
|
|
1105
|
+
const backdrop = designTokens?.layout?.backdrop;
|
|
1106
|
+
if (backdrop === false) return "transparent";
|
|
1107
|
+
if (typeof backdrop === "string") return backdrop;
|
|
1108
|
+
return "rgba(0, 0, 0, 0.4)";
|
|
1109
|
+
}, [designTokens]);
|
|
1110
|
+
const content = /* @__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)(
|
|
1254
1111
|
CategoriesProvider,
|
|
1255
1112
|
{
|
|
1256
1113
|
config: finalCategoriesConfig,
|
|
1257
1114
|
disableDeveloperGuidance,
|
|
1258
1115
|
children: [
|
|
1259
1116
|
children,
|
|
1260
|
-
/* @__PURE__ */ (0,
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(React4.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1261
1118
|
PreferencesModalComponent,
|
|
1262
1119
|
{
|
|
1263
1120
|
preferences: api.preferences,
|
|
@@ -1267,8 +1124,24 @@ function ConsentProvider({
|
|
|
1267
1124
|
texts,
|
|
1268
1125
|
...preferencesModalProps
|
|
1269
1126
|
}
|
|
1270
|
-
) : /* @__PURE__ */ (0,
|
|
1271
|
-
!state.consented &&
|
|
1127
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PreferencesModal, { hideBranding }) }),
|
|
1128
|
+
blocking && isHydrated && !state.consented && blockingStrategy === "provider" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1129
|
+
"div",
|
|
1130
|
+
{
|
|
1131
|
+
style: {
|
|
1132
|
+
position: "fixed",
|
|
1133
|
+
top: 0,
|
|
1134
|
+
left: 0,
|
|
1135
|
+
right: 0,
|
|
1136
|
+
bottom: 0,
|
|
1137
|
+
backgroundColor: providerBackdropColor,
|
|
1138
|
+
zIndex: 1299
|
|
1139
|
+
},
|
|
1140
|
+
"data-testid": "lgpd-provider-overlay",
|
|
1141
|
+
"aria-hidden": true
|
|
1142
|
+
}
|
|
1143
|
+
),
|
|
1144
|
+
!state.consented && isHydrated && (CookieBannerComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1272
1145
|
CookieBannerComponent,
|
|
1273
1146
|
{
|
|
1274
1147
|
consented: api.consented,
|
|
@@ -1276,47 +1149,61 @@ function ConsentProvider({
|
|
|
1276
1149
|
rejectAll: api.rejectAll,
|
|
1277
1150
|
openPreferences: api.openPreferences,
|
|
1278
1151
|
texts,
|
|
1152
|
+
blocking,
|
|
1153
|
+
...cookieBannerProps
|
|
1154
|
+
}
|
|
1155
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1156
|
+
CookieBanner,
|
|
1157
|
+
{
|
|
1158
|
+
blocking,
|
|
1159
|
+
hideBranding,
|
|
1279
1160
|
...cookieBannerProps
|
|
1280
1161
|
}
|
|
1281
|
-
)
|
|
1282
|
-
state.consented && !disableFloatingPreferencesButton && (FloatingPreferencesButtonComponent ? /* @__PURE__ */ (0,
|
|
1162
|
+
)),
|
|
1163
|
+
state.consented && !disableFloatingPreferencesButton && (FloatingPreferencesButtonComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1283
1164
|
FloatingPreferencesButtonComponent,
|
|
1284
1165
|
{
|
|
1285
1166
|
openPreferences: api.openPreferences,
|
|
1286
1167
|
consented: api.consented,
|
|
1287
1168
|
...floatingPreferencesButtonProps
|
|
1288
1169
|
}
|
|
1289
|
-
) :
|
|
1170
|
+
) : (
|
|
1171
|
+
// Encaminha `floatingPreferencesButtonProps` para o componente padrão
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FloatingPreferencesButton, { ...floatingPreferencesButtonProps })
|
|
1173
|
+
))
|
|
1290
1174
|
]
|
|
1291
1175
|
}
|
|
1292
|
-
) }) }) }) }) })
|
|
1176
|
+
) }) }) }) }) });
|
|
1177
|
+
if (theme) {
|
|
1178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_styles2.ThemeProvider, { theme: mergedTheme, children: content });
|
|
1179
|
+
}
|
|
1180
|
+
return content;
|
|
1293
1181
|
}
|
|
1294
1182
|
function useConsentStateInternal() {
|
|
1295
|
-
const ctx =
|
|
1183
|
+
const ctx = React4.useContext(StateCtx);
|
|
1296
1184
|
if (!ctx) throw new Error("useConsentState must be used within ConsentProvider");
|
|
1297
1185
|
return ctx;
|
|
1298
1186
|
}
|
|
1299
1187
|
function useConsentActionsInternal() {
|
|
1300
|
-
const ctx =
|
|
1188
|
+
const ctx = React4.useContext(ActionsCtx);
|
|
1301
1189
|
if (!ctx) throw new Error("useConsentActions must be used within ConsentProvider");
|
|
1302
1190
|
return ctx;
|
|
1303
1191
|
}
|
|
1304
1192
|
function useConsentTextsInternal() {
|
|
1305
|
-
const ctx =
|
|
1193
|
+
const ctx = React4.useContext(TextsCtx);
|
|
1306
1194
|
return ctx;
|
|
1307
1195
|
}
|
|
1308
1196
|
function useConsentHydrationInternal() {
|
|
1309
|
-
return
|
|
1197
|
+
return React4.useContext(HydrationCtx);
|
|
1310
1198
|
}
|
|
1311
|
-
var
|
|
1199
|
+
var React4, import_styles2, import_jsx_runtime6, PreferencesModal, DEFAULT_TEXTS, StateCtx, ActionsCtx, TextsCtx, HydrationCtx, defaultTexts;
|
|
1312
1200
|
var init_ConsentContext = __esm({
|
|
1313
1201
|
"src/context/ConsentContext.tsx"() {
|
|
1314
1202
|
"use strict";
|
|
1315
|
-
|
|
1316
|
-
|
|
1203
|
+
React4 = __toESM(require("react"), 1);
|
|
1204
|
+
import_styles2 = require("@mui/material/styles");
|
|
1317
1205
|
init_cookieUtils();
|
|
1318
1206
|
init_categoryUtils();
|
|
1319
|
-
init_theme();
|
|
1320
1207
|
init_CategoriesContext();
|
|
1321
1208
|
init_DesignContext();
|
|
1322
1209
|
init_developerGuidance();
|
|
@@ -1324,8 +1211,8 @@ var init_ConsentContext = __esm({
|
|
|
1324
1211
|
init_logger();
|
|
1325
1212
|
init_CookieBanner();
|
|
1326
1213
|
init_FloatingPreferencesButton();
|
|
1327
|
-
|
|
1328
|
-
PreferencesModal =
|
|
1214
|
+
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1215
|
+
PreferencesModal = React4.lazy(
|
|
1329
1216
|
() => Promise.resolve().then(() => (init_PreferencesModal(), PreferencesModal_exports)).then((m) => ({
|
|
1330
1217
|
default: m.PreferencesModal
|
|
1331
1218
|
}))
|
|
@@ -1367,10 +1254,10 @@ var init_ConsentContext = __esm({
|
|
|
1367
1254
|
transferCountries: void 0
|
|
1368
1255
|
// Exibido se definido
|
|
1369
1256
|
};
|
|
1370
|
-
StateCtx =
|
|
1371
|
-
ActionsCtx =
|
|
1372
|
-
TextsCtx =
|
|
1373
|
-
HydrationCtx =
|
|
1257
|
+
StateCtx = React4.createContext(null);
|
|
1258
|
+
ActionsCtx = React4.createContext(null);
|
|
1259
|
+
TextsCtx = React4.createContext(DEFAULT_TEXTS);
|
|
1260
|
+
HydrationCtx = React4.createContext(false);
|
|
1374
1261
|
defaultTexts = DEFAULT_TEXTS;
|
|
1375
1262
|
}
|
|
1376
1263
|
});
|
|
@@ -1438,6 +1325,7 @@ function PreferencesModal2({
|
|
|
1438
1325
|
}) {
|
|
1439
1326
|
const { preferences, setPreferences, closePreferences, isModalOpen } = useConsent();
|
|
1440
1327
|
const texts = useConsentTexts();
|
|
1328
|
+
const designTokens = useDesignTokens();
|
|
1441
1329
|
const { toggleableCategories } = useCategories();
|
|
1442
1330
|
const [tempPreferences, setTempPreferences] = (0, import_react2.useState)(() => {
|
|
1443
1331
|
const initialPrefs = { necessary: true };
|
|
@@ -1463,15 +1351,29 @@ function PreferencesModal2({
|
|
|
1463
1351
|
setTempPreferences(preferences);
|
|
1464
1352
|
closePreferences();
|
|
1465
1353
|
};
|
|
1466
|
-
return /* @__PURE__ */ (0,
|
|
1467
|
-
/* @__PURE__ */ (0,
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_Dialog.default, { "aria-labelledby": "cookie-pref-title", open, onClose: handleCancel, ...DialogProps2, children: [
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1356
|
+
import_DialogTitle.default,
|
|
1357
|
+
{
|
|
1358
|
+
id: "cookie-pref-title",
|
|
1359
|
+
sx: { fontSize: designTokens?.typography?.fontSize?.modal ?? void 0 },
|
|
1360
|
+
children: texts.modalTitle
|
|
1361
|
+
}
|
|
1362
|
+
),
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_DialogContent.default, { dividers: true, sx: { p: designTokens?.spacing?.padding?.modal ?? void 0 }, children: [
|
|
1364
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1365
|
+
import_Typography3.default,
|
|
1366
|
+
{
|
|
1367
|
+
variant: "body2",
|
|
1368
|
+
sx: { mb: 2, fontSize: designTokens?.typography?.fontSize?.modal ?? void 0 },
|
|
1369
|
+
children: texts.modalIntro
|
|
1370
|
+
}
|
|
1371
|
+
),
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_FormGroup.default, { children: [
|
|
1373
|
+
toggleableCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1472
1374
|
import_FormControlLabel.default,
|
|
1473
1375
|
{
|
|
1474
|
-
control: /* @__PURE__ */ (0,
|
|
1376
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1475
1377
|
import_Switch.default,
|
|
1476
1378
|
{
|
|
1477
1379
|
checked: tempPreferences[category.id] ?? false,
|
|
@@ -1485,17 +1387,17 @@ function PreferencesModal2({
|
|
|
1485
1387
|
},
|
|
1486
1388
|
category.id
|
|
1487
1389
|
)),
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_FormControlLabel.default, { control: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Switch.default, { checked: true, disabled: true }), label: texts.necessaryAlwaysOn })
|
|
1489
1391
|
] })
|
|
1490
1392
|
] }),
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1492
|
-
/* @__PURE__ */ (0,
|
|
1493
|
-
/* @__PURE__ */ (0,
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_DialogActions.default, { children: [
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Button2.default, { variant: "outlined", onClick: handleCancel, children: texts.close }),
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Button2.default, { variant: "contained", onClick: handleSave, children: texts.save })
|
|
1494
1396
|
] }),
|
|
1495
|
-
!hideBranding && /* @__PURE__ */ (0,
|
|
1397
|
+
!hideBranding && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Branding, { variant: "modal" })
|
|
1496
1398
|
] });
|
|
1497
1399
|
}
|
|
1498
|
-
var import_Button2, import_Dialog, import_DialogActions, import_DialogContent, import_DialogTitle, import_FormControlLabel, import_FormGroup, import_Switch, import_Typography3, import_react2,
|
|
1400
|
+
var import_Button2, import_Dialog, import_DialogActions, import_DialogContent, import_DialogTitle, import_FormControlLabel, import_FormGroup, import_Switch, import_Typography3, import_react2, import_jsx_runtime7;
|
|
1499
1401
|
var init_PreferencesModal = __esm({
|
|
1500
1402
|
"src/components/PreferencesModal.tsx"() {
|
|
1501
1403
|
"use strict";
|
|
@@ -1511,8 +1413,9 @@ var init_PreferencesModal = __esm({
|
|
|
1511
1413
|
import_react2 = require("react");
|
|
1512
1414
|
init_CategoriesContext();
|
|
1513
1415
|
init_useConsent();
|
|
1416
|
+
init_DesignContext();
|
|
1514
1417
|
init_Branding();
|
|
1515
|
-
|
|
1418
|
+
import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1516
1419
|
}
|
|
1517
1420
|
});
|
|
1518
1421
|
|
|
@@ -1529,6 +1432,7 @@ __export(index_exports, {
|
|
|
1529
1432
|
LogLevel: () => LogLevel,
|
|
1530
1433
|
PreferencesModal: () => PreferencesModal2,
|
|
1531
1434
|
analyzeDeveloperConfiguration: () => analyzeDeveloperConfiguration,
|
|
1435
|
+
createDefaultConsentTheme: () => createDefaultConsentTheme,
|
|
1532
1436
|
createGoogleAnalyticsIntegration: () => createGoogleAnalyticsIntegration,
|
|
1533
1437
|
createGoogleTagManagerIntegration: () => createGoogleTagManagerIntegration,
|
|
1534
1438
|
createProjectPreferences: () => createProjectPreferences,
|
|
@@ -1556,11 +1460,11 @@ init_CategoriesContext();
|
|
|
1556
1460
|
|
|
1557
1461
|
// src/utils/ConsentGate.tsx
|
|
1558
1462
|
init_useConsent();
|
|
1559
|
-
var
|
|
1463
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1560
1464
|
function ConsentGate(props) {
|
|
1561
1465
|
const { preferences } = useConsent();
|
|
1562
1466
|
if (!preferences[props.category]) return null;
|
|
1563
|
-
return /* @__PURE__ */ (0,
|
|
1467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: props.children });
|
|
1564
1468
|
}
|
|
1565
1469
|
|
|
1566
1470
|
// src/utils/scriptLoader.ts
|
|
@@ -1600,11 +1504,79 @@ function loadScript(id, src, category = null, attrs = {}) {
|
|
|
1600
1504
|
});
|
|
1601
1505
|
}
|
|
1602
1506
|
|
|
1603
|
-
// src/
|
|
1604
|
-
|
|
1507
|
+
// src/utils/theme.ts
|
|
1508
|
+
var import_styles3 = require("@mui/material/styles");
|
|
1509
|
+
function createDefaultConsentTheme() {
|
|
1510
|
+
return (0, import_styles3.createTheme)({
|
|
1511
|
+
palette: {
|
|
1512
|
+
primary: {
|
|
1513
|
+
main: "#1976d2",
|
|
1514
|
+
contrastText: "#ffffff"
|
|
1515
|
+
},
|
|
1516
|
+
secondary: {
|
|
1517
|
+
main: "#dc004e",
|
|
1518
|
+
contrastText: "#ffffff"
|
|
1519
|
+
},
|
|
1520
|
+
background: {
|
|
1521
|
+
default: "#fafafa",
|
|
1522
|
+
paper: "#ffffff"
|
|
1523
|
+
},
|
|
1524
|
+
text: {
|
|
1525
|
+
primary: "#333333",
|
|
1526
|
+
secondary: "#666666"
|
|
1527
|
+
},
|
|
1528
|
+
action: {
|
|
1529
|
+
hover: "rgba(25, 118, 210, 0.04)"
|
|
1530
|
+
}
|
|
1531
|
+
},
|
|
1532
|
+
typography: {
|
|
1533
|
+
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
1534
|
+
body2: {
|
|
1535
|
+
fontSize: "0.875rem",
|
|
1536
|
+
lineHeight: 1.43
|
|
1537
|
+
},
|
|
1538
|
+
button: {
|
|
1539
|
+
fontWeight: 500,
|
|
1540
|
+
textTransform: "none"
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
components: {
|
|
1544
|
+
MuiButton: {
|
|
1545
|
+
styleOverrides: {
|
|
1546
|
+
root: {
|
|
1547
|
+
borderRadius: 8,
|
|
1548
|
+
paddingX: 16,
|
|
1549
|
+
paddingY: 8
|
|
1550
|
+
},
|
|
1551
|
+
contained: {
|
|
1552
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
1553
|
+
"&:hover": {
|
|
1554
|
+
boxShadow: "0 4px 8px rgba(0,0,0,0.15)"
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
},
|
|
1559
|
+
MuiPaper: {
|
|
1560
|
+
styleOverrides: {
|
|
1561
|
+
root: {
|
|
1562
|
+
borderRadius: 12
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
},
|
|
1566
|
+
MuiDialog: {
|
|
1567
|
+
styleOverrides: {
|
|
1568
|
+
paper: {
|
|
1569
|
+
borderRadius: 16
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
var defaultConsentTheme = () => createDefaultConsentTheme();
|
|
1605
1577
|
|
|
1606
1578
|
// src/utils/ConsentScriptLoader.tsx
|
|
1607
|
-
var
|
|
1579
|
+
var React5 = __toESM(require("react"), 1);
|
|
1608
1580
|
init_useConsent();
|
|
1609
1581
|
init_logger();
|
|
1610
1582
|
function ConsentScriptLoader({
|
|
@@ -1612,8 +1584,8 @@ function ConsentScriptLoader({
|
|
|
1612
1584
|
reloadOnChange = false
|
|
1613
1585
|
}) {
|
|
1614
1586
|
const { preferences, consented } = useConsent();
|
|
1615
|
-
const loadedScripts =
|
|
1616
|
-
|
|
1587
|
+
const loadedScripts = React5.useRef(/* @__PURE__ */ new Set());
|
|
1588
|
+
React5.useEffect(() => {
|
|
1617
1589
|
if (!consented) return;
|
|
1618
1590
|
integrations.forEach(async (integration) => {
|
|
1619
1591
|
const shouldLoad = preferences[integration.category];
|
|
@@ -1641,7 +1613,7 @@ function ConsentScriptLoader({
|
|
|
1641
1613
|
}
|
|
1642
1614
|
function useConsentScriptLoader() {
|
|
1643
1615
|
const { preferences, consented } = useConsent();
|
|
1644
|
-
return
|
|
1616
|
+
return React5.useCallback(
|
|
1645
1617
|
async (integration) => {
|
|
1646
1618
|
if (!consented) {
|
|
1647
1619
|
logger.warn(`\u26A0\uFE0F Cannot load script ${integration.id}: No consent given`);
|
|
@@ -1752,6 +1724,7 @@ init_categoryUtils();
|
|
|
1752
1724
|
LogLevel,
|
|
1753
1725
|
PreferencesModal,
|
|
1754
1726
|
analyzeDeveloperConfiguration,
|
|
1727
|
+
createDefaultConsentTheme,
|
|
1755
1728
|
createGoogleAnalyticsIntegration,
|
|
1756
1729
|
createGoogleTagManagerIntegration,
|
|
1757
1730
|
createProjectPreferences,
|