@onemrvapublic/design-system 22.6.0 → 22.7.0-develop.1

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/README.md CHANGED
@@ -33,23 +33,13 @@ If you need access to our design system board, send us a message.
33
33
  @Bram Decuypere (NL / EN)
34
34
  ## Changelog
35
35
 
36
- ### 22.6.0
36
+ ### 22.7.0-develop.1
37
37
 
38
- # [22.6.0](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/compare/v22.5.0...v22.6.0) (2026-10-06)
39
-
40
-
41
- ### Bug Fixes
42
-
43
- * **mat-navigation:** align sidenav item indentation with figma spec ([fdce73f](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/fdce73f451d2a813eb2822faa19014ed8ecfade3))
44
- * colors change alignment with figma - FINAL ([4c38f26](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/4c38f26dfa436216a4c14eee1a7ba0b5ebe7ce7a))
45
- * **table:** entrypoint table demo not functional ([2d5007f](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/2d5007ffd724931ea4fd77f45dac3bf216ed5ad7))
46
- * **mcp-server:** point the local stdio entry at the built dist/index.js ([79f739d](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/79f739d9a404bc10c001f6ea4b8c77dbe64c5a2a))
47
- * **button:** spacing outlined button ([3982d39](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/3982d396e35133f764d6cae63c5d11836c49eb72))
48
- * **paginator:** visual improvement ([dcdf45a](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/dcdf45ab4d06b771d3e53e48e5cc96c2dd762829))
49
- * **table:** weird spacing requirements ([fe0f894](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/fe0f89414054f858244d810d1c69b32d904e6f9d))
38
+ # [22.7.0-develop.1](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/compare/v22.6.0...v22.7.0-develop.1) (2026-10-08)
50
39
 
51
40
 
52
41
  ### Features
53
42
 
54
- * **mcp-server:** add Claude Code as an IDE setup target ([50e0b96](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/50e0b9688124e4f02c45903e1eaec2b7619859ce))
43
+ * **cookie-consent:** add orejime cookie consent entry point ([4b0aecd](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/4b0aecd80ba5b857811bebb00657a401598a5c2c))
44
+ * **cookie-consent:** improve layout spacing ([37110e5](https://rvaonem.ghe.com/AS-DESIGN-SYSTEM/core/commit/37110e5456745a7e78149280a7351585c304551d))
55
45
 
@@ -166,5 +166,57 @@
166
166
  "length": "Falsche Anzahl von Ziffern für dieses Land",
167
167
  "wrong-iban-checksum": "Die Bankkontonummer ist ungültig",
168
168
  "invalid": "Feld erforderlich"
169
+ },
170
+ "cookieConsent": {
171
+ "privacyPolicyLabel": "Cookie-Richtlinie",
172
+ "preferences": "Cookie-Einstellungen",
173
+ "banner": {
174
+ "title": "Unsere Website verwendet Cookies",
175
+ "description": "Einige Cookies sind für das ordnungsgemäße Funktionieren des Tools unerlässlich; Sie können sie nicht ablehnen. Andere Cookies sind optional: Sie ermöglichen es uns, die Nutzung des Dienstes zu messen und Ihr Feedback zu sammeln, um den Dienst zu verbessern. Sie können sie ablehnen, ohne dass dies Ihren Zugang zum Dienst beeinträchtigt, und Ihre Auswahl jederzeit über Cookie-Einstellungen am Seitenende ändern. Weitere Informationen finden Sie in unserer {privacyPolicy}.",
176
+ "accept": "Alle Cookies akzeptieren",
177
+ "decline": "Optionale Cookies ablehnen",
178
+ "configure": "Konfigurieren",
179
+ "acceptTitle": "Alle Cookies akzeptieren",
180
+ "declineTitle": "Optionale Cookies ablehnen",
181
+ "configureTitle": "Cookies konfigurieren"
182
+ },
183
+ "modal": {
184
+ "title": "Unsere Website verwendet Cookies",
185
+ "description": "Was ist ein Cookie? Welche Cookies verwenden wir und warum? Weitere Informationen finden Sie in unserer {privacyPolicy}.",
186
+ "close": "Schließen",
187
+ "closeTitle": "Einstellungen schließen",
188
+ "globalPreferences": "Einstellungen für alle Cookies",
189
+ "acceptAll": "Optionale Cookies akzeptieren",
190
+ "declineAll": "Optionale Cookies ablehnen",
191
+ "save": "Meine Auswahl bestätigen",
192
+ "saveTitle": "Meine Einstellungen zu den erfassten Daten speichern"
193
+ },
194
+ "contextual": {
195
+ "title": "\"{purpose}\" ist inaktiv",
196
+ "description": "Erlauben Sie Cookies, um diese Funktion zu nutzen.",
197
+ "accept": "Erlauben",
198
+ "accepted": "\"{purpose}\" ist jetzt erlaubt."
199
+ },
200
+ "purpose": {
201
+ "mandatory": "(immer aktiv)",
202
+ "mandatoryTitle": "Diese Cookies sind immer erforderlich",
203
+ "enabled": "aktiviert",
204
+ "disabled": "deaktiviert",
205
+ "exempt": "Opt-out",
206
+ "exemptTitle": "Diese Cookies sind standardmäßig aktiv (Sie können sie aber deaktivieren)",
207
+ "showMore": "Mehr Details anzeigen",
208
+ "accept": "Akzeptieren",
209
+ "decline": "Ablehnen",
210
+ "partial": "teilweise",
211
+ "essential": {
212
+ "title": "Essenzielle Cookies",
213
+ "description": "Wir verwenden Cookies, die für einen reibungslosen Betrieb der Website technisch notwendig sind. Sie werden automatisch gesetzt, sobald Sie die Website besuchen, und können nicht abgelehnt werden. Wir sind verpflichtet, sie für Sie aufzulisten."
214
+ }
215
+ },
216
+ "misc": {
217
+ "newWindowTitle": "neues Fenster",
218
+ "updateNeeded": "Seit Ihrem letzten Besuch gab es Änderungen. Bitte aktualisieren Sie Ihre Einwilligung.",
219
+ "poweredBy": "Bereitgestellt von Orejime"
220
+ }
169
221
  }
170
222
  }
@@ -168,5 +168,57 @@
168
168
  "length": "Incorrect number of digits for this country",
169
169
  "wrong-iban-checksum": "Bank account number invalid",
170
170
  "invalid": "Field required"
171
+ },
172
+ "cookieConsent": {
173
+ "privacyPolicyLabel": "cookie policy",
174
+ "preferences": "Cookie settings",
175
+ "banner": {
176
+ "title": "We use cookies",
177
+ "description": "Some cookies are essential for the tool to work properly; you cannot refuse them. Others are optional: they allow us to measure how the service is used and to collect your feedback to improve it. You can refuse them without affecting your access to the service, and change your choice at any time via Cookie settings at the bottom of the page. Read our {privacyPolicy} to learn more.",
178
+ "accept": "Accept all cookies",
179
+ "decline": "Decline optional cookies",
180
+ "configure": "Configure",
181
+ "acceptTitle": "Accept all cookies",
182
+ "declineTitle": "Decline optional cookies",
183
+ "configureTitle": "Configure cookies"
184
+ },
185
+ "modal": {
186
+ "title": "We use cookies",
187
+ "description": "What is a cookie? Which cookies do we use and why? Read more in our {privacyPolicy}.",
188
+ "close": "Close",
189
+ "closeTitle": "Close preferences",
190
+ "globalPreferences": "Preferences for all cookies",
191
+ "acceptAll": "Accept optional cookies",
192
+ "declineAll": "Decline optional cookies",
193
+ "save": "Confirm my choice",
194
+ "saveTitle": "Save my configuration on collected information"
195
+ },
196
+ "contextual": {
197
+ "title": "\"{purpose}\" is inactive",
198
+ "description": "Allow cookies to access this functionality.",
199
+ "accept": "Allow",
200
+ "accepted": "\"{purpose}\" is now allowed."
201
+ },
202
+ "purpose": {
203
+ "mandatory": "(always active)",
204
+ "mandatoryTitle": "These cookies are always required",
205
+ "enabled": "enabled",
206
+ "disabled": "disabled",
207
+ "exempt": "opt-out",
208
+ "exemptTitle": "These cookies are enabled by default (but you can turn them off)",
209
+ "showMore": "Show more details",
210
+ "accept": "Accept",
211
+ "decline": "Decline",
212
+ "partial": "partial",
213
+ "essential": {
214
+ "title": "Essential cookies",
215
+ "description": "We use cookies that are technically necessary for the site to work properly. They are set automatically as soon as you arrive and cannot be refused. We are required to list them for you."
216
+ }
217
+ },
218
+ "misc": {
219
+ "newWindowTitle": "new window",
220
+ "updateNeeded": "There were changes since your last visit, please update your consent.",
221
+ "poweredBy": "Powered by Orejime"
222
+ }
171
223
  }
172
224
  }
