Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSP-98 Cookie Consent Configuration v3 #79

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Model/Config/NostoConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class NostoConfigService

public const ENABLE_STORE_ABANDONED_CART_DATA = 'storeAbandonedCartData';

public const ENABLE_IGNORE_COOKIE_CONSENT = 'ignoreCookieConsent';

public const DAILY_PRODUCT_SYNC_ENABLED = 'dailySynchronization';

public const DAILY_PRODUCT_SYNC_TIME = 'dailySynchronizationTime';
Expand Down
9 changes: 9 additions & 0 deletions src/Model/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ public function isEnabledStoreAbandonedCartData($channelId = null, $languageId =
);
}

public function isEnabledIgnoreCookieConsent($channelId = null, $languageId = null): bool
{
return $this->configService->getBool(
NostoConfigService::ENABLE_IGNORE_COOKIE_CONSENT,
$channelId,
$languageId
);
}

public function isDailyProductSyncEnabled($channelId = null, $languageId = null): bool
{
return $this->configService->getBool(NostoConfigService::DAILY_PRODUCT_SYNC_ENABLED, $channelId, $languageId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,24 @@
</sw-inherit-wrapper>
{% endblock %}

{% block nosto_integration_feature_ignore_cookie_consent %}
<sw-inherit-wrapper
v-model="actualConfigData['ignoreCookieConsent']"
:inheritedValue="configKey === null ? null : allConfigs['null']['ignoreCookieConsent']"
>
<template #content="props">
<sw-switch-field
:map-inheritance="props"
:label="$tc('nosto.configuration.featuresFlags.ignoreCookieConsent')"
:help-text="$tc('nosto.configuration.featuresFlags.ignoreCookieConsentHelpText')"
:disabled="props.isInherited"
:value="props.currentValue"
@change="props.updateCurrentValue"
/>
</template>
</sw-inherit-wrapper>
{% endblock %}

{% block nosto_integration_daily_synchronization_flag %}
<sw-inherit-wrapper
v-if="configKey === null"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"enableReloadRecommendations": "Empfehlungen neu laden, nachdem ein empfohlenes Produkt hinzugefügt wurde",
"enableLabelling": "Synchronisierung der Produktkennzeichnung aktivieren",
"storeAbandonedCartData": "Datenspeicherung für abgebrochene Warenkörbe",
"ignoreCookieConsent": "Cookie-Zustimmung ignorieren",
"enableDailySynchronization": "Tägliche Produktsynchronisierung aktivieren",
"enableDailySynchronizationHelp": "Wenn das Feld aktiviert ist, werden die Produkte jeden Tag zur angegebenen Zeit synchronisiert",
"timeDailySynchronization": "Zeit für die tägliche Produktsynchronisierung",
Expand All @@ -108,6 +109,7 @@
"enableReloadRecommendationsHelpText": "Wenn das Kontrollkästchen aktiviert ist, werden die Empfehlungen nach dem Hinzufügen eines empfohlenen Produkts neu geladen",
"enableLabellingHelpText": "Wenn das Kontrollkästchen aktiviert ist, werden die Produktetiketten an Nosto gesendet.",
"storeAbandonedCartDataHelpText": "Diese Konfigurationsoption steuert, ob Daten für abgebrochene Warenkörbe in der entsprechenden Datenbank Tabelle gespeichert werden sollen. Wenn diese Option aktiviert ist, ruft das System die Daten ab und erstellt neue Zeilen in der Tabelle für jeden abgebrochenen Warenkorb. Wenn sie deaktiviert ist, werden keine neuen Zeilen hinzugefügt, was möglicherweise Leistungsprobleme verhindert.",
"ignoreCookieConsentHelpText": "Wenn das Kontrollkästchen aktiviert ist, werden die Cookies für Nosto automatisch akzeptiert",
"categoryNamingHelpText": "Produktkategorienamen enthalten die Kategorie-ID oder nicht",
"categoryNaming": "Produktkategorienamen",
"categoryBlocklist": "Kategorie Ausschluss",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"enableReloadRecommendations": "Reload Recommendations After Adding a recommended product",
"enableLabelling": "Enable Product Labelling Sync",
"storeAbandonedCartData": "Store data for abandoned carts",
"ignoreCookieConsent": "Ignore cookie consent",
"enableDailySynchronization": "Enable Daily Product Synchronization",
"enableDailySynchronizationHelp": "If the field is enabled products will be synchronized at the mentioned time each day",
"timeDailySynchronization": "Time for Daily Product Synchronization",
Expand All @@ -108,6 +109,7 @@
"enableReloadRecommendationsHelpText": "If the checkbox is checked, the recommendations will be reloaded after adding a recommended product",
"enableLabellingHelpText": "If the checkbox is checked, product labels will be sent to Nosto",
"storeAbandonedCartDataHelpText": "This configuration option controls whether data for abandoned carts should be stored in the relevant table. When this option is enabled, the system will fetch and create new rows in the table for each abandoned cart. If disabled, no new rows will be added, potentially preventing performance issues.",
"ignoreCookieConsentHelpText": "If the checkbox is checked, cookies for Nosto will be automatically accepted",
"categoryNamingHelpText": "Product category names will contain the category ID or not",
"categoryNaming": "Product Category Names",
"categoryBlocklist": "Category Exclusion",
Expand Down
5 changes: 4 additions & 1 deletion src/Subscriber/FrontendSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ public function onKernelResponse(ResponseEvent $event): void

private function migrateOverdoseCookie(Response $response, Request $request): void
{
if ($request->cookies->has(NostoCookieProvider::LEGACY_COOKIE_KEY)) {
if (
$request->cookies->has(NostoCookieProvider::LEGACY_COOKIE_KEY) ||
$this->configProvider->isEnabledIgnoreCookieConsent()
) {
$cookie = Cookie::create(NostoCookieProvider::LEGACY_COOKIE_KEY, '1', strtotime('-1 day'))
->withHttpOnly(false);
$cookie->setSecureDefault($request->isSecure());
Expand Down
Loading