@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
@@ -0,0 +1,225 @@
1
+ import {
2
+ Consent
3
+ } from "./chunk-C5QPXHTH.js";
4
+ import {
5
+ __spreadProps,
6
+ __spreadValues
7
+ } from "./chunk-Q3FZFXQE.js";
8
+
9
+ // src/wrappers/react.ts
10
+ import { useEffect, useState } from "react";
11
+ function useConsent(category) {
12
+ try {
13
+ const [allowed, setAllowed] = useState(() => Consent.has(category));
14
+ useEffect(() => {
15
+ const update = () => {
16
+ setAllowed(Consent.has(category));
17
+ };
18
+ update();
19
+ const unsub1 = Consent.on("consent:changed", update);
20
+ const unsub2 = Consent.on("consent:accepted", update);
21
+ const unsub3 = Consent.on("consent:rejected", update);
22
+ const unsub4 = Consent.on("consent:withdrawn", update);
23
+ const unsub5 = Consent.on("ready", update);
24
+ return () => {
25
+ unsub1();
26
+ unsub2();
27
+ unsub3();
28
+ unsub4();
29
+ unsub5();
30
+ };
31
+ }, [category]);
32
+ return allowed;
33
+ } catch (e) {
34
+ return Consent.has(category);
35
+ }
36
+ }
37
+ function useConsentService(serviceId) {
38
+ try {
39
+ const [allowed, setAllowed] = useState(() => Consent.hasService(serviceId));
40
+ useEffect(() => {
41
+ const update = () => {
42
+ setAllowed(Consent.hasService(serviceId));
43
+ };
44
+ update();
45
+ const unsub1 = Consent.on("consent:changed", update);
46
+ const unsub2 = Consent.on("consent:accepted", update);
47
+ const unsub3 = Consent.on("consent:rejected", update);
48
+ const unsub4 = Consent.on("consent:withdrawn", update);
49
+ const unsub5 = Consent.on("ready", update);
50
+ return () => {
51
+ unsub1();
52
+ unsub2();
53
+ unsub3();
54
+ unsub4();
55
+ unsub5();
56
+ };
57
+ }, [serviceId]);
58
+ return allowed;
59
+ } catch (e) {
60
+ return Consent.hasService(serviceId);
61
+ }
62
+ }
63
+ function useConsentLocale() {
64
+ try {
65
+ const [locale, setLocale] = useState(() => Consent.getLocale());
66
+ useEffect(() => {
67
+ const update = () => setLocale(Consent.getLocale());
68
+ update();
69
+ const unsub = Consent.on("locale:changed", (detail) => {
70
+ setLocale(detail.locale);
71
+ });
72
+ return () => unsub();
73
+ }, []);
74
+ return locale;
75
+ } catch (e) {
76
+ return Consent.getLocale();
77
+ }
78
+ }
79
+ function useSyncConsentLocale(locale) {
80
+ try {
81
+ useEffect(() => {
82
+ if (locale) {
83
+ Consent.syncLocale(locale);
84
+ }
85
+ }, [locale]);
86
+ } catch (e) {
87
+ if (locale) {
88
+ Consent.syncLocale(locale);
89
+ }
90
+ }
91
+ }
92
+ function useGpc() {
93
+ try {
94
+ const [isGpc] = useState(() => Consent.isGpcActive());
95
+ return isGpc;
96
+ } catch (e) {
97
+ return Consent.isGpcActive();
98
+ }
99
+ }
100
+ function ConsentGate({
101
+ category,
102
+ service,
103
+ fallback = null,
104
+ children
105
+ }) {
106
+ const isCategoryAllowed = category ? useConsent(category) : true;
107
+ const isServiceAllowed = service ? useConsentService(service) : true;
108
+ const isAllowed = category ? isCategoryAllowed : service ? isServiceAllowed : true;
109
+ if (isAllowed) {
110
+ return children != null ? children : null;
111
+ }
112
+ if (typeof fallback === "function") {
113
+ return fallback({
114
+ category,
115
+ service,
116
+ openPreferences: () => Consent.openPreferences()
117
+ });
118
+ }
119
+ return fallback;
120
+ }
121
+ function CookiePolicy({
122
+ view = "full",
123
+ options,
124
+ className,
125
+ style
126
+ }) {
127
+ try {
128
+ const [html, setHtml] = useState("");
129
+ const locale = useConsentLocale();
130
+ useEffect(() => {
131
+ void Consent.ready().then(() => {
132
+ try {
133
+ const rendered = Consent.renderPolicyHtml(__spreadProps(__spreadValues({}, options), { view, locale: (options == null ? void 0 : options.locale) || locale }));
134
+ setHtml(rendered);
135
+ } catch (e) {
136
+ setHtml("");
137
+ }
138
+ });
139
+ }, [view, locale, JSON.stringify(options)]);
140
+ return html ? {
141
+ $$typeof: Symbol.for("react.element"),
142
+ type: "div",
143
+ key: null,
144
+ ref: null,
145
+ props: {
146
+ className,
147
+ style,
148
+ dangerouslySetInnerHTML: { __html: html }
149
+ }
150
+ } : null;
151
+ } catch (e) {
152
+ return null;
153
+ }
154
+ }
155
+ function LegalNotice({ options, className, style }) {
156
+ try {
157
+ const [html, setHtml] = useState("");
158
+ const locale = useConsentLocale();
159
+ useEffect(() => {
160
+ void Consent.ready().then(() => {
161
+ try {
162
+ const rendered = Consent.renderLegalNoticeHtml(__spreadProps(__spreadValues({}, options), { locale: (options == null ? void 0 : options.locale) || locale }));
163
+ setHtml(rendered);
164
+ } catch (e) {
165
+ setHtml("");
166
+ }
167
+ });
168
+ }, [locale, JSON.stringify(options)]);
169
+ return html ? {
170
+ $$typeof: Symbol.for("react.element"),
171
+ type: "div",
172
+ key: null,
173
+ ref: null,
174
+ props: {
175
+ className,
176
+ style,
177
+ dangerouslySetInnerHTML: { __html: html }
178
+ }
179
+ } : null;
180
+ } catch (e) {
181
+ return null;
182
+ }
183
+ }
184
+ function PrivacyPolicy({ options, className, style }) {
185
+ try {
186
+ const [html, setHtml] = useState("");
187
+ const locale = useConsentLocale();
188
+ useEffect(() => {
189
+ void Consent.ready().then(() => {
190
+ try {
191
+ const rendered = Consent.renderPrivacyPolicyHtml(__spreadProps(__spreadValues({}, options), { locale: (options == null ? void 0 : options.locale) || locale }));
192
+ setHtml(rendered);
193
+ } catch (e) {
194
+ setHtml("");
195
+ }
196
+ });
197
+ }, [locale, JSON.stringify(options)]);
198
+ return html ? {
199
+ $$typeof: Symbol.for("react.element"),
200
+ type: "div",
201
+ key: null,
202
+ ref: null,
203
+ props: {
204
+ className,
205
+ style,
206
+ dangerouslySetInnerHTML: { __html: html }
207
+ }
208
+ } : null;
209
+ } catch (e) {
210
+ return null;
211
+ }
212
+ }
213
+
214
+ export {
215
+ useConsent,
216
+ useConsentService,
217
+ useConsentLocale,
218
+ useSyncConsentLocale,
219
+ useGpc,
220
+ ConsentGate,
221
+ CookiePolicy,
222
+ LegalNotice,
223
+ PrivacyPolicy
224
+ };
225
+ //# sourceMappingURL=chunk-UQU54ANZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wrappers/react.ts"],"sourcesContent":["import { useEffect, useState, type ReactNode } from \"react\";\nimport { Consent } from \"../core/consent-engine.js\";\n\n/**\n * React hook to reactively subscribe to a consent category.\n *\n * @param category - Category ID (e.g. 'analytics', 'marketing')\n * @returns boolean indicating if the category is allowed\n */\nexport function useConsent(category: string): boolean {\n try {\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 } catch {\n return Consent.has(category);\n }\n}\n\n/**\n * React hook to reactively subscribe to a specific service.\n *\n * @param serviceId - Service ID (e.g. 'ga4', 'youtube')\n * @returns boolean indicating if the service is allowed\n */\nexport function useConsentService(serviceId: string): boolean {\n try {\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 } catch {\n return Consent.hasService(serviceId);\n }\n}\n\n/**\n * React hook to reactively subscribe to the cookie consent library's active locale.\n */\nexport function useConsentLocale(): string {\n try {\n const [locale, setLocale] = useState<string>(() => Consent.getLocale());\n\n useEffect(() => {\n const update = () => setLocale(Consent.getLocale());\n update();\n const unsub = Consent.on(\"locale:changed\", (detail) => {\n setLocale(detail.locale);\n });\n return () => unsub();\n }, []);\n\n return locale;\n } catch {\n return Consent.getLocale();\n }\n}\n\n/**\n * Zero-boilerplate React hook to synchronize parent application i18n state\n * (such as react-i18next i18n.language or next-intl locale) with the consent library.\n */\nexport function useSyncConsentLocale(locale?: string): void {\n try {\n useEffect(() => {\n if (locale) {\n Consent.syncLocale(locale);\n }\n }, [locale]);\n } catch {\n if (locale) {\n Consent.syncLocale(locale);\n }\n }\n}\n\n/**\n * React hook to check if Global Privacy Control (GPC) or Do Not Track (DNT) signal is active.\n */\nexport function useGpc(): boolean {\n try {\n const [isGpc] = useState<boolean>(() => Consent.isGpcActive());\n return isGpc;\n } catch {\n return Consent.isGpcActive();\n }\n}\n\nexport interface ConsentGateFallbackContext {\n category?: string;\n service?: string;\n openPreferences: () => void;\n}\n\nexport interface ConsentGateProps {\n category?: string;\n service?: string;\n fallback?: ReactNode | ((context: ConsentGateFallbackContext) => ReactNode);\n children?: ReactNode;\n}\n\n/**\n * Declarative React Component to conditionally render content/media based on consent status.\n *\n * @example\n * ```tsx\n * <ConsentGate\n * category=\"marketing\"\n * fallback={(\n * <div className=\"consent-placeholder\">\n * <p>Este vídeo requiere cookies de marketing para reproducirse.</p>\n * <button onClick={() => Consent.openPreferences()}>Configurar permisos</button>\n * </div>\n * )}\n * >\n * <iframe src=\"https://www.youtube.com/embed/xyz\" />\n * </ConsentGate>\n * ```\n */\nexport function ConsentGate({\n category,\n service,\n fallback = null,\n children,\n}: ConsentGateProps): any {\n const isCategoryAllowed = category ? useConsent(category) : true;\n const isServiceAllowed = service ? useConsentService(service) : true;\n const isAllowed = category ? isCategoryAllowed : (service ? isServiceAllowed : true);\n\n if (isAllowed) {\n return children ?? null;\n }\n\n if (typeof fallback === \"function\") {\n return fallback({\n category,\n service,\n openPreferences: () => Consent.openPreferences(),\n });\n }\n\n return fallback;\n}\n\nexport interface CookiePolicyProps {\n view?: \"full\" | \"table-only\" | \"summary\";\n options?: import(\"../core/types.js\").LegalPolicyOptions;\n className?: string;\n style?: any;\n}\n\n/**\n * Declarative React component that renders the full Cookie Policy document or cookie inventory table.\n */\nexport function CookiePolicy({\n view = \"full\",\n options,\n className,\n style,\n}: CookiePolicyProps): any {\n try {\n const [html, setHtml] = useState<string>(\"\");\n const locale = useConsentLocale();\n\n useEffect(() => {\n void Consent.ready().then(() => {\n try {\n const rendered = Consent.renderPolicyHtml({ ...options, view, locale: options?.locale || locale });\n setHtml(rendered);\n } catch {\n setHtml(\"\");\n }\n });\n }, [view, locale, JSON.stringify(options)]);\n\n return html\n ? {\n $$typeof: Symbol.for(\"react.element\"),\n type: \"div\",\n key: null,\n ref: null,\n props: {\n className,\n style,\n dangerouslySetInnerHTML: { __html: html },\n },\n }\n : null;\n } catch {\n return null;\n }\n}\n\nexport interface LegalNoticeProps {\n options?: import(\"../core/types.js\").LegalPolicyOptions;\n className?: string;\n style?: any;\n}\n\n/**\n * Declarative React component that renders the Legal Notice (Aviso Legal LSSI-CE art. 10).\n */\nexport function LegalNotice({ options, className, style }: LegalNoticeProps): any {\n try {\n const [html, setHtml] = useState<string>(\"\");\n const locale = useConsentLocale();\n\n useEffect(() => {\n void Consent.ready().then(() => {\n try {\n const rendered = Consent.renderLegalNoticeHtml({ ...options, locale: options?.locale || locale });\n setHtml(rendered);\n } catch {\n setHtml(\"\");\n }\n });\n }, [locale, JSON.stringify(options)]);\n\n return html\n ? {\n $$typeof: Symbol.for(\"react.element\"),\n type: \"div\",\n key: null,\n ref: null,\n props: {\n className,\n style,\n dangerouslySetInnerHTML: { __html: html },\n },\n }\n : null;\n } catch {\n return null;\n }\n}\n\nexport interface PrivacyPolicyProps {\n options?: import(\"../core/types.js\").LegalPolicyOptions;\n className?: string;\n style?: any;\n}\n\n/**\n * Declarative React component that renders the GDPR Privacy Policy document.\n */\nexport function PrivacyPolicy({ options, className, style }: PrivacyPolicyProps): any {\n try {\n const [html, setHtml] = useState<string>(\"\");\n const locale = useConsentLocale();\n\n useEffect(() => {\n void Consent.ready().then(() => {\n try {\n const rendered = Consent.renderPrivacyPolicyHtml({ ...options, locale: options?.locale || locale });\n setHtml(rendered);\n } catch {\n setHtml(\"\");\n }\n });\n }, [locale, JSON.stringify(options)]);\n\n return html\n ? {\n $$typeof: Symbol.for(\"react.element\"),\n type: \"div\",\n key: null,\n ref: null,\n props: {\n className,\n style,\n dangerouslySetInnerHTML: { __html: html },\n },\n }\n : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,WAAW,gBAAgC;AAS7C,SAAS,WAAW,UAA2B;AACpD,MAAI;AACF,UAAM,CAAC,SAAS,UAAU,IAAI,SAAkB,MAAM,QAAQ,IAAI,QAAQ,CAAC;AAE3E,cAAU,MAAM;AACd,YAAM,SAAS,MAAM;AACnB,mBAAW,QAAQ,IAAI,QAAQ,CAAC;AAAA,MAClC;AAEA,aAAO;AAEP,YAAM,SAAS,QAAQ,GAAG,mBAAmB,MAAM;AACnD,YAAM,SAAS,QAAQ,GAAG,oBAAoB,MAAM;AACpD,YAAM,SAAS,QAAQ,GAAG,oBAAoB,MAAM;AACpD,YAAM,SAAS,QAAQ,GAAG,qBAAqB,MAAM;AACrD,YAAM,SAAS,QAAQ,GAAG,SAAS,MAAM;AAEzC,aAAO,MAAM;AACX,eAAO;AACP,eAAO;AACP,eAAO;AACP,eAAO;AACP,eAAO;AAAA,MACT;AAAA,IACF,GAAG,CAAC,QAAQ,CAAC;AAEb,WAAO;AAAA,EACT,SAAQ;AACN,WAAO,QAAQ,IAAI,QAAQ;AAAA,EAC7B;AACF;AAQO,SAAS,kBAAkB,WAA4B;AAC5D,MAAI;AACF,UAAM,CAAC,SAAS,UAAU,IAAI,SAAkB,MAAM,QAAQ,WAAW,SAAS,CAAC;AAEnF,cAAU,MAAM;AACd,YAAM,SAAS,MAAM;AACnB,mBAAW,QAAQ,WAAW,SAAS,CAAC;AAAA,MAC1C;AAEA,aAAO;AAEP,YAAM,SAAS,QAAQ,GAAG,mBAAmB,MAAM;AACnD,YAAM,SAAS,QAAQ,GAAG,oBAAoB,MAAM;AACpD,YAAM,SAAS,QAAQ,GAAG,oBAAoB,MAAM;AACpD,YAAM,SAAS,QAAQ,GAAG,qBAAqB,MAAM;AACrD,YA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
5
+ __spreadProps,
6
+ __spreadValues
7
+ } from "./chunk-Q3FZFXQE.js";
8
+
9
+ // src/wrappers/vue.ts
10
+ import {
11
+ ref,
12
+ onUnmounted,
13
+ watch,
14
+ isRef,
15
+ defineComponent,
16
+ h,
17
+ getCurrentInstance
18
+ } from "vue";
19
+ function useConsent(category) {
20
+ const getCategory = () => isRef(category) ? category.value : category;
21
+ const allowed = ref(Consent.has(getCategory()));
22
+ const update = () => {
23
+ allowed.value = Consent.has(getCategory());
24
+ };
25
+ const unsubs = [
26
+ Consent.on("consent:changed", update),
27
+ Consent.on("consent:accepted", update),
28
+ Consent.on("consent:rejected", update),
29
+ Consent.on("consent:withdrawn", update),
30
+ Consent.on("ready", update)
31
+ ];
32
+ if (isRef(category)) {
33
+ watch(category, () => {
34
+ update();
35
+ });
36
+ }
37
+ if (getCurrentInstance()) {
38
+ onUnmounted(() => {
39
+ unsubs.forEach((u) => u());
40
+ });
41
+ }
42
+ return allowed;
43
+ }
44
+ function useConsentService(serviceId) {
45
+ const getService = () => isRef(serviceId) ? serviceId.value : serviceId;
46
+ const allowed = ref(Consent.hasService(getService()));
47
+ const update = () => {
48
+ allowed.value = Consent.hasService(getService());
49
+ };
50
+ const unsubs = [
51
+ Consent.on("consent:changed", update),
52
+ Consent.on("consent:accepted", update),
53
+ Consent.on("consent:rejected", update),
54
+ Consent.on("consent:withdrawn", update),
55
+ Consent.on("ready", update)
56
+ ];
57
+ if (isRef(serviceId)) {
58
+ watch(serviceId, () => {
59
+ update();
60
+ });
61
+ }
62
+ if (getCurrentInstance()) {
63
+ onUnmounted(() => {
64
+ unsubs.forEach((u) => u());
65
+ });
66
+ }
67
+ return allowed;
68
+ }
69
+ function useConsentLocale() {
70
+ const locale = ref(Consent.getLocale());
71
+ const update = (detail) => {
72
+ locale.value = (detail == null ? void 0 : detail.locale) || Consent.getLocale();
73
+ };
74
+ const unsub = Consent.on("locale:changed", update);
75
+ if (getCurrentInstance()) {
76
+ onUnmounted(() => {
77
+ unsub();
78
+ });
79
+ }
80
+ return locale;
81
+ }
82
+ function useSyncConsentLocale(locale) {
83
+ const sync = (val) => {
84
+ if (val) {
85
+ Consent.syncLocale(val);
86
+ }
87
+ };
88
+ if (isRef(locale)) {
89
+ watch(
90
+ locale,
91
+ (newVal) => {
92
+ sync(newVal);
93
+ },
94
+ { immediate: true }
95
+ );
96
+ } else if (typeof locale === "function") {
97
+ watch(
98
+ locale,
99
+ (newVal) => {
100
+ sync(newVal);
101
+ },
102
+ { immediate: true }
103
+ );
104
+ } else if (typeof locale === "string") {
105
+ sync(locale);
106
+ }
107
+ }
108
+ function useGpc() {
109
+ return ref(Consent.isGpcActive());
110
+ }
111
+ var ConsentGate = defineComponent({
112
+ name: "ConsentGate",
113
+ props: {
114
+ category: {
115
+ type: String,
116
+ required: false
117
+ },
118
+ service: {
119
+ type: String,
120
+ required: false
121
+ }
122
+ },
123
+ setup(props, { slots }) {
124
+ const isAllowed = ref(false);
125
+ const check = () => {
126
+ if (props.service) {
127
+ isAllowed.value = Consent.hasService(props.service);
128
+ } else if (props.category) {
129
+ isAllowed.value = Consent.has(props.category);
130
+ } else {
131
+ isAllowed.value = true;
132
+ }
133
+ };
134
+ check();
135
+ const unsubs = [
136
+ Consent.on("consent:changed", check),
137
+ Consent.on("consent:accepted", check),
138
+ Consent.on("consent:rejected", check),
139
+ Consent.on("consent:withdrawn", check),
140
+ Consent.on("ready", check)
141
+ ];
142
+ if (getCurrentInstance()) {
143
+ onUnmounted(() => {
144
+ unsubs.forEach((u) => u());
145
+ });
146
+ }
147
+ return () => {
148
+ if (isAllowed.value) {
149
+ return slots.default ? h("div", { class: "consent-gate-allowed" }, slots.default()) : null;
150
+ }
151
+ return slots.fallback ? h("div", { class: "consent-gate-fallback" }, slots.fallback()) : null;
152
+ };
153
+ }
154
+ });
155
+ var CookiePolicy = defineComponent({
156
+ name: "CookiePolicy",
157
+ props: {
158
+ view: {
159
+ type: String,
160
+ default: "full"
161
+ },
162
+ options: {
163
+ type: Object,
164
+ default: () => ({})
165
+ }
166
+ },
167
+ setup(props) {
168
+ const html = ref("");
169
+ const locale = useConsentLocale();
170
+ const render = () => {
171
+ var _a;
172
+ try {
173
+ html.value = Consent.renderPolicyHtml(__spreadProps(__spreadValues({}, props.options), {
174
+ view: props.view,
175
+ locale: ((_a = props.options) == null ? void 0 : _a.locale) || locale.value
176
+ }));
177
+ } catch (e) {
178
+ html.value = "";
179
+ }
180
+ };
181
+ render();
182
+ watch([() => props.view, locale, () => props.options], render, { deep: true });
183
+ Consent.on("ready", render);
184
+ return () => h("div", { class: "solvenza-cookie-policy-container", innerHTML: html.value });
185
+ }
186
+ });
187
+ var LegalNotice = defineComponent({
188
+ name: "LegalNotice",
189
+ props: {
190
+ options: {
191
+ type: Object,
192
+ default: () => ({})
193
+ }
194
+ },
195
+ setup(props) {
196
+ const html = ref("");
197
+ const locale = useConsentLocale();
198
+ const render = () => {
199
+ var _a;
200
+ try {
201
+ html.value = Consent.renderLegalNoticeHtml(__spreadProps(__spreadValues({}, props.options), {
202
+ locale: ((_a = props.options) == null ? void 0 : _a.locale) || locale.value
203
+ }));
204
+ } catch (e) {
205
+ html.value = "";
206
+ }
207
+ };
208
+ render();
209
+ watch([locale, () => props.options], render, { deep: true });
210
+ Consent.on("ready", render);
211
+ return () => h("div", { class: "solvenza-legal-notice-container", innerHTML: html.value });
212
+ }
213
+ });
214
+ var PrivacyPolicy = defineComponent({
215
+ name: "PrivacyPolicy",
216
+ props: {
217
+ options: {
218
+ type: Object,
219
+ default: () => ({})
220
+ }
221
+ },
222
+ setup(props) {
223
+ const html = ref("");
224
+ const locale = useConsentLocale();
225
+ const render = () => {
226
+ var _a;
227
+ try {
228
+ html.value = Consent.renderPrivacyPolicyHtml(__spreadProps(__spreadValues({}, props.options), {
229
+ locale: ((_a = props.options) == null ? void 0 : _a.locale) || locale.value
230
+ }));
231
+ } catch (e) {
232
+ html.value = "";
233
+ }
234
+ };
235
+ render();
236
+ watch([locale, () => props.options], render, { deep: true });
237
+ Consent.on("ready", render);
238
+ return () => h("div", { class: "solvenza-privacy-policy-container", innerHTML: html.value });
239
+ }
240
+ });
241
+ function createConsentPlugin(configOrUrl = "/consent.json") {
242
+ return {
243
+ install(app) {
244
+ if (typeof window !== "undefined") {
245
+ void Consent.init(configOrUrl);
246
+ }
247
+ app.provide("consent", Consent);
248
+ app.config.globalProperties.$consent = Consent;
249
+ app.component("ConsentGate", ConsentGate);
250
+ app.component("CookiePolicy", CookiePolicy);
251
+ app.component("LegalNotice", LegalNotice);
252
+ app.component("PrivacyPolicy", PrivacyPolicy);
253
+ }
254
+ };
255
+ }
256
+
257
+ export {
258
+ useConsent,
259
+ useConsentService,
260
+ useConsentLocale,
261
+ useSyncConsentLocale,
262
+ useGpc,
263
+ ConsentGate,
264
+ CookiePolicy,
265
+ LegalNotice,
266
+ PrivacyPolicy,
267
+ createConsentPlugin
268
+ };
269
+ //# sourceMappingURL=chunk-W5MG56VI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wrappers/vue.ts"],"sourcesContent":["import {\n ref,\n onUnmounted,\n watch,\n isRef,\n defineComponent,\n h,\n getCurrentInstance,\n type App,\n type Plugin,\n type Ref,\n type PropType,\n type VNode,\n} from \"vue\";\nimport { Consent } from \"../core/consent-engine.js\";\nimport type { ConsentConfig } from \"../core/types.js\";\n\n/**\n * Vue 3 Composable to reactively subscribe to a consent category.\n *\n * @param category - Category ID (string or Ref<string>)\n * @returns Ref<boolean> indicating if the category is allowed\n *\n * @example\n * ```ts\n * const isAnalyticsAllowed = useConsent('analytics');\n * ```\n */\nexport function useConsent(category: string | Ref<string>): Ref<boolean> {\n const getCategory = () => (isRef(category) ? category.value : category);\n const allowed = ref<boolean>(Consent.has(getCategory()));\n\n const update = () => {\n allowed.value = Consent.has(getCategory());\n };\n\n const unsubs = [\n Consent.on(\"consent:changed\", update),\n Consent.on(\"consent:accepted\", update),\n Consent.on(\"consent:rejected\", update),\n Consent.on(\"consent:withdrawn\", update),\n Consent.on(\"ready\", update),\n ];\n\n if (isRef(category)) {\n watch(category, () => {\n update();\n });\n }\n\n if (getCurrentInstance()) {\n onUnmounted(() => {\n unsubs.forEach((u) => u());\n });\n }\n\n return allowed;\n}\n\n/**\n * Vue 3 Composable to reactively subscribe to a specific service.\n *\n * @param serviceId - Service ID (string or Ref<string>)\n * @returns Ref<boolean> indicating if the service is allowed\n */\nexport function useConsentService(serviceId: string | Ref<string>): Ref<boolean> {\n const getService = () => (isRef(serviceId) ? serviceId.value : serviceId);\n const allowed = ref<boolean>(Consent.hasService(getService()));\n\n const update = () => {\n allowed.value = Consent.hasService(getService());\n };\n\n const unsubs = [\n Consent.on(\"consent:changed\", update),\n Consent.on(\"consent:accepted\", update),\n Consent.on(\"consent:rejected\", update),\n Consent.on(\"consent:withdrawn\", update),\n Consent.on(\"ready\", update),\n ];\n\n if (isRef(serviceId)) {\n watch(serviceId, () => {\n update();\n });\n }\n\n if (getCurrentInstance()) {\n onUnmounted(() => {\n unsubs.forEach((u) => u());\n });\n }\n\n return allowed;\n}\n\n/**\n * Vue 3 Composable to reactively subscribe to the active consent locale.\n */\nexport function useConsentLocale(): Ref<string> {\n const locale = ref<string>(Consent.getLocale());\n\n const update = (detail?: { locale: string }) => {\n locale.value = detail?.locale || Consent.getLocale();\n };\n\n const unsub = Consent.on(\"locale:changed\", update);\n\n if (getCurrentInstance()) {\n onUnmounted(() => {\n unsub();\n });\n }\n\n return locale;\n}\n\n/**\n * Vue 3 Composable to synchronize parent app locale (e.g. vue-i18n locale)\n * with the cookie consent engine without boilerplate.\n */\nexport function useSyncConsentLocale(\n locale: Ref<string> | (() => string) | string,\n): void {\n const sync = (val: string) => {\n if (val) {\n Consent.syncLocale(val);\n }\n };\n\n if (isRef(locale)) {\n watch(\n locale,\n (newVal) => {\n sync(newVal);\n },\n { immediate: true },\n );\n } else if (typeof locale === \"function\") {\n watch(\n locale,\n (newVal) => {\n sync(newVal);\n },\n { immediate: true },\n );\n } else if (typeof locale === \"string\") {\n sync(locale);\n }\n}\n\n/**\n * Vue 3 Composable to check if Global Privacy Control (GPC) or Do Not Track (DNT) signal is active.\n */\nexport function useGpc(): Ref<boolean> {\n return ref<boolean>(Consent.isGpcActive());\n}\n\n/**\n * Declarative Vue 3 Component to conditionally render content based on consent.\n *\n * @example\n * ```vue\n * <ConsentGate category=\"marketing\">\n * <template #default>\n * <iframe src=\"https://youtube.com/...\" />\n * </template>\n * <template #fallback>\n * <p>Vídeo bloqueado. Acepta cookies de marketing para reproducirlo.</p>\n * </template>\n * </ConsentGate>\n * ```\n */\nexport const ConsentGate = defineComponent({\n name: \"ConsentGate\",\n props: {\n category: {\n type: String as PropType<string>,\n required: false,\n },\n service: {\n type: String as PropType<string>,\n required: false,\n },\n },\n setup(props, { slots }) {\n const isAllowed = ref<boolean>(false);\n\n const check = () => {\n if (props.service) {\n isAllowed.value = Consent.hasService(props.service);\n } else if (props.category) {\n isAllowed.value = Consent.has(props.category);\n } else {\n isAllowed.value = true;\n }\n };\n\n check();\n\n const unsubs = [\n Consent.on(\"consent:changed\", check),\n Consent.on(\"consent:accepted\", check),\n Consent.on(\"consent:rejected\", check),\n Consent.on(\"consent:withdrawn\", check),\n Consent.on(\"ready\", check),\n ];\n\n if (getCurrentInstance()) {\n onUnmounted(() => {\n unsubs.forEach((u) => u());\n });\n }\n\n return (): VNode | null => {\n if (isAllowed.value) {\n return slots.default ? h(\"div\", { class: \"consent-gate-allowed\" }, slots.default()) : null;\n }\n return slots.fallback ? h(\"div\", { class: \"consent-gate-fallback\" }, slots.fallback()) : null;\n };\n },\n});\n\n/**\n * Declarative Vue 3 Component to render Cookie Policy document or cookie inventory table.\n */\nexport const CookiePolicy = defineComponent({\n name: \"CookiePolicy\",\n props: {\n view: {\n type: String as PropType<\"full\" | \"table-only\" | \"summary\">,\n default: \"full\",\n },\n options: {\n type: Object as PropType<import(\"../core/types.js\").LegalPolicyOptions>,\n default: () => ({}),\n },\n },\n setup(props) {\n const html = ref<string>(\"\");\n const locale = useConsentLocale();\n\n const render = () => {\n try {\n html.value = Consent.renderPolicyHtml({\n ...props.options,\n view: props.view,\n locale: props.options?.locale || locale.value,\n });\n } catch {\n html.value = \"\";\n }\n };\n\n render();\n watch([() => props.view, locale, () => props.options], render, { deep: true });\n Consent.on(\"ready\", render);\n\n return (): VNode => h(\"div\", { class: \"solvenza-cookie-policy-container\", innerHTML: html.value });\n },\n});\n\n/**\n * Declarative Vue 3 Component to render Legal Notice (Aviso Legal LSSI-CE art. 10).\n */\nexport const LegalNotice = defineComponent({\n name: \"LegalNotice\",\n props: {\n options: {\n type: Object as PropType<import(\"../core/types.js\").LegalPolicyOptions>,\n default: () => ({}),\n },\n },\n setup(props) {\n const html = ref<string>(\"\");\n const locale = useConsentLocale();\n\n const render = () => {\n try {\n html.value = Consent.renderLegalNoticeHtml({\n ...props.options,\n locale: props.options?.locale || locale.value,\n });\n } catch {\n html.value = \"\";\n }\n };\n\n render();\n watch([locale, () => props.options], render, { deep: true });\n Consent.on(\"ready\", render);\n\n return (): VNode => h(\"div\", { class: \"solvenza-legal-notice-container\", innerHTML: html.value });\n },\n});\n\n/**\n * Declarative Vue 3 Component to render GDPR Privacy Policy document.\n */\nexport const PrivacyPolicy = defineComponent({\n name: \"PrivacyPolicy\",\n props: {\n options: {\n type: Object as PropType<import(\"../core/types.js\").LegalPolicyOptions>,\n default: () => ({}),\n },\n },\n setup(props) {\n const html = ref<string>(\"\");\n const locale = useConsentLocale();\n\n const render = () => {\n try {\n html.value = Consent.renderPrivacyPolicyHtml({\n ...props.options,\n locale: props.options?.locale || locale.value,\n });\n } catch {\n html.value = \"\";\n }\n };\n\n render();\n watch([locale, () => props.options], render, { deep: true });\n Consent.on(\"ready\", render);\n\n return (): VNode => h(\"div\", { class: \"solvenza-privacy-policy-container\", innerHTML: html.value });\n },\n});\n\n/**\n * Vue 3 Plugin factory for Solvenza Cookies Compliance.\n *\n * @example\n * ```ts\n * import { createApp } from 'vue';\n * import { createConsentPlugin } from '@solvenza/cookies-compliance/vue';\n * import App from './App.vue';\n *\n * const app = createApp(App);\n * app.use(createConsentPlugin('/consent.json'));\n * app.mount('#app');\n * ```\n */\nexport function createConsentPlugin(\n configOrUrl: string | ConsentConfig = \"/consent.json\",\n): Plugin {\n return {\n install(app: App) {\n if (typeof window !== \"undefined\") {\n void Consent.init(configOrUrl);\n }\n\n app.provide(\"consent\", Consent);\n app.config.globalProperties.$consent = Consent;\n app.component(\"ConsentGate\", ConsentGate);\n app.component(\"CookiePolicy\", CookiePolicy);\n app.component(\"LegalNotice\", LegalNotice);\n app.component(\"PrivacyPolicy\", PrivacyPolicy);\n },\n };\n}\n"],"mappings":";;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AAeA,SAAS,WAAW,UAA8C;AACvE,QAAM,cAAc,MAAO,MAAM,QAAQ,IAAI,SAAS,QAAQ;AAC9D,QAAM,UAAU,IAAa,QAAQ,IAAI,YAAY,CAAC,CAAC;AAEvD,QAAM,SAAS,MAAM;AACnB,YAAQ,QAAQ,QAAQ,IAAI,YAAY,CAAC;AAAA,EAC3C;AAEA,QAAM,SAAS;AAAA,IACb,QAAQ,GAAG,mBAAmB,MAAM;AAAA,IACpC,QAAQ,GAAG,oBAAoB,MAAM;AAAA,IACrC,QAAQ,GAAG,oBAAoB,MAAM;AAAA,IACrC,QAAQ,GAAG,qBAAqB,MAAM;AAAA,IACtC,QAAQ,GAAG,SAAS,MAAM;AAAA,EAC5B;AAEA,MAAI,MAAM,QAAQ,GAAG;AACnB,UAAM,UAAU,MAAM;AACpB,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,MAAI,mBAAmB,GAAG;AACxB,gBAAY,MAAM;AAChB,aAAO,QAAQ,CAAC,MAAM,EAAE,CAAC;AAAA,IAC3B,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAQO,SAAS,kBAAkB,WAA+C;AAC/E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