File

core/bootstrap/cookie-banner/cookie-banner.service.ts

Description

This service is handling the cookie banner and cookie preferences related logic.

Index

Properties
Methods

Constructor

constructor(options: OptionsService)
Parameters :
Name Type Optional
options OptionsService No

Methods

getCookieBannerSettings
getCookieBannerSettings()

Returns Cookie banner configuration.

Return an object with cookie banner configuration defined in application options.

getCookieDescription
getCookieDescription(cookieType: "required" | "functional" | "marketing")

Description of cookies.

Parameters :
Name Type Optional Description
cookieType "required" | "functional" | "marketing" No

Takes one of the following options: 'required', 'functional', 'marketing'.

Returns : string

The default cookie description, if not explicitly defined in application options.

getCookiePreferencesConfig
getCookiePreferencesConfig()

Returns Cookie preferences configuration.

Returns : CookiePreferences

Return an object with cookie preferences configuration defined in application options.

getUserCookiePreferences
getUserCookiePreferences()

Gets the cookie preferences configuration from local storage.

Returns : CookiePreferences

Object with cookie preferences configuration.

isConfigCookiePreferencesDefined
isConfigCookiePreferencesDefined()

Verifies that cookie preferences configuration is defined.

Returns : boolean

Returns if the cookie preferences configuration is defined.

isFunctionalCookieEnabled
isFunctionalCookieEnabled()

Verifies that functional cookies are enabled.

Returns : boolean

True when functional cookies are enabled.

setCookies
setCookies(cookiePreferences: CookiePreferences)

Converts the cookie preferences to boolean. Sets the cookie preferences configuration in local storage.

Parameters :
Name Type Optional Description
cookiePreferences CookiePreferences No

Object with cookie preferences configuration

Returns : void
shouldShowCookieBanner
shouldShowCookieBanner()

Verifies that cookie banner should be shown.

Returns : boolean

Returns if the cookie banner should be shown.

transformCookiePreferencesListToCookiePreferences
transformCookiePreferencesListToCookiePreferences(cookiePreferencesList: Cookie[])

Transforms an array of cookie preferences objects to cookie preferences configuration object.

Parameters :
Name Type Optional Description
cookiePreferencesList Cookie[] No

Array of cookie preferences.

Returns : CookiePreferences

An object with cookie preferences configuration.

transformCookiePreferencesToList
transformCookiePreferencesToList(cookiePreferences: CookiePreferences)

Transforms cookie preferences configuration object to an array of cookie preferences objects. Each object in returned array contains cookie 'name', 'value' and 'isReadonly' property.

Parameters :
Name Type Optional
cookiePreferences CookiePreferences No
Returns : Cookie[]

Array shows if the cookie is Readonly.

Properties

Readonly COOKIE_BANNER
Type : string
Default value : 'cookieBanner'
Readonly COOKIE_PREFERENCES_CONFIG
Type : string
Default value : 'cookiePreferences'
cookieDescriptions
Type : object
Default value : { required: gettext( "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: gettext( 'These cookies are used to track site usage and to process my personal data to measure and improve usability and performance. We will neither forward this data to any third party nor use this data for direct marketing purposes. I recognize that I can opt in and out of these cookies at any time.' ), marketing: gettext('These cookies are used to target advertising to a user.') }
Readonly IS_PREVIEW
Type : string
Default value : 'preview'
isCookieBannerShowed$
Type : Subject<boolean>
Default value : new Subject()
Readonly PREVIEW_COOKIE_BANNER
Type : string
Default value : 'previewCookieBanner'
Readonly STORAGE_KEY
Type : string
Default value : 'acceptCookieNotice'

results matching ""

    No results matching ""