Theme key 'theme', storage keys in the cookie scanner, type in the cookie list

- Theme choice in localStorage under 'theme' (next-themes' key and values)
  instead of 'ipal-theme'. ThemeScript moves an old choice before the first
  paint and removes the old key; useTheme / ThemeSwitcher do the same
  without the script. ipalKit({ theme: { storageKey } }) sets an own key,
  which reaches ThemeScript through getSiteShell().theme and <html
  data-theme-storage>.
- The cookie scanner declares the theme key (Theme choice: local storage,
  necessary, until changed or site data is cleared) when the theme switch
  is on, so Scan cookies finds it without a crawl.
- Cookies -> Cookie list rows get a Type (cookie / local storage / session
  storage, default cookie, shared by every language), filled by scan, review
  and approval. The detailed settings window and <CookieTable> show it with
  English and Polish defaults; the approval page marks storage entries.
- Migration: adds cookie_settings_cookies.storage (DEFAULT 'cookie') and
  cookie_settings_locales.detail_labels_storage, nothing else.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 11:29:56 +01:00
co-authored by Claude Opus 5.5
parent 6998b44431
commit b5368cdc61
35 changed files with 522 additions and 78 deletions
+17
View File
@@ -332,6 +332,23 @@ 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).
## Cookies and browser storage in one list (type)
*Cookies → Cookie list* holds cookies **and** keys the site keeps in the browser's local or session
storage (the theme choice, a chat widget's state). Each row has a **Type** (`storage`: `cookie` ·
`localStorage` · `sessionStorage`, default `cookie`, shared by every language). The cookie scanner fills it.
| Where | What visitors see |
|---|---|
| `<CookieTable>` (`/rsc`) | a **Type** column when the list has an entry that is not a cookie (`storageColumn: 'auto'`, the default; `true` / `false` to force it). Column heading `labels.storage`, type names `storageTypes` — defaults per `locale`: en *Type* · *Cookie* / *Local storage* / *Session storage*, pl `Rodzaj` · `Plik cookie` / `Pamięć lokalna` / `Pamięć sesji` (`COOKIE_STORAGE_LABELS`) |
| Detailed settings window | a **Type** line under entries that are not cookies: label from *Settings window → Cookie list headings → Type* (empty = default per language), type names from `texts.details.storageTypes` |
| `getCookieTable` / `texts.cookies` | every row has `storage` (`ConsentStorage`); `texts.details.storage` / `.storageTypes` |
**Migration (Postgres / SQLite):** two added columns, nothing dropped — `cookie_settings_cookies.storage`
(enum, `DEFAULT 'cookie'`, so existing rows become *Cookie*) and `cookie_settings_locales.detail_labels_storage`.
Run `pnpm payload migrate:create cookie-storage-type` and commit it. Change the type of existing storage rows
by hand (a scan fills it only for new rows).
## Every language filled (`fillEmptyLocales`)
The cookie list's **Purpose** and **Duration** are per language. Text an editor writes in one language