@@ -166,5 +166,57 @@
166
166
  "length": "Nombre de chiffres incorrect pour ce pays",
167
167
  "wrong-iban-checksum": "Le numéro de compte bancaire est invalide",
168
168
  "invalid": "Champ requis"
169
+ },
170
+ "cookieConsent": {
171
+ "privacyPolicyLabel": "politique d'utilisation des cookies",
172
+ "preferences": "Paramètres cookies",
173
+ "banner": {
174
+ "title": "Nous utilisons des cookies",
175
+ "description": "Certains cookies sont indispensables au bon fonctionnement de l'outil ; vous ne pouvez pas les refuser. D'autres sont facultatifs : ils nous permettent de mesurer l'utilisation du service et de recueillir votre avis pour l'améliorer. Vous pouvez les refuser sans que cela affecte votre accès au service, et modifier votre choix à tout moment via Paramètres cookies en bas de page. Consultez notre {privacyPolicy} pour en savoir plus.",
176
+ "accept": "Accepter tous les cookies",
177
+ "decline": "Refuser les cookies optionnels",
178
+ "configure": "Configurer",
179
+ "acceptTitle": "Accepter tous les cookies",
180
+ "declineTitle": "Refuser les cookies optionnels",
181
+ "configureTitle": "Configurer les cookies"
182
+ },
183
+ "modal": {
184
+ "title": "Nous utilisons des cookies",
185
+ "description": "Qu'est-ce qu'un cookie ? Quels cookies utilisons-nous et pourquoi ? Lisez-en plus dans notre {privacyPolicy}.",
186
+ "close": "Fermer",
187
+ "closeTitle": "Fermer les préférences",
188
+ "globalPreferences": "Préférences pour tous les cookies",
189
+ "acceptAll": "Accepter les cookies optionnels",
190
+ "declineAll": "Refuser les cookies optionnels",
191
+ "save": "Confirmer mon choix",
192
+ "saveTitle": "Sauvegarder ma configuration sur les informations collectées"
193
+ },
194
+ "contextual": {
195
+ "title": "\"{purpose}\" est désactivé",
196
+ "description": "Autorisez le dépôt de cookies pour accéder à cette fonctionnalité.",
197
+ "accept": "Autoriser",
198
+ "accepted": "\"{purpose}\" est maintenant autorisé."
199
+ },
200
+ "purpose": {
201
+ "mandatory": "(toujours actifs)",
202
+ "mandatoryTitle": "Ces cookies sont toujours requis",
203
+ "enabled": "activé",
204
+ "disabled": "désactivé",
205
+ "exempt": "opt-out",
206
+ "exemptTitle": "Ces cookies sont activés par défaut (mais vous pouvez les désactiver)",
207
+ "showMore": "Voir plus de détails",
208
+ "accept": "Accepter",
209
+ "decline": "Refuser",
210
+ "partial": "partiel",
211
+ "essential": {
212
+ "title": "Cookies essentiels",
213
+ "description": "Nous utilisons des cookies techniquement nécessaires au bon fonctionnement du site. Ils sont déposés automatiquement dès votre arrivée et ne peuvent pas être refusés. Nous sommes tenus de vous les lister."
214
+ }
215
+ },
216
+ "misc": {
217
+ "newWindowTitle": "nouvelle fenêtre",
218
+ "updateNeeded": "Des modifications ont eu lieu depuis votre dernière visite, merci de mettre à jour votre consentement.",
219
+ "poweredBy": "Propulsé par Orejime"
220
+ }
169
221
  }
170
222
  }
@@ -167,5 +167,57 @@
167
167
  "length": "Onjuist aantal cijfers voor dit land",
168
168
  "wrong-iban-checksum": "Bankrekeningnummer is ongeldig",
169
169
  "invalid": "Veld verplicht"
