react-lgpd-consent 0.2.1 → 0.2.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/dist/index.cjs CHANGED
@@ -186,74 +186,242 @@ var init_theme = __esm({
186
186
  }
187
187
  });
188
188
 
189
+ // src/utils/developerGuidance.ts
190
+ function analyzeDeveloperConfiguration(config) {
191
+ const guidance = {
192
+ warnings: [],
193
+ suggestions: [],
194
+ activeCategoriesInfo: [],
195
+ usingDefaults: !config
196
+ };
197
+ const finalConfig = config || DEFAULT_PROJECT_CATEGORIES;
198
+ if (!config) {
199
+ guidance.warnings.push(
200
+ '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".'
201
+ );
202
+ }
203
+ guidance.activeCategoriesInfo.push({
204
+ id: "necessary",
205
+ name: "Cookies Necess\xE1rios",
206
+ description: "Essenciais para funcionamento b\xE1sico do site",
207
+ essential: true,
208
+ uiRequired: false
209
+ // Não precisa de toggle (sempre ativo)
210
+ });
211
+ const enabledCategories = finalConfig.enabledCategories || [];
212
+ const categoryNames = {
213
+ analytics: {
214
+ name: "Cookies Anal\xEDticos",
215
+ description: "Medem uso e performance do site"
216
+ },
217
+ functional: {
218
+ name: "Cookies Funcionais",
219
+ description: "Melhoram experi\xEAncia e funcionalidades"
220
+ },
221
+ marketing: {
222
+ name: "Cookies de Marketing",
223
+ description: "Publicidade direcionada e campanhas"
224
+ },
225
+ social: {
226
+ name: "Cookies de Redes Sociais",
227
+ description: "Integra\xE7\xE3o com plataformas sociais"
228
+ },
229
+ personalization: {
230
+ name: "Cookies de Personaliza\xE7\xE3o",
231
+ description: "Adaptam conte\xFAdo \xE0s prefer\xEAncias do usu\xE1rio"
232
+ }
233
+ };
234
+ enabledCategories.forEach((categoryId) => {
235
+ const categoryInfo = categoryNames[categoryId];
236
+ if (categoryInfo) {
237
+ guidance.activeCategoriesInfo.push({
238
+ id: categoryId,
239
+ name: categoryInfo.name,
240
+ description: categoryInfo.description,
241
+ essential: false,
242
+ uiRequired: true
243
+ // Precisa de toggle na UI
244
+ });
245
+ }
246
+ });
247
+ const customCategories = finalConfig.customCategories || [];
248
+ customCategories.forEach((category) => {
249
+ guidance.activeCategoriesInfo.push({
250
+ id: category.id,
251
+ name: category.name,
252
+ description: category.description,
253
+ essential: category.essential === true,
254
+ uiRequired: category.essential !== true
255
+ // Apenas não-essenciais precisam toggle
256
+ });
257
+ });
258
+ const totalToggleable = guidance.activeCategoriesInfo.filter(
259
+ (c) => c.uiRequired
260
+ ).length;
261
+ if (totalToggleable === 0) {
262
+ guidance.suggestions.push(
263
+ 'Apenas cookies necess\xE1rios est\xE3o configurados. Para compliance completo LGPD, considere adicionar categorias como "analytics" ou "functional" conforme uso real.'
264
+ );
265
+ }
266
+ if (totalToggleable > 5) {
267
+ guidance.warnings.push(
268
+ `${totalToggleable} categorias opcionais detectadas. UI com muitas op\xE7\xF5es pode ' +
269
+ 'prejudicar experi\xEAncia do usu\xE1rio. Considere agrupar categorias similares.`
270
+ );
271
+ }
272
+ const poorDescriptions = customCategories.filter(
273
+ (c) => !c.description || c.description.length < 10
274
+ );
275
+ if (poorDescriptions.length > 0) {
276
+ guidance.warnings.push(
277
+ `Categorias customizadas com descri\xE7\xF5es inadequadas: ${poorDescriptions.map((c) => c.id).join(", ")}. Descri\xE7\xF5es claras s\xE3o obrigat\xF3rias para compliance LGPD.`
278
+ );
279
+ }
280
+ return guidance;
281
+ }
282
+ function logDeveloperGuidance(guidance) {
283
+ try {
284
+ const isProduction = (
285
+ // 1. NODE_ENV de bundlers (Vite, webpack, etc.)
286
+ typeof globalThis.process !== "undefined" && globalThis.process.env?.NODE_ENV === "production" || // 2. Vite/bundler env vars (apenas em ESM)
287
+ typeof globalThis !== "undefined" && typeof globalThis.import !== "undefined" && globalThis.import.meta?.env?.PROD === true || // 3. Flag customizada para desabilitar logs
288
+ typeof globalThis !== "undefined" && globalThis.__LGPD_PRODUCTION__ || // 4. Flag de desenvolvimento desabilitada
289
+ typeof window !== "undefined" && window.__LGPD_DISABLE_GUIDANCE__
290
+ );
291
+ if (isProduction) return;
292
+ const PREFIX = "[\u{1F36A} LGPD-CONSENT]";
293
+ if (guidance.warnings.length > 0) {
294
+ console.group(`${PREFIX} \u26A0\uFE0F Avisos de Configura\xE7\xE3o`);
295
+ guidance.warnings.forEach(
296
+ (warning) => console.warn(`${PREFIX} ${warning}`)
297
+ );
298
+ console.groupEnd();
299
+ }
300
+ if (guidance.suggestions.length > 0) {
301
+ console.group(`${PREFIX} \u{1F4A1} Sugest\xF5es`);
302
+ guidance.suggestions.forEach(
303
+ (suggestion) => console.info(`${PREFIX} ${suggestion}`)
304
+ );
305
+ console.groupEnd();
306
+ }
307
+ if (guidance.usingDefaults) {
308
+ console.info(
309
+ `${PREFIX} \u{1F4CB} Usando configura\xE7\xE3o padr\xE3o. Para personalizar, use a prop "categories" no ConsentProvider.`
310
+ );
311
+ }
312
+ console.group(`${PREFIX} \u{1F527} Categorias Ativas (para UI customizada)`);
313
+ console.table(
314
+ guidance.activeCategoriesInfo.map((cat) => ({
315
+ ID: cat.id,
316
+ Nome: cat.name,
317
+ "Toggle UI?": cat.uiRequired ? "\u2705 SIM" : "\u274C N\xC3O (sempre ativo)",
318
+ "Essencial?": cat.essential ? "\u{1F512} SIM" : "\u2699\uFE0F N\xC3O"
319
+ }))
320
+ );
321
+ console.info(
322
+ `${PREFIX} \u2139\uFE0F Use estes dados para criar componentes customizados adequados.`
323
+ );
324
+ console.groupEnd();
325
+ } catch (error) {
326
+ if (typeof console !== "undefined" && console.warn) {
327
+ console.warn(
328
+ "[\u{1F36A} LGPD-CONSENT] Sistema de orienta\xE7\xF5es encontrou erro:",
329
+ error
330
+ );
331
+ }
332
+ }
333
+ }
334
+ function useDeveloperGuidance(config) {
335
+ const guidance = analyzeDeveloperConfiguration(config);
336
+ React.useEffect(() => {
337
+ logDeveloperGuidance(guidance);
338
+ }, [JSON.stringify(config)]);
339
+ return guidance;
340
+ }
341
+ var React, DEFAULT_PROJECT_CATEGORIES;
342
+ var init_developerGuidance = __esm({
343
+ "src/utils/developerGuidance.ts"() {
344
+ "use strict";
345
+ React = __toESM(require("react"), 1);
346
+ DEFAULT_PROJECT_CATEGORIES = {
347
+ enabledCategories: ["analytics"],
348
+ // Só analytics além de necessary
349
+ customCategories: []
350
+ };
351
+ }
352
+ });
353
+
189
354
  // src/context/CategoriesContext.tsx
