diff --git a/assets/styles/app.scss b/assets/styles/app.scss index b72cc98fb6..9f21b4ab83 100644 --- a/assets/styles/app.scss +++ b/assets/styles/app.scss @@ -452,27 +452,60 @@ blockquote.blockquote { } :root{ + --spacer: #{$spacer}; +} + +#cc-main { --cc-font-family: var(--bs-body-font-family); --cc-bg: var(--bs-body-bg); - --cc-z-index: 2147483647; - --cc-text: var(--bs-body-color); - --cc-border-radius: var(--bs-border-radius-lg); + --cc-primary-color: var(--bs-body-color); + --cc-secondary-color: var(--bs-body-color); + --cc-modal-border-radius: var(--bs-border-radius-lg); --cc-btn-primary-bg: var(--bs-primary); --cc-btn-primary-hover-bg: var(--bs-primary-text-emphasis); --cc-btn-secondary-bg: var(--bs-gray-300); - --cc-btn-secondary-text: var(--bs-body-color); --cc-btn-secondary-hover-bg: var(--bs-gray-400); --cc-btn-border-radius: var(--bs-border-radius); - --cc-toggle-bg-off: var(--bs-gray-600); - --cc-toggle-bg-readonly: var(--bs-gray-300); + --cc-toggle-on-bg: var(--cc-btn-primary-bg); + --cc-toggle-off-bg: var(--bs-gray-600); + --cc-toggle-readonly-bg: var(--bs-gray-300); --cc-cookie-category-block-bg: var(--bs-gray-200); - --cc-cookie-category-block-bg-hover: var(--bs-gray-300); - --cc-section-border: var(--bs-border-color); - --cc-cookie-table-border: var(--bs-border-color); + --cc-cookie-category-block-hover-bg: var(--bs-gray-300); + --cc-section-category-border: var(--bs-border-color); + --cc-cookie-category-block-border: var(--bs-border-color); --cc-overlay-bg: var(--bs-black); - --cc-overlay-opacity: .5; - --cc-consent-modal-box-shadow: var(--bs-box-shadow-lg); - --spacer: #{$spacer}; + + .cc--anim { + .pm-wrapper .pm-overlay, .cm-wrapper:before { + opacity: .5 !important; + } + } + + .cc-link { + &, &:hover { + color: var(--cc-btn-primary-bg); + } + } + + .cm__desc { + color: inherit; + } + + .cm { + box-shadow: var(--bs-box-shadow-lg); + } + + .pm button[data-role="necessary"]{ + background-color: var(--cc-btn-secondary-bg); + border-color: var(--cc-btn-secondary-border-color); + color: var(--cc-btn-secondary-color); + + &:hover { + background: var(--cc-btn-secondary-hover-bg); + border-color: var(--cc-btn-secondary-hover-border-color); + color: var(--cc-btn-secondary-hover-color); + } + } } .medium-zoom-overlay { diff --git a/plugins/cookieconsent.client.ts b/plugins/cookieconsent.client.ts index 2e527aa4f1..93b8a5e7ab 100644 --- a/plugins/cookieconsent.client.ts +++ b/plugins/cookieconsent.client.ts @@ -1,9 +1,8 @@ -import 'vanilla-cookieconsent' +import * as CookieConsent from "vanilla-cookieconsent"; import posthog from 'posthog-js' import axios from "axios"; export default defineNuxtPlugin(nuxtApp => { - let isProd = process.env.NODE_ENV === "production"; const isEurope = Intl.DateTimeFormat().resolvedOptions().timeZone.indexOf("Europe") === 0; nuxtApp.hook('page:finish', () => { @@ -37,88 +36,79 @@ export default defineNuxtPlugin(nuxtApp => { }; + const cookieConsent = CookieConsent; + nuxtApp.provide("cookieConsent", cookieConsent); const enabledMarketing = () => { - cookieConsent.loadScript('https://js-eu1.hs-scripts.com/27220195.js', () => {}, [{name: "defer", value: "defer"}]); + return cookieConsent.loadScript('https://js-eu1.hs-scripts.com/27220195.js',{defer: "defer"}); }; - const cookieConsent = window.initCookieConsent() - - if (!isEurope) { - enabledAnalytics(); - enabledMarketing(); - - return; - } - - // @ts-ignore cookieConsent.run({ - autorun: true, - current_lang: 'en', - autoclear_cookies: false, - gui_options: { - consent_modal: { - swap_buttons: true + mode: isEurope ? 'opt-in' : 'opt-out', + manageScriptTags: true, + disablePageInteraction: true, + guiOptions: { + consentModal: { + layout: 'box inline', + flipButtons: true } }, - page_scripts: true, - force_consent: true, - onAccept: () => { - if (cookieConsent.allowedCategory('analytics')) { + autoClearCookies: false, + onConsent: ({cookie}) => { + let consentCategories = cookie.categories; + if (consentCategories.includes('analytics')) { enabledAnalytics(); } - if (cookieConsent.allowedCategory('marketing')) { + if (consentCategories.includes('marketing')) { enabledMarketing(); } }, - - languages: { - en: { - consent_modal: { - title: 'I use cookies', - description: 'Hi, this website uses analytics & marketing cookies to understand how you interact with it to continuously improve your user experience. Read more', - primary_btn: { - text: 'Accept', - role: 'accept_all' // 'accept_selected' or 'accept_all' - }, - secondary_btn: { - text: 'Settings', - role: 'settings' // 'settings' or 'accept_necessary' + categories: { + analytics: { + enabled: true, + readOnly: false, + }, + marketing: { + enabled: true, + readOnly: false, + } + }, + language: { + default: 'en', + translations: { + en: { + consentModal: { + title: 'I use cookies', + description: 'Hi, this website uses analytics & marketing cookies to understand how you interact with it to continuously improve your user experience. Read more', + acceptAllBtn: 'Accept', + showPreferencesBtn: 'Settings' }, - }, - settings_modal: { - title: 'Cookie preferences', - save_settings_btn: 'Save settings', - accept_all_btn: 'Accept all', - reject_all_btn: 'Reject all', - blocks: [ - { - title: 'Cookie usage', - description: 'I use cookies to enhance your online experience. You can choose for each category to opt-in/out whenever you want.' - }, - { - title: 'Analytics cookies', - description: 'These cookies collect information about how you use the website, which pages you visited and which links you clicked on. All of the data is anonymized and cannot be used to identify you.', - toggle: { - value: 'analytics', - enabled: true, - readonly: false - } - }, - { - title: 'Marketing cookies', - description: 'These cookies tracks your activities on our site to allow commercials to eventually reach out.', - toggle: { - value: 'marketing', - enabled: true, - readonly: false + preferencesModal: { + title: 'Cookie preferences', + savePreferencesBtn: 'Save settings', + acceptAllBtn: 'Accept all', + acceptNecessaryBtn: 'Reject all', + sections: [ + { + title: 'Cookie usage', + description: 'I use cookies to enhance your online experience. You can choose for each category to opt-in/out whenever you want.' + }, + { + title: 'Analytics cookies', + description: 'These cookies collect information about how you use the website, which pages you visited and which links you clicked on. All of the data is anonymized and cannot be used to identify you.', + linkedCategory: 'analytics', + }, + { + title: 'Marketing cookies', + description: 'These cookies tracks your activities on our site to allow commercials to eventually reach out.', + linkedCategory: 'marketing' + }, + { + title: 'More information', + description: 'For any queries in relation to our policy on cookies and your choices, please contact us.', } - }, - { - title: 'More information', - description: 'For any queries in relation to our policy on cookies and your choices, please contact us.', - } - ] + ] + } } } }