170
+ },
171
+ "cookieConsent": {
172
+ "privacyPolicyLabel": "cookiebeleid",
173
+ "preferences": "Cookie-instellingen",
174
+ "banner": {
175
+ "title": "Onze site maakt gebruik van cookies",
176
+ "description": "Sommige cookies zijn noodzakelijk voor de goede werking van de tool; u kunt ze niet weigeren. Andere cookies zijn optioneel: ze laten ons toe het gebruik van de dienst te meten en uw feedback te verzamelen om de dienst te verbeteren. U kunt ze weigeren zonder dat dit uw toegang tot de dienst beïnvloedt, en u kunt uw keuze op elk moment wijzigen via Cookie-instellingen onderaan de pagina. Lees ons {privacyPolicy} voor meer informatie.",
177
+ "accept": "Alle cookies aanvaarden",
178
+ "decline": "Optionele cookies weigeren",
179
+ "configure": "Configureren",
180
+ "acceptTitle": "Alle cookies aanvaarden",
181
+ "declineTitle": "Optionele cookies weigeren",
182
+ "configureTitle": "Cookies configureren"
183
+ },
184
+ "modal": {
185
+ "title": "Onze site maakt gebruik van cookies",
186
+ "description": "Wat is een cookie? Welke cookies gebruiken we en waarom? Lees er meer over in ons {privacyPolicy}.",
187
+ "close": "Sluiten",
188
+ "closeTitle": "Voorkeuren sluiten",
189
+ "globalPreferences": "Voorkeuren voor alle cookies",
190
+ "acceptAll": "Optionele cookies aanvaarden",
191
+ "declineAll": "Optionele cookies weigeren",
192
+ "save": "Mijn keuze bevestigen",
193
+ "saveTitle": "Mijn instellingen voor de verzamelde gegevens opslaan"
194
+ },
195
+ "contextual": {
196
+ "title": "\"{purpose}\" is niet actief",
197
+ "description": "Sta cookies toe om deze functionaliteit te gebruiken.",
198
+ "accept": "Toestaan",
199
+ "accepted": "\"{purpose}\" is nu toegestaan."
200
+ },
201
+ "purpose": {
202
+ "mandatory": "(altijd actief)",
203
+ "mandatoryTitle": "Deze cookies zijn altijd vereist",
204
+ "enabled": "geactiveerd",
205
+ "disabled": "gedeactiveerd",
206
+ "exempt": "opt-out",
207
+ "exemptTitle": "Deze cookies zijn standaard actief (maar u kunt ze uitschakelen)",
208
+ "showMore": "Meer details tonen",
209
+ "accept": "Aanvaarden",
210
+ "decline": "Weigeren",
211
+ "partial": "gedeeltelijk",
212
+ "essential": {
213
+ "title": "Essentiële cookies",
214
+ "description": "Wij gebruiken cookies die technisch noodzakelijk zijn voor een vlotte werking van de site. Ze worden automatisch geplaatst zodra u de website bezoekt en kunnen niet geweigerd worden. We zijn verplicht om ze voor u op te lijsten."
215
+ }
216
+ },
217
+ "misc": {
218
+ "newWindowTitle": "nieuw venster",
219
+ "updateNeeded": "Er zijn wijzigingen sinds uw laatste bezoek. Gelieve uw toestemming bij te werken.",
220
+ "poweredBy": "Mogelijk gemaakt door Orejime"
221
+ }
170
222
  }
171
223
  }
