react-lgpd-consent 0.4.4 → 0.5.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.
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ var core = require('@react-lgpd-consent/core');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "COMMON_INTEGRATIONS", {
8
+ enumerable: true,
9
+ get: function () { return core.COMMON_INTEGRATIONS; }
10
+ });
11
+ Object.defineProperty(exports, "INTEGRATION_TEMPLATES", {
12
+ enumerable: true,
13
+ get: function () { return core.INTEGRATION_TEMPLATES; }
14
+ });
15
+ Object.defineProperty(exports, "createClarityIntegration", {
16
+ enumerable: true,
17
+ get: function () { return core.createClarityIntegration; }
18
+ });
19
+ Object.defineProperty(exports, "createCorporateIntegrations", {
20
+ enumerable: true,
21
+ get: function () { return core.createCorporateIntegrations; }
22
+ });
23
+ Object.defineProperty(exports, "createECommerceIntegrations", {
24
+ enumerable: true,
25
+ get: function () { return core.createECommerceIntegrations; }
26
+ });
27
+ Object.defineProperty(exports, "createFacebookPixelIntegration", {
28
+ enumerable: true,
29
+ get: function () { return core.createFacebookPixelIntegration; }
30
+ });
31
+ Object.defineProperty(exports, "createGoogleAnalyticsIntegration", {
32
+ enumerable: true,
33
+ get: function () { return core.createGoogleAnalyticsIntegration; }
34
+ });
35
+ Object.defineProperty(exports, "createGoogleTagManagerIntegration", {
36
+ enumerable: true,
37
+ get: function () { return core.createGoogleTagManagerIntegration; }
38
+ });
39
+ Object.defineProperty(exports, "createHotjarIntegration", {
40
+ enumerable: true,
41
+ get: function () { return core.createHotjarIntegration; }
42
+ });
43
+ Object.defineProperty(exports, "createIntercomIntegration", {
44
+ enumerable: true,
45
+ get: function () { return core.createIntercomIntegration; }
46
+ });
47
+ Object.defineProperty(exports, "createMixpanelIntegration", {
48
+ enumerable: true,
49
+ get: function () { return core.createMixpanelIntegration; }
50
+ });
51
+ Object.defineProperty(exports, "createSaaSIntegrations", {
52
+ enumerable: true,
53
+ get: function () { return core.createSaaSIntegrations; }
54
+ });
55
+ Object.defineProperty(exports, "createUserWayIntegration", {
56
+ enumerable: true,
57
+ get: function () { return core.createUserWayIntegration; }
58
+ });
59
+ Object.defineProperty(exports, "createZendeskChatIntegration", {
60
+ enumerable: true,
61
+ get: function () { return core.createZendeskChatIntegration; }
62
+ });
63
+ Object.defineProperty(exports, "suggestCategoryForScript", {
64
+ enumerable: true,
65
+ get: function () { return core.suggestCategoryForScript; }
66
+ });
@@ -0,0 +1 @@
1
+ export { COMMON_INTEGRATIONS, ClarityConfig, CorporateConfig, ECommerceConfig, FacebookPixelConfig, GoogleAnalyticsConfig, GoogleTagManagerConfig, HotjarConfig, INTEGRATION_TEMPLATES, IntercomConfig, MixpanelConfig, SaaSConfig, ScriptIntegration, UserWayConfig, ZendeskConfig, createClarityIntegration, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, suggestCategoryForScript } from '@react-lgpd-consent/core';
@@ -0,0 +1 @@
1
+ export { COMMON_INTEGRATIONS, ClarityConfig, CorporateConfig, ECommerceConfig, FacebookPixelConfig, GoogleAnalyticsConfig, GoogleTagManagerConfig, HotjarConfig, INTEGRATION_TEMPLATES, IntercomConfig, MixpanelConfig, SaaSConfig, ScriptIntegration, UserWayConfig, ZendeskConfig, createClarityIntegration, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, suggestCategoryForScript } from '@react-lgpd-consent/core';
@@ -0,0 +1 @@
1
+ export { COMMON_INTEGRATIONS, INTEGRATION_TEMPLATES, createClarityIntegration, createCorporateIntegrations, createECommerceIntegrations, createFacebookPixelIntegration, createGoogleAnalyticsIntegration, createGoogleTagManagerIntegration, createHotjarIntegration, createIntercomIntegration, createMixpanelIntegration, createSaaSIntegrations, createUserWayIntegration, createZendeskChatIntegration, suggestCategoryForScript } from '@react-lgpd-consent/core';
package/dist/mui.cjs ADDED
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var mui = require('@react-lgpd-consent/mui');
4
+
5
+
6
+
7
+ Object.keys(mui).forEach(function (k) {
8
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return mui[k]; }
11
+ });
12
+ });
package/dist/mui.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from '@react-lgpd-consent/mui';
package/dist/mui.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@react-lgpd-consent/mui';
package/dist/mui.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@react-lgpd-consent/mui';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-lgpd-consent",
3
- "version": "0.4.4",
3
+ "version": "0.5.1",
4
4
  "description": "Biblioteca de consentimento LGPD, integrações nativas e sistema extensível para React.",
