diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4743961..9656581 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,6 +8,39 @@ versions at once, go through every "Requires project changes" section in order, version you have. A new release = a new section at the top; we remove the oldest ones only once there are more than 20. +## Unreleased + +The theme choice moves to the standard `theme` key, the cookie scanner declares the plugin's own browser-storage +key, and the cookie list tells cookies from browser storage. + +### Changed +- **Theme key** `ipal-theme` → **`theme`** (`THEME_STORAGE_KEY`), the key and `light` / `dark` values next-themes uses. + Visitors keep their choice: `` moves an old `ipal-theme` value to the new key before the first paint + (no flash) and removes the old key; `useTheme` / `` do the same on pages without the script + (`migrateThemeStorage`, `LEGACY_THEME_STORAGE_KEY`). A project that also runs next-themes now shares the key — + set `ipalKit({ theme: { storageKey } })` to keep them apart. + +### New +- **`theme.storageKey`** option (`ThemeOptions`): `getSiteShell().theme.storageKey` → `` → + `` (`THEME_STORAGE_ATTRIBUTE`) → `useTheme` / ``; both also take `storageKey`. +- **Cookie scanner declares browser storage**: the theme choice (*Theme choice*, on when Site settings → Theme → + *Allow theme toggle* is on) as **necessary**, local storage, "until changed or site data is cleared" — so + **Scan cookies** finds it without a crawl. +- **Type in the cookie list**: *Cookies → Cookie list* rows have **Type** (`storage`: cookie · local storage · + session storage, default cookie, shared by every language), filled by scan, review and approval. The detailed + settings window shows it for storage entries (heading: *Settings window → Cookie list headings → Type*); + `` adds a **Type** column when the list has a storage entry (`storageColumn`, `storageTypes`, + `COOKIE_STORAGE_LABELS`). `CookieTableRow.storage`, `texts.details.storage` / `.storageTypes`, type `ConsentStorage`. + The approval page marks storage entries. + +### What projects must update +1. **Migration (Postgres / SQLite):** `pnpm payload migrate:create cookie-storage-type` — it only adds + `cookie_settings_cookies.storage` (enum, `DEFAULT 'cookie'`) and `cookie_settings_locales.detail_labels_storage`. + Existing rows become *Cookie*: set the type of storage rows by hand. MongoDB: nothing to do. +2. A project that reads `localStorage.getItem('ipal-theme')` itself: use `THEME_STORAGE_KEY` (or `documentThemeStorageKey()`). +3. Cookie list: after the next **Scan cookies**, approve the new *theme* entry; remove an old *ipal-theme* row from + *Cookies → Cookie list* once the site runs this version. + ## 1.14.4 Cookie texts in every language without retyping them, and one **Cookies** entry in the admin instead of three. diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index 53baefd..1d6b34d 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -983,6 +983,8 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both | 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 | +| Theme choice in localStorage under `theme` (next-themes' key); old `ipal-theme` moved before paint; declared to the cookie scanner as necessary local storage | — | `ipalKit({ theme: { storageKey } })`; `` / `useTheme({ storageKey })` | +| Cookie list entries have a **Type** (cookie / local / session storage), filled by the scanner; `` shows it when needed | `` | `storageColumn`, `storageTypes`, Cookies → Settings window → Cookie list headings → Type | | 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` | diff --git a/docs/agent/skills/ipal-consent-check/SKILL.md b/docs/agent/skills/ipal-consent-check/SKILL.md index 3f33a94..d93fe65 100644 --- a/docs/agent/skills/ipal-consent-check/SKILL.md +++ b/docs/agent/skills/ipal-consent-check/SKILL.md @@ -130,4 +130,4 @@ unknown names to the panel scan above instead of step 2): table" block on the policy page is a good place — then the editor decides where it appears. Lifetime: Chrome caps every cookie at max. 400 days (13 months) — the scan shows what -really stays in the browser. localStorage keys (e.g. `ipal-theme` — the chosen theme) are listed separately. +really stays in the browser. localStorage keys (e.g. `theme` — the chosen theme) are listed separately; in the panel they are entries of type *Local storage* (the scanner declares the theme key itself when the theme switch is on). Check that every storage row in *Cookies → Cookie list* has the right **Type** — rows from before the type existed are *Cookie*. diff --git a/docs/agent/skills/ipal-reference/SKILL.md b/docs/agent/skills/ipal-reference/SKILL.md index bb0c1b7..9a4dd85 100644 --- a/docs/agent/skills/ipal-reference/SKILL.md +++ b/docs/agent/skills/ipal-reference/SKILL.md @@ -76,6 +76,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip | `cookieScanner.crawl.serviceUrl` / `.token` / `.siteUrl` / `.maxPages` / `.acceptSelector` | env URL / env token / `serverURL` → `NEXT_PUBLIC_SERVER_URL` / `20` / `[data-ipal="accept"]` | where the service is, the shared secret, the public origin crawled and called back, pages from the sitemap (max 100), the banner's accept button | options win over env | | `cookieScanner.crawl.consentMode` / `.trackerHosts` / `.dashboard` / `.globalOverride` | `'advanced'` / `DEFAULT_TRACKER_HOSTS` / `true` / none | `'basic'` also flags Google tag requests before consent; hosts counted as trackers; dashboard warning; changes the `cookie-crawl` global like `globalOverrides` | `(defaults) => [...defaults, 'chat.example']`; `dashboard: false` | | `cookieScanner.database` / `.databaseCategories` / `.syncAccepted` | `true` / Functional+Personalization → functional, Security+Necessary → necessary / `true` | Open Cookie Database lookup on or off; category map; accepting writes to Cookie banner | `database: false`; `{ Functional: 'necessary' }`; `syncAccepted: false` | +| `theme.storageKey` | `'theme'` | localStorage key of the visitor's light / dark choice (next-themes uses the same key — set your own to keep them apart); via `config.custom.ipal.themeStorageKey` → `getSiteShell().theme.storageKey` → `ThemeScript` → `` → `useTheme` / `ThemeSwitcher`. An old `ipal-theme` choice moves before the first paint | `{ storageKey: 'acme-theme' }`; check: DevTools → Application → Local storage shows the key after a switch | | `stats` | off | `stats-visits` collection, `POST /api/ipal/hit`, `//stats` view, nav link, dashboard chart | `true` / object | | `stats.collectionOverrides` | none | changes `stats-visits` like `consentLog.collectionOverrides`; its `access.read` also decides who sees the stats view and dashboard chart | object or function | | `stats.retentionDays` / `timeZone` / `dashboard` | 90 / `'Europe/Warsaw'` / `true` | retention, day boundary, `StatsWidget` | `dashboard: false` hides the chart | diff --git a/docs/agent/skills/ipal-reference/resources/api.md b/docs/agent/skills/ipal-reference/resources/api.md index 03ab209..7c6db01 100644 --- a/docs/agent/skills/ipal-reference/resources/api.md +++ b/docs/agent/skills/ipal-reference/resources/api.md @@ -113,7 +113,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT | `CookieBanner` | `@intecion/ipal-kit/client` | Consent banner + category settings: `settings: 'inline' \| 'modal' \| 'detailed'`, `controls`, `equalChoice` (recommended `true`), `order`, `settingsActions`, `icon`, `classNames`; 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. Prop `className`. | | `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, categories?, caption?, classNames? }`; `rows` from `getCookieTable()`. | +| `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, 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`; pass to `ConsentProvider texts`. | @@ -134,9 +134,9 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT | `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. | -**Built-in texts:** `CONSENT_FALLBACK`, `CONSENT_FALLBACK_PL`, `consentFallback(locale)` (banner defaults by page language), `CONSENT_CATEGORY_LABELS` / `consentCategoryOptions()` (category names `{ en, pl }`), `COOKIE_TABLE_LABELS` (`/rsc`, `` defaults). +**Built-in texts:** `CONSENT_FALLBACK`, `CONSENT_FALLBACK_PL`, `consentFallback(locale)` (banner defaults by page language), `CONSENT_CATEGORY_LABELS` / `consentCategoryOptions()` (category names `{ en, pl }`), `COOKIE_TABLE_LABELS` (`/rsc`, `` defaults), `COOKIE_STORAGE_LABELS` (`/rsc`, type names per language). -**Types:** `ConsentCategory`, `ConsentState`, `ConsentTexts`, `CookieTableRow`, `ConsentLogOptions` (root) — categories, consent state, banner texts, cookie table row, log options; `CookieBannerAction`, `CookieSettingsAction`, `CookieBannerClassNames` (`/client`) — `CookieBanner` buttons and classes; `CookieTableLabels` (`/rsc`) — `CookieTable` column headers. +**Types:** `ConsentCategory`, `ConsentState`, `ConsentStorage` (`'cookie' \| 'localStorage' \| 'sessionStorage'`), `ConsentTexts`, `CookieTableRow`, `ConsentLogOptions` (root) — categories, consent state, banner texts, cookie table row, log options; `CookieBannerAction`, `CookieSettingsAction`, `CookieBannerClassNames` (`/client`) — `CookieBanner` buttons and classes; `CookieTableLabels` (`/rsc`) — `CookieTable` column headers. ## Cookie scanner (`consent/scanner`) — details: `node_modules/@intecion/ipal-kit/docs/cookie-scanner.md` @@ -682,19 +682,23 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP | Export | Import from | What it does / when | |---|---|---| | `ThemeScript({ allowToggle?, defaultTheme? })` | `@intecion/ipal-kit/rsc` | Inline script that sets `data-theme` on `` before paint (no flash). First in `` or `theme` in ``; ``. | -| `ThemeSwitcher({ label?, classNames?, renderIcon? })` | `@intecion/ipal-kit/client` | Unstyled switcher (`