UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

79 lines 4.11 kB
import { Subject } from 'rxjs'; import { OptionsService } from '../../common/options.service'; import { Cookie, CookieBannerSettings, CookiePreferences } from './cookie-banner.model'; import * as i0 from "@angular/core"; /** * This service is handling the cookie banner and cookie preferences related logic. */ export declare class CookieBannerService { private options; readonly STORAGE_KEY: string; readonly COOKIE_BANNER = "cookieBanner"; readonly PREVIEW_COOKIE_BANNER = "previewCookieBanner"; readonly IS_PREVIEW = "preview"; readonly COOKIE_PREFERENCES_CONFIG = "cookiePreferences"; isCookieBannerShowed$: Subject<boolean>; cookieDescriptions: { required: "These cookies are required to enable core site functionality. They perform a task or operation without which a site's functionality would not be possible."; functional: "These cookies are used to support you during your first steps with the product, to deliver content tailored to your needs, and to collect usage statistics."; marketing: "These cookies are used to target advertising to a user."; }; constructor(options: OptionsService); /** * Returns Cookie preferences configuration. * @returns {object} Return an object with cookie preferences configuration defined in application options. */ getCookiePreferencesConfig(): CookiePreferences; /** * Returns Cookie banner configuration. * @returns {object} Return an object with cookie banner configuration defined in application options. */ getCookieBannerSettings(): Partial<CookieBannerSettings>; /** * Converts the cookie preferences to boolean. Sets the cookie preferences configuration in local storage. * @param {object} cookiePreferences Object with cookie preferences configuration */ setCookies(cookiePreferences: CookiePreferences, policyVersion?: string): void; /** * Verifies that cookie banner should be shown. * @returns {boolean} Returns if the cookie banner should be shown. */ shouldShowCookieBanner(): boolean; /** * Gets the cookie preferences configuration from local storage. * @returns {object} Object with cookie preferences configuration. */ getUserCookiePreferences(): CookiePreferences; /** * Verifies that cookie preferences configuration is defined in the application options. * @returns {boolean} Returns if the cookie preferences configuration is defined. */ isConfigCookiePreferencesDefined(): boolean; /** * Verifies that functional cookies are enabled. * @returns {boolean} True when functional cookies are enabled. */ isFunctionalCookieEnabled(): boolean; /** * Description of cookies. * @param {'required' | 'functional' | 'marketing'} cookieType Takes one of the following options: 'required', 'functional', 'marketing'. * @returns {string} The default cookie description, if not explicitly defined in application options. */ getCookieDescription(cookieType: 'required' | 'functional' | 'marketing'): string; /** * Transforms cookie preferences configuration object to an array of cookie preferences objects. Each object in returned array contains cookie 'name', 'value' and 'isReadonly' property. * @param {object} cookiePreferences. * @returns {Array} Array shows if the cookie is Readonly. */ transformCookiePreferencesToList(cookiePreferences: CookiePreferences): Cookie[]; /** * Transforms an array of cookie preferences objects to cookie preferences configuration object. * @param {Array} cookiePreferencesList Array of cookie preferences. * @returns {object} An object with cookie preferences configuration. */ transformCookiePreferencesListToCookiePreferences(cookiePreferencesList: Cookie[]): CookiePreferences; private isPreviewMode; static ɵfac: i0.ɵɵFactoryDeclaration<CookieBannerService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<CookieBannerService>; } //# sourceMappingURL=cookie-banner.service.d.ts.map