190
355
  function CategoriesProvider({
356
+ children,
191
357
  categories,
192
- children
358
+ // LEGACY: prop antiga (apenas customCategories)
359
+ config
360
+ // NOVO: configuração completa
193
361
  }) {
194
- const value = React.useMemo(() => categories || [], [categories]);
195
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CategoriesCtx.Provider, { value, children });
362
+ const contextValue = React2.useMemo(() => {
363
+ let finalConfig;
364
+ if (categories && !config) {
365
+ finalConfig = {
366
+ enabledCategories: DEFAULT_PROJECT_CATEGORIES.enabledCategories,
367
+ customCategories: categories
368
+ };
369
+ } else {
370
+ finalConfig = config || DEFAULT_PROJECT_CATEGORIES;
371
+ }
372
+ const guidance = analyzeDeveloperConfiguration(
373
+ config || (categories ? { customCategories: categories } : void 0)
374
+ );
375
+ const toggleableCategories = guidance.activeCategoriesInfo.filter(
376
+ (cat) => cat.uiRequired
377
+ );
378
+ return {
379
+ config: finalConfig,
380
+ guidance,
381
+ toggleableCategories,
382
+ allCategories: guidance.activeCategoriesInfo,
383
+ legacyCategories: categories || []
384
+ };
385
+ }, [config, categories]);
386
+ React2.useEffect(() => {
387
+ logDeveloperGuidance(contextValue.guidance);
388
+ }, [contextValue.guidance]);
389
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CategoriesContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CategoriesCtx.Provider, { value: contextValue.legacyCategories, children }) });
196
390
  }
