@solvenza/cookies-compliance 1.2.1 → 1.5.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.
Files changed (72) hide show
  1. package/README.md +960 -36
  2. package/bin/audit-cli.js +134 -13
  3. package/dist/audit.cjs +811 -0
  4. package/dist/audit.cjs.map +1 -0
  5. package/dist/audit.d.cts +60 -0
  6. package/dist/audit.d.ts +60 -0
  7. package/dist/audit.js +380 -0
  8. package/dist/audit.js.map +1 -0
  9. package/dist/chunk-C5QPXHTH.js +3557 -0
  10. package/dist/chunk-C5QPXHTH.js.map +1 -0
  11. package/dist/chunk-OHOHIAK6.js +442 -0
  12. package/dist/chunk-OHOHIAK6.js.map +1 -0
  13. package/dist/chunk-Q3FZFXQE.js +89 -0
  14. package/dist/chunk-UQU54ANZ.js +225 -0
  15. package/dist/chunk-UQU54ANZ.js.map +1 -0
  16. package/dist/chunk-W5MG56VI.js +269 -0
  17. package/dist/chunk-W5MG56VI.js.map +1 -0
  18. package/dist/consent.esm.cjs +2195 -84
  19. package/dist/consent.esm.cjs.map +1 -1
  20. package/dist/consent.esm.d.cts +173 -6
  21. package/dist/consent.esm.d.ts +173 -6
  22. package/dist/consent.esm.js +57 -23
  23. package/dist/consent.esm.js.map +1 -1
  24. package/dist/consent.min.js +437 -55
  25. package/dist/consent.min.js.map +1 -1
  26. package/dist/presets.cjs +495 -0
  27. package/dist/presets.cjs.map +1 -0
  28. package/dist/presets.d.cts +51 -0
  29. package/dist/presets.d.ts +51 -0
  30. package/dist/presets.js +16 -0
  31. package/dist/presets.js.map +1 -0
  32. package/dist/types--kyI7OOR.d.cts +314 -0
  33. package/dist/types--kyI7OOR.d.ts +314 -0
  34. package/dist/wrappers/angular.cjs +2341 -65
  35. package/dist/wrappers/angular.cjs.map +1 -1
  36. package/dist/wrappers/angular.d.cts +85 -5
  37. package/dist/wrappers/angular.d.ts +85 -5
  38. package/dist/wrappers/angular.js +217 -3
  39. package/dist/wrappers/angular.js.map +1 -1
  40. package/dist/wrappers/next.cjs +2353 -103
  41. package/dist/wrappers/next.cjs.map +1 -1
  42. package/dist/wrappers/next.d.cts +25 -1
  43. package/dist/wrappers/next.d.ts +25 -1
  44. package/dist/wrappers/next.js +30 -5
  45. package/dist/wrappers/next.js.map +1 -1
  46. package/dist/wrappers/nuxt.cjs +4171 -0
  47. package/dist/wrappers/nuxt.cjs.map +1 -0
  48. package/dist/wrappers/nuxt.d.cts +33 -0
  49. package/dist/wrappers/nuxt.d.ts +33 -0
  50. package/dist/wrappers/nuxt.js +51 -0
  51. package/dist/wrappers/nuxt.js.map +1 -0
  52. package/dist/wrappers/react.cjs +2336 -141
  53. package/dist/wrappers/react.cjs.map +1 -1
  54. package/dist/wrappers/react.d.cts +87 -1
  55. package/dist/wrappers/react.d.ts +87 -1
  56. package/dist/wrappers/react.js +21 -51
  57. package/dist/wrappers/react.js.map +1 -1
  58. package/dist/wrappers/vue.cjs +4163 -0
  59. package/dist/wrappers/vue.cjs.map +1 -0
  60. package/dist/wrappers/vue.d.cts +144 -0
  61. package/dist/wrappers/vue.d.ts +144 -0
  62. package/dist/wrappers/vue.js +28 -0
  63. package/dist/wrappers/vue.js.map +1 -0
  64. package/dist/wrappers/wordpress.js +1 -1
  65. package/package.json +26 -5
  66. package/schema.json +143 -4
  67. package/dist/chunk-DDAAVRWG.js +0 -25
  68. package/dist/chunk-FBRP4MSA.js +0 -1907
  69. package/dist/chunk-FBRP4MSA.js.map +0 -1
  70. package/dist/consent-engine-DOMyEKfk.d.cts +0 -193
  71. package/dist/consent-engine-DOMyEKfk.d.ts +0 -193
  72. /package/dist/{chunk-DDAAVRWG.js.map → chunk-Q3FZFXQE.js.map} +0 -0
