core/bootstrap/cookie-banner/cookie-banner.service.ts
This service is handling the cookie banner and cookie preferences related logic.
Properties |
|
Methods |
constructor(options: OptionsService)
|
||||||
Parameters :
|
getCookieBannerSettings |
getCookieBannerSettings()
|
Returns Cookie banner configuration.
Returns :
CookieBannerSettings
Return an object with cookie banner configuration defined in application options. |
getCookieDescription | ||||||||
getCookieDescription(cookieType: "required" | "functional" | "marketing")
|
||||||||
Description of cookies.
Parameters :
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 :
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 :
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 :
Returns :
Cookie[]
Array shows if the cookie is Readonly. |
Readonly COOKIE_BANNER |
COOKIE_BANNER:
|
Type : string
|
Default value : 'cookieBanner'
|
Readonly COOKIE_PREFERENCES_CONFIG |
COOKIE_PREFERENCES_CONFIG:
|
Type : string
|
Default value : 'cookiePreferences'
|
cookieDescriptions |
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.')
}
|
isCookieBannerShowed$ |
isCookieBannerShowed$:
|
Type : Subject<boolean>
|
Default value : new Subject()
|
Readonly STORAGE_KEY |
STORAGE_KEY:
|
Type : string
|
Default value : 'acceptCookieNotice'
|