# consent Cookie consent banner (GDPR): 4 categories (necessary / functional / analytics / marketing), stored in a versioned cookie, Google Consent Mode, content from the CookieSettings global. A settings window in three modes to pick from (`settings`: in the bar, small window, large window with cookie details). Default look in plain Tailwind, overridable. ## Dependency The banner uses an icon from `lucide-react` — a regular `dependencies` entry of the package (`^0.400.0`), installed together with IAPL; you add nothing in the project. ## Config The **CookieSettings** global — **Cookies** in the admin (slug `cookie-settings`, group *Privacy*) — is always built. Tabs: *Banner*, *Settings window*, *Categories*, *Cookie list*; with the cookie scanner also *Review and approve* and *Site check* (one entry for everything about cookies — see [cookie-scanner.md → Admin layout](./cookie-scanner.md#admin-layout)). Public read (`read: () => true` — the banner reads it for anonymous visitors); `update` is limited to the `admin` and `editor` roles (`adminOrEditor` — consent texts are legal copy, not for plain `user` accounts). To change it: `iapl({ globalOverrides: { 'cookie-settings': { access: { update } } } })`. The only plugin option in this module is `consentLog` (below). The editor manages the banner content (message, buttons, categories, settingsTitle) in the panel, localized. The privacy policy link comes from system pages (`privacyPolicy`), not from a separate field. **Privacy policy link in the banner (since 1.7.12)** — zero code: | What | Where from | |---|---| | Where it leads | Site settings → System pages → Privacy Policy | | Link text | Cookies → `privacyLinkLabel` (per language) | | When the text is empty | title of the policy page in that language | `privacyPolicy` options in `getConsentTexts`: omit (automatic), `false` (no link), `{ page }` (your own page, read with `locale: 'all'`). The `label` parameter is **deprecated** — text hard-coded in code breaks A0 with several languages; it works only when the panel field is empty. Remove it from projects when you update them. ## Front — Provider + banner Usually one line in the layout (PROGRAMISTA §2.8) — `SiteProviders` (`/rsc`) wires the provider, banner, button and `Analytics` in the right order, with texts from `getSiteShell(locale).consent`: ```tsx }>{children} ``` `SiteProviders` also takes `cookieMap`, `banner={false}`, `cookieButton={false}` (or your own element), `gpc` (Global Privacy Control, below), `maxAgeDays` (re-ask period), `logEndpoint` (default: the shell's consent log endpoint; `false` = not posted) and `analytics={false | { consentMode, defer, deferTimeoutMs }}` (`consentMode: 'basic'` = no Google request before consent — see [analytics.md](./analytics.md)). By hand (your own layout) — the same from the individual parts: The provider wraps the app; the banner and the button render themselves. Import from `@intecion/ipal-kit/client`: ```tsx // app/(frontend)/[locale]/layout.tsx import { ConsentProvider, CookieBanner, CookieButton } from '@intecion/ipal-kit/client' import { getConsentTexts } from '@intecion/ipal-kit' export default async function Layout({ children, params }) { const { locale } = await params const payload = await getPayload({ config }) // texts from Cookie banner; the policy link is automatic: // target = System pages → Privacy Policy, text = Cookies → privacyLinkLabel const texts = await getConsentTexts({ payload, config: i18nConfig, locale }) return ( {children} ) } ``` `ConsentProvider` — props: `texts` (required, `ConsentTexts` from `getConsentTexts`), `cookieMap` (extra cookies to delete on withdrawal), `logEndpoint` (consent log — pass `"/api/ipal/consent"` when you wire the provider by hand; `SiteProviders` does it itself), `gpc` (`'honour'` default, `'ask'`, `false` — [Global Privacy Control](#global-privacy-control-1170)), `maxAgeDays` (days a choice is kept, default 180), `nonce` (CSP nonce for the banner's first-paint script), `cookieValue` (optional server-read cookie — [First paint](#first-paint-the-banner-is-part-of-the-first-render-1170)). `CookieBanner` does not render after a decision, `CookieButton` — the opposite (it shows only after a decision and reopens the banner). Since 1.17.0 the banner is in the server HTML and painted with the page, not after hydration (next section). Built-in banner texts follow the page language: `consentFallback(locale)` → `CONSENT_FALLBACK_PL` on `pl`, `CONSENT_FALLBACK` (English) otherwise; panel values always win. Category names for your own selects: `CONSENT_CATEGORY_LABELS` (`{ en, pl }` per category), `consentCategoryOptions()`. `` takes `locale` and optional `labels`; defaults: `COOKIE_TABLE_LABELS` (`@intecion/ipal-kit/rsc`). `getConsentTexts({ payload, config, locale, privacyPolicy?, settingsSlug? })` — `settingsSlug` is the SiteSettings slug for the automatic link (default `'site-settings'`). Empty fields in the panel → English fallback. | `CookieBanner` prop | Default | Description | |---|---|---| | `classNames` | — | slots (table below) — a given one replaces the default | | `equalChoice` | `true` (since 1.17.0) | "Reject" styled like "Accept all"; `false` = the secondary look (before 1.17.0; iapl-doctor warns) | | `firstPaint` | `true` | banner in the server HTML, decided before the first paint; `false` = nothing until the page has hydrated (as before 1.17.0) | | `nonce` | provider's | CSP nonce for the first-paint script; default: the one given to `ConsentProvider` / `SiteProviders` | | `icon` | `true` | cookie icon | | `order` | `['settings', 'reject', 'accept']` | banner buttons; keep `'reject'` (a development warning and iapl-doctor say so when it is missing) | | `settings` | `'inline'` | `'inline' \| 'modal' \| 'detailed'` | | `controls` | `'checkbox'` | `'checkbox' \| 'switch'` | | `settingsActions` | `['back', 'save']` | buttons under the categories (`'accept' \| 'back' \| 'reject' \| 'save'`) | ### Where the cookie button sits (1.17.2) `CookieButton` is fixed in the **bottom corner of the window** — on every page, long or short, at every scroll position, on desktop and phone. It is a child of `` (never inside the footer) and it no longer climbs above the footer when the footer scrolls into view (1.12.x–1.17.1 did that: on a phone with a tall footer the button ended at the top of the screen, on a short page in the middle of it). One exception keeps every control reachable: **at the very end of the page**, where a visitor cannot scroll a covered link out from under a fixed button, the button steps up just far enough to lie on no link, button or form field (`stepAbove`; 8 px gap; never more than half the window, otherwise it stays in the corner). It then usually rests on plain text of the footer (the copyright line). Anywhere above the end of the page it stays in the corner: a covered control is one scroll away. The step is a `transform` — no layout shift. | Prop | Default | What it does | |---|---|---| | `side` | `'left'` | corner: `'left'` or `'right'` | | `clear` | `COOKIE_BUTTON_CLEAR` (links, buttons, form fields) | CSS selector of controls the button frees at the end of the page; `false` = stay in the corner whatever is under it | | `avoid` | — | placement before 1.17.2: a CSS selector the button lifts above while it is on screen — `avoid={COOKIE_BUTTON_AVOID}` (`'footer, [role="contentinfo"]'`) is exactly the old default (`bottomOverlap`). `false` = never move at all (also turns `clear` off) | | `className` | — | replaces the default classes; position is then yours too (the `clear` step applies only while your classes keep it `position: fixed`) | Position tokens: `--ipal-cookie-button-offset` (from the bottom, default `1rem`), `--ipal-cookie-button-inset` (from the side, default `1rem`); the device's safe-area insets (bottom and the chosen side) are added. z-index `--ipal-z-header` (default 40): above the page, below the banner, the settings window and the lightbox (50). Hidden while the banner is showing. Keyboard: a `