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
+5 -1
View File
@@ -3,7 +3,7 @@ import type { BasePayload, Endpoint, PayloadRequest, Where } from 'payload'
import type { ConsentCategory } from '../categories.js'
import type { CookieReviewValues } from './merge.js'
import type { CookieChange } from './scan.js'
import type { CookieScannerOptions } from './types.js'
import type { CookieScannerOptions, CookieStorage } from './types.js'
import { userMeetsRole } from '../../access/predicates.js'
import { CONSENT_CATEGORIES } from '../categories.js'
@@ -30,6 +30,8 @@ export type CookieApprovalItem = {
name: string
purpose: null | string
retention: null | string
/** Cookie, or a key in the browser's local / session storage. */
storage: CookieStorage
/** Nothing knew it: no category or no purpose yet. */
unknown: boolean
vendor: null | string
@@ -53,6 +55,7 @@ type Doc = {
retention?: null | Record<string, null | string> | string
source?: null | string
status?: 'accepted' | 'draft' | 'rejected' | null
storage?: CookieStorage | null
vendor?: null | string
}
@@ -73,6 +76,7 @@ function item(doc: Doc, locale: string): CookieApprovalItem {
change: doc.change ?? null,
purpose,
retention: asText(doc.retention, locale),
storage: doc.storage ?? 'cookie',
unknown: !doc.category || !purpose || doc.source === 'unknown',
vendor: doc.vendor ?? null,
}