197
- function useCustomCategories() {
198
- return React.useContext(CategoriesCtx);
391
+ function useCategories() {
392
+ const context = React2.useContext(CategoriesContext);
393
+ if (!context) {
394
+ throw new Error(
395
+ "useCategories deve ser usado dentro de CategoriesProvider. Certifique-se de que o ConsentProvider est\xE1 envolvendo seu componente."
396
+ );
397
+ }
398
+ return context;
199
399
  }
200
- function useAllCategories() {
201
- const customCategories = useCustomCategories();
202
- return React.useMemo(() => {
203
- const defaultCategories = [
204
- {
205
- id: "necessary",
206
- name: "Cookies Necess\xE1rios",
207
- description: "Essenciais para o funcionamento b\xE1sico do site. Incluem cookies de sess\xE3o, autentica\xE7\xE3o e seguran\xE7a.",
208
- essential: true,
209
- cookies: ["PHPSESSID", "JSESSIONID", "cookieConsent", "csrf_token"]
210
- },
211
- {
212
- id: "analytics",
213
- name: "Analytics e Estat\xEDsticas",
214
- description: "Permitem medir audi\xEAncia e desempenho, gerando estat\xEDsticas an\xF4nimas de uso.",
215
- essential: false,
216
- cookies: ["_ga", "_ga_*", "_gid", "_gat", "gtag"]
217
- },
218
- {
219
- id: "functional",
220
- name: "Cookies Funcionais",
221
- description: "Melhoram a experi\xEAncia do usu\xE1rio, lembrando prefer\xEAncias e configura\xE7\xF5es.",
222
- essential: false,
223
- cookies: ["language", "theme", "timezone", "preferences"]
224
- },
225
- {
226
- id: "marketing",
227
- name: "Marketing e Publicidade",
228
- description: "Utilizados para publicidade direcionada e medi\xE7\xE3o de campanhas publicit\xE1rias.",
229
- essential: false,
230
- cookies: ["_fbp", "fr", "tr", "ads_*", "doubleclick"]
231
- },
232
- {
233
- id: "social",
234
- name: "Redes Sociais",
235
- description: "Permitem compartilhamento e integra\xE7\xE3o com redes sociais como Facebook, YouTube, etc.",
236
- essential: false,
237
- cookies: ["__Secure-*", "sb", "datr", "c_user", "social_*"]
238
- },
239
- {
240
- id: "personalization",
241
- name: "Personaliza\xE7\xE3o",
242
- description: "Adaptam o conte\xFAdo e interface \xE0s prefer\xEAncias individuais do usu\xE1rio.",
243
- essential: false,
244
- cookies: ["personalization_*", "content_*", "layout_*"]
245
- }
246
- ];
247
- return [...defaultCategories, ...customCategories];
248
- }, [customCategories]);
400
+ function useCategoryStatus(categoryId) {
401
+ const { allCategories } = useCategories();
402
+ const category = allCategories.find((cat) => cat.id === categoryId);
403
+ return {
404
+ isActive: !!category,
405
+ isEssential: category?.essential || false,
406
+ needsToggle: category?.uiRequired || false,
407
+ name: category?.name,
408
+ description: category?.description
409
+ };
410
+ }
411
+ function useCustomCategories() {
412
+ return React2.useContext(CategoriesCtx);
249
413
  }
250
- var React, import_jsx_runtime, CategoriesCtx;
414
+ var React2, import_jsx_runtime, CategoriesContext, CategoriesCtx;
251
415
  var init_CategoriesContext = __esm({
252
416
  "src/context/CategoriesContext.tsx"() {
253
417
  "use strict";
254
- React = __toESM(require("react"), 1);
418
+ React2 = __toESM(require("react"), 1);
419
+ init_developerGuidance();
255
420
  import_jsx_runtime = require("react/jsx-runtime");
256
- CategoriesCtx = React.createContext([]);
421
+ CategoriesContext = React2.createContext(
422
+ null
423
+ );
424
+ CategoriesCtx = React2.createContext([]);
257
425
  }
258
426
  });
259
427
 
@@ -333,12 +501,25 @@ function PreferencesModal({
333
501
  }) {
334
502
  const { preferences, setPreferences, closePreferences, isModalOpen } = useConsent();
335
503
  const texts = useConsentTexts();
336
- const [tempPreferences, setTempPreferences] = (0, import_react.useState)(preferences);
504
+ const { toggleableCategories } = useCategories();
505
+ const [tempPreferences, setTempPreferences] = (0, import_react.useState)(
506
+ () => {
507
+ const initialPrefs = { necessary: true };
508
+ toggleableCategories.forEach((category) => {
509
+ initialPrefs[category.id] = preferences[category.id] ?? false;
510
+ });
511
+ return initialPrefs;
512
+ }
513
+ );
337
514
  (0, import_react.useEffect)(() => {
338
515
  if (isModalOpen) {
339
- setTempPreferences(preferences);
516
+ const syncedPrefs = { necessary: true };
517
+ toggleableCategories.forEach((category) => {
518
+ syncedPrefs[category.id] = preferences[category.id] ?? false;
519
+ });
520
+ setTempPreferences(syncedPrefs);
340
521
  }
341
- }, [isModalOpen, preferences]);
522
+ }, [isModalOpen, preferences, toggleableCategories]);
342
523
  const open = DialogProps2?.open ?? isModalOpen ?? false;
343
524
  const handleSave = () => {
344
525
  setPreferences(tempPreferences);
@@ -359,38 +540,23 @@ function PreferencesModal({
359
540
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_DialogContent.default, { dividers: true, children: [
360
541
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Typography2.default, { variant: "body2", sx: { mb: 2 }, children: texts.modalIntro }),
361
542
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_FormGroup.default, { children: [
362
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
543
+ toggleableCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
363
544
  import_FormControlLabel.default,
364
545
  {
365
546
  control: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
366
547
  import_Switch.default,
367
548
  {
368
- checked: tempPreferences.analytics,
549
+ checked: tempPreferences[category.id] ?? false,
369
550
  onChange: (e) => setTempPreferences((prev) => ({
370
551
  ...prev,
371
- analytics: e.target.checked
552
+ [category.id]: e.target.checked
372
553
  }))
373
554
  }
374
555
  ),
375
- label: "Cookies Anal\xEDticos (medem uso do site)"
376
- }
377
- ),
378
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
379
- import_FormControlLabel.default,
380
- {
381
- control: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
382
- import_Switch.default,
383
- {
384
- checked: tempPreferences.marketing,
385
- onChange: (e) => setTempPreferences((prev) => ({
386
- ...prev,
387
- marketing: e.target.checked
388
- }))
389
- }
390
- ),
391
- label: "Cookies de Marketing/Publicidade"
392
- }
393
- ),
556
+ label: `${category.name} - ${category.description}`
557
+ },
558
+ category.id
559
+ )),
394
560
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
395
561
  import_FormControlLabel.default,