@@ -1,4 +1,90 @@
1
+ import { L as LegalPolicyOptions } from '../types--kyI7OOR.cjs';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * React hook to reactively subscribe to a consent category.
6
+ *
7
+ * @param category - Category ID (e.g. 'analytics', 'marketing')
8
+ * @returns boolean indicating if the category is allowed
9
+ */
1
10
  declare function useConsent(category: string): boolean;
11
+ /**
12
+ * React hook to reactively subscribe to a specific service.
13
+ *
14
+ * @param serviceId - Service ID (e.g. 'ga4', 'youtube')
15
+ * @returns boolean indicating if the service is allowed
16
+ */
2
17
  declare function useConsentService(serviceId: string): boolean;
18
+ /**
19
+ * React hook to reactively subscribe to the cookie consent library's active locale.
20
+ */
21
+ declare function useConsentLocale(): string;
22
+ /**
23
+ * Zero-boilerplate React hook to synchronize parent application i18n state
24
+ * (such as react-i18next i18n.language or next-intl locale) with the consent library.
25
+ */
26
+ declare function useSyncConsentLocale(locale?: string): void;
27
+ /**
28
+ * React hook to check if Global Privacy Control (GPC) or Do Not Track (DNT) signal is active.
29
+ */
30
+ declare function useGpc(): boolean;
31
+ interface ConsentGateFallbackContext {
32
+ category?: string;
33
+ service?: string;
34
+ openPreferences: () => void;
35
+ }
36
+ interface ConsentGateProps {
37
+ category?: string;
38
+ service?: string;
39
+ fallback?: ReactNode | ((context: ConsentGateFallbackContext) => ReactNode);
40
+ children?: ReactNode;
41
+ }
42
+ /**
43
+ * Declarative React Component to conditionally render content/media based on consent status.
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * <ConsentGate
48
+ * category="marketing"
49
+ * fallback={(
50
+ * <div className="consent-placeholder">
51
+ * <p>Este vídeo requiere cookies de marketing para reproducirse.</p>
52
+ * <button onClick={() => Consent.openPreferences()}>Configurar permisos</button>
53
+ * </div>
54
+ * )}
55
+ * >
56
+ * <iframe src="https://www.youtube.com/embed/xyz" />
57
+ * </ConsentGate>
58
+ * ```
59
+ */
60
+ declare function ConsentGate({ category, service, fallback, children, }: ConsentGateProps): any;
61
+ interface CookiePolicyProps {
62
+ view?: "full" | "table-only" | "summary";
63
+ options?: LegalPolicyOptions;
64
+ className?: string;
65
+ style?: any;
66
+ }
67
+ /**
68
+ * Declarative React component that renders the full Cookie Policy document or cookie inventory table.
69
+ */
70
+ declare function CookiePolicy({ view, options, className, style, }: CookiePolicyProps): any;
71
+ interface LegalNoticeProps {
72
+ options?: LegalPolicyOptions;
73
+ className?: string;
74
+ style?: any;
75
+ }
76
+ /**
77
+ * Declarative React component that renders the Legal Notice (Aviso Legal LSSI-CE art. 10).
78
+ */
79
+ declare function LegalNotice({ options, className, style }: LegalNoticeProps): any;
80
+ interface PrivacyPolicyProps {
81
+ options?: LegalPolicyOptions;
82
+ className?: string;
83
+ style?: any;
84
+ }
85
+ /**
86
+ * Declarative React component that renders the GDPR Privacy Policy document.
87
+ */
88
+ declare function PrivacyPolicy({ options, className, style }: PrivacyPolicyProps): any;
3
89
 
4
- export { useConsent, useConsentService };
90
+ export { ConsentGate, type ConsentGateFallbackContext, type ConsentGateProps, CookiePolicy, type CookiePolicyProps, LegalNotice, type LegalNoticeProps, PrivacyPolicy, type PrivacyPolicyProps, useConsent, useConsentLocale, useConsentService, useGpc, useSyncConsentLocale };
@@ -1,4 +1,90 @@
1
+ import { L as LegalPolicyOptions } from '../types--kyI7OOR.js';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * React hook to reactively subscribe to a consent category.
6
+ *
7
+ * @param category - Category ID (e.g. 'analytics', 'marketing')
8
+ * @returns boolean indicating if the category is allowed
9
+ */
1
10
  declare function useConsent(category: string): boolean;
