react-lgpd-consent 0.3.4 → 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 +9 -3
- package/LICENSE +21 -21
- package/QUICKSTART.md +25 -4
- package/README.md +23 -0
- package/dist/{PreferencesModal-XYBFROAB.js → PreferencesModal-KAZMVPBD.js} +1 -1
- package/dist/{chunk-7D2F6JFW.js → chunk-MHCQFGRJ.js} +69 -214
- package/dist/index.cjs +162 -250
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +73 -2
- package/package.json +6 -6
|
@@ -181,88 +181,8 @@ function useCategoryStatus(categoryId) {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
// src/context/ConsentContext.tsx
|
|
184
|
-
import * as
|
|
185
|
-
|
|
186
|
-
// src/utils/SafeThemeProvider.tsx
|
|
187
|
-
import * as React3 from "react";
|
|
188
|
-
import { ThemeProvider, createTheme } from "@mui/material/styles";
|
|
189
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
190
|
-
var createSafeTheme = (userTheme) => {
|
|
191
|
-
const baseTheme = createTheme({
|
|
192
|
-
palette: {
|
|
193
|
-
primary: {
|
|
194
|
-
main: "#1976d2",
|
|
195
|
-
dark: "#1565c0",
|
|
196
|
-
light: "#42a5f5",
|
|
197
|
-
contrastText: "#ffffff"
|
|
198
|
-
},
|
|
199
|
-
secondary: {
|
|
200
|
-
main: "#dc004e",
|
|
201
|
-
dark: "#9a0036",
|
|
202
|
-
light: "#e33371",
|
|
203
|
-
contrastText: "#ffffff"
|
|
204
|
-
},
|
|
205
|
-
background: {
|
|
206
|
-
default: "#fafafa",
|
|
207
|
-
paper: "#ffffff"
|
|
208
|
-
},
|
|
209
|
-
text: {
|
|
210
|
-
primary: "#333333",
|
|
211
|
-
secondary: "#666666"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
transitions: {
|
|
215
|
-
duration: {
|
|
216
|
-
shortest: 150,
|
|
217
|
-
shorter: 200,
|
|
218
|
-
short: 250,
|
|
219
|
-
standard: 300,
|
|
220
|
-
complex: 375,
|
|
221
|
-
enteringScreen: 225,
|
|
222
|
-
leavingScreen: 195
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
if (!userTheme) {
|
|
227
|
-
return baseTheme;
|
|
228
|
-
}
|
|
229
|
-
return createTheme({
|
|
230
|
-
...baseTheme,
|
|
231
|
-
...userTheme,
|
|
232
|
-
palette: {
|
|
233
|
-
...baseTheme.palette,
|
|
234
|
-
...userTheme.palette,
|
|
235
|
-
primary: {
|
|
236
|
-
...baseTheme.palette.primary,
|
|
237
|
-
...userTheme.palette?.primary
|
|
238
|
-
},
|
|
239
|
-
secondary: {
|
|
240
|
-
...baseTheme.palette.secondary,
|
|
241
|
-
...userTheme.palette?.secondary
|
|
242
|
-
},
|
|
243
|
-
background: {
|
|
244
|
-
...baseTheme.palette.background,
|
|
245
|
-
...userTheme.palette?.background
|
|
246
|
-
},
|
|
247
|
-
text: {
|
|
248
|
-
...baseTheme.palette.text,
|
|
249
|
-
...userTheme.palette?.text
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
transitions: {
|
|
253
|
-
...baseTheme.transitions,
|
|
254
|
-
...userTheme.transitions,
|
|
255
|
-
duration: {
|
|
256
|
-
...baseTheme.transitions.duration,
|
|
257
|
-
...userTheme.transitions?.duration
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
};
|
|
262
|
-
function SafeThemeProvider({ theme, children }) {
|
|
263
|
-
const safeTheme = React3.useMemo(() => createSafeTheme(theme), [theme]);
|
|
264
|
-
return /* @__PURE__ */ jsx2(ThemeProvider, { theme: safeTheme, children });
|
|
265
|
-
}
|
|
184
|
+
import * as React4 from "react";
|
|
185
|
+
import { ThemeProvider } from "@mui/material/styles";
|
|
266
186
|
|
|
267
187
|
// src/utils/cookieUtils.ts
|
|
268
188
|
import Cookies from "js-cookie";
|
|
@@ -614,86 +534,18 @@ function getDefaultCategoryDefinition(category) {
|
|
|
614
534
|
return definitions[category];
|
|
615
535
|
}
|
|
616
536
|
|
|
617
|
-
// src/utils/theme.ts
|
|
618
|
-
import { createTheme as createTheme2 } from "@mui/material/styles";
|
|
619
|
-
var defaultConsentTheme = createTheme2({
|
|
620
|
-
palette: {
|
|
621
|
-
primary: {
|
|
622
|
-
main: "#1976d2",
|
|
623
|
-
contrastText: "#ffffff"
|
|
624
|
-
},
|
|
625
|
-
secondary: {
|
|
626
|
-
main: "#dc004e",
|
|
627
|
-
contrastText: "#ffffff"
|
|
628
|
-
},
|
|
629
|
-
background: {
|
|
630
|
-
default: "#fafafa",
|
|
631
|
-
paper: "#ffffff"
|
|
632
|
-
},
|
|
633
|
-
text: {
|
|
634
|
-
primary: "#333333",
|
|
635
|
-
secondary: "#666666"
|
|
636
|
-
},
|
|
637
|
-
action: {
|
|
638
|
-
hover: "rgba(25, 118, 210, 0.04)"
|
|
639
|
-
}
|
|
640
|
-
},
|
|
641
|
-
typography: {
|
|
642
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
643
|
-
body2: {
|
|
644
|
-
fontSize: "0.875rem",
|
|
645
|
-
lineHeight: 1.43
|
|
646
|
-
},
|
|
647
|
-
button: {
|
|
648
|
-
fontWeight: 500,
|
|
649
|
-
textTransform: "none"
|
|
650
|
-
}
|
|
651
|
-
},
|
|
652
|
-
components: {
|
|
653
|
-
MuiButton: {
|
|
654
|
-
styleOverrides: {
|
|
655
|
-
root: {
|
|
656
|
-
borderRadius: 8,
|
|
657
|
-
paddingX: 16,
|
|
658
|
-
paddingY: 8
|
|
659
|
-
},
|
|
660
|
-
contained: {
|
|
661
|
-
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
662
|
-
"&:hover": {
|
|
663
|
-
boxShadow: "0 4px 8px rgba(0,0,0,0.15)"
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
MuiPaper: {
|
|
669
|
-
styleOverrides: {
|
|
670
|
-
root: {
|
|
671
|
-
borderRadius: 12
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
},
|
|
675
|
-
MuiDialog: {
|
|
676
|
-
styleOverrides: {
|
|
677
|
-
paper: {
|
|
678
|
-
borderRadius: 16
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
});
|
|
684
|
-
|
|
685
537
|
// src/context/DesignContext.tsx
|
|
686
|
-
import * as
|
|
687
|
-
import { jsx as
|
|
688
|
-
var DesignContext =
|
|
538
|
+
import * as React3 from "react";
|
|
539
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
540
|
+
var DesignContext = React3.createContext(void 0);
|
|
689
541
|
function DesignProvider({
|
|
690
542
|
tokens,
|
|
691
543
|
children
|
|
692
544
|
}) {
|
|
693
|
-
return /* @__PURE__ */
|
|
545
|
+
return /* @__PURE__ */ jsx2(DesignContext.Provider, { value: tokens, children });
|
|
694
546
|
}
|
|
695
547
|
function useDesignTokens() {
|
|
696
|
-
return
|
|
548
|
+
return React3.useContext(DesignContext);
|
|
697
549
|
}
|
|
698
550
|
|
|
699
551
|
// src/components/CookieBanner.tsx
|
|
@@ -708,7 +560,7 @@ import Link2 from "@mui/material/Link";
|
|
|
708
560
|
// src/components/Branding.tsx
|
|
709
561
|
import Link from "@mui/material/Link";
|
|
710
562
|
import Typography from "@mui/material/Typography";
|
|
711
|
-
import { jsx as
|
|
563
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
712
564
|
var brandingStyles = {
|
|
713
565
|
banner: {
|
|
714
566
|
fontSize: "0.65rem",
|
|
@@ -750,7 +602,7 @@ function Branding({ variant, hidden = false }) {
|
|
|
750
602
|
children: [
|
|
751
603
|
texts.brandingPoweredBy || "fornecido por",
|
|
752
604
|
" ",
|
|
753
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ jsx3(
|
|
754
606
|
Link,
|
|
755
607
|
{
|
|
756
608
|
href: "https://www.ledipo.eti.br",
|
|
@@ -769,7 +621,7 @@ function Branding({ variant, hidden = false }) {
|
|
|
769
621
|
}
|
|
770
622
|
|
|
771
623
|
// src/components/CookieBanner.tsx
|
|
772
|
-
import { Fragment, jsx as
|
|
624
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
773
625
|
function CookieBanner({
|
|
774
626
|
policyLinkUrl,
|
|
775
627
|
debug,
|
|
@@ -800,11 +652,11 @@ function CookieBanner({
|
|
|
800
652
|
borderRadius: designTokens?.spacing?.borderRadius?.banner,
|
|
801
653
|
fontFamily: designTokens?.typography?.fontFamily
|
|
802
654
|
};
|
|
803
|
-
const bannerContent = /* @__PURE__ */
|
|
655
|
+
const bannerContent = /* @__PURE__ */ jsx4(Paper, { elevation: 3, sx: bannerStyle, ...PaperProps, children: /* @__PURE__ */ jsxs2(Stack, { spacing: 1, children: [
|
|
804
656
|
/* @__PURE__ */ jsxs2(Typography2, { variant: "body2", sx: { fontSize: designTokens?.typography?.fontSize?.banner }, children: [
|
|
805
657
|
texts.bannerMessage,
|
|
806
658
|
" ",
|
|
807
|
-
policyLinkUrl && /* @__PURE__ */
|
|
659
|
+
policyLinkUrl && /* @__PURE__ */ jsx4(
|
|
808
660
|
Link2,
|
|
809
661
|
{
|
|
810
662
|
href: policyLinkUrl,
|
|
@@ -817,7 +669,7 @@ function CookieBanner({
|
|
|
817
669
|
)
|
|
818
670
|
] }),
|
|
819
671
|
/* @__PURE__ */ jsxs2(Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, justifyContent: "flex-end", children: [
|
|
820
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ jsx4(
|
|
821
673
|
Button,
|
|
822
674
|
{
|
|
823
675
|
variant: "outlined",
|
|
@@ -829,7 +681,7 @@ function CookieBanner({
|
|
|
829
681
|
children: texts.declineAll
|
|
830
682
|
}
|
|
831
683
|
),
|
|
832
|
-
/* @__PURE__ */
|
|
684
|
+
/* @__PURE__ */ jsx4(
|
|
833
685
|
Button,
|
|
834
686
|
{
|
|
835
687
|
variant: "contained",
|
|
@@ -841,7 +693,7 @@ function CookieBanner({
|
|
|
841
693
|
children: texts.acceptAll
|
|
842
694
|
}
|
|
843
695
|
),
|
|
844
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ jsx4(
|
|
845
697
|
Button,
|
|
846
698
|
{
|
|
847
699
|
variant: "text",
|
|
@@ -854,7 +706,7 @@ function CookieBanner({
|
|
|
854
706
|
}
|
|
855
707
|
)
|
|
856
708
|
] }),
|
|
857
|
-
!hideBranding && /* @__PURE__ */
|
|
709
|
+
!hideBranding && /* @__PURE__ */ jsx4(Branding, { variant: "banner" })
|
|
858
710
|
] }) });
|
|
859
711
|
const positionStyle = {
|
|
860
712
|
position: "fixed",
|
|
@@ -874,7 +726,7 @@ function CookieBanner({
|
|
|
874
726
|
}
|
|
875
727
|
if (blocking) {
|
|
876
728
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
877
|
-
/* @__PURE__ */
|
|
729
|
+
/* @__PURE__ */ jsx4(
|
|
878
730
|
Box,
|
|
879
731
|
{
|
|
880
732
|
sx: {
|
|
@@ -888,10 +740,10 @@ function CookieBanner({
|
|
|
888
740
|
}
|
|
889
741
|
}
|
|
890
742
|
),
|
|
891
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ jsx4(Box, { sx: positionStyle, children: bannerContent })
|
|
892
744
|
] });
|
|
893
745
|
}
|
|
894
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ jsx4(
|
|
895
747
|
Snackbar,
|
|
896
748
|
{
|
|
897
749
|
open,
|
|
@@ -910,7 +762,7 @@ import CookieOutlined from "@mui/icons-material/CookieOutlined";
|
|
|
910
762
|
import Fab from "@mui/material/Fab";
|
|
911
763
|
import Tooltip from "@mui/material/Tooltip";
|
|
912
764
|
import { useTheme } from "@mui/material/styles";
|
|
913
|
-
import { jsx as
|
|
765
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
914
766
|
function useThemeWithFallbacks() {
|
|
915
767
|
const theme = useTheme();
|
|
916
768
|
logger.themeCompatibility(theme);
|
|
@@ -932,7 +784,7 @@ function useThemeWithFallbacks() {
|
|
|
932
784
|
function FloatingPreferencesButton({
|
|
933
785
|
position = "bottom-right",
|
|
934
786
|
offset = 24,
|
|
935
|
-
icon = /* @__PURE__ */
|
|
787
|
+
icon = /* @__PURE__ */ jsx5(CookieOutlined, {}),
|
|
936
788
|
tooltip,
|
|
937
789
|
FabProps,
|
|
938
790
|
hideWhenConsented = false
|
|
@@ -972,7 +824,7 @@ function FloatingPreferencesButton({
|
|
|
972
824
|
return { ...styles, bottom: offset, right: offset };
|
|
973
825
|
}
|
|
974
826
|
};
|
|
975
|
-
return /* @__PURE__ */
|
|
827
|
+
return /* @__PURE__ */ jsx5(Tooltip, { title: tooltipText, placement: "top", children: /* @__PURE__ */ jsx5(
|
|
976
828
|
Fab,
|
|
977
829
|
{
|
|
978
830
|
size: "medium",
|
|
@@ -994,9 +846,9 @@ function FloatingPreferencesButton({
|
|
|
994
846
|
}
|
|
995
847
|
|
|
996
848
|
// src/context/ConsentContext.tsx
|
|
997
|
-
import { jsx as
|
|
998
|
-
var PreferencesModal =
|
|
999
|
-
() => import("./PreferencesModal-
|
|
849
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
850
|
+
var PreferencesModal = React4.lazy(
|
|
851
|
+
() => import("./PreferencesModal-KAZMVPBD.js").then((m) => ({
|
|
1000
852
|
default: m.PreferencesModal
|
|
1001
853
|
}))
|
|
1002
854
|
);
|
|
@@ -1113,10 +965,10 @@ function reducer(state, action) {
|
|
|
1113
965
|
return state;
|
|
1114
966
|
}
|
|
1115
967
|
}
|
|
1116
|
-
var StateCtx =
|
|
1117
|
-
var ActionsCtx =
|
|
1118
|
-
var TextsCtx =
|
|
1119
|
-
var HydrationCtx =
|
|
968
|
+
var StateCtx = React4.createContext(null);
|
|
969
|
+
var ActionsCtx = React4.createContext(null);
|
|
970
|
+
var TextsCtx = React4.createContext(DEFAULT_TEXTS);
|
|
971
|
+
var HydrationCtx = React4.createContext(false);
|
|
1120
972
|
function ConsentProvider({
|
|
1121
973
|
initialState,
|
|
1122
974
|
categories,
|
|
@@ -1139,18 +991,18 @@ function ConsentProvider({
|
|
|
1139
991
|
disableDeveloperGuidance,
|
|
1140
992
|
children
|
|
1141
993
|
}) {
|
|
1142
|
-
const texts =
|
|
1143
|
-
const cookie =
|
|
994
|
+
const texts = React4.useMemo(() => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }), [textsProp]);
|
|
995
|
+
const cookie = React4.useMemo(
|
|
1144
996
|
() => ({ ...DEFAULT_COOKIE_OPTS, ...cookieOpts ?? {} }),
|
|
1145
997
|
[cookieOpts]
|
|
1146
998
|
);
|
|
1147
|
-
const
|
|
1148
|
-
const finalCategoriesConfig =
|
|
999
|
+
const mergedTheme = theme;
|
|
1000
|
+
const finalCategoriesConfig = React4.useMemo(() => {
|
|
1149
1001
|
if (categories) return categories;
|
|
1150
1002
|
return DEFAULT_PROJECT_CATEGORIES;
|
|
1151
1003
|
}, [categories]);
|
|
1152
1004
|
useDeveloperGuidance(finalCategoriesConfig, disableDeveloperGuidance);
|
|
1153
|
-
const boot =
|
|
1005
|
+
const boot = React4.useMemo(() => {
|
|
1154
1006
|
if (initialState) return { ...initialState, isModalOpen: false };
|
|
1155
1007
|
return createFullConsentState(
|
|
1156
1008
|
false,
|
|
@@ -1160,9 +1012,9 @@ function ConsentProvider({
|
|
|
1160
1012
|
false
|
|
1161
1013
|
);
|
|
1162
1014
|
}, [initialState, finalCategoriesConfig]);
|
|
1163
|
-
const [state, dispatch] =
|
|
1164
|
-
const [isHydrated, setIsHydrated] =
|
|
1165
|
-
|
|
1015
|
+
const [state, dispatch] = React4.useReducer(reducer, boot);
|
|
1016
|
+
const [isHydrated, setIsHydrated] = React4.useState(false);
|
|
1017
|
+
React4.useEffect(() => {
|
|
1166
1018
|
if (!initialState) {
|
|
1167
1019
|
const saved = readConsentCookie(cookie.name);
|
|
1168
1020
|
if (saved?.consented) {
|
|
@@ -1175,17 +1027,17 @@ function ConsentProvider({
|
|
|
1175
1027
|
}
|
|
1176
1028
|
setIsHydrated(true);
|
|
1177
1029
|
}, [cookie.name, initialState, finalCategoriesConfig]);
|
|
1178
|
-
|
|
1030
|
+
React4.useEffect(() => {
|
|
1179
1031
|
if (state.consented) writeConsentCookie(state, finalCategoriesConfig, cookie);
|
|
1180
1032
|
}, [state, cookie, finalCategoriesConfig]);
|
|
1181
|
-
const prevConsented =
|
|
1182
|
-
|
|
1033
|
+
const prevConsented = React4.useRef(state.consented);
|
|
1034
|
+
React4.useEffect(() => {
|
|
1183
1035
|
if (!prevConsented.current && state.consented && onConsentGiven) {
|
|
1184
1036
|
setTimeout(() => onConsentGiven(state), 150);
|
|
1185
1037
|
}
|
|
1186
1038
|
prevConsented.current = state.consented;
|
|
1187
1039
|
}, [state, onConsentGiven]);
|
|
1188
|
-
const api =
|
|
1040
|
+
const api = React4.useMemo(() => {
|
|
1189
1041
|
const acceptAll = () => dispatch({ type: "ACCEPT_ALL", config: finalCategoriesConfig });
|
|
1190
1042
|
const rejectAll = () => dispatch({ type: "REJECT_ALL", config: finalCategoriesConfig });
|
|
1191
1043
|
const setPreference = (category, value) => dispatch({ type: "SET_CATEGORY", category, value });
|
|
@@ -1218,24 +1070,24 @@ function ConsentProvider({
|
|
|
1218
1070
|
resetConsent
|
|
1219
1071
|
};
|
|
1220
1072
|
}, [state, cookie, finalCategoriesConfig, onPreferencesSaved]);
|
|
1221
|
-
|
|
1073
|
+
React4.useEffect(() => {
|
|
1222
1074
|
_registerGlobalOpenPreferences(api.openPreferences);
|
|
1223
1075
|
return () => _unregisterGlobalOpenPreferences();
|
|
1224
1076
|
}, [api.openPreferences]);
|
|
1225
|
-
const providerBackdropColor =
|
|
1077
|
+
const providerBackdropColor = React4.useMemo(() => {
|
|
1226
1078
|
const backdrop = designTokens?.layout?.backdrop;
|
|
1227
1079
|
if (backdrop === false) return "transparent";
|
|
1228
1080
|
if (typeof backdrop === "string") return backdrop;
|
|
1229
1081
|
return "rgba(0, 0, 0, 0.4)";
|
|
1230
1082
|
}, [designTokens]);
|
|
1231
|
-
|
|
1083
|
+
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(
|
|
1232
1084
|
CategoriesProvider,
|
|
1233
1085
|
{
|
|
1234
1086
|
config: finalCategoriesConfig,
|
|
1235
1087
|
disableDeveloperGuidance,
|
|
1236
1088
|
children: [
|
|
1237
1089
|
children,
|
|
1238
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ jsx6(React4.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ jsx6(
|
|
1239
1091
|
PreferencesModalComponent,
|
|
1240
1092
|
{
|
|
1241
1093
|
preferences: api.preferences,
|
|
@@ -1245,8 +1097,8 @@ function ConsentProvider({
|
|
|
1245
1097
|
texts,
|
|
1246
1098
|
...preferencesModalProps
|
|
1247
1099
|
}
|
|
1248
|
-
) : /* @__PURE__ */
|
|
1249
|
-
blocking && isHydrated && !state.consented && blockingStrategy === "provider" && /* @__PURE__ */
|
|
1100
|
+
) : /* @__PURE__ */ jsx6(PreferencesModal, { hideBranding }) }),
|
|
1101
|
+
blocking && isHydrated && !state.consented && blockingStrategy === "provider" && /* @__PURE__ */ jsx6(
|
|
1250
1102
|
"div",
|
|
1251
1103
|
{
|
|
1252
1104
|
style: {
|
|
@@ -1262,7 +1114,7 @@ function ConsentProvider({
|
|
|
1262
1114
|
"aria-hidden": true
|
|
1263
1115
|
}
|
|
1264
1116
|
),
|
|
1265
|
-
!state.consented && isHydrated && (CookieBannerComponent ? /* @__PURE__ */
|
|
1117
|
+
!state.consented && isHydrated && (CookieBannerComponent ? /* @__PURE__ */ jsx6(
|
|
1266
1118
|
CookieBannerComponent,
|
|
1267
1119
|
{
|
|
1268
1120
|
consented: api.consented,
|
|
@@ -1273,7 +1125,7 @@ function ConsentProvider({
|
|
|
1273
1125
|
blocking,
|
|
1274
1126
|
...cookieBannerProps
|
|
1275
1127
|
}
|
|
1276
|
-
) : /* @__PURE__ */
|
|
1128
|
+
) : /* @__PURE__ */ jsx6(
|
|
1277
1129
|
CookieBanner,
|
|
1278
1130
|
{
|
|
1279
1131
|
blocking,
|
|
@@ -1281,7 +1133,7 @@ function ConsentProvider({
|
|
|
1281
1133
|
...cookieBannerProps
|
|
1282
1134
|
}
|
|
1283
1135
|
)),
|
|
1284
|
-
state.consented && !disableFloatingPreferencesButton && (FloatingPreferencesButtonComponent ? /* @__PURE__ */
|
|
1136
|
+
state.consented && !disableFloatingPreferencesButton && (FloatingPreferencesButtonComponent ? /* @__PURE__ */ jsx6(
|
|
1285
1137
|
FloatingPreferencesButtonComponent,
|
|
1286
1138
|
{
|
|
1287
1139
|
openPreferences: api.openPreferences,
|
|
@@ -1290,28 +1142,32 @@ function ConsentProvider({
|
|
|
1290
1142
|
}
|
|
1291
1143
|
) : (
|
|
1292
1144
|
// Encaminha `floatingPreferencesButtonProps` para o componente padrão
|
|
1293
|
-
/* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ jsx6(FloatingPreferencesButton, { ...floatingPreferencesButtonProps })
|
|
1294
1146
|
))
|
|
1295
1147
|
]
|
|
1296
1148
|
}
|
|
1297
|
-
) }) }) }) }) })
|
|
1149
|
+
) }) }) }) }) });
|
|
1150
|
+
if (theme) {
|
|
1151
|
+
return /* @__PURE__ */ jsx6(ThemeProvider, { theme: mergedTheme, children: content });
|
|
1152
|
+
}
|
|
1153
|
+
return content;
|
|
1298
1154
|
}
|
|
1299
1155
|
function useConsentStateInternal() {
|
|
1300
|
-
const ctx =
|
|
1156
|
+
const ctx = React4.useContext(StateCtx);
|
|
1301
1157
|
if (!ctx) throw new Error("useConsentState must be used within ConsentProvider");
|
|
1302
1158
|
return ctx;
|
|
1303
1159
|
}
|
|
1304
1160
|
function useConsentActionsInternal() {
|
|
1305
|
-
const ctx =
|
|
1161
|
+
const ctx = React4.useContext(ActionsCtx);
|
|
1306
1162
|
if (!ctx) throw new Error("useConsentActions must be used within ConsentProvider");
|
|
1307
1163
|
return ctx;
|
|
1308
1164
|
}
|
|
1309
1165
|
function useConsentTextsInternal() {
|
|
1310
|
-
const ctx =
|
|
1166
|
+
const ctx = React4.useContext(TextsCtx);
|
|
1311
1167
|
return ctx;
|
|
1312
1168
|
}
|
|
1313
1169
|
function useConsentHydrationInternal() {
|
|
1314
|
-
return
|
|
1170
|
+
return React4.useContext(HydrationCtx);
|
|
1315
1171
|
}
|
|
1316
1172
|
var defaultTexts = DEFAULT_TEXTS;
|
|
1317
1173
|
|
|
@@ -1360,7 +1216,7 @@ function _unregisterGlobalOpenPreferences() {
|
|
|
1360
1216
|
}
|
|
1361
1217
|
|
|
1362
1218
|
// src/components/PreferencesModal.tsx
|
|
1363
|
-
import { jsx as
|
|
1219
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1364
1220
|
function PreferencesModal2({
|
|
1365
1221
|
DialogProps: DialogProps2,
|
|
1366
1222
|
hideBranding = false
|
|
@@ -1394,7 +1250,7 @@ function PreferencesModal2({
|
|
|
1394
1250
|
closePreferences();
|
|
1395
1251
|
};
|
|
1396
1252
|
return /* @__PURE__ */ jsxs4(Dialog, { "aria-labelledby": "cookie-pref-title", open, onClose: handleCancel, ...DialogProps2, children: [
|
|
1397
|
-
/* @__PURE__ */
|
|
1253
|
+
/* @__PURE__ */ jsx7(
|
|
1398
1254
|
DialogTitle,
|
|
1399
1255
|
{
|
|
1400
1256
|
id: "cookie-pref-title",
|
|
@@ -1403,7 +1259,7 @@ function PreferencesModal2({
|
|
|
1403
1259
|
}
|
|
1404
1260
|
),
|
|
1405
1261
|
/* @__PURE__ */ jsxs4(DialogContent, { dividers: true, sx: { p: designTokens?.spacing?.padding?.modal ?? void 0 }, children: [
|
|
1406
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ jsx7(
|
|
1407
1263
|
Typography3,
|
|
1408
1264
|
{
|
|
1409
1265
|
variant: "body2",
|
|
@@ -1412,10 +1268,10 @@ function PreferencesModal2({
|
|
|
1412
1268
|
}
|
|
1413
1269
|
),
|
|
1414
1270
|
/* @__PURE__ */ jsxs4(FormGroup, { children: [
|
|
1415
|
-
toggleableCategories.map((category) => /* @__PURE__ */
|
|
1271
|
+
toggleableCategories.map((category) => /* @__PURE__ */ jsx7(
|
|
1416
1272
|
FormControlLabel,
|
|
1417
1273
|
{
|
|
1418
|
-
control: /* @__PURE__ */
|
|
1274
|
+
control: /* @__PURE__ */ jsx7(
|
|
1419
1275
|
Switch,
|
|
1420
1276
|
{
|
|
1421
1277
|
checked: tempPreferences[category.id] ?? false,
|
|
@@ -1429,14 +1285,14 @@ function PreferencesModal2({
|
|
|
1429
1285
|
},
|
|
1430
1286
|
category.id
|
|
1431
1287
|
)),
|
|
1432
|
-
/* @__PURE__ */
|
|
1288
|
+
/* @__PURE__ */ jsx7(FormControlLabel, { control: /* @__PURE__ */ jsx7(Switch, { checked: true, disabled: true }), label: texts.necessaryAlwaysOn })
|
|
1433
1289
|
] })
|
|
1434
1290
|
] }),
|
|
1435
1291
|
/* @__PURE__ */ jsxs4(DialogActions, { children: [
|
|
1436
|
-
/* @__PURE__ */
|
|
1437
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ jsx7(Button2, { variant: "outlined", onClick: handleCancel, children: texts.close }),
|
|
1293
|
+
/* @__PURE__ */ jsx7(Button2, { variant: "contained", onClick: handleSave, children: texts.save })
|
|
1438
1294
|
] }),
|
|
1439
|
-
!hideBranding && /* @__PURE__ */
|
|
1295
|
+
!hideBranding && /* @__PURE__ */ jsx7(Branding, { variant: "modal" })
|
|
1440
1296
|
] });
|
|
1441
1297
|
}
|
|
1442
1298
|
|
|
@@ -1451,7 +1307,6 @@ export {
|
|
|
1451
1307
|
createProjectPreferences,
|
|
1452
1308
|
validateProjectPreferences,
|
|
1453
1309
|
getAllProjectCategories,
|
|
1454
|
-
defaultConsentTheme,
|
|
1455
1310
|
CookieBanner,
|
|
1456
1311
|
FloatingPreferencesButton,
|
|
1457
1312
|
ConsentProvider,
|