@studiohyperdrive/ngx-cookies
Version:
An integrated Angular approach to the vanilla cookieconsent library.
1 lines • 23.6 kB
Source Map (JSON)
{"version":3,"file":"studiohyperdrive-ngx-cookies.mjs","sources":["../../../../libs/angular/cookies/src/lib/services/cookie/cookie.service.ts","../../../../libs/angular/cookies/src/lib/tokens/has-cookies-fallback/has-cookies-fallback.ts","../../../../libs/angular/cookies/src/lib/directives/has-cookie/has-cookie.directive.ts","../../../../libs/angular/cookies/src/lib/abstracts/cookie-fallback/cookie-fallback.component.ts","../../../../libs/angular/cookies/src/index.ts","../../../../libs/angular/cookies/src/studiohyperdrive-ngx-cookies.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as CookieConsent from 'vanilla-cookieconsent';\nimport { NgxWindowService } from '@studiohyperdrive/ngx-core';\n\nimport {\n\tBehaviorSubject,\n\tObservable,\n\tSubject,\n\tcombineLatest,\n\tdistinctUntilChanged,\n\tmap,\n\tstartWith,\n} from 'rxjs';\nimport {\n\tNgxCookieCategories,\n\tNgxCookieChangedEvent,\n\tNgxCookieConfiguration,\n\tNgxCookieEvent,\n\tNgxCookieLanguageConfiguration,\n\tNgxCookieValue,\n} from '../../types';\n\n/**\n * A service that implements the CookieConsent from https://cookieconsent.orestbida.com and provides the necessary Observables to handle this setup.\n */\n@Injectable({ providedIn: 'root' })\nexport class NgxCookieService {\n\t/**\n\t * Subject to hold the onFirstConsent event\n\t */\n\tprivate readonly firstCookiesConsentedSubject: Subject<NgxCookieEvent> = new Subject();\n\n\t/**\n\t * Subject to hold the onConsent event\n\t */\n\tprivate readonly cookiesConsentedSubject: Subject<NgxCookieEvent> = new Subject();\n\n\t/**\n\t * Subject to hold the consentChanged event\n\t */\n\tprivate readonly cookiesConsentChangedSubject: Subject<NgxCookieChangedEvent> = new Subject();\n\n\t/**\n\t * Subject to hold the modalVisible event\n\t */\n\tprivate readonly modalVisibleSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(\n\t\tfalse\n\t);\n\n\t/**\n\t * Subject to hold the cookiesChanged event\n\t */\n\tprivate readonly cookiesChangedSubject: Subject<Record<string, any>> = new Subject();\n\n\t/**\n\t * An event triggered only the very first time that the user expresses their choice of consent\n\t */\n\tpublic readonly firstCookiesConsented$: Observable<NgxCookieEvent> =\n\t\tthis.firstCookiesConsentedSubject.asObservable();\n\n\t/**\n\t * An event triggering the choice of consent on every page load.\n\t */\n\tpublic readonly cookiesConsented$: Observable<NgxCookieEvent> =\n\t\tthis.cookiesConsentedSubject.asObservable();\n\n\t/**\n\t * An event triggered when the user modifies their preferences and only if consent has already been provided.\n\t */\n\tpublic readonly cookiesConsentChanged$: Observable<NgxCookieChangedEvent> =\n\t\tthis.cookiesConsentChangedSubject.asObservable();\n\n\t/**\n\t * Whether the cookies modal is currently visible\n\t */\n\tpublic readonly modalVisible$: Observable<boolean> = this.modalVisibleSubject.asObservable();\n\n\t/**\n\t * Emits every time the set cookies have been changed\n\t */\n\tpublic readonly cookiesChanged$: Observable<Record<string, any>> =\n\t\tthis.cookiesChangedSubject.asObservable();\n\n\tconstructor(private readonly windowsService: NgxWindowService) {}\n\n\t/**\n\t * Sets up the CookieConsent.\n\t *\n\t * For more information of on this configuration, check the documentation\n\t * https://cookieconsent.orestbida.com/essential/getting-started.html\n\t *\n\t * @param categories - The categories of cookies\n\t * @param language - The language settings of the cookies\n\t * @param configuration - An optional set configuration settings\n\t */\n\tpublic setupCookiesHandler(\n\t\tcategories: NgxCookieCategories,\n\t\tlanguage: NgxCookieLanguageConfiguration,\n\t\tconfiguration?: NgxCookieConfiguration\n\t): void {\n\t\t// Iben: If we're not in the browser, we early exit, so server-side rendering can be enabled\n\t\tif (!this.windowsService.isBrowser()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Iben: If no categories were provided, we early exit and throw an error, as the cookie preference cannot be shown without.\n\t\tif (!categories || Object.keys(categories).length === 0) {\n\t\t\tconsole.error(\n\t\t\t\t'NgxCookies: No categories were provided for the cookie handler. At least one category is required.'\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Iben: Setup the onFirstConsent listener\n\t\tconst onFirstConsent = (event) => {\n\t\t\tthis.firstCookiesConsentedSubject.next(event);\n\t\t};\n\t\tonFirstConsent.bind(this);\n\n\t\t// Iben: Setup the onConsent listener\n\t\tconst onConsent = (event) => {\n\t\t\tthis.cookiesConsentedSubject.next(event);\n\t\t};\n\t\tonConsent.bind(this);\n\n\t\t// Iben: Setup the onChange listener\n\t\tconst onChange = (event) => {\n\t\t\tthis.cookiesConsentChangedSubject.next(event);\n\t\t};\n\t\tonChange.bind(this);\n\n\t\t// Iben: Setup the onModalShow listener\n\t\tconst onModalShow = () => {\n\t\t\tthis.modalVisibleSubject.next(true);\n\t\t};\n\t\tonModalShow.bind(this);\n\n\t\t// Iben: Setup the onModalHide listener\n\t\tconst onModalHide = () => {\n\t\t\tthis.modalVisibleSubject.next(false);\n\t\t};\n\t\tonModalHide.bind(this);\n\n\t\t// Iben: Run the CookieConsent handler\n\t\tCookieConsent.run({\n\t\t\t...(configuration || {}),\n\t\t\tonFirstConsent,\n\t\t\tonConsent,\n\t\t\tonChange,\n\t\t\tonModalHide,\n\t\t\tonModalShow,\n\t\t\tcategories,\n\t\t\tlanguage,\n\t\t});\n\t}\n\n\t/**\n\t * Whether a certain category of cookies was accepted\n\t *\n\t * @param name - The name of the category\n\t */\n\tpublic hasAcceptedCategory(name: string): Observable<boolean> {\n\t\t// Iben: Return every time the cookie consent has changed\n\t\treturn combineLatest([\n\t\t\tthis.cookiesConsented$.pipe(startWith(undefined)),\n\t\t\tthis.cookiesConsentChanged$.pipe(startWith(undefined)),\n\t\t]).pipe(\n\t\t\tmap(() => {\n\t\t\t\t// Iben: Check if the category was accepted\n\t\t\t\treturn CookieConsent.acceptedCategory(name);\n\t\t\t})\n\t\t);\n\t}\n\n\t/**\n\t * Accept a category of cookies\n\t *\n\t * @param name - The name of the categories\n\t */\n\tpublic acceptCategory(name: string): void {\n\t\tCookieConsent.acceptCategory(name);\n\t}\n\n\t/**\n\t * Whether a certain service within a category was accepted\n\t *\n\t * @param category - The name of the category\n\t * @param name - The name of the service\n\t */\n\tpublic hasAcceptedService(category: string, name: string): Observable<boolean> {\n\t\t// Iben: Return every time the cookie consent has changed\n\t\treturn combineLatest([\n\t\t\tthis.cookiesConsented$.pipe(startWith(undefined)),\n\t\t\tthis.cookiesConsentChanged$.pipe(startWith(undefined)),\n\t\t]).pipe(\n\t\t\tmap(() => {\n\t\t\t\t// Iben: Check if the service within the provided category was accepted\n\t\t\t\treturn CookieConsent.acceptedService(name, category);\n\t\t\t})\n\t\t);\n\t}\n\n\t/**\n\t * Accept a category of cookies\n\t *\n\t * @param category - The name of the category\n\t * @param name - The name of the service\n\t */\n\tpublic acceptService(category: string, name: string): void {\n\t\tCookieConsent.acceptService(name, category);\n\t}\n\n\t/**\n\t * Show the cookie modal\n\t */\n\tpublic showModal(): void {\n\t\tCookieConsent.show(true);\n\t}\n\n\t/**\n\t * Get a cookie\n\t *\n\t * @param cookie - Name of the cookie\n\t */\n\tpublic getCookie<DataType = any>(cookie: string): DataType | undefined {\n\t\treturn (CookieConsent.getCookie('data') || {})[cookie];\n\t}\n\n\t/**\n\t * Get a cookie as an observable\n\t *\n\t * @param cookie - Name of the cookie\n\t */\n\tpublic getCookieObservable<DataType = any>(cookie: string): Observable<DataType | undefined> {\n\t\t// Iben: Return every time the set cookies are changed\n\t\treturn this.cookiesChanged$.pipe(\n\t\t\tstartWith(CookieConsent.getCookie('data') || {}),\n\t\t\t// Iben: Get the cookie value\n\t\t\tmap(() => {\n\t\t\t\treturn this.getCookie<DataType>(cookie);\n\t\t\t}),\n\t\t\t// Iben: As the cookiesChanged event emits every time all cookies are rest, we check if the cookie value was really changed\n\t\t\tdistinctUntilChanged()\n\t\t);\n\t}\n\n\t/**\n\t * Set a cookie\n\t *\n\t * @param cookie - The cookie we wish to set\n\t */\n\tpublic setCookie(cookie: NgxCookieValue): void {\n\t\t// Iben: Set the cookie\n\t\tconst isSet = CookieConsent.setCookieData({\n\t\t\tvalue: { [cookie.name]: cookie.value },\n\t\t\tmode: 'update',\n\t\t});\n\n\t\t// Iben: If the cookie was not set, we return\n\t\tif (!isSet) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Iben: Update the subject so we can notify listeners\n\t\tthis.cookiesChangedSubject.next(CookieConsent.getCookie('data'));\n\t}\n\n\t/**\n\t * Remove a cookie\n\t *\n\t * @param cookie - The cookie we wish to remove\n\t */\n\tpublic removeCookie(cookie: string): void {\n\t\t// Iben: Get the current cookies\n\t\tconst currentCookies = CookieConsent.getCookie('data') || {};\n\n\t\t// Iben: Remove the cookie from the currently set cookies\n\t\tconst { [cookie]: _removedValue, ...value } = currentCookies;\n\n\t\t// Iben: Remove the cookie from the cookies holder\n\t\tconst isSet = CookieConsent.setCookieData({ value, mode: 'overwrite' });\n\n\t\t// Iben: If the cookie was not set, we return\n\t\tif (!isSet) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Iben: Update the subject so we can notify listeners\n\t\tthis.cookiesChangedSubject.next(CookieConsent.getCookie('data'));\n\t}\n}\n","import { InjectionToken, Type } from '@angular/core';\n\nimport { NgxCookiesFallBackComponent } from '../../abstracts';\n\n/** A token to provide a fallback component that needs to be rendered when a specific (set of) cookie(s) was not accepted. */\nexport const NgxCookiesFallbackComponentToken = new InjectionToken<\n\tType<NgxCookiesFallBackComponent>\n>('NgxCookiesFallbackComponent');\n","import {\n\tChangeDetectorRef,\n\tComponentRef,\n\tDirective,\n\tInject,\n\tInput,\n\tOptional,\n\tTemplateRef,\n\tType,\n\tViewContainerRef,\n\tOnDestroy,\n} from '@angular/core';\nimport { Subject, tap, takeUntil, combineLatest, map } from 'rxjs';\nimport { flatten } from 'lodash';\n\nimport { NgxHasCookieConfiguration } from '../../types';\nimport { NgxCookieService } from '../../services';\nimport { NgxCookiesFallBackComponent } from '../../abstracts';\nimport { NgxCookiesFallbackComponentToken } from '../../tokens';\n\n/**\n * A structural directive that provides a way to render UI elements based on whether a (set of) cookie(s) have been accepted by the user.\n */\n@Directive({\n\tselector: '[hasCookie]',\n\tstandalone: true,\n})\nexport class NgxHasCookieDirective implements OnDestroy {\n\t//TODO: Iben: Replace this with the OnDestroyComponent flow once we have a shared lib\n\t/**\n\t * The destroyed state of the directive\n\t */\n\tprivate destroyed$: Subject<void>;\n\n\t/**\n\t * The needed templateRefs\n\t */\n\tprivate thenTemplateRef: TemplateRef<any> | null = null;\n\tprivate elseTemplateRef: TemplateRef<any> | null = null;\n\n\t/**\n\t * The ref of the component we wish to render as a fallback\n\t */\n\tprivate componentRef: ComponentRef<NgxCookiesFallBackComponent>;\n\n\t/**\n\t * The list of cookies we need to check\n\t */\n\tprivate cookies: NgxHasCookieConfiguration[] = [];\n\n\t/**\n\t * A cookie or list of cookies the item should have\n\t */\n\t@Input() public set hasCookie(cookie: NgxHasCookieConfiguration | NgxHasCookieConfiguration[]) {\n\t\tthis.cookies = Array.isArray(cookie) ? cookie : [cookie];\n\t\tthis.updateView();\n\t}\n\n\t/**\n\t * The else template in case the cookie is not accepted\n\t */\n\t@Input() public set hasCookieElse(ngTemplate: TemplateRef<any>) {\n\t\tthis.elseTemplateRef = ngTemplate;\n\t\tthis.updateView();\n\t}\n\n\tconstructor(\n\t\ttemplateRef: TemplateRef<any>,\n\t\tprivate viewContainer: ViewContainerRef,\n\t\tprivate readonly ngxCookieService: NgxCookieService,\n\t\tprivate readonly cdRef: ChangeDetectorRef,\n\t\t@Optional()\n\t\t@Inject(NgxCookiesFallbackComponentToken)\n\t\tprivate readonly component: Type<NgxCookiesFallBackComponent>\n\t) {\n\t\tthis.thenTemplateRef = templateRef;\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\tthis.dispose();\n\t}\n\n\t/**\n\t * Updates the view and hides/renders the template as needed\n\t */\n\tprivate updateView(): void {\n\t\t// Iben: Dispose the current subscription\n\t\tthis.dispose();\n\n\t\t// Iben: Create a new onDestroyed handler\n\t\tthis.destroyed$ = new Subject();\n\n\t\t// Iben: Render the views based on the correct state\n\t\tcombineLatest(\n\t\t\t// Iben Check for each cookie if it is accepted\n\t\t\tthis.cookies.map((cookie) => {\n\t\t\t\t// Iben: If no specific services were provided, we can just check the category\n\t\t\t\tif (!cookie.services) {\n\t\t\t\t\treturn this.ngxCookieService.hasAcceptedCategory(cookie.category);\n\t\t\t\t}\n\n\t\t\t\t// Iben: If specific services were provided, we can just check each individual category\n\t\t\t\treturn combineLatest(\n\t\t\t\t\tcookie.services.map((service) => {\n\t\t\t\t\t\treturn this.ngxCookieService.hasAcceptedService(cookie.category, service);\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t})\n\t\t)\n\t\t\t.pipe(\n\t\t\t\tmap((hasCookies) => {\n\t\t\t\t\treturn flatten(hasCookies).every((hasCookie) => hasCookie);\n\t\t\t\t}),\n\t\t\t\ttap((hasCookie) => {\n\t\t\t\t\t// Iben: Clear the current view\n\t\t\t\t\tthis.viewContainer.clear();\n\n\t\t\t\t\t// Iben: If there already is a component, destroy it so it can update correctly\n\t\t\t\t\tif (this.componentRef) {\n\t\t\t\t\t\tthis.componentRef.destroy();\n\t\t\t\t\t\tthis.componentRef = undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Iben: Render the correct templates\n\t\t\t\t\thasCookie ? this.renderThenTemplate() : this.renderElseTemplate();\n\n\t\t\t\t\t// Iben: Detect the changes so that the view gets updated\n\t\t\t\t\tthis.cdRef.detectChanges();\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.destroyed$)\n\t\t\t)\n\t\t\t.subscribe();\n\t}\n\n\t/**\n\t * Dispose the current subscription\n\t */\n\tprivate dispose(): void {\n\t\tif (this.destroyed$) {\n\t\t\tthis.destroyed$.next();\n\t\t\tthis.destroyed$.complete();\n\t\t}\n\t}\n\n\t/**\n\t * Render the template on which the directive is set\n\t */\n\tprivate renderThenTemplate(): void {\n\t\t// Iben: If a thenTemplateRef is provided, render the template\n\t\tif (this.thenTemplateRef) {\n\t\t\tthis.viewContainer.createEmbeddedView(this.thenTemplateRef);\n\t\t}\n\t}\n\n\t/**\n\t * Render the fallbackTemplate or fallBackComponent\n\t */\n\tprivate renderElseTemplate(): void {\n\t\t// Iben: If a custom template ref was provided, render the template and early exit\n\t\tif (this.elseTemplateRef) {\n\t\t\tthis.viewContainer.createEmbeddedView(this.elseTemplateRef);\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Iben: If a component was provided as a fallback, we render that\n\t\tif (this.component) {\n\t\t\t// Iben: Render the provided component\n\t\t\tthis.componentRef = this.viewContainer.createComponent<NgxCookiesFallBackComponent>(\n\t\t\t\tthis.component\n\t\t\t);\n\n\t\t\t// Iben: Set the cookies of the component\n\t\t\tthis.componentRef.setInput('cookies', this.cookies);\n\t\t}\n\t}\n}\n","import { Directive, Input } from '@angular/core';\nimport { NgxHasCookieConfiguration } from '../../types';\n\n/**\n *An abstract component that can optionally be used as a fallback to content that depends on accepted cookies\n */\n@Directive()\nexport abstract class NgxCookiesFallBackComponent {\n\t/**\n\t * The cookies that were required to show the original content\n\t */\n\t@Input() cookies: NgxHasCookieConfiguration[] = [];\n}\n","/*\n * Public API Surface of ngx-cookies\n */\nexport { NgxCookieService } from './lib/services';\nexport { NgxHasCookieDirective } from './lib/directives';\nexport { NgxCookiesFallBackComponent } from './lib/abstracts';\nexport { NgxCookiesFallbackComponentToken } from './lib/tokens';\nexport {\n\tNgxCookieConfiguration,\n\tNgxCookieCategories,\n\tNgxCookieLanguageConfiguration,\n} from './lib/types';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAsBA;;AAEG;MAEU,gBAAgB,CAAA;AAyD5B,IAAA,WAAA,CAA6B,cAAgC,EAAA;QAAhC,IAAc,CAAA,cAAA,GAAd,cAAc;AAxD3C;;AAEG;AACc,QAAA,IAAA,CAAA,4BAA4B,GAA4B,IAAI,OAAO,EAAE;AAEtF;;AAEG;AACc,QAAA,IAAA,CAAA,uBAAuB,GAA4B,IAAI,OAA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