Consent compliance: docs, agent guide, skills, changelog, shared behaviour spec, browser check, reference e2e

- docs/consent.md: compliance defaults, Global Privacy Control, withdrawal, consent log on by default and the SQL
  migration; no more "UODO requirement" or "GPC not needed". docs/analytics.md: what Consent Mode advanced sends.
- docs/consent-behaviour-spec.md: the behaviour IAPL and IAWL share, with the 13-item test list.
- CHANGELOG 1.17.0: the SQL migration first, a before → after table for an existing site.
- AGENT.md, iapl-setup / iapl-upgrade / iapl-reference / iapl-consent-check, PROGRAMISTA item 78; reference skills copy.
- iapl-consent-check: Global Privacy Control, equal prominence and withdrawal runs; Google asset warnings.
- Reference site uses the new defaults; e2e for GPC, a stale grant, equal prominence, withdrawal; e2e:built runs every
  consent test in both bundlers. YouTubeEmbed warns in development without a poster.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 13:48:19 +01:00
co-authored by Claude Opus 5.5
parent 99036eb70c
commit f5c53e4523
33 changed files with 821 additions and 112 deletions
+80 -2
View File
@@ -12,8 +12,10 @@ once there are more than 20.
## 1.17.0 — the plugin is called IAPL; mail works with no setup
> **Read before upgrading.** In this order: the security follow-ups prepared as 1.16.8 (never released on their
> own), e-mail, the new name, the speed of public pages (one line in `next.config.ts`), then Postgres (nothing to do).
> No schema or migration on any database.
> own), e-mail, the new name, the speed of public pages (one line in `next.config.ts`), consent, then Postgres
> (nothing to do). **One schema change, on Postgres / SQLite only:** the consent log is now on by default — a project
> that never had `consentLog` on creates and applies a migration in the same deploy, or sets `consentLog: false`
> (below, "Consent"). MongoDB: no migration.
>
> **Security first — prepared as 1.16.8, released here.** No option, schema, migration or import-map change. Three points:
> **A site built with Turbopack** (`next build` without `--webpack`) published the plugin's `package.json` (registry
@@ -54,6 +56,15 @@ once there are more than 20.
> `withPayload(withSecurityConfig(nextConfig))` becomes `withSecurityConfig(withPayload(nextConfig))`; a panel not at
> `/admin` adds `{ adminClientHints: { route } }`. Without that line the site works exactly as before.
>
> **Consent** — what a visitor of an existing site sees change: **"Reject" looks like "Accept all"** (it was a plain
> text button); one more sentence in the **default** banner text (only where the panel's message is empty); a browser
> that sends **Global Privacy Control** gets no banner, no tracker request (also not Google's in Consent Mode
> `advanced`) and can opt in from the cookie button. **Every choice is recorded** in *Privacy → Consent records* (the
> consent log is on by default; no IP, no user agent). Withdrawing now stops Meta, TikTok and Clarity at once.
> Consent Mode stays `advanced`. Each change has an opt-out (table under "Requires project changes"). **Postgres /
> SQLite:** `pnpm payload migrate:create consent-log` in the same deploy, or `iapl({ consentLog: false })` — without
> either the site works but no choice is recorded (one log line, a doctor error).
>
> **Postgres** (nothing to do): many form submissions or "forgot password" requests at the same moment no longer stop
> the site; form and account mail go out right after the commit. Details under "Fixed — Postgres".
@@ -190,6 +201,33 @@ once there are more than 20.
real tracing library around access rules.
### Requires project changes
- **Postgres / SQLite, consent log (first, before the deploy):** the consent log (`consent-records`) is now on by
default. A project that did not set `consentLog` before gets a **new table**: run `pnpm payload migrate:create
consent-log`, commit the migration and have it applied when the new container starts (`prodMigrations`, or the start
command `pnpm payload migrate && pnpm start`) — **in the same deploy**. Or set `iapl({ consentLog: false })`. Without
either nothing breaks: the page and the banner work, `POST /api/ipal/consent` answers `503`, the server logs once
"the consent-records table does not exist…", and `iapl-doctor` reports `consent-log-migration` (error). A project
that already had `consentLog: true`: nothing. **MongoDB** (the eight client sites): nothing — the collection
appears by itself.
- **Generated types:** where the consent log was off, `payload generate:types` adds the `consent-records` collection
(`ConsentRecord`, its select type); run it and commit. The import map does not change (the log has no admin
component).
- **What changes for an existing site on upgrade — consent** (an unedited 1.16.7 site, `SiteProviders` layout):
| | Before | After | Opt-out |
|---|---|---|---|
| "Reject" on the banner | plain text button next to a filled "Accept all" | the same filled button as "Accept all" | `<CookieBanner equalChoice={false} />` |
| Default banner text (panel message empty) | "…or choose which to allow." | + "You can change your choice at any time with the cookie button, and set cookie rules in your browser too." (Polish: the same sentence in Polish) | write the message in Cookies → *Banner* |
| A visitor whose browser sends Global Privacy Control, no choice yet | the banner; in Consent Mode `advanced` the Google tag loaded and pinged before a choice | no banner (decided before the first paint), the cookie button; nothing sent to Google or a pixel; nothing stored. Analytics no longer counts these visitors unless they opt in from the cookie button (share unknown; Brave, DuckDuckGo, Firefox private windows today) | `<SiteProviders gpc="ask">` (banner, still nothing sent before a choice) or `gpc={false}` (ignored) |
| Such a visitor who had clicked "Accept all" **after** 1.17.0 without the signal, and turns it on later | — | analytics and marketing switched off on the next page, their cookies deleted, the record rewritten and logged | `gpc={false}` |
| Such a visitor whose choice dates from before 1.17.0 | — | the choice stands until it expires (180 days) or they change it | — |
| Consent log | none unless `consentLog: true` | every choice stored in *Privacy → Consent records* (admin only): random id, choices, policy version, time; purged after 3 years | `iapl({ consentLog: false })`; one layout: `logEndpoint={false}` |
| Withdrawing (cookie button → "Reject") | cookies deleted; Meta, Clarity, LinkedIn, TikTok kept running until the next page | the same, plus Meta, TikTok and Clarity told at once, listed local / session storage keys removed | — |
| Clarity on a site without GA4 / GTM | never got a consent signal: ran without cookies for EEA visits (every page view a new visitor) | `consentv2` sent when it loads: sessions hold together after consent | — |
| Google tag | Consent Mode default | the same, plus `ads_data_redaction` (no ad-click ids in Ads requests while marketing is denied) | — |
| Consent Mode | `advanced` | `advanced` (unchanged) | `consentMode: 'basic'` |
| Schema | — | MongoDB: a new collection, created by itself. Postgres / SQLite: a new table (migration above) | `consentLog: false` |
- **A CI that compares generated types:** `payload generate:types` gives a diff on upgrade — four field descriptions
of Site integrations changed (no type did). Run it and commit `payload-types.ts`. The import map does not change.
- **Nothing else has to be run.** The e-mail tab of Site integrations has a new block ("How e-mails are sent"); it is
@@ -237,6 +275,23 @@ once there are more than 20.
upgrade. Run `pnpm exec iapl-skills` and commit in the same change as the version bump.
### Changed
- **Consent: "Reject" is as prominent as "Accept all" by default** (`equalChoice` defaults to `true`). The EDPB
Cookie Banner Taskforce (2023) found a missing or weaker reject option an infringement for most authorities; a UODO
article repeats it. `equalChoice={false}` restores the secondary look; `iapl-doctor` (`consent-banner`) warns, and a
development console warning names a banner `order` without `'reject'`.
- **Consent log on by default** (`consentLog` — `false` turns it off). `<SiteProviders>` posts every decision to it by
itself: `getSiteShell` gives `consentLogEndpoint` (`'/api/ipal/consent'` with the config's API route, `null` when
the log is off); `logEndpoint={false}` stops one layout. A write without its SQL table answers `503` and logs one line
per process. The posted body gains `gpc`; the record's fields are unchanged.
- **Consent: withdrawal stops the tools already running** — `fbq('consent', 'revoke')`, `ttq.revokeConsent()`,
`clarity('consent', false)` (and `grant` / `consentv2` on a new grant), and the panel's listed local / session
storage keys of the category are removed with its cookies (also the panel's listed cookie names). Clarity gets
`consentv2` when it loads. `ads_data_redaction: true` is set with the Consent Mode default.
- **Default banner text** (English and Polish, used only when the panel's message is empty): one more sentence on
changing the choice with the cookie button and setting cookie rules in the browser (PKE art. 399 asks for the latter).
- **Docs:** `docs/consent.md` no longer calls equal choice a "UODO requirement" (it is the EDPB authorities' position,
repeated by UODO; no UODO or UKE banner decision was found) and no longer says Global Privacy Control is not needed.
`docs/analytics.md` says what Consent Mode `advanced` sends before consent.
- **The cookie banner is part of the first render** ([consent.md → First paint](./consent.md#first-paint-the-banner-is-part-of-the-first-render-1170)).
Until now `<CookieBanner>` rendered nothing until the page had hydrated, so on a first visit its text appeared late
and on a text page became the LCP element (reference site, mobile profile, 4x CPU, slow 4G: page painted at 1.0 s,
@@ -274,6 +329,29 @@ once there are more than 20.
keep their doctor rule ids, so settings in a project's doctor file still match.
### Added
- **Global Privacy Control honoured** ([consent.md → Global Privacy Control](./consent.md#global-privacy-control-1170)):
a browser that sends `Sec-GPC: 1` / `navigator.globalPrivacyControl` gets no banner, analytics and marketing stay off
and nothing is sent to Google (also in Consent Mode `advanced`) or a pixel; the visitor can still opt in from the
cookie button, and that choice wins (stored with `gpc: true`). A grant made without the signal gives way when the
signal appears. Decided in the browser before the first paint — pages stay static, no `Vary`. Options:
`gpc: 'honour' | 'ask' | false` on `SiteProviders` / `ConsentProvider` / `consentBannerScript`. Building blocks:
`resolveConsent`, `gpcFromNavigator`, `gpcFromHeaders`, `GPC_CATEGORIES`, `GPC_HEADER`, `gpcWellKnown`
(`/.well-known/gpc.json`), types `GpcMode`, `ResolvedConsent`; `/client`: `readEffectiveConsent`, `signalVendors`,
`clarityConsent`. The consent record gains `gpc`; the statistics endpoint keeps a visitor id out while the signal
overrides a choice made without it. Text: `texts.gpcNotice` (PL / EN), class slot `gpcNotice`.
- **`maxAgeDays`** on `SiteProviders` / `ConsentProvider` / `useConsent`: the re-ask period (default 180 days).
- **`CONSENT_LOG_PATH`** (`'/ipal/consent'`).
- **Doctor rules** `consent-log-migration` (Postgres / SQLite with the log on and no migration creating
`consent_records`: error) and `consent-banner` (`equalChoice={false}`, an `order` without `'reject'`, `gpc={false}`,
`cookieButton={false}` with no `reopen`, a hand-wired `ConsentProvider` without `logEndpoint`: warnings; `gpc="ask"`:
info; the crawl judging another Consent Mode than the layout: warning).
- **`iapl-consent-check`**: five runs — adds Global Privacy Control, equal prominence (computed size and look of
"Reject" against "Accept all") and withdrawal; warns about YouTube thumbnails, Google Fonts and the Maps API loaded
before a choice. `<YouTubeEmbed>` warns in development when it has no `poster`.
- **[consent-behaviour-spec.md](./consent-behaviour-spec.md)** — the behaviour IAPL and IAWL share: categories, the
record and cookie, Consent Mode mapping, Global Privacy Control, equal prominence in testable terms, the shared test
list. **[dev/consent-compliance-proposal.md](./dev/consent-compliance-proposal.md)** — where the banner stands
against the rules, with sources.
- **Payload's colour-scheme client hints go to the admin only** ([security.md](./security.md) "Client hints").
`withSecurityConfig(withPayload(nextConfig))` — the wrapper **outside** `withPayload` — moves `Accept-CH`,
`Critical-CH` and `Vary: Sec-CH-Prefers-Color-Scheme` from `/:path*` to `/admin/:path*`. Before, every public
+2 -1
View File
@@ -24,7 +24,8 @@ API details — one file per module:
| GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok, `defer` | [analytics.md](./analytics.md) |
| Blocks, RenderBlocks, enhanceProps | [blocks.md](./blocks.md) |
| Block library: ready sections, page templates | [block-library.md](./block-library.md) |
| Cookie consent, banner, settings window (in the bar / modal / large with cookie details) | [consent.md](./consent.md) |
| Cookie consent, banner, settings window (in the bar / modal / large with cookie details), Global Privacy Control | [consent.md](./consent.md) |
| The consent behaviour IAPL and IAWL share (record, categories, GPC, equal prominence, tests) | [consent-behaviour-spec.md](./consent-behaviour-spec.md) |
| Cookie scanner: review list of drafts, "Scan cookies", Open Cookie Database lookup (optional) | [cookie-scanner.md](./cookie-scanner.md) |
| Under construction — locks subpages behind a popup (developer tool) | [construction.md](./construction.md) |
| Routing, archives, redirects, Markdown, search | [content.md](./content.md) |
+7 -3
View File
@@ -246,7 +246,7 @@ site), **P** = a test in the panel. Full code: PROGRAMISTA.md §2.
| 9 | **Media / R2 / speed** | `Media` with `focalPoint`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` + field; **always** `buildR2Storage(['media'], { s3Storage })` + `@payloadcms/storage-s3`; `R2_*` in `.env.example`; `<MediaPreconnect/>`; `images: buildImagesConfig()` and `buildUploadSecurityHeaders()` in `next.config.ts`; the project's `<Media>` via `mediaImageProps`/`videoProps` (§6.11b) | `buildR2Storage`, `mediaImageProps`, `videoProps`, `buildImagesConfig` | A, S |
| 10 | **Forms** | every form from a **seed** (`scripts/seed-form-*.ts`: fields, confirmation, mail to the company **and** confirmation to the customer, every language); a block with `<RenderForm>` + `formClasses.ts` (look, once); `actions.ts` = `createSubmitAction({ getCachedPayload, headers })`; `forms: {…}` in `iapl`; `email: mailAdapter()` | `RenderForm` (`/rsc`), `createSubmitAction`, `mailAdapter` | A, P |
| 11 | **Turnstile** | `<SiteProviders>` in `[locale]/layout.tsx` (wires `TurnstileProvider` with the key from the panel); `RenderForm` renders the widget; keys in Site integrations | `SiteProviders`, `getTurnstileConfig`, `TurnstileProvider` | A, P |
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; `iapl({ consentLog: true })` (without it the `/api/ipal/consent` endpoint does not exist) + `<SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}>` (ConsentProvider, banner, CookieButton, Analytics in the right order; the banner is in the server HTML and painted with the page — pages stay static, an inline script decides before the first paint; with a nonce CSP pass `nonce` to `SiteProviders`; never wrap the banner in a "mounted" guard or `dynamic(…, { ssr: false })`, never read the consent cookie in the layout unless the site is dynamic anyway: `consentCookie`, consent.md → "First paint"); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (`cookieScanner: true` → *Cookie review* → **Scan cookies** → *Approve cookies* → **Approve and add**; or cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookies → Settings window → Cookie list headings in every language | consent.md, analytics.md | A, `iapl-consent-check` |
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; the consent log is on by default since 1.17.0 (`consentLog: false` turns it off; **Postgres / SQLite: `pnpm payload migrate:create consent-log` and apply it in the same deploy**, doctor `consent-log-migration`) + `<SiteProviders banner={<CookieBanner settings="detailed" />}>` (posts every decision to the log by itself; "Reject" is as prominent as "Accept all" by default — `equalChoice`; Global Privacy Control honoured by default — `gpc`, consent.md → "Global Privacy Control"; ConsentProvider, banner, CookieButton, Analytics in the right order; the banner is in the server HTML and painted with the page — pages stay static, an inline script decides before the first paint; with a nonce CSP pass `nonce` to `SiteProviders`; never wrap the banner in a "mounted" guard or `dynamic(…, { ssr: false })`, never read the consent cookie in the layout unless the site is dynamic anyway: `consentCookie`, consent.md → "First paint"); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (`cookieScanner: true` → *Cookie review* → **Scan cookies** → *Approve cookies* → **Approve and add**; or cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookies → Settings window → Cookie list headings in every language | consent.md, analytics.md | A, `iapl-consent-check` |
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `withSecurityConfig(withPayload(nextConfig))` — this order (no `X-Powered-By`; Payload's colour-scheme client hints for `/admin` only, check: `curl -sI localhost:3000/pl \| grep -i critical-ch` → nothing); CSP: `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } })` + `buildAdminCspHeaders` on `/admin/:path*` + `src/app/api/csp-report/route.ts` (`createCspReportRoute`) → read the reports → `mode: 'enforce'`; `twoFactor: { issuer, plugin: payloadTotp }` + `generate:importmap` (`TotpRedirectProvider`, `SafeTotpView`; check: a new admin lands on `/admin/setup-totp?back=%2Fadmin` with the QR, no reloading; a login with the password only gets `403` from `/api/globals/site-integrations` and `/api/form-submissions` — security.md "What the second factor covers"); own endpoints: `secondFactorPassed(req)` / `userMeetsRole(req, role)`; **an account without 2FA can only set it up** (`twoFactor.requireSetup`, default: nothing else answers, 72 h from creation or an admin's reset, then blocked until an admin chooses "Reopen setup" on the account) — so set 2FA up right after creating an account; `iapl-doctor --url` must report 0 accounts without 2FA; Postgres/SQLite: migration for `totpSetupFrom`; `IAPL_IP_HEADER` in production | security.md, forms.md | A |
| 14 | Operations | `src/app/api/health/route.ts` (`healthRoute`); `src/instrumentation.ts` with `assertEnv(iaplEnvRules({ storage: true, ipHeader: true }))`; staging with `IAPL_NOINDEX=1`; smoke tests (§8a) | `healthRoute`, `assertEnv`, `iaplEnvRules` | A |
| 15 | System pages | Site settings → System pages: homepage, 404, privacy policy, cookies; legal links in the footer by role (`getSystemLinks(locale)`) | `getSystemLinks`, `getSystemPagePath`, `getNotFoundPage` | P |
@@ -1149,7 +1149,7 @@ project → **plugin gap**, not a copy.
| R2, file names, optimization, preview | `buildR2Storage`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` | storage.md |
| Image / video in `<Media>` | `mediaImageProps`, `videoProps`, `MEDIA_SIZES` | storage.md |
| Enlarge an image (card, gallery, product, rich text) | `<SiteProviders lightbox>` + `<LightboxTrigger group image={lightboxImage(media, { size })}>` (`/client`), `RenderRichText lightbox`, `useLightbox`; labels: `iapl({ lightbox: true })` → Form messages → Image viewer | lightbox.md |
| YouTube without cookies before a click | `<YouTubeEmbed>` (`/client`) | storage.md |
| YouTube without cookies before a click | `<YouTubeEmbed poster={…}>` (`/client`) — always pass an uploaded poster (without it the thumbnail comes from Google before any choice; a development warning says so) | storage.md |
| `next.config` | `buildImagesConfig`, `buildSecurityHeaders` (`csp`), `buildCsp`, `buildCspHeaders`, `buildAdminCsp` / `buildAdminCspHeaders`, `buildUploadSecurityHeaders`, `withSecurityConfig` (the OUTER wrapper: hides `X-Powered-By`, keeps Payload's `Accept-CH` / `Critical-CH` / `Vary` colour-scheme hints on the admin only; `adminClientHints: { route, sources } \| false`), `scopeColorSchemeClientHints`, `adminClientHintSources`, `COLOR_SCHEME_CLIENT_HINT` | storage.md, security.md |
| CSP reports, nonces | `createCspReportRoute` (`parseCspReports`, type `CspViolation`), `createProxy({ csp })` + `<SiteProviders nonce>` (dynamic pages only), `createCspNonce`, `CSP_NONCE_HEADER`, `buildReportingEndpoints`, `cspHeaderKey`, `DEFAULT_CSP_REPORT_GROUP`; types `BuildAdminCspArgs`, `CspDirective`, `CspSources`, `CreateCspReportRouteArgs`, `WithSecurityConfigOptions` | security.md |
| Fluid typography and spacing | `fluid.css` / `fluid-wide.css` (`--ipal-*` variables); your own sizes: `fluidClamp`, `FLUID_SCALE`, `FLUID_RANGES` | design-tokens.md |
@@ -1160,6 +1160,7 @@ project → **plugin gap**, not a copy.
| Need | Use | Doc |
|---|---|---|
| Banner, settings, cookie button | `<SiteProviders banner={<CookieBanner …/>}>`, `CookieButton`, `useConsent` | consent.md |
| Compliance defaults (1.17.0): Global Privacy Control honoured (no banner, no tracker request, opt-in from the cookie button wins), "Reject" like "Accept all", consent log on, withdrawal tells Meta / TikTok / Clarity and clears listed storage keys | built in; opt-outs: `SiteProviders gpc="ask"` / `gpc={false}`, `CookieBanner equalChoice={false}`, `iapl({ consentLog: false })` / `logEndpoint={false}`, `maxAgeDays` (re-ask, default 180); building blocks `resolveConsent`, `gpcFromHeaders`, `gpcFromNavigator`, `GPC_CATEGORIES`, `GPC_HEADER`, `CONSENT_LOG_PATH`, `gpcWellKnown` (`/.well-known/gpc.json`), `readEffectiveConsent`, `signalVendors`, `clarityConsent` (`/client`). Check: `iapl-consent-check` (5 runs incl. GPC, equal prominence, withdrawal), `iapl-doctor` (`consent-banner`, `consent-log-migration`) | consent.md → "Compliance defaults", consent-behaviour-spec.md |
| Banner at first paint (not after hydration; LCP) | built in: `CookieBanner firstPaint` (default on), `SiteProviders nonce` under a nonce CSP; off: `firstPaint={false}`; server-exact HTML on a dynamic site: `SiteProviders consentCookie` / `ConsentProvider cookieValue`; your own banner: `consentBannerScript`. Check: `curl -s <page> \| grep -c 'data-ipal="banner-script"'` → 1 and the response still has `s-maxage` | consent.md → "First paint" |
| Settings window: in the bar / small / large with cookie details | `<CookieBanner settings="inline" \| "modal" \| "detailed">` — do not build your own window or cookie list | consent.md → "Large window with details" |
| A consent-dependent script | `ConsentScript` | consent.md |
@@ -1210,7 +1211,10 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
| Text written in one language fills the empty languages (cookie list, cookie review), never over a language's own text | `fillEmptyLocales: false` | `fillEmptyLocales: { 'cookie-settings': [...], 'cookie-review': [...] }`; `buildFillEmptyLocalesGlobalHook` / `…CollectionHook` for your own globals and collections |
| Cookie approval: one summary + **Approve and add** (editor+), unknown cookies approved as `marketing` + "Needs description", dashboard reminder while cookies wait; nothing reaches the cookie banner before approval | `cookieScanner.approval: false` (per-entry review) | `approval.unknownCategory`, `approval.dashboard: false`; building blocks `approveCookies`, `loadCookieApproval`, `countPendingCookies`, `flagGoneEntries`, `sameCookie` |
| Cookie review: scan + review editor+, delete admin; Open Cookie Database "Functional" → `functional` | omit `cookieScanner` | `cookieScanner.access`, `collectionOverrides`, `databaseCategories`, `integrations`, `declarations`, `labels`, `syncAccepted: false`; building blocks `runCookieScan`, `collectCookieFindings`, `applyCookieFindings` |
| Consent records / stats visits: read and delete admin (stats view and chart follow `stats-visits` read access) | omit `consentLog` / `stats` | `consentLog.collectionOverrides`, `stats.collectionOverrides` (object merges `access`/`admin`/`hooks`, function takes over; `applyCollectionOverride`) |
| Consent log on (since 1.17.0; Postgres / SQLite: a migration in the same deploy) | `consentLog: false`; one layout: `logEndpoint={false}` | `consentLog: { retentionDays, collectionOverrides }`; `buildConsentLogCollection` / `buildConsentLogEndpoint`, `CONSENT_LOG_PATH` |
| Global Privacy Control honoured: no banner, analytics and marketing off, no Google request also in Consent Mode `advanced`; a grant made without the signal is switched off when it appears | `gpc={false}` (doctor warns) | `gpc="ask"`; `resolveConsent`, `gpcFromHeaders`, `consentBannerScript({ gpc })` |
| "Reject" styled like "Accept all" (`equalChoice`) | `equalChoice={false}` (doctor warns) | `classNames.rejectButton` |
| Consent records / stats visits: read and delete admin (stats view and chart follow `stats-visits` read access) | `consentLog: false` / omit `stats` | `consentLog.collectionOverrides`, `stats.collectionOverrides` (object merges `access`/`admin`/`hooks`, function takes over; `applyCollectionOverride`) |
| Injected `users`: admin manages everyone, others only themselves | — | `access.authAccess` (your keys win); your own `users` collection wins whole |
| First registered account = admin | `access.firstUserAdmin: false` | `buildRolesField(defaultRole, { firstUserAdmin })` |
| 2FA on the panel's login collection, mismatch = startup error; redirect to the 2FA screens by `TotpRedirectProvider` | `twoFactor: false` (discouraged) | `twoFactor.collectionSlug`, `allowCollectionMismatch: true`, `twoFactor.provider` (own component, or `false` for the package's) |
@@ -1,6 +1,6 @@
---
name: iapl-consent-check
description: Proves in a real browser (Playwright) that an IAPL site respects cookie consent — no Meta/Clarity/LinkedIn/TikTok/Ads requests and no tracking cookies before a decision or after "reject", Google only with Consent Mode "denied" signals, tags starting after "accept". Use after adding analytics, pixels, embeds (YouTube, maps, chat) or third-party scripts, before handing a site over, and whenever GDPR/RODO or cookie banner behaviour is in question.
description: Proves in a real browser (Playwright) that an IAPL site respects cookie consent — no Meta/Clarity/LinkedIn/TikTok/Ads requests and no tracking cookies before a decision or after "reject", Google only with Consent Mode "denied" signals, tags starting after "accept", Global Privacy Control honoured, "Reject" as prominent as "Accept all", withdrawal deleting the cookies. Use after adding analytics, pixels, embeds (YouTube, maps, chat) or third-party scripts, before handing a site over, and whenever GDPR/RODO or cookie banner behaviour is in question.
---
# iapl-consent-check
@@ -22,8 +22,9 @@ before analytics or marketing consent — check the project's choice in "Project
node .agents/skills/iapl-consent-check/scripts/consent-check.mjs http://localhost:3000/pl
```
`--wait 6000` when tags start slowly (`defer` mode in Analytics).
3. Output: three runs in clean profiles — no decision, "Accept",
"Reject" + reload. Every `[ERROR]` is a violation — fix it:
3. Output: five runs in clean profiles — no decision, "Accept", "Reject" + reload, **Global Privacy Control**
(`Sec-GPC: 1` and `navigator.globalPrivacyControl`), "Accept" then withdraw (cookie button → "Reject").
Every `[ERROR]` is a violation — fix it:
| Violation | Cause → fix |
|---|---|
@@ -31,6 +32,11 @@ before analytics or marketing consent — check the project's choice in "Project
| tracking cookie set without consent | same; or GTM fires a tag without an `ad_storage` condition (analytics.md → GTM) |
| GA hit with consent GRANTED | `setDefaultConsent` not before the tag — `<Analytics>` must be inside `<ConsentProvider>` (`SiteProviders` does this itself) |
| YouTube / Maps before consent (warning) | `ConsentScript` (consent.md), `youtube-nocookie.com` or "click to load" |
| "Reject" is not as prominent as "Accept all" / no "Reject" on the first layer | `equalChoice={false}`, a `rejectButton` class or an `order` without `'reject'` in the layout → remove it (the default is equal; consent.md → "Compliance defaults") |
| Global Privacy Control: the Google tag loaded | IAPL before 1.17.0, a hand-made tag loader, or GTM started by hand → update; `<Analytics>` from the plugin |
| Global Privacy Control: banner shown (warning) | `gpc="ask"` / `gpc={false}` in the layout — fine only if it is a recorded project decision |
| withdraw: tracking cookie still set | the cookie is not in `DEFAULT_COOKIE_MAP`, `cookieMap` or the panel's cookie list → add it to the list (scan → approve) or `<ConsentProvider cookieMap>` |
| YouTube thumbnail / Google Fonts / Maps API before a choice (warning) | `<YouTubeEmbed poster>` with an uploaded poster; fonts through `next/font`; maps behind `ConsentScript` or click-to-load |
4. The "after accept" section shows what starts after consent — compare it with the IDs in Site
Integrations (e.g. is Meta Pixel there, if the client has one). Nothing starts
@@ -1,10 +1,14 @@
#!/usr/bin/env node
// iapl-consent-check — proves in a real browser that tracking waits for consent (GDPR).
// node consent-check.mjs <pageUrl> [--wait 4000]
// Three runs, each in a fresh browser profile:
// 1. no decision → no third-party pixels, no tracking cookies, Google only with "denied" signals
// Five runs, each in a fresh browser profile:
// 1. no decision → no third-party pixels, no tracking cookies, Google only with "denied" signals;
// "Reject" as prominent as "Accept all" (same size, same look or no weaker contrast)
// 2. accept all → configured tags start (reported, so you can confirm they're the right ones)
// 3. reject all → same as 1, also after a reload
// 4. Global Privacy Control (Sec-GPC: 1 + navigator.globalPrivacyControl) → no banner (IAPL 1.17.0 default),
// no tracker request at all, Google included
// 5. accept, then withdraw (cookie button → reject) → the tracking cookies are gone
// Needs Playwright: pnpm add -D playwright && pnpm exec playwright install chromium
// Exit code: 0 = compliant, 1 = violations, 2 = setup problem.
@@ -41,6 +45,12 @@ const EMBEDS = [
['YouTube (cookie mode)', /youtube\.com\/embed/],
['Google Maps embed', /google\.com\/maps\/embed/],
]
// Requests to Google before any choice that are not tracking tags: a warning (the visitor's IP reaches Google).
const THIRD_PARTY_ASSETS = [
['YouTube thumbnail (i.ytimg.com) — upload a poster', /i\.ytimg\.com/],
['Google Fonts — self-host (next/font)', /fonts\.googleapis\.com|fonts\.gstatic\.com/],
['Google Maps API', /maps\.googleapis\.com/],
]
const GOOGLE_COLLECT = /google-analytics\.com\/(g\/)?collect|analytics\.google\.com\/g\/collect/
const GOOGLE_TAG = /googletagmanager\.com\/(gtm|gtag)/
const TRACKING_COOKIES = /^(_ga|_gid|_gat|_gcl_|_fbp|_fbc|_clck|_clsk|_ttp|li_|lidc|bcookie|_hj)/
@@ -52,8 +62,22 @@ const consentGranted = (u) => {
}
const browser = await chromium.launch()
const run = async (label, action) => {
const ctx = await browser.newContext()
/** Computed look of the banner's accept / reject buttons and the banner surface (run 1). */
const buttonLook = (page) => page.evaluate(() => {
const props = ['fontSize', 'fontWeight', 'paddingTop', 'paddingLeft', 'borderTopLeftRadius', 'height', 'backgroundColor', 'color', 'borderTopColor', 'borderTopWidth']
const pick = (el) => {
if (!el) return null
const cs = getComputedStyle(el)
const out = { tag: el.tagName }
for (const p of props) out[p] = p === 'height' ? String(Math.round(el.getBoundingClientRect().height)) : cs[p]
return out
}
const banner = document.querySelector('[data-ipal="banner"]')
return { accept: pick(document.querySelector('[data-ipal="banner"] [data-ipal="accept"]')), reject: pick(document.querySelector('[data-ipal="banner"] [data-ipal="reject"]')), surface: banner ? getComputedStyle(banner).backgroundColor : null }
})
const run = async (label, action, { gpc = false, withdraw = false } = {}) => {
const ctx = await browser.newContext(gpc ? { extraHTTPHeaders: { 'Sec-GPC': '1' } } : {})
if (gpc) await ctx.addInitScript(() => Object.defineProperty(Navigator.prototype, 'globalPrivacyControl', { configurable: true, get: () => true }))
const page = await ctx.newPage()
const requests = []
page.on('request', (r) => requests.push(r.url()))
@@ -61,13 +85,27 @@ const run = async (label, action) => {
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 })
} catch (e) {
console.error(`iapl-consent-check: cannot open ${url} (${e.message.split('\n')[0]})`)
await browser.close()
const gpcRun = await run('4. Global Privacy Control')
if (gpcRun.bannerVisible) warnings.push('4. Global Privacy Control: the banner is shown (gpc="ask", gpc={false} or IAPL before 1.17.0) — the default honours the signal without a banner')
inspect(gpcRun, true)
if (gpcRun.requests.some((u) => GOOGLE_TAG.test(u) || GOOGLE_COLLECT.test(u))) violations.push('4. Global Privacy Control: the Google tag loaded although the browser asks not to share data and nothing was granted')
const withdrawn = await run('5. accept, then withdraw', 'accept', { withdraw: true })
if (withdrawn.withdrawn?.missing) warnings.push('5. withdraw: no [data-ipal="cookie-button"] to reopen the settings — is <CookieButton/> rendered?')
else if (withdrawn.withdrawn) {
const left = withdrawn.withdrawn.after.filter((c) => TRACKING_COOKIES.test(c))
for (const c of left) violations.push(`5. withdraw: tracking cookie "${c}" still set after "Reject" (add it to <ConsentProvider cookieMap> or the panel's cookie list)`)
}
await browser.close()
process.exit(2)
}
await page.waitForTimeout(WAIT)
await page.mouse.wheel(0, 2000) // some tags wait for interaction (Analytics defer)
await page.waitForTimeout(500)
const banner = (await page.locator('[data-ipal="banner"]').count()) > 0
const bannerVisible = banner && (await page.locator('[data-ipal="banner"]').first().isVisible())
const look = action ? null : await buttonLook(page)
let clicked = null
if (action) {
const btn = page.locator(`[data-ipal="${action}"]`)
@@ -82,11 +120,27 @@ const run = async (label, action) => {
}
} else clicked = -1
}
let withdrawn = null
if (withdraw && clicked !== -1) {
const before = (await ctx.cookies()).map((c) => c.name)
const reopen = page.locator('[data-ipal="cookie-button"]')
if ((await reopen.count()) > 0) {
await reopen.first().click()
await page.locator('[data-ipal="banner"] [data-ipal="reject"]').first().click()
await page.waitForTimeout(1000)
withdrawn = { after: (await ctx.cookies()).map((c) => c.name), before }
} else withdrawn = { missing: true }
}
const cookies = (await ctx.cookies()).map((c) => c.name)
await ctx.close()
return { label, requests, cookies, banner, clicked }
return { label, requests, cookies, banner, bannerVisible, clicked, look, withdrawn }
}
/** WCAG contrast of two computed colours (rgb/rgba strings); null when one is transparent. */
const rgb = (c) => { const m = /rgba?\(([^)]+)\)/.exec(c ?? ''); if (!m) return null; const p = m[1].split(',').map(Number); return p.length > 3 && p[3] === 0 ? null : p.slice(0, 3) }
const lum = ([r, g, b]) => { const f = (v) => { v /= 255; return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4 }; return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b) }
const contrast = (a, b) => { const x = rgb(a), y = rgb(b); if (!x || !y) return null; const [l1, l2] = [lum(x), lum(y)].sort((m, n) => n - m); return (l1 + 0.05) / (l2 + 0.05) }
const violations = []
const warnings = []
const info = []
@@ -103,6 +157,7 @@ const inspect = (r, mustBeQuiet) => {
const noSignal = collects.filter((u) => consentGranted(u) === null)
if (noSignal.length) warnings.push(`${r.label}: Google Analytics hit without Consent Mode signal (gcs) — setDefaultConsent must run before the tag`)
for (const e of embedHits) warnings.push(`${r.label}: ${e} loaded before consent — gate it (ConsentScript) or use youtube-nocookie / click-to-load`)
for (const [n, re] of THIRD_PARTY_ASSETS) if (r.requests.some((u) => re.test(u))) warnings.push(`${r.label}: ${n} — a request to Google before any choice`)
}
return { pixelHits, trackingCookies, google: r.requests.some((u) => GOOGLE_TAG.test(u) || GOOGLE_COLLECT.test(u)) }
}
@@ -110,6 +165,19 @@ const inspect = (r, mustBeQuiet) => {
const first = await run('1. no decision')
if (!first.banner) warnings.push('1. no decision: cookie banner [data-ipal="banner"] not found — is <CookieBanner/> rendered? Older IAPL versions lack data-ipal attributes on buttons.')
const s1 = inspect(first, true)
// Equal prominence (docs/consent-behaviour-spec.md §5): same element and size; same look, or "Reject" no weaker.
if (first.look?.accept && !first.look.reject) violations.push('1. no decision: no "Reject" button on the first layer')
else if (first.look?.accept && first.look.reject) {
const { accept: a, reject: j, surface } = first.look
const size = ['tag', 'fontSize', 'fontWeight', 'paddingTop', 'paddingLeft', 'borderTopLeftRadius', 'height'].filter((p) => a[p] !== j[p])
if (size.length) violations.push(`1. no decision: "Reject" is not as prominent as "Accept all" (differs in ${size.join(', ')})`)
const colours = ['backgroundColor', 'color', 'borderTopColor', 'borderTopWidth'].filter((p) => a[p] !== j[p])
if (colours.length) {
const textJ = contrast(j.color, rgb(j.backgroundColor) ? j.backgroundColor : surface)
const edge = (b) => contrast(rgb(b.backgroundColor) ? b.backgroundColor : b.borderTopColor, surface) ?? 1
if ((textJ !== null && textJ < 4.5) || edge(j) < edge(a)) violations.push(`1. no decision: "Reject" looks weaker than "Accept all" (${colours.join(', ')} differ and its contrast is lower)`)
}
}
const accepted = await run('2. accept all', 'accept')
if (accepted.clicked === -1) warnings.push('2. accept: button [data-ipal="accept"] not found — skipped')
@@ -121,6 +189,18 @@ const rejected = await run('3. reject all (+ reload)', 'reject')
if (rejected.clicked === -1) warnings.push('3. reject: button [data-ipal="reject"] not found — skipped')
else inspect({ ...rejected, requests: rejected.requests.slice(rejected.clicked ?? 0) }, true)
const gpcRun = await run('4. Global Privacy Control')
if (gpcRun.bannerVisible) warnings.push('4. Global Privacy Control: the banner is shown (gpc="ask", gpc={false} or IAPL before 1.17.0) — the default honours the signal without a banner')
inspect(gpcRun, true)
if (gpcRun.requests.some((u) => GOOGLE_TAG.test(u) || GOOGLE_COLLECT.test(u))) violations.push('4. Global Privacy Control: the Google tag loaded although the browser asks not to share data and nothing was granted')
const withdrawn = await run('5. accept, then withdraw', 'accept', { withdraw: true })
if (withdrawn.withdrawn?.missing) warnings.push('5. withdraw: no [data-ipal="cookie-button"] to reopen the settings — is <CookieButton/> rendered?')
else if (withdrawn.withdrawn) {
const left = withdrawn.withdrawn.after.filter((c) => TRACKING_COOKIES.test(c))
for (const c of left) violations.push(`5. withdraw: tracking cookie "${c}" still set after "Reject" (add it to <ConsentProvider cookieMap> or the panel's cookie list)`)
}
await browser.close()
info.push(`before consent: Google tag ${s1.google ? 'loaded (Consent Mode, OK if gcs denied)' : 'not loaded'}`)
+5 -4
View File
@@ -91,7 +91,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
| `forms.turnstileOnConfigError` | `{ text: 'allow', files: 'reject' }` | what a form does while Turnstile CANNOT check (wrong / missing secret, Cloudflare down): a text form is accepted, a submission to the file endpoint is refused. Not involved while Turnstile is off | `'allow'` / `'reject'` for every form, or `{ text, files }`; `turnstileOnConfigError` at a call site (`createSubmitAction`, `attachments.submit`) wins |
| `forms.attachments` | off | **File** field in the form builder; a file is checked (size, count, type by content, refused extensions), attached to the company e-mail and dropped — **never stored**; adds `POST /api/ipal/forms/submit`, the fields `submissionFiles` / `filesDelivery` / `filesDeliveryNote` / `attemptKey` on `form-submissions`, and the **Files** texts in Form messages | `true` / `FormAttachmentsOption`: `maxSizeMB` (10), `maxTotalMB`, `maxFiles` (3), `fileTypes`, `allowRisky`, `scan` (antivirus hook — none built in), `strictPdf`, `notice`, `maxConcurrent` (2), `path`, `submit` (`maxPerMinute`, `clientIp`, `honeypotField`, `turnstileHostnames`, `turnstileOnConfigError`, `allowedOrigins`, `idleTimeoutMs`, `timeoutMs`); block only: `forms.fields.file: false` or `buildFileBlock(…)`. Postgres: `migrate:create`. Check: submit a PDF → attached to the company e-mail, absent from the customer e-mail, submission shows *File delivery: Handed to the mail server* (forms.md "Files") |
| `forms.consentFieldName` | `'consent'` | name of the GDPR consent field `submitForm` requires (read from `config.custom.ipal`) | `createSubmitAction({ consentFieldName })` / `submitForm` argument wins |
| `consentLog` | off | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min) | `true` / `{ retentionDays }` (default 1095) |
| `consentLog` | **on** (since 1.17.0) | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min); Postgres / SQLite: a table, migration in the same deploy | `false` / `{ retentionDays }` (default 1095) |
| `consentLog.collectionOverrides` | none | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug) | e.g. `{ access: { read: ({ req }) => req.user?.email === '[email protected]' } }` — narrows who reads records in a project without roles |
| `doctor` | on (404 until `IAPL_DOCTOR_TOKEN` is set) | `GET /api/ipal/doctor` — read-only counts for `iapl-doctor --url` (users without TOTP, cookies waiting for approval, versions); Bearer token ≥ 32 characters, rate-limited, never names or values | `false` = no endpoint; `{ tokenVar, access }` (doctor.md) |
| `cookieScanner` | off | `cookie-review` collection, "Scan cookies" box above its list (`CookieScanButton`), `GET`/`POST /api/ipal/cookie-scan`, and (unless `approval: false`) the *Approve cookies* view `/admin/cookie-approval` (`CookieApprovalView`) + `GET`/`POST /api/ipal/cookie-approval` + the dashboard reminder; a scan lists the cookies of the integrations switched on + names looked up in the bundled Open Cookie Database; one **Approve and add** puts the ticked cookies into Cookies → Cookie list (so `<CookieTable>` and the detailed window); never deletes, never overwrites edited text, never duplicates, nothing reaches the banner before approval | `true` / object; after switching on: `pnpm generate:importmap` + `migrate:create`. Check: *Privacy → Cookie review* → **Scan cookies** → "Waiting for approval: N" → **Review and approve** → **Approve and add** → the cookies are in Cookies → Cookie list (cookie-scanner.md) |
@@ -123,7 +123,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|---|---|---|---|
| auth collection (`users`) | `{ slug, auth: true, useAsTitle: 'email' }`, when the project has none (slug: `access.authCollection` → `twoFactor.collectionSlug` → `admin.user` → `'users'`); with `access`: create/delete/unlock admin only, read/update admin or self | `access.authAccess`; your own collection with that slug | yours wins |
| `forms`, `form-submissions` | form-builder + IAPL blocks `step`, `checkboxGroup`, `time` | `forms` | omit `forms` |
| `consent-records` | proof of consent (id, choices, policy version; `consentLog.collectionOverrides`) | `consentLog` | off by default |
| `consent-records` | proof of consent (id, choices, policy version; `consentLog.collectionOverrides`) | `consentLog` | on by default (1.17.0) |
| global `cookie-crawl` | latest browser crawl (status, counts, violations, third-party hosts) + e-mail recipients; read editor+, update admin | `cookieScanner.crawl` (`globalOverride`) | off by default |
| `cookie-review` | cookie scanner entries (`status` draft / accepted / rejected, `change` new / changed / gone, `needsDescription`; create/read/update editor+, delete admin) | `cookieScanner` | off by default |
| view `/admin/cookie-approval` | *Approve cookies*: everything waiting, grouped by category, one **Approve and add** | `cookieScanner.approval` | `approval: false` |
@@ -135,7 +135,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
| global revalidation hook | `afterChange` on the four globals → `revalidatePath('/', 'layout')` | `revalidatePath` | omit `revalidatePath` |
| `POST /api/ipal/test-email` | SMTP/Graph test (admin only); body `{ to, attachmentMB? }` — `attachmentMB` attaches a dummy file to measure the mail server's size limit | — | **currently always** |
| `POST /api/ipal/forms/submit` | a panel form **with files** posts here (multipart, read as a stream; same gates as `sendForm`); same-origin only | `forms.attachments` (`path`, `submit`) | off by default |
| `POST /api/ipal/consent` | saves consent | `consentLog` | off by default |
| `POST /api/ipal/consent` | saves consent (`503` while the SQL table is missing) | `consentLog` | on by default (1.17.0) |
| `POST /api/ipal/hit` | page view for stats | `stats` | off by default |
| `GET`/`POST /api/ipal/cookie-crawl`, `POST /api/ipal/cookie-crawl/results` | crawl status / start (editor+ or bearer token) / the scanner service's callback (token, running job only) | `cookieScanner.crawl` | off by default |
| `GET`/`POST /api/ipal/cookie-approval` | the approval list (`?locale=`) / approve (`{ ids? }`), editor+ | `cookieScanner.approval` (`access`) | `approval: false` |
@@ -208,7 +208,8 @@ Mandatory set: AGENT.md §0b, skill **iapl-setup**; checks: **iapl-audit**, **ia
| consent | layout + policy page | banner via `SiteProviders`; table `<CookieTable rows={…} labels={…} />` (`/rsc`) from `getCookieTable` | `iapl-consent-check`; delete the consent cookie → the banner comes back | consent.md |
| cookie crawl | config + env + service | `cookieScanner: { crawl: true }`, `IAPL_COOKIE_SCAN_URL` / `IAPL_COOKIE_SCAN_TOKEN`, site in the service's `IAPL_CRAWLER_SITES`; optional Coolify scheduled task `curl -X POST -H "Authorization: Bearer $IAPL_COOKIE_SCAN_TOKEN" $U/api/ipal/cookie-crawl` | **Check site** → "Last crawl …: N pages, N violations"; *Privacy → Cookie check* | cookie-scanner.md → Browser crawl |
| cookie list | config | `cookieScanner: true` (+ `declarations` for embeds/chat), `generate:importmap`, `migrate:create` | *Cookie review* → **Scan cookies** → **Review and approve** → **Approve and add** → Cookies → Cookie list; `<CookieBanner settings="detailed">` and `<CookieTable>` list it | cookie-scanner.md |
| proof of consent | config + layout | `consentLog: true` + `logEndpoint="/api/ipal/consent"` | after a click, a document in Consent Records | consent.md |
| proof of consent | nothing (on by default); Postgres / SQLite: `migrate:create consent-log` | `SiteProviders` posts by itself; a hand-wired `ConsentProvider` needs `logEndpoint="/api/ipal/consent"` | after a click, a document in Consent Records | consent.md |
| Global Privacy Control | nothing (on by default) | `gpc="ask"` / `gpc={false}` on `SiteProviders` | a browser with GPC: no banner, cookie button, no tracker request; `iapl-consent-check` run 4 | consent.md → Global Privacy Control |
| stats | config + layout | `stats: true` + `<SiteProviders stats={{ locale }}>` (or `<PageStats locale />` inside `ConsentProvider`); on a site with `storageNames: 'iapl'` also `visitorCookie: IAPL_VISITOR_COOKIE` (`<PageStats visitorCookie={IAPL_VISITOR_COOKIE} />`) — `iapl-doctor` rule `storage-names` | `/<admin>/stats`; `POST /api/ipal/hit` request in Network | stats.md |
| analytics | layout | `SiteProviders` wires `Analytics` (ID from Site integrations → Analytics); Consent Mode: `analytics={{ consentMode: 'basic' }}` = no request to Google before consent, default `'advanced'` = the Google tag loads at once with every signal `denied` | Meta/other pixels only after consent; in `basic` no `gtm.js` / `gtag/js` in Network before consent | analytics.md, gtm-meta-pixel.md |
| extra JSON-LD | layout / `lib/content` | `jsonLd={[buildNavigationJsonLd(…)]}`; `siteJsonLd` → `buildLocalBusinessJsonLd` | Rich Results Test | seo.md |
@@ -161,15 +161,15 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| Export | Import from | What it does / when |
|---|---|---|
| `ConsentProvider` | `@intecion/ipal-kit/client` | Consent provider: `{ texts, cookieMap?, logEndpoint?, nonce?, cookieValue? }` (`nonce`: CSP nonce for the banner's first-paint script; `cookieValue`: optional server-read consent cookie → exact HTML, dynamic pages) — consent state, cookie, Consent Mode, deleting cookies after consent is withdrawn, optional POST of the decision to the log (`'/api/ipal/consent'`). Wrap the layout once; required by the banner, `Analytics`, `ConsentScript`. |
| `ConsentProvider` | `@intecion/ipal-kit/client` | Consent provider: `{ texts, cookieMap?, logEndpoint?, nonce?, cookieValue?, gpc?, maxAgeDays? }` (`gpc`: Global Privacy Control `'honour'` default / `'ask'` / `false`; `maxAgeDays`: re-ask period, default 180; withdrawal also removes the panel's listed storage keys and tells Meta / TikTok / Clarity) (`nonce`: CSP nonce for the banner's first-paint script; `cookieValue`: optional server-read consent cookie → exact HTML, dynamic pages) — consent state, cookie, Consent Mode, deleting cookies after consent is withdrawn, optional POST of the decision to the log (`'/api/ipal/consent'`). Wrap the layout once; required by the banner, `Analytics`, `ConsentScript`. |
| `CookieBanner` | `@intecion/ipal-kit/client` | Consent banner + category settings: `settings: 'inline' \| 'modal' \| 'detailed'`, `controls`, `equalChoice` (recommended `true`), `order`, `settingsActions`, `icon`, `classNames`, `firstPaint` (default `true`: in the server HTML, decided before the first paint by an inline script; pages stay static), `nonce`; colours from `--ipal-*` CSS vars. Do not write your own banner. |
| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Props `className`, `side` (`'left' \| 'right'`), `avoid` (selector it lifts above, default `COOKIE_BUTTON_AVOID` = footer; `false`). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. |
| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Default footer selector; pixels the footer covers at the bottom of the screen (how far the button moves up) |
| `TOTP_TEXTS`, `TOTP_VIEW_TITLE` | `@intecion/ipal-kit` | en/pl texts of the 2FA screens (`totpPlugin:*`, merged by `twoFactor`) and their tab title |
| `ConsentScript` | `@intecion/ipal-kit/client` | Loads an external script (`src` or `code`) only after consent for `category` — for vendors without Consent Mode (chat, Plausible etc.). Inside `ConsentProvider`. |
| `CookieTable` | `@intecion/ipal-kit/rsc` | Server Component: cookie table for the cookie policy page — `{ rows, labels?, locale?, categories?, caption?, classNames?, storageColumn?, storageTypes? }`; `rows` from `getCookieTable()`; a **Type** column when a row is local / session storage (`storageColumn: 'auto' \| boolean`). |
| `useConsent(options?)` | `@intecion/ipal-kit/client` | Low-level consent state hook → `{ state, decided, consentId, hydrated, serverRead, acceptAll, rejectAll, savePreferences, reopen }` (options: `cookieMap`, `version`, `onDecision`, `cookieValue`). Usually use `ConsentProvider` + `useConsentContext` (the provider calls it itself). |
| `consentBannerScript({ version?, cookieName? })` | `@intecion/ipal-kit` | The inline script `CookieBanner` puts after its markup: before the first paint it removes `hidden` from the banner (no current decision) or sets `display: none` (current decision), and keeps a click made before hydration. For a project's own banner; reads only the consent cookie. Options type: `ConsentBannerScriptOptions`. consent.md → "First paint". |
| `useConsent(options?)` | `@intecion/ipal-kit/client` | Low-level consent state hook → `{ state, decided, consentId, gpc, gpcMode, hydrated, serverRead, acceptAll, rejectAll, savePreferences, reopen }` (options: `cookieMap`, `storageMap`, `version`, `onDecision` (gets `{ id, state, version, gpc }`), `cookieValue`, `gpc`, `maxAgeDays`). Usually use `ConsentProvider` + `useConsentContext` (the provider calls it itself). |
| `consentBannerScript({ version?, cookieName?, gpc? })` | `@intecion/ipal-kit` | The inline script `CookieBanner` puts after its markup: before the first paint it removes `hidden` from the banner (no current decision) or sets `display: none` (current decision, or Global Privacy Control honoured with `gpc: 'honour'`, the default), and keeps a click made before hydration. For a project's own banner; reads only the consent cookie. Options type: `ConsentBannerScriptOptions`. consent.md → "First paint". |
| `useConsentContext()` | `@intecion/ipal-kit/client` | Hook: the `useConsent` value + `texts` from `ConsentProvider` — for your own consent-dependent UI (e.g. `state.marketing`). Throws outside the provider. |
| `getConsentTexts({ payload, config, locale?, privacyPolicy?, settingsSlug? })` | `@intecion/ipal-kit` | Server: banner texts from the CookieSettings global (EN fallback per field) + privacy policy link from the system pages → `Promise<ConsentTexts>`; pass to `ConsentProvider texts`. |
| `getCookieTable({ payload, locale? })` | `@intecion/ipal-kit` | Server: Cookies → Cookie list rows in one language → `Promise<CookieTableRow[]>` (does not throw) — for `CookieTable`. |
@@ -186,6 +186,13 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `ACCEPT_ALL_CONSENT` | `@intecion/ipal-kit` | All categories `true`. |
| `REJECT_ALL_CONSENT` | `@intecion/ipal-kit` | Only `necessary: true` (a copy of `DEFAULT_CONSENT`). |
| `CONSENT_LOG_SLUG` | `@intecion/ipal-kit` | Consent log collection slug: `'consent-records'`. |
| `CONSENT_LOG_PATH` | `@intecion/ipal-kit` | The consent log endpoint's path under the API route: `'/ipal/consent'` (`/api/ipal/consent`). |
| `resolveConsent(record, signal, mode?)` | `@intecion/ipal-kit` | Pure: what is in effect for a stored record (or `null`), the Global Privacy Control signal and the mode (`'honour'` default / `'ask'` / `false`) → `{ decided, gpc, stale, state }` (type `ResolvedConsent`; mode type `GpcMode`). The table in consent.md → "Global Privacy Control". |
| `gpcFromNavigator()` / `gpcFromHeaders(headers)` | `@intecion/ipal-kit` | The signal: `navigator.globalPrivacyControl === true` (false on the server) / `Sec-GPC: 1` exactly. Read the header only where a response is per visitor (endpoints) — never while rendering a static page. |
| `GPC_CATEGORIES`, `GPC_HEADER` | `@intecion/ipal-kit` | `['analytics', 'marketing']` (what the signal refuses) and `'sec-gpc'`. |
| `gpcWellKnown({ lastUpdate })` | `@intecion/ipal-kit` | Route handler for `/.well-known/gpc.json` (`{ gpc: true, lastUpdate }`): `app/.well-known/gpc.json/route.ts` → `export const GET = gpcWellKnown({ lastUpdate: '2026-11-26' })`. Optional. |
| `readEffectiveConsent(version, gpc?)` | `@intecion/ipal-kit/client` | The stored choice under `version` with Global Privacy Control applied, read live from the cookie and `navigator` (not React state) — for your own tag loader's effects. |
| `signalVendors(prev, next)` / `clarityConsent(state)` | `@intecion/ipal-kit/client` | Tells the running Meta Pixel (`fbq('consent', …)`), TikTok (`ttq.revokeConsent` / `grantConsent`) and Clarity (`consentv2` / `consent false`) about a change; `useConsent` calls it on every decision — for your own banner. `clarityConsent` → Clarity's `{ ad_Storage, analytics_Storage }`. |
| `buildConsentLogCollection()` | `@intecion/ipal-kit` | Consent log collection (id, choices, version, time — no IP/personal data; proof of consent under GDPR Art. 7(1)). The plugin wires it itself with `consentLog: true` — do not call. |
| `buildConsentLogEndpoint({ retentionDays? })` | `@intecion/ipal-kit` | `POST /api/ipal/consent` endpoint that saves decisions and deletes records older than `retentionDays` (default 1095). The plugin wires it itself with `consentLog` — do not call. |
+5 -4
View File
@@ -190,7 +190,8 @@ export default buildConfig({
twoFactor: { issuer: '<Client name>', plugin: payloadTotp },
whiteLabel: true,
indexNow: true,
consentLog: true, // without this there is no POST /api/ipal/consent
// consentLog is on by default (1.17.0): consent-records + POST /api/ipal/consent; `consentLog: false` turns it off.
// Postgres / SQLite: pnpm payload migrate:create consent-log, applied in the same deploy.
revalidatePath, // saving a plugin global refreshes the whole site (ISR)
}),
buildR2Storage(['media'], { s3Storage }), // ALWAYS: R2 with the full R2_* set, local disk without it
@@ -419,8 +420,8 @@ export default async function LocaleLayout({ children, params }: Props) {
return (
<html lang={locale}>
<body>
<SiteProviders shell={await getSiteShell(locale)} logEndpoint="/api/ipal/consent"
banner={<CookieBanner equalChoice settings="detailed" />}>
<SiteProviders shell={await getSiteShell(locale)}
banner={<CookieBanner settings="detailed" />}>
<main>{children}</main>{/* Header/Footer — stage 10 */}
</SiteProviders>
</body>
@@ -591,7 +592,7 @@ after a choice in the banner a new record in Consent records.
**Turn off / override.** Turnstile: both keys empty (panel and env) → no widget and no verification; fail-closed
`turnstileOnConfigError: 'reject'`; the Turnstile/SMTP fields in Site integrations currently always. Form look:
`formClasses`, unusual ones → `useBuilderForm` (no copy of the engine). Banner: `settings`, `controls`, `order`,
`equalChoice`, `classNames`, tokens; no `consentLog` = no register and no endpoint (then remove `logEndpoint`).
`classNames`, tokens (`equalChoice` is the default since 1.17.0 — never pass `equalChoice={false}`); `consentLog: false` = no register and no endpoint (SiteProviders then posts nothing). Global Privacy Control is honoured by default (`gpc`); leave it.
**Consent Mode choice** (record it in "Project decisions"): `'advanced'` (default) — the Google tag loads at once with
every signal `denied` (pixels and Clarity only after consent); `'basic'` — `<SiteProviders analytics={{ consentMode: 'basic' }}>`,
no request to `googletagmanager.com` before analytics or marketing consent (a client requiring zero requests to Google).
+23
View File
@@ -581,6 +581,29 @@ element). Pages stay static; consent, tags, the cookie and the consent log are u
**Check:** `curl -s <page> | grep -c 'data-ipal="banner-script"'` → 1; the response still carries `s-maxage`; first
visit: the banner is there before the page's scripts have loaded; after a decision and a reload: never shown.
**→ 1.17.0, consent compliance (CHANGELOG 1.17.0 "Consent"; PROGRAMISTA §6, item 78; consent.md → "Compliance defaults") — Postgres / SQLite: a migration; MongoDB: nothing required:**
What a visitor of an existing site sees change: "Reject" looks like "Accept all"; one more sentence in the default
banner text (only where the panel's message is empty); a browser with Global Privacy Control gets no banner and no
tracker request. Every decision is now recorded in *Privacy → Consent records*.
1. **Postgres / SQLite and the project never had `consentLog` on:** the consent log is now on by default and is a new
table. In the same deploy: `pnpm payload migrate:create consent-log`, commit it, apply it at container start
(`prodMigrations` or `pnpm payload migrate && pnpm start`). Or `iapl({ consentLog: false })`. Without either the site
works, but every choice answers 503 and is not recorded (one log line; `iapl-doctor` error `consent-log-migration`).
MongoDB: the collection appears by itself.
2. Every site: `pnpm payload generate:types` adds the `consent-records` collection's types (where it was off) — run it and
commit. No import-map change.
3. Layout: remove `logEndpoint="/api/ipal/consent"` from `<SiteProviders>` (it is the default now; keeping it is
harmless) and `equalChoice` (the default). A hand-wired `<ConsentProvider>` keeps `logEndpoint`.
4. The project's decisions, only where the owner wants the old behaviour — record each in `AGENTS.md` → "Project
decisions": `<CookieBanner equalChoice={false} />`, `<SiteProviders gpc="ask" | gpc={false}>`,
`iapl({ consentLog: false })`. Consent Mode stays `advanced` unless the project chose `basic`.
5. Project e2e that clicks "Reject" by its old secondary look, or expects the old banner text, update it.
6. A `<YouTubeEmbed>` without `poster`: add an uploaded poster (the thumbnail otherwise comes from Google before any
choice; the consent check warns).
**Check:** `pnpm exec iapl-doctor` (no `consent-log-migration`, no `consent-banner` warning you did not decide);
`iapl-consent-check` on the built site — 0 violations, run 4 (Global Privacy Control) shows no banner; after a click on
the banner a document in *Privacy → Consent records*.
**→ 1.17.0, e-mail (the Intecion mail service (IWSN in the panel) is the default transport; Microsoft Graph deprecated; CHANGELOG 1.17.0;
PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; read which case the site is:**
1. **Every site:** no schema change, no migration, no import-map change. `pnpm payload generate:types` gives a small diff
+23 -8
View File
@@ -8,12 +8,15 @@ according to the consent from the consent module:
everything `denied`). Then it depends on `consentMode`:
- `'advanced'` (default): the `googletagmanager.com` script loads **right away,
also before consent**. With `denied`, Google stores no cookies (`_ga`), but it
can send cookieless pings — this is **not** "zero requests before consent".
sends cookieless pings — this is **not** "zero requests before consent" (what they carry: below).
Exception since 1.17.0: a visitor whose browser sends **Global Privacy Control** gets no Google request until
they grant analytics or marketing ([consent.md](./consent.md#global-privacy-control-1170)).
- `'basic'`: **zero requests to Google before consent** — the script waits until
the visitor grants analytics or marketing (see "How Consent Mode works" below).
- **Others (Meta Pixel, Microsoft Clarity, LinkedIn Insight, TikTok Pixel)** —
they have no Consent Mode, so they load **only after consent** for their
category. They react live: click "Accept" → the tag starts without a reload.
category. They react live: click "Accept" → the tag starts without a reload; withdraw → Meta, TikTok and Clarity
are told at once (1.17.0). Clarity also gets its own consent signal (`consentv2`) when it loads.
## Config
@@ -136,7 +139,19 @@ no conversion modelling for visitors without consent. The default `advanced` loa
with `denied` signals. In both modes the Consent Mode default is set first. The mode is the client's
decision — record it in `AGENTS.md` → "Project decisions".
The rule itself is `shouldLoadGoogle({ consentMode, ready, state })` — a pure function (no React, no DOM)
**What `advanced` sends before consent** (Google's documentation): the Google tag script is downloaded from
`googletagmanager.com`, and while the signals are `denied` it sends cookieless pings to Google — the timestamp,
user agent and referrer the browser adds to any request, whether the page or a previous one carried an ad-click id,
the consent state, and a random number per page load. Every request carries the visitor's IP address (Google says
Ads truncates it while `ad_storage` is denied and Analytics does not log it). No cookie is read or written. Google
uses the pings for conversion and behaviour modelling — which needs volume: GA4 about 1,000 events a day with
analytics denied for 7 days, Google Ads 700 ad clicks in 7 days per country — so on a small site the pings often buy
nothing. Under the EDPB's guidelines on the technical scope of ePrivacy art. 5(3) (2/2023) a script that makes the
browser send information is in scope whether or not a cookie is involved; no authority has ruled on Consent Mode by
name. `'basic'` sends nothing before consent. `ads_data_redaction` is set with the default (since 1.17.0).
The rule itself is `shouldLoadGoogle({ consentMode, ready, state, gpc? })` — a pure function (no React, no DOM;
`gpc`: Global Privacy Control applies, then `advanced` waits like `basic`)
exported from `@intecion/ipal-kit/client` and `@intecion/ipal-kit`. Use it for your own Google-dependent
code (a Maps embed, a YouTube player with Google Ads), so it follows the same consent rule as `<Analytics>`:
@@ -154,11 +169,11 @@ const allowed = shouldLoadGoogle({ consentMode: 'basic', ready: true, state: con
3. Click in the banner → `gtag('consent', 'update', …)` → tags react immediately.
Withdrawing consent (true → false) deletes the category's cookies (`_ga*`, `_fbp`,
`_clck`, `_ttp`, … — see [consent.md](./consent.md)) and sends an `update` to
Google, but **non-Google scripts that are already loaded (Meta, Clarity,
LinkedIn, TikTok) stay on the page until reload** — the plugin does not unload
them. The same goes for a Google tag already loaded in `basic` mode — from then
on it is governed by the Consent Mode `update`.
`_clck`, `_ttp`, … — see [consent.md](./consent.md)) and its listed storage keys, sends an `update` to
Google, and tells the non-Google tags already on the page (1.17.0): Meta `fbq('consent', 'revoke')`, TikTok
`ttq.revokeConsent()`, Clarity `clarity('consent', false)`. A script cannot be unloaded; LinkedIn Insight has no
consent call and stops with the next page load. A Google tag already loaded in `basic` mode is governed by the
Consent Mode `update` from then on.
Mapping of categories to Google signals:
+154
View File
@@ -0,0 +1,154 @@
# Cookie consent: shared behaviour spec
Version 1, 2026-11-26. Product-neutral: IAPL (`@intecion/ipal-kit`, Payload CMS) implements it in 1.17.0, IAWL
(WordPress) follows it in its consent stage. A visitor's choice must read the same in both products, and both pass
the same tests (§7). Where the products differ is said in §8. Why each rule exists, and which rules are law,
regulator guidance or vendor policy: [dev/consent-compliance-proposal.md](./dev/consent-compliance-proposal.md).
"MUST" is a requirement of this spec; "SHOULD" a default a product may let a site change.
## 1. Page delivery
1. The public page HTML MUST be the same for every visitor: nothing in it depends on the consent cookie or on a
Global Privacy Control signal. Pages stay cacheable (static, ISR, page cache, CDN).
2. The banner is in that HTML, hidden (`hidden` attribute). A small inline script placed right after it decides
**before the first paint**: show it (no current choice) or keep it hidden (a current choice, or GPC honoured). The
script reads only the consent cookie and `navigator.globalPrivacyControl`, stores nothing, loads nothing.
3. A click on a banner button before the rest of the page's script is live MUST NOT be lost: the inline script notes
it and the full script carries it out.
4. No JavaScript, or a script refused by CSP: the banner stays hidden and nothing tracks (every tag is loaded by
script).
5. The server MUST NOT render differently for `Sec-GPC`. An endpoint whose response is per visitor anyway MAY read it.
A product that ever varies a cacheable response by it sends `Vary: Sec-GPC` or marks the response private.
## 2. Categories and the record
| Category | Meaning | Switchable |
|---|---|---|
| `necessary` | needed for the site to work (session, security, the consent cookie itself, a theme or language the visitor chose when declared necessary) | no, always on |
| `functional` | remembers the visitor's settings (e.g. language cookie) | yes, off by default |
| `analytics` | measurement (GA4, Clarity, a statistics visitor id) | yes, off by default |
| `marketing` | advertising and remarketing (Google Ads, Meta, LinkedIn, TikTok) | yes, off by default |
**Cookie:** name `cookie-consent`; value = the record as JSON, URI-encoded; `Path=/`; `SameSite=Lax`; `Secure` on
HTTPS; host-only (no `Domain`); not `HttpOnly` (the browser script reads it); `Max-Age` 15552000 (180 days) for a
grant and a refusal alike (SHOULD; a site may change the period).
**Record:**
```json
{ "gpc": false, "id": "a1b2c3d4e5f6a7b8c9d0e1f2", "state": { "necessary": true, "functional": false, "analytics": true, "marketing": false }, "timestamp": "2026-11-26T10:00:00.000Z", "version": 1 }
```
- `id`: 24 lowercase hex characters, random, no personal data; kept across changes of the same visitor's choice.
- `version`: the site's policy version (integer ≥ 1). A record with another version counts as **no choice**.
- `timestamp`: ISO 8601 UTC of the choice.
- `gpc`: was the browser sending Global Privacy Control when the choice was made. Absent in records written before
this spec (IAPL before 1.17.0).
- A reader takes the **first** cookie of that name, ignores unknown fields, treats a non-boolean category as off and
`necessary` as on, and treats an unreadable value as no choice.
**Consent log entry** (server side, SHOULD be on): `consentId` (= `id`), `version`, `choices` (the four booleans),
creation time. **No IP address, no user agent.** Posted after every choice, fire and forget: a failed post never
blocks or breaks the banner. Records are deleted after a retention period (IAPL: 1095 days).
## 3. Consent Mode and other tools
| Google signal | From |
|---|---|
| `ad_storage`, `ad_user_data`, `ad_personalization` | `marketing` |
| `analytics_storage` | `analytics` |
| `functionality_storage`, `personalization_storage` | `functional` |
| `security_storage` | always `granted` |
1. The Consent Mode `default` (the stored choice with GPC applied, else all `denied`; `wait_for_update: 500`) is the
first `dataLayer` entry, before any Google tag command; `ads_data_redaction: true` is set with it.
2. Every choice pushes `gtag('consent', 'update', …)` at once.
3. Consent Mode **advanced** (SHOULD be the default): the Google tag loads before a choice with every signal denied.
**basic** (option): no request to Google before analytics or marketing is granted. Under GPC (§4) advanced behaves
like basic.
4. Other tools load only after their category is granted: Clarity (analytics), Meta Pixel, LinkedIn Insight, TikTok
Pixel (marketing). Clarity gets `clarity('consentv2', { ad_Storage, analytics_Storage })` when it loads.
5. Withdrawal (a category on → off): delete that category's cookies on this host and every parent domain, and its
listed `localStorage` / `sessionStorage` keys; tell the running tools — `fbq('consent', 'revoke')`,
`ttq.revokeConsent()`, `clarity('consent', false)`; a later grant on the same page sends `grant` / `consentv2`.
Write the record and post it to the log.
## 4. Global Privacy Control
The signal: `Sec-GPC: 1` (only the exact value `1`) and `navigator.globalPrivacyControl === true`. It is read as a
refusal of **analytics and marketing** that the visitor did not have to click. `functional` and `necessary` are not
its business.
Modes (SHOULD default to `honour`): `honour`, `ask`, off.
| Stored choice | Signal | `honour` | `ask` |
|---|---|---|---|
| none | on | no banner (decided before first paint); the reopen button; analytics, marketing off; **no request to any tracker, Google included**; nothing stored | banner shown with the GPC line; nothing sent to any tracker until a choice |
| `gpc: true` (made with the signal) | on | stands, also a grant | stands |
| `gpc: false` (made without it) granting analytics or marketing | on | both switched off at once without asking: cookies and keys deleted, tools and Google told, record rewritten with `gpc: true`, posted to the log | same |
| no `gpc` field (older record) | on | stands until it expires or the visitor changes it | stands |
| any | off | stands — the absence of the signal is never consent | stands |
- A choice the visitor makes on the site while the signal is on (settings window, or the banner in `ask`) is
specific and wins; it is stored with `gpc: true`.
- The settings window (and the banner in `ask`) shows one line, e.g. "Your browser sends a Global Privacy Control
signal. Analytics and marketing are off. You can turn them on for this site here."
- Off: the signal is ignored entirely.
- A site MAY publish `/.well-known/gpc.json` = `{ "gpc": true, "lastUpdate": "YYYY-MM-DD" }`.
- Do Not Track is not read.
## 5. Equal prominence, in testable terms
On the banner's first layer, at 360×640 and at 1280×800:
1. "Accept all" and "Reject" are both `<button>` elements, both fully inside the viewport without scrolling the
banner; one click on either completes the choice.
2. Same computed `font-size`, `font-weight`, padding, `border-radius` and rendered height.
3. Same computed `background-color`, `color` and border — **or**, where a site styles them apart: the text of
"Reject" has a contrast of at least 4.5:1 against its background, and "Reject"'s background (or border) contrasts
with the banner surface at least as much as "Accept all"'s does.
4. "Reject" is not a link, not inside the text, not behind "Settings".
5. Nothing is pre-ticked in the settings view; "Save" there is as prominent as "Accept all".
6. A way to reopen the settings is always on the page after a choice (a floating button or a footer link).
## 6. Text shown
- First layer: what the cookies are for (one or two sentences), a link to the privacy policy, and: "You can change
your choice at any time with the cookie button, and set cookie rules in your browser too." (Polish law, PKE art.
399, asks for the browser-settings part.)
- Settings view: per category a title and description; per cookie (where the site lists them) name, provider,
purpose, duration, type (cookie / local storage / session storage).
- Every text in the page's language; the editor's text wins over the default.
## 7. Shared test list
Run in a real browser against a built site (IAPL: `reference/e2e`, `iapl-consent-check`; IAWL: its end-to-end
suite). Unit tests may cover the same with a simulated DOM.
1. First visit, no choice: no tracker request (Google allowed only in advanced, with `gcs=G100`), no non-necessary
cookie or storage key; banner visible at first paint, also with the application script blocked.
2. "Reject": the same as 1 after a reload; record written with all optional categories off.
3. "Accept all": Consent Mode `update` granted, configured tools start; record written; log entry created.
4. Settings, one category: only that category's tools start.
5. Reopen and switch a category off: its cookies and keys are gone, tools told, no further request from them.
6. Policy version raised: banner again at first paint; old record ignored.
7. Record unreadable or foreign: treated as no choice.
8. GPC on, no choice (`honour`): no banner in any frame, the reopen button, no tracker request including Google,
nothing stored; the GPC line in the settings window.
9. GPC on, a grant in the settings window: tools start; record has `gpc: true`; the next page keeps it.
10. Grant made with GPC off, then GPC on: analytics and marketing off, their cookies deleted, record rewritten with
`gpc: true`, posted to the log.
11. Equal prominence (§5) at both sizes.
12. The page HTML is identical with and without the cookie and the signal; cache headers unchanged; no `Vary` on
`Sec-GPC`.
13. No JavaScript: nothing tracks.
## 8. Where the products differ
| | IAPL | IAWL |
|---|---|---|
| Opt-outs | props and plugin options (`gpc`, `equalChoice`, `consentLog: false`, `maxAgeDays`) | code constants (no panel switch for protections) |
| Banner | React component, server-rendered | rendered by PHP, behaviour in a small plain script |
| Consent log storage | `consent-records` collection (MongoDB, or a table on Postgres / SQLite) | its own table |
| Site statement | `gpcWellKnown()` route handler | to be decided in its consent stage |
+129 -27
View File
@@ -45,11 +45,13 @@ when you update them.
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
<SiteProviders shell={await getSiteShell(locale)} logEndpoint="/api/ipal/consent"
banner={<CookieBanner equalChoice classNames={…} />}>{children}</SiteProviders>
<SiteProviders shell={await getSiteShell(locale)}
banner={<CookieBanner settings="detailed" classNames={…} />}>{children}</SiteProviders>
```
`SiteProviders` also takes `cookieMap`, `banner={false}`, `cookieButton={false}`
(or your own element) and `analytics={false | { consentMode, defer, deferTimeoutMs }}`
(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:
@@ -82,8 +84,10 @@ export default async function Layout({ children, params }) {
`ConsentProvider` — props: `texts` (required, `ConsentTexts` from `getConsentTexts`),
`cookieMap` (extra cookies to delete on withdrawal), `logEndpoint`
(consent log), `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)).
(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).
@@ -100,11 +104,11 @@ takes `locale` and optional `labels`; defaults: `COOKIE_TABLE_LABELS` (`@intecio
| `CookieBanner` prop | Default | Description |
|---|---|---|
| `classNames` | — | slots (table below) — a given one replaces the default |
| `equalChoice` | `false` | "Reject" styled as the primary button |
| `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 |
| `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'`) |
@@ -116,6 +120,81 @@ moves up by its visible part (`bottomOverlap`), so it never covers footer links.
`--ipal-cookie-button-offset` (from the bottom, default `1rem`), `--ipal-cookie-button-inset` (from the
side, default `1rem`); z-index `--ipal-z-header`. Type `CookieButtonProps`.
## Compliance defaults (1.17.0)
What the plugin now does with no project setting, each with its opt-out. Where the rules come from, and which are
law, regulator guidance or vendor policy: [dev/consent-compliance-proposal.md](./dev/consent-compliance-proposal.md).
The behaviour both IAPL and IAWL follow: [consent-behaviour-spec.md](./consent-behaviour-spec.md).
| Default | Opt-out |
|---|---|
| Global Privacy Control honoured (below) | `gpc="ask"` or `gpc={false}` on `SiteProviders` / `ConsentProvider` |
| "Reject" styled like "Accept all" (`equalChoice`) | `<CookieBanner equalChoice={false} />` |
| Consent log on (`consent-records`, posted by `SiteProviders`) | `iapl({ consentLog: false })`, or `logEndpoint={false}` on one layout |
| Withdrawal tells the running tools (Meta, TikTok, Clarity) and removes listed storage keys | none needed (a fix); `signalVendors` is exported for your own banner |
| Clarity gets its consent signal (`consentv2`) when it loads | — (Clarity needs one for EEA visits since 31 October 2025) |
| `ads_data_redaction` with the Consent Mode default | — (it acts only while `ad_storage` is denied) |
| Default text: "You can change your choice at any time with the cookie button, and set cookie rules in your browser too." | your own text in Cookies → *Banner* → message (the default is used only when it is empty) |
Not changed: Consent Mode stays `'advanced'` by default (the Google tag loads before a choice with every signal
`denied` and sends cookieless pings — [analytics.md](./analytics.md#how-consent-mode-works)); `'basic'` is the option for
"no request to Google before consent". The re-ask period stays 180 days (`maxAgeDays` to change it).
### Global Privacy Control (1.17.0)
Global Privacy Control ([W3C draft](https://www.w3.org/TR/gpc/)) is a browser setting that says "do not sell or
share my data": the browser sends `Sec-GPC: 1` and exposes `navigator.globalPrivacyControl === true`. Brave and
DuckDuckGo send it by default, Firefox on request and in private windows; Chrome and Safari are adding a setting.
In the EU it has no binding force of its own today (in California and eleven more US states it must be honoured);
optional categories are off until opt-in anyway, so the plugin reads it as a **refusal of analytics and marketing
that the visitor did not have to click**, and a choice the visitor makes on the site wins.
| Stored choice | Signal | `gpc: 'honour'` (default) |
|---|---|---|
| none | on | no banner (decided before the first paint), the cookie button; analytics and marketing off; **no request to Google** (also in Consent Mode `advanced`) or a pixel; nothing stored |
| made with the signal on (`gpc: true` in the record) | on | the choice stands, also a grant — the visitor chose it for this site |
| made without the signal (`gpc: false`) that granted analytics or marketing | on | both switched off without asking: cookies and listed storage keys deleted, the tools and Google told, the record rewritten (`gpc: true`) and posted to the consent log |
| from before 1.17.0 (no `gpc` field) | on | stands until it expires or the visitor changes it |
| any | off | stands — the absence of the signal is never consent |
`functional` is not the signal's business (no data is shared): a functional grant stays; with no choice it is off,
as for everyone. In the settings window (cookie button) a line says the signal is honoured
(`texts.gpcNotice`, filled by `getConsentTexts` in Polish or English; `classNames.gpcNotice`); "Accept all" or a
saved category there is the visitor's own choice and is stored with `gpc: true`.
- `gpc="ask"`: the banner is shown as usual (with the line); until a choice nothing is sent to any tracker, Google
included. `gpc={false}`: the signal is ignored (before 1.17.0) — iapl-doctor warns.
- **Static pages stay static.** The signal is read in the browser — by the first-paint script
(`consentBannerScript({ gpc })`) and the consent store — never while rendering a page: the HTML is the same with
and without it, and no `Vary` is needed. In server-read mode (`consentCookie`) a visitor with no stored choice
still gets the hidden banner and the script, because the server cannot know the signal.
- **On the server**, where a response is per visitor anyway: `gpcFromHeaders(headers)` (`Sec-GPC: 1` exactly). The
statistics endpoint uses it: a visitor id is not accepted while the signal overrides a choice made without it.
Reading the header in a layout makes the page dynamic; a cached response that differs by it needs
`Vary: Sec-GPC` (many CDNs then refuse to cache or need a rule) — so don't.
- **Building blocks:** `resolveConsent(record, signal, mode)` (pure, the table above), `gpcFromNavigator()`,
`gpcFromHeaders()`, `GPC_CATEGORIES`, `GPC_HEADER`, types `GpcMode`, `ResolvedConsent` (all `@intecion/ipal-kit`);
`readEffectiveConsent(version, mode)` from `/client` (the stored choice with the signal applied, read live —
for your own tag loader).
- **The site statement** `/.well-known/gpc.json` (optional): `app/.well-known/gpc.json/route.ts` with
`export const GET = gpcWellKnown({ lastUpdate: '2026-11-26' })` (`@intecion/ipal-kit`). The proxy's matcher
usually skips paths with a dot; if yours does not, let this path through.
- Do Not Track is not read (retired by the W3C; removed from Firefox). A site should never *state* that it ignores
browser signals (a German court treated DNT as a valid objection).
### Withdrawal stops what already runs (1.17.0)
When a category goes from on to off (the visitor reopens the settings, or GPC overrides an old grant):
- its cookies are deleted — the built-in list (`DEFAULT_COOKIE_MAP`), `cookieMap`, and the panel's cookie list
(Cookies → *Cookie list*, rows of that category), on this host and every parent domain;
- its **browser storage keys** from the panel's cookie list (rows of type *Local storage* / *Session storage*,
`name*` = prefix) are removed; necessary rows never;
- the tools already running are told: Meta Pixel `fbq('consent', 'revoke')`, TikTok `ttq.revokeConsent()`,
Clarity `clarity('consent', false)` (stops and erases its cookies); granting again on the same page sends
`grant` / `consentv2`. LinkedIn Insight has no such call: it stops with the next page load. Google gets the
Consent Mode update as before. Building blocks: `signalVendors(prev, next)`, `clarityConsent(state)` (`/client`).
## First paint: the banner is part of the first render (1.17.0)
Before 1.17.0 the banner rendered nothing until React had hydrated the page and an effect had read the
@@ -133,6 +212,7 @@ parsed, before the browser paints:
|---|---|---|
| no decision; decision under an older **Policy version**; unreadable or foreign `cookie-consent` | `hidden` removed → banner painted with the page | the same element becomes live (no re-render, no shift: the bar is `position: fixed`) |
| current decision | `display: none` on the banner → never painted | React removes it; `CookieButton` appears |
| no decision, browser sends Global Privacy Control (`gpc: 'honour'`, default) | `display: none` → never painted | React removes it; `CookieButton` appears |
| JavaScript off, or a CSP refused the script | banner stays hidden | with JS: appears after hydration, as before 1.17.0; without JS: no banner (and no tag: every tag is loaded by JS) |
The script decides exactly as `readConsentRecord` does, reads only the consent cookie, stores nothing and
@@ -143,7 +223,7 @@ React hydrates with "no decision" (what the server rendered) and switches to the
before the next paint (`useSyncExternalStore`).
What does **not** change: what counts as consent, when tags load (nothing earlier), the Consent Mode
default (still pushed first), the cookie (`cookie-consent`, `{ id, state, timestamp, version }`), the
default (still pushed first), the cookie (`cookie-consent`, `{ id, state, timestamp, version }`, plus `gpc`), the
consent log, withdrawal, `CookieButton`, the settings window in all three modes, texts per language.
**CSP.** With the header-only policy (`buildSecurityHeaders`, `'unsafe-inline'` for scripts — what
@@ -184,7 +264,7 @@ dynamic anyway (a nonce CSP, signed-in pages). `undefined` (the prop left out) =
| Banner at first paint for a new visitor | yes | yes |
**Your own banner** (AGENT.md §7 says: don't; when you must): `consentBannerScript({ version })` from
`@intecion/ipal-kit` (options: `ConsentBannerScriptOptions` — `version`, `cookieName`) is the same script — put `hidden` and `suppressHydrationWarning` on your banner's root and
`@intecion/ipal-kit` (options: `ConsentBannerScriptOptions` — `version`, `cookieName`, `gpc`) is the same script — put `hidden` and `suppressHydrationWarning` on your banner's root and
the script in a `<script>` as its next sibling; `useConsentContext()` gives `hydrated` (false in the
server render and while hydrating) and `serverRead`.
@@ -466,23 +546,26 @@ to add the hook to a config. Nothing to migrate.
LinkedIn, TikTok, Hotjar…) — also on the parent domain (`.client.com`), where GA stores them.
The project's own cookies: `<ConsentProvider cookieMap={{ marketing: ['_my*'] }}>` (added to the
default list, `*` = prefix).
- **Equal choice:** `<CookieBanner equalChoice />` — "Reject" looks like "Accept all"
(UODO/EDPB requirement: refusing must be as easy as consenting). Off by default so the look of
existing sites does not change; **turn it on in new projects**.
- **Consent log (proof of consent, GDPR Art. 7(1)):** `iapl({ consentLog: true })` or
`iapl({ consentLog: { retentionDays: 730 } })` + `<ConsentProvider logEndpoint="/api/ipal/consent">`
(or `SiteProviders logEndpoint`). It stores a random identifier (the same as in the cookie), the
choices, the policy version and the time — **no IP and no user agent**. *Consent records* collection
(admin only), automatic cleanup after `retentionDays` (default 1095). Details below. Postgres:
`migrate:create`.
- **Equal choice:** "Reject" looks like "Accept all" — **the default since 1.17.0** (`equalChoice={false}`
restores the secondary look). This is the position of the EU data-protection authorities (EDPB Cookie Banner
Taskforce report, 2023: no reject option on a layer that has a consent button is an infringement for a vast
majority of them; colours are judged case by case), repeated in a UODO article (2025); it is regulator guidance,
not a statute, and no UODO or UKE decision on a banner was found.
- **Consent log (proof of consent, GDPR Art. 7(1)):** **on by default since 1.17.0**;
`iapl({ consentLog: { retentionDays: 730 } })` to change it, `consentLog: false` to turn it off.
`SiteProviders` posts every decision there by itself (`shell.consentLogEndpoint`); a hand-wired
`<ConsentProvider>` needs `logEndpoint="/api/ipal/consent"`. It stores a random identifier (the same as in the
cookie), the choices, the policy version and the time — **no IP and no user agent**. *Consent records*
collection (admin only), automatic cleanup after `retentionDays` (default 1095). Details below.
**Postgres / SQLite: a new table** — [create and apply a migration](#postgres-sqlite-the-consent-log-is-a-table).
- **Cookie table** for the policy page: Cookies → *Cookie list* + `getCookieTable` + `<CookieTable>` from `/rsc`.
Fill the list from the panel with the cookie scanner (`cookieScanner` option — one approval adds every cookie found to the list, the table and the detailed window,
[cookie-scanner.md](./cookie-scanner.md)) and check the real site with `iapl-consent-check` → cookie-scan.
- Consent cookie: `cookie-consent` (`CONSENT_COOKIE`), JSON `{ id, state, timestamp, version }`,
`max-age` 180 days (`CONSENT_MAX_AGE`), `samesite=lax`, `Secure` on HTTPS. Consent with another
`max-age` 180 days (`CONSENT_MAX_AGE`; `maxAgeDays` changes it), `samesite=lax`, `Secure` on HTTPS. Since 1.17.0
the record may carry `gpc` (was the signal on when the choice was made). Consent with another
policy version is treated as no decision.
- Global Privacy Control is not needed: in the EU everything except necessary is off by default
anyway until consent.
- Global Privacy Control: honoured by default since 1.17.0 — [above](#global-privacy-control-1170).
## Consent log — details (`consentLog`)
@@ -494,13 +577,30 @@ to add the hook to a config. Nothing to migrate.
| Collection | `consent-records` (`CONSENT_LOG_SLUG`), group *Privacy*; fields `consentId` (index), `version`, `choices.{necessary,functional,analytics,marketing}`, `createdAt` |
| Collection access | `read` / `delete` — admin (without `access`, i.e. no roles: any logged-in account — narrow it with `collectionOverrides`); `create` / `update` — nobody through the API (written only by the endpoint, `overrideAccess`) |
| Endpoint | `POST /api/ipal/consent`, public (no login) |
| Body | `{ id: string (hex 16–64), version: int ≥ 1, state: { necessary, functional, analytics, marketing: boolean } }` |
| Responses | `201 { ok: true }`, `400` (bad JSON/validation), `429` (limit 20 requests/min per IP, scope `consent`), `500` |
| Default | on (since 1.17.0); `consentLog: false` = no collection, no endpoint, `shell.consentLogEndpoint` null |
| Body | `{ id: string (hex 16–64), version: int ≥ 1, state: { necessary, functional, analytics, marketing: boolean }, gpc?: boolean }` (`gpc` is accepted and not stored) |
| Responses | `201 { ok: true }`, `400` (bad JSON/validation), `429` (limit 20 requests/min per IP, scope `consent`), `503` (the table does not exist: one log line per process), `500` |
| Cleanup | on a write, at most once per 24 h per process: one `db.deleteMany` for records older than `retentionDays`, **in the background** (the consent write does not wait; an error is logged and the cleanup is retried on the next write) |
The provider sends a record after every decision (`fetch` with `keepalive`, errors ignored —
the banner never waits). By hand: `buildConsentLogCollection()` / `buildConsentLogEndpoint(opts)`
from `@intecion/ipal-kit`.
from `@intecion/ipal-kit`; `CONSENT_LOG_PATH` is the endpoint's path under the API route (`/ipal/consent`).
### Postgres / SQLite: the consent log is a table
On MongoDB the collection appears by itself. On a SQL database `consent-records` is a table (`consent_records`
plus `consent_records_choices`… as Payload names them), so the deploy that brings 1.17.0 to a project that never had
`consentLog` on must create it — **in the same deploy**, before the new version serves requests:
```bash
pnpm payload migrate:create consent-log # commit the file in src/migrations/
pnpm payload migrate # applied at container start (prodMigrations, or `pnpm payload migrate && pnpm start`)
```
Or `iapl({ consentLog: false })` when the project does not want the log. Without the table nothing breaks: the page
and the banner work, each choice answers `503` and the server logs once *"the consent-records table does not
exist — create and apply a migration…"*; `iapl-doctor` reports `consent-log-migration` as an error while no
migration in `src/migrations` creates `consent_records`.
Narrow who reads the records (e.g. a project without roles, only the data protection officer):
@@ -516,9 +616,10 @@ iapl({
- **Turn off:** do not mount `CookieBanner` / `CookieButton` (or `SiteProviders banner={false}
cookieButton={false}`). The `cookie-settings` global is currently always added (no option to drop
it); the consent log only with `consentLog`.
it); the consent log with `consentLog: false`; Global Privacy Control with `gpc={false}`.
- **Override:** texts and the cookie list in the panel; the look with `--ipal-*` tokens and `classNames`;
the layout with the props `order`, `settings`, `controls`, `settingsActions`, `equalChoice`, `icon`;
`gpc` and `maxAgeDays` on the provider;
the log's `retentionDays`; `privacyPolicy` / `settingsSlug` in `getConsentTexts`. The `cookie-settings`
global (write access is `admin` + `editor` by default, hooks, admin options):
`iapl({ globalOverrides: { 'cookie-settings': { access: { update } } } })` — your access rules win,
@@ -532,5 +633,6 @@ iapl({
warning, optional e-mail ([cookie-scanner.md → Browser crawl](./cookie-scanner.md#browser-crawl)).
- **Extend:** `cookieMap` (your own cookies to delete), `ConsentScript` (scripts without Consent
Mode), `useConsentContext()` (your own UI: `state`, `acceptAll`, `rejectAll`, `savePreferences`,
`reopen`, `texts`), server-safe helpers (`parseConsent`, `readConsentRecord`, `CONSENT_COOKIE`,
`getCookieTable`) and the builders `buildConsentLogCollection` / `buildConsentLogEndpoint`.
`reopen`, `texts`, `gpc`, `gpcMode`), server-safe helpers (`parseConsent`, `readConsentRecord`, `CONSENT_COOKIE`,
`getCookieTable`, `resolveConsent`, `gpcFromHeaders`) and the builders `buildConsentLogCollection` /
`buildConsentLogEndpoint`.
+3 -2
View File
@@ -172,7 +172,7 @@ export default buildConfig({
twoFactor: { issuer: 'Nazwa Klienta', plugin: payloadTotp },
whiteLabel: true, // logo/name from Site settings in the admin panel
indexNow: true, // publish → Bing / ChatGPT Search (production)
consentLog: true, // proof of consent (GDPR Art. 7(1)), no personal data
// consentLog: on by default since 1.17.0 (proof of consent, GDPR Art. 7(1), no personal data); false = off
// adminRoute: '/its', // + move app/(payload)/admin → its and put `its` in the proxy matcher (§2.6)
}),
buildR2Storage(['media'], { s3Storage }), // ALWAYS — R2 when all R2_* are in env, local disk without them
@@ -303,7 +303,7 @@ export default async function LocaleLayout({ children, params }: Props) {
<html lang={locale}>
{/* NO <head> — Next manages it itself */}
<body>
<SiteProviders shell={shell} logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice />}>
<SiteProviders shell={shell} banner={<CookieBanner settings="detailed" />}>
{/* <Header …/> */}
<main>{children}</main>
{/* <Footer …/> */}
@@ -685,6 +685,7 @@ Do one item at a time, build, check. Order by importance:
| 75 | **1.17.0 — e-mail: launch day and copies** — a site moves from `<name>.dev.netscale.pl` to its real domain (the real domain must send with no click); or production's database is copied to a development or staging address (it must not mail real people); or the start stops with "`developmentHosts` must be an array of host patterns" | Nothing to run on launch day. A development address matching `iapl({ developmentHosts })` (built in `*.dev.netscale.pl`) or a site with `IAPL_NOINDEX=1` that holds another host's connection sends nothing until an admin presses "Connect again". Other staging hosts: add their pattern to `developmentHosts` (an array of non-empty patterns; `[]` = none). Production never keeps `IAPL_NOINDEX` | `iapl-upgrade` "→ 1.17.0, e-mail", email.md "Staging, copies and several hosts" |
| 76 | **1.17.0 — public pages: Chrome requests the first page of a visit twice** — `curl -sI <site>/pl` shows `Critical-CH: Sec-CH-Prefers-Color-Scheme` (Payload's `withPayload` adds it for every path; only the admin reads the hint); Lighthouse lists the same URL twice under redirects | `next.config.ts`: `withSecurityConfig(withPayload(nextConfig))` — the plugin's wrapper OUTSIDE (was inside). Another panel address: `{ adminClientHints: { route } }`; keep the old behaviour: `{ adminClientHints: false }`. Without the edit nothing changes | `iapl-upgrade` "→ 1.17.0, the public pages' first request", security.md "Client hints" |
| 77 | **1.17.0 — cookie banner at first paint** — the banner appeared seconds after the page (after hydration) and was the LCP element on text pages; or after the update an e2e test finds a hidden `[data-ipal="banner"]` for a returning visitor; or with a nonce CSP the console reports a refused inline script | Nothing to run: the banner is now in the server HTML and an inline script shows or hides it before the first paint; pages stay static; consent, tags and the log are unchanged. Remove a project "mounted" wrapper around the banner. Nonce CSP: `<SiteProviders nonce>`. Tailwind 3 with a `classNames.root` that sets `display`: `[data-ipal="banner"][hidden] { display: none !important }`. Old behaviour: `<CookieBanner firstPaint={false} />`; exact HTML on a dynamic site: `consentCookie` | `iapl-upgrade` "→ 1.17.0, cookie banner at first paint", consent.md "First paint" |
| 78 | **1.17.0 — consent compliance** — after the update "Reject" looks like "Accept all"; a browser with Global Privacy Control sees no banner; *Privacy → Consent records* fills with every choice; or on Postgres / SQLite the log says "the consent-records table does not exist" and doctor reports `consent-log-migration` | MongoDB: nothing to run. Postgres / SQLite without the log before: `pnpm payload migrate:create consent-log` + apply in the same deploy, or `iapl({ consentLog: false })`. `generate:types`. Opt-outs: `equalChoice={false}`, `gpc="ask"` / `gpc={false}`, `consentLog: false`, `logEndpoint={false}` | `iapl-upgrade` "→ 1.17.0, consent compliance", consent.md "Compliance defaults" |
After updating the package: `pnpm exec iapl-skills` (new skill versions), `pnpm payload generate:importmap`, `rm -rf .next`, restart dev, grep for the new symbol in
`node_modules/@intecion/ipal-kit/dist`.
+4 -2
View File
@@ -141,7 +141,7 @@ import { SiteProviders } from '@intecion/ipal-kit/rsc'
import { getSiteShell } from '@/lib/content'
<body>
<SiteProviders shell={await getSiteShell(locale)} logEndpoint="/api/ipal/consent">
<SiteProviders shell={await getSiteShell(locale)}>
<Header /><main>{children}</main><Footer />
</SiteProviders>
</body>
@@ -154,7 +154,9 @@ It does not mount `AlternateLinksProvider` (i18n.md) — add it yourself if you
| Prop | Default | What it does |
|---|---|---|
| `shell` | — (required) | result of `getSiteShell(locale)` |
| `logEndpoint` | — | consent log endpoint (`consentLog`) |
| `logEndpoint` | `shell.consentLogEndpoint` | consent log endpoint (on by default since 1.17.0); `false` = decisions not posted |
| `gpc` | `'honour'` | Global Privacy Control: `'honour'`, `'ask'`, `false` (consent.md) |
| `maxAgeDays` | `180` | days a choice is kept before the banner asks again |
| `banner` | `<CookieBanner />` | your own banner or `false` |
| `cookieButton` | `<CookieButton />` | your own button or `false` |
| `consentCookie` | — | optional server read of the consent cookie (`(await cookies()).get(CONSENT_COOKIE)?.value ?? null`): exact HTML, but the pages become dynamic. Left out (default): pages stay static and the banner decides before the first paint with an inline script — consent.md → "First paint" |
+1 -1
View File
@@ -66,7 +66,7 @@ After enabling: `pnpm payload generate:importmap` (components `@intecion/ipal-ki
With `SiteProviders`:
```tsx
<SiteProviders shell={shell} logEndpoint="/api/ipal/consent" stats={{ locale }}>
<SiteProviders shell={shell} stats={{ locale }}>
```
Or by hand — **inside `ConsentProvider`**: