diff --git a/COOKIE-CONSENT.md b/COOKIE-CONSENT.md index f5091bf..b57a0c4 100644 --- a/COOKIE-CONSENT.md +++ b/COOKIE-CONSENT.md @@ -19,16 +19,16 @@ Категории `COOKIE_CATEGORIES` — в `src/const/const.ts`. Типы `CookieCategoryId` и `CookieConsent` — в `src/types/types.ts`. -| id | Название | Обязательные | -| ------------- | --------------------- | :----------: | -| `necessary` | Обязательные cookie | ✅ да | -| `functional` | Функциональные cookie | ❌ нет | -| `statistical` | Статистические cookie | ❌ нет | -| `marketing` | Маркетинговые cookie | ❌ нет | +| id | Название | Обязательные | +| ------------- | ------------------------------ | :----------: | +| `necessary` | Строго необходимые cookies | ✅ да | +| `performance` | Cookies производительности | ❌ нет | +| `functional` | Функциональные cookies | ❌ нет | +| `targeting` | Целевые и аналитические cookies| ❌ нет | ```typescript // src/types/types.ts -export type CookieCategoryId = 'necessary' | 'functional' | 'statistical' | 'marketing' +export type CookieCategoryId = 'necessary' | 'performance' | 'functional' | 'targeting' export type CookieConsent = Record ``` @@ -44,7 +44,7 @@ SSR: layout.tsx читает куку cookie-consent из заголовков Провайдер сразу знает состояние — баннер либо скрыт, либо показан с первого рендера ``` -- Кука есть → `initialConsent = { necessary: true, statistical: true, ... }` → баннер не рендерится +- Кука есть → `initialConsent = { necessary: true, performance: true, ... }` → баннер не рендерится - Куки нет → `initialConsent = null` → баннер показывается сразу --- @@ -78,7 +78,7 @@ import { useCookieConsent } from '@/context/CookieConsentContext' export default function AdBlock() { const { consent } = useCookieConsent() - if (!consent.marketing) return null + if (!consent.targeting) return null return
Реклама
} @@ -102,11 +102,11 @@ export default function MyAnalytics() { const { registerCallback } = useCookieConsent() useEffect(() => { - registerCallback('statistical', () => { + registerCallback('performance', () => { console.log('Загружаем метрику...') }) - registerCallback('marketing', () => { + registerCallback('targeting', () => { console.log('Загружаем VK Pixel...') }) }, [registerCallback]) @@ -142,8 +142,8 @@ export default function CookieSettingsButton() { ```tsx useEffect(() => { - // Яндекс.Метрика (statistical) - registerCallback('statistical', () => { + // Яндекс.Метрика (performance) + registerCallback('performance', () => { const counterId = process.env.NEXT_PUBLIC_METRIKA_ID if (!counterId || (window as any).ym) return const script = document.createElement('script') @@ -151,8 +151,8 @@ useEffect(() => { document.head.appendChild(script) }) - // VK Pixel или Google Ads (marketing) - registerCallback('marketing', () => { + // VK Pixel или Google Ads (targeting) + registerCallback('targeting', () => { // вставить скрипт пикселя }) @@ -171,12 +171,12 @@ useEffect(() => { Пользователь открыл сайт → layout читает куку (SSR) → CookieConsentProvider(initialConsent) - → ServicesInit монтируется: registerCallback('statistical', fn), ... - ├─ consent.statistical = true → fn() вызывается сразу - └─ consent.statistical = false → fn() ждёт + → ServicesInit монтируется: registerCallback('performance', fn), ... + ├─ consent.performance = true → fn() вызывается сразу + └─ consent.performance = false → fn() ждёт Пользователь нажал «Принять все» - → saveConsent({ necessary:true, functional:true, statistical:true, marketing:true }) + → saveConsent({ necessary:true, performance:true, functional:true, targeting:true }) → document.cookie = 'cookie-consent=...' (max-age 1 год, SameSite=Lax) → setConsent(...) → useEffect в провайдере срабатывает → все зарегистрированные колбеки для принятых типов вызываются @@ -191,7 +191,7 @@ useEffect(() => { Имя: cookie-consent Формат: URL-encoded JSON Пример: %7B%22necessary%22%3Atrue%2C%22functional%22%3Afalse%2C%22statistical%22%3Atrue%2C%22marketing%22%3Afalse%7D -Декод.: {"necessary":true,"functional":false,"statistical":true,"marketing":false} +Декод.: {"necessary":true,"performance":false,"functional":true,"targeting":false} Срок: 1 год (max-age=31536000) Флаги: path=/; SameSite=Lax ``` diff --git a/src/components/CookieBanner/CookieBannerClient.tsx b/src/components/CookieBanner/CookieBannerClient.tsx index e798621..e0a7577 100644 --- a/src/components/CookieBanner/CookieBannerClient.tsx +++ b/src/components/CookieBanner/CookieBannerClient.tsx @@ -17,19 +17,19 @@ export default function CookieBannerClient({ cookiePolicyUrl }: Props): JSX.Elem const [showDetails, setShowDetails] = useState(false) const [selected, setSelected] = useState({ necessary: true, + performance: consent.performance, functional: consent.functional, - statistical: consent.statistical, - marketing: consent.marketing, + targeting: consent.targeting, }) if (!isBannerVisible) return null const acceptAll = () => { - saveConsent({ necessary: true, functional: true, statistical: true, marketing: true }) + saveConsent({ necessary: true, performance: true, functional: true, targeting: true }) } const acceptNecessary = () => { - saveConsent({ necessary: true, functional: false, statistical: false, marketing: false }) + saveConsent({ necessary: true, performance: false, functional: false, targeting: false }) } const saveSelected = () => { diff --git a/src/components/Footer/Footer.module.scss b/src/components/Footer/Footer.module.scss index e38b9c7..282b6a9 100644 --- a/src/components/Footer/Footer.module.scss +++ b/src/components/Footer/Footer.module.scss @@ -95,6 +95,10 @@ } } + @media (max-width: $tablet-mid-width) { + text-align: center; + } + &:focus-visible { border-radius: 2px; outline: 2px solid $accent-add-bg; diff --git a/src/components/Forms/FormCalculation/FormCalculationClient.tsx b/src/components/Forms/FormCalculation/FormCalculationClient.tsx index c8cb325..a66f94b 100644 --- a/src/components/Forms/FormCalculation/FormCalculationClient.tsx +++ b/src/components/Forms/FormCalculation/FormCalculationClient.tsx @@ -164,7 +164,7 @@ export default function FormCalculationClient({ prices: initialPrices }: Props):