react-lgpd-consent 0.4.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +226 -0
- package/QUICKSTART.en.md +34 -0
- package/QUICKSTART.md +562 -1
- package/README.en.md +25 -0
- package/README.md +37 -0
- package/dist/FloatingPreferencesButton-4AGBXNHH.cjs +11 -0
- package/dist/FloatingPreferencesButton-IY7TFD7D.js +2 -0
- package/dist/PreferencesModal-5KNHWW57.js +2 -0
- package/dist/PreferencesModal-YBCWCVUI.cjs +11 -0
- package/dist/chunk-25XEI2DZ.cjs +193 -0
- package/dist/chunk-FJKRAERJ.cjs +119 -0
- package/dist/chunk-N3QOW4SA.js +178 -0
- package/dist/chunk-ORI4PLVG.cjs +1899 -0
- package/dist/chunk-PJFGQMCI.js +92 -0
- package/dist/chunk-RWT2ORFE.js +1840 -0
- package/dist/index.cjs +872 -1560
- package/dist/index.d.cts +1794 -232
- package/dist/index.d.ts +1794 -232
- package/dist/index.js +707 -65
- package/package.json +73 -39
- package/dist/PreferencesModal-D2SEVH3N.js +0 -6
- package/dist/chunk-B5FNONG3.js +0 -1362
package/dist/index.cjs
CHANGED
|
@@ -1,1512 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
-
};
|
|
11
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
|
|
33
|
-
// src/utils/developerGuidance.ts
|
|
34
|
-
function analyzeDeveloperConfiguration(config) {
|
|
35
|
-
const guidance = {
|
|
36
|
-
warnings: [],
|
|
37
|
-
suggestions: [],
|
|
38
|
-
activeCategoriesInfo: [],
|
|
39
|
-
usingDefaults: !config
|
|
40
|
-
};
|
|
41
|
-
const finalConfig = config || DEFAULT_PROJECT_CATEGORIES;
|
|
42
|
-
if (!config) {
|
|
43
|
-
guidance.warnings.push(
|
|
44
|
-
'LGPD-CONSENT: Nenhuma configura\xE7\xE3o de categorias especificada. Usando padr\xE3o: necessary + analytics. Para produ\xE7\xE3o, recomenda-se especificar explicitamente as categorias via prop "categories".'
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
guidance.activeCategoriesInfo.push({
|
|
48
|
-
id: "necessary",
|
|
49
|
-
name: "Cookies Necess\xE1rios",
|
|
50
|
-
description: "Essenciais para funcionamento b\xE1sico do site",
|
|
51
|
-
essential: true,
|
|
52
|
-
uiRequired: false
|
|
53
|
-
});
|
|
54
|
-
const enabledCategories = finalConfig.enabledCategories || [];
|
|
55
|
-
const categoryNames = {
|
|
56
|
-
analytics: {
|
|
57
|
-
name: "Cookies Anal\xEDticos",
|
|
58
|
-
description: "Medem uso e performance do site"
|
|
59
|
-
},
|
|
60
|
-
functional: {
|
|
61
|
-
name: "Cookies Funcionais",
|
|
62
|
-
description: "Melhoram experi\xEAncia e funcionalidades"
|
|
63
|
-
},
|
|
64
|
-
marketing: {
|
|
65
|
-
name: "Cookies de Marketing",
|
|
66
|
-
description: "Publicidade direcionada e campanhas"
|
|
67
|
-
},
|
|
68
|
-
social: {
|
|
69
|
-
name: "Cookies de Redes Sociais",
|
|
70
|
-
description: "Integra\xE7\xE3o com plataformas sociais"
|
|
71
|
-
},
|
|
72
|
-
personalization: {
|
|
73
|
-
name: "Cookies de Personaliza\xE7\xE3o",
|
|
74
|
-
description: "Adaptam conte\xFAdo \xE0s prefer\xEAncias do usu\xE1rio"
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
enabledCategories.forEach((categoryId) => {
|
|
78
|
-
const categoryInfo = categoryNames[categoryId];
|
|
79
|
-
if (categoryInfo) {
|
|
80
|
-
guidance.activeCategoriesInfo.push({
|
|
81
|
-
id: categoryId,
|
|
82
|
-
name: categoryInfo.name,
|
|
83
|
-
description: categoryInfo.description,
|
|
84
|
-
essential: false,
|
|
85
|
-
uiRequired: true
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const custom = finalConfig.customCategories || [];
|
|
90
|
-
custom.forEach((cat) => {
|
|
91
|
-
if (!cat?.id || cat.id === "necessary") return;
|
|
92
|
-
guidance.activeCategoriesInfo.push({
|
|
93
|
-
id: cat.id,
|
|
94
|
-
name: cat.name,
|
|
95
|
-
description: cat.description,
|
|
96
|
-
essential: !!cat.essential,
|
|
97
|
-
uiRequired: !cat.essential
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
const totalToggleable = guidance.activeCategoriesInfo.filter((c) => c.uiRequired).length;
|
|
101
|
-
if (totalToggleable === 0) {
|
|
102
|
-
guidance.suggestions.push(
|
|
103
|
-
'Apenas cookies necess\xE1rios est\xE3o configurados. Para compliance completo LGPD, considere adicionar categorias como "analytics" ou "functional" conforme uso real.'
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
if (totalToggleable > 5) {
|
|
107
|
-
guidance.warnings.push(
|
|
108
|
-
`${totalToggleable} categorias opcionais detectadas. UI com muitas op\xE7\xF5es pode prejudicar experi\xEAncia do usu\xE1rio. Considere agrupar categorias similares.`
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
return guidance;
|
|
112
|
-
}
|
|
113
|
-
function logDeveloperGuidance(guidance, disableGuidanceProp) {
|
|
114
|
-
const gt = globalThis;
|
|
115
|
-
const nodeEnv = typeof gt.process !== "undefined" ? gt.process?.env?.NODE_ENV : void 0;
|
|
116
|
-
const isProd = nodeEnv === "production" || gt.__LGPD_PRODUCTION__ === true;
|
|
117
|
-
const isDisabled = !!disableGuidanceProp || gt.__LGPD_DISABLE_GUIDANCE__ === true;
|
|
118
|
-
if (isProd || isDisabled) return;
|
|
119
|
-
const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
|
|
120
|
-
if (guidance.warnings.length > 0) {
|
|
121
|
-
console.group(`${PREFIX} \u26A0\uFE0F Avisos de Configura\xE7\xE3o`);
|
|
122
|
-
guidance.warnings.forEach((msg) => console.warn(`${PREFIX} ${msg}`));
|
|
123
|
-
console.groupEnd();
|
|
124
|
-
}
|
|
125
|
-
if (guidance.suggestions.length > 0) {
|
|
126
|
-
console.group(`${PREFIX} \u{1F4A1} Sugest\xF5es`);
|
|
127
|
-
guidance.suggestions.forEach((msg) => console.info(`${PREFIX} ${msg}`));
|
|
128
|
-
console.groupEnd();
|
|
129
|
-
}
|
|
130
|
-
if (guidance.usingDefaults) {
|
|
131
|
-
console.warn(
|
|
132
|
-
`${PREFIX} \u{1F4CB} Usando configura\xE7\xE3o padr\xE3o. Para personalizar, use a prop "categories" no ConsentProvider.`
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
const rows = guidance.activeCategoriesInfo.map((cat) => ({
|
|
136
|
-
ID: cat.id,
|
|
137
|
-
Nome: cat.name,
|
|
138
|
-
"Toggle UI?": cat.uiRequired ? "\u2705 SIM" : "\u274C N\xC3O (sempre ativo)",
|
|
139
|
-
"Essencial?": cat.essential ? "\u{1F512} SIM" : "\u2699\uFE0F N\xC3O"
|
|
140
|
-
}));
|
|
141
|
-
if (typeof console.table === "function") {
|
|
142
|
-
console.group(`${PREFIX} \u{1F527} Categorias Ativas (para UI customizada)`);
|
|
143
|
-
console.table(rows);
|
|
144
|
-
console.info(`${PREFIX} \u2139\uFE0F Use estes dados para criar componentes customizados adequados.`);
|
|
145
|
-
console.groupEnd();
|
|
146
|
-
} else {
|
|
147
|
-
console.log(`${PREFIX} \u{1F527} Categorias Ativas (para UI customizada)`, rows);
|
|
148
|
-
console.info(`${PREFIX} \u2139\uFE0F Use estes dados para criar componentes customizados adequados.`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function useDeveloperGuidance(config, disableGuidanceProp) {
|
|
152
|
-
const guidance = import_react.default.useMemo(() => {
|
|
153
|
-
return analyzeDeveloperConfiguration(config);
|
|
154
|
-
}, [config]);
|
|
155
|
-
import_react.default.useEffect(() => {
|
|
156
|
-
if (!disableGuidanceProp) {
|
|
157
|
-
logDeveloperGuidance(guidance, disableGuidanceProp);
|
|
158
|
-
}
|
|
159
|
-
}, [guidance, disableGuidanceProp]);
|
|
160
|
-
return guidance;
|
|
161
|
-
}
|
|
162
|
-
var import_react, DEFAULT_PROJECT_CATEGORIES;
|
|
163
|
-
var init_developerGuidance = __esm({
|
|
164
|
-
"src/utils/developerGuidance.ts"() {
|
|
165
|
-
"use strict";
|
|
166
|
-
import_react = __toESM(require("react"), 1);
|
|
167
|
-
DEFAULT_PROJECT_CATEGORIES = {
|
|
168
|
-
enabledCategories: ["analytics"]
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
});
|
|
1
|
+
'use strict';
|
|
172
2
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const contextValue = React2.useMemo(() => {
|
|
180
|
-
const finalConfig = config || DEFAULT_PROJECT_CATEGORIES;
|
|
181
|
-
const guidance = analyzeDeveloperConfiguration(config);
|
|
182
|
-
const toggleableCategories = guidance.activeCategoriesInfo.filter((cat) => cat.uiRequired);
|
|
183
|
-
return {
|
|
184
|
-
config: finalConfig,
|
|
185
|
-
guidance,
|
|
186
|
-
toggleableCategories,
|
|
187
|
-
allCategories: guidance.activeCategoriesInfo
|
|
188
|
-
};
|
|
189
|
-
}, [config]);
|
|
190
|
-
React2.useEffect(() => {
|
|
191
|
-
logDeveloperGuidance(contextValue.guidance, disableDeveloperGuidance);
|
|
192
|
-
}, [contextValue.guidance, disableDeveloperGuidance]);
|
|
193
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CategoriesContext.Provider, { value: contextValue, children });
|
|
194
|
-
}
|
|
195
|
-
function useCategories() {
|
|
196
|
-
const context = React2.useContext(CategoriesContext);
|
|
197
|
-
if (!context) {
|
|
198
|
-
throw new Error(
|
|
199
|
-
"useCategories deve ser usado dentro de CategoriesProvider. Certifique-se de que o ConsentProvider est\xE1 envolvendo seu componente."
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
return context;
|
|
203
|
-
}
|
|
204
|
-
function useCategoryStatus(categoryId) {
|
|
205
|
-
const { allCategories } = useCategories();
|
|
206
|
-
const category = allCategories.find((cat) => cat.id === categoryId);
|
|
207
|
-
return {
|
|
208
|
-
isActive: !!category,
|
|
209
|
-
isEssential: category?.essential || false,
|
|
210
|
-
needsToggle: category?.uiRequired || false,
|
|
211
|
-
name: category?.name,
|
|
212
|
-
description: category?.description
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
var React2, import_jsx_runtime, CategoriesContext;
|
|
216
|
-
var init_CategoriesContext = __esm({
|
|
217
|
-
"src/context/CategoriesContext.tsx"() {
|
|
218
|
-
"use strict";
|
|
219
|
-
React2 = __toESM(require("react"), 1);
|
|
220
|
-
init_developerGuidance();
|
|
221
|
-
import_jsx_runtime = require("react/jsx-runtime");
|
|
222
|
-
CategoriesContext = React2.createContext(null);
|
|
223
|
-
}
|
|
224
|
-
});
|
|
3
|
+
var chunkFJKRAERJ_cjs = require('./chunk-FJKRAERJ.cjs');
|
|
4
|
+
var chunk25XEI2DZ_cjs = require('./chunk-25XEI2DZ.cjs');
|
|
5
|
+
var chunkORI4PLVG_cjs = require('./chunk-ORI4PLVG.cjs');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var styles = require('@mui/material/styles');
|
|
8
|
+
var React = require('react');
|
|
225
9
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
var
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
237
|
-
LogLevel2[LogLevel2["ERROR"] = 0] = "ERROR";
|
|
238
|
-
LogLevel2[LogLevel2["WARN"] = 1] = "WARN";
|
|
239
|
-
LogLevel2[LogLevel2["INFO"] = 2] = "INFO";
|
|
240
|
-
LogLevel2[LogLevel2["DEBUG"] = 3] = "DEBUG";
|
|
241
|
-
return LogLevel2;
|
|
242
|
-
})(LogLevel || {});
|
|
243
|
-
_ConsentLogger = class _ConsentLogger {
|
|
244
|
-
constructor() {
|
|
245
|
-
this.enabled = _ConsentLogger.IS_DEVELOPMENT;
|
|
246
|
-
this.level = 2 /* INFO */;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Habilita ou desabilita o sistema de logging.
|
|
250
|
-
* @param {boolean} enabled Se `true`, os logs serão exibidos; caso contrário, serão suprimidos.
|
|
251
|
-
*/
|
|
252
|
-
setEnabled(enabled) {
|
|
253
|
-
this.enabled = enabled;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Define o nível mínimo de severidade para os logs.
|
|
257
|
-
* Mensagens com severidade menor que o nível definido não serão exibidas.
|
|
258
|
-
* @param {LogLevel} level O nível mínimo de severidade (ex: `LogLevel.DEBUG` para ver todos os logs).
|
|
259
|
-
*/
|
|
260
|
-
setLevel(level) {
|
|
261
|
-
this.level = level;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Registra uma mensagem de erro.
|
|
265
|
-
* @param {...unknown[]} args Argumentos a serem logados.
|
|
266
|
-
*/
|
|
267
|
-
error(...args) {
|
|
268
|
-
if (this.enabled && this.level >= 0 /* ERROR */) {
|
|
269
|
-
console.error(_ConsentLogger.LOG_PREFIX, "[ERROR]", ...args);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Registra uma mensagem de aviso.
|
|
274
|
-
* @param {...unknown[]} args Argumentos a serem logados.
|
|
275
|
-
*/
|
|
276
|
-
warn(...args) {
|
|
277
|
-
if (this.enabled && this.level >= 1 /* WARN */) {
|
|
278
|
-
console.warn(_ConsentLogger.LOG_PREFIX, "[WARN]", ...args);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Registra uma mensagem informativa.
|
|
283
|
-
* @param {...unknown[]} args Argumentos a serem logados.
|
|
284
|
-
*/
|
|
285
|
-
info(...args) {
|
|
286
|
-
if (this.enabled && this.level >= 2 /* INFO */) {
|
|
287
|
-
console.info(_ConsentLogger.LOG_PREFIX, "[INFO]", ...args);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Registra uma mensagem de depuração.
|
|
292
|
-
* @param {...unknown[]} args Argumentos a serem logados.
|
|
293
|
-
*/
|
|
294
|
-
debug(...args) {
|
|
295
|
-
if (this.enabled && this.level >= 3 /* DEBUG */) {
|
|
296
|
-
console.debug(_ConsentLogger.LOG_PREFIX, "[DEBUG]", ...args);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Inicia um grupo de logs no console.
|
|
301
|
-
* @param {...unknown[]} args Argumentos para o título do grupo.
|
|
302
|
-
*/
|
|
303
|
-
group(...args) {
|
|
304
|
-
if (this.enabled && this.level >= 3 /* DEBUG */) {
|
|
305
|
-
console.group(_ConsentLogger.LOG_PREFIX, ...args);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Finaliza o grupo de logs mais recente no console.
|
|
310
|
-
*/
|
|
311
|
-
groupEnd() {
|
|
312
|
-
if (this.enabled && this.level >= 3 /* DEBUG */) {
|
|
313
|
-
console.groupEnd();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Exibe dados tabulares no console.
|
|
318
|
-
* @param {unknown} tabularData Dados a serem exibidos na tabela.
|
|
319
|
-
* @param {string[]} [properties] Propriedades opcionais para exibir.
|
|
320
|
-
*/
|
|
321
|
-
table(tabularData, properties) {
|
|
322
|
-
if (this.enabled && this.level >= 3 /* DEBUG */) {
|
|
323
|
-
console.table(tabularData, properties);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Registra informações sobre a compatibilidade do tema Material-UI.
|
|
328
|
-
* @param {unknown} themeInfo Objeto potencialmente parcial do tema (inspeção segura).
|
|
329
|
-
*/
|
|
330
|
-
themeCompatibility(themeInfo) {
|
|
331
|
-
const isRecord = (v) => typeof v === "object" && v !== null;
|
|
332
|
-
const theme = isRecord(themeInfo) ? themeInfo : void 0;
|
|
333
|
-
const palette = theme && isRecord(theme["palette"]) ? theme["palette"] : void 0;
|
|
334
|
-
const primary = palette && isRecord(palette["primary"]);
|
|
335
|
-
const transitions = theme && isRecord(theme["transitions"]) ? theme["transitions"] : void 0;
|
|
336
|
-
const duration = transitions && isRecord(transitions["duration"]);
|
|
337
|
-
this.debug("Theme compatibility check:", {
|
|
338
|
-
hasTheme: !!theme,
|
|
339
|
-
hasPalette: !!palette,
|
|
340
|
-
hasPrimary: !!primary,
|
|
341
|
-
hasTransitions: !!transitions,
|
|
342
|
-
hasDuration: !!duration
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Registra mudanças no estado de consentimento.
|
|
347
|
-
* @param {string} action Ação que causou a mudança de estado.
|
|
348
|
-
* @param {{ consented?: boolean; isModalOpen?: boolean; preferences?: Record<string, unknown> }} state Estado atual.
|
|
349
|
-
*/
|
|
350
|
-
consentState(action, state) {
|
|
351
|
-
this.debug(`Consent state change [${action}]:`, {
|
|
352
|
-
consented: state.consented,
|
|
353
|
-
isModalOpen: state.isModalOpen,
|
|
354
|
-
preferencesCount: Object.keys(state.preferences || {}).length
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Registra operações de cookie (leitura, escrita, remoção).
|
|
359
|
-
* @param {'read' | 'write' | 'delete'} operation Tipo de operação.
|
|
360
|
-
* @param {string} cookieName Nome do cookie.
|
|
361
|
-
* @param {unknown} [data] Dados associados, se aplicável.
|
|
362
|
-
*/
|
|
363
|
-
cookieOperation(operation, cookieName, data) {
|
|
364
|
-
this.debug(`Cookie ${operation}:`, {
|
|
365
|
-
name: cookieName,
|
|
366
|
-
hasData: !!data,
|
|
367
|
-
dataSize: data ? JSON.stringify(data).length : 0
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
368
20
|
});
|
|
369
21
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Registra a renderização de um componente.
|
|
372
|
-
* @param {string} componentName Nome do componente.
|
|
373
|
-
* @param {Record<string, unknown>} [props] Propriedades do componente.
|
|
374
|
-
*/
|
|
375
|
-
componentRender(componentName, props) {
|
|
376
|
-
this.debug(`Component render [${componentName}]:`, {
|
|
377
|
-
hasProps: !!props,
|
|
378
|
-
propsKeys: props ? Object.keys(props) : []
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Registra o status de carregamento de scripts de integração.
|
|
383
|
-
* @param {string} scriptName O nome do script.
|
|
384
|
-
* @param {'load' | 'remove'} action A ação realizada (carregar ou remover).
|
|
385
|
-
* @param {boolean} success Se a operação foi bem-sucedida.
|
|
386
|
-
*/
|
|
387
|
-
scriptIntegration(scriptName, action, success) {
|
|
388
|
-
this.info(`Script ${action} [${scriptName}]:`, success ? "SUCCESS" : "FAILED");
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Registra chamadas à API interna da biblioteca.
|
|
392
|
-
* @param {string} method Nome do método da API chamado.
|
|
393
|
-
* @param {unknown} [params] Parâmetros passados para o método.
|
|
394
|
-
*/
|
|
395
|
-
apiUsage(method, params) {
|
|
396
|
-
this.debug(`API call [${method}]:`, params);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
_ConsentLogger.IS_DEVELOPMENT = typeof globalThis !== "undefined" && globalThis.process?.env?.NODE_ENV === "development";
|
|
400
|
-
_ConsentLogger.LOG_PREFIX = "[react-lgpd-consent]";
|
|
401
|
-
ConsentLogger = _ConsentLogger;
|
|
402
|
-
logger = new ConsentLogger();
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
// src/utils/cookieUtils.ts
|
|
407
|
-
function readConsentCookie(name = DEFAULT_COOKIE_OPTS.name) {
|
|
408
|
-
logger.debug("Reading consent cookie", { name });
|
|
409
|
-
if (typeof document === "undefined") {
|
|
410
|
-
logger.debug("Cookie read skipped: server-side environment");
|
|
411
|
-
return null;
|
|
412
|
-
}
|
|
413
|
-
const raw = import_js_cookie.default.get(name);
|
|
414
|
-
if (!raw) {
|
|
415
|
-
logger.debug("No consent cookie found");
|
|
416
|
-
return null;
|
|
417
|
-
}
|
|
418
|
-
try {
|
|
419
|
-
const data = JSON.parse(raw);
|
|
420
|
-
logger.cookieOperation("read", name, data);
|
|
421
|
-
if (!data.version) {
|
|
422
|
-
logger.debug("Migrating legacy cookie format");
|
|
423
|
-
return migrateLegacyCookie(data);
|
|
424
|
-
}
|
|
425
|
-
if (data.version !== COOKIE_SCHEMA_VERSION) {
|
|
426
|
-
logger.warn(`Cookie version mismatch: ${data.version} != ${COOKIE_SCHEMA_VERSION}`);
|
|
427
|
-
return null;
|
|
428
|
-
}
|
|
429
|
-
return data;
|
|
430
|
-
} catch (error) {
|
|
431
|
-
logger.error("Error parsing consent cookie", error);
|
|
432
|
-
return null;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
function migrateLegacyCookie(legacyData) {
|
|
436
|
-
try {
|
|
437
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
438
|
-
return {
|
|
439
|
-
version: COOKIE_SCHEMA_VERSION,
|
|
440
|
-
consented: Boolean(legacyData.consented) || false,
|
|
441
|
-
preferences: legacyData.preferences && typeof legacyData.preferences === "object" ? legacyData.preferences : { necessary: true },
|
|
442
|
-
consentDate: now,
|
|
443
|
-
lastUpdate: now,
|
|
444
|
-
source: "banner",
|
|
445
|
-
isModalOpen: false
|
|
446
|
-
};
|
|
447
|
-
} catch {
|
|
448
|
-
return null;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
function writeConsentCookie(state, config, opts, source = "banner") {
|
|
452
|
-
if (typeof document === "undefined") {
|
|
453
|
-
logger.debug("Cookie write skipped: server-side environment");
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
457
|
-
const o = { ...DEFAULT_COOKIE_OPTS, ...opts };
|
|
458
|
-
const cookieData = {
|
|
459
|
-
version: COOKIE_SCHEMA_VERSION,
|
|
460
|
-
consented: state.consented,
|
|
461
|
-
preferences: state.preferences,
|
|
462
|
-
consentDate: state.consentDate || now,
|
|
463
|
-
lastUpdate: now,
|
|
464
|
-
source,
|
|
465
|
-
projectConfig: config
|
|
466
|
-
};
|
|
467
|
-
logger.cookieOperation("write", o.name, cookieData);
|
|
468
|
-
import_js_cookie.default.set(o.name, JSON.stringify(cookieData), {
|
|
469
|
-
expires: o.maxAgeDays,
|
|
470
|
-
sameSite: o.sameSite,
|
|
471
|
-
secure: o.secure,
|
|
472
|
-
path: o.path
|
|
473
|
-
});
|
|
474
|
-
logger.info("Consent cookie saved", {
|
|
475
|
-
consented: cookieData.consented,
|
|
476
|
-
source: cookieData.source,
|
|
477
|
-
preferencesCount: Object.keys(cookieData.preferences).length
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
function removeConsentCookie(opts) {
|
|
481
|
-
if (typeof document === "undefined") {
|
|
482
|
-
logger.debug("Cookie removal skipped: server-side environment");
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
const o = { ...DEFAULT_COOKIE_OPTS, ...opts };
|
|
486
|
-
logger.cookieOperation("delete", o.name);
|
|
487
|
-
import_js_cookie.default.remove(o.name, { path: o.path });
|
|
488
|
-
logger.info("Consent cookie removed");
|
|
489
|
-
}
|
|
490
|
-
var import_js_cookie, DEFAULT_COOKIE_OPTS, COOKIE_SCHEMA_VERSION;
|
|
491
|
-
var init_cookieUtils = __esm({
|
|
492
|
-
"src/utils/cookieUtils.ts"() {
|
|
493
|
-
"use strict";
|
|
494
|
-
import_js_cookie = __toESM(require("js-cookie"), 1);
|
|
495
|
-
init_logger();
|
|
496
|
-
DEFAULT_COOKIE_OPTS = {
|
|
497
|
-
name: "cookieConsent",
|
|
498
|
-
maxAgeDays: 365,
|
|
499
|
-
sameSite: "Lax",
|
|
500
|
-
secure: typeof window !== "undefined" ? window.location.protocol === "https:" : false,
|
|
501
|
-
path: "/"
|
|
502
|
-
};
|
|
503
|
-
COOKIE_SCHEMA_VERSION = "1.0";
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
// src/utils/categoryUtils.ts
|
|
508
|
-
function createProjectPreferences(config, defaultValue = false) {
|
|
509
|
-
const preferences = {
|
|
510
|
-
necessary: true
|
|
511
|
-
// Sempre presente e true (essencial)
|
|
512
|
-
};
|
|
513
|
-
const enabledCategories = config?.enabledCategories || [];
|
|
514
|
-
enabledCategories.forEach((category) => {
|
|
515
|
-
if (category !== "necessary") {
|
|
516
|
-
preferences[category] = defaultValue;
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
const custom = config?.customCategories || [];
|
|
520
|
-
custom.forEach((cat) => {
|
|
521
|
-
if (cat.id && cat.id !== "necessary") {
|
|
522
|
-
preferences[cat.id] = defaultValue;
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
|
-
return preferences;
|
|
526
|
-
}
|
|
527
|
-
function validateProjectPreferences(preferences, config) {
|
|
528
|
-
const validPreferences = {
|
|
529
|
-
necessary: true
|
|
530
|
-
// Sempre válida
|
|
531
|
-
};
|
|
532
|
-
const enabledCategories = config?.enabledCategories || [];
|
|
533
|
-
enabledCategories.forEach((category) => {
|
|
534
|
-
if (category !== "necessary" && preferences[category] !== void 0) {
|
|
535
|
-
validPreferences[category] = preferences[category];
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
const custom = config?.customCategories || [];
|
|
539
|
-
custom.forEach((cat) => {
|
|
540
|
-
const id = cat.id;
|
|
541
|
-
if (id && id !== "necessary" && preferences[id] !== void 0) {
|
|
542
|
-
validPreferences[id] = preferences[id];
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
return validPreferences;
|
|
546
|
-
}
|
|
547
|
-
function getAllProjectCategories(config) {
|
|
548
|
-
const allCategories = [
|
|
549
|
-
{
|
|
550
|
-
id: "necessary",
|
|
551
|
-
name: "Necess\xE1rios",
|
|
552
|
-
description: "Cookies essenciais para funcionamento b\xE1sico do site",
|
|
553
|
-
essential: true
|
|
554
|
-
}
|
|
555
|
-
];
|
|
556
|
-
const enabledCategories = config?.enabledCategories || [];
|
|
557
|
-
enabledCategories.forEach((category) => {
|
|
558
|
-
if (category !== "necessary") {
|
|
559
|
-
allCategories.push(getDefaultCategoryDefinition(category));
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
const custom = config?.customCategories || [];
|
|
563
|
-
custom.forEach((cat) => {
|
|
564
|
-
if (cat.id && cat.id !== "necessary") {
|
|
565
|
-
allCategories.push({ ...cat, essential: !!cat.essential });
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
return allCategories;
|
|
569
|
-
}
|
|
570
|
-
function getDefaultCategoryDefinition(category) {
|
|
571
|
-
const definitions = {
|
|
572
|
-
necessary: {
|
|
573
|
-
id: "necessary",
|
|
574
|
-
name: "Necess\xE1rios",
|
|
575
|
-
description: "Cookies essenciais para funcionamento b\xE1sico do site",
|
|
576
|
-
essential: true
|
|
577
|
-
},
|
|
578
|
-
analytics: {
|
|
579
|
-
id: "analytics",
|
|
580
|
-
name: "An\xE1lise e Estat\xEDsticas",
|
|
581
|
-
description: "Cookies para an\xE1lise de uso e estat\xEDsticas do site",
|
|
582
|
-
essential: false
|
|
583
|
-
},
|
|
584
|
-
functional: {
|
|
585
|
-
id: "functional",
|
|
586
|
-
name: "Funcionalidades",
|
|
587
|
-
description: "Cookies para funcionalidades extras como prefer\xEAncias e idioma",
|
|
588
|
-
essential: false
|
|
589
|
-
},
|
|
590
|
-
marketing: {
|
|
591
|
-
id: "marketing",
|
|
592
|
-
name: "Marketing e Publicidade",
|
|
593
|
-
description: "Cookies para publicidade direcionada e marketing",
|
|
594
|
-
essential: false
|
|
595
|
-
},
|
|
596
|
-
social: {
|
|
597
|
-
id: "social",
|
|
598
|
-
name: "Redes Sociais",
|
|
599
|
-
description: "Cookies para integra\xE7\xE3o com redes sociais e compartilhamento",
|
|
600
|
-
essential: false
|
|
601
|
-
},
|
|
602
|
-
personalization: {
|
|
603
|
-
id: "personalization",
|
|
604
|
-
name: "Personaliza\xE7\xE3o",
|
|
605
|
-
description: "Cookies para personaliza\xE7\xE3o de conte\xFAdo e experi\xEAncia",
|
|
606
|
-
essential: false
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
return definitions[category];
|
|
610
|
-
}
|
|
611
|
-
var init_categoryUtils = __esm({
|
|
612
|
-
"src/utils/categoryUtils.ts"() {
|
|
613
|
-
"use strict";
|
|
614
|
-
}
|
|
615
|
-
});
|
|
616
|
-
|
|
617
|
-
// src/context/DesignContext.tsx
|
|
618
|
-
function DesignProvider({
|
|
619
|
-
tokens,
|
|
620
|
-
children
|
|
621
|
-
}) {
|
|
622
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DesignContext.Provider, { value: tokens, children });
|
|
623
|
-
}
|
|
624
|
-
function useDesignTokens() {
|
|
625
|
-
return React3.useContext(DesignContext);
|
|
626
|
-
}
|
|
627
|
-
var React3, import_jsx_runtime2, DesignContext;
|
|
628
|
-
var init_DesignContext = __esm({
|
|
629
|
-
"src/context/DesignContext.tsx"() {
|
|
630
|
-
"use strict";
|
|
631
|
-
React3 = __toESM(require("react"), 1);
|
|
632
|
-
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
633
|
-
DesignContext = React3.createContext(void 0);
|
|
634
|
-
}
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
// src/components/Branding.tsx
|
|
638
|
-
function Branding({ variant, hidden = false }) {
|
|
639
|
-
const texts = useConsentTexts();
|
|
640
|
-
const designTokens = useDesignTokens();
|
|
641
|
-
if (hidden) return null;
|
|
642
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
643
|
-
import_Typography.default,
|
|
644
|
-
{
|
|
645
|
-
variant: "caption",
|
|
646
|
-
sx: (theme) => ({
|
|
647
|
-
...brandingStyles[variant],
|
|
648
|
-
color: designTokens?.colors?.text ?? theme.palette.text.secondary
|
|
649
|
-
}),
|
|
650
|
-
children: [
|
|
651
|
-
texts.brandingPoweredBy || "fornecido por",
|
|
652
|
-
" ",
|
|
653
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
654
|
-
import_Link.default,
|
|
655
|
-
{
|
|
656
|
-
href: "https://www.ledipo.eti.br",
|
|
657
|
-
target: "_blank",
|
|
658
|
-
rel: "noopener noreferrer",
|
|
659
|
-
sx: (theme) => ({
|
|
660
|
-
...linkStyles,
|
|
661
|
-
color: designTokens?.colors?.primary ?? theme.palette.primary.main
|
|
662
|
-
}),
|
|
663
|
-
children: "L\xC9dipO.eti.br"
|
|
664
|
-
}
|
|
665
|
-
)
|
|
666
|
-
]
|
|
667
|
-
}
|
|
668
|
-
);
|
|
669
|
-
}
|
|
670
|
-
var import_Link, import_Typography, import_jsx_runtime3, brandingStyles, linkStyles;
|
|
671
|
-
var init_Branding = __esm({
|
|
672
|
-
"src/components/Branding.tsx"() {
|
|
673
|
-
"use strict";
|
|
674
|
-
init_useConsent();
|
|
675
|
-
init_DesignContext();
|
|
676
|
-
import_Link = __toESM(require("@mui/material/Link"), 1);
|
|
677
|
-
import_Typography = __toESM(require("@mui/material/Typography"), 1);
|
|
678
|
-
import_jsx_runtime3 = require("react/jsx-runtime");
|
|
679
|
-
brandingStyles = {
|
|
680
|
-
banner: {
|
|
681
|
-
fontSize: "0.65rem",
|
|
682
|
-
textAlign: "right",
|
|
683
|
-
mt: 1,
|
|
684
|
-
opacity: 0.7,
|
|
685
|
-
fontStyle: "italic",
|
|
686
|
-
width: "100%"
|
|
687
|
-
},
|
|
688
|
-
modal: {
|
|
689
|
-
fontSize: "0.65rem",
|
|
690
|
-
textAlign: "right",
|
|
691
|
-
px: 3,
|
|
692
|
-
pb: 1,
|
|
693
|
-
opacity: 0.7,
|
|
694
|
-
fontStyle: "italic",
|
|
695
|
-
width: "100%"
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
linkStyles = {
|
|
699
|
-
textDecoration: "none",
|
|
700
|
-
fontWeight: 500,
|
|
701
|
-
"&:hover": {
|
|
702
|
-
textDecoration: "underline"
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
|
|
708
|
-
// src/components/CookieBanner.tsx
|
|
709
|
-
function CookieBanner({
|
|
710
|
-
policyLinkUrl,
|
|
711
|
-
debug,
|
|
712
|
-
blocking = true,
|
|
713
|
-
hideBranding = false,
|
|
714
|
-
SnackbarProps,
|
|
715
|
-
PaperProps
|
|
716
|
-
}) {
|
|
717
|
-
const { consented, acceptAll, rejectAll, openPreferences } = useConsent();
|
|
718
|
-
const texts = useConsentTexts();
|
|
719
|
-
const isHydrated = useConsentHydration();
|
|
720
|
-
const designTokens = useDesignTokens();
|
|
721
|
-
const open = debug ? true : isHydrated && !consented;
|
|
722
|
-
logger.componentRender("CookieBanner", {
|
|
723
|
-
open,
|
|
724
|
-
consented,
|
|
725
|
-
isHydrated,
|
|
726
|
-
blocking,
|
|
727
|
-
hideBranding
|
|
728
|
-
});
|
|
729
|
-
if (!open) return null;
|
|
730
|
-
const bannerStyle = {
|
|
731
|
-
p: designTokens?.spacing?.padding?.banner ?? 2,
|
|
732
|
-
maxWidth: 720,
|
|
733
|
-
mx: "auto",
|
|
734
|
-
backgroundColor: designTokens?.colors?.background,
|
|
735
|
-
color: designTokens?.colors?.text,
|
|
736
|
-
borderRadius: designTokens?.spacing?.borderRadius?.banner,
|
|
737
|
-
fontFamily: designTokens?.typography?.fontFamily
|
|
738
|
-
};
|
|
739
|
-
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: [
|
|
740
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_Typography2.default, { variant: "body2", sx: { fontSize: designTokens?.typography?.fontSize?.banner }, children: [
|
|
741
|
-
texts.bannerMessage,
|
|
742
|
-
" ",
|
|
743
|
-
policyLinkUrl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
744
|
-
import_Link2.default,
|
|
745
|
-
{
|
|
746
|
-
href: policyLinkUrl,
|
|
747
|
-
underline: "hover",
|
|
748
|
-
target: "_blank",
|
|
749
|
-
rel: "noopener noreferrer",
|
|
750
|
-
sx: { color: designTokens?.colors?.primary },
|
|
751
|
-
children: texts.policyLink ?? "Saiba mais"
|
|
752
|
-
}
|
|
753
|
-
)
|
|
754
|
-
] }),
|
|
755
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_Stack.default, { direction: { xs: "column", sm: "row" }, spacing: 1, justifyContent: "flex-end", children: [
|
|
756
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
757
|
-
import_Button.default,
|
|
758
|
-
{
|
|
759
|
-
variant: "outlined",
|
|
760
|
-
onClick: () => {
|
|
761
|
-
logger.apiUsage("rejectAll", { source: "banner" });
|
|
762
|
-
rejectAll();
|
|
763
|
-
},
|
|
764
|
-
sx: { color: designTokens?.colors?.secondary },
|
|
765
|
-
children: texts.declineAll
|
|
766
|
-
}
|
|
767
|
-
),
|
|
768
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
769
|
-
import_Button.default,
|
|
770
|
-
{
|
|
771
|
-
variant: "contained",
|
|
772
|
-
onClick: () => {
|
|
773
|
-
logger.apiUsage("acceptAll", { source: "banner" });
|
|
774
|
-
acceptAll();
|
|
775
|
-
},
|
|
776
|
-
sx: { backgroundColor: designTokens?.colors?.primary },
|
|
777
|
-
children: texts.acceptAll
|
|
778
|
-
}
|
|
779
|
-
),
|
|
780
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
781
|
-
import_Button.default,
|
|
782
|
-
{
|
|
783
|
-
variant: "text",
|
|
784
|
-
onClick: () => {
|
|
785
|
-
logger.apiUsage("openPreferences", { source: "banner" });
|
|
786
|
-
openPreferences();
|
|
787
|
-
},
|
|
788
|
-
sx: { color: designTokens?.colors?.text },
|
|
789
|
-
children: texts.preferences
|
|
790
|
-
}
|
|
791
|
-
)
|
|
792
|
-
] }),
|
|
793
|
-
!hideBranding && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Branding, { variant: "banner" })
|
|
794
|
-
] }) });
|
|
795
|
-
const positionStyle = {
|
|
796
|
-
position: "fixed",
|
|
797
|
-
zIndex: 1300,
|
|
798
|
-
...designTokens?.layout?.position === "top" ? { top: 0 } : { bottom: 0 },
|
|
799
|
-
left: 0,
|
|
800
|
-
right: 0,
|
|
801
|
-
width: designTokens?.layout?.width?.desktop ?? "100%",
|
|
802
|
-
p: 2
|
|
803
|
-
};
|
|
804
|
-
let backdropColor = "rgba(0, 0, 0, 0.4)";
|
|
805
|
-
const backdropToken = designTokens?.layout?.backdrop;
|
|
806
|
-
if (backdropToken === false) {
|
|
807
|
-
backdropColor = "transparent";
|
|
808
|
-
} else if (typeof backdropToken === "string") {
|
|
809
|
-
backdropColor = backdropToken;
|
|
810
|
-
}
|
|
811
|
-
if (blocking) {
|
|
812
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
813
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
814
|
-
import_Box.default,
|
|
815
|
-
{
|
|
816
|
-
sx: {
|
|
817
|
-
position: "fixed",
|
|
818
|
-
top: 0,
|
|
819
|
-
left: 0,
|
|
820
|
-
right: 0,
|
|
821
|
-
bottom: 0,
|
|
822
|
-
backgroundColor: backdropColor,
|
|
823
|
-
zIndex: 1299
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
),
|
|
827
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_Box.default, { sx: positionStyle, children: bannerContent })
|
|
828
|
-
] });
|
|
829
|
-
}
|
|
830
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
831
|
-
import_Snackbar.default,
|
|
832
|
-
{
|
|
833
|
-
open,
|
|
834
|
-
anchorOrigin: {
|
|
835
|
-
vertical: designTokens?.layout?.position === "top" ? "top" : "bottom",
|
|
836
|
-
horizontal: "center"
|
|
837
|
-
},
|
|
838
|
-
...SnackbarProps,
|
|
839
|
-
children: bannerContent
|
|
840
|
-
}
|
|
841
|
-
);
|
|
842
|
-
}
|
|
843
|
-
var import_Button, import_Box, import_Paper, import_Snackbar, import_Stack, import_Typography2, import_Link2, import_jsx_runtime4;
|
|
844
|
-
var init_CookieBanner = __esm({
|
|
845
|
-
"src/components/CookieBanner.tsx"() {
|
|
846
|
-
"use strict";
|
|
847
|
-
import_Button = __toESM(require("@mui/material/Button"), 1);
|
|
848
|
-
import_Box = __toESM(require("@mui/material/Box"), 1);
|
|
849
|
-
import_Paper = __toESM(require("@mui/material/Paper"), 1);
|
|
850
|
-
import_Snackbar = __toESM(require("@mui/material/Snackbar"), 1);
|
|
851
|
-
import_Stack = __toESM(require("@mui/material/Stack"), 1);
|
|
852
|
-
import_Typography2 = __toESM(require("@mui/material/Typography"), 1);
|
|
853
|
-
import_Link2 = __toESM(require("@mui/material/Link"), 1);
|
|
854
|
-
init_useConsent();
|
|
855
|
-
init_DesignContext();
|
|
856
|
-
init_Branding();
|
|
857
|
-
init_logger();
|
|
858
|
-
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
859
|
-
}
|
|
860
|
-
});
|
|
861
|
-
|
|
862
|
-
// src/components/FloatingPreferencesButton.tsx
|
|
863
|
-
function useThemeWithFallbacks() {
|
|
864
|
-
const theme = (0, import_styles.useTheme)();
|
|
865
|
-
logger.themeCompatibility(theme);
|
|
866
|
-
return {
|
|
867
|
-
palette: {
|
|
868
|
-
primary: {
|
|
869
|
-
main: theme?.palette?.primary?.main || "#1976d2",
|
|
870
|
-
dark: theme?.palette?.primary?.dark || "#1565c0"
|
|
871
|
-
}
|
|
872
|
-
},
|
|
873
|
-
transitions: {
|
|
874
|
-
duration: {
|
|
875
|
-
shortest: theme?.transitions?.duration?.shortest || 150,
|
|
876
|
-
short: theme?.transitions?.duration?.short || 250
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
}
|
|
881
|
-
function FloatingPreferencesButton({
|
|
882
|
-
position = "bottom-right",
|
|
883
|
-
offset = 24,
|
|
884
|
-
icon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_CookieOutlined.default, {}),
|
|
885
|
-
tooltip,
|
|
886
|
-
FabProps,
|
|
887
|
-
hideWhenConsented = false
|
|
888
|
-
}) {
|
|
889
|
-
const { openPreferences, consented } = useConsent();
|
|
890
|
-
const texts = useConsentTexts();
|
|
891
|
-
const safeTheme = useThemeWithFallbacks();
|
|
892
|
-
const designTokens = useDesignTokens();
|
|
893
|
-
logger.componentRender("FloatingPreferencesButton", {
|
|
894
|
-
position,
|
|
895
|
-
offset,
|
|
896
|
-
hideWhenConsented,
|
|
897
|
-
consented
|
|
898
|
-
});
|
|
899
|
-
if (hideWhenConsented && consented) {
|
|
900
|
-
logger.debug(
|
|
901
|
-
"FloatingPreferencesButton: Hidden due to hideWhenConsented=true and consented=true"
|
|
902
|
-
);
|
|
903
|
-
return null;
|
|
904
|
-
}
|
|
905
|
-
const tooltipText = tooltip ?? texts.preferencesButton ?? "Gerenciar Prefer\xEAncias de Cookies";
|
|
906
|
-
const getPosition = () => {
|
|
907
|
-
const styles = {
|
|
908
|
-
position: "fixed",
|
|
909
|
-
zIndex: 1200
|
|
910
|
-
};
|
|
911
|
-
switch (position) {
|
|
912
|
-
case "bottom-left":
|
|
913
|
-
return { ...styles, bottom: offset, left: offset };
|
|
914
|
-
case "bottom-right":
|
|
915
|
-
return { ...styles, bottom: offset, right: offset };
|
|
916
|
-
case "top-left":
|
|
917
|
-
return { ...styles, top: offset, left: offset };
|
|
918
|
-
case "top-right":
|
|
919
|
-
return { ...styles, top: offset, right: offset };
|
|
920
|
-
default:
|
|
921
|
-
return { ...styles, bottom: offset, right: offset };
|
|
922
|
-
}
|
|
923
|
-
};
|
|
924
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Tooltip.default, { title: tooltipText, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
925
|
-
import_Fab.default,
|
|
926
|
-
{
|
|
927
|
-
size: "medium",
|
|
928
|
-
color: "primary",
|
|
929
|
-
onClick: openPreferences,
|
|
930
|
-
sx: {
|
|
931
|
-
...getPosition(),
|
|
932
|
-
backgroundColor: designTokens?.colors?.primary ?? safeTheme.palette.primary.main,
|
|
933
|
-
"&:hover": {
|
|
934
|
-
backgroundColor: designTokens?.colors?.primary ? designTokens?.colors?.primary : safeTheme.palette.primary.dark
|
|
935
|
-
},
|
|
936
|
-
transition: `all ${safeTheme.transitions.duration.short}ms`
|
|
937
|
-
},
|
|
938
|
-
"aria-label": tooltipText,
|
|
939
|
-
...FabProps,
|
|
940
|
-
children: icon
|
|
941
|
-
}
|
|
942
|
-
) });
|
|
943
|
-
}
|
|
944
|
-
var import_CookieOutlined, import_Fab, import_Tooltip, import_styles, import_jsx_runtime5;
|
|
945
|
-
var init_FloatingPreferencesButton = __esm({
|
|
946
|
-
"src/components/FloatingPreferencesButton.tsx"() {
|
|
947
|
-
"use strict";
|
|
948
|
-
import_CookieOutlined = __toESM(require("@mui/icons-material/CookieOutlined"), 1);
|
|
949
|
-
import_Fab = __toESM(require("@mui/material/Fab"), 1);
|
|
950
|
-
import_Tooltip = __toESM(require("@mui/material/Tooltip"), 1);
|
|
951
|
-
import_styles = require("@mui/material/styles");
|
|
952
|
-
init_DesignContext();
|
|
953
|
-
init_useConsent();
|
|
954
|
-
init_logger();
|
|
955
|
-
import_jsx_runtime5 = require("react/jsx-runtime");
|
|
956
|
-
}
|
|
957
|
-
});
|
|
958
|
-
|
|
959
|
-
// src/context/ConsentContext.tsx
|
|
960
|
-
function createFullConsentState(consented, preferences, source, projectConfig, isModalOpen = false, existingState) {
|
|
961
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
962
|
-
return {
|
|
963
|
-
version: "1.0",
|
|
964
|
-
consented,
|
|
965
|
-
preferences,
|
|
966
|
-
consentDate: existingState?.consentDate || now,
|
|
967
|
-
lastUpdate: now,
|
|
968
|
-
source,
|
|
969
|
-
projectConfig,
|
|
970
|
-
isModalOpen
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
function reducer(state, action) {
|
|
974
|
-
logger.consentState(action.type, state);
|
|
975
|
-
switch (action.type) {
|
|
976
|
-
case "ACCEPT_ALL": {
|
|
977
|
-
const prefs = createProjectPreferences(action.config, true);
|
|
978
|
-
const newState = createFullConsentState(true, prefs, "banner", action.config, false, state);
|
|
979
|
-
logger.info("User accepted all cookies", {
|
|
980
|
-
preferences: newState.preferences
|
|
981
|
-
});
|
|
982
|
-
return newState;
|
|
983
|
-
}
|
|
984
|
-
case "REJECT_ALL": {
|
|
985
|
-
const prefs = createProjectPreferences(action.config, false);
|
|
986
|
-
const newState = createFullConsentState(true, prefs, "banner", action.config, false, state);
|
|
987
|
-
logger.info("User rejected all cookies", {
|
|
988
|
-
preferences: newState.preferences
|
|
989
|
-
});
|
|
990
|
-
return newState;
|
|
991
|
-
}
|
|
992
|
-
case "SET_CATEGORY":
|
|
993
|
-
logger.debug("Category preference changed", {
|
|
994
|
-
category: action.category,
|
|
995
|
-
value: action.value
|
|
996
|
-
});
|
|
997
|
-
return {
|
|
998
|
-
...state,
|
|
999
|
-
preferences: {
|
|
1000
|
-
...state.preferences,
|
|
1001
|
-
[action.category]: action.value
|
|
1002
|
-
},
|
|
1003
|
-
lastUpdate: (/* @__PURE__ */ new Date()).toISOString()
|
|
1004
|
-
};
|
|
1005
|
-
case "SET_PREFERENCES":
|
|
1006
|
-
logger.info("Preferences saved", { preferences: action.preferences });
|
|
1007
|
-
return createFullConsentState(true, action.preferences, "modal", action.config, false, state);
|
|
1008
|
-
case "OPEN_MODAL":
|
|
1009
|
-
return { ...state, isModalOpen: true };
|
|
1010
|
-
case "CLOSE_MODAL":
|
|
1011
|
-
return createFullConsentState(true, state.preferences, "modal", action.config, false, state);
|
|
1012
|
-
case "RESET": {
|
|
1013
|
-
return createFullConsentState(
|
|
1014
|
-
false,
|
|
1015
|
-
createProjectPreferences(action.config),
|
|
1016
|
-
"programmatic",
|
|
1017
|
-
action.config,
|
|
1018
|
-
false
|
|
1019
|
-
);
|
|
1020
|
-
}
|
|
1021
|
-
case "HYDRATE": {
|
|
1022
|
-
const validatedPreferences = validateProjectPreferences(
|
|
1023
|
-
action.state.preferences,
|
|
1024
|
-
action.config
|
|
1025
|
-
);
|
|
1026
|
-
return {
|
|
1027
|
-
...action.state,
|
|
1028
|
-
preferences: validatedPreferences,
|
|
1029
|
-
isModalOpen: false
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
default:
|
|
1033
|
-
return state;
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
function ConsentProvider({
|
|
1037
|
-
initialState,
|
|
1038
|
-
categories,
|
|
1039
|
-
texts: textsProp,
|
|
1040
|
-
theme,
|
|
1041
|
-
designTokens,
|
|
1042
|
-
PreferencesModalComponent,
|
|
1043
|
-
preferencesModalProps = {},
|
|
1044
|
-
CookieBannerComponent,
|
|
1045
|
-
cookieBannerProps = {},
|
|
1046
|
-
FloatingPreferencesButtonComponent,
|
|
1047
|
-
floatingPreferencesButtonProps = {},
|
|
1048
|
-
disableFloatingPreferencesButton = false,
|
|
1049
|
-
blocking = false,
|
|
1050
|
-
blockingStrategy = "auto",
|
|
1051
|
-
hideBranding = false,
|
|
1052
|
-
onConsentGiven,
|
|
1053
|
-
onPreferencesSaved,
|
|
1054
|
-
cookie: cookieOpts,
|
|
1055
|
-
disableDeveloperGuidance,
|
|
1056
|
-
children
|
|
1057
|
-
}) {
|
|
1058
|
-
const texts = React4.useMemo(() => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }), [textsProp]);
|
|
1059
|
-
const cookie = React4.useMemo(
|
|
1060
|
-
() => ({ ...DEFAULT_COOKIE_OPTS, ...cookieOpts ?? {} }),
|
|
1061
|
-
[cookieOpts]
|
|
1062
|
-
);
|
|
1063
|
-
const mergedTheme = theme;
|
|
1064
|
-
const finalCategoriesConfig = React4.useMemo(() => {
|
|
1065
|
-
if (categories) return categories;
|
|
1066
|
-
return DEFAULT_PROJECT_CATEGORIES;
|
|
1067
|
-
}, [categories]);
|
|
1068
|
-
useDeveloperGuidance(finalCategoriesConfig, disableDeveloperGuidance);
|
|
1069
|
-
const boot = React4.useMemo(() => {
|
|
1070
|
-
if (initialState) return { ...initialState, isModalOpen: false };
|
|
1071
|
-
return createFullConsentState(
|
|
1072
|
-
false,
|
|
1073
|
-
createProjectPreferences(finalCategoriesConfig),
|
|
1074
|
-
"banner",
|
|
1075
|
-
finalCategoriesConfig,
|
|
1076
|
-
false
|
|
1077
|
-
);
|
|
1078
|
-
}, [initialState, finalCategoriesConfig]);
|
|
1079
|
-
const [state, dispatch] = React4.useReducer(reducer, boot);
|
|
1080
|
-
const [isHydrated, setIsHydrated] = React4.useState(false);
|
|
1081
|
-
React4.useEffect(() => {
|
|
1082
|
-
if (!initialState) {
|
|
1083
|
-
const saved = readConsentCookie(cookie.name);
|
|
1084
|
-
if (saved?.consented) {
|
|
1085
|
-
dispatch({
|
|
1086
|
-
type: "HYDRATE",
|
|
1087
|
-
state: saved,
|
|
1088
|
-
config: finalCategoriesConfig
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
setIsHydrated(true);
|
|
1093
|
-
}, [cookie.name, initialState, finalCategoriesConfig]);
|
|
1094
|
-
React4.useEffect(() => {
|
|
1095
|
-
if (state.consented) writeConsentCookie(state, finalCategoriesConfig, cookie);
|
|
1096
|
-
}, [state, cookie, finalCategoriesConfig]);
|
|
1097
|
-
const prevConsented = React4.useRef(state.consented);
|
|
1098
|
-
React4.useEffect(() => {
|
|
1099
|
-
if (!prevConsented.current && state.consented && onConsentGiven) {
|
|
1100
|
-
setTimeout(() => onConsentGiven(state), 150);
|
|
1101
|
-
}
|
|
1102
|
-
prevConsented.current = state.consented;
|
|
1103
|
-
}, [state, onConsentGiven]);
|
|
1104
|
-
const api = React4.useMemo(() => {
|
|
1105
|
-
const acceptAll = () => dispatch({ type: "ACCEPT_ALL", config: finalCategoriesConfig });
|
|
1106
|
-
const rejectAll = () => dispatch({ type: "REJECT_ALL", config: finalCategoriesConfig });
|
|
1107
|
-
const setPreference = (category, value) => dispatch({ type: "SET_CATEGORY", category, value });
|
|
1108
|
-
const setPreferences = (preferences) => {
|
|
1109
|
-
dispatch({
|
|
1110
|
-
type: "SET_PREFERENCES",
|
|
1111
|
-
preferences,
|
|
1112
|
-
config: finalCategoriesConfig
|
|
1113
|
-
});
|
|
1114
|
-
if (onPreferencesSaved) {
|
|
1115
|
-
setTimeout(() => onPreferencesSaved(preferences), 150);
|
|
1116
|
-
}
|
|
1117
|
-
};
|
|
1118
|
-
const openPreferences = () => dispatch({ type: "OPEN_MODAL" });
|
|
1119
|
-
const closePreferences = () => dispatch({ type: "CLOSE_MODAL", config: finalCategoriesConfig });
|
|
1120
|
-
const resetConsent = () => {
|
|
1121
|
-
removeConsentCookie(cookie);
|
|
1122
|
-
dispatch({ type: "RESET", config: finalCategoriesConfig });
|
|
1123
|
-
};
|
|
1124
|
-
return {
|
|
1125
|
-
consented: !!state.consented,
|
|
1126
|
-
preferences: state.preferences,
|
|
1127
|
-
isModalOpen: state.isModalOpen,
|
|
1128
|
-
acceptAll,
|
|
1129
|
-
rejectAll,
|
|
1130
|
-
setPreference,
|
|
1131
|
-
setPreferences,
|
|
1132
|
-
openPreferences,
|
|
1133
|
-
closePreferences,
|
|
1134
|
-
resetConsent
|
|
1135
|
-
};
|
|
1136
|
-
}, [state, cookie, finalCategoriesConfig, onPreferencesSaved]);
|
|
1137
|
-
React4.useEffect(() => {
|
|
1138
|
-
_registerGlobalOpenPreferences(api.openPreferences);
|
|
1139
|
-
return () => _unregisterGlobalOpenPreferences();
|
|
1140
|
-
}, [api.openPreferences]);
|
|
1141
|
-
const providerBackdropColor = React4.useMemo(() => {
|
|
1142
|
-
const backdrop = designTokens?.layout?.backdrop;
|
|
1143
|
-
if (backdrop === false) return "transparent";
|
|
1144
|
-
if (typeof backdrop === "string") return backdrop;
|
|
1145
|
-
return "rgba(0, 0, 0, 0.4)";
|
|
1146
|
-
}, [designTokens]);
|
|
1147
|
-
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)(
|
|
1148
|
-
CategoriesProvider,
|
|
1149
|
-
{
|
|
1150
|
-
config: finalCategoriesConfig,
|
|
1151
|
-
disableDeveloperGuidance,
|
|
1152
|
-
children: [
|
|
1153
|
-
children,
|
|
1154
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(React4.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1155
|
-
PreferencesModalComponent,
|
|
1156
|
-
{
|
|
1157
|
-
preferences: api.preferences,
|
|
1158
|
-
setPreferences: api.setPreferences,
|
|
1159
|
-
closePreferences: api.closePreferences,
|
|
1160
|
-
isModalOpen: api.isModalOpen,
|
|
1161
|
-
texts,
|
|
1162
|
-
...preferencesModalProps
|
|
1163
|
-
}
|
|
1164
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PreferencesModal, { hideBranding }) }),
|
|
1165
|
-
blocking && isHydrated && !state.consented && blockingStrategy === "provider" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1166
|
-
"div",
|
|
1167
|
-
{
|
|
1168
|
-
style: {
|
|
1169
|
-
position: "fixed",
|
|
1170
|
-
top: 0,
|
|
1171
|
-
left: 0,
|
|
1172
|
-
right: 0,
|
|
1173
|
-
bottom: 0,
|
|
1174
|
-
backgroundColor: providerBackdropColor,
|
|
1175
|
-
zIndex: 1299
|
|
1176
|
-
},
|
|
1177
|
-
"data-testid": "lgpd-provider-overlay",
|
|
1178
|
-
"aria-hidden": true
|
|
1179
|
-
}
|
|
1180
|
-
),
|
|
1181
|
-
!state.consented && isHydrated && (CookieBannerComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1182
|
-
CookieBannerComponent,
|
|
1183
|
-
{
|
|
1184
|
-
consented: api.consented,
|
|
1185
|
-
acceptAll: api.acceptAll,
|
|
1186
|
-
rejectAll: api.rejectAll,
|
|
1187
|
-
openPreferences: api.openPreferences,
|
|
1188
|
-
texts,
|
|
1189
|
-
blocking,
|
|
1190
|
-
...cookieBannerProps
|
|
1191
|
-
}
|
|
1192
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1193
|
-
CookieBanner,
|
|
1194
|
-
{
|
|
1195
|
-
blocking,
|
|
1196
|
-
hideBranding,
|
|
1197
|
-
...cookieBannerProps
|
|
1198
|
-
}
|
|
1199
|
-
)),
|
|
1200
|
-
state.consented && !disableFloatingPreferencesButton && (FloatingPreferencesButtonComponent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1201
|
-
FloatingPreferencesButtonComponent,
|
|
1202
|
-
{
|
|
1203
|
-
openPreferences: api.openPreferences,
|
|
1204
|
-
consented: api.consented,
|
|
1205
|
-
...floatingPreferencesButtonProps
|
|
1206
|
-
}
|
|
1207
|
-
) : (
|
|
1208
|
-
// Encaminha `floatingPreferencesButtonProps` para o componente padrão
|
|
1209
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1210
|
-
FloatingPreferencesButton,
|
|
1211
|
-
{
|
|
1212
|
-
...floatingPreferencesButtonProps ?? {}
|
|
1213
|
-
}
|
|
1214
|
-
)
|
|
1215
|
-
))
|
|
1216
|
-
]
|
|
1217
|
-
}
|
|
1218
|
-
) }) }) }) }) });
|
|
1219
|
-
if (mergedTheme) {
|
|
1220
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_styles2.ThemeProvider, { theme: mergedTheme, children: content });
|
|
1221
|
-
}
|
|
1222
|
-
return content;
|
|
1223
|
-
}
|
|
1224
|
-
function useConsentStateInternal() {
|
|
1225
|
-
const ctx = React4.useContext(StateCtx);
|
|
1226
|
-
if (!ctx) throw new Error("useConsentState must be used within ConsentProvider");
|
|
1227
|
-
return ctx;
|
|
1228
|
-
}
|
|
1229
|
-
function useConsentActionsInternal() {
|
|
1230
|
-
const ctx = React4.useContext(ActionsCtx);
|
|
1231
|
-
if (!ctx) throw new Error("useConsentActions must be used within ConsentProvider");
|
|
1232
|
-
return ctx;
|
|
1233
|
-
}
|
|
1234
|
-
function useConsentTextsInternal() {
|
|
1235
|
-
const ctx = React4.useContext(TextsCtx);
|
|
1236
|
-
return ctx;
|
|
1237
|
-
}
|
|
1238
|
-
function useConsentHydrationInternal() {
|
|
1239
|
-
return React4.useContext(HydrationCtx);
|
|
1240
|
-
}
|
|
1241
|
-
var React4, import_styles2, import_jsx_runtime6, PreferencesModal, DEFAULT_TEXTS, StateCtx, ActionsCtx, TextsCtx, HydrationCtx, defaultTexts;
|
|
1242
|
-
var init_ConsentContext = __esm({
|
|
1243
|
-
"src/context/ConsentContext.tsx"() {
|
|
1244
|
-
"use strict";
|
|
1245
|
-
React4 = __toESM(require("react"), 1);
|
|
1246
|
-
import_styles2 = require("@mui/material/styles");
|
|
1247
|
-
init_cookieUtils();
|
|
1248
|
-
init_categoryUtils();
|
|
1249
|
-
init_CategoriesContext();
|
|
1250
|
-
init_DesignContext();
|
|
1251
|
-
init_developerGuidance();
|
|
1252
|
-
init_useConsent();
|
|
1253
|
-
init_logger();
|
|
1254
|
-
init_CookieBanner();
|
|
1255
|
-
init_FloatingPreferencesButton();
|
|
1256
|
-
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1257
|
-
PreferencesModal = React4.lazy(
|
|
1258
|
-
() => Promise.resolve().then(() => (init_PreferencesModal(), PreferencesModal_exports)).then((m) => ({
|
|
1259
|
-
default: m.PreferencesModal
|
|
1260
|
-
}))
|
|
1261
|
-
);
|
|
1262
|
-
DEFAULT_TEXTS = {
|
|
1263
|
-
// Textos básicos
|
|
1264
|
-
bannerMessage: "Utilizamos cookies para melhorar sua experi\xEAncia.",
|
|
1265
|
-
acceptAll: "Aceitar todos",
|
|
1266
|
-
declineAll: "Recusar",
|
|
1267
|
-
preferences: "Prefer\xEAncias",
|
|
1268
|
-
policyLink: "Saiba mais",
|
|
1269
|
-
modalTitle: "Prefer\xEAncias de Cookies",
|
|
1270
|
-
modalIntro: "Ajuste as categorias de cookies. Cookies necess\xE1rios s\xE3o sempre utilizados para funcionalidades b\xE1sicas.",
|
|
1271
|
-
save: "Salvar prefer\xEAncias",
|
|
1272
|
-
necessaryAlwaysOn: "Cookies necess\xE1rios (sempre ativos)",
|
|
1273
|
-
// Textos adicionais para UI customizada
|
|
1274
|
-
preferencesButton: "Configurar Cookies",
|
|
1275
|
-
preferencesTitle: "Gerenciar Prefer\xEAncias de Cookies",
|
|
1276
|
-
preferencesDescription: "Escolha quais tipos de cookies voc\xEA permite que sejam utilizados.",
|
|
1277
|
-
close: "Fechar",
|
|
1278
|
-
accept: "Aceitar",
|
|
1279
|
-
reject: "Rejeitar",
|
|
1280
|
-
// Textos ANPD expandidos (opcionais)
|
|
1281
|
-
brandingPoweredBy: "fornecido por",
|
|
1282
|
-
controllerInfo: void 0,
|
|
1283
|
-
// Exibido se definido
|
|
1284
|
-
dataTypes: void 0,
|
|
1285
|
-
// Exibido se definido
|
|
1286
|
-
thirdPartySharing: void 0,
|
|
1287
|
-
// Exibido se definido
|
|
1288
|
-
userRights: void 0,
|
|
1289
|
-
// Exibido se definido
|
|
1290
|
-
contactInfo: void 0,
|
|
1291
|
-
// Exibido se definido
|
|
1292
|
-
retentionPeriod: void 0,
|
|
1293
|
-
// Exibido se definido
|
|
1294
|
-
lawfulBasis: void 0,
|
|
1295
|
-
// Exibido se definido
|
|
1296
|
-
transferCountries: void 0
|
|
1297
|
-
// Exibido se definido
|
|
1298
|
-
};
|
|
1299
|
-
StateCtx = React4.createContext(null);
|
|
1300
|
-
ActionsCtx = React4.createContext(null);
|
|
1301
|
-
TextsCtx = React4.createContext(DEFAULT_TEXTS);
|
|
1302
|
-
HydrationCtx = React4.createContext(false);
|
|
1303
|
-
defaultTexts = DEFAULT_TEXTS;
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
|
|
1307
|
-
// src/hooks/useConsent.ts
|
|
1308
|
-
function useConsent() {
|
|
1309
|
-
const state = useConsentStateInternal();
|
|
1310
|
-
const actions = useConsentActionsInternal();
|
|
1311
|
-
return {
|
|
1312
|
-
consented: state.consented,
|
|
1313
|
-
preferences: state.preferences,
|
|
1314
|
-
isModalOpen: state.isModalOpen,
|
|
1315
|
-
acceptAll: actions.acceptAll,
|
|
1316
|
-
rejectAll: actions.rejectAll,
|
|
1317
|
-
setPreference: actions.setPreference,
|
|
1318
|
-
setPreferences: actions.setPreferences,
|
|
1319
|
-
openPreferences: actions.openPreferences,
|
|
1320
|
-
closePreferences: actions.closePreferences,
|
|
1321
|
-
resetConsent: actions.resetConsent
|
|
1322
|
-
};
|
|
1323
|
-
}
|
|
1324
|
-
function useConsentTexts() {
|
|
1325
|
-
return useConsentTextsInternal();
|
|
1326
|
-
}
|
|
1327
|
-
function useConsentHydration() {
|
|
1328
|
-
return useConsentHydrationInternal();
|
|
1329
|
-
}
|
|
1330
|
-
function useOpenPreferencesModal() {
|
|
1331
|
-
const { openPreferences } = useConsent();
|
|
1332
|
-
return openPreferences;
|
|
1333
|
-
}
|
|
1334
|
-
function openPreferencesModal() {
|
|
1335
|
-
if (globalOpenPreferences) {
|
|
1336
|
-
globalOpenPreferences();
|
|
1337
|
-
} else {
|
|
1338
|
-
logger.warn(
|
|
1339
|
-
"openPreferencesModal: ConsentProvider n\xE3o foi inicializado ou n\xE3o est\xE1 dispon\xEDvel."
|
|
1340
|
-
);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
function _registerGlobalOpenPreferences(openPreferences) {
|
|
1344
|
-
globalOpenPreferences = openPreferences;
|
|
1345
|
-
}
|
|
1346
|
-
function _unregisterGlobalOpenPreferences() {
|
|
1347
|
-
globalOpenPreferences = null;
|
|
1348
|
-
}
|
|
1349
|
-
var globalOpenPreferences;
|
|
1350
|
-
var init_useConsent = __esm({
|
|
1351
|
-
"src/hooks/useConsent.ts"() {
|
|
1352
|
-
"use strict";
|
|
1353
|
-
init_ConsentContext();
|
|
1354
|
-
init_logger();
|
|
1355
|
-
globalOpenPreferences = null;
|
|
1356
|
-
}
|
|
1357
|
-
});
|
|
1358
|
-
|
|
1359
|
-
// src/components/PreferencesModal.tsx
|
|
1360
|
-
var PreferencesModal_exports = {};
|
|
1361
|
-
__export(PreferencesModal_exports, {
|
|
1362
|
-
PreferencesModal: () => PreferencesModal2
|
|
1363
|
-
});
|
|
1364
|
-
function PreferencesModal2({
|
|
1365
|
-
DialogProps: DialogProps2,
|
|
1366
|
-
hideBranding = false
|
|
1367
|
-
}) {
|
|
1368
|
-
const { preferences, setPreferences, closePreferences, isModalOpen } = useConsent();
|
|
1369
|
-
const texts = useConsentTexts();
|
|
1370
|
-
const designTokens = useDesignTokens();
|
|
1371
|
-
const { toggleableCategories } = useCategories();
|
|
1372
|
-
const [tempPreferences, setTempPreferences] = (0, import_react2.useState)(() => {
|
|
1373
|
-
const initialPrefs = { necessary: true };
|
|
1374
|
-
toggleableCategories.forEach((category) => {
|
|
1375
|
-
initialPrefs[category.id] = preferences[category.id] ?? false;
|
|
1376
22
|
});
|
|
1377
|
-
return initialPrefs;
|
|
1378
|
-
});
|
|
1379
|
-
(0, import_react2.useEffect)(() => {
|
|
1380
|
-
if (isModalOpen) {
|
|
1381
|
-
const syncedPrefs = { necessary: true };
|
|
1382
|
-
toggleableCategories.forEach((category) => {
|
|
1383
|
-
syncedPrefs[category.id] = preferences[category.id] ?? false;
|
|
1384
|
-
});
|
|
1385
|
-
setTempPreferences(syncedPrefs);
|
|
1386
|
-
}
|
|
1387
|
-
}, [isModalOpen, preferences, toggleableCategories]);
|
|
1388
|
-
const open = DialogProps2?.open ?? isModalOpen ?? false;
|
|
1389
|
-
const handleSave = () => {
|
|
1390
|
-
setPreferences(tempPreferences);
|
|
1391
|
-
};
|
|
1392
|
-
const handleCancel = () => {
|
|
1393
|
-
setTempPreferences(preferences);
|
|
1394
|
-
closePreferences();
|
|
1395
|
-
};
|
|
1396
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_Dialog.default, { "aria-labelledby": "cookie-pref-title", open, onClose: handleCancel, ...DialogProps2, children: [
|
|
1397
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1398
|
-
import_DialogTitle.default,
|
|
1399
|
-
{
|
|
1400
|
-
id: "cookie-pref-title",
|
|
1401
|
-
sx: { fontSize: designTokens?.typography?.fontSize?.modal ?? void 0 },
|
|
1402
|
-
children: texts.modalTitle
|
|
1403
|
-
}
|
|
1404
|
-
),
|
|
1405
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_DialogContent.default, { dividers: true, sx: { p: designTokens?.spacing?.padding?.modal ?? void 0 }, children: [
|
|
1406
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1407
|
-
import_Typography3.default,
|
|
1408
|
-
{
|
|
1409
|
-
variant: "body2",
|
|
1410
|
-
sx: { mb: 2, fontSize: designTokens?.typography?.fontSize?.modal ?? void 0 },
|
|
1411
|
-
children: texts.modalIntro
|
|
1412
|
-
}
|
|
1413
|
-
),
|
|
1414
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_FormGroup.default, { children: [
|
|
1415
|
-
toggleableCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1416
|
-
import_FormControlLabel.default,
|
|
1417
|
-
{
|
|
1418
|
-
control: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1419
|
-
import_Switch.default,
|
|
1420
|
-
{
|
|
1421
|
-
checked: tempPreferences[category.id] ?? false,
|
|
1422
|
-
onChange: (e) => setTempPreferences((prev) => ({
|
|
1423
|
-
...prev,
|
|
1424
|
-
[category.id]: e.target.checked
|
|
1425
|
-
}))
|
|
1426
|
-
}
|
|
1427
|
-
),
|
|
1428
|
-
label: `${category.name} - ${category.description}`
|
|
1429
|
-
},
|
|
1430
|
-
category.id
|
|
1431
|
-
)),
|
|
1432
|
-
/* @__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 })
|
|
1433
|
-
] })
|
|
1434
|
-
] }),
|
|
1435
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_DialogActions.default, { children: [
|
|
1436
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Button2.default, { variant: "outlined", onClick: handleCancel, children: texts.close }),
|
|
1437
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Button2.default, { variant: "contained", onClick: handleSave, children: texts.save })
|
|
1438
|
-
] }),
|
|
1439
|
-
!hideBranding && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Branding, { variant: "modal" })
|
|
1440
|
-
] });
|
|
1441
|
-
}
|
|
1442
|
-
var import_Button2, import_Dialog, import_DialogActions, import_DialogContent, import_DialogTitle, import_FormControlLabel, import_FormGroup, import_Switch, import_Typography3, import_react2, import_jsx_runtime7;
|
|
1443
|
-
var init_PreferencesModal = __esm({
|
|
1444
|
-
"src/components/PreferencesModal.tsx"() {
|
|
1445
|
-
"use strict";
|
|
1446
|
-
import_Button2 = __toESM(require("@mui/material/Button"), 1);
|
|
1447
|
-
import_Dialog = __toESM(require("@mui/material/Dialog"), 1);
|
|
1448
|
-
import_DialogActions = __toESM(require("@mui/material/DialogActions"), 1);
|
|
1449
|
-
import_DialogContent = __toESM(require("@mui/material/DialogContent"), 1);
|
|
1450
|
-
import_DialogTitle = __toESM(require("@mui/material/DialogTitle"), 1);
|
|
1451
|
-
import_FormControlLabel = __toESM(require("@mui/material/FormControlLabel"), 1);
|
|
1452
|
-
import_FormGroup = __toESM(require("@mui/material/FormGroup"), 1);
|
|
1453
|
-
import_Switch = __toESM(require("@mui/material/Switch"), 1);
|
|
1454
|
-
import_Typography3 = __toESM(require("@mui/material/Typography"), 1);
|
|
1455
|
-
import_react2 = require("react");
|
|
1456
|
-
init_CategoriesContext();
|
|
1457
|
-
init_useConsent();
|
|
1458
|
-
init_DesignContext();
|
|
1459
|
-
init_Branding();
|
|
1460
|
-
import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1461
23
|
}
|
|
1462
|
-
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
1463
27
|
|
|
1464
|
-
|
|
1465
|
-
var index_exports = {};
|
|
1466
|
-
__export(index_exports, {
|
|
1467
|
-
COMMON_INTEGRATIONS: () => COMMON_INTEGRATIONS,
|
|
1468
|
-
ConsentGate: () => ConsentGate,
|
|
1469
|
-
ConsentProvider: () => ConsentProvider,
|
|
1470
|
-
ConsentScriptLoader: () => ConsentScriptLoader,
|
|
1471
|
-
CookieBanner: () => CookieBanner,
|
|
1472
|
-
DEFAULT_PROJECT_CATEGORIES: () => DEFAULT_PROJECT_CATEGORIES,
|
|
1473
|
-
FloatingPreferencesButton: () => FloatingPreferencesButton,
|
|
1474
|
-
LogLevel: () => LogLevel,
|
|
1475
|
-
PreferencesModal: () => PreferencesModal2,
|
|
1476
|
-
analyzeDeveloperConfiguration: () => analyzeDeveloperConfiguration,
|
|
1477
|
-
createDefaultConsentTheme: () => createDefaultConsentTheme,
|
|
1478
|
-
createGoogleAnalyticsIntegration: () => createGoogleAnalyticsIntegration,
|
|
1479
|
-
createGoogleTagManagerIntegration: () => createGoogleTagManagerIntegration,
|
|
1480
|
-
createProjectPreferences: () => createProjectPreferences,
|
|
1481
|
-
createUserWayIntegration: () => createUserWayIntegration,
|
|
1482
|
-
defaultConsentTheme: () => defaultConsentTheme,
|
|
1483
|
-
defaultTexts: () => defaultTexts,
|
|
1484
|
-
getAllProjectCategories: () => getAllProjectCategories,
|
|
1485
|
-
loadScript: () => loadScript,
|
|
1486
|
-
openPreferencesModal: () => openPreferencesModal,
|
|
1487
|
-
setDebugLogging: () => setDebugLogging,
|
|
1488
|
-
useCategories: () => useCategories,
|
|
1489
|
-
useCategoryStatus: () => useCategoryStatus,
|
|
1490
|
-
useConsent: () => useConsent,
|
|
1491
|
-
useConsentHydration: () => useConsentHydration,
|
|
1492
|
-
useConsentScriptLoader: () => useConsentScriptLoader,
|
|
1493
|
-
useConsentTexts: () => useConsentTexts,
|
|
1494
|
-
useOpenPreferencesModal: () => useOpenPreferencesModal,
|
|
1495
|
-
validateProjectPreferences: () => validateProjectPreferences
|
|
1496
|
-
});
|
|
1497
|
-
module.exports = __toCommonJS(index_exports);
|
|
1498
|
-
init_PreferencesModal();
|
|
1499
|
-
init_ConsentContext();
|
|
1500
|
-
init_useConsent();
|
|
1501
|
-
init_CategoriesContext();
|
|
28
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
1502
29
|
|
|
1503
|
-
//
|
|
1504
|
-
init_useConsent();
|
|
1505
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
30
|
+
// react-lgpd-consent - Tree-shakeable ESM build
|
|
1506
31
|
function ConsentGate(props) {
|
|
1507
|
-
const { preferences } = useConsent();
|
|
32
|
+
const { preferences } = chunkORI4PLVG_cjs.useConsent();
|
|
1508
33
|
if (!preferences[props.category]) return null;
|
|
1509
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
1510
35
|
}
|
|
1511
36
|
|
|
1512
37
|
// src/utils/scriptLoader.ts
|
|
@@ -1545,11 +70,8 @@ function loadScript(id, src, category = null, attrs = {}) {
|
|
|
1545
70
|
checkConsent();
|
|
1546
71
|
});
|
|
1547
72
|
}
|
|
1548
|
-
|
|
1549
|
-
// src/utils/theme.ts
|
|
1550
|
-
var import_styles3 = require("@mui/material/styles");
|
|
1551
73
|
function createDefaultConsentTheme() {
|
|
1552
|
-
return
|
|
74
|
+
return styles.createTheme({
|
|
1553
75
|
palette: {
|
|
1554
76
|
primary: {
|
|
1555
77
|
main: "#1976d2",
|
|
@@ -1617,17 +139,230 @@ function createDefaultConsentTheme() {
|
|
|
1617
139
|
}
|
|
1618
140
|
var defaultConsentTheme = () => createDefaultConsentTheme();
|
|
1619
141
|
|
|
142
|
+
// src/utils/autoConfigureCategories.ts
|
|
143
|
+
var FORBIDDEN_NECESSARY_SCRIPTS = /* @__PURE__ */ new Set([
|
|
144
|
+
// Analytics & Performance
|
|
145
|
+
"google-analytics",
|
|
146
|
+
"google-tag-manager",
|
|
147
|
+
"hotjar",
|
|
148
|
+
"mixpanel",
|
|
149
|
+
"clarity",
|
|
150
|
+
"amplitude",
|
|
151
|
+
"segment",
|
|
152
|
+
// Marketing & Advertising
|
|
153
|
+
"facebook-pixel",
|
|
154
|
+
"twitter-pixel",
|
|
155
|
+
"linkedin-insight",
|
|
156
|
+
"pinterest-tag",
|
|
157
|
+
"snapchat-pixel",
|
|
158
|
+
"tiktok-pixel",
|
|
159
|
+
"reddit-pixel",
|
|
160
|
+
// Communication & Support
|
|
161
|
+
"intercom",
|
|
162
|
+
"zendesk-chat",
|
|
163
|
+
"drift",
|
|
164
|
+
"crisp",
|
|
165
|
+
"freshchat",
|
|
166
|
+
// A/B Testing & Optimization
|
|
167
|
+
"optimizely",
|
|
168
|
+
"vwo",
|
|
169
|
+
"google-optimize",
|
|
170
|
+
"unbounce",
|
|
171
|
+
// Social & Content
|
|
172
|
+
"youtube-embed",
|
|
173
|
+
"vimeo-embed",
|
|
174
|
+
"twitter-widget",
|
|
175
|
+
"facebook-widget",
|
|
176
|
+
"instagram-widget",
|
|
177
|
+
// Accessibility (exceto scripts críticos)
|
|
178
|
+
"userway"
|
|
179
|
+
]);
|
|
180
|
+
function analyzeIntegrationCategories(integrations) {
|
|
181
|
+
const categoryMap = {};
|
|
182
|
+
integrations.forEach((integration) => {
|
|
183
|
+
const category = integration.category;
|
|
184
|
+
if (!categoryMap[category]) {
|
|
185
|
+
categoryMap[category] = [];
|
|
186
|
+
}
|
|
187
|
+
categoryMap[category].push(integration.id);
|
|
188
|
+
});
|
|
189
|
+
return categoryMap;
|
|
190
|
+
}
|
|
191
|
+
function autoConfigureCategories(originalConfig, integrations, options = {}) {
|
|
192
|
+
const { warningOnly = false, silent = false } = options;
|
|
193
|
+
const config = originalConfig || { enabledCategories: ["analytics"] };
|
|
194
|
+
const categoryIntegrations = analyzeIntegrationCategories(integrations);
|
|
195
|
+
const requiredCategories = Object.keys(categoryIntegrations);
|
|
196
|
+
const currentCategories = new Set(config.enabledCategories || []);
|
|
197
|
+
const missingCategories = requiredCategories.filter((cat) => !currentCategories.has(cat));
|
|
198
|
+
let adjustedConfig = { ...config };
|
|
199
|
+
let autoEnabledCategories = [];
|
|
200
|
+
if (missingCategories.length > 0) {
|
|
201
|
+
if (warningOnly) {
|
|
202
|
+
if (!silent) {
|
|
203
|
+
logMissingCategoriesWarning(missingCategories, categoryIntegrations);
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
autoEnabledCategories = [...missingCategories];
|
|
207
|
+
adjustedConfig = {
|
|
208
|
+
...config,
|
|
209
|
+
enabledCategories: [...currentCategories, ...missingCategories]
|
|
210
|
+
};
|
|
211
|
+
if (!silent) {
|
|
212
|
+
logAutoEnabledCategories(autoEnabledCategories, categoryIntegrations);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
originalConfig: config,
|
|
218
|
+
adjustedConfig,
|
|
219
|
+
autoEnabledCategories,
|
|
220
|
+
missingCategories,
|
|
221
|
+
wasAdjusted: autoEnabledCategories.length > 0,
|
|
222
|
+
categoryIntegrations
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function logMissingCategoriesWarning(missingCategories, categoryIntegrations) {
|
|
226
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
227
|
+
if (!isDev) return;
|
|
228
|
+
const PREFIX = "[\u{1F36A} LGPD-CONSENT AUTO-CONFIG]";
|
|
229
|
+
console.group(`${PREFIX} \u26A0\uFE0F Categorias Requeridas N\xE3o Habilitadas`);
|
|
230
|
+
missingCategories.forEach((category) => {
|
|
231
|
+
const integrations = categoryIntegrations[category] || [];
|
|
232
|
+
console.warn(
|
|
233
|
+
`${PREFIX} Categoria '${category}' requerida por integra\xE7\xF5es: ${integrations.join(", ")}`
|
|
234
|
+
);
|
|
235
|
+
});
|
|
236
|
+
const categoriesCode = missingCategories.map((c) => `'${c}'`).join(", ");
|
|
237
|
+
console.warn(
|
|
238
|
+
`${PREFIX} Para corrigir, adicione estas categorias ao ConsentProvider:`,
|
|
239
|
+
`categories={{ enabledCategories: [...existingCategories, ${categoriesCode}] }}`
|
|
240
|
+
);
|
|
241
|
+
console.groupEnd();
|
|
242
|
+
}
|
|
243
|
+
function logAutoEnabledCategories(autoEnabledCategories, categoryIntegrations) {
|
|
244
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
245
|
+
if (!isDev) return;
|
|
246
|
+
const PREFIX = "[\u{1F36A} LGPD-CONSENT AUTO-CONFIG]";
|
|
247
|
+
console.group(`${PREFIX} \u2705 Categorias Auto-Habilitadas`);
|
|
248
|
+
autoEnabledCategories.forEach((category) => {
|
|
249
|
+
const integrations = categoryIntegrations[category] || [];
|
|
250
|
+
console.info(
|
|
251
|
+
`${PREFIX} Categoria '${category}' auto-habilitada para integra\xE7\xF5es: ${integrations.join(", ")}`
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
console.info(`${PREFIX} \u{1F4A1} Essas categorias foram automaticamente adicionadas \xE0 configura\xE7\xE3o.`);
|
|
255
|
+
console.info(`${PREFIX} \u{1F527} Para controle manual, especifique explicitamente no ConsentProvider.`);
|
|
256
|
+
console.groupEnd();
|
|
257
|
+
}
|
|
258
|
+
function validateIntegrationCategories(integrations, enabledCategories) {
|
|
259
|
+
const requiredCategories = integrations.map((i) => i.category);
|
|
260
|
+
const enabledSet = new Set(enabledCategories);
|
|
261
|
+
return requiredCategories.every((category) => enabledSet.has(category));
|
|
262
|
+
}
|
|
263
|
+
function extractCategoriesFromIntegrations(integrations) {
|
|
264
|
+
const categories = /* @__PURE__ */ new Set();
|
|
265
|
+
integrations.forEach((integration) => {
|
|
266
|
+
categories.add(integration.category);
|
|
267
|
+
});
|
|
268
|
+
return Array.from(categories);
|
|
269
|
+
}
|
|
270
|
+
function validateNecessaryClassification(integrations, enabledCategories) {
|
|
271
|
+
const warnings = [];
|
|
272
|
+
const hasNecessaryCategory = enabledCategories.includes("necessary");
|
|
273
|
+
if (!hasNecessaryCategory) {
|
|
274
|
+
return warnings;
|
|
275
|
+
}
|
|
276
|
+
const problematicIntegrations = integrations.filter(
|
|
277
|
+
(integration) => integration.category === "necessary" && FORBIDDEN_NECESSARY_SCRIPTS.has(integration.id)
|
|
278
|
+
);
|
|
279
|
+
if (problematicIntegrations.length > 0) {
|
|
280
|
+
warnings.push(
|
|
281
|
+
`\u26A0\uFE0F ATEN\xC7\xC3O GDPR/LGPD: As seguintes integra\xE7\xF5es NUNCA devem ser classificadas como 'necessary':`
|
|
282
|
+
);
|
|
283
|
+
problematicIntegrations.forEach((integration) => {
|
|
284
|
+
warnings.push(
|
|
285
|
+
` \u2022 '${integration.id}' (categoria: ${integration.category}) - Requer consentimento expl\xEDcito`
|
|
286
|
+
);
|
|
287
|
+
});
|
|
288
|
+
warnings.push(
|
|
289
|
+
`\u{1F4A1} Scripts 'necessary' executam SEM consentimento e podem resultar em multas.`,
|
|
290
|
+
`\u{1F4DA} Apenas scripts de seguran\xE7a, autentica\xE7\xE3o ou core do site se qualificam.`,
|
|
291
|
+
`\u{1F527} Mova estes scripts para categorias apropriadas (analytics, marketing, etc.)`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
return warnings;
|
|
295
|
+
}
|
|
296
|
+
|
|
1620
297
|
// src/utils/ConsentScriptLoader.tsx
|
|
1621
|
-
var React5 = __toESM(require("react"), 1);
|
|
1622
|
-
init_useConsent();
|
|
1623
|
-
init_logger();
|
|
1624
298
|
function ConsentScriptLoader({
|
|
1625
299
|
integrations,
|
|
1626
300
|
reloadOnChange = false
|
|
1627
301
|
}) {
|
|
1628
|
-
const { preferences, consented } = useConsent();
|
|
1629
|
-
const
|
|
1630
|
-
|
|
302
|
+
const { preferences, consented } = chunkORI4PLVG_cjs.useConsent();
|
|
303
|
+
const categories = chunkORI4PLVG_cjs.useCategories();
|
|
304
|
+
const loadedScripts = React__namespace.useRef(/* @__PURE__ */ new Set());
|
|
305
|
+
React__namespace.useEffect(() => {
|
|
306
|
+
try {
|
|
307
|
+
const ids = (integrations || []).map((i) => i.id);
|
|
308
|
+
const gt = globalThis;
|
|
309
|
+
const current = Array.isArray(gt.__LGPD_USED_INTEGRATIONS__) ? gt.__LGPD_USED_INTEGRATIONS__ : [];
|
|
310
|
+
const merged = Array.from(/* @__PURE__ */ new Set([...current, ...ids]));
|
|
311
|
+
gt.__LGPD_USED_INTEGRATIONS__ = merged;
|
|
312
|
+
try {
|
|
313
|
+
const gmap = globalThis;
|
|
314
|
+
const map = gmap.__LGPD_INTEGRATIONS_MAP__ || {};
|
|
315
|
+
(integrations || []).forEach((i) => {
|
|
316
|
+
map[i.id] = i.category;
|
|
317
|
+
});
|
|
318
|
+
gmap.__LGPD_INTEGRATIONS_MAP__ = map;
|
|
319
|
+
} catch {
|
|
320
|
+
}
|
|
321
|
+
} catch {
|
|
322
|
+
}
|
|
323
|
+
}, [integrations]);
|
|
324
|
+
React__namespace.useEffect(() => {
|
|
325
|
+
try {
|
|
326
|
+
const required = Array.from(new Set((integrations || []).map((i) => i.category))).filter(
|
|
327
|
+
Boolean
|
|
328
|
+
);
|
|
329
|
+
const gt = globalThis;
|
|
330
|
+
const current = Array.isArray(gt.__LGPD_REQUIRED_CATEGORIES__) ? gt.__LGPD_REQUIRED_CATEGORIES__ : [];
|
|
331
|
+
const merged = Array.from(/* @__PURE__ */ new Set([...current, ...required]));
|
|
332
|
+
gt.__LGPD_REQUIRED_CATEGORIES__ = merged;
|
|
333
|
+
if (typeof window !== "undefined" && typeof window.dispatchEvent === "function") {
|
|
334
|
+
window.dispatchEvent(new CustomEvent("lgpd:requiredCategories"));
|
|
335
|
+
}
|
|
336
|
+
} catch {
|
|
337
|
+
}
|
|
338
|
+
}, [integrations]);
|
|
339
|
+
React__namespace.useEffect(() => {
|
|
340
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
341
|
+
if (!isDev || integrations.length === 0) return;
|
|
342
|
+
const enabledCategories = categories.allCategories.map((cat) => cat.id);
|
|
343
|
+
const isValid = validateIntegrationCategories(integrations, enabledCategories);
|
|
344
|
+
if (!isValid) {
|
|
345
|
+
autoConfigureCategories({ enabledCategories }, integrations, {
|
|
346
|
+
warningOnly: true,
|
|
347
|
+
silent: false
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
const necessaryWarnings = validateNecessaryClassification(integrations, enabledCategories);
|
|
351
|
+
if (necessaryWarnings.length > 0) {
|
|
352
|
+
console.group("\u{1F6A8} [LGPD-CONSENT] VALIDA\xC7\xC3O DE COMPLIANCE");
|
|
353
|
+
necessaryWarnings.forEach((warning) => {
|
|
354
|
+
if (warning.startsWith("\u26A0\uFE0F")) {
|
|
355
|
+
console.error(warning);
|
|
356
|
+
} else if (warning.startsWith("\u{1F4A1}") || warning.startsWith("\u{1F4DA}") || warning.startsWith("\u{1F527}")) {
|
|
357
|
+
console.warn(warning);
|
|
358
|
+
} else {
|
|
359
|
+
console.log(warning);
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
console.groupEnd();
|
|
363
|
+
}
|
|
364
|
+
}, [integrations, categories]);
|
|
365
|
+
React__namespace.useEffect(() => {
|
|
1631
366
|
if (!consented) return;
|
|
1632
367
|
integrations.forEach(async (integration) => {
|
|
1633
368
|
const shouldLoad = preferences[integration.category];
|
|
@@ -1640,7 +375,7 @@ function ConsentScriptLoader({
|
|
|
1640
375
|
}
|
|
1641
376
|
loadedScripts.current.add(integration.id);
|
|
1642
377
|
} catch (error) {
|
|
1643
|
-
logger.error(`\u274C Failed to load script: ${integration.id}`, error);
|
|
378
|
+
chunkORI4PLVG_cjs.logger.error(`\u274C Failed to load script: ${integration.id}`, error);
|
|
1644
379
|
}
|
|
1645
380
|
}
|
|
1646
381
|
});
|
|
@@ -1648,16 +383,16 @@ function ConsentScriptLoader({
|
|
|
1648
383
|
return null;
|
|
1649
384
|
}
|
|
1650
385
|
function useConsentScriptLoader() {
|
|
1651
|
-
const { preferences, consented } = useConsent();
|
|
1652
|
-
return
|
|
386
|
+
const { preferences, consented } = chunkORI4PLVG_cjs.useConsent();
|
|
387
|
+
return React__namespace.useCallback(
|
|
1653
388
|
async (integration) => {
|
|
1654
389
|
if (!consented) {
|
|
1655
|
-
logger.warn(`\u26A0\uFE0F Cannot load script ${integration.id}: No consent given`);
|
|
390
|
+
chunkORI4PLVG_cjs.logger.warn(`\u26A0\uFE0F Cannot load script ${integration.id}: No consent given`);
|
|
1656
391
|
return false;
|
|
1657
392
|
}
|
|
1658
393
|
const shouldLoad = preferences[integration.category];
|
|
1659
394
|
if (!shouldLoad) {
|
|
1660
|
-
logger.warn(
|
|
395
|
+
chunkORI4PLVG_cjs.logger.warn(
|
|
1661
396
|
`\u26A0\uFE0F Cannot load script ${integration.id}: Category '${integration.category}' not consented`
|
|
1662
397
|
);
|
|
1663
398
|
return false;
|
|
@@ -1669,7 +404,7 @@ function useConsentScriptLoader() {
|
|
|
1669
404
|
}
|
|
1670
405
|
return true;
|
|
1671
406
|
} catch (error) {
|
|
1672
|
-
logger.error(`\u274C Failed to load script: ${integration.id}`, error);
|
|
407
|
+
chunkORI4PLVG_cjs.logger.error(`\u274C Failed to load script: ${integration.id}`, error);
|
|
1673
408
|
return false;
|
|
1674
409
|
}
|
|
1675
410
|
},
|
|
@@ -1679,10 +414,32 @@ function useConsentScriptLoader() {
|
|
|
1679
414
|
|
|
1680
415
|
// src/utils/scriptIntegrations.ts
|
|
1681
416
|
function createGoogleAnalyticsIntegration(config) {
|
|
417
|
+
const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtag/js?id=${config.measurementId}`;
|
|
1682
418
|
return {
|
|
1683
419
|
id: "google-analytics",
|
|
1684
420
|
category: "analytics",
|
|
1685
|
-
src
|
|
421
|
+
src,
|
|
422
|
+
cookies: ["_ga", "_ga_*", "_gid"],
|
|
423
|
+
cookiesInfo: [
|
|
424
|
+
{
|
|
425
|
+
name: "_ga",
|
|
426
|
+
purpose: "Identifica\xE7\xE3o \xFAnica de visitantes para an\xE1lise de tr\xE1fego",
|
|
427
|
+
duration: "2 anos",
|
|
428
|
+
provider: "Google Analytics"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: "_ga_*",
|
|
432
|
+
purpose: "Rastreamento de sess\xF5es e eventos espec\xEDficos do stream GA4",
|
|
433
|
+
duration: "2 anos",
|
|
434
|
+
provider: "Google Analytics"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
name: "_gid",
|
|
438
|
+
purpose: "Distin\xE7\xE3o de visitantes \xFAnicos em per\xEDodo de 24h",
|
|
439
|
+
duration: "24 horas",
|
|
440
|
+
provider: "Google Analytics"
|
|
441
|
+
}
|
|
442
|
+
],
|
|
1686
443
|
init: () => {
|
|
1687
444
|
if (typeof window !== "undefined") {
|
|
1688
445
|
const w = window;
|
|
@@ -1699,29 +456,30 @@ function createGoogleAnalyticsIntegration(config) {
|
|
|
1699
456
|
};
|
|
1700
457
|
}
|
|
1701
458
|
function createGoogleTagManagerIntegration(config) {
|
|
459
|
+
const src = config.scriptUrl ?? `https://www.googletagmanager.com/gtm.js?id=${config.containerId}`;
|
|
1702
460
|
return {
|
|
1703
461
|
id: "google-tag-manager",
|
|
1704
462
|
category: "analytics",
|
|
1705
|
-
src
|
|
463
|
+
src,
|
|
464
|
+
cookies: ["_gcl_au"],
|
|
1706
465
|
init: () => {
|
|
1707
466
|
if (typeof window !== "undefined") {
|
|
1708
467
|
const dataLayerName = config.dataLayerName || "dataLayer";
|
|
1709
468
|
const w = window;
|
|
1710
469
|
const layer = w[dataLayerName] ?? [];
|
|
1711
470
|
w[dataLayerName] = layer;
|
|
1712
|
-
layer.push({
|
|
1713
|
-
"gtm.start": (/* @__PURE__ */ new Date()).getTime(),
|
|
1714
|
-
event: "gtm.js"
|
|
1715
|
-
});
|
|
471
|
+
layer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
|
|
1716
472
|
}
|
|
1717
473
|
}
|
|
1718
474
|
};
|
|
1719
475
|
}
|
|
1720
476
|
function createUserWayIntegration(config) {
|
|
477
|
+
const src = config.scriptUrl ?? "https://cdn.userway.org/widget.js";
|
|
1721
478
|
return {
|
|
1722
479
|
id: "userway",
|
|
1723
480
|
category: "functional",
|
|
1724
|
-
src
|
|
481
|
+
src,
|
|
482
|
+
cookies: ["_userway_*"],
|
|
1725
483
|
init: () => {
|
|
1726
484
|
if (typeof window !== "undefined") {
|
|
1727
485
|
const w = window;
|
|
@@ -1737,43 +495,597 @@ var COMMON_INTEGRATIONS = {
|
|
|
1737
495
|
googleTagManager: createGoogleTagManagerIntegration,
|
|
1738
496
|
userway: createUserWayIntegration
|
|
1739
497
|
};
|
|
498
|
+
function createFacebookPixelIntegration(config) {
|
|
499
|
+
const src = config.scriptUrl ?? "https://connect.facebook.net/en_US/fbevents.js";
|
|
500
|
+
return {
|
|
501
|
+
id: "facebook-pixel",
|
|
502
|
+
category: "marketing",
|
|
503
|
+
src,
|
|
504
|
+
cookies: ["_fbp", "fr"],
|
|
505
|
+
init: () => {
|
|
506
|
+
if (typeof window !== "undefined") {
|
|
507
|
+
const w = window;
|
|
508
|
+
if (!w.fbq) {
|
|
509
|
+
const fbq = (...args) => {
|
|
510
|
+
if (w.fbq && typeof w.fbq.callMethod === "function") {
|
|
511
|
+
w.fbq.callMethod(...args);
|
|
512
|
+
} else {
|
|
513
|
+
fbq.queue = fbq.queue || [];
|
|
514
|
+
fbq.queue.push(args);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
fbq.loaded = true;
|
|
518
|
+
w.fbq = fbq;
|
|
519
|
+
}
|
|
520
|
+
w.fbq("init", config.pixelId, config.advancedMatching ?? {});
|
|
521
|
+
if (config.autoTrack !== false) w.fbq("track", "PageView");
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
function createHotjarIntegration(config) {
|
|
527
|
+
const v = config.version ?? 6;
|
|
528
|
+
const src = config.scriptUrl ?? `https://static.hotjar.com/c/hotjar-${config.siteId}.js?sv=${v}`;
|
|
529
|
+
return {
|
|
530
|
+
id: "hotjar",
|
|
531
|
+
category: "analytics",
|
|
532
|
+
src,
|
|
533
|
+
cookies: [
|
|
534
|
+
"_hjSession_*",
|
|
535
|
+
"_hjSessionUser_*",
|
|
536
|
+
"_hjFirstSeen",
|
|
537
|
+
"_hjIncludedInSessionSample",
|
|
538
|
+
"_hjAbsoluteSessionInProgress"
|
|
539
|
+
],
|
|
540
|
+
cookiesInfo: [
|
|
541
|
+
{
|
|
542
|
+
name: "_hjSession_*",
|
|
543
|
+
purpose: "Identifica\xE7\xE3o \xFAnica da sess\xE3o de grava\xE7\xE3o e heatmaps",
|
|
544
|
+
duration: "30 minutos",
|
|
545
|
+
provider: "Hotjar"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: "_hjSessionUser_*",
|
|
549
|
+
purpose: "Identifica\xE7\xE3o persistente do usu\xE1rio entre sess\xF5es",
|
|
550
|
+
duration: "365 dias",
|
|
551
|
+
provider: "Hotjar"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
name: "_hjFirstSeen",
|
|
555
|
+
purpose: "Detec\xE7\xE3o de primeira visita do usu\xE1rio ao site",
|
|
556
|
+
duration: "Sess\xE3o",
|
|
557
|
+
provider: "Hotjar"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
name: "_hjIncludedInSessionSample",
|
|
561
|
+
purpose: "Indica se a sess\xE3o est\xE1 inclu\xEDda na amostra de grava\xE7\xE3o",
|
|
562
|
+
duration: "30 minutos",
|
|
563
|
+
provider: "Hotjar"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: "_hjAbsoluteSessionInProgress",
|
|
567
|
+
purpose: "Detecta se uma sess\xE3o absoluta est\xE1 em progresso",
|
|
568
|
+
duration: "30 minutos",
|
|
569
|
+
provider: "Hotjar"
|
|
570
|
+
}
|
|
571
|
+
],
|
|
572
|
+
init: () => {
|
|
573
|
+
if (typeof window !== "undefined") {
|
|
574
|
+
const w = window;
|
|
575
|
+
w._hjSettings = { hjid: config.siteId, hjsv: v };
|
|
576
|
+
if (!w.hj) {
|
|
577
|
+
const hj = (...args) => {
|
|
578
|
+
hj.q = hj.q || [];
|
|
579
|
+
hj.q.push(args);
|
|
580
|
+
};
|
|
581
|
+
w.hj = hj;
|
|
582
|
+
}
|
|
583
|
+
if (config.debug && typeof console !== "undefined" && typeof console.info === "function") {
|
|
584
|
+
console.info("[Hotjar] initialized with siteId", config.siteId);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
function createMixpanelIntegration(config) {
|
|
591
|
+
const src = config.scriptUrl ?? "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";
|
|
592
|
+
return {
|
|
593
|
+
id: "mixpanel",
|
|
594
|
+
category: "analytics",
|
|
595
|
+
src,
|
|
596
|
+
cookies: ["mp_*"],
|
|
597
|
+
cookiesInfo: [
|
|
598
|
+
{
|
|
599
|
+
name: "mp_*",
|
|
600
|
+
purpose: "Rastreamento de eventos e propriedades do usu\xE1rio para analytics",
|
|
601
|
+
duration: "1 ano",
|
|
602
|
+
provider: "Mixpanel"
|
|
603
|
+
}
|
|
604
|
+
],
|
|
605
|
+
init: () => {
|
|
606
|
+
if (typeof window !== "undefined") {
|
|
607
|
+
const w = window;
|
|
608
|
+
w.mixpanel = w.mixpanel || { init: () => void 0 };
|
|
609
|
+
if (w.mixpanel && typeof w.mixpanel.init === "function") {
|
|
610
|
+
try {
|
|
611
|
+
w.mixpanel.init(config.token, config.config ?? {}, config.api_host);
|
|
612
|
+
} catch (error) {
|
|
613
|
+
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
|
614
|
+
console.warn("[Mixpanel] Failed to initialize:", error);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
function createClarityIntegration(config) {
|
|
623
|
+
const src = config.scriptUrl ?? `https://www.clarity.ms/tag/${config.projectId}`;
|
|
624
|
+
return {
|
|
625
|
+
id: "clarity",
|
|
626
|
+
category: "analytics",
|
|
627
|
+
src,
|
|
628
|
+
cookies: ["_clck", "_clsk", "CLID", "ANONCHK", "MR", "MUID", "SM"],
|
|
629
|
+
init: () => {
|
|
630
|
+
if (typeof window !== "undefined" && typeof config.upload !== "undefined") {
|
|
631
|
+
const w = window;
|
|
632
|
+
if (typeof w.clarity === "function") {
|
|
633
|
+
try {
|
|
634
|
+
w.clarity("set", "upload", config.upload);
|
|
635
|
+
} catch (error) {
|
|
636
|
+
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
|
637
|
+
console.warn("[Clarity] Failed to configure upload setting:", error);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
function createIntercomIntegration(config) {
|
|
646
|
+
const src = config.scriptUrl ?? `https://widget.intercom.io/widget/${config.app_id}`;
|
|
647
|
+
return {
|
|
648
|
+
id: "intercom",
|
|
649
|
+
category: "functional",
|
|
650
|
+
src,
|
|
651
|
+
cookies: ["intercom-id-*", "intercom-session-*"],
|
|
652
|
+
init: () => {
|
|
653
|
+
if (typeof window !== "undefined") {
|
|
654
|
+
const w = window;
|
|
655
|
+
if (typeof w.Intercom === "function") {
|
|
656
|
+
try {
|
|
657
|
+
w.Intercom("boot", { app_id: config.app_id });
|
|
658
|
+
} catch (error) {
|
|
659
|
+
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
|
660
|
+
console.warn("[Intercom] Failed to boot:", error);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
function createZendeskChatIntegration(config) {
|
|
669
|
+
const src = config.scriptUrl ?? `https://static.zdassets.com/ekr/snippet.js?key=${config.key}`;
|
|
670
|
+
return {
|
|
671
|
+
id: "zendesk-chat",
|
|
672
|
+
category: "functional",
|
|
673
|
+
src,
|
|
674
|
+
cookies: ["__zlcmid", "_zendesk_shared_session"],
|
|
675
|
+
init: () => {
|
|
676
|
+
if (typeof window !== "undefined") {
|
|
677
|
+
const w = window;
|
|
678
|
+
if (typeof w.zE === "function") {
|
|
679
|
+
try {
|
|
680
|
+
w.zE("webWidget", "identify", { key: config.key });
|
|
681
|
+
} catch (error) {
|
|
682
|
+
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
|
683
|
+
console.warn("[Zendesk] Failed to identify:", error);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function createECommerceIntegrations(cfg) {
|
|
692
|
+
const list = [];
|
|
693
|
+
if (cfg.googleAnalytics) list.push(createGoogleAnalyticsIntegration(cfg.googleAnalytics));
|
|
694
|
+
if (cfg.facebookPixel) list.push(createFacebookPixelIntegration(cfg.facebookPixel));
|
|
695
|
+
if (cfg.hotjar) list.push(createHotjarIntegration(cfg.hotjar));
|
|
696
|
+
if (cfg.userway) list.push(createUserWayIntegration(cfg.userway));
|
|
697
|
+
return list;
|
|
698
|
+
}
|
|
699
|
+
function createSaaSIntegrations(cfg) {
|
|
700
|
+
const list = [];
|
|
701
|
+
if (cfg.googleAnalytics) list.push(createGoogleAnalyticsIntegration(cfg.googleAnalytics));
|
|
702
|
+
if (cfg.mixpanel) list.push(createMixpanelIntegration(cfg.mixpanel));
|
|
703
|
+
if (cfg.intercom) list.push(createIntercomIntegration(cfg.intercom));
|
|
704
|
+
if (cfg.hotjar) list.push(createHotjarIntegration(cfg.hotjar));
|
|
705
|
+
return list;
|
|
706
|
+
}
|
|
707
|
+
function createCorporateIntegrations(cfg) {
|
|
708
|
+
const list = [];
|
|
709
|
+
if (cfg.googleAnalytics) list.push(createGoogleAnalyticsIntegration(cfg.googleAnalytics));
|
|
710
|
+
if (cfg.clarity) list.push(createClarityIntegration(cfg.clarity));
|
|
711
|
+
if (cfg.zendesk) list.push(createZendeskChatIntegration(cfg.zendesk));
|
|
712
|
+
if (cfg.userway) list.push(createUserWayIntegration(cfg.userway));
|
|
713
|
+
return list;
|
|
714
|
+
}
|
|
715
|
+
var INTEGRATION_TEMPLATES = {
|
|
716
|
+
ecommerce: {
|
|
717
|
+
essential: ["google-analytics", "facebook-pixel"],
|
|
718
|
+
optional: ["hotjar", "userway"],
|
|
719
|
+
categories: ["analytics", "marketing", "functional"]
|
|
720
|
+
},
|
|
721
|
+
saas: {
|
|
722
|
+
essential: ["google-analytics", "mixpanel"],
|
|
723
|
+
optional: ["intercom", "hotjar"],
|
|
724
|
+
categories: ["analytics", "functional"]
|
|
725
|
+
},
|
|
726
|
+
corporate: {
|
|
727
|
+
essential: ["google-analytics"],
|
|
728
|
+
optional: ["userway", "zendesk-chat", "clarity"],
|
|
729
|
+
categories: ["analytics", "functional"]
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
function suggestCategoryForScript(name) {
|
|
733
|
+
const n = name.toLowerCase();
|
|
734
|
+
if (n.includes("facebook") || n.includes("pixel") || n.includes("ads")) return ["marketing"];
|
|
735
|
+
if (n.includes("hotjar") || n.includes("mixpanel") || n.includes("clarity")) return ["analytics"];
|
|
736
|
+
if (n.includes("intercom") || n.includes("zendesk") || n.includes("chat")) return ["functional"];
|
|
737
|
+
return ["analytics"];
|
|
738
|
+
}
|
|
1740
739
|
|
|
1741
|
-
// src/
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
740
|
+
// src/types/advancedTexts.ts
|
|
741
|
+
var EXPANDED_DEFAULT_TEXTS = {
|
|
742
|
+
// Textos adicionais
|
|
743
|
+
confirm: "Confirmar",
|
|
744
|
+
cancel: "Cancelar",
|
|
745
|
+
loading: "Carregando...",
|
|
746
|
+
// Feedback
|
|
747
|
+
feedback: {
|
|
748
|
+
saveSuccess: "Prefer\xEAncias salvas com sucesso!",
|
|
749
|
+
saveError: "Erro ao salvar prefer\xEAncias. Tente novamente.",
|
|
750
|
+
consentUpdated: "Consentimento atualizado.",
|
|
751
|
+
cookiesRejected: "Cookies opcionais rejeitados.",
|
|
752
|
+
settingsReset: "Configura\xE7\xF5es resetadas."
|
|
753
|
+
},
|
|
754
|
+
// Acessibilidade
|
|
755
|
+
accessibility: {
|
|
756
|
+
bannerLabel: "Banner de consentimento de cookies",
|
|
757
|
+
modalLabel: "Modal de prefer\xEAncias de cookies",
|
|
758
|
+
keyboardNavigation: "Use Tab para navegar, Enter para selecionar",
|
|
759
|
+
toggleState: {
|
|
760
|
+
enabled: "Habilitado",
|
|
761
|
+
disabled: "Desabilitado"
|
|
762
|
+
},
|
|
763
|
+
liveRegion: "Regi\xE3o de an\xFAncios din\xE2micos"
|
|
764
|
+
},
|
|
765
|
+
// Categorias
|
|
766
|
+
categories: {
|
|
767
|
+
necessary: {
|
|
768
|
+
name: "Cookies Necess\xE1rios",
|
|
769
|
+
description: "Essenciais para o funcionamento b\xE1sico do site",
|
|
770
|
+
examples: "Sess\xE3o, seguran\xE7a, prefer\xEAncias de idioma"
|
|
771
|
+
},
|
|
772
|
+
analytics: {
|
|
773
|
+
name: "Cookies de Analytics",
|
|
774
|
+
description: "Ajudam a entender como os visitantes usam o site",
|
|
775
|
+
examples: "Google Analytics, contadores de p\xE1gina"
|
|
776
|
+
},
|
|
777
|
+
marketing: {
|
|
778
|
+
name: "Cookies de Marketing",
|
|
779
|
+
description: "Usados para personalizar an\xFAncios e ofertas",
|
|
780
|
+
examples: "Facebook Pixel, Google Ads, remarketing"
|
|
781
|
+
},
|
|
782
|
+
functional: {
|
|
783
|
+
name: "Cookies Funcionais",
|
|
784
|
+
description: "Melhoram a funcionalidade e personaliza\xE7\xE3o",
|
|
785
|
+
examples: "Chat, mapas, v\xEDdeos embarcados"
|
|
786
|
+
},
|
|
787
|
+
performance: {
|
|
788
|
+
name: "Cookies de Performance",
|
|
789
|
+
description: "Coletam informa\xE7\xF5es sobre velocidade e estabilidade",
|
|
790
|
+
examples: "Monitoramento de erro, otimiza\xE7\xE3o de velocidade"
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
// Contextos específicos
|
|
794
|
+
contexts: {
|
|
795
|
+
ecommerce: {
|
|
796
|
+
cartAbandonment: "Lembramos dos produtos no seu carrinho",
|
|
797
|
+
personalizedOffers: "Ofertas personalizadas baseadas no seu hist\xF3rico",
|
|
798
|
+
paymentSecurity: "Seguran\xE7a adicional no processo de pagamento",
|
|
799
|
+
productRecommendations: "Sugest\xF5es de produtos relevantes"
|
|
800
|
+
},
|
|
801
|
+
saas: {
|
|
802
|
+
userAnalytics: "An\xE1lise de uso para melhorar funcionalidades",
|
|
803
|
+
performanceMonitoring: "Monitoramento de performance da aplica\xE7\xE3o",
|
|
804
|
+
featureUsage: "Estat\xEDsticas de uso de recursos",
|
|
805
|
+
customerSupport: "Suporte ao cliente mais eficiente"
|
|
806
|
+
},
|
|
807
|
+
government: {
|
|
808
|
+
citizenServices: "Melhoria dos servi\xE7os ao cidad\xE3o",
|
|
809
|
+
dataProtection: "Prote\xE7\xE3o rigorosa dos dados pessoais",
|
|
810
|
+
transparency: "Transpar\xEAncia no uso de dados",
|
|
811
|
+
accessibility: "Recursos de acessibilidade digital"
|
|
812
|
+
},
|
|
813
|
+
education: {
|
|
814
|
+
studentProgress: "Acompanhamento do progresso educacional",
|
|
815
|
+
learningAnalytics: "Analytics para melhorar o aprendizado",
|
|
816
|
+
accessibility: "Recursos educacionais acess\xEDveis",
|
|
817
|
+
parentalConsent: "Consentimento parental quando necess\xE1rio"
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
// Variações de tom
|
|
821
|
+
variants: {
|
|
822
|
+
formal: {
|
|
823
|
+
bannerMessage: "Este s\xEDtio eletr\xF4nico utiliza cookies para otimizar a experi\xEAncia de navega\xE7\xE3o.",
|
|
824
|
+
acceptAll: "Concordar com todos os cookies",
|
|
825
|
+
declineAll: "Recusar cookies opcionais",
|
|
826
|
+
modalTitle: "Configura\xE7\xE3o de Cookies"
|
|
827
|
+
},
|
|
828
|
+
casual: {
|
|
829
|
+
bannerMessage: "\u{1F36A} Ei! Usamos cookies para tornar sua experi\xEAncia ainda melhor!",
|
|
830
|
+
acceptAll: "Aceitar tudo",
|
|
831
|
+
declineAll: "S\xF3 o essencial",
|
|
832
|
+
modalTitle: "Seus Cookies"
|
|
833
|
+
},
|
|
834
|
+
concise: {
|
|
835
|
+
bannerMessage: "Usamos cookies. Voc\xEA aceita?",
|
|
836
|
+
acceptAll: "Sim",
|
|
837
|
+
declineAll: "N\xE3o",
|
|
838
|
+
modalTitle: "Cookies"
|
|
839
|
+
},
|
|
840
|
+
detailed: {
|
|
841
|
+
bannerMessage: "Utilizamos cookies e tecnologias similares para melhorar sua experi\xEAncia de navega\xE7\xE3o, personalizar conte\xFAdo, analisar tr\xE1fego e oferecer funcionalidades de redes sociais.",
|
|
842
|
+
acceptAll: "Aceitar todos os cookies e tecnologias",
|
|
843
|
+
declineAll: "Recusar todos os cookies opcionais",
|
|
844
|
+
modalTitle: "Centro de Prefer\xEAncias de Privacidade"
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
// Internacionalização simplificada (apenas textos básicos)
|
|
848
|
+
i18n: {
|
|
849
|
+
en: {
|
|
850
|
+
bannerMessage: "We use cookies to enhance your experience.",
|
|
851
|
+
acceptAll: "Accept All",
|
|
852
|
+
declineAll: "Decline",
|
|
853
|
+
preferences: "Preferences",
|
|
854
|
+
modalTitle: "Cookie Preferences",
|
|
855
|
+
modalIntro: "Customize your cookie preferences below.",
|
|
856
|
+
save: "Save Preferences",
|
|
857
|
+
necessaryAlwaysOn: "Necessary cookies (always active)"
|
|
858
|
+
},
|
|
859
|
+
es: {
|
|
860
|
+
bannerMessage: "Utilizamos cookies para mejorar su experiencia.",
|
|
861
|
+
acceptAll: "Aceptar Todo",
|
|
862
|
+
declineAll: "Rechazar",
|
|
863
|
+
preferences: "Preferencias",
|
|
864
|
+
modalTitle: "Preferencias de Cookies",
|
|
865
|
+
modalIntro: "Personalice sus preferencias de cookies a continuaci\xF3n.",
|
|
866
|
+
save: "Guardar Preferencias",
|
|
867
|
+
necessaryAlwaysOn: "Cookies necess\xE1rias (sempre ativas)"
|
|
868
|
+
},
|
|
869
|
+
fr: {
|
|
870
|
+
bannerMessage: "Nous utilisons des cookies pour am\xE9liorer votre exp\xE9rience.",
|
|
871
|
+
acceptAll: "Tout Accepter",
|
|
872
|
+
declineAll: "Refuser",
|
|
873
|
+
preferences: "Pr\xE9f\xE9rences",
|
|
874
|
+
modalTitle: "Pr\xE9f\xE9rences des Cookies",
|
|
875
|
+
modalIntro: "Personnalisez vos pr\xE9f\xE9rences de cookies ci-dessous.",
|
|
876
|
+
save: "Enregistrer les Pr\xE9f\xE9rences",
|
|
877
|
+
necessaryAlwaysOn: "Cookies n\xE9cessaires (toujours actifs)"
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
// Textos técnicos
|
|
881
|
+
technical: {
|
|
882
|
+
sessionCookies: "Cookies de sess\xE3o s\xE3o tempor\xE1rios e expiram quando voc\xEA fecha o navegador.",
|
|
883
|
+
persistentCookies: "Cookies persistentes permanecem no seu dispositivo at\xE9 expirarem ou serem removidos.",
|
|
884
|
+
thirdPartyCookies: "Cookies de terceiros s\xE3o definidos por dom\xEDnios diferentes do site que voc\xEA est\xE1 visitando.",
|
|
885
|
+
browserSettings: "Voc\xEA pode gerenciar cookies nas configura\xE7\xF5es do seu navegador.",
|
|
886
|
+
disablingImpact: "Desabilitar cookies pode afetar a funcionalidade do site."
|
|
887
|
+
},
|
|
888
|
+
// Cookie details
|
|
889
|
+
cookieDetails: {
|
|
890
|
+
tableHeaders: {
|
|
891
|
+
name: "Nome",
|
|
892
|
+
purpose: "Finalidade",
|
|
893
|
+
duration: "Dura\xE7\xE3o",
|
|
894
|
+
provider: "Fornecedor",
|
|
895
|
+
type: "Tipo"
|
|
896
|
+
},
|
|
897
|
+
noCookies: "Nenhum cookie encontrado para esta categoria.",
|
|
898
|
+
toggleDetails: {
|
|
899
|
+
expand: "Ver detalhes",
|
|
900
|
+
collapse: "Ocultar detalhes"
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
function resolveTexts(texts, options = {}) {
|
|
905
|
+
const { language = "pt", variant } = options;
|
|
906
|
+
let resolved = { ...texts };
|
|
907
|
+
if (variant && texts.variants?.[variant]) {
|
|
908
|
+
resolved = { ...resolved, ...texts.variants[variant] };
|
|
909
|
+
}
|
|
910
|
+
if (language !== "pt" && texts.i18n?.[language]) {
|
|
911
|
+
resolved = { ...resolved, ...texts.i18n[language] };
|
|
912
|
+
}
|
|
913
|
+
return resolved;
|
|
914
|
+
}
|
|
915
|
+
var TEXT_TEMPLATES = {
|
|
916
|
+
ecommerce: {
|
|
917
|
+
...EXPANDED_DEFAULT_TEXTS,
|
|
918
|
+
bannerMessage: "Utilizamos cookies para personalizar ofertas e melhorar sua experi\xEAncia de compra.",
|
|
919
|
+
acceptAll: "Aceitar e continuar",
|
|
920
|
+
variants: {
|
|
921
|
+
casual: {
|
|
922
|
+
bannerMessage: "\u{1F6D2} Usamos cookies para encontrar as melhores ofertas para voc\xEA!",
|
|
923
|
+
acceptAll: "Quero ofertas personalizadas!"
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
saas: {
|
|
928
|
+
...EXPANDED_DEFAULT_TEXTS,
|
|
929
|
+
bannerMessage: "Utilizamos cookies para otimizar o desempenho da aplica\xE7\xE3o e sua experi\xEAncia.",
|
|
930
|
+
acceptAll: "Aceitar e otimizar",
|
|
931
|
+
variants: {
|
|
932
|
+
formal: {
|
|
933
|
+
bannerMessage: "Esta aplica\xE7\xE3o utiliza cookies para an\xE1lise de performance e melhoria cont\xEDnua da experi\xEAncia do usu\xE1rio.",
|
|
934
|
+
acceptAll: "Autorizar coleta de dados de uso"
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
government: {
|
|
939
|
+
...EXPANDED_DEFAULT_TEXTS,
|
|
940
|
+
bannerMessage: "Este portal utiliza cookies em conformidade com a LGPD para melhorar os servi\xE7os p\xFAblicos.",
|
|
941
|
+
acceptAll: "Aceitar em conformidade",
|
|
942
|
+
variants: {
|
|
943
|
+
formal: {
|
|
944
|
+
bannerMessage: "Este s\xEDtio eletr\xF4nico do governo utiliza cookies estritamente necess\xE1rios e opcionais, em conformidade com a Lei Geral de Prote\xE7\xE3o de Dados.",
|
|
945
|
+
acceptAll: "Concordar com o uso de cookies"
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
Object.defineProperty(exports, "FloatingPreferencesButton", {
|
|
952
|
+
enumerable: true,
|
|
953
|
+
get: function () { return chunkFJKRAERJ_cjs.FloatingPreferencesButton; }
|
|
954
|
+
});
|
|
955
|
+
Object.defineProperty(exports, "PreferencesModal", {
|
|
956
|
+
enumerable: true,
|
|
957
|
+
get: function () { return chunk25XEI2DZ_cjs.PreferencesModal; }
|
|
958
|
+
});
|
|
959
|
+
Object.defineProperty(exports, "ConsentProvider", {
|
|
960
|
+
enumerable: true,
|
|
961
|
+
get: function () { return chunkORI4PLVG_cjs.ConsentProvider; }
|
|
962
|
+
});
|
|
963
|
+
Object.defineProperty(exports, "CookieBanner", {
|
|
964
|
+
enumerable: true,
|
|
965
|
+
get: function () { return chunkORI4PLVG_cjs.CookieBanner; }
|
|
966
|
+
});
|
|
967
|
+
Object.defineProperty(exports, "DEFAULT_PROJECT_CATEGORIES", {
|
|
968
|
+
enumerable: true,
|
|
969
|
+
get: function () { return chunkORI4PLVG_cjs.DEFAULT_PROJECT_CATEGORIES; }
|
|
970
|
+
});
|
|
971
|
+
Object.defineProperty(exports, "GUIDANCE_PRESETS", {
|
|
972
|
+
enumerable: true,
|
|
973
|
+
get: function () { return chunkORI4PLVG_cjs.GUIDANCE_PRESETS; }
|
|
974
|
+
});
|
|
975
|
+
Object.defineProperty(exports, "LogLevel", {
|
|
976
|
+
enumerable: true,
|
|
977
|
+
get: function () { return chunkORI4PLVG_cjs.LogLevel; }
|
|
978
|
+
});
|
|
979
|
+
Object.defineProperty(exports, "analyzeDeveloperConfiguration", {
|
|
980
|
+
enumerable: true,
|
|
981
|
+
get: function () { return chunkORI4PLVG_cjs.analyzeDeveloperConfiguration; }
|
|
982
|
+
});
|
|
983
|
+
Object.defineProperty(exports, "categorizeDiscoveredCookies", {
|
|
984
|
+
enumerable: true,
|
|
985
|
+
get: function () { return chunkORI4PLVG_cjs.categorizeDiscoveredCookies; }
|
|
986
|
+
});
|
|
987
|
+
Object.defineProperty(exports, "createProjectPreferences", {
|
|
988
|
+
enumerable: true,
|
|
989
|
+
get: function () { return chunkORI4PLVG_cjs.createProjectPreferences; }
|
|
990
|
+
});
|
|
991
|
+
Object.defineProperty(exports, "defaultTexts", {
|
|
992
|
+
enumerable: true,
|
|
993
|
+
get: function () { return chunkORI4PLVG_cjs.defaultTexts; }
|
|
994
|
+
});
|
|
995
|
+
Object.defineProperty(exports, "detectConsentCookieName", {
|
|
996
|
+
enumerable: true,
|
|
997
|
+
get: function () { return chunkORI4PLVG_cjs.detectConsentCookieName; }
|
|
998
|
+
});
|
|
999
|
+
Object.defineProperty(exports, "discoverRuntimeCookies", {
|
|
1000
|
+
enumerable: true,
|
|
1001
|
+
get: function () { return chunkORI4PLVG_cjs.discoverRuntimeCookies; }
|
|
1002
|
+
});
|
|
1003
|
+
Object.defineProperty(exports, "getAllProjectCategories", {
|
|
1004
|
+
enumerable: true,
|
|
1005
|
+
get: function () { return chunkORI4PLVG_cjs.getAllProjectCategories; }
|
|
1006
|
+
});
|
|
1007
|
+
Object.defineProperty(exports, "getCookiesInfoForCategory", {
|
|
1008
|
+
enumerable: true,
|
|
1009
|
+
get: function () { return chunkORI4PLVG_cjs.getCookiesInfoForCategory; }
|
|
1010
|
+
});
|
|
1011
|
+
Object.defineProperty(exports, "logDeveloperGuidance", {
|
|
1012
|
+
enumerable: true,
|
|
1013
|
+
get: function () { return chunkORI4PLVG_cjs.logDeveloperGuidance; }
|
|
1014
|
+
});
|
|
1015
|
+
Object.defineProperty(exports, "openPreferencesModal", {
|
|
1016
|
+
enumerable: true,
|
|
1017
|
+
get: function () { return chunkORI4PLVG_cjs.openPreferencesModal; }
|
|
1018
|
+
});
|
|
1019
|
+
Object.defineProperty(exports, "setCookieCatalogOverrides", {
|
|
1020
|
+
enumerable: true,
|
|
1021
|
+
get: function () { return chunkORI4PLVG_cjs.setCookieCatalogOverrides; }
|
|
1022
|
+
});
|
|
1023
|
+
Object.defineProperty(exports, "setCookieCategoryOverrides", {
|
|
1024
|
+
enumerable: true,
|
|
1025
|
+
get: function () { return chunkORI4PLVG_cjs.setCookieCategoryOverrides; }
|
|
1026
|
+
});
|
|
1027
|
+
Object.defineProperty(exports, "setDebugLogging", {
|
|
1028
|
+
enumerable: true,
|
|
1029
|
+
get: function () { return chunkORI4PLVG_cjs.setDebugLogging; }
|
|
1030
|
+
});
|
|
1031
|
+
Object.defineProperty(exports, "useCategories", {
|
|
1032
|
+
enumerable: true,
|
|
1033
|
+
get: function () { return chunkORI4PLVG_cjs.useCategories; }
|
|
1034
|
+
});
|
|
1035
|
+
Object.defineProperty(exports, "useCategoryStatus", {
|
|
1036
|
+
enumerable: true,
|
|
1037
|
+
get: function () { return chunkORI4PLVG_cjs.useCategoryStatus; }
|
|
1038
|
+
});
|
|
1039
|
+
Object.defineProperty(exports, "useConsent", {
|
|
1040
|
+
enumerable: true,
|
|
1041
|
+
get: function () { return chunkORI4PLVG_cjs.useConsent; }
|
|
1042
|
+
});
|
|
1043
|
+
Object.defineProperty(exports, "useConsentHydration", {
|
|
1044
|
+
enumerable: true,
|
|
1045
|
+
get: function () { return chunkORI4PLVG_cjs.useConsentHydration; }
|
|
1046
|
+
});
|
|
1047
|
+
Object.defineProperty(exports, "useConsentTexts", {
|
|
1048
|
+
enumerable: true,
|
|
1049
|
+
get: function () { return chunkORI4PLVG_cjs.useConsentTexts; }
|
|
1050
|
+
});
|
|
1051
|
+
Object.defineProperty(exports, "useDeveloperGuidance", {
|
|
1052
|
+
enumerable: true,
|
|
1053
|
+
get: function () { return chunkORI4PLVG_cjs.useDeveloperGuidance; }
|
|
1054
|
+
});
|
|
1055
|
+
Object.defineProperty(exports, "useOpenPreferencesModal", {
|
|
1056
|
+
enumerable: true,
|
|
1057
|
+
get: function () { return chunkORI4PLVG_cjs.useOpenPreferencesModal; }
|
|
1058
|
+
});
|
|
1059
|
+
Object.defineProperty(exports, "validateProjectPreferences", {
|
|
1060
|
+
enumerable: true,
|
|
1061
|
+
get: function () { return chunkORI4PLVG_cjs.validateProjectPreferences; }
|
|
1779
1062
|
});
|
|
1063
|
+
exports.COMMON_INTEGRATIONS = COMMON_INTEGRATIONS;
|
|
1064
|
+
exports.ConsentGate = ConsentGate;
|
|
1065
|
+
exports.ConsentScriptLoader = ConsentScriptLoader;
|
|
1066
|
+
exports.EXPANDED_DEFAULT_TEXTS = EXPANDED_DEFAULT_TEXTS;
|
|
1067
|
+
exports.INTEGRATION_TEMPLATES = INTEGRATION_TEMPLATES;
|
|
1068
|
+
exports.TEXT_TEMPLATES = TEXT_TEMPLATES;
|
|
1069
|
+
exports.analyzeIntegrationCategories = analyzeIntegrationCategories;
|
|
1070
|
+
exports.autoConfigureCategories = autoConfigureCategories;
|
|
1071
|
+
exports.createClarityIntegration = createClarityIntegration;
|
|
1072
|
+
exports.createCorporateIntegrations = createCorporateIntegrations;
|
|
1073
|
+
exports.createDefaultConsentTheme = createDefaultConsentTheme;
|
|
1074
|
+
exports.createECommerceIntegrations = createECommerceIntegrations;
|
|
1075
|
+
exports.createFacebookPixelIntegration = createFacebookPixelIntegration;
|
|
1076
|
+
exports.createGoogleAnalyticsIntegration = createGoogleAnalyticsIntegration;
|
|
1077
|
+
exports.createGoogleTagManagerIntegration = createGoogleTagManagerIntegration;
|
|
1078
|
+
exports.createHotjarIntegration = createHotjarIntegration;
|
|
1079
|
+
exports.createIntercomIntegration = createIntercomIntegration;
|
|
1080
|
+
exports.createMixpanelIntegration = createMixpanelIntegration;
|
|
1081
|
+
exports.createSaaSIntegrations = createSaaSIntegrations;
|
|
1082
|
+
exports.createUserWayIntegration = createUserWayIntegration;
|
|
1083
|
+
exports.createZendeskChatIntegration = createZendeskChatIntegration;
|
|
1084
|
+
exports.defaultConsentTheme = defaultConsentTheme;
|
|
1085
|
+
exports.extractCategoriesFromIntegrations = extractCategoriesFromIntegrations;
|
|
1086
|
+
exports.loadScript = loadScript;
|
|
1087
|
+
exports.resolveTexts = resolveTexts;
|
|
1088
|
+
exports.suggestCategoryForScript = suggestCategoryForScript;
|
|
1089
|
+
exports.useConsentScriptLoader = useConsentScriptLoader;
|
|
1090
|
+
exports.validateIntegrationCategories = validateIntegrationCategories;
|
|
1091
|
+
exports.validateNecessaryClassification = validateNecessaryClassification;
|