Cookies: fill empty languages, and one Cookies entry in the admin

Every language filled (fillEmptyLocales, default on): text saved in one
language goes to every language where the same field is still empty, never
over a language's own text. Applies to the cookie list (purpose, duration)
and the cookie review (purpose, duration). Scanner and approval writes give
a language without its own text the default language's text. Building
blocks: buildFillEmptyLocalesGlobalHook / CollectionHook, fillEmptyLocales,
withFillLocales.

One Cookies entry (cookieScanner.adminLayout, default combined): the
Cookie banner global is now labelled Cookies and gets Review and approve
(scan box and approval list inline) and Site check tabs, built from ui
fields. Cookie review and Cookie check leave the navigation
(admin.group false) but keep their pages, data and API. This is
presentation only: no schema change and no migration, only
generate:importmap. adminLayout separate keeps the old layout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-28 22:55:11 +01:00
co-authored by Claude Opus 5.5
parent a9e1adc03b
commit b10c2dc0e3
34 changed files with 812 additions and 96 deletions
+3 -1
View File
@@ -108,7 +108,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 `ipalKit`; `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"; `ipalKit({ 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); 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; Cookie banner → Settings window → Cookie list headings in every language | consent.md, analytics.md | A, `ipal-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"; `ipalKit({ 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); 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, `ipal-consent-check` |
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `withPayload(withSecurityConfig(nextConfig))` (no `X-Powered-By`); 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`; check: a new admin lands on `/admin/setup-totp?back=%2Fadmin` with the QR, no reloading); `IPAL_IP_HEADER` in production | security.md, forms.md | A |
| 14 | Operations | `src/app/api/health/route.ts` (`healthRoute`); `src/instrumentation.ts` with `assertEnv(ipalEnvRules({ storage: true, ipHeader: true }))`; staging with `IPAL_NOINDEX=1`; smoke tests (§8a) | `healthRoute`, `assertEnv`, `ipalEnvRules` | 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 |
@@ -982,6 +982,8 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
| Global saves revalidate the layout (with `ipalKit({ revalidatePath })`) | omit `revalidatePath`; once: `context: { disableRevalidate: true }` | `buildGlobalRevalidateHook` on your own globals |
| Staff features without `access` (no roles field): every logged-in account passes (`userMeetsRole`) | add `access` (roles decide) | `globalOverrides`, `forms.formSubmissionOverrides`, `consentLog.collectionOverrides`, `stats.collectionOverrides` |
| Cookie check (`crawl`): start editor+ or the token, results token-only for the running job, latest result only, dashboard warning on, e-mail off until recipients are set | omit `crawl`; `crawl.dashboard: false` | `crawl.serviceUrl` / `token` / `siteUrl` / `maxPages` / `acceptSelector` / `consentMode` / `trackerHosts` / `globalOverride`; *Cookie check → Warning e-mails to*; building blocks `ingestCrawlResult`, `findCrawlViolations`, `parseCrawlResult` |
| Cookie admin: one *Cookies* entry — review list and site check as tabs, their own entries out of the navigation (pages and API kept) | `cookieScanner.adminLayout: 'separate'` | `addCookieScannerTabs`, `CookieReviewTab`, `CookieSiteCheckTab`; `collectionOverrides` / `crawl.globalOverride` win |
| 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`) |
@@ -50,14 +50,14 @@ list in the panel and you check it:
(Postgres), commit the migration. Embeds and widgets the plugin does not inject (YouTube, maps,
chat): add them as `cookieScanner.declarations` (or an `integrations` entry with `isEnabled`) —
never a hand-typed list in code.
2. *Privacy → Cookie review* → **Scan cookies**. "Integrations in use" must match the IDs in Site
2. *Privacy → Cookies → Review and approve* → **Scan cookies** (with `adminLayout: 'separate'`: *Privacy → Cookie review*). "Integrations in use" must match the IDs in Site
Integrations; a filled ID that is missing → **ipal-debug**.
3. Run the browser scan below and paste every cookie it reports as unknown into **More cookie
names**, scan again. Cookies marked **Needs description** need provider, category and
purpose: ask the client, do not guess (Edit on the approval page opens the entry).
4. **Review and approve** (`/admin/cookie-approval`): the cookies are grouped by category, new /
4. **Approve** in the same tab (also at `/admin/cookie-approval`): the cookies are grouped by category, new /
changed / needs-description marked. Untick anything that should not be listed, then **Approve
and add** — every ticked cookie goes to Cookie banner → Cookie list in every language (and so
and add** — every ticked cookie goes to Cookies → Cookie list in every language (and so
to the cookie policy table and the banner's detailed window); existing text is never
overwritten, no row is duplicated. Unknown cookies land in `marketing` (or
`approval.unknownCategory`) flagged "Needs description" — describe them before handover.
@@ -105,7 +105,7 @@ unknown names to the panel scan above instead of step 2):
**non-necessary cookie set before consent** — fix it as in the table above. `[WARNING] unknown` —
find the provider and purpose, set `category` (`necessary|functional|analytics|marketing`) and `purpose`
in `cookies.json`. Do not guess — ask if you do not know.
2. Import into the panel (Cookie banner → Cookie list), each language separately (scan with `--lang en` for English):
2. Import into the panel (Cookies → Cookie list), each language separately (scan with `--lang en` for English):
```bash
LOCALE=pl pnpm payload run .agents/skills/ipal-consent-check/scripts/import-cookies.ts cookie-scan/cookies.json
```
@@ -113,7 +113,7 @@ unknown names to the panel scan above instead of step 2):
the scan did not see — the editor does that in the panel. The same list feeds the
`<CookieBanner settings="detailed">` window (an expandable list under each category) — after the import open
"Settings" in the banner and check that every category shows its cookies and that the labels
(Cookie banner → Settings window → Cookie list headings) are in that language.
(Cookies → Settings window → Cookie list headings) are in that language.
3. The cookie policy page shows the table from the panel — **do not paste the list into the policy text**:
```tsx
import { getCookieTable } from '@intecion/ipal-kit'
@@ -124,7 +124,7 @@ unknown names to the panel scan above instead of step 2):
<CookieTable rows={rows} categories={consent.categories} labels={labels} />
```
`labels` = `{ name, category, provider, purpose, duration }` (all required). The plugin panel
has only `provider` / `purpose` / `duration` (Cookie banner → Settings window → Cookie list headings = `consent.details`);
has only `provider` / `purpose` / `duration` (Cookies → Settings window → Cookie list headings = `consent.details`);
take the `name` and `category` headers from (localized) fields of the project block. The table is unstyled
(`classNames`: `table`, `caption`, `tr`, `th`, `td`; optional `caption`). A project "Cookie
table" block on the policy page is a good place — then the editor decides where it appears.
+5 -2
View File
@@ -66,7 +66,9 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `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.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 |
| `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 Cookie banner → 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 Cookie banner → Cookie list (cookie-scanner.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) |
| `cookieScanner.adminLayout` | `'combined'` | one *Cookies* entry: *Review and approve* and (with `crawl`) *Site check* tabs on the `cookie-settings` global (`ui` fields, `CookieReviewTab` / `CookieSiteCheckTab`); `cookie-review` and `cookie-crawl` get `admin.group: false` (out of the nav, pages and API kept) | `'separate'`; no migration, `generate:importmap` |
| `fillEmptyLocales` | on | afterChange hooks: text saved in one language fills the empty languages of `cookie-settings` `cookies.purpose` / `cookies.duration` and `cookie-review` `purpose` / `retention`; never overwrites a language's own text | `false`; `{ 'cookie-settings': [...], 'cookie-review': [...] }` (`[]` = off); check: add a cookie in Polish, switch the locale to English → same purpose |
| `cookieScanner.approval` | on | `false` = per-entry review only (no view, endpoint or reminder); `{ unknownCategory, dashboard }` — category for cookies nothing knows (default `'marketing'`, must need consent), dashboard reminder | adds `change` + `needsDescription` to `cookie-review` → `migrate:create` when upgrading |
| `cookieScanner.declarations` / `.integrations` | built-ins only | the project's own cookies (`CookieDeclaration[]`), or `(defaults) => CookieIntegration[]` to add / change / drop integrations (`key`, `label`, `declarations`, `isEnabled(ctx)`) | e.g. a chat widget on when `ctx.integrations.chatId` is filled |
| `cookieScanner.access` / `.collectionOverrides` / `.labels` | editor+ / none / `en` + `pl` | who may scan; changes `cookie-review` like `consentLog.collectionOverrides`; admin labels per language (`CookieScanLabels`) | object or function |
@@ -122,6 +124,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `IntecionCredit` | `afterLogin`, `afterNavLinks` | `whiteLabel` and `credit !== false` |
| `StatsNavLink`, `StatsView` (`views.ipalStats`, `/stats`), `StatsWidget` (`beforeDashboard`) | nav, view, dashboard | `stats` (`dashboard: false` without the widget) |
| `CookieScanButton` | `beforeListTable` of `cookie-review` (with **Check site** when `crawl` is on) | `cookieScanner` |
| `CookieReviewTab`, `CookieSiteCheckTab` | `ui` fields in the `cookie-settings` tabs | `cookieScanner` with `adminLayout !== 'separate'` (Site check: `crawl`) |
| `CookieApprovalView` (+ client `CookieApprovalForm`) | `views.ipalCookieApproval`, path `/cookie-approval` | `cookieScanner` and `approval !== false` |
| `CookieCrawlAlert` | `beforeDashboard` | `cookieScanner` with `approval.dashboard !== false` ("Waiting for approval"), or `crawl` with `dashboard !== false` |
| `IntegrationAlerts` | `beforeDashboard` | **currently always** (renders nothing when everything works) |
@@ -172,7 +175,7 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
| Turnstile | panel / env | `SiteProviders` wires `TurnstileProvider`; keys in Site integrations → Turnstile or env; server: `verifyTurnstile` (`/server`) | widget in the form; dashboard alert on a bad key | turnstile.md |
| consent | layout + policy page | banner via `SiteProviders`; table `<CookieTable rows={…} labels={…} />` (`/rsc`) from `getCookieTable` | `ipal-consent-check`; delete the consent cookie → the banner comes back | consent.md |
| cookie crawl | config + env + service | `cookieScanner: { crawl: true }`, `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN`, site in the service's `IPAL_CRAWLER_SITES`; optional Coolify scheduled task `curl -X POST -H "Authorization: Bearer $IPAL_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** → Cookie banner → Cookie list; `<CookieBanner settings="detailed">` and `<CookieTable>` list it | cookie-scanner.md |
| 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 |
| stats | config + layout | `stats: true` + `<SiteProviders stats={{ locale }}>` (or `<PageStats locale />` inside `ConsentProvider`) | `/<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 |
@@ -25,6 +25,8 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `RowLabel` | `@intecion/ipal-kit/admin` | Array row title in the panel taken from the row content (e.g. "Fast delivery" instead of "Item 01"). Do not wire by hand — use `rowLabel()`; after adding, `pnpm generate:importmap`. |
| `AdminLogo` | `@intecion/ipal-kit/admin` | Server Component: large panel logo (login screen) from SiteSettings `logo`, fallback `siteName`. Injected by the plugin with `whiteLabel`; after turning the option on, `pnpm generate:importmap`. |
| `AdminIcon` | `@intecion/ipal-kit/admin` | Server Component: small panel nav icon from SiteSettings `favicon`, fallback initials. Injected by the plugin with `whiteLabel`; after turning the option on, `pnpm generate:importmap`. |
| `CookieReviewTab` | `@intecion/ipal-kit/admin` | Client: the *Review and approve* tab of *Cookies* — scan box + approval list inline (reloads after approving; waits while the form has unsaved changes) + link to the review entries. Injected by `addCookieScannerTabs` (combined layout); `pnpm generate:importmap`. |
| `CookieSiteCheckTab` | `@intecion/ipal-kit/admin` | Client: the *Site check* tab — start a check, status, latest violations, link to the warning e-mails. Injected with `crawl` in the combined layout. |
| `CookieApprovalView` | `@intecion/ipal-kit/admin` | Server Component: the *Approve cookies* view at `/admin/cookie-approval` — everything waiting, grouped by consent category, one **Approve and add**. Injected with `cookieScanner` (unless `approval: false`); after turning it on, `pnpm generate:importmap`. |
| `CookieApprovalForm` | `@intecion/ipal-kit/admin` | Client part of the view: tick boxes, markers (New / Changed / Needs description), Edit links, the button. Props `pending`, `gone`, `unknownCategory`, `labels?`, `adminRoute?` — reuse it in your own view. |
| `CookieCrawlAlert` | `@intecion/ipal-kit/admin` | Server Component: dashboard warning — "Waiting for approval: N" with a link to the approval view, and with the crawl violations or a failed crawl; renders nothing otherwise. Props `approval`, `crawl`. Injected with `cookieScanner` (`approval.dashboard: false` / `crawl.dashboard: false` drop its parts); after turning it on, `pnpm generate:importmap`. |
@@ -115,14 +117,14 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `useConsent(options?)` | `@intecion/ipal-kit/client` | Low-level consent state hook → `{ state, decided, consentId, acceptAll, rejectAll, savePreferences, reopen }`. Usually use `ConsentProvider` + `useConsentContext` (the provider calls it itself). |
| `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: Cookie banner → Cookie list rows in one language → `Promise<CookieTableRow[]>` (does not throw) — for `CookieTable`. |
| `getCookieTable({ payload, locale? })` | `@intecion/ipal-kit` | Server: Cookies → Cookie list rows in one language → `Promise<CookieTableRow[]>` (does not throw) — for `CookieTable`. |
| `setDefaultConsent(state)` | `@intecion/ipal-kit` | Google Consent Mode `consent default` (with `wait_for_update`). `Analytics` calls it itself before loading Google tags — do not call. |
| `updateConsent(state)` | `@intecion/ipal-kit` | Google Consent Mode `consent update` after the decision. `useConsent` calls it itself — do not call. |
| `parseConsent(raw, version?)` | `@intecion/ipal-kit` | Consent cookie value → `ConsentState \| null` (null: missing, error or a different policy version). For server-side gating. |
| `readConsentRecord(raw, version?)` | `@intecion/ipal-kit` | Like `parseConsent`, but the full record `{ id, state, timestamp, version } \| null`. |
| `serializeConsent(state, version?, id?)` | `@intecion/ipal-kit` | `ConsentState` → encoded cookie value (with timestamp and version). Usually the provider does this. |
| `CONSENT_COOKIE` | `@intecion/ipal-kit` | Consent cookie name: `'cookie-consent'`. |
| `CONSENT_VERSION` | `@intecion/ipal-kit` | Default policy version: `1` (overridden in the panel: Cookie banner → Policy version; changing it invalidates old consents). |
| `CONSENT_VERSION` | `@intecion/ipal-kit` | Default policy version: `1` (overridden in the panel: Cookies → Policy version; changing it invalidates old consents). |
| `CONSENT_MAX_AGE` | `@intecion/ipal-kit` | Consent cookie lifetime in seconds: 180 days. |
| `CONSENT_CATEGORIES` | `@intecion/ipal-kit` | `['necessary', 'functional', 'analytics', 'marketing']`; `necessary` always on. |
| `DEFAULT_CONSENT` | `@intecion/ipal-kit` | State before the decision: only `necessary: true`. |
@@ -145,11 +147,12 @@ Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection,
| Export | Import from | What it does / when |
|---|---|---|
| `loadCookieApproval({ payload, locale, req? })` | `@intecion/ipal-kit` | What waits (`pending`: drafts and accepted cookies marked changed) and what is no longer found (`gone`), texts in one content locale → `CookieApprovalList` of `CookieApprovalItem`s. |
| `approveCookies({ payload, ids?, unknownCategory?, addToList?, req? })` | `@intecion/ipal-kit` | **Approve and add**: accepts the pending entries (all, or `ids`) and adds them to Cookie banner → Cookie list in every locale — no duplicates (`sameCookie`), editor text and categories kept, unknown ones get `unknownCategory` + "Needs description" → `CookieApprovalResult`. |
| `approveCookies({ payload, ids?, unknownCategory?, addToList?, req? })` | `@intecion/ipal-kit` | **Approve and add**: accepts the pending entries (all, or `ids`) and adds them to Cookies → Cookie list in every locale — no duplicates (`sameCookie`), editor text and categories kept, unknown ones get `unknownCategory` + "Needs description" → `CookieApprovalResult`. |
| `countPendingCookies(payload)` / `PENDING_WHERE` | `@intecion/ipal-kit` | How many cookies wait (dashboard, e-mail) / the `Where` for them. |
| `buildCookieApprovalEndpoints(options)` | `@intecion/ipal-kit` | `GET`/`POST /api/ipal/cookie-approval` — the plugin wires them; call only to wire by hand. |
| `flagGoneEntries({ payload, keep, where, req? })` | `@intecion/ipal-kit` | Marks entries a scan no longer finds `change: 'gone'` (never deletes) → count. |
| `nextChange(existing, changed)` | `@intecion/ipal-kit` | Pure marker rule → `CookieChange` (`'new' \| 'changed' \| 'gone'`) or null. |
| `addCookieScannerTabs(global, { approval, crawl, labels, unknownCategory? })` | `@intecion/ipal-kit` | Adds the *Review and approve* / *Site check* tabs (`ui` fields) to a global's `tabs` field — the plugin does it for `cookie-settings` (`adminLayout: 'combined'`). |
| `sameCookie(a, b)` | `@intecion/ipal-kit` | Same name, or one is a pattern covering the other (`_ga_*` / `_ga_XYZ`). |
| `COOKIE_APPROVAL_PATH` / `COOKIE_APPROVAL_VIEW_PATH` / `DEFAULT_UNKNOWN_CATEGORY` | `@intecion/ipal-kit` | `'/ipal/cookie-approval'` / `'/cookie-approval'` (admin route) / `'marketing'`. |
@@ -165,7 +168,7 @@ Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection,
| `parseCookieNames(input)` | `@intecion/ipal-kit` | Text box / array → clean, unique names (max 200; no spaces, `;`, `,`, `=`). |
| `mergeCookieReview(current, previous, next)` | `@intecion/ipal-kit` | Pure "never overwrite an edit" rule, per field and per locale. |
| `suggestionFor(finding, locales)` | `@intecion/ipal-kit` | A finding's values resolved per locale (own language → English → first). |
| `addToCookieList({ payload, entry, req? })` | `@intecion/ipal-kit` | What accepting does: adds the row to Cookie banner → Cookie list or fills only its empty text, every locale → `'added' \| 'filled' \| 'unchanged'`. |
| `addToCookieList({ payload, entry, req? })` | `@intecion/ipal-kit` | What accepting does: adds the row to Cookies → Cookie list or fills only its empty text, every locale → `'added' \| 'filled' \| 'unchanged'`. |
| `loadCookieDatabase()` / `indexCookieDatabase(rows)` / `lookupCookie(index, name, categories?)` | `@intecion/ipal-kit` | Bundled Open Cookie Database (Apache-2.0, loaded on first use): exact name, then the longest wildcard prefix → `CookieFinding \| null`. |
| `DEFAULT_DATABASE_CATEGORIES` | `@intecion/ipal-kit` | Database → consent category map (Functional → `functional` on purpose; override with `cookieScanner.databaseCategories`). |
| `DEFAULT_COOKIE_INTEGRATIONS` | `@intecion/ipal-kit` | Built-in declarations: consent cookie, admin login, `NEXT_LOCALE`, `ipal_vid`, GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok, Turnstile — each with its `isEnabled` check. |
@@ -277,6 +280,9 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
|---|---|---|
| `buildRevalidateHook({ revalidatePath, config, homeSlug? })` | `@intecion/ipal-kit` | → `{ afterChange, afterDelete }` that revalidate ISR for the document paths in all languages; the project injects `revalidatePath` from `next/cache` |
| `buildGlobalRevalidateHook({ revalidatePath })` | `@intecion/ipal-kit` | Global `afterChange`: `revalidatePath('/', 'layout')` — the whole site picks up the change. The plugin adds it to its own globals when you pass `ipalKit({ revalidatePath })`; wire it yourself on your own globals (Header, Footer). Skip once: `context: { disableRevalidate: true }`. |
| `buildFillEmptyLocalesGlobalHook({ global, fields })` / `buildFillEmptyLocalesCollectionHook({ collection, fields })` | `@intecion/ipal-kit` | `afterChange`: text saved in one language fills the same field in every language where it is empty; never overwrites a language's own text. Fields `'field'` or `'array.subField'` (rows matched by id). The plugin adds them to the cookie list and the cookie review (`fillEmptyLocales`). |
| `fillEmptyLocales({ payload, target, source, sourceLocale, fields, req? })` | `@intecion/ipal-kit` | The core of those hooks (`FillEmptyLocalesTarget`: `{ global }` or `{ collection, id }`) → locales changed. |
| `withFillLocales(kind, config, fields)` | `@intecion/ipal-kit` | Adds the right hook to a global (`'global'`) or collection (`'collection'`) config; no fields = unchanged. |
| `setPublishedAtHook` | `@intecion/ipal-kit` | `beforeChange`: sets `publishedAt` on first publish (does not overwrite an existing date) |
| `trackSlugHistoryHook` | `@intecion/ipal-kit` | `beforeChange`: appends the old slug to the `slugHistory` field (add the field yourself); `resolveRedirect` reads it |
| `buildPreventDeleteSystemPage({ settingsSlug?, roleFields? })` | `@intecion/ipal-kit` | `beforeDelete`: blocks deleting a page assigned to a system role (homepage, policies) |
+4 -4
View File
@@ -432,8 +432,8 @@ list is currently fixed; block Markdown: `markdown: { overrides }` in `createCon
**Steps.** Skill **ipal-form**: a block with `<RenderForm>` (`/rsc`), `src/components/forms/formClasses.ts`, the action from stage 6
(one per project), every form from a **seed** `scripts/seed-form-*.ts` (email to the company + confirmation to the customer,
every language, consent checkbox). Cookies: skill **ipal-consent-check** — `cookie-scan.mjs` → `import-cookies.ts` into
Cookie banner → Cookie list; on the cookie policy page a block with `<CookieTable>` (`/rsc`, data from `getCookieTable`);
the same list appears in the `settings="detailed"` dialog (labels: Cookie banner → Settings window → Cookie list headings, every language).
Cookies → Cookie list; on the cookie policy page a block with `<CookieTable>` (`/rsc`, data from `getCookieTable`);
the same list appears in the `settings="detailed"` dialog (labels: Cookies → Settings window → Cookie list headings, every language).
**Check.** Panel → Forms: the seeded form; a submission on `/pl` → an entry in Form Submissions + 2 emails (SMTP:
Site integrations → SMTP → Send test); with Turnstile test keys the widget is visible, without a token the submission is rejected;
@@ -450,7 +450,7 @@ no request to `googletagmanager.com` before analytics or marketing consent (a cl
Check in `basic`: DevTools → Network shows no `gtm.js` / `gtag/js` before consent. Analytics: empty IDs in the panel or
`analytics={false}`. Forms: `createSubmitAction({ turnstileHostnames: ['client.pl'] })` rejects a token solved on
another domain (leave it empty in dev — Cloudflare test keys report `example.com`). The locale cookie respects consent;
after an editor bumps Cookie banner → Policy version nothing to change (`createProxy(config, { policyVersion })` pins one).
after an editor bumps Cookies → Policy version nothing to change (`createProxy(config, { policyVersion })` pins one).
## 10. Navigation
@@ -496,7 +496,7 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
3. **Pages**: home page (title and slug **in every language**, otherwise `/en` → 404), 404, privacy policy,
cookie policy (with the `CookieTable` block), terms if needed; `noindex` on the policies; AI summary.
4. **Site settings → System pages**: Homepage (without it `/pl` → 404), 404, policies; content collection archives.
5. **Cookie banner**: banner texts, Privacy link label, Policy version, Cookies (import from the scan), Detail labels —
5. **Cookies**: banner texts, Privacy link label, Policy version, Cookies (import from the scan), Detail labels —
in every language.
6. **Notifications**: form messages in every language.
7. **Site integrations**: SMTP or Graph (From Name/Address; Send test), Turnstile (for testing site
+3 -3
View File
@@ -52,7 +52,7 @@ a custom table of contents (→ `extractHeadings` + `TableOfContents` + `heading
**→ 1.12.3 (PROGRAMISTA §6, item 46):** Postgres/SQLite: `migrate:create` (new Cookie banner group →
`detailLabels`, only new columns — no rename). A custom cookie settings window or a cookie list added to
the banner → `<CookieBanner settings="detailed">` and remove the copy. With `detailed`: Cookie banner → Cookie list filled in
the banner → `<CookieBanner settings="detailed">` and remove the copy. With `detailed`: Cookies → Cookie list filled in
(scan, **ipal-consent-check**) and Detail labels in every language.
**→ 1.13.0 (PROGRAMISTA §6, item 47; CHANGELOG "What projects must update" — do all 7, in order):**
@@ -108,7 +108,7 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
client; English only → `i18n: { supportedLanguages: { en } }`. Own admin texts → `i18n.translations.<lang>.ipal`.
7. **Frontend texts:** validator messages are full sentences and `pl` locales get Polish fallbacks — grep the
project's tests and code for the old strings (`'required'`, `'invalid email'`) and update them.
8. **Sidebar:** `roles` (users) and Cookie banner → Consent version moved to the sidebar — update editor instructions.
8. **Sidebar:** `roles` (users) and Cookies → Consent version moved to the sidebar — update editor instructions.
Nothing else to change: the statistics tab title, the cookie scanner's integration names and the maintenance
notice's close button follow the language by themselves.
@@ -145,7 +145,7 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
describe the ones marked **Needs description**. The client wants the old entry-by-entry review →
`cookieScanner: { approval: false }`; unknown cookies in another category → `approval: { unknownCategory }`.
4. Behaviour: hand-typed Cookie list rows are looked up only while they have no review entry.
**Check:** run a scan → the cookies appear on `/admin/cookie-approval`; approve one → it is in Cookie banner →
**Check:** run a scan → the cookies appear on `/admin/cookie-approval`; approve one → it is in Cookies →
Cookies in every language; the dashboard shows the reminder while cookies wait. Without `cookieScanner`: nothing.
## 2. Inventory (no code changes)
+34 -9
View File
@@ -14,8 +14,10 @@ project.
## Config
The **CookieSettings** global (slug `cookie-settings`, group *Settings*) is always
built. Public read (`read: () => true` — the banner reads it for anonymous
The **CookieSettings** global — **Cookies** in the admin (slug `cookie-settings`, group *Privacy*) — is always
built. Tabs: *Banner*, *Settings window*, *Categories*, *Cookie list*; with the cookie scanner also
*Review and approve* and *Site check* (one entry for everything about cookies — see
[cookie-scanner.md → Admin layout](./cookie-scanner.md#admin-layout)). Public read (`read: () => true` — the banner reads it for anonymous
visitors); `update` is limited to the `admin` and `editor` roles (`adminOrEditor` —
consent texts are legal copy, not for plain `user` accounts). To change it:
`ipalKit({ globalOverrides: { 'cookie-settings': { access: { update } } } })`.
@@ -29,7 +31,7 @@ from a separate field.
| What | Where from |
|---|---|
| Where it leads | Site settings → System pages → Privacy Policy |
| Link text | Cookie banner → `privacyLinkLabel` (per language) |
| Link text | Cookies → `privacyLinkLabel` (per language) |
| When the text is empty | title of the policy page in that language |
`privacyPolicy` options in `getConsentTexts`: omit (automatic), `false` (no
@@ -65,7 +67,7 @@ export default async function Layout({ children, params }) {
const payload = await getPayload({ config })
// texts from Cookie banner; the policy link is automatic:
// target = System pages → Privacy Policy, text = Cookie banner → privacyLinkLabel
// target = System pages → Privacy Policy, text = Cookies → privacyLinkLabel
const texts = await getConsentTexts({ payload, config: i18nConfig, locale })
return (
@@ -248,7 +250,7 @@ Three settings modes to pick in the project — one prop:
<CookieBanner equalChoice controls="switch" settings="detailed" />
```
The cookie list comes from **Cookie banner → Cookie list** (the same source as `<CookieTable>` on the policy
The cookie list comes from **Cookies → Cookie list** (the same source as `<CookieTable>` on the policy
page), filtered by category — a category without entries has no expandable list. List labels: **Cookie
Settings → Detail labels** (`cookies` — e.g. "Cookies used", the counter is added automatically; `provider`,
`purpose`, `duration`), per language; empty → English. `getConsentTexts` passes this in `texts.cookies` /
@@ -266,7 +268,7 @@ Recommendation (AGENT.md §7): tokens and `classNames` first — then fixes from
project. When you need a completely different layout, you can build your own window; the data is in the
context: `useConsentContext()` → `texts.cookies`, `texts.details`, `state`, `savePreferences`.
Texts from the panel (**Cookie banner**, per language) — empty field = the element is not shown:
Texts from the panel (**Cookies**, per language) — empty field = the element is not shown:
| Field | Where |
|---|---|
@@ -286,7 +288,7 @@ The elements also have stable `data-ipal` handles for CSS and e2e tests (used by
`accept`, `back`, `save`; in modal mode also `consent-overlay`, `consent-dialog`, `close`; in detailed mode
additionally `category-<category>` (card) and `cookies` (expandable list).
Accessibility: the banner dialog and `CookieButton` have an `aria-label` from **Cookie banner →
Accessibility: the banner dialog and `CookieButton` have an `aria-label` from **Cookies →
title** or **settingsTitle** (per language) — no hard-coded texts in the components. The modal has
`aria-modal`, focus on ✕ after opening and closes on Escape; switches have `role="switch"` and `aria-checked`.
@@ -330,9 +332,32 @@ independent consent state).
> The consent mechanism for the locale is also described from the i18n side:
> [i18n.md](./i18n.md#locale-cookie-and-consent-gdpr).
## Every language filled (`fillEmptyLocales`)
The cookie list's **Purpose** and **Duration** are per language. Text an editor writes in one language
is copied to every language where that field is still empty, when the document is saved — a cookie
added in Polish is not blank on the English page. A language that already has its own text is never
overwritten, so each language can still be changed on its own. The same applies to the cookie review
entries (purpose, duration). Cookie scanner and approval writes do the same with their own texts:
English and Polish where they exist, the default language's text for any other language.
Payload's `localization.fallback` covers only part of this: an empty language *reads* as the default
language's text, but nothing is stored, the admin shows the field empty, and the text always comes
from the default language, not from the one just edited.
| Option | Default | |
|---|---|---|
| `fillEmptyLocales` | `true` | `false` = off; `{ 'cookie-settings': ['cookies.purpose'], 'cookie-review': [] }` = choose the fields per slug (`[]` = off for that slug). Field paths: `'field'` or `'arrayField.subField'` |
Building blocks for your own globals and collections (`@intecion/ipal-kit`):
`buildFillEmptyLocalesGlobalHook({ global, fields })`, `buildFillEmptyLocalesCollectionHook({ collection, fields })`
(afterChange hooks), `fillEmptyLocales({ payload, target, source, sourceLocale, fields, req? })` (the
core, `FillEmptyLocalesTarget` = `{ global }` or `{ collection, id }`), and `withFillLocales(kind, config, fields)`
to add the hook to a config. Nothing to migrate.
## Policy version, withdrawing consent, consent log, cookie table (1.9.1)
- **New consent after a policy change:** Cookie banner → *Consent version* (sidebar). Raise it by 1
- **New consent after a policy change:** Cookies → *Consent version* (sidebar). Raise it by 1
after adding a tool or changing the policy — every visitor will see the banner again.
`getConsentTexts` passes the version to `<ConsentProvider texts>` automatically.
- **Withdrawing consent deletes the tools' cookies** (`_ga`, `_ga_*`, `_gid`, `_fbp`, `_gcl_*`, Clarity,
@@ -348,7 +373,7 @@ independent consent state).
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`.
- **Cookie table** for the policy page: Cookie banner → *Cookie list* + `getCookieTable` + `<CookieTable>` from `/rsc`.
- **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 `ipal-consent-check` → cookie-scan.
- Consent cookie: `cookie-consent` (`CONSENT_COOKIE`), JSON `{ id, state, timestamp, version }`,
+45 -11
View File
@@ -1,6 +1,6 @@
# cookie scanner
Fills the cookie list (Cookie banner → Cookie list) from the admin panel. A scan lists the cookies of
Fills the cookie list (Cookies → Cookie list) from the admin panel. A scan lists the cookies of
every integration the project switches on, plus any extra names, in a review list. The editor then
sees **one summary** — *Approve cookies*, grouped by consent category, new / changed / unknown marked —
and one button, **Approve and add**, puts every ticked cookie everywhere it is listed: the cookie list,
@@ -30,8 +30,10 @@ ipalKit({
Then, in the project:
1. **Import map** — the "Scan cookies" box above the list is an admin component
(`@intecion/ipal-kit/admin#CookieScanButton`). Run `pnpm generate:importmap`.
1. **Import map** — the scan box, the *Review and approve* / *Site check* tabs and the approval view
are admin components (`@intecion/ipal-kit/admin#CookieScanButton`, `#CookieReviewTab`,
`#CookieSiteCheckTab`, `#CookieApprovalView`). Run `pnpm generate:importmap` (again after upgrading
to the combined layout — the two tab components are new).
2. **Postgres / SQLite migration** — the option adds the `cookie-review` collection (with localized
`purpose` and `retention`). Run `pnpm payload migrate:create cookie-scanner`, commit the migration;
Coolify runs `payload migrate` on deploy (deployment.md). MongoDB: nothing to do.
@@ -39,11 +41,37 @@ Then, in the project:
fields to `cookie-review` — `change` (select) and `needsDescription` (checkbox). Run
`pnpm payload migrate:create cookie-approval` and commit it. Existing entries keep their status;
accepted ones are not re-approved, drafts show up on the approval page without a marker.
3. **Verify** — log in as an editor, open *Privacy → Cookie review*. The box lists "Integrations in
use" (e.g. Cookie banner, Admin panel login, Google Analytics 4). Click **Scan cookies**: the box
says "Waiting for approval: N" with **Review and approve**. Open it (`/admin/cookie-approval`): the
cookies are grouped by category. Click **Approve and add**, then open *Cookie banner → Cookie
list*: the cookies are there, with purpose and retention in every language.
3. **Verify** — log in as an editor, open *Privacy → Cookies → Review and approve*. The box lists
"Integrations in use" (e.g. Cookie banner, Admin panel login, Google Analytics 4). Click **Scan
cookies**: the cookies found appear below, grouped by category. Click **Approve and add**; the page
reloads — open the *Cookie list* tab: the cookies are there, with purpose and duration in every
language.
## Admin layout
One **Cookies** entry in *Privacy* holds everything (`adminLayout: 'combined'`, the default):
| Tab | What it is |
|---|---|
| Banner, Settings window, Categories | the banner texts ([consent.md](./consent.md)) |
| Cookie list | the cookies shown in the banner's detailed window and the cookie policy table |
| Review and approve | the scan box and the approval list inline; **Edit cookies one by one** opens the review entries |
| Site check | only with `crawl`: start a check, its status, the violations of the latest check, a link to the warning e-mail settings |
The review list (`cookie-review`) and the site check result (`cookie-crawl`) leave the navigation
(`admin.group: false`) but keep their pages, data and API — links from the dashboard, the e-mail and
**Edit** still open them, and `/admin/cookie-approval` still works. The two tabs are `ui` fields: no data,
no schema change, **no migration** — only `pnpm generate:importmap`. Approving in the tab writes the
cookie list of the same screen, so the page reloads afterwards; while the screen has unsaved changes the
button waits ("Save your changes first.").
`adminLayout: 'separate'` keeps the older layout: *Cookie review* and *Cookie check* as their own
navigation entries, no extra tabs. A project's `collectionOverrides` / `crawl.globalOverride` (e.g. its own
`admin.group`) win in both layouts.
Every language is filled: text written in one language (in the cookie list or a review entry) goes to
the languages where that field is still empty, never over a language's own text
([consent.md → Every language filled](./consent.md#every-language-filled-fillemptylocales)).
## How editors use it
@@ -51,9 +79,9 @@ Then, in the project:
|---|---|
| **Scan cookies** | Every cookie of the integrations in use goes into the review list, marked **New**. Rows typed into the cookie list by hand are looked up once (*In the cookie list* is ticked). Nothing is added to the cookie banner yet. |
| **More cookie names** (optional text box) | Names seen in the browser (DevTools → Application → Cookies), one per line. Each is looked up in the project's declarations, every built-in integration, then the Open Cookie Database. A name nothing knows is marked **Needs description**. |
| **Review and approve** | The *Approve cookies* view (`/admin/cookie-approval`, linked from the box and the dashboard): one table per consent category (Necessary, Functional, Analytics, Marketing, then *Not yet described*), each cookie with provider, purpose and duration in the content language that matches the admin language, markers **New**, **Changed**, **Needs description**, an **Edit** link and a tick box. |
| **Review and approve** | The *Review and approve* tab of *Cookies* (the same list is also at `/admin/cookie-approval`, linked from the dashboard and the e-mail): one table per consent category (Necessary, Functional, Analytics, Marketing, then *Not yet described*), each cookie with provider, purpose and duration in the content language that matches the admin language, markers **New**, **Changed**, **Needs description**, an **Edit** link and a tick box. |
| Untick or edit | Untick a cookie to leave it waiting; **Edit** opens its review entry (provider, category, purpose, duration per language). A later scan keeps every value you changed and still updates values you left as suggested. |
| **Approve and add** | Every ticked cookie becomes *Accepted* and is added to *Cookie banner → Cookie list* in every language, with the plugin's English and Polish texts (other languages get the English text). A row that already lists the cookie — the same name, or a pattern that covers it, e.g. `_ga_*` and `_ga_XYZ123` — is never duplicated: only its empty provider / purpose / duration are filled, its text and category stay. The cookie list feeds the cookie policy table and the banner's detailed window, so the cookie appears there too. |
| **Approve and add** | Every ticked cookie becomes *Accepted* and is added to *Cookies → Cookie list* in every language, with the plugin's English and Polish texts (a language without its own text gets the default language's text). A row that already lists the cookie — the same name, or a pattern that covers it, e.g. `_ga_*` and `_ga_XYZ123` — is never duplicated: only its empty provider / purpose / duration are filled, its text and category stay. The cookie list feeds the cookie policy table and the banner's detailed window, so the cookie appears there too. |
| Unknown cookies | Approved into a category that needs consent (`approval.unknownCategory`, default `marketing`) and flagged **Needs description** on the review entry; writing a purpose clears the flag. |
| A scan finds a change | An accepted cookie whose suggested text changed is marked **Changed** and waits for approval again; approving it fills only empty text in the cookie list. |
| A cookie disappears | An integration switched off, a declaration removed, or a cookie the site check no longer sees: the entry is marked **No longer found** and listed under that heading on the approval page. Nothing is deleted — the cookie list keeps its row until an editor removes it there. Found again → the mark goes away. |
@@ -148,6 +176,7 @@ run the tests, commit.
| `approval.unknownCategory` | `'marketing'` | category given to cookies nothing knows when they are approved; pick one that needs consent (`functional`, `analytics`, `marketing`) |
| `approval.dashboard` | `true` | `false` = no "Waiting for approval" reminder on the dashboard |
| `crawl` | off | browser crawl through the scanner service — [Browser crawl](#browser-crawl) |
| `adminLayout` | `'combined'` | one *Cookies* entry with *Review and approve* and *Site check* tabs; `'separate'` = own navigation entries — [Admin layout](#admin-layout) |
A project declaration:
@@ -235,6 +264,10 @@ All from `@intecion/ipal-kit` (server-safe), for your own admin view, a CLI or a
| `buildCookieReviewCollection(options)`, `buildCookieScanEndpoints(options, plugin)` | the collection and endpoints, to wire by hand |
| `COOKIE_SCAN_LABELS`, `mergeCookieScanLabels(overrides)` | admin labels |
| `CookieScanButton` (`/admin`) | the box above the list (with **Check site** when `crawl` is on) |
| `CookieReviewTab`, `CookieSiteCheckTab` (`/admin`) | the two tabs of the combined layout (client components; props `approval`, `labels`, `unknownCategory` / `labels`) |
| `addCookieScannerTabs(global, { approval, crawl, labels, unknownCategory? })` | adds those tabs to a global with a `tabs` field — for a project that builds its own cookie global |
| `CookieScanButton` props `scan` / `onChange` | hide the scan part (the Site check tab) / called after a scan or a finished check |
| `CookieApprovalForm` props `onApproved` / `blockedReason` | after approving (the tab reloads the page) / why the button waits |
| `CookieCrawlAlert` (`/admin`) | the dashboard warning: cookies waiting for approval, and with `crawl` violations or a failed check (props `approval`, `crawl`) |
| `buildCookieCrawlGlobal(labels)`, `buildCookieCrawlEndpoints({ labels, options, plugin })` | the crawl's global and endpoints, to wire by hand |
| `resolveCrawlConfig(crawlOptions, payload)` | options + env + `serverURL` → `ResolvedCrawlConfig` (what is missing) |
@@ -420,12 +453,13 @@ as unknown into **More cookie names**.
## Turn off, override, extend
- **Separate screens:** `adminLayout: 'separate'`.
- **Turn off one approval:** `approval: false` — per-entry review only (set *Accepted* on each entry), no
approval view, endpoint or reminder.
- **Turn off the crawl only:** omit `crawl` (default) — no `cookie-crawl` global, no crawl endpoints, no
dashboard warning, no violation fields; `dashboard: false` keeps the crawl without the warning.
- **Turn off:** omit `cookieScanner` (default). Turning it off later keeps no endpoint and no
collection; Cookie banner → Cookie list keeps every row (it is still edited by hand or by the skill's
collection; Cookies → Cookie list keeps every row (it is still edited by hand or by the skill's
import script).
- **Override:** `collectionOverrides` (access, admin, hooks), `access` (who scans), `labels`,
`databaseCategories`, `integrations` (change or drop a built-in), `syncAccepted: false`,
+5 -5
View File
@@ -312,7 +312,7 @@ turn off every part: `banner={<CookieBanner classNames={…} />}` / `false`, `co
Pick the consent settings window with the banner's `settings` prop: `'inline'` (default — categories in the bar),
`'modal'` (small window in the center) or `'detailed'` (large window: each category with a switch, a description and
an expandable list of cookies from Cookie banner → Cookie list). Example:
an expandable list of cookies from Cookies → Cookie list). Example:
`banner={<CookieBanner equalChoice controls="switch" settings="detailed" />}` — description: consent.md, the
`settings="detailed"` section.
@@ -433,7 +433,7 @@ pnpm dev
3. **Pages** — the homepage with a title **in every language** (empty EN slug = 404 on `/en`).
4. **Site settings → System pages** — Homepage (without it `/pl` → 404), 404,
policies; archives of content collections.
5. **Cookie banner** — banner texts per language; **Cookies** (list from the scan, `ipal-consent-check`) and **Detail
5. **Cookies** — banner texts per language; **Cookies** (list from the scan, `ipal-consent-check`) and **Detail
labels** (captions of the list in the `settings="detailed"` window) — also in every language.
6. **Notifications** — form messages per language.
7. **Site integrations** — SMTP/Graph (From Name, From Address), Turnstile, analytics/pixel
@@ -613,7 +613,7 @@ Do one item at a time, build, check. Order by importance:
| 15m | own plugin moving Notifications into a group; `formOverrides`/`formSubmissionOverrides` only for labels and the admin group | delete — the plugin itself puts Form messages → Settings, and forms → the "Forms" group with labels (`forms.adminGroup`) | forms.md |
| 15n | mail errors visible only in logs | nothing in the project: `mailAdapter()` shows the send error on the dashboard and in Site integrations → SMTP; `generate:importmap`, Postgres: `migrate:create` | email.md |
| 16 | Hard-coded 404 | 404 role in System pages + `getNotFoundPage` | pages.md |
| 16a | `privacyPolicy: { label: 'Polityka prywatności', … }` in the layout | delete the whole parameter; enter the text in Cookie banner → Privacy link label | consent.md |
| 16a | `privacyPolicy: { label: 'Polityka prywatności', … }` in the layout | delete the whole parameter; enter the text in Cookies → Privacy link label | consent.md |
| 17 | **AI/GEO (mandatory since 1.9.0)** | llms.txt + llms-full.txt, the `/md/…` route, `markdownAlternate: true`, `prefersMarkdown` in the proxy, `/api/mcp`, `buildSummaryField`, AI bots allowed — AGENT.md §0b | content.md, seo.md, mcp.md |
| 18 | **1.9.0** — `TurnstileProvider siteKey` from `getSiteIntegrations(…).turnstileSiteKey` | `getTurnstileConfig(payload).siteKey`. Note: with both keys set `submitForm` **requires** a token — a form without the widget will be rejected | turnstile.md |
| 19 | **1.9.0** — `twoFactor: { issuer }` without `plugin` | add `plugin: payloadTotp` (the fallback with a dynamic import was removed — startup fails with an error) | security.md |
@@ -622,7 +622,7 @@ Do one item at a time, build, check. Order by importance:
| 22 | **1.9.1** — hand-written `actions.ts` / `md` route / no form seed | `createSubmitAction`, `createMarkdownRoute`, seed from `ipal-form` (mail to the company + to the visitor) | forms.md, content.md |
| 23 | **1.9.1** — `createProxy` without `markdown: true` | add it — otherwise `/md/…` redirects to `/pl/md/…` | content.md |
| 24 | **1.9.1** — page JSON-LD assembled by hand | `getPageJsonLd`, `buildNavigationJsonLd`, `sameAsUrls`, `formatOpeningHours` | seo.md |
| 25 | **1.9.1** — consent: version, log, table | Cookie banner → Policy version; `consentLog: true` + `logEndpoint`; `<CookieBanner equalChoice>`; scan + `<CookieTable>`; Postgres: `migrate:create` | consent.md |
| 25 | **1.9.1** — consent: version, log, table | Cookies → Policy version; `consentLog: true` + `logEndpoint`; `<CookieBanner equalChoice>`; scan + `<CookieTable>`; Postgres: `migrate:create` | consent.md |
| 26 | **1.9.1** — media: `priority`, no placeholders, `images` in next.config | `<Media>` through `mediaImageProps`/`videoProps`, `buildMediaPlaceholderHook`, `buildImagesConfig`, `buildUploadSecurityHeaders` | media.md, storage.md |
| 27 | **1.9.1** — staging indexed | `IPAL_NOINDEX=1` in the staging env | seo.md |
| 28 | **1.9.2** — own `FormRenderer` (a copy of the engine on `useForm`) | **security:** it passed the whole form document, including the Emails tab, to the browser (company addresses in the HTML). Block → `<RenderForm form action locale texts classNames>`, styling into `formClasses.ts`, delete `FormRenderer.tsx`; unusual form → `useBuilderForm` | forms.md |
@@ -643,7 +643,7 @@ Do one item at a time, build, check. Order by importance:
| 43 | **1.11.1** — `<Media>` sets the background color only for JPEG | delete the condition — `mediaImageProps` does it itself (`placeholderColor`) | media.md |
| 44 | **1.11.1** — `CmsLink['appearance']` replaced with an own type because the type depended on field order | types per shape: `CmsLink`, `CmsLinkPlain`, `CmsLinkNoLabel`; `pnpm generate:types` and fix the imports | links.md |
| 45 | **1.11.1** — format description in a form field label / time as text | the **Placeholder** field in the admin panel, the **Time** type; Postgres: `migrate:create` | forms.md |
| 46 | **1.12.3** — own cookie settings window / cookie list in the banner written in the project | `<CookieBanner settings="detailed">` (list from Cookie banner → Cookie list, captions: Detail labels); delete your own version; Postgres: `migrate:create` | consent.md |
| 46 | **1.12.3** — own cookie settings window / cookie list in the banner written in the project | `<CookieBanner settings="detailed">` (list from Cookies → Cookie list, captions: Detail labels); delete your own version; Postgres: `migrate:create` | consent.md |
| 47 | **1.13.0** — staff access, Search engines, seed scripts, workarounds around plugin globals | without `access`: every logged-in account gets the staff features → `access` or `globalOverrides` / `formOverrides` / `formSubmissionOverrides` / `collectionOverrides`; with `access`: staff need `editor`/`admin`; Postgres: `migrate:create`; check `settingsDepth`, `sitemap()` throwing, 2FA slug, client IP; own seed code → `@intecion/ipal-kit/seed`; global hooks/access plugins → `revalidatePath` / `globalOverrides` | CHANGELOG 1.13.0, AGENT.md §7.1, seo.md, seeding.md |
| 48 | **1.14.0 — image lightbox** — own image modal (`useState(index)` + `div role="dialog"`), `glightbox` / other lightbox library, thumbnails linking to the raw file in a new tab | `ipalKit({ lightbox: true })` + Postgres `migrate:create`; `<SiteProviders lightbox>`; `<LightboxTrigger group image={lightboxImage(media, { size })}>` around the thumbnail; delete the old dialog and `pnpm remove glightbox`; old label fields → Form messages → Image viewer | lightbox.md → "Replacing a hand-made modal" |
| 49 | **1.14.0** — import map, Node, Next, audit, cookie list, admin languages | `pnpm payload generate:importmap` (`FaviconCheck`, `RowLabel`); Node 20.9+; `next@^16.4.3` + `sharp@^0.35.5` (Next ≤16.4.0 has two RCEs); `pnpm audit --prod` + `dompurify` / `undici` overrides on payload 3.90.x; hand-kept cookie list → `cookieScanner` (+ `crawl`, `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN`) + `migrate:create`; English-only admin → `i18n.supportedLanguages`; tests on validator strings → full sentences | CHANGELOG 1.14.0, cookie-scanner.md, i18n.md, AGENT.md §4 items 11–12 |
+5
View File
@@ -159,6 +159,11 @@ Rules:
`Ustawienia`, `Prywatność`, `Statystyki`). Settings holds configuration only; logs and records
(consent log, visits) go to their own group. A nav link or view the user cannot open is
hidden, never shown with "You do not have access".
- **One entry per feature.** Screens that serve one feature become tabs of one global, not
separate navigation entries: *Cookies* holds the banner texts, the cookie list, *Review and
approve* and *Site check*. Supporting collections and globals leave the navigation with
`admin.group: false` (their pages and API stay, links still open them) and appear as `ui`-field
tabs. Logs stay separate (*Consent log*).
- A global or collection is named for what the editor finds in it ("Form messages"), not
for the mechanism behind it ("Notifications"). Renaming the visible label never changes
the slug.
+22
View File
@@ -232,6 +232,28 @@ A sync error is logged; the save does not fail.
---
## buildFillEmptyLocalesGlobalHook / buildFillEmptyLocalesCollectionHook — text into empty languages
The text counterpart of `buildCrossLocaleFieldSync`: text saved in one language goes to every
language where that field is still empty; a language with its own text is never overwritten. The
plugin adds it to the cookie list and the cookie review (`ipalKit({ fillEmptyLocales })`, consent.md).
On your own global or collection:
```ts
import { buildFillEmptyLocalesGlobalHook } from '@intecion/ipal-kit'
hooks: {
afterChange: [buildFillEmptyLocalesGlobalHook({ global: 'footer', fields: ['tagline', 'links.label'] })],
}
```
Fields: `'field'` or `'arrayField.subField'` (rows matched by their id). The collection variant takes
`{ collection, fields }`. It skips its own writes (`context.ipalFillLocales`) and the cookie scanner's,
puts `req.locale` back afterwards, and logs instead of failing the save. Core function:
`fillEmptyLocales`; `withFillLocales(kind, config, fields)` adds the hook to a config.
---
## buildNoindexField — checkbox → meta.noindex (a field, not a hook)
A sidebar `noindex` checkbox kept in sync with `meta.noindex` (which the sitemap and
+1 -1
View File
@@ -125,7 +125,7 @@ changes when `day` changes in the `timeZone` zone.
## For the privacy policy and the cookie table
Add a row in **Cookie banner → Cookie list** (panel):
Add a row in **Cookies → Cookie list** (panel):
| Name | Provider | Category | Purpose | Duration |
|---|---|---|---|---|