11
+ /**
12
+ * React hook to reactively subscribe to a specific service.
13
+ *
14
+ * @param serviceId - Service ID (e.g. 'ga4', 'youtube')
15
+ * @returns boolean indicating if the service is allowed
16
+ */
2
17
  declare function useConsentService(serviceId: string): boolean;
18
+ /**
19
+ * React hook to reactively subscribe to the cookie consent library's active locale.
20
+ */
21
+ declare function useConsentLocale(): string;
22
+ /**
23
+ * Zero-boilerplate React hook to synchronize parent application i18n state
24
+ * (such as react-i18next i18n.language or next-intl locale) with the consent library.
25
+ */
26
+ declare function useSyncConsentLocale(locale?: string): void;
27
+ /**
28
+ * React hook to check if Global Privacy Control (GPC) or Do Not Track (DNT) signal is active.
29
+ */
30
+ declare function useGpc(): boolean;
31
+ interface ConsentGateFallbackContext {
32
+ category?: string;
33
+ service?: string;
34
+ openPreferences: () => void;
35
+ }
36
+ interface ConsentGateProps {
37
+ category?: string;
38
+ service?: string;
39
+ fallback?: ReactNode | ((context: ConsentGateFallbackContext) => ReactNode);
40
+ children?: ReactNode;
41
+ }
42
+ /**
43
+ * Declarative React Component to conditionally render content/media based on consent status.
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * <ConsentGate
48
+ * category="marketing"
49
+ * fallback={(
50
+ * <div className="consent-placeholder">
51
+ * <p>Este vídeo requiere cookies de marketing para reproducirse.</p>
52
+ * <button onClick={() => Consent.openPreferences()}>Configurar permisos</button>
53
+ * </div>
54
+ * )}
55
+ * >
56
+ * <iframe src="https://www.youtube.com/embed/xyz" />
57
+ * </ConsentGate>
58
+ * ```
59
+ */
60
+ declare function ConsentGate({ category, service, fallback, children, }: ConsentGateProps): any;
61
+ interface CookiePolicyProps {
62
+ view?: "full" | "table-only" | "summary";
63
+ options?: LegalPolicyOptions;
64
+ className?: string;
65
+ style?: any;
66
+ }
67
+ /**
68
+ * Declarative React component that renders the full Cookie Policy document or cookie inventory table.
69
+ */
70
+ declare function CookiePolicy({ view, options, className, style, }: CookiePolicyProps): any;
71
+ interface LegalNoticeProps {
72
+ options?: LegalPolicyOptions;
73
+ className?: string;
74
+ style?: any;
75
+ }
76
+ /**
77
+ * Declarative React component that renders the Legal Notice (Aviso Legal LSSI-CE art. 10).
78
+ */
79
+ declare function LegalNotice({ options, className, style }: LegalNoticeProps): any;
80
+ interface PrivacyPolicyProps {
81
+ options?: LegalPolicyOptions;
82
+ className?: string;
83
+ style?: any;
84
+ }
85
+ /**
86
+ * Declarative React component that renders the GDPR Privacy Policy document.
87
+ */
88
+ declare function PrivacyPolicy({ options, className, style }: PrivacyPolicyProps): any;
3
89
 
