@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,12 +1,24 @@
1
- import { a as ConsentConfig, j as ConsentState, b as ConsentChoices, d as Consent } from '../consent-engine-DOMyEKfk.cjs';
1
+ import { OnInit, OnDestroy, TemplateRef, ViewContainerRef, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { C as ConsentConfig, b as ConsentState, c as ConsentChoices, S as StoragePurgeReport, d as ConsentEvent, e as ConsentEventHandler, L as LegalPolicyOptions } from '../types--kyI7OOR.cjs';
2
3
 
3
4
  /**
4
- * Angular Consent Service helper.
5
- * Compatible with AOT and JIT Angular applications.
5
+ * Angular Consent Service injectable helper.
6
+ * Compatible with standalone, NgModule, AOT, and SSR Angular applications.
6
7
  */
7
8
  declare class ConsentService {
8
9
  init(config: ConsentConfig | string): Promise<void>;
9
10
  getConsent(): ConsentState;
11
+ getLocale(): string;
12
+ setLocale(locale: string): void;
13
+ /**
14
+ * Synchronize parent Angular application i18n state (@ngx-translate, Transloco, or custom)
15
+ * with the cookie compliance engine without boilerplate.
16
+ */
17
+ syncLocale(locale: string): void;
18
+ /**
19
+ * Check if Global Privacy Control (GPC) signal is active.
20
+ */
21
+ isGpcActive(): boolean;
10
22
  has(category: string): boolean;
11
23
  hasService(serviceId: string): boolean;
12
24
  acceptAll(): void;
@@ -14,7 +26,75 @@ declare class ConsentService {
14
26
  setPreferences(choices: ConsentChoices): void;
15
27
  openPreferences(): void;
16
28
  withdraw(): void;
17
- on(event: Parameters<typeof Consent.on>[0], handler: Parameters<typeof Consent.on>[1]): () => void;
29
+ purgeCategory(category: string): StoragePurgeReport;
30
+ purgeStorage(categoryOrService?: string): StoragePurgeReport[];
31
+ on<E extends ConsentEvent>(event: E, handler: ConsentEventHandler<E>): () => void;
32
+ renderPolicyHtml(options?: LegalPolicyOptions): string;
33
+ renderLegalNoticeHtml(options?: LegalPolicyOptions): string;
34
+ renderPrivacyPolicyHtml(options?: LegalPolicyOptions): string;
35
+ }
36
+ /**
37
+ * Angular Structural Directive to conditionally render elements based on consent.
38
+ *
39
+ * @example
40
+ * ```html
41
+ * <!-- Render video only if marketing consent is granted -->
42
+ * <div *consentGate="'marketing'; else videoBlocked">
43
+ * <iframe src="https://www.youtube.com/embed/..." />
44
+ * </div>
45
+ *
46
+ * <ng-template #videoBlocked>
47
+ * <div class="blocked-alert">
48
+ * <p>Este vídeo requiere cookies de marketing.</p>
49
+ * <button (click)="openPreferences()">Configurar cookies</button>
50
+ * </div>
51
+ * </ng-template>
52
+ * ```
53
+ */
54
+ declare class ConsentGateDirective implements OnInit, OnDestroy {
55
+ private templateRef;
56
+ private viewContainer;
57
+ category?: string;
58
+ service?: string;
59
+ elseTemplate?: TemplateRef<any>;
60
+ private hasView;
61
+ private hasElseView;
62
+ private unsubs;
63
+ constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef);
64
+ ngOnInit(): void;
65
+ ngOnDestroy(): void;
66
+ private updateView;
67
+ }
68
+ /**
69
+ * Angular Standalone Component to render Cookie Policy document or cookie inventory table.
70
+ */
71
+ declare class CookiePolicyComponent implements OnInit, OnChanges {
72
+ view: "full" | "table-only" | "summary";
73
+ options?: LegalPolicyOptions;
74
+ renderedHtml: string;
75
+ ngOnInit(): void;
76
+ ngOnChanges(_changes: SimpleChanges): void;
77
+ private render;
78
+ }
79
+ /**
80
+ * Angular Standalone Component to render Legal Notice (Aviso Legal LSSI-CE art. 10).
81
+ */
82
+ declare class LegalNoticeComponent implements OnInit, OnChanges {
83
+ options?: LegalPolicyOptions;
84
+ renderedHtml: string;
85
+ ngOnInit(): void;
86
+ ngOnChanges(_changes: SimpleChanges): void;
87
+ private render;
88
+ }
89
+ /**
90
+ * Angular Standalone Component to render GDPR Privacy Policy document.
91
+ */
92
+ declare class PrivacyPolicyComponent implements OnInit, OnChanges {
93
+ options?: LegalPolicyOptions;
94
+ renderedHtml: string;
95
+ ngOnInit(): void;
96
+ ngOnChanges(_changes: SimpleChanges): void;
97
+ private render;
18
98
  }
19
99
 
20
- export { ConsentService };
100
+ export { ConsentGateDirective, ConsentService, CookiePolicyComponent, LegalNoticeComponent, PrivacyPolicyComponent };
@@ -1,12 +1,24 @@
1
- import { a as ConsentConfig, j as ConsentState, b as ConsentChoices, d as Consent } from '../consent-engine-DOMyEKfk.js';
1
+ import { OnInit, OnDestroy, TemplateRef, ViewContainerRef, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { C as ConsentConfig, b as ConsentState, c as ConsentChoices, S as StoragePurgeReport, d as ConsentEvent, e as ConsentEventHandler, L as LegalPolicyOptions } from '../types--kyI7OOR.js';
2
3
 
3
4
  /**
4
- * Angular Consent Service helper.
5
- * Compatible with AOT and JIT Angular applications.
5
+ * Angular Consent Service injectable helper.
6
+ * Compatible with standalone, NgModule, AOT, and SSR Angular applications.
6
7
  */
7
8
  declare class ConsentService {
8
9
  init(config: ConsentConfig | string): Promise<void>;
9
10
  getConsent(): ConsentState;
11
+ getLocale(): string;
12
+ setLocale(locale: string): void;
13
+ /**
14
+ * Synchronize parent Angular application i18n state (@ngx-translate, Transloco, or custom)
15
+ * with the cookie compliance engine without boilerplate.
16
+ */
17
+ syncLocale(locale: string): void;
18
+ /**
19
+ * Check if Global Privacy Control (GPC) signal is active.
20
+ */
21
+ isGpcActive(): boolean;
10
22
  has(category: string): boolean;
11
23
  hasService(serviceId: string): boolean;
12
24
  acceptAll(): void;
@@ -14,7 +26,75 @@ declare class ConsentService {
14
26
  setPreferences(choices: ConsentChoices): void;
15
27
  openPreferences(): void;
16
28
  withdraw(): void;
17
- on(event: Parameters<typeof Consent.on>[0], handler: Parameters<typeof Consent.on>[1]): () => void;
29
+ purgeCategory(category: string): StoragePurgeReport;
30
+ purgeStorage(categoryOrService?: string): StoragePurgeReport[];
31
+ on<E extends ConsentEvent>(event: E, handler: ConsentEventHandler<E>): () => void;
32
+ renderPolicyHtml(options?: LegalPolicyOptions): string;
33
+ renderLegalNoticeHtml(options?: LegalPolicyOptions): string;
34
+ renderPrivacyPolicyHtml(options?: LegalPolicyOptions): string;
35
+ }
36
+ /**
37
+ * Angular Structural Directive to conditionally render elements based on consent.
38
+ *
39
+ * @example
40
+ * ```html
41
+ * <!-- Render video only if marketing consent is granted -->
42
+ * <div *consentGate="'marketing'; else videoBlocked">
43
+ * <iframe src="https://www.youtube.com/embed/..." />
44
+ * </div>
45
+ *
46
+ * <ng-template #videoBlocked>
47
+ * <div class="blocked-alert">
48
+ * <p>Este vídeo requiere cookies de marketing.</p>
49
+ * <button (click)="openPreferences()">Configurar cookies</button>
50
+ * </div>
51
+ * </ng-template>
52
+ * ```
53
+ */
54
+ declare class ConsentGateDirective implements OnInit, OnDestroy {
55
+ private templateRef;
56
+ private viewContainer;
57
+ category?: string;
58
+ service?: string;
59
+ elseTemplate?: TemplateRef<any>;
60
+ private hasView;
61
+ private hasElseView;
62
+ private unsubs;
63
+ constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef);
64
+ ngOnInit(): void;
65
+ ngOnDestroy(): void;
66
+ private updateView;
67
+ }
68
+ /**
69
+ * Angular Standalone Component to render Cookie Policy document or cookie inventory table.
70
+ */
71
+ declare class CookiePolicyComponent implements OnInit, OnChanges {
72
+ view: "full" | "table-only" | "summary";
73
+ options?: LegalPolicyOptions;
74
+ renderedHtml: string;
75
+ ngOnInit(): void;
76
+ ngOnChanges(_changes: SimpleChanges): void;
77
+ private render;
78
+ }
79
+ /**
80
+ * Angular Standalone Component to render Legal Notice (Aviso Legal LSSI-CE art. 10).
81
+ */
82
+ declare class LegalNoticeComponent implements OnInit, OnChanges {
83
+ options?: LegalPolicyOptions;
84
+ renderedHtml: string;
85
+ ngOnInit(): void;
86
+ ngOnChanges(_changes: SimpleChanges): void;
87
+ private render;
88
+ }
89
+ /**
90
+ * Angular Standalone Component to render GDPR Privacy Policy document.
91
+ */
92
+ declare class PrivacyPolicyComponent implements OnInit, OnChanges {
93
+ options?: LegalPolicyOptions;
94
+ renderedHtml: string;
95
+ ngOnInit(): void;
96
+ ngOnChanges(_changes: SimpleChanges): void;
97
+ private render;
18
98
  }
19
99
 
20
- export { ConsentService };
100
+ export { ConsentGateDirective, ConsentService, CookiePolicyComponent, LegalNoticeComponent, PrivacyPolicyComponent };
@@ -1,9 +1,26 @@
1
1
  import {
2
2
  Consent
3
- } from "../chunk-FBRP4MSA.js";
4
- import "../chunk-DDAAVRWG.js";
3
+ } from "../chunk-C5QPXHTH.js";
4
+ import "../chunk-OHOHIAK6.js";
5
+ import {
6
+ __decorateElement,
7
+ __decoratorStart,
8
+ __runInitializers,
9
+ __spreadProps,
10
+ __spreadValues
11
+ } from "../chunk-Q3FZFXQE.js";
5
12
 
6
13
  // src/wrappers/angular.ts
14
+ import {
15
+ Directive,
16
+ Component,
17
+ Input,
18
+ Injectable
19
+ } from "@angular/core";
20
+ var _ConsentService_decorators, _init;
21
+ _ConsentService_decorators = [Injectable({
22
+ providedIn: "root"
23
+ })];
7
24
  var ConsentService = class {
8
25
  async init(config) {
9
26
  return Consent.init(config);
@@ -11,6 +28,25 @@ var ConsentService = class {
11
28
  getConsent() {
12
29
  return Consent.getConsent();
13
30
  }
31
+ getLocale() {
32
+ return Consent.getLocale();
33
+ }
34
+ setLocale(locale) {
35
+ Consent.setLocale(locale);
36
+ }
37
+ /**
38
+ * Synchronize parent Angular application i18n state (@ngx-translate, Transloco, or custom)
39
+ * with the cookie compliance engine without boilerplate.
40
+ */
41
+ syncLocale(locale) {
42
+ Consent.syncLocale(locale);
43
+ }
44
+ /**
45
+ * Check if Global Privacy Control (GPC) signal is active.
46
+ */
47
+ isGpcActive() {
48
+ return Consent.isGpcActive();
49
+ }
14
50
  has(category) {
15
51
  return Consent.has(category);
16
52
  }
@@ -32,11 +68,189 @@ var ConsentService = class {
32
68
  withdraw() {
33
69
  Consent.withdraw();
34
70
  }
71
+ purgeCategory(category) {
72
+ return Consent.purgeCategory(category);
73
+ }
74
+ purgeStorage(categoryOrService) {
75
+ return Consent.purgeStorage(categoryOrService);
76
+ }
35
77
  on(event, handler) {
36
78
  return Consent.on(event, handler);
37
79
  }
80
+ renderPolicyHtml(options) {
81
+ return Consent.renderPolicyHtml(options);
82
+ }
83
+ renderLegalNoticeHtml(options) {
84
+ return Consent.renderLegalNoticeHtml(options);
85
+ }
86
+ renderPrivacyPolicyHtml(options) {
87
+ return Consent.renderPrivacyPolicyHtml(options);
88
+ }
89
+ };
90
+ _init = __decoratorStart(null);
91
+ ConsentService = __decorateElement(_init, 0, "ConsentService", _ConsentService_decorators, ConsentService);
92
+ __runInitializers(_init, 1, ConsentService);
93
+ var _elseTemplate_dec, _service_dec, _category_dec, _ConsentGateDirective_decorators, _init2;
94
+ _ConsentGateDirective_decorators = [Directive({
95
+ selector: "[consentGate]",
96
+ standalone: true
97
+ })], _category_dec = [Input("consentGate")], _service_dec = [Input("consentGateService")], _elseTemplate_dec = [Input("consentGateElse")];
98
+ var ConsentGateDirective = class {
99
+ constructor(templateRef, viewContainer) {
100
+ this.templateRef = templateRef;
101
+ this.viewContainer = viewContainer;
102
+ this.hasView = false;
103
+ this.hasElseView = false;
104
+ this.unsubs = [];
105
+ }
106
+ ngOnInit() {
107
+ const update = () => this.updateView();
108
+ update();
109
+ this.unsubs = [
110
+ Consent.on("consent:changed", update),
111
+ Consent.on("consent:accepted", update),
112
+ Consent.on("consent:rejected", update),
113
+ Consent.on("consent:withdrawn", update),
114
+ Consent.on("ready", update)
115
+ ];
116
+ }
117
+ ngOnDestroy() {
118
+ this.unsubs.forEach((u) => u());
119
+ }
120
+ updateView() {
121
+ const isAllowed = this.category ? Consent.has(this.category) : this.service ? Consent.hasService(this.service) : true;
122
+ if (isAllowed) {
123
+ if (!this.hasView) {
124
+ this.viewContainer.clear();
125
+ this.viewContainer.createEmbeddedView(this.templateRef);
126
+ this.hasView = true;
127
+ this.hasElseView = false;
128
+ }
129
+ } else {
130
+ if (this.hasView || !this.hasElseView && this.elseTemplate) {
131
+ this.viewContainer.clear();
132
+ this.hasView = false;
133
+ if (this.elseTemplate) {
134
+ this.viewContainer.createEmbeddedView(this.elseTemplate);
135
+ this.hasElseView = true;
136
+ }
137
+ }
138
+ }
139
+ }
140
+ };
141
+ _init2 = __decoratorStart(null);
142
+ __decorateElement(_init2, 5, "category", _category_dec, ConsentGateDirective);
143
+ __decorateElement(_init2, 5, "service", _service_dec, ConsentGateDirective);
144
+ __decorateElement(_init2, 5, "elseTemplate", _elseTemplate_dec, ConsentGateDirective);
145
+ ConsentGateDirective = __decorateElement(_init2, 0, "ConsentGateDirective", _ConsentGateDirective_decorators, ConsentGateDirective);
146
+ __runInitializers(_init2, 1, ConsentGateDirective);
147
+ var _options_dec, _view_dec, _CookiePolicyComponent_decorators, _init3;
148
+ _CookiePolicyComponent_decorators = [Component({
149
+ selector: "solvenza-cookie-policy",
150
+ standalone: true,
151
+ template: `<div [innerHTML]="renderedHtml"></div>`
152
+ })], _view_dec = [Input()], _options_dec = [Input()];
153
+ var CookiePolicyComponent = class {
154
+ constructor() {
155
+ this.view = __runInitializers(_init3, 8, this, "full"), __runInitializers(_init3, 11, this);
156
+ this.renderedHtml = "";
157
+ }
158
+ ngOnInit() {
159
+ this.render();
160
+ Consent.on("ready", () => this.render());
161
+ Consent.on("locale:changed", () => this.render());
162
+ }
163
+ ngOnChanges(_changes) {
164
+ this.render();
165
+ }
166
+ render() {
167
+ var _a;
168
+ try {
169
+ this.renderedHtml = Consent.renderPolicyHtml(__spreadProps(__spreadValues({}, this.options), {
170
+ view: this.view,
171
+ locale: ((_a = this.options) == null ? void 0 : _a.locale) || Consent.getLocale()
172
+ }));
173
+ } catch (e) {
174
+ this.renderedHtml = "";
175
+ }
176
+ }
177
+ };
178
+ _init3 = __decoratorStart(null);
179
+ __decorateElement(_init3, 5, "view", _view_dec, CookiePolicyComponent);
180
+ __decorateElement(_init3, 5, "options", _options_dec, CookiePolicyComponent);
181
+ CookiePolicyComponent = __decorateElement(_init3, 0, "CookiePolicyComponent", _CookiePolicyComponent_decorators, CookiePolicyComponent);
182
+ __runInitializers(_init3, 1, CookiePolicyComponent);
183
+ var _options_dec2, _LegalNoticeComponent_decorators, _init4;
184
+ _LegalNoticeComponent_decorators = [Component({
185
+ selector: "solvenza-legal-notice",
186
+ standalone: true,
187
+ template: `<div [innerHTML]="renderedHtml"></div>`
188
+ })], _options_dec2 = [Input()];
189
+ var LegalNoticeComponent = class {
190
+ constructor() {
191
+ this.renderedHtml = "";
192
+ }
193
+ ngOnInit() {
194
+ this.render();
195
+ Consent.on("ready", () => this.render());
196
+ Consent.on("locale:changed", () => this.render());
197
+ }
198
+ ngOnChanges(_changes) {
199
+ this.render();
200
+ }
201
+ render() {
202
+ var _a;
203
+ try {
204
+ this.renderedHtml = Consent.renderLegalNoticeHtml(__spreadProps(__spreadValues({}, this.options), {
205
+ locale: ((_a = this.options) == null ? void 0 : _a.locale) || Consent.getLocale()
206
+ }));
207
+ } catch (e) {
208
+ this.renderedHtml = "";
209
+ }
210
+ }
211
+ };
212
+ _init4 = __decoratorStart(null);
213
+ __decorateElement(_init4, 5, "options", _options_dec2, LegalNoticeComponent);
214
+ LegalNoticeComponent = __decorateElement(_init4, 0, "LegalNoticeComponent", _LegalNoticeComponent_decorators, LegalNoticeComponent);
215
+ __runInitializers(_init4, 1, LegalNoticeComponent);
216
+ var _options_dec3, _PrivacyPolicyComponent_decorators, _init5;
217
+ _PrivacyPolicyComponent_decorators = [Component({
218
+ selector: "solvenza-privacy-policy",
219
+ standalone: true,
220
+ template: `<div [innerHTML]="renderedHtml"></div>`
221
+ })], _options_dec3 = [Input()];
222
+ var PrivacyPolicyComponent = class {
223
+ constructor() {
224
+ this.renderedHtml = "";
225
+ }
226
+ ngOnInit() {
227
+ this.render();
228
+ Consent.on("ready", () => this.render());
229
+ Consent.on("locale:changed", () => this.render());
230
+ }
231
+ ngOnChanges(_changes) {
232
+ this.render();
233
+ }
234
+ render() {
235
+ var _a;
236
+ try {
237
+ this.renderedHtml = Consent.renderPrivacyPolicyHtml(__spreadProps(__spreadValues({}, this.options), {
238
+ locale: ((_a = this.options) == null ? void 0 : _a.locale) || Consent.getLocale()
239
+ }));
240
+ } catch (e) {
241
+ this.renderedHtml = "";
242
+ }
243
+ }
38
244
  };
245
+ _init5 = __decoratorStart(null);
246
+ __decorateElement(_init5, 5, "options", _options_dec3, PrivacyPolicyComponent);
247
+ PrivacyPolicyComponent = __decorateElement(_init5, 0, "PrivacyPolicyComponent", _PrivacyPolicyComponent_decorators, PrivacyPolicyComponent);
248
+ __runInitializers(_init5, 1, PrivacyPolicyComponent);
39
249
  export {
40
- ConsentService
250
+ ConsentGateDirective,
251
+ ConsentService,
252
+ CookiePolicyComponent,
253
+ LegalNoticeComponent,
254
+ PrivacyPolicyComponent
41
255
  };
42
256
  //# sourceMappingURL=angular.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/wrappers/angular.ts"],"sourcesContent":["import { Consent } from \"../core/consent-engine.js\";\nimport type { ConsentChoices, ConsentConfig, ConsentState } from \"../core/types.js\";\n\n/**\n * Angular Consent Service helper.\n * Compatible with AOT and JIT Angular applications.\n */\nexport class ConsentService {\n async init(config: ConsentConfig | string): Promise<void> {\n return Consent.init(config);\n }\n\n getConsent(): ConsentState {\n return Consent.getConsent();\n }\n\n has(category: string): boolean {\n return Consent.has(category);\n }\n\n hasService(serviceId: string): boolean {\n return Consent.hasService(serviceId);\n }\n\n acceptAll(): void {\n Consent.acceptAll();\n }\n\n rejectAll(): void {\n Consent.rejectAll();\n }\n\n setPreferences(choices: ConsentChoices): void {\n Consent.setPreferences(choices);\n }\n\n openPreferences(): void {\n Consent.openPreferences();\n }\n\n withdraw(): void {\n Consent.withdraw();\n }\n\n on(event: Parameters<typeof Consent.on>[0], handler: Parameters<typeof Consent.on>[1]) {\n return Consent.on(event, handler);\n }\n}\n"],"mappings":";;;;;;AAOO,IAAM,iBAAN,MAAqB;AAAA,EAC1B,MAAM,KAAK,QAA+C;AACxD,WAAO,QAAQ,KAAK,MAAM;AAAA,EAC5B;AAAA,EAEA,aAA2B;AACzB,WAAO,QAAQ,WAAW;AAAA,EAC5B;AAAA,EAEA,IAAI,UAA2B;AAC7B,WAAO,QAAQ,IAAI,QAAQ;AAAA,EAC7B;AAAA,EAEA,WAAW,WAA4B;AACrC,WAAO,QAAQ,WAAW,SAAS;AAAA,EACrC;AAAA,EAEA,YAAkB;AAChB,YAAQ,UAAU;AAAA,EACpB;AAAA,EAEA,YAAkB;AAChB,YAAQ,UAAU;AAAA,EACpB;AAAA,EAEA,eAAe,SAA+B;AAC5C,YAAQ,eAAe,OAAO;AAAA,EAChC;AAAA,EAEA,kBAAwB;AACtB,YAAQ,gBAAgB;AAAA,EAC1B;AAAA,EAEA,WAAiB;AACf,YAAQ,SAAS;AAAA,EACnB;AAAA,EAEA,GAAG,OAAyC,SAA2C;AACrF,WAAO,QAAQ,GAAG,OAAO,OAAO;AAAA,EAClC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/wrappers/angular.ts"],"sourcesContent":["import {\n Directive,\n Component,\n Input,\n TemplateRef,\n ViewContainerRef,\n OnInit,\n OnDestroy,\n OnChanges,\n SimpleChanges,\n Injectable,\n} from \"@angular/core\";\nimport { Consent } from \"../core/consent-engine.js\";\nimport type {\n ConsentChoices,\n ConsentConfig,\n ConsentEvent,\n ConsentEventHandler,\n ConsentState,\n LegalPolicyOptions,\n StoragePurgeReport,\n} from \"../core/types.js\";\n\n/**\n * Angular Consent Service injectable helper.\n * Compatible with standalone, NgModule, AOT, and SSR Angular applications.\n */\n@Injectable({\n providedIn: \"root\",\n})\nexport class ConsentService {\n async init(config: ConsentConfig | string): Promise<void> {\n return Consent.init(config);\n }\n\n getConsent(): ConsentState {\n return Consent.getConsent();\n }\n\n getLocale(): string {\n return Consent.getLocale();\n }\n\n setLocale(locale: string): void {\n Consent.setLocale(locale);\n }\n\n /**\n * Synchronize parent Angular application i18n state (@ngx-translate, Transloco, or custom)\n * with the cookie compliance engine without boilerplate.\n */\n syncLocale(locale: string): void {\n Consent.syncLocale(locale);\n }\n\n /**\n * Check if Global Privacy Control (GPC) signal is active.\n */\n isGpcActive(): boolean {\n return Consent.isGpcActive();\n }\n\n has(category: string): boolean {\n return Consent.has(category);\n }\n\n hasService(serviceId: string): boolean {\n return Consent.hasService(serviceId);\n }\n\n acceptAll(): void {\n Consent.acceptAll();\n }\n\n rejectAll(): void {\n Consent.rejectAll();\n }\n\n setPreferences(choices: ConsentChoices): void {\n Consent.setPreferences(choices);\n }\n\n openPreferences(): void {\n Consent.openPreferences();\n }\n\n withdraw(): void {\n Consent.withdraw();\n }\n\n purgeCategory(category: string): StoragePurgeReport {\n return Consent.purgeCategory(category);\n }\n\n purgeStorage(categoryOrService?: string): StoragePurgeReport[] {\n return Consent.purgeStorage(categoryOrService);\n }\n\n on<E extends ConsentEvent>(event: E, handler: ConsentEventHandler<E>): () => void {\n return Consent.on(event, handler);\n }\n\n renderPolicyHtml(options?: LegalPolicyOptions): string {\n return Consent.renderPolicyHtml(options);\n }\n\n renderLegalNoticeHtml(options?: LegalPolicyOptions): string {\n return Consent.renderLegalNoticeHtml(options);\n }\n\n renderPrivacyPolicyHtml(options?: LegalPolicyOptions): string {\n return Consent.renderPrivacyPolicyHtml(options);\n }\n}\n\n/**\n * Angular Structural Directive to conditionally render elements based on consent.\n *\n * @example\n * ```html\n * <!-- Render video only if marketing consent is granted -->\n * <div *consentGate=\"'marketing'; else videoBlocked\">\n * <iframe src=\"https://www.youtube.com/embed/...\" />\n * </div>\n *\n * <ng-template #videoBlocked>\n * <div class=\"blocked-alert\">\n * <p>Este vídeo requiere cookies de marketing.</p>\n * <button (click)=\"openPreferences()\">Configurar cookies</button>\n * </div>\n * </ng-template>\n * ```\n */\n@Directive({\n selector: \"[consentGate]\",\n standalone: true,\n})\nexport class ConsentGateDirective implements OnInit, OnDestroy {\n @Input(\"consentGate\") category?: string;\n @Input(\"consentGateService\") service?: string;\n @Input(\"consentGateElse\") elseTemplate?: TemplateRef<any>;\n\n private hasView = false;\n private hasElseView = false;\n private unsubs: Array<() => void> = [];\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n ) {}\n\n ngOnInit(): void {\n const update = () => this.updateView();\n update();\n\n this.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\n ngOnDestroy(): void {\n this.unsubs.forEach((u) => u());\n }\n\n private updateView(): void {\n const isAllowed = this.category\n ? Consent.has(this.category)\n : this.service\n ? Consent.hasService(this.service)\n : true;\n\n if (isAllowed) {\n if (!this.hasView) {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView = true;\n this.hasElseView = false;\n }\n } else {\n if (this.hasView || (!this.hasElseView && this.elseTemplate)) {\n this.viewContainer.clear();\n this.hasView = false;\n if (this.elseTemplate) {\n this.viewContainer.createEmbeddedView(this.elseTemplate);\n this.hasElseView = true;\n }\n }\n }\n }\n}\n\n/**\n * Angular Standalone Component to render Cookie Policy document or cookie inventory table.\n */\n@Component({\n selector: \"solvenza-cookie-policy\",\n standalone: true,\n template: `<div [innerHTML]=\"renderedHtml\"></div>`,\n})\nexport class CookiePolicyComponent implements OnInit, OnChanges {\n @Input() view: \"full\" | \"table-only\" | \"summary\" = \"full\";\n @Input() options?: LegalPolicyOptions;\n\n renderedHtml = \"\";\n\n ngOnInit(): void {\n this.render();\n Consent.on(\"ready\", () => this.render());\n Consent.on(\"locale:changed\", () => this.render());\n }\n\n ngOnChanges(_changes: SimpleChanges): void {\n this.render();\n }\n\n private render(): void {\n try {\n this.renderedHtml = Consent.renderPolicyHtml({\n ...this.options,\n view: this.view,\n locale: this.options?.locale || Consent.getLocale(),\n });\n } catch {\n this.renderedHtml = \"\";\n }\n }\n}\n\n/**\n * Angular Standalone Component to render Legal Notice (Aviso Legal LSSI-CE art. 10).\n */\n@Component({\n selector: \"solvenza-legal-notice\",\n standalone: true,\n template: `<div [innerHTML]=\"renderedHtml\"></div>`,\n})\nexport class LegalNoticeComponent implements OnInit, OnChanges {\n @Input() options?: LegalPolicyOptions;\n\n renderedHtml = \"\";\n\n ngOnInit(): void {\n this.render();\n Consent.on(\"ready\", () => this.render());\n Consent.on(\"locale:changed\", () => this.render());\n }\n\n ngOnChanges(_changes: SimpleChanges): void {\n this.render();\n }\n\n private render(): void {\n try {\n this.renderedHtml = Consent.renderLegalNoticeHtml({\n ...this.options,\n locale: this.options?.locale || Consent.getLocale(),\n });\n } catch {\n this.renderedHtml = \"\";\n }\n }\n}\n\n/**\n * Angular Standalone Component to render GDPR Privacy Policy document.\n */\n@Component({\n selector: \"solvenza-privacy-policy\",\n standalone: true,\n template: `<div [innerHTML]=\"renderedHtml\"></div>`,\n})\nexport class PrivacyPolicyComponent implements OnInit, OnChanges {\n @Input() options?: LegalPolicyOptions;\n\n renderedHtml = \"\";\n\n ngOnInit(): void {\n this.render();\n Consent.on(\"ready\", () => this.render());\n Consent.on(\"locale:changed\", () => this.render());\n }\n\n ngOnChanges(_changes: SimpleChanges): void {\n this.render();\n }\n\n private render(): void {\n try {\n this.renderedHtml = Consent.renderPrivacyPolicyHtml({\n ...this.options,\n locale: this.options?.locale || Consent.getLocale(),\n });\n } catch {\n this.renderedHtml = \"\";\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAOA;AAAA,OACK;AAXP;AA2BA,8BAAC,WAAW;AAAA,EACV,YAAY;AACd,CAAC;AACM,IAAM,iBAAN,MAAqB;AAAA,EAC1B,MAAM,KAAK,QAA+C;AACxD,WAAO,QAAQ,KAAK,MAAM;AAAA,EAC5B;AAAA,EAEA,aAA2B;AACzB,WAAO,QAAQ,WAAW;AAAA,EAC5B;AAAA,EAEA,YAAoB;AAClB,WAAO,QAAQ,UAAU;AAAA,EAC3B;AAAA,EAEA,UAAU,QAAsB;AAC9B,YAAQ,UAAU,MAAM;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAW,QAAsB;AAC/B,YAAQ,WAAW,MAAM;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKA,cAAuB;AACrB,WAAO,QAAQ,YAAY;AAAA,EAC7B;AAAA,EAEA,IAAI,UAA2B;AAC7B,WAAO,QAAQ,IAAI,QAAQ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