396
562
  {
@@ -423,6 +589,7 @@ var init_PreferencesModal = __esm({
423
589
  import_Switch = __toESM(require("@mui/material/Switch"), 1);
424
590
  import_Typography2 = __toESM(require("@mui/material/Typography"), 1);
425
591
  import_react = require("react");
592
+ init_CategoriesContext();
426
593
  init_useConsent();
427
594
  init_Branding();
428
595
  import_jsx_runtime3 = require("react/jsx-runtime");
@@ -515,9 +682,12 @@ function reducer(state, action) {
515
682
  }
516
683
  function ConsentProvider({
517
684
  initialState,
685
+ categories,
686
+ // NOVO: configuração completa de categorias
518
687
  texts: textsProp,
519
688
  theme,
520
689
  customCategories,
690
+ // LEGACY: compatibilidade
521
691
  scriptIntegrations,
522
692
  PreferencesModalComponent,
523
693
  preferencesModalProps = {},
@@ -528,19 +698,31 @@ function ConsentProvider({
528
698
  cookie: cookieOpts,
529
699
  children
530
700
  }) {
531
- const texts = React2.useMemo(
701
+ const texts = React3.useMemo(
532
702
  () => ({ ...DEFAULT_TEXTS, ...textsProp ?? {} }),
533
703
  [textsProp]
534
704
  );
535
- const cookie = React2.useMemo(
705
+ const cookie = React3.useMemo(
536
706
  () => ({ ...DEFAULT_COOKIE_OPTS, ...cookieOpts ?? {} }),
537
707
  [cookieOpts]
538
708
  );
539
- const appliedTheme = React2.useMemo(
709
+ const appliedTheme = React3.useMemo(
540
710
  () => theme || defaultConsentTheme,
541
711
  [theme]
542
712
  );
543
- const boot = React2.useMemo(() => {
713
+ const finalCategoriesConfig = React3.useMemo(() => {
714
+ if (categories) return categories;
715
+ if (customCategories) {
716
+ return {
717
+ enabledCategories: ["analytics"],
718
+ // padrão quando usando API antiga
719
+ customCategories
720
+ };
721
+ }
722
+ return void 0;
723
+ }, [categories, customCategories]);
724
+ useDeveloperGuidance(finalCategoriesConfig);
725
+ const boot = React3.useMemo(() => {
544
726
  if (initialState) return { ...initialState, isModalOpen: false };
545
727
  return createFullConsentState(
546
728
  false,
@@ -549,9 +731,9 @@ function ConsentProvider({
549
731
  false
550
732
  );
551
733
  }, [initialState, customCategories]);
552
- const [state, dispatch] = React2.useReducer(reducer, boot);
553
- const [isHydrated, setIsHydrated] = React2.useState(false);
554
- React2.useEffect(() => {
734
+ const [state, dispatch] = React3.useReducer(reducer, boot);
735
+ const [isHydrated, setIsHydrated] = React3.useState(false);
736
+ React3.useEffect(() => {
555
737
  if (!initialState) {
556
738
  const saved = readConsentCookie(cookie.name);
557
739
  if (saved?.consented) {
@@ -561,24 +743,24 @@ function ConsentProvider({
561
743
  }
562
744
  setIsHydrated(true);
563
745
  }, [cookie.name, initialState]);
564
- React2.useEffect(() => {
746
+ React3.useEffect(() => {
565
747
  if (state.consented) writeConsentCookie(state, state.source, cookie);
566
748
  }, [state, cookie]);
567
- const prevConsented = React2.useRef(state.consented);
568
- React2.useEffect(() => {
749
+ const prevConsented = React3.useRef(state.consented);
750
+ React3.useEffect(() => {
569
751
  if (!prevConsented.current && state.consented && onConsentGiven) {
570
752
  setTimeout(() => onConsentGiven(state), 150);
571
753
  }
572
754
  prevConsented.current = state.consented;
573
755
  }, [state, onConsentGiven]);
574
- const prevPrefs = React2.useRef(state.preferences);
575
- React2.useEffect(() => {
756
+ const prevPrefs = React3.useRef(state.preferences);
757
+ React3.useEffect(() => {
576
758
  if (state.consented && onPreferencesSaved && prevPrefs.current !== state.preferences) {
577
759
  setTimeout(() => onPreferencesSaved(state.preferences), 150);
578
760
  prevPrefs.current = state.preferences;
579
761
  }
580
762
  }, [state, onPreferencesSaved]);
581
- const api = React2.useMemo(() => {
763
+ const api = React3.useMemo(() => {
582
764
  const acceptAll = () => dispatch({ type: "ACCEPT_ALL", customCategories });
583
765
  const rejectAll = () => dispatch({ type: "REJECT_ALL", customCategories });
584
766
  const setPreference = (category, value) => dispatch({ type: "SET_CATEGORY", category, value });
@@ -602,41 +784,49 @@ function ConsentProvider({
602
784
  resetConsent
603
785
  };
604
786
  }, [state, cookie, customCategories]);
605
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_styles2.ThemeProvider, { theme: appliedTheme, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StateCtx.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionsCtx.Provider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextsCtx.Provider, { value: texts, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HydrationCtx.Provider, { value: isHydrated, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(CategoriesProvider, { categories: customCategories, children: [
606
- children,
607
- !disableAutomaticModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(React2.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PreferencesModalComponent, { ...preferencesModalProps }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PreferencesModal2, { hideBranding }) })
608
- ] }) }) }) }) }) });
787
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_styles2.ThemeProvider, { theme: appliedTheme, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StateCtx.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionsCtx.Provider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextsCtx.Provider, { value: texts, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HydrationCtx.Provider, { value: isHydrated, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
788
+ CategoriesProvider,
789
+ {
790
+ config: finalCategoriesConfig,
791
+ categories: customCategories,
792
+ children: [
793
+ children,
794
+ !disableAutomaticModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(React3.Suspense, { fallback: null, children: PreferencesModalComponent ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PreferencesModalComponent, { ...preferencesModalProps }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PreferencesModal2, { hideBranding }) })
795
+ ]
796
+ }
797
+ ) }) }) }) }) });
609
798
  }
610
799
  function useConsentStateInternal() {
611
- const ctx = React2.useContext(StateCtx);
800
+ const ctx = React3.useContext(StateCtx);
612
801
  if (!ctx)
613
802
  throw new Error("useConsentState must be used within ConsentProvider");
614
803
  return ctx;
615
804
  }
616
805
  function useConsentActionsInternal() {
617
- const ctx = React2.useContext(ActionsCtx);
806
+ const ctx = React3.useContext(ActionsCtx);
618
807
  if (!ctx)
619
808
  throw new Error("useConsentActions must be used within ConsentProvider");
620
809
  return ctx;
621
810
  }
622
811
  function useConsentTextsInternal() {
623
- const ctx = React2.useContext(TextsCtx);
812
+ const ctx = React3.useContext(TextsCtx);
624
813
  return ctx;
625
814
  }
626
815
  function useConsentHydrationInternal() {
627
- return React2.useContext(HydrationCtx);
816
+ return React3.useContext(HydrationCtx);
628
817
  }
629
- var React2, import_styles2, import_jsx_runtime4, PreferencesModal2, DEFAULT_PREFERENCES, DEFAULT_TEXTS, StateCtx, ActionsCtx, TextsCtx, HydrationCtx;
818
+ var React3, import_styles2, import_jsx_runtime4, PreferencesModal2, DEFAULT_PREFERENCES, DEFAULT_TEXTS, StateCtx, ActionsCtx, TextsCtx, HydrationCtx;
630
819
  var init_ConsentContext = __esm({
631
820
  "src/context/ConsentContext.tsx"() {
632
821
  "use strict";
633
- React2 = __toESM(require("react"), 1);
822
+ React3 = __toESM(require("react"), 1);
634
823
  import_styles2 = require("@mui/material/styles");
635
824
  init_cookieUtils();
636
825
  init_theme();
637
826
  init_CategoriesContext();
827
+ init_developerGuidance();
638
828
  import_jsx_runtime4 = require("react/jsx-runtime");
639
- PreferencesModal2 = React2.lazy(
829
+ PreferencesModal2 = React3.lazy(
640
830
  () => Promise.resolve().then(() => (init_PreferencesModal(), PreferencesModal_exports)).then((m) => ({
641
831
  default: m.PreferencesModal
642
832
  }))
@@ -674,10 +864,10 @@ var init_ConsentContext = __esm({
674
864
  transferCountries: void 0
675
865
  // Exibido se definido
676
866
  };
677
- StateCtx = React2.createContext(null);
678
- ActionsCtx = React2.createContext(null);
679
- TextsCtx = React2.createContext(DEFAULT_TEXTS);
680
- HydrationCtx = React2.createContext(false);
867
+ StateCtx = React3.createContext(null);
868
+ ActionsCtx = React3.createContext(null);
869
+ TextsCtx = React3.createContext(DEFAULT_TEXTS);
870
+ HydrationCtx = React3.createContext(false);
681
871
  }
682
872
  });
683
873
 
@@ -719,14 +909,17 @@ __export(index_exports, {
719
909
  ConsentProvider: () => ConsentProvider,
720
910
  ConsentScriptLoader: () => ConsentScriptLoader,
721
911
  CookieBanner: () => CookieBanner,
912
+ DEFAULT_PROJECT_CATEGORIES: () => DEFAULT_PROJECT_CATEGORIES,
722
913
  FloatingPreferencesButton: () => FloatingPreferencesButton,
723
914
  PreferencesModal: () => PreferencesModal,
915
+ analyzeDeveloperConfiguration: () => analyzeDeveloperConfiguration,
724
916
  createGoogleAnalyticsIntegration: () => createGoogleAnalyticsIntegration,
725
917
  createGoogleTagManagerIntegration: () => createGoogleTagManagerIntegration,
726
918
  createUserWayIntegration: () => createUserWayIntegration,
727
919
  defaultConsentTheme: () => defaultConsentTheme,
728
920
  loadScript: () => loadScript,
729
- useAllCategories: () => useAllCategories,
921
+ useCategories: () => useCategories,
922
+ useCategoryStatus: () => useCategoryStatus,
730
923
  useConsent: () => useConsent,
731
924
  useConsentHydration: () => useConsentHydration,
732
925
  useConsentScriptLoader: () => useConsentScriptLoader,
@@ -960,15 +1153,15 @@ function loadScript(id, src, category = null, attrs = {}) {
960
1153
  init_theme();
961
1154
 
962
1155
  // src/utils/ConsentScriptLoader.tsx
963
- var React3 = __toESM(require("react"), 1);
1156
+ var React4 = __toESM(require("react"), 1);
964
1157
  init_useConsent();
965
1158
  function ConsentScriptLoader({
966
1159
  integrations,
967
1160
  reloadOnChange = false
968
1161
  }) {
969
1162
  const { preferences, consented } = useConsent();
970
- const loadedScripts = React3.useRef(/* @__PURE__ */ new Set());
971
- React3.useEffect(() => {
1163
+ const loadedScripts = React4.useRef(/* @__PURE__ */ new Set());
1164
+ React4.useEffect(() => {
972
1165
  if (!consented) return;
973
1166
  integrations.forEach(async (integration) => {
974
1167
  const shouldLoad = preferences[integration.category];
@@ -999,7 +1192,7 @@ function ConsentScriptLoader({
999
1192
  }
1000
1193
  function useConsentScriptLoader() {
1001
1194
  const { preferences, consented } = useConsent();
1002
- return React3.useCallback(
1195
+ return React4.useCallback(
1003
1196
  async (integration) => {
1004
1197
  if (!consented) {
1005
1198
  console.warn(
@@ -1096,6 +1289,9 @@ var COMMON_INTEGRATIONS = {
1096
1289
  googleTagManager: createGoogleTagManagerIntegration,
1097
1290
  userway: createUserWayIntegration
1098
1291
  };
1292
+
1293
+ // src/index.ts
1294
+ init_developerGuidance();
1099
1295
  // Annotate the CommonJS export names for ESM import in node:
1100
1296
  0 && (module.exports = {
1101
1297
  COMMON_INTEGRATIONS,
@@ -1103,14 +1299,17 @@ var COMMON_INTEGRATIONS = {
1103
1299
  ConsentProvider,
1104
1300
  ConsentScriptLoader,
1105
1301
  CookieBanner,
1302
+ DEFAULT_PROJECT_CATEGORIES,
1106
1303
  FloatingPreferencesButton,
1107
1304
  PreferencesModal,
1305
+ analyzeDeveloperConfiguration,
1108
1306
  createGoogleAnalyticsIntegration,
1109
1307
  createGoogleTagManagerIntegration,
1110
1308
  createUserWayIntegration,
1111
1309
  defaultConsentTheme,
1112
1310
  loadScript,
1113
- useAllCategories,
1311
+ useCategories,
1312
+ useCategoryStatus,
1114
1313
  useConsent,
1115
1314
  useConsentHydration,
1116
1315
  useConsentScriptLoader,