@@ -0,0 +1,177 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, makeEnvironmentProviders, inject, DOCUMENT, Injectable } from '@angular/core';
3
+ import { toSignal } from '@angular/core/rxjs-interop';
4
+ import { TranslateService } from '@ngx-translate/core';
5
+ import { BehaviorSubject, map, distinctUntilChanged, firstValueFrom } from 'rxjs';
6
+
7
+ const COOKIE_CONSENT_OPTIONS = new InjectionToken('COOKIE_CONSENT_OPTIONS');
8
+ /**
9
+ * Configures the cookie consent banner. Nothing is shown until
10
+ * `CookieConsentService.init()` is called, so the app decides when
11
+ * (typically after authentication and once translations are loaded).
12
+ */
13
+ function provideCookieConsent(options) {
14
+ return makeEnvironmentProviders([
15
+ { provide: COOKIE_CONSENT_OPTIONS, useValue: options },
16
+ ]);
17
+ }
18
+
19
+ const ESSENTIAL_COOKIE_PURPOSE = 'essential';
20
+ const DEFAULT_PRIVACY_POLICY_URL = 'https://www.onem.be/politique-dutilisation-des-cookies';
21
+ const LABELS_KEY = 'cookieConsent';
22
+ const ESSENTIAL_PURPOSE = {
23
+ id: ESSENTIAL_COOKIE_PURPOSE,
24
+ title: `${LABELS_KEY}.purpose.essential.title`,
25
+ description: `${LABELS_KEY}.purpose.essential.description`,
26
+ isMandatory: true,
27
+ };
28
+ /** Orejime's text sections, as in its `src/translations`. */
29
+ const OREJIME_SECTIONS = ['banner', 'modal', 'contextual', 'purpose', 'misc'];
30
+ /** Sections in which Orejime renders a link to the privacy policy. */
31
+ const PRIVACY_POLICY_SECTIONS = ['banner', 'modal', 'contextual'];
32
+ /**
33
+ * Angular wrapper around Orejime (https://orejime.boscop.fr).
34
+ *
35
+ * Orejime is not bundled: the app loads `orejime/dist/orejime-standard-en.js`
36
+ * and `orejime/dist/orejime-standard.css` through the `scripts` and `styles`
37
+ * of its `angular.json`, which installs the global `loadOrejime()` used here.
38
+ *
39
+ * The orejime-standard-<lang>.js bundles only differ by their default texts,
40
+ * and every text is overridden from the `cookieConsent` translations of the
41
+ * current language, so a single bundle serves every language.
42
+ *
43
+ * Labels are resolved once, in `init()`. Orejime cannot be re-translated in
44
+ * place, so apps that switch language at runtime should reload the page.
45
+ */
46
+ class CookieConsentService {
47
+ constructor() {
48
+ this.options = inject(COOKIE_CONSENT_OPTIONS, { optional: true });
49
+ this.translate = inject(TranslateService);
50
+ this.document = inject(DOCUMENT);
51
+ this.consentsSubject = new BehaviorSubject({});
52
+ /** Consent per purpose id; empty until `init()` has resolved. */
53
+ this.consents = toSignal(this.consentsSubject, { requireSync: true });
54
+ }
55
+ /**
56
+ * Shows the banner if the user has not decided yet, and starts tracking
57
+ * consent. Waits for the current language's translations. Safe to call
58
+ * more than once.
59
+ */
60
+ init() {
61
+ this.initialization ??= this.load();
62
+ return this.initialization;
63
+ }
64
+ /** Emits the consent for one purpose now and on every change. */
65
+ consent$(purposeId) {
66
+ return this.consentsSubject.pipe(map(consents => consents[purposeId] === true), distinctUntilChanged());
67
+ }
68
+ hasConsent(purposeId) {
69
+ return this.consentsSubject.value[purposeId] === true;
70
+ }
71
+ /**
72
+ * Opens the preferences modal, e.g. from a "Cookie settings" footer link.
73
+ * Initializes first if needed, so a misconfiguration surfaces as an error
74
+ * instead of a button that does nothing.
75
+ */
76
+ async openPreferences() {
77
+ await this.init();
78
+ this.instance?.prompt();
79
+ }
80
+ async load() {
81
+ if (!this.options) {
82
+ throw new Error('CookieConsentService: provideCookieConsent() is missing from the application providers.');
83
+ }
84
+ if (!this.options.cookie?.name?.trim()) {
85
+ throw new Error('CookieConsentService: provideCookieConsent() needs a cookie.name specific to the application.');
86
+ }
87
+ const loadOrejime = this.document.defaultView?.loadOrejime;
88
+ if (!loadOrejime) {
89
+ throw new Error('CookieConsentService: loadOrejime() is not defined. Add "node_modules/orejime/dist/orejime-standard-en.js" to the scripts of angular.json.');
90
+ }
91
+ const config = await this.createConfig(this.options);
92
+ const instance = loadOrejime(config);
93
+ this.instance = instance;
94
+ const readConsents = () => Object.fromEntries(config.purposes.map(({ id }) => [id, instance.manager.getConsent(id)]));
95
+ instance.manager.on('update', () => this.consentsSubject.next(readConsents()));
96
+ instance.manager.on('clear', () => this.consentsSubject.next(readConsents()));
97
+ // Seeds from the consent stored by a previous visit.
98
+ this.consentsSubject.next(readConsents());
99
+ }
100
+ async createConfig(options) {
101
+ const purposes = [
102
+ ...(options.essentialPurpose === false ? [] : [ESSENTIAL_PURPOSE]),
103
+ ...options.purposes,
104
+ ];
105
+ const purposeKeys = purposes.flatMap(({ title, description }) => description ? [title, description] : [title]);
106
+ // get() waits for the translation file, unlike instant().
107
+ const [labels, texts] = await Promise.all([
108
+ firstValueFrom(this.translate.get(LABELS_KEY)),
109
+ firstValueFrom(this.translate.get(purposeKeys)),
110
+ ]);
111
+ const language = this.translate.getCurrentLang() ?? this.translate.getFallbackLang() ?? '';
112
+ return {
113
+ privacyPolicyUrl: this.privacyPolicyUrl(options, language),
114
+ purposes: purposes.map(purpose => ({
115
+ ...purpose,
116
+ title: texts[purpose.title],
117
+ description: purpose.description && texts[purpose.description],
118
+ })),
119
+ cookie: options.cookie,
120
+ forceModal: options.forceModal,
121
+ forceBanner: options.forceBanner,
122
+ orejimeElement: options.orejimeElement,
123
+ translations: mergeTranslations(toOrejimeTranslations(typeof labels === 'object' ? labels : {}), options.translations ?? {}),
124
+ };
125
+ }
126
+ privacyPolicyUrl(options, language) {
127
+ const url = options.privacyPolicyUrl;
128
+ if (typeof url === 'string') {
129
+ return url;
130
+ }
131
+ return url?.[language] ?? DEFAULT_PRIVACY_POLICY_URL;
132
+ }
133
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: CookieConsentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
134
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: CookieConsentService, providedIn: 'root' }); }
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: CookieConsentService, decorators: [{
137
+ type: Injectable,
138
+ args: [{
139
+ providedIn: 'root',
140
+ }]
141
+ }] });
142
+ /**
143
+ * Maps the `cookieConsent` labels onto every Orejime text, so the texts
144
+ * follow the ngx-translate language whichever orejime-standard-<lang>.js
145
+ * bundle the app loads.
146
+ */
147
+ function toOrejimeTranslations(labels) {
148
+ const privacyPolicyLabel = labels['privacyPolicyLabel'];
149
+ return Object.fromEntries(OREJIME_SECTIONS.map(section => {
150
+ // Only string labels: purpose texts such as purpose.essential are
151
+ // passed with the purposes themselves.
152
+ const strings = Object.entries(labels[section] ?? {}).filter((entry) => typeof entry[1] === 'string');
153
+ if (typeof privacyPolicyLabel === 'string' &&
154
+ PRIVACY_POLICY_SECTIONS.includes(section)) {
155
+ strings.push(['privacyPolicyLabel', privacyPolicyLabel]);
156
+ }
157
+ return [section, Object.fromEntries(strings)];
158
+ }));
159
+ }
160
+ function mergeTranslations(base, overrides) {
161
+ const merged = { ...base };
162
+ for (const [section, labels] of Object.entries(overrides)) {
163
+ merged[section] = { ...merged[section], ...labels };
164
+ }
165
+ return merged;
166
+ }
167
+
168
+ /*
169
+ * Public API Surface of cookie-consent
170
+ */
171
+
172
+ /**
173
+ * Generated bundle index. Do not edit.
174
+ */
175
+
176
+ export { COOKIE_CONSENT_OPTIONS, CookieConsentService, ESSENTIAL_COOKIE_PURPOSE, provideCookieConsent };
177
+ //# sourceMappingURL=onemrvapublic-design-system-cookie-consent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onemrvapublic-design-system-cookie-consent.mjs","sources":["../../../../projects/onemrva/design-system/cookie-consent/src/cookie-consent.provider.ts","../../../../projects/onemrva/design-system/cookie-consent/src/cookie-consent.service.ts","../../../../projects/onemrva/design-system/cookie-consent/index.ts","../../../../projects/onemrva/design-system/cookie-consent/onemrvapublic-design-system-cookie-consent.ts"],"sourcesContent":["import {\n EnvironmentProviders,\n InjectionToken,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport { CookieConsentOptions } from './cookie-consent.models';\n\nexport const COOKIE_CONSENT_OPTIONS = new InjectionToken<CookieConsentOptions>(\n 'COOKIE_CONSENT_OPTIONS',\n);\n\n/**\n * Configures the cookie consent banner. Nothing is shown until\n * `CookieConsentService.init()` is called, so the app decides when\n * (typically after authentication and once translations are loaded).\n */\nexport function provideCookieConsent(\n options: CookieConsentOptions,\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: COOKIE_CONSENT_OPTIONS, useValue: options },\n ]);\n}\n","import { DOCUMENT, inject, Injectable } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { TranslateService } from '@ngx-translate/core';\nimport {\n BehaviorSubject,\n distinctUntilChanged,\n firstValueFrom,\n map,\n Observable,\n} from 'rxjs';\nimport {\n CookieConsentOptions,\n CookieConsentPurpose,\n LoadOrejime,\n OrejimeConfig,\n OrejimeInstance,\n OrejimeTranslations,\n} from './cookie-consent.models';\nimport { COOKIE_CONSENT_OPTIONS } from './cookie-consent.provider';\n\nexport const ESSENTIAL_COOKIE_PURPOSE = 'essential';\n\nconst DEFAULT_PRIVACY_POLICY_URL =\n 'https://www.onem.be/politique-dutilisation-des-cookies';\n\nconst LABELS_KEY = 'cookieConsent';\n\nconst ESSENTIAL_PURPOSE: CookieConsentPurpose = {\n id: ESSENTIAL_COOKIE_PURPOSE,\n title: `${LABELS_KEY}.purpose.essential.title`,\n description: `${LABELS_KEY}.purpose.essential.description`,\n isMandatory: true,\n};\n\n/** Orejime's text sections, as in its `src/translations`. */\nconst OREJIME_SECTIONS = ['banner', 'modal', 'contextual', 'purpose', 'misc'];\n\n/** Sections in which Orejime renders a link to the privacy policy. */\nconst PRIVACY_POLICY_SECTIONS = ['banner', 'modal', 'contextual'];\n\n/**\n * Angular wrapper around Orejime (https://orejime.boscop.fr).\n *\n * Orejime is not bundled: the app loads `orejime/dist/orejime-standard-en.js`\n * and `orejime/dist/orejime-standard.css` through the `scripts` and `styles`\n * of its `angular.json`, which installs the global `loadOrejime()` used here.\n *\n * The orejime-standard-<lang>.js bundles only differ by their default texts,\n * and every text is overridden from the `cookieConsent` translations of the\n * current language, so a single bundle serves every language.\n *\n * Labels are resolved once, in `init()`. Orejime cannot be re-translated in\n * place, so apps that switch language at runtime should reload the page.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class CookieConsentService {\n private readonly options = inject(COOKIE_CONSENT_OPTIONS, { optional: true });\n private readonly translate = inject(TranslateService);\n private readonly document = inject(DOCUMENT);\n\n private instance?: OrejimeInstance;\n private initialization?: Promise<void>;\n\n private readonly consentsSubject = new BehaviorSubject<\n Record<string, boolean>\n >({});\n\n /** Consent per purpose id; empty until `init()` has resolved. */\n readonly consents = toSignal(this.consentsSubject, { requireSync: true });\n\n /**\n * Shows the banner if the user has not decided yet, and starts tracking\n * consent. Waits for the current language's translations. Safe to call\n * more than once.\n */\n init(): Promise<void> {\n this.initialization ??= this.load();\n return this.initialization;\n }\n\n /** Emits the consent for one purpose now and on every change. */\n consent$(purposeId: string): Observable<boolean> {\n return this.consentsSubject.pipe(\n map(consents => consents[purposeId] === true),\n distinctUntilChanged(),\n );\n }\n\n hasConsent(purposeId: string): boolean {\n return this.consentsSubject.value[purposeId] === true;\n }\n\n /**\n * Opens the preferences modal, e.g. from a \"Cookie settings\" footer link.\n * Initializes first if needed, so a misconfiguration surfaces as an error\n * instead of a button that does nothing.\n */\n async openPreferences(): Promise<void> {\n await this.init();\n this.instance?.prompt();\n }\n\n private async load(): Promise<void> {\n if (!this.options) {\n throw new Error(\n 'CookieConsentService: provideCookieConsent() is missing from the application providers.',\n );\n }\n\n if (!this.options.cookie?.name?.trim()) {\n throw new Error(\n 'CookieConsentService: provideCookieConsent() needs a cookie.name specific to the application.',\n );\n }\n\n const loadOrejime = (\n this.document.defaultView as { loadOrejime?: LoadOrejime } | null\n )?.loadOrejime;\n\n if (!loadOrejime) {\n throw new Error(\n 'CookieConsentService: loadOrejime() is not defined. Add \"node_modules/orejime/dist/orejime-standard-en.js\" to the scripts of angular.json.',\n );\n }\n\n const config = await this.createConfig(this.options);\n const instance = loadOrejime(config);\n this.instance = instance;\n\n const readConsents = () =>\n Object.fromEntries(\n config.purposes.map(({ id }) => [id, instance.manager.getConsent(id)]),\n );\n\n instance.manager.on('update', () =>\n this.consentsSubject.next(readConsents()),\n );\n instance.manager.on('clear', () =>\n this.consentsSubject.next(readConsents()),\n );\n\n // Seeds from the consent stored by a previous visit.\n this.consentsSubject.next(readConsents());\n }\n\n private async createConfig(\n options: CookieConsentOptions,\n ): Promise<OrejimeConfig> {\n const purposes = [\n ...(options.essentialPurpose === false ? [] : [ESSENTIAL_PURPOSE]),\n ...options.purposes,\n ];\n\n const purposeKeys = purposes.flatMap(({ title, description }) =>\n description ? [title, description] : [title],\n );\n\n // get() waits for the translation file, unlike instant().\n const [labels, texts] = await Promise.all([\n firstValueFrom(this.translate.get(LABELS_KEY)),\n firstValueFrom(this.translate.get(purposeKeys)),\n ]);\n\n const language =\n this.translate.getCurrentLang() ?? this.translate.getFallbackLang() ?? '';\n\n return {\n privacyPolicyUrl: this.privacyPolicyUrl(options, language),\n purposes: purposes.map(purpose => ({\n ...purpose,\n title: texts[purpose.title],\n description: purpose.description && texts[purpose.description],\n })),\n cookie: options.cookie,\n forceModal: options.forceModal,\n forceBanner: options.forceBanner,\n orejimeElement: options.orejimeElement,\n translations: mergeTranslations(\n toOrejimeTranslations(typeof labels === 'object' ? labels : {}),\n options.translations ?? {},\n ),\n };\n }\n\n private privacyPolicyUrl(\n options: CookieConsentOptions,\n language: string,\n ): string {\n const url = options.privacyPolicyUrl;\n\n if (typeof url === 'string') {\n return url;\n }\n\n return url?.[language] ?? DEFAULT_PRIVACY_POLICY_URL;\n }\n}\n\n/**\n * Maps the `cookieConsent` labels onto every Orejime text, so the texts\n * follow the ngx-translate language whichever orejime-standard-<lang>.js\n * bundle the app loads.\n */\nfunction toOrejimeTranslations(\n labels: Record<string, unknown>,\n): OrejimeTranslations {\n const privacyPolicyLabel = labels['privacyPolicyLabel'];\n\n return Object.fromEntries(\n OREJIME_SECTIONS.map(section => {\n // Only string labels: purpose texts such as purpose.essential are\n // passed with the purposes themselves.\n const strings = Object.entries(\n (labels[section] as Record<string, unknown> | undefined) ?? {},\n ).filter(\n (entry): entry is [string, string] => typeof entry[1] === 'string',\n );\n\n if (\n typeof privacyPolicyLabel === 'string' &&\n PRIVACY_POLICY_SECTIONS.includes(section)\n ) {\n strings.push(['privacyPolicyLabel', privacyPolicyLabel]);\n }\n\n return [section, Object.fromEntries(strings)];\n }),\n );\n}\n\nfunction mergeTranslations(\n base: OrejimeTranslations,\n overrides: OrejimeTranslations,\n): OrejimeTranslations {\n const merged = { ...base };\n\n for (const [section, labels] of Object.entries(overrides)) {\n merged[section] = { ...merged[section], ...labels };\n }\n\n return merged;\n}\n","/*\n * Public API Surface of cookie-consent\n */\n\nexport * from './src/cookie-consent.models';\nexport * from './src/cookie-consent.provider';\nexport * from './src/cookie-consent.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAOa,sBAAsB,GAAG,IAAI,cAAc,CACtD,wBAAwB;AAG1B;;;;AAIG;AACG,SAAU,oBAAoB,CAClC,OAA6B,EAAA;AAE7B,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,OAAO,EAAE;AACvD,KAAA,CAAC;AACJ;;ACFO,MAAM,wBAAwB,GAAG;AAExC,MAAM,0BAA0B,GAC9B,wDAAwD;AAE1D,MAAM,UAAU,GAAG,eAAe;AAElC,MAAM,iBAAiB,GAAyB;AAC9C,IAAA,EAAE,EAAE,wBAAwB;IAC5B,KAAK,EAAE,CAAA,EAAG,UAAU,CAAA,wBAAA,CAA0B;IAC9C,WAAW,EAAE,CAAA,EAAG,UAAU,CAAA,8BAAA,CAAgC;AAC1D,IAAA,WAAW,EAAE,IAAI;CAClB;AAED;AACA,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC;AAE7E;AACA,MAAM,uBAAuB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC;AAEjE;;;;;;;;;;;;;AAaG;MAIU,oBAAoB,CAAA;AAHjC,IAAA,WAAA,GAAA;QAImB,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AA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O,CAAC,SAAS,CAAC,EAAE;AACzD,QAAA,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE;IACrD;AAEA,IAAA,OAAO,MAAM;AACf;;ACnPA;;AAEG;;ACFH;;AAEG;;;;"}
@@ -2062,7 +2062,7 @@ function onemrvaDateLuxonYearMonthProvider() {
2062
2062
  }
2063
2063
 
2064
2064
  // Auto-generated — do not edit
2065
- const VERSION = '22.6.0';
2065
+ const VERSION = '22.7.0-develop.1';
2066
2066
 
2067
2067
  function onemrvaThemeProvider() {
2068
2068
  return makeEnvironmentProviders([