UNPKG

@localia/ngx-cookie-consent

Version:

Angular module to display a cookie consent banner without other dependencies.

1 lines 89 kB
{"version":3,"file":"localia-ngx-cookie-consent.mjs","sources":["../../../projects/ngx-cookie-consent/src/lib/services/ngx-cookie/ngx-cookie.service.ts","../../../projects/ngx-cookie-consent/src/lib/config/ngx-cookie-consent-config.service.ts","../../../projects/ngx-cookie-consent/src/lib/services/ngx-cookie-eventbus/ngx-cookie-eventbus.service.ts","../../../projects/ngx-cookie-consent/src/lib/services/ngx-cookie-manager/ngx-cookie-manager.service.ts","../../../projects/ngx-cookie-consent/src/lib/directives/if-consent/if-consent.directive.ts","../../../projects/ngx-cookie-consent/src/lib/languages/en.language.ts","../../../projects/ngx-cookie-consent/src/lib/languages/de.language.ts","../../../projects/ngx-cookie-consent/src/lib/languages/it.language.ts","../../../projects/ngx-cookie-consent/src/lib/languages/pt.language.ts","../../../projects/ngx-cookie-consent/src/lib/languages/fr.language.ts","../../../projects/ngx-cookie-consent/src/lib/languages/index.ts","../../../projects/ngx-cookie-consent/src/lib/services/ngx-language/ngx-language.service.ts","../../../projects/ngx-cookie-consent/src/lib/services/ngx-cookie-consent/ngx-cookie-consent.service.ts","../../../projects/ngx-cookie-consent/src/lib/ngx-cookie-consent.component.ts","../../../projects/ngx-cookie-consent/src/lib/ngx-cookie-consent.component.html","../../../projects/ngx-cookie-consent/src/lib/ngx-cookie-consent.module.ts","../../../projects/ngx-cookie-consent/src/public-api.ts","../../../projects/ngx-cookie-consent/src/localia-ngx-cookie-consent.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Inject, Injectable, InjectionToken, PLATFORM_ID } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxCookieService {\n\n private readonly documentIsAccessible: boolean;\n\n constructor(\n @Inject(DOCUMENT) private document: any,\n @Inject(PLATFORM_ID) private platformId: InjectionToken<Object>,\n ) {\n this.documentIsAccessible = isPlatformBrowser(this.platformId);\n }\n\n /**\n * @param name Cookie name\n */\n check(name: string): boolean {\n if (!this.documentIsAccessible) {\n return false;\n }\n\n name = encodeURIComponent(name);\n const regExp = this.getCookieRegExp(name);\n\n return regExp.test(this.document.cookie);\n }\n\n /**\n * @param name Cookie name\n */\n get(name: string): string|boolean|undefined {\n if (this.documentIsAccessible && this.check(name)) {\n name = encodeURIComponent(name);\n\n const regExp: RegExp = this.getCookieRegExp(name);\n const result: RegExpExecArray|null = regExp.exec(this.document.cookie);\n\n if (result === null) {\n return false;\n }\n\n const returnValue = decodeURIComponent(result[1]);\n\n if (returnValue.toLowerCase() === 'true') {\n return true;\n }\n\n if (returnValue.toLowerCase() === 'false') {\n return false;\n }\n\n return decodeURIComponent(result[1]);\n }\n\n return undefined;\n }\n\n set(name: string, value: string|boolean, expiringDays: number = 1, path: string = '/'): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n let cookieString: string = encodeURIComponent( name ) + '=' + encodeURIComponent( value ) + ';';\n\n const dateExpires: Date = new Date( new Date().getTime() + expiringDays * 86400000);\n cookieString += 'expires=' + dateExpires.toUTCString() + ';';\n cookieString += 'path=' + path + ';';\n cookieString += 'SameSite=None; Secure;';\n\n this.document.cookie = cookieString;\n }\n\n delete(name: string, path: string = '/'): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n let cookieString: string = encodeURIComponent( name ) + '=;';\n\n cookieString += 'expires=Thu, 01 Jan 1970 00:00:01 GMT;';\n cookieString += 'path=' + path + ';';\n cookieString += 'SameSite=None; Secure;';\n\n this.document.cookie = cookieString;\n }\n\n /**\n * @param name Cookie name\n */\n private getCookieRegExp(name: string): RegExp {\n return new RegExp('(?:^' + name + '|;\\\\s*' + name + ')=(.*?)(?:;|$)', 'g');\n }\n}\n","import { Injectable } from '@angular/core';\nimport { CookieItem } from './cookie-item.interface';\nimport { TranslatableString } from './translatable-string.interface';\nimport { CustomLanguageConfig } from \"./custom-language-config.interface\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxCookieConsentConfigService {\n privacyPolicyUrl?: string | TranslatableString = '#';\n imprintUrl?: string | TranslatableString = '#';\n defaultLanguage?: string = 'en';\n availableLanguages?: string[] = ['en', 'de', 'it', 'pt', 'fr'];\n customLanguage?: CustomLanguageConfig|null = null;\n showLanguageSwitcher?: boolean = true;\n showBadgeOpener?: boolean = true;\n openerPosition?: 'left-top' | 'right-top' | 'left-bottom' | 'right-bottom' = 'left-bottom';\n customClass?: string = '';\n customOpenerClass?: string = '';\n cookiePrefix?: string = 'cookieconsent_';\n cookieExpiryDays?: number = 365;\n showCookieDetails?: boolean = false;\n showFunctionalCookies?: boolean = true;\n functionalCookies?: CookieItem[] = [];\n showMarketingCookies?: boolean = true;\n marketingCookies?: CookieItem[] = [];\n showEssentialCookies?: boolean = true;\n essentialCookies?: CookieItem[] = [];\n showOtherTools?: boolean = true;\n otherTools?: CookieItem[] = [];\n excludeRoutes?: string[] = [];\n}\n","import { Injectable } from '@angular/core';\r\nimport { Observable, Subject } from 'rxjs';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class NgxCookieEventbusService {\r\n public languageChangedSubject: Subject<boolean>;\r\n public languageChanged$: Observable<boolean>;\r\n\r\n public languageUpdatedSubject: Subject<string>;\r\n public languageUpdated$: Observable<string>;\r\n\r\n\r\n constructor() {\r\n this.languageChangedSubject = new Subject<boolean>();\r\n this.languageChanged$ = this.languageChangedSubject.asObservable();\r\n\r\n this.languageUpdatedSubject = new Subject<string>();\r\n this.languageUpdated$ = this.languageUpdatedSubject.asObservable();\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport { NgxCookieService } from '../ngx-cookie/ngx-cookie.service';\nimport { NgxCookieConsentConfigService } from '../../config/ngx-cookie-consent-config.service';\nimport { NgxCookieEventbusService } from '../ngx-cookie-eventbus/ngx-cookie-eventbus.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxCookieManagerService {\n cookieUpdated$ = new Subject<{name: string, state: boolean}>();\n languageChanged$: Observable<string>;\n\n constructor(\n private cookieService: NgxCookieService,\n private cookieConsentConfig: NgxCookieConsentConfigService,\n private cookieEventbusService: NgxCookieEventbusService,\n ) {\n this.languageChanged$ = this.cookieEventbusService.languageUpdated$;\n }\n\n private getConfig(key: string): any {\n return (this.cookieConsentConfig as any)[key];\n }\n\n private setConfig(key: string, value: string): void {\n (this.cookieConsentConfig as any)[key] = value;\n }\n\n private getPrefixedCookieName(name: string): string {\n return this.getConfig('cookiePrefix') + name;\n }\n\n getCookie(cookieName: string): boolean {\n return this.cookieService.get(this.getPrefixedCookieName(cookieName)) === true;\n }\n\n updateDisplayLanguage(locale: string): void {\n const availableLanguages = this.getConfig('availableLanguages');\n\n if (!availableLanguages.includes(locale)) {\n return;\n }\n\n this.setConfig('defaultLanguage', locale);\n this.cookieEventbusService.languageChangedSubject.next(true);\n }\n\n getDisplayLanguage(): string {\n return this.getConfig('defaultLanguage');\n }\n}\n","import { Directive, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { NgxCookieManagerService } from '../../services/ngx-cookie-manager/ngx-cookie-manager.service';\nimport { filter } from 'rxjs';\n\n@Directive({\n selector: '[ngxIfConsent]',\n standalone: false\n})\nexport class IfConsentDirective implements OnInit, OnDestroy {\n private cookieName!: string;\n private subscription: any;\n\n private show = false;\n @Input() set ngxIfConsent(name: string) {\n this.cookieName = name;\n this.initSubscription();\n }\n\n constructor(\n private cookieManager: NgxCookieManagerService,\n private templateRef: TemplateRef<unknown>,\n private vcr: ViewContainerRef\n ) {}\n\n ngOnInit(): void {\n this.loadSavedValue();\n }\n\n ngOnDestroy(): void {\n this.removeSubscription();\n }\n\n private displayTemplate() {\n this.vcr.clear();\n if (this.show) {\n this.vcr.createEmbeddedView(this.templateRef);\n }\n }\n\n private initSubscription() {\n this.subscription = this.cookieManager.cookieUpdated$.pipe(\n filter((cookie) => cookie.name === this.cookieName)\n ).subscribe((cookie) => {\n this.show = cookie.state;\n this.displayTemplate();\n });\n }\n\n\n private removeSubscription() {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n\n private loadSavedValue() {\n this.show = this.cookieManager.getCookie(this.cookieName);\n this.displayTemplate();\n }\n}\n","export const lang_en: { [key: string]: string } = {\n language: 'English',\n title: 'We value your privacy',\n text: 'We and our partners use technologies such as cookies or targeting and process personal data such as IP address or browser information to personalise the ads we display. These technologies may access your device and help us show you more relevant ads and improve your website experience. We also use these technologies to measure results or better target our website content. Because we value your privacy, we hereby ask for your consent to use the following technologies.',\n right_bottom: 'You can change/revoke this at any time later by clicking on the Settings button in the bottom right corner of the page.',\n left_bottom: 'You can change/revoke this at any time later by clicking on the Settings button in the bottom left corner of the page.',\n right_top: 'You can change/revoke this at any time later by clicking on the Settings button in the top right corner of the page.',\n left_top: 'You can change/revoke this at any time later by clicking on the Settings button in the top left corner of the page.',\n privacy_text: 'Privacy Policy',\n imprint_text: 'Imprint',\n privacy_settings_text: 'Privacy Settings',\n privacy_settings_title: 'Privacy Settings',\n privacy_settings_title_text: 'This tool helps you to select and deactivate various cookies, trackers and analysis tools used on this website.',\n functional_title: \"Functional\",\n functional_description: 'These cookies enable us to analyze website usage so that we can measure and improve its performance.',\n marketing_title: \"Marketing\",\n marketing_description: 'Marketing cookies are usually used to show you advertisements that meet your interests. When you visit another website, your browser\\'s cookie is recognized and selected ads are displayed to you based on the information stored in this cookie (art. 6 par. 1 p. 1 a) GDPR).',\n essential_title: \"Essential\",\n essential_description: 'These cookies are required for the basic functions of the website.',\n other_title: \"Other\",\n other_description: 'Within our organization we use other tools for data processing. These are also listed here for informational purposes. However, data is collected only after a certain interaction, for example, when you agree on a demo. If you wish to object to data processing by these processors, please contact us.',\n save_text: 'Save',\n accept_text: 'Accept and close',\n decline_text: 'Deny',\n choose_language_text: 'Choose language',\n back_text: 'Back',\n cookie_name: 'Name',\n cookie_description: 'Description',\n cookie_duration: 'Duration',\n};\n","export const lang_de: { [key: string]: string } = {\n language: 'Deutsch',\n title: 'Wir schätzen Ihre Privatsphäre',\n text: 'Wir und unsere Partner verwenden Technologien wie Cookies oder Targeting und verarbeiten personenbezogene Daten wie IP-Adresse oder Browserinformationen, um die angezeigte Werbung zu personalisieren. Diese Technologien können auf Ihr Gerät zugreifen und helfen uns, Ihnen relevantere Anzeigen zu zeigen und Ihre Webseitenerfahrung zu verbessern. Wir nutzen diese Technologien zudem, um Ergebnisse zu messen oder unsere Website-Inhalte besser auszurichten. Da wir Ihre Privatsphäre schätzen, bitten wir Sie hiermit um Ihre Einwilligung, die folgenden Technologien zu verwenden.',\n right_bottom: 'Sie können diese jederzeit später ändern/widerrufen, indem Sie auf die Schaltfläche Einstellungen in der rechten unteren Ecke der Seite klicken.',\n left_bottom: 'Sie können diese jederzeit später ändern/widerrufen, indem Sie auf die Schaltfläche Einstellungen in der linken unteren Ecke der Seite klicken.',\n right_top: 'Sie können diese jederzeit später ändern/widerrufen, indem Sie auf die Schaltfläche Einstellungen in der rechten oberen Ecke der Seite klicken.',\n left_top: 'Sie können diese jederzeit später ändern/widerrufen, indem Sie auf die Schaltfläche Einstellungen in der linken oberen Ecke der Seite klicken.',\n privacy_text: 'Datenschutzbestimmungen',\n imprint_text: 'Impressum',\n privacy_settings_text: 'Datenschutzeinstellungen',\n privacy_settings_title: 'Datenschutz​einstellungen',\n privacy_settings_title_text: 'Mit diesem Tool können Sie verschiedene Cookies, Tracker und Analysetools, die auf dieser Website verwendet werden, auswählen und deaktivieren.',\n functional_title: 'Funktional',\n functional_description: 'Diese Cookies ermöglichen es uns, die Nutzung der Website zu analysieren, so dass wir ihre Leistung messen und verbessern können.',\n marketing_title: 'Marketing',\n marketing_description: 'Marketing-Cookies werden in der Regel verwendet, um Ihnen Werbung zu zeigen, die Ihren Interessen entspricht. Wenn Sie eine andere Website besuchen, wird das Cookie Ihres Browsers erkannt, und Ihnen wird auf der Grundlage der in diesem Cookie gespeicherten Informationen ausgewählte Werbung angezeigt (Art. 6 Abs. 1 S. 1 a) DSGVO).',\n essential_title: 'Erforderlich',\n essential_description: 'Diese Cookies sind für die Grundfunktionen der Website erforderlich.',\n other_title: 'Andere',\n other_description: 'Innerhalb unserer Organisation verwenden wir andere Tools für die Datenverarbeitung. Diese sind hier ebenfalls zu Informationszwecken aufgeführt. Die Daten werden jedoch erst nach einer bestimmten Interaktion erhoben, zum Beispiel wenn Sie einer Demo zustimmen. Wenn Sie der Datenverarbeitung durch diese Verarbeiter widersprechen möchten, wenden Sie sich bitte an uns.',\n save_text: 'Speichern',\n accept_text: 'Akzeptieren und schliessen',\n decline_text: 'Ablehnen',\n choose_language_text: 'Sprache wählen',\n back_text: 'Zurück',\n cookie_name: 'Name',\n cookie_description: 'Beschreibung',\n cookie_duration: 'Dauer',\n};\n","export const lang_it: { [key: string]: string } = {\n language: 'Italiano',\n title: 'Teniamo alla vostra privacy',\n text: 'Noi e i nostri partner utilizziamo tecnologie come i cookie o il targeting ed elaboriamo dati personali come l\\'indirizzo IP o le informazioni sul browser per personalizzare gli annunci che visualizziamo. Queste tecnologie possono accedere al vostro dispositivo e aiutarci a mostrarvi annunci più pertinenti e a migliorare la vostra esperienza sul sito web. Utilizziamo queste tecnologie anche per misurare i risultati o per indirizzare meglio i contenuti del nostro sito web. Poiché teniamo alla vostra privacy, con la presente chiediamo il vostro consenso all\\'utilizzo delle seguenti tecnologie.',\n right_bottom: 'È possibile modificare/revocare tale consenso in qualsiasi momento facendo clic sul pulsante Impostazioni nell\\'angolo in basso a destra della pagina.',\n left_bottom: 'È possibile modificare/revocare tale consenso in qualsiasi momento facendo clic sul pulsante Impostazioni nell\\'angolo in basso a sinistra della pagina.',\n right_top: 'È possibile modificare/revocare tale consenso in qualsiasi momento facendo clic sul pulsante Impostazioni nell\\'angolo in alto a destra della pagina.',\n left_top: 'È possibile modificare/revocare tale consenso in qualsiasi momento facendo clic sul pulsante Impostazioni nell\\'angolo in alto a sinistra della pagina.',\n privacy_text: 'Politica sulla privacy',\n imprint_text: 'Imprint',\n privacy_settings_text: 'Impostazioni sulla privacy',\n privacy_settings_title: 'Impostazioni sulla privacy',\n privacy_settings_title_text: 'Questo menu vi aiuta a selezionare e disattivare i vari cookie, tracker e strumenti di analisi utilizzati su questo sito web.',\n functional_title: \"Funzionali\",\n functional_description: 'Questi cookie ci consentono di analizzare l\\'utilizzo del sito web per poterne misurare e migliorare le prestazioni.',\n marketing_title: \"Marketing\",\n marketing_description: 'I cookie di marketing sono solitamente utilizzati per mostrarvi pubblicità che rispondono ai vostri interessi. Quando visitate un altro sito web, il cookie del vostro browser viene riconosciuto e vi vengono mostrati annunci selezionati in base alle informazioni memorizzate in questo cookie (art. 6 par. 1 p. 1 a) GDPR).',\n essential_title: \"Essenziali\",\n essential_description: 'Questi cookie sono necessari per le funzioni di base del sito web.',\n other_title: \"Altri\",\n other_description: 'All\\'interno della nostra organizzazione utilizziamo altri strumenti per l\\'elaborazione dei dati. Anche questi sono elencati qui a scopo informativo. Tuttavia, i dati vengono raccolti solo dopo una determinata interazione, ad esempio quando si richiede una demo. Se desiderate opporvi al trattamento dei dati da parte di questi elaboratori, contattateci.',\n save_text: 'Salva',\n accept_text: 'Accetta e chiudi',\n decline_text: 'Rifiuta',\n choose_language_text: 'Seleziona una lingua',\n back_text: 'Indietro',\n cookie_name: 'Nome',\n cookie_description: 'Descrizione',\n cookie_duration: 'Durata',\n};\n","export const lang_pt: { [key: string]: string } = {\n language: 'Português',\n title: 'Nós valorizamos sua privacidade',\n text: 'Nós e nossos parceiros usamos tecnologias como cookies ou direcionamento e processamos dados pessoais como endereço IP ou informações do navegador para personalizar os anúncios que exibimos. Essas tecnologias podem acessar seu dispositivo e nos ajudar a mostrar anúncios mais relevantes e melhorar sua experiência no site. Também usamos essas tecnologias para medir resultados ou direcionar melhor o conteúdo do nosso site. Como valorizamos sua privacidade, pedimos seu consentimento para usar as seguintes tecnologias.',\n right_bottom: 'Você pode alterar/revogar isso a qualquer momento clicando no botão Configurações no canto inferior direito da página.',\n left_bottom: 'Você pode alterar/revogar isso a qualquer momento clicando no botão Configurações no canto inferior esquerdo da página.',\n right_top: 'Você pode alterar/revogar isso a qualquer momento clicando no botão Configurações no canto superior direito da página.',\n left_top: 'Você pode alterar/revogar isso a qualquer momento clicando no botão Configurações no canto superior esquerdo da página.',\n privacy_text: 'Política de Privacidade',\n imprint_text: 'Dados da Empresa',\n privacy_settings_text: 'Configuração de Privacidade',\n privacy_settings_title: 'Configuração de Privacidade',\n privacy_settings_title_text: 'Esta ferramenta ajuda você a selecionar e desativar vários cookies, rastreadores e ferramentas de análise usadas neste site.',\n functional_title: 'Funcional',\n functional_description: 'Esses cookies nos permitem analisar o uso do site para que possamos medir e melhorar seu desempenho.',\n marketing_title: 'Marketing',\n marketing_description: 'Os cookies de marketing geralmente são usados para mostrar anúncios que atendem aos seus interesses. Quando você visita outro site, o cookie do seu navegador é reconhecido e os anúncios selecionados são exibidos para você com base nas informações armazenadas neste cookie (art. 6 par. 1 p. 1 a) GDPR).',\n essential_title: 'Essencial',\n essential_description: 'Esses cookies são necessários para as funções básicas do site.',\n other_title: 'Outros',\n other_description: 'Dentro de nossa organização, usamos outras ferramentas para processamento de dados. Estes também estão listados aqui para fins informativos. No entanto, os dados são coletados somente após uma determinada interação, por exemplo, quando você concorda com uma demonstração. Se você deseja se opor ao processamento de dados por esses processadores, entre em contato conosco.',\n save_text: 'Salvar',\n accept_text: 'Aceitar e fechar',\n decline_text: 'Recusar',\n choose_language_text: 'Selecionar linguagem',\n back_text: 'Voltar',\n cookie_name: 'Nome',\n cookie_description: 'Descrição',\n cookie_duration: 'Duração',\n};\n","export const lang_fr: { [key: string]: string } = {\n language: 'Français',\n title: 'Nous apprécions votre vie privée',\n text: 'Nous et nos partenaires utilisons des technologies telles que les cookies ou le ciblage et traitons des données personnelles telles que l\\'adresse IP ou les informations du navigateur pour personnaliser les publicités que nous affichons. Ces technologies peuvent accéder à votre appareil et nous aider à vous montrer des publicités plus pertinentes et à améliorer votre expérience sur notre site. Nous utilisons également ces technologies pour mesurer les résultats ou mieux cibler notre contenu web. Parce que nous valorisons votre vie privée, nous vous demandons par la présente votre consentement pour utiliser les technologies suivantes.',\n right_bottom: 'Vous pouvez changer/révoquer cela à tout moment ultérieurement en cliquant sur le bouton Paramètres en bas à droite de la page.',\n left_bottom: 'Vous pouvez changer/révoquer cela à tout moment ultérieurement en cliquant sur le bouton Paramètres en bas à gauche de la page.',\n right_top: 'Vous pouvez changer/révoquer cela à tout moment ultérieurement en cliquant sur le bouton Paramètres en haut à droite de la page.',\n left_top: 'Vous pouvez changer/révoquer cela à tout moment ultérieurement en cliquant sur le bouton Paramètres en haut à gauche de la page.',\n privacy_text: 'Politique de confidentialité',\n imprint_text: 'Mentions légales',\n privacy_settings_text: 'Paramètres de confidentialité',\n privacy_settings_title: 'Paramètres de confidentialité',\n privacy_settings_title_text: 'Cet outil vous aide à sélectionner et désactiver divers cookies, traqueurs et outils d\\'analyse utilisés sur ce site.',\n functional_title: \"Fonctionnel\",\n functional_description: 'Ces cookies nous permettent d\\'analyser l\\'utilisation du site afin que nous puissions mesurer et améliorer ses performances.',\n marketing_title: \"Marketing\",\n marketing_description: 'Les cookies marketing sont généralement utilisés pour vous montrer des publicités qui correspondent à vos intérêts. Lorsque vous visitez un autre site, le cookie de votre navigateur est reconnu et des publicités sélectionnées vous sont affichées en fonction des informations stockées dans ce cookie (art. 6 par. 1 p. 1 a) RGPD).',\n essential_title: \"Essentiel\",\n essential_description: 'Ces cookies sont nécessaires pour les fonctions de base du site.',\n other_title: \"Autre\",\n other_description: 'Au sein de notre organisation, nous utilisons d\\'autres outils pour le traitement des données. Ceux-ci sont également listés ici à titre informatif. Cependant, les données ne sont collectées qu\\'après une certaine interaction, par exemple, lorsque vous acceptez une démonstration. Si vous souhaitez vous opposer au traitement des données par ces processeurs, veuillez nous contacter.',\n save_text: 'Enregistrer',\n accept_text: 'Accepter et fermer',\n decline_text: 'Refuser',\n choose_language_text: 'Choisir la langue',\n back_text: 'Retour',\n cookie_name: 'Nom',\n cookie_description: 'Description',\n cookie_duration: 'Durée',\n};\n","// export all available languages\nexport { lang_en } from './en.language';\nexport { lang_de } from './de.language';\nexport { lang_it } from './it.language';\nexport { lang_pt } from './pt.language';\nexport { lang_fr } from './fr.language';\n","import { Injectable } from '@angular/core';\nimport * as languages from './../../languages';\nimport { NgxCookieConsentConfigService } from '../../config/ngx-cookie-consent-config.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxLanguageService {\n translationKey = 'lang_en';\n translations: any;\n\n constructor(private config: NgxCookieConsentConfigService) {\n this.translationKey = 'lang_' + this.config.defaultLanguage;\n this.translations = languages;\n\n if (config.customLanguage !== null && config.customLanguage !== undefined) {\n this.translations = {\n ...this.translations,\n ...{\n ['lang_' + config.customLanguage?.languageKey]: {\n ...this.sanitizeCustomTranslations(config.customLanguage?.translations)\n }\n }\n };\n }\n }\n\n\n getTranslation(key: string, translationLang?: string): string {\n const sanitizedKey = key.replace('-', '_');\n\n if (translationLang) {\n return this.translations[`lang_${translationLang}`][sanitizedKey] || '';\n }\n\n return this.translations[this.translationKey][sanitizedKey] || '';\n }\n\n getTranslationFromObject(obj: any, translationLang?: string): string {\n if (typeof obj === 'string') {\n return obj;\n }\n\n if (translationLang && obj.hasOwnProperty(translationLang)) {\n return obj[translationLang];\n }\n\n const fallback = this.translationKey.replace('lang_', '');\n if (obj.hasOwnProperty(fallback)) {\n return obj[fallback];\n }\n\n return '';\n }\n\n private sanitizeCustomTranslations(translations: { [p: string]: string } | undefined): { [p: string]: string } {\n if (!translations) {\n return {};\n }\n\n // get default english translations merge with custom translations\n const defaultTranslations = this.translations['lang_en'];\n\n return {\n ...defaultTranslations,\n ...translations\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { NgxCookieConsentConfigService } from '../../config/ngx-cookie-consent-config.service';\nimport { NgxCookieService } from '../ngx-cookie/ngx-cookie.service';\nimport { NgxLanguageService } from '../ngx-language/ngx-language.service';\nimport { NgxCookieManagerService } from '../ngx-cookie-manager/ngx-cookie-manager.service';\nimport { NgxCookieEventbusService } from '../ngx-cookie-eventbus/ngx-cookie-eventbus.service';\nimport { Subscription } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxCookieConsentService {\n private langChangedSubscription: Subscription;\n activeLang = 'en';\n\n constructor(\n private cookieManagerService: NgxCookieManagerService,\n private cookieService: NgxCookieService,\n private cookieConsentConfig: NgxCookieConsentConfigService,\n private languageService: NgxLanguageService,\n private cookieEventbusService: NgxCookieEventbusService,\n ) {\n this.activeLang = this.getConfig('defaultLanguage');\n this.langChangedSubscription = this.cookieEventbusService.languageChanged$.subscribe({\n next: () => {\n this.activeLang = this.getConfig('defaultLanguage');\n }\n });\n }\n\n getTranslation(key: string, translationLang?: string): string {\n const lang = translationLang || this.activeLang;\n return this.languageService.getTranslation(key, lang);\n }\n\n getTranslationFromObject(obj: any, translationLang?: string): string {\n const lang = translationLang || this.activeLang;\n return this.languageService.getTranslationFromObject(obj, lang);\n }\n\n getConfig(key: string): any {\n return (this.cookieConsentConfig as any)[key];\n }\n\n getPrefixedCookieName(name: string): string {\n return this.getConfig('cookiePrefix') + name;\n }\n\n getCookieFields(): {functional: {key: string, selected: boolean}[], marketing: {key: string, selected: boolean}[]} {\n const functionalCookies = this.getCookiesByCategory('functionalCookies');\n const marketingCookies = this.getCookiesByCategory('marketingCookies');\n\n return {functional: functionalCookies, marketing: marketingCookies};\n }\n\n setLanguage(lang: string): void {\n this.activeLang = lang;\n this.setConfig('defaultLanguage', lang);\n this.cookieEventbusService.languageUpdatedSubject.next(lang);\n }\n\n setConfig(key: string, value: string): void {\n (this.cookieConsentConfig as any)[key] = value;\n }\n\n setCookieConsentStatus(status: boolean): void {\n this.cookieService.set(this.getPrefixedCookieName('status'), status, this.getConfig('cookieExpiryDays'));\n this.cookieManagerService.cookieUpdated$.next({\n name: 'status',\n state: status\n });\n }\n\n setCookieConsentStatusForCookie(name: string, status: boolean): void {\n this.cookieManagerService.cookieUpdated$.next({\n name,\n state: status\n });\n\n if (!status) {\n return this.cookieService.delete(this.getPrefixedCookieName(name));\n }\n\n this.cookieService.set(this.getPrefixedCookieName(name), status, this.getConfig('cookieExpiryDays'));\n }\n\n shouldDisplayCookieConsent(): boolean {\n return !this.cookieService.get(this.getPrefixedCookieName('status'));\n }\n\n acceptAllCookies(): void {\n const cookies = [\n ...this.getConfig('functionalCookies').map((cookie: any) => cookie.key),\n ...this.getConfig('marketingCookies').map((cookie: any) => cookie.key),\n ];\n\n cookies.forEach((cookie: string) => {\n this.setCookieConsentStatusForCookie(cookie, true);\n });\n\n this.setCookieConsentStatus(true);\n }\n\n denyAllCookies(): void {\n const cookies = [\n ...this.getConfig('functionalCookies').map((cookie: any) => cookie.key),\n ...this.getConfig('marketingCookies').map((cookie: any) => cookie.key),\n ];\n\n cookies.forEach((cookie: string) => {\n this.setCookieConsentStatusForCookie(cookie, false);\n });\n\n this.setCookieConsentStatus(true);\n }\n\n saveSomeCookies(cookies: { functional: any, marketing: any } ): void {\n Object.keys(cookies.functional).forEach((cookie: any) => {\n this.setCookieConsentStatusForCookie(cookie, cookies.functional[cookie]);\n });\n\n Object.keys(cookies.marketing).forEach((cookie: any) => {\n this.setCookieConsentStatusForCookie(cookie, cookies.marketing[cookie]);\n });\n\n this.setCookieConsentStatus(true);\n }\n\n private getCookiesByCategory(category: string): {key: string, selected: boolean}[] {\n return this.getConfig(category).map((cookie: any) => {\n const cookieKey = cookie.key;\n const cookieState = this.cookieService.get(this.getPrefixedCookieName(cookie.key)) === true;\n\n return {\n key: cookieKey,\n selected: cookieState\n };\n });\n }\n}\n","import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormGroup } from '@angular/forms';\nimport { NgxCookieConsentService } from './services/ngx-cookie-consent/ngx-cookie-consent.service';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { filter } from 'rxjs';\nimport { CustomLanguageConfig } from './config/custom-language-config.interface';\n\n@Component({\n selector: 'ngx-cookie-consent',\n templateUrl: './ngx-cookie-consent.component.html',\n styleUrls: ['./ngx-cookie-consent.component.scss'],\n standalone: false\n})\nexport class NgxCookieConsentComponent implements OnInit {\n cookieConsentVisible = false;\n showSettingsDialog = false;\n dropDownOpen = false;\n functionalCookiesClosed = true;\n marketingCookiesClosed = true;\n essentialCookiesClosed = true;\n otherToolsClosed = true;\n cookieForm: FormGroup;\n private cookieFields: {\n functional: { key: string; selected: boolean }[],\n marketing: { key: string; selected: boolean }[],\n };\n\n constructor(\n private router: Router,\n private consentService: NgxCookieConsentService,\n private formBuilder: FormBuilder\n ) {\n this.cookieFields = this.consentService.getCookieFields();\n this.cookieForm = this.buildForm();\n }\n\n get activeLang(): string {\n return this.consentService.getConfig('defaultLanguage');\n }\n\n get privacyPolicyUrl(): string {\n const config = this.consentService.getConfig('privacyPolicyUrl');\n return this.consentService.getTranslationFromObject(config);\n }\n\n get imprintUrl(): string {\n const config = this.consentService.getConfig('imprintUrl');\n return this.consentService.getTranslationFromObject(config);\n }\n\n get availableLanguages(): string[] {\n return this.consentService.getConfig('availableLanguages');\n }\n\n get customLanguage(): CustomLanguageConfig | null {\n return this.consentService.getConfig('customLanguage');\n }\n\n get functionalCookiesAllSelected(): boolean {\n const arr = Object.values(this.cookieForm.get('functional')?.value);\n\n if (arr.length === 0) {\n return false;\n }\n\n return arr.every((value) => value === true);\n }\n\n get marketingCookiesAllSelected(): boolean {\n const arr = Object.values(this.cookieForm.get('marketing')?.value);\n\n if (arr.length === 0) {\n return false;\n }\n\n return arr.every((value) => value === true);\n }\n\n translate(key: string, translationLang?: string): string {\n return this.consentService.getTranslation(key, translationLang);\n }\n\n translate_o(key: string | object, translationLang?: string): string {\n return this.consentService.getTranslationFromObject(key, translationLang);\n }\n\n config(key: string) {\n return this.consentService.getConfig(key);\n }\n\n switchLanguage(lang: string) {\n this.dropDownOpen = false;\n this.consentService.setLanguage(lang);\n }\n\n toggle($event: any, category: string) {\n const fields: any = this.consentService.getCookieFields();\n const cookies = fields[category];\n cookies.forEach((field: any) => {\n this.cookieForm\n .get(category)\n ?.get(field.key)\n ?.setValue($event.currentTarget.checked);\n });\n }\n\n back() {\n this.showSettingsDialog = false;\n this.resetDropdowns();\n this.resetForm();\n }\n\n denyAllCookies() {\n this.resetModal();\n this.consentService.denyAllCookies();\n this.resetForm();\n }\n\n acceptAllCookies() {\n this.resetModal();\n this.consentService.acceptAllCookies();\n this.resetForm();\n }\n\n saveSomeCookies() {\n this.consentService.saveSomeCookies(this.cookieForm.value);\n this.resetModal();\n }\n\n private buildForm(): FormGroup {\n return this.formBuilder.group({\n functional: this.buildCookieFields(this.cookieFields.functional),\n marketing: this.buildCookieFields(this.cookieFields.marketing),\n });\n }\n\n private buildCookieFields(fields: { key: string; selected: boolean }[]) {\n const group: any = {};\n fields.forEach((field) => {\n group[field.key] = this.formBuilder.control(field.selected);\n });\n\n return this.formBuilder.group(group);\n }\n\n private resetForm() {\n const fields: any = this.consentService.getCookieFields();\n const categoryKeys = Object.keys(fields);\n categoryKeys.forEach((categoryKey) => {\n const category = fields[categoryKey];\n category.forEach((field: any) => {\n this.cookieForm\n .get(categoryKey)\n ?.get(field.key)\n ?.setValue(field.selected);\n });\n });\n }\n\n private resetDropdowns() {\n this.functionalCookiesClosed = true;\n this.marketingCookiesClosed = true;\n this.essentialCookiesClosed = true;\n this.otherToolsClosed = true;\n }\n\n private resetModal() {\n this.cookieConsentVisible = false;\n this.showSettingsDialog = false;\n this.resetDropdowns();\n }\n\n ngOnInit(): void {\n this.router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe({\n next: (event: any) => {\n const excludedRoutes =\n this.consentService.getConfig('excludeRoutes');\n const realPath = event.urlAfterRedirects.split('?')[0];\n\n if (excludedRoutes.includes(realPath)) {\n this.cookieConsentVisible = false;\n } else {\n this.cookieConsentVisible =\n this.consentService.shouldDisplayCookieConsent();\n }\n },\n });\n }\n\n closeDropDown($event: Event) {\n const eventTarget = $event.target as HTMLElement;\n const parentTarget = eventTarget.parentElement as HTMLElement;\n\n if (\n eventTarget.classList.contains('language-chooser') ||\n parentTarget.classList.contains('language-chooser')\n ) {\n return;\n }\n\n this.dropDownOpen = false;\n }\n}\n","<div class=\"ngx-cc\" *ngIf=\"cookieConsentVisible\" (click)=\"closeDropDown($event)\" [ngClass]=\"config('customClass')\">\n <div class=\"ngx-cc__wrapper\">\n <div class=\"ngx-cc__modal\" *ngIf=\"!showSettingsDialog\">\n <div class=\"ngx-cc__modal_language-switcher\" *ngIf=\"config('showLanguageSwitcher')\">\n <div class=\"language-switcher\">\n <div class=\"flex flex-end\">\n <div class=\"language-chooser\" title=\"{{ translate('choose_language_text') }}\"\n (click)=\"dropDownOpen = !dropDownOpen\">\n <i class=\"icon icon--language\"></i>\n </div>\n </div>\n <div class=\"dropdown\" [ngClass]=\"{'dropdown--active': dropDownOpen}\">\n <div class=\"dropdown__item\" *ngFor=\"let lang of availableLanguages\"\n [ngClass]=\"{'dropdown__item--active': activeLang === lang}\">\n <div class=\"dropdown__item_text\" (click)=\"switchLanguage(lang)\">\n <i class=\"flag-icon flag-{{ lang }}\"></i> {{ translate('language', lang) }}\n </div>\n </div>\n <div class=\"dropdown__item\" *ngIf=\"customLanguage\"\n [ngClass]=\"{'dropdown__item--active': activeLang === customLanguage.languageKey}\">\n <div class=\"dropdown__item_text\" (click)=\"switchLanguage(customLanguage.languageKey)\">\n <i class=\"flag-icon flag-custom\">\n <img *ngIf=\"customLanguage.customIconPath\" [src]=\"customLanguage.customIconPath\" alt=\"{{ customLanguage.languageKey }}\" width=\"34px\" height=\"26px\">\n </i> {{ customLanguage.languageName }}\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"ngx-cc__modal__header\">\n <h1 class=\"text--center\">{{ translate('title') }}</h1>\n </div>\n <div class=\"ngx-cc__modal__body\">\n <p>{{ translate('text') }} {{ translate(config('openerPosition')) }}</p>\n <div>\n <ul class=\"ngx-cc__cookie-controls\">\n <li><a [href]=\"privacyPolicyUrl\" target=\"_blank\">{{ translate('privacy_text') }}</a></li>\n <li><a [href]=\"imprintUrl\" target=\"_blank\">{{ translate('imprint_text') }}</a></li>\n <li><span class=\"text--link\"\n (click)=\"showSettingsDialog = true\">{{ translate('privacy_settings_text') }}</span>\n </li>\n </ul>\n </div>\n </div>\n <div class=\"ngx-cc__modal__footer text--center\">\n <div class=\"ngx-cc__modal__controls\">\n <button class=\"secondary text--uppercase cc-deny\" (click)=\"denyAllCookies()\">{{ translate('decline_text') }}</button>\n <button class=\"text--uppercase cc-accept-all\" (click)=\"acceptAllCookies()\">{{ translate('accept_text') }}</button>\n </div>\n </div>\n </div>\n <div class=\"ngx-cc__modal\" *ngIf=\"showSettingsDialog\">\n <div class=\"ngx-cc__modal_back\">\n <div class=\"flex flex-start\">\n <div class=\"back-button\" title=\"{{ translate('back_text') }}\" (click)=\"back()\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" shape-rendering=\"geometricPrecision\"\n text-rendering=\"geometricPrecision\" image-rendering=\"optimizeQuality\" fill-rule=\"evenodd\"\n clip-rule=\"evenodd\" viewBox=\"0 0 512 512\">\n <path fill-rule=\"nonzero\"\n d=\"M512 256c0 70.68-28.66 134.7-74.98 181.02C390.7 483.34 326.68 512 256 512c-70.69 0-134.7-28.66-181.02-74.98C28.66 390.7 0 326.69 0 256c0-70.69 28.66-134.7 74.98-181.02C121.3 28.66 185.31 0 256 0c70.68 0 134.7 28.66 181.02 74.98C483.34 121.3 512 185.31 512 256zM280.33 146.96 171.3 256l109.03 109.04 40.52-40.51-68.51-68.52 68.52-68.52-40.53-40.53zm130.66 264.03c39.66-39.66 64.2-94.47 64.2-154.99 0-60.53-24.54-115.33-64.2-154.99-39.66-39.66-94.47-64.2-154.99-64.2-60.53 0-115.33 24.54-154.99 64.2-39.66 39.66-64.2 94.46-64.2 154.99 0 60.53 24.54 115.33 64.2 154.99 39.66 39.66 94.46 64.2 154.99 64.2 60.52 0 115.33-24.54 154.99-64.2z\"/>\n </svg>\n </div>\n </div>\n </div>\n <div class=\"ngx-cc__modal__header\">\n <h1 class=\"text--center\">{{ translate('privacy_settings_title') }}</h1>\n </div>\n <div class=\"ngx-cc__modal__body\">\n <p>{{ translate('privacy_settings_title_text') }}</p>\n <div>\n <ul class=\"ngx-cc__cookie-controls\">\n <li><a [href]=\"privacyPolicyUrl\" target=\"_blank\">{{ translate('privacy_text') }}</a></li>\n <li><a [href]=\"imprintUrl\" target=\"_blank\">{{ translate('imprint_text') }}</a></li>\n </ul>\n </div>\n </div>\n <div class=\"ngx-cc__consent_purposes\">\n <div class=\"block\" [ngClass]=\"{'block--closed': functionalCookiesClosed}\" *ngIf=\"config('showFunctionalCookies')\">\n <div class=\"block__header\">\n <div class=\"block__title\">\n <h4>{{ translate('functional_title') }}</h4>\n <span>{{ translate('functional_description') }}</span>\n </div>\n <div class=\"block__item__controls\">\n <div class=\"checkbox checkbox--apple\">\n <input type=\"checkbox\" id=\"functional_cookies\" name=\"functional_cookies\" value=\"1\" [checked]=\"functionalCookiesAllSelected\" (change)=\"toggle($event, 'functional')\">\n <label for=\"functional_cookies\"></label>\n </div>\n </div>\n <div class=\"block__opener\">\n <i class=\"icon icon--small icon--arrow-down\" [ngClass]=\"{\n 'icon--arrow-down': functionalCookiesClosed,\n 'icon--arrow-up': !functionalCookiesClosed\n }\" (click)=\"functionalCookiesClosed = !functionalCookiesClosed\"\n *ngIf=\"config('functionalCookies').length > 0\"></i>\n </div>\n </div>\n <div class=\"block__items\" [formGroup]=\"cookieForm\">\n <div class=\"block__item\" *ngFor=\"let functional of config('functionalCookies')\">\n <div class=\"block__item__body\">\n <div class=\"block__item__title\">\n <h5>{{ translate_o(functional.name) }}</h5>\n <div class=\"text--tiny\">{{ translate_o(functional.description) }}</div>\n <a class=\"text--link text--link--tiny\" href=\"{{ translate_o(functional.privacyPolicyUrl) }}\" target=\"_blank\">{{ translate_o(functional.privacyPolicyUrl) }}</a>\n </div>\n <div class=\"block__item__controls\" formGroupName=\"functional\">\n <div class=\"checkbox checkbox--apple checkbox--tiny\">\n <input type=\"checkbox\" id=\"{{ functional.key }}\" formControlName=\"{{ functional.key }}\" value=\"1\">\n <label for=\"{{ functional.key }}\"></label>\n </div>\n </div>\n </div>\n <div class=\"block__item__details\" *ngIf=\"config('showCookieDetails') && functional?.cookies.length > 0\">\n <div class=\"detail__item\" *ngFor=\"let functionalCookie of functional.cookies\">\n <div>{{ translate('cookie_name') }}: {{ functionalCookie.name }}</div>\n <div>{{ translate('cookie_description') }}: {{ translate_o(functionalCookie.description) }}</div>\n <div>{{ translate('cookie_duration') }}: {{ translate_o(functionalCookie.duration) }}</div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n\n <div class=\"block\" [ngClass]=\"{'block--closed': marketingCookiesClosed}\" *ngIf=\"config('showMarketingCookies')\">\n <div class=\"block__header\">\n <div class=\"block__title\">\n <h4>{{ translate('marketing_title') }}</h4>\n <span>{{ translate('marketing_description') }}</span>\n </div>\n <div class=\"block__item__controls\">\n <div class=\"checkbox checkbox--apple\">\n <input type=\"checkbox\" id=\"marketing_cookies\" name=\"marketing_cookies\" value=\"1\" [checked]=\"marketingCookiesAllSelected\" (change)=\"toggle($event, 'marketing')\">\n <label for=\"marketing_cookies\"></label>\n </div>\n </div>\n <div class=\"block__opener\">\n <i class=\"icon icon--small icon--arrow-down\" [ngClass]=\"{\n 'icon--arrow-down': marketingCookiesClosed,\n 'icon--arrow-up': !marketingCookiesClosed\n }\" (click)=\"marketingCookiesClosed = !marketingCookiesClosed\"\n *ngIf=\"config('marketingCookies').length > 0\"></i>\n </div>\n