4
- export { useConsent, useConsentService };
90
+ export { ConsentGate, type ConsentGateFallbackContext, type ConsentGateProps, CookiePolicy, type CookiePolicyProps, LegalNotice, type LegalNoticeProps, PrivacyPolicy, type PrivacyPolicyProps, useConsent, useConsentLocale, useConsentService, useGpc, useSyncConsentLocale };
@@ -1,56 +1,26 @@
1
1
  import {
2
- Consent
3
- } from "../chunk-FBRP4MSA.js";
4
- import "../chunk-DDAAVRWG.js";
5
-
6
- // src/wrappers/react.ts
7
- import { useEffect, useState } from "react";
8
- function useConsent(category) {
9
- const [allowed, setAllowed] = useState(() => Consent.has(category));
10
- useEffect(() => {
11
- const update = () => {
12
- setAllowed(Consent.has(category));
13
- };
14
- update();
15
- const unsub1 = Consent.on("consent:changed", update);
16
- const unsub2 = Consent.on("consent:accepted", update);
17
- const unsub3 = Consent.on("consent:rejected", update);
18
- const unsub4 = Consent.on("consent:withdrawn", update);
19
- const unsub5 = Consent.on("ready", update);
20
- return () => {
21
- unsub1();
22
- unsub2();
23
- unsub3();
24
- unsub4();
25
- unsub5();
26
- };
27
- }, [category]);
28
- return allowed;
29
- }
30
- function useConsentService(serviceId) {
31
- const [allowed, setAllowed] = useState(() => Consent.hasService(serviceId));
32
- useEffect(() => {
33
- const update = () => {
34
- setAllowed(Consent.hasService(serviceId));
35
- };
36
- update();
37
- const unsub1 = Consent.on("consent:changed", update);
38
- const unsub2 = Consent.on("consent:accepted", update);
39
- const unsub3 = Consent.on("consent:rejected", update);
40
- const unsub4 = Consent.on("consent:withdrawn", update);
41
- const unsub5 = Consent.on("ready", update);
42
- return () => {
43
- unsub1();
44
- unsub2();
45
- unsub3();
46
- unsub4();
47
- unsub5();
48
- };
49
- }, [serviceId]);
50
- return allowed;
51
- }
2
+ ConsentGate,
3
+ CookiePolicy,
4
+ LegalNotice,
5
+ PrivacyPolicy,
6
+ useConsent,
7
+ useConsentLocale,
8
+ useConsentService,
9
+ useGpc,
10
+ useSyncConsentLocale
11
+ } from "../chunk-UQU54ANZ.js";
12
+ import "../chunk-C5QPXHTH.js";
13
+ import "../chunk-OHOHIAK6.js";
14
+ import "../chunk-Q3FZFXQE.js";
52
15
  export {
16
+ ConsentGate,
17
+ CookiePolicy,
18
+ LegalNotice,
19
+ PrivacyPolicy,
53
20
  useConsent,
54
- useConsentService
21
+ useConsentLocale,
22
+ useConsentService,
23
+ useGpc,
24
+ useSyncConsentLocale
55
25
  };
56
26
  //# sourceMappingURL=react.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/wrappers/react.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Consent } from \"../core/consent-engine.js\";\n\nexport function useConsent(category: string): boolean {\n const [allowed, setAllowed] = useState<boolean>(() => Consent.has(category));\n\n useEffect(() => {\n const update = () => {\n setAllowed(Consent.has(category));\n };\n\n update();\n\n const unsub1 = Consent.on(\"consent:changed\", update);\n const unsub2 = Consent.on(\"consent:accepted\", update);\n const unsub3 = Consent.on(\"consent:rejected\", update);\n const unsub4 = Consent.on(\"consent:withdrawn\", update);\n const unsub5 = Consent.on(\"ready\", update);\n\n return () => {\n unsub1();\n unsub2();\n unsub3();\n unsub4();\n unsub5();\n };\n }, [category]);\n\n return allowed;\n}\n\nexport function useConsentService(serviceId: string): boolean {\n const [allowed, setAllowed] = useState<boolean>(() => Consent.hasService(serviceId));\n\n useEffect(() => {\n const update = () => {\n setAllowed(Consent.hasService(serviceId));\n };\n\n update();\n\n const unsub1 = Consent.on(\"consent:changed\", update);\n const unsub2 = Consent.on(\"consent:accepted\", update);\n const unsub3 = Consent.on(\"consent:rejected\", update);\n const unsub4 = Consent.on(\"consent:withdrawn\", update);\n const unsub5 = Consent.on(\"ready\", update);\n\n return () => {\n unsub1();\n unsub2();\n unsub3();\n unsub4();\n unsub5();\n };\n }, [serviceId]);\n\n return allowed;\n}\n"],"mappings":";;;;;;AAAA,SAAS,WAAW,gBAAgB;AAG7B,SAAS,WAAW,UAA2B;AACpD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB,MAAM,QAAQ,IAAI,QAAQ,CAAC;AAE3E,YAAU,MAAM;AACd,UAAM,SAAS,MAAM;AACnB,iBAAW,QAAQ,IA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