Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 4x 2x 2x | import { ChangeDetectionStrategy, Component, EventEmitter, Inject, OnInit, Output } from '@angular/core'; import { COOKIE_CONSENT_OPTIONS } from 'ish-core/configurations/injection-keys'; import { CookieConsentSettings } from 'ish-core/models/cookies/cookies.model'; import { CookiesService } from 'ish-core/utils/cookies/cookies.service'; import { InjectSingle } from 'ish-core/utils/injection'; /** * Cookies Modal Component */ @Component({ selector: 'ish-cookies-modal', templateUrl: './cookies-modal.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class CookiesModalComponent implements OnInit { @Output() closeModal = new EventEmitter<void>(); cookieConsentSettings?: CookieConsentSettings; selectedIds: { [id: string]: boolean } = {}; constructor( @Inject(COOKIE_CONSENT_OPTIONS) public cookieConsentOptions: InjectSingle<typeof COOKIE_CONSENT_OPTIONS>, private cookiesService: CookiesService ) {} ngOnInit() { this.cookieConsentSettings = JSON.parse(this.cookiesService.get('cookieConsent') || 'null'); Object.keys(this.cookieConsentOptions.options).forEach(option => { if ( this.cookieConsentOptions.options[option].required || this.cookieConsentSettings?.enabledOptions.includes(option) ) { this.selectedIds[option] = true; } }); } acceptAll() { this.cookiesService.setCookiesConsentForAll(); } submit() { this.cookiesService.setCookiesConsentFor( Object.keys(this.selectedIds).reduce((acc, x) => (this.selectedIds[x] ? acc.push(x) && acc : acc), []) ); this.closeModal.emit(); } hide() { this.closeModal.emit(); } unsorted = () => 0; } |