From 74ff1ed8ea97ef554ac8c9bf8dd53ec9e7c5da2e Mon Sep 17 00:00:00 2001 From: Silke Date: Fri, 9 Jun 2023 12:47:31 +0200 Subject: [PATCH 1/8] feat: save language selection as cookie --- docs/guides/cookie-consent.md | 13 +++++++------ .../language-switch.component.html | 2 +- .../language-switch.component.spec.ts | 7 ++++++- .../language-switch/language-switch.component.ts | 15 ++++++++++++++- src/environments/environment.model.ts | 2 +- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/docs/guides/cookie-consent.md b/docs/guides/cookie-consent.md index 1405129e81..d5e237fb85 100644 --- a/docs/guides/cookie-consent.md +++ b/docs/guides/cookie-consent.md @@ -33,7 +33,7 @@ cookieConsentOptions: { description: 'cookie.consent.option.tracking.description', }, }, - allowedCookies: ['cookieConsent', 'apiToken'], + allowedCookies: ['apiToken', 'cookieConsent', 'preferredLocale'], }, ``` @@ -42,7 +42,7 @@ The `options` array configures the presented options in the _Cookie Preferences_ - The option `id` is the value that will be stored in the user's `cookieConsent` settings. - The `name` makes up the checkbox label name, usually given as localization key. - The `description` contains the additional option description, usually given as localization key. -- With the `required` flag, an option can be marked as not deselectable. +- With the `required` flag, an option can be marked as not non-selectable. In this way, the user can be informed that necessary cookies are always set without explicit consent of the user. The following screenshot is the rendered representation of the default cookie consent options configuration: @@ -100,10 +100,11 @@ This route can be linked to from anywhere within the application. ## PWA Required Cookies -| Name | Expiration | Provider | Description | Category | -| ------------- | ---------- | ------------- | ----------------------------------------------------------------- | ----------- | -| apiToken | 1 year | Intershop PWA | The API token used by the Intershop Commerce Management REST API. | First Party | -| cookieConsent | 1 year | Intershop PWA | Saves the user's cookie consent settings. | First Party | +| Name | Expiration | Provider | Description | Category | +| --------------- | ---------- | ------------- | ----------------------------------------------------------------- | ----------- | +| apiToken | 1 year | Intershop PWA | The API token used by the Intershop Commerce Management REST API. | First Party | +| cookieConsent | 1 year | Intershop PWA | Saves the user's cookie consent settings. | First Party | +| preferredLocale | 1 year | Intershop PWA | Saves the user's language selection. | First Party | ## Disabling the Integrated Cookie Consent Handling diff --git a/src/app/shell/header/language-switch/language-switch.component.html b/src/app/shell/header/language-switch/language-switch.component.html index d2c99eea73..eadcaafe65 100644 --- a/src/app/shell/header/language-switch/language-switch.component.html +++ b/src/app/shell/header/language-switch/language-switch.component.html @@ -25,7 +25,7 @@