UNPKG

@studiohyperdrive/ngx-cookies

Version:
60 lines (59 loc) 2.28 kB
import { ChangeDetectorRef, TemplateRef, Type, ViewContainerRef, OnDestroy } from '@angular/core'; import { NgxHasCookieConfiguration } from '../../types'; import { NgxCookieService } from '../../services'; import { NgxCookiesFallBackComponent } from '../../abstracts'; import * as i0 from "@angular/core"; /** * 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. */ export declare class NgxHasCookieDirective implements OnDestroy { private viewContainer; private readonly ngxCookieService; private readonly cdRef; private readonly component; /** * The destroyed state of the directive */ private destroyed$; /** * The needed templateRefs */ private thenTemplateRef; private elseTemplateRef; /** * The ref of the component we wish to render as a fallback */ private componentRef; /** * The list of cookies we need to check */ private cookies; /** * A cookie or list of cookies the item should have */ set hasCookie(cookie: NgxHasCookieConfiguration | NgxHasCookieConfiguration[]); /** * The else template in case the cookie is not accepted */ set hasCookieElse(ngTemplate: TemplateRef<any>); constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, ngxCookieService: NgxCookieService, cdRef: ChangeDetectorRef, component: Type<NgxCookiesFallBackComponent>); ngOnDestroy(): void; /** * Updates the view and hides/renders the template as needed */ private updateView; /** * Dispose the current subscription */ private dispose; /** * Render the template on which the directive is set */ private renderThenTemplate; /** * Render the fallbackTemplate or fallBackComponent */ private renderElseTemplate; static ɵfac: i0.ɵɵFactoryDeclaration<NgxHasCookieDirective, [null, null, null, null, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<NgxHasCookieDirective, "[hasCookie]", never, { "hasCookie": { "alias": "hasCookie"; "required": false; }; "hasCookieElse": { "alias": "hasCookieElse"; "required": false; }; }, {}, never, never, true, never>; }