5
5
  "keywords": [
6
6
  "lgpd",
@@ -35,10 +35,20 @@
35
35
  "import": "./dist/index.js",
36
36
  "require": "./dist/index.cjs"
37
37
  },
38
+ "./core": {
39
+ "types": "./dist/core.d.ts",
40
+ "import": "./dist/core.js",
41
+ "require": "./dist/core.cjs"
42
+ },
43
+ "./mui": {
44
+ "types": "./dist/mui.d.ts",
45
+ "import": "./dist/mui.js",
46
+ "require": "./dist/mui.cjs"
47
+ },
38
48
  "./integrations": {
39
- "types": "./dist/utils/scriptIntegrations.d.ts",
40
- "import": "./dist/utils/scriptIntegrations.js",
41
- "require": "./dist/utils/scriptIntegrations.cjs"
49
+ "types": "./dist/integrations.d.ts",
50
+ "import": "./dist/integrations.js",
51
+ "require": "./dist/integrations.cjs"
42
52
  },
43
53
  "./package.json": "./package.json"
44
54
  },
@@ -58,26 +68,6 @@
58
68
  "engines": {
59
69
  "node": ">=20.0.0"
60
70
  },
61
- "scripts": {
62
- "clean": "rimraf node_modules package-lock.json dist docs storybook-static .cache .stryker-tmp",
63
- "build": "cross-env NODE_ENV=production tsup src/index.ts --format esm,cjs --dts --clean",
64
- "dev": "cross-env NODE_ENV=development tsup src/index.ts --format esm,cjs --dts --watch",
65
- "lint": "eslint \"**/*.{ts,tsx}\" --cache",
66
- "lint:ci": "eslint \"**/*.{ts,tsx}\" --cache --max-warnings=0",
67
- "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\" \"eslint.config.js\"",
68
- "type-check": "tsc --noEmit",
69
- "test": "jest --config jest.config.ts",
70
- "test:a11y": "jest --config jest.config.ts --testMatch='**/*.a11y.test.tsx'",
71
- "test:coverage": "jest --config jest.config.ts --coverage",
72
- "coverage-check": "node scripts/coverage-check.cjs",
73
- "size-check": "size-limit",
74
- "mutation": "npx stryker run",
75
- "mutation:tests": "npx stryker run ./stryker.tests.conf.json",
76
- "prepublishOnly": "npm run build",
77
- "docs:generate": "typedoc --out docs",
78
- "storybook": "storybook dev -p 6006",
79
- "build-storybook": "storybook build"
80
- },
81
71
  "repository": {
82
72
  "type": "git",
83
73
  "url": "git+https://github.com/lucianoedipo/react-lgpd-consent.git"
@@ -95,67 +85,20 @@
95
85
  "peerDependenciesMeta": {
96
86
  "@mui/icons-material": {
97
87
  "optional": true
88
+ },
89
+ "@mui/material": {
90
+ "optional": true
98
91
  }
99
92
  },
100
93
  "dependencies": {
101
- "js-cookie": "^3.0.5",
102
- "zod": "^4.1.12"
103
- },
104
- "devDependencies": {
105
- "@axe-core/react": "^4.10.2",
106
- "@chromatic-com/storybook": "4.1.1",
107
- "@emotion/react": "11.14.0",
108
- "@emotion/styled": "11.14.1",
109
- "@eslint/compat": "1.4.0",
110
- "@mui/icons-material": "7.3.4",
111
- "@mui/material": "7.3.4",
112
- "@size-limit/preset-small-lib": "^11.2.0",
113
- "@storybook/addon-a11y": "9.1.10",
114
- "@storybook/addon-docs": "9.1.10",
115
- "@storybook/addon-vitest": "9.1.10",
116
- "@storybook/react-vite": "9.1.10",
117
- "@stryker-mutator/core": "9.2.0",
118
- "@stryker-mutator/jest-runner": "9.2.0",
119
- "@testing-library/dom": "10.4.1",
120
- "@testing-library/jest-dom": "6.9.1",
121
- "@testing-library/react": "^16.3.0",
122
- "@testing-library/user-event": "14.6.1",
123
- "@types/jest": "30.0.0",
124
- "@types/jest-axe": "^3.5.9",
125
- "@types/js-cookie": "3.0.6",
126
- "@types/node": "24.7.0",
127
- "@types/react": "19.2.1",
128
- "@types/react-dom": "19.2.0",
129
- "@typescript-eslint/eslint-plugin": "8.46.0",
130
- "@typescript-eslint/parser": "8.46.0",
131
- "cross-env": "10.1.0",
132
- "eslint": "9.37.0",
133
- "eslint-config-prettier": "10.1.8",
134
- "eslint-plugin-jest": "29.0.1",
135
- "eslint-plugin-react-hooks": "6.1.1",
136
- "eslint-plugin-storybook": "9.1.10",
137
- "globals": "^16.4.0",
138
- "jest": "30.2.0",
139
- "jest-axe": "^10.0.0",
140
- "jest-environment-jsdom": "30.2.0",
141
- "prettier": "3.6.2",
142
- "react": "19.2.0",
143
- "react-dom": "19.2.0",
144
- "rimraf": "6.0.1",
145
- "size-limit": "^11.2.0",
146
- "storybook": "9.1.10",
147
- "ts-jest": "29.4.4",
148
- "ts-node": "10.9.2",
149
- "tsup": "8.5.0",
150
- "typedoc": "0.28.13",
151
- "typescript": "5.9.3",
152
- "typescript-eslint": "8.46.0"
94
+ "@react-lgpd-consent/core": "^0.5.0",
95
+ "@react-lgpd-consent/mui": "^0.5.0"
153
96
  },
154
97
  "size-limit": [
155
98
  {
156
99
  "name": "ESM Bundle",
157
100
  "path": "dist/index.js",
158
- "limit": "34 KB"
101
+ "limit": "70 KB"
159
102
  },
160
103
  {
161
104
  "name": "CJS Bundle",
@@ -171,7 +114,26 @@
171
114
  "name": "Complete Package Import",
172
115
  "path": "dist/index.js",
173
116
  "import": "{ ConsentProvider, useConsent, ConsentScriptLoader }",
174
- "limit": "15 KB"
117
+ "limit": "65 KB"
175
118
  }
176
- ]
177
- }
119
+ ],
120
+ "scripts": {
121
+ "clean": "rimraf dist",
122
+ "build": "cross-env NODE_ENV=production tsup",
123
+ "dev": "cross-env NODE_ENV=development tsup --watch",
124
+ "lint": "eslint \"src/**/*.{ts,tsx}\" --cache",
125
+ "lint:ci": "eslint \"src/**/*.{ts,tsx}\" --cache --max-warnings=0",
126
+ "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
127
+ "type-check": "tsc --noEmit",
128
+ "test": "jest --config ../../jest.config.mjs",
129
+ "test:a11y": "jest --config ../../jest.config.mjs --testMatch='**/*.a11y.test.tsx'",
130
+ "test:coverage": "jest --config ../../jest.config.mjs --coverage",
131
+ "coverage-check": "node ../../scripts/coverage-check.cjs",
132
+ "size-check": "size-limit",
133
+ "mutation": "npx stryker run",
134
+ "mutation:tests": "npx stryker run ../../stryker.tests.conf.json",
135
+ "docs:generate": "typedoc --options ../../typedoc.json",
136
+ "storybook": "storybook dev -p 6006 --config-dir ../../.storybook",
137
+ "build-storybook": "storybook build --config-dir ../../.storybook --output-dir ../../storybook-static"
138
+ }
139
+ }
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkFJKRAERJ_cjs = require('./chunk-FJKRAERJ.cjs');
4
- require('./chunk-ORI4PLVG.cjs');
5
-
6
-
7
-
8
- Object.defineProperty(exports, "FloatingPreferencesButton", {
9
- enumerable: true,
10
- get: function () { return chunkFJKRAERJ_cjs.FloatingPreferencesButton; }
11
- });
@@ -1,2 +0,0 @@
1
- export { FloatingPreferencesButton } from './chunk-PJFGQMCI.js';
2
- import './chunk-RWT2ORFE.js';
@@ -1,2 +0,0 @@
1
- export { PreferencesModal } from './chunk-N3QOW4SA.js';
2
- import './chunk-RWT2ORFE.js';
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk25XEI2DZ_cjs = require('./chunk-25XEI2DZ.cjs');
4
- require('./chunk-ORI4PLVG.cjs');
5
-
6
-
7
-
8
- Object.defineProperty(exports, "PreferencesModal", {
9
- enumerable: true,
10
- get: function () { return chunk25XEI2DZ_cjs.PreferencesModal; }
11
- });
@@ -1,193 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkORI4PLVG_cjs = require('./chunk-ORI4PLVG.cjs');
4
- var Box = require('@mui/material/Box');
5
- var Button = require('@mui/material/Button');
6
- var Dialog = require('@mui/material/Dialog');
7
- var DialogActions = require('@mui/material/DialogActions');
8
- var DialogContent = require('@mui/material/DialogContent');
9
- var DialogTitle = require('@mui/material/DialogTitle');
10
- var FormControlLabel = require('@mui/material/FormControlLabel');
11
- var FormGroup = require('@mui/material/FormGroup');
12
- var Switch = require('@mui/material/Switch');
13
- var Typography = require('@mui/material/Typography');
14
- var react = require('react');
15
- var jsxRuntime = require('react/jsx-runtime');
16
-
17
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
-
19
- var Box__default = /*#__PURE__*/_interopDefault(Box);
20
- var Button__default = /*#__PURE__*/_interopDefault(Button);
21
- var Dialog__default = /*#__PURE__*/_interopDefault(Dialog);
22
- var DialogActions__default = /*#__PURE__*/_interopDefault(DialogActions);
23
- var DialogContent__default = /*#__PURE__*/_interopDefault(DialogContent);
24
- var DialogTitle__default = /*#__PURE__*/_interopDefault(DialogTitle);
25
- var FormControlLabel__default = /*#__PURE__*/_interopDefault(FormControlLabel);
26
- var FormGroup__default = /*#__PURE__*/_interopDefault(FormGroup);
27
- var Switch__default = /*#__PURE__*/_interopDefault(Switch);
28
- var Typography__default = /*#__PURE__*/_interopDefault(Typography);
29
-
30
- // react-lgpd-consent - Tree-shakeable ESM build
31
- function PreferencesModal({
32
- DialogProps: DialogProps2,
33
- hideBranding = false
34
- }) {
35
- const { preferences, setPreferences, closePreferences, isModalOpen } = chunkORI4PLVG_cjs.useConsent();
36
- const texts = chunkORI4PLVG_cjs.useConsentTexts();
37
- const designTokens = chunkORI4PLVG_cjs.useDesignTokens();
38
- const { toggleableCategories, allCategories } = chunkORI4PLVG_cjs.useCategories();
39
- const [tempPreferences, setTempPreferences] = react.useState(() => {
40
- const initialPrefs = { necessary: true };
41
- toggleableCategories.forEach((category) => {
42
- initialPrefs[category.id] = preferences[category.id] ?? false;
43
- });
44
- return initialPrefs;
45
- });
46
- react.useEffect(() => {
47
- if (isModalOpen) {
48
- const syncedPrefs = { necessary: true };
49
- toggleableCategories.forEach((category) => {
50
- syncedPrefs[category.id] = preferences[category.id] ?? false;
51
- });
52
- setTempPreferences(syncedPrefs);
53
- }
54
- }, [isModalOpen, preferences, toggleableCategories]);
55
- const open = DialogProps2?.open ?? isModalOpen ?? false;
56
- const handleSave = () => {
57
- setPreferences(tempPreferences);
58
- };
59
- const handleCancel = () => {
60
- setTempPreferences(preferences);
61
- closePreferences();
62
- };
63
- const modalTitleSx = (theme) => ({
64
- fontSize: designTokens?.typography?.fontSize?.modal ?? void 0,
65
- color: designTokens?.colors?.text ?? theme.palette.text.primary
66
- });
67
- const modalContentSx = (theme) => ({
68
- p: designTokens?.spacing?.padding?.modal ?? void 0,
69
- backgroundColor: designTokens?.colors?.background ?? theme.palette.background.paper,
70
- color: designTokens?.colors?.text ?? theme.palette.text.primary
71
- });
72
- return /* @__PURE__ */ jsxRuntime.jsxs(Dialog__default.default, { "aria-labelledby": "cookie-pref-title", open, onClose: handleCancel, ...DialogProps2, children: [
73
- /* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { id: "cookie-pref-title", sx: modalTitleSx, children: texts.modalTitle }),
74
- /* @__PURE__ */ jsxRuntime.jsxs(DialogContent__default.default, { dividers: true, sx: modalContentSx, children: [
75
- /* @__PURE__ */ jsxRuntime.jsx(
76
- Typography__default.default,
77
- {
78
- variant: "body2",
79
- sx: (theme) => ({
80
- mb: 2,
81
- fontSize: designTokens?.typography?.fontSize?.modal ?? void 0,
82
- color: designTokens?.colors?.text ?? theme.palette.text.primary
83
- }),
84
- children: texts.modalIntro
85
- }
86
- ),
87
- /* @__PURE__ */ jsxRuntime.jsxs(FormGroup__default.default, { children: [
88
- toggleableCategories.map((category) => {
89
- const full = allCategories.find((c) => c.id === category.id);
90
- const namesFromGuidance = full?.cookies ?? [];
91
- const used = globalThis.__LGPD_USED_INTEGRATIONS__ || [];
92
- const descriptors = chunkORI4PLVG_cjs.getCookiesInfoForCategory(category.id, used);
93
- const enrichedDescriptors = descriptors.map((desc) => {
94
- if (desc.purpose && desc.duration && desc.provider) {
95
- return desc;
96
- }
97
- return {
98
- name: desc.name,
99
- purpose: desc.purpose || "-",
100
- duration: desc.duration || "-",
101
- provider: desc.provider || "-"
102
- };
103
- });
104
- const merged = [
105
- ...enrichedDescriptors,
106
- ...namesFromGuidance.filter((n) => !enrichedDescriptors.find((d) => d.name === n)).map((n) => ({ name: n, purpose: "-", duration: "-", provider: "-" }))
107
- ];
108
- let mergedFinal = merged;
109
- try {
110
- if (merged.length === 0) {
111
- const gmap = globalThis.__LGPD_INTEGRATIONS_MAP__ || {};
112
- const scriptRows = Object.entries(gmap).filter(([, cat]) => cat === category.id).map(([id]) => ({
113
- name: `(script) ${id}`,
114
- purpose: "Script de integra\xE7\xE3o ativo",
115
- duration: "-",
116
- provider: "-"
117
- }));
118
- if (scriptRows.length > 0) mergedFinal = scriptRows;
119
- }
120
- } catch {
121
- }
122
- return /* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, { sx: { mb: 1 }, children: [
123
- /* @__PURE__ */ jsxRuntime.jsx(
124
- FormControlLabel__default.default,
125
- {
126
- control: /* @__PURE__ */ jsxRuntime.jsx(
127
- Switch__default.default,
128
- {
129
- checked: tempPreferences[category.id] ?? false,
130
- onChange: (e) => setTempPreferences((prev) => ({
131
- ...prev,
132
- [category.id]: e.target.checked
133
- }))
134
- }
135
- ),
136
- label: `${category.name} - ${category.description}`
137
- }
138
- ),
139
- /* @__PURE__ */ jsxRuntime.jsxs("details", { style: { marginLeft: 48 }, children: [
140
- /* @__PURE__ */ jsxRuntime.jsx("summary", { children: "Ver detalhes" }),
141
- /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
142
- /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
143
- /* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Cookie" }),
144
- /* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Finalidade" }),
145
- /* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Dura\xE7\xE3o" }),
146
- /* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Fornecedor" })
147
- ] }) }),
148
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: mergedFinal.map((d, idx) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
149
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: d.name }),
150
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: d.purpose }),
151
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: d.duration }),
152
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: d.provider })
153
- ] }, d.name + idx)) })
154
- ] }) })
155
- ] })
156
- ] }, category.id);
157
- }),
158
- /* @__PURE__ */ jsxRuntime.jsx(FormControlLabel__default.default, { control: /* @__PURE__ */ jsxRuntime.jsx(Switch__default.default, { checked: true, disabled: true }), label: texts.necessaryAlwaysOn }),
159
- /* @__PURE__ */ jsxRuntime.jsxs("details", { style: { marginLeft: 48 }, children: [
160
- /* @__PURE__ */ jsxRuntime.jsx("summary", { children: "Ver detalhes" }),
161
- /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
162
- /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
163
- /* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Cookie" }),
164
- /* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Finalidade" }),
165
- /* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Dura\xE7\xE3o" }),
166
- /* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Fornecedor" })
167
- ] }) }),
168
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: (() => {
169
- const used = globalThis.__LGPD_USED_INTEGRATIONS__ || [];
170
- const necessaryCookies = chunkORI4PLVG_cjs.getCookiesInfoForCategory(
171
- "necessary",
172
- used
173
- );
174
- return necessaryCookies.map((d, idx) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
175
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: d.name }),
176
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: d.purpose || "-" }),
177
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: d.duration || "-" }),
178
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: d.provider || "-" })
179
- ] }, d.name + idx));
180
- })() })
181
- ] }) })
182
- ] })
183
- ] })
184
- ] }),
185
- /* @__PURE__ */ jsxRuntime.jsxs(DialogActions__default.default, { children: [
186
- /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, { variant: "outlined", onClick: handleCancel, children: texts.close }),
187
- /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, { variant: "contained", onClick: handleSave, children: texts.save })
188
- ] }),
189
- !hideBranding && /* @__PURE__ */ jsxRuntime.jsx(chunkORI4PLVG_cjs.Branding, { variant: "modal" })
190
- ] });
191
- }
192
-
193
- exports.PreferencesModal = PreferencesModal;
@@ -1,119 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkORI4PLVG_cjs = require('./chunk-ORI4PLVG.cjs');
4
- var CookieOutlined = require('@mui/icons-material/CookieOutlined');
5
- var Fab = require('@mui/material/Fab');
6
- var Tooltip = require('@mui/material/Tooltip');
7
- var styles = require('@mui/material/styles');
8
- var React = require('react');
9
- var jsxRuntime = require('react/jsx-runtime');
10
-
11
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
-
13
- function _interopNamespace(e) {
14
- if (e && e.__esModule) return e;
15
- var n = Object.create(null);
16
- if (e) {
17
- Object.keys(e).forEach(function (k) {
18
- if (k !== 'default') {
19
- var d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: function () { return e[k]; }
23
- });
24
- }
25
- });
26
- }
27
- n.default = e;
28
- return Object.freeze(n);
29
- }
30
-
31
- var CookieOutlined__default = /*#__PURE__*/_interopDefault(CookieOutlined);
32
- var Fab__default = /*#__PURE__*/_interopDefault(Fab);
33
- var Tooltip__default = /*#__PURE__*/_interopDefault(Tooltip);
34
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
35
-
36
- // react-lgpd-consent - Tree-shakeable ESM build
37
- function useThemeWithFallbacks() {
38
- const theme = styles.useTheme();
39
- chunkORI4PLVG_cjs.logger.themeCompatibility(theme);
40
- return {
41
- palette: {
42
- primary: {
43
- main: theme?.palette?.primary?.main || "#1976d2",
44
- dark: theme?.palette?.primary?.dark || "#1565c0"
45
- }
46
- },
47
- transitions: {
48
- duration: {
49
- shortest: theme?.transitions?.duration?.shortest || 150,
50
- short: theme?.transitions?.duration?.short || 250
51
- }
52
- }
53
- };
54
- }
55
- var FloatingPreferencesButton = React__namespace.memo(function FloatingPreferencesButton2({
56
- position = "bottom-right",
57
- offset = 24,
58
- icon = /* @__PURE__ */ jsxRuntime.jsx(CookieOutlined__default.default, {}),
59
- tooltip,
60
- FabProps,
61
- hideWhenConsented = false
62
- }) {
63
- const { openPreferences, consented } = chunkORI4PLVG_cjs.useConsent();
64
- const texts = chunkORI4PLVG_cjs.useConsentTexts();
65
- const safeTheme = useThemeWithFallbacks();
66
- const designTokens = chunkORI4PLVG_cjs.useDesignTokens();
67
- const positionStyles = React__namespace.useMemo(() => {
68
- const styles = {
69
- position: "fixed",
70
- zIndex: 1200
71
- };
72
- switch (position) {
73
- case "bottom-left":
74
- return { ...styles, bottom: offset, left: offset };
75
- case "bottom-right":
76
- return { ...styles, bottom: offset, right: offset };
77
- case "top-left":
78
- return { ...styles, top: offset, left: offset };
79
- case "top-right":
80
- return { ...styles, top: offset, right: offset };
81
- default:
82
- return { ...styles, bottom: offset, right: offset };
83
- }
84
- }, [position, offset]);
85
- chunkORI4PLVG_cjs.logger.componentRender("FloatingPreferencesButton", {
86
- position,
87
- offset,
88
- hideWhenConsented,
89
- consented
90
- });
91
- if (hideWhenConsented && consented) {
92
- chunkORI4PLVG_cjs.logger.debug(
93
- "FloatingPreferencesButton: Hidden due to hideWhenConsented=true and consented=true"
94
- );
95
- return null;
96
- }
97
- const tooltipText = tooltip ?? texts.preferencesButton ?? "Gerenciar Prefer\xEAncias de Cookies";
98
- return /* @__PURE__ */ jsxRuntime.jsx(Tooltip__default.default, { title: tooltipText, placement: "top", children: /* @__PURE__ */ jsxRuntime.jsx(
99
- Fab__default.default,
100
- {
101
- size: "medium",
102
- color: "primary",
103
- onClick: openPreferences,
104
- sx: {
105
- ...positionStyles,
106
- backgroundColor: designTokens?.colors?.primary ?? safeTheme.palette.primary.main,
107
- "&:hover": {
108
- backgroundColor: designTokens?.colors?.primary ? designTokens?.colors?.primary : safeTheme.palette.primary.dark
109
- },
110
- transition: `all ${safeTheme.transitions.duration.short}ms`
111
- },
112
- "aria-label": tooltipText,
113
- ...FabProps,
114
- children: icon
115
- }
116
- ) });
117
- });
118
-
119
- exports.FloatingPreferencesButton = FloatingPreferencesButton;