Merge claude/totp-pl-cookie-button: plain en/pl 2FA texts, CookieButton above the footer

TOTP_TEXTS (en, pl) merged over payload-2fa's, project translations still win,
twoFactor.texts: false keeps the package's; tab titles on the 2FA views
(TOTP_VIEW_TITLE). CookieButton lifts above the footer (avoid, default
COOKIE_BUTTON_AVOID; side; bottomOverlap; --ipal-cookie-button-inset). Admin
language keeps following the browser (no fallbackLanguage change).

Merge addition: the branch had no CHANGELOG entry — both items added under New
in the one Unreleased section, plus Requires project changes item 6 (CookieButton).
This commit is contained in:
Radosław Smoliński
2026-10-29 15:46:09 +01:00
16 changed files with 291 additions and 11 deletions
+10
View File
@@ -48,6 +48,14 @@ fifteen ready page sections and ten page templates.
- **Reference site for agents:** `docs/agent/reference-site/INDEX.md` (shipped) maps every plugin feature to a file
in a complete example site built on ipal-kit, so an agent can copy a working pattern. The site itself lives in the
plugin repo (`reference/`, not shipped) and is built, seeded and smoke-tested in the plugin's CI.
- **2FA screens in plain English and Polish:** `TOTP_TEXTS` (en, pl) go over `@clocklimited/payload-2fa`'s texts, and
the setup / verify screens get a tab title (`TOTP_VIEW_TITLE`, in the site's default language) instead of
"Payload". The project's own `i18n.translations.<lang>.totpPlugin` still wins, a view's own `meta.title` stays, and
`twoFactor: { …, texts: false }` keeps the package's texts. The admin language still follows the browser.
- **`<CookieButton>` stays clear of the footer:** when the footer scrolls into view the button moves up above it
(`avoid`, default `COOKIE_BUTTON_AVOID` = `footer, [role="contentinfo"]`; `avoid={false}` turns it off), `side`
(`'left'` default / `'right'`), position tokens `--ipal-cookie-button-inset`; `bottomOverlap` for your own widget.
Type `CookieButtonProps`.
### Fixed
- **Sitemap, llms.txt, the site index (MCP `list_pages`), search (`searchContent`, the search route, MCP
@@ -89,6 +97,8 @@ fifteen ready page sections and ten page templates.
Existing sites move block by block when they get work (an own block with the same slug and fields can be replaced by
the library block with `slug`, else a migration with **ipal-migrate-fields**). After turning blocks on:
`pnpm generate:types`, `pnpm payload generate:importmap`, Postgres/SQLite `pnpm payload migrate:create`.
6. **CookieButton:** it now lifts above the site footer when the footer is in view. A site with its own fixed footer
bar or a button placed by `className`: check it; `avoid={false}` keeps the old fixed position.
## 1.14.6
@@ -36,6 +36,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `twoFactor.plugin` | — (required) | injected `payloadTotp` (the plugin does not import the peer) | missing function → throws |
| `twoFactor.collectionSlug` | the panel's login collection (`admin.user`, else the first auth collection) | collection with 2FA; startup fails with `[ipal] twoFactor…` when it is not an auth collection or differs from `admin.user` | point it at the login collection |
| `twoFactor.provider` | `'@intecion/ipal-kit/admin#TotpRedirectProvider'` | admin provider that sends users to `setup-totp` / `verify-totp` (path read in the browser); replaces the package's header-based one | own component path / `{ path, clientProps, serverProps }` (gets clientProps `forceSetup`); `false` keeps the package's (needs `x-pathname` on `/admin`, else `setup-totp?back=null` loops) |
| `twoFactor.texts` | ipal-kit's en/pl texts (`TOTP_TEXTS`) over the package's; 2FA screens titled "Two-step verification" / "Weryfikacja dwuetapowa" (site's language) | `false` = the package's texts; one text: `i18n.translations.<lang>.totpPlugin.<key>` (security.md) |
| `twoFactor.allowCollectionMismatch` | `false` | allows `collectionSlug` ≠ `admin.user` (panel users of the other collection then skip 2FA) | `true` only when you protect a second auth collection on purpose |
| `whiteLabel` | none | `admin.components.graphics.Logo/Icon` (`AdminLogo`/`AdminIcon`) from Site settings + vendor credit | omit / `false`; `true` = defaults |
| `whiteLabel.settingsSlug` | `'site-settings'` | global it reads the logo/name from | — |
@@ -144,7 +144,9 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
|---|---|---|
| `ConsentProvider` | `@intecion/ipal-kit/client` | Consent provider: `{ texts, cookieMap?, logEndpoint? }` — 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`; 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`. |
| `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, acceptAll, rejectAll, savePreferences, reopen }`. Usually use `ConsentProvider` + `useConsentContext` (the provider calls it itself). |
+6 -1
View File
@@ -105,7 +105,12 @@ takes `locale` and optional `labels`; defaults: `COOKIE_TABLE_LABELS` (`@intecio
| `controls` | `'checkbox'` | `'checkbox' \| 'switch'` |
| `settingsActions` | `['back', 'save']` | buttons under the categories (`'accept' \| 'back' \| 'reject' \| 'save'`) |
`CookieButton` takes only `className` (replaces the default).
`CookieButton` props: `className` (replaces the default classes; position is then yours too),
`side` (`'left'` default or `'right'`), `avoid` (CSS selector, default `COOKIE_BUTTON_AVOID` =
`'footer, [role="contentinfo"]'`; `false` = never move). While the footer is on screen the button
moves up by its visible part (`bottomOverlap`), so it never covers footer links. Position tokens:
`--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`.
## Overriding the look (Level 2)
+1
View File
@@ -80,6 +80,7 @@ Use these terms everywhere: labels, descriptions, docs, toasts. Never a synonym.
| The whole website | site | `witryna` | website, page, domain |
| A blog/news entry | post | `wpis` | article (unless the project calls it so) |
| Electronic mail | e-mail | `e-mail` | email, mail |
| Code from an authenticator app at login | two-step verification (2FA in short labels) | `weryfikacja dwuetapowa` | TOTP, two-factor authentication |
| Cookie consent | consent | `zgoda` | permission, opt-in |
| Cookie consent banner | cookie banner | `baner cookies` | popup, consent bar, CookieBanner |
| Form entry sent by a visitor | submission | `zgłoszenie` | entry, response, lead |
+4 -1
View File
@@ -404,7 +404,10 @@ about the matcher — paste it inline. This is a Next limitation, not a plugin o
## Admin panel languages and texts
The site's content languages (`i18n.locales`) and the **admin panel's** language are
separate. The panel's language is what each user picks in *Account → Language*.
separate. The panel's language is what each user picks in *Account → Language*; until they pick one,
Payload takes the browser's language (English or Polish), else `i18n.fallbackLanguage` (Payload's
default `en`). An English browser therefore gets an English panel — 2FA screens included — on a
Polish site; set `i18n.fallbackLanguage: 'pl'` in your config to change the last step.
- **Default:** when the project's `buildConfig` has no `i18n.supportedLanguages`, ipal-kit
sets English and Polish. A project that sets its own list keeps it, untouched:
+16
View File
@@ -402,6 +402,22 @@ pnpm generate:importmap
`src/app/(payload)/admin/importMap.js` must list `@intecion/ipal-kit/admin#TotpRedirectProvider` and
`@clocklimited/payload-2fa/rsc#TOTPSetup` / `#TOTPVerify` / `#TOTPField`. Commit the file.
### Texts of the 2FA screens (`twoFactor.texts`)
The setup and verify screens and the user field read their texts through Payload's i18n
(`totpPlugin:*`), in the user's admin language (*Account → Language*; without a choice, the
browser's language — an English browser sees English screens on a Polish site). The package's own texts are long and informal,
so ipal-kit merges `TOTP_TEXTS` (English and Polish, per `docs/dev/admin-ux.md`) over them, e.g.
"Two-step verification" / "Weryfikacja dwuetapowa", "Enter the 6-digit code from the app:" /
"Wpisz 6-cyfrowy kod z aplikacji:". The browser tab reads "Weryfikacja dwuetapowa — <site> | Panel"
(`TOTP_VIEW_TITLE` in the site's default language: Payload's view title is a plain string).
- **Override one text:** `i18n.translations.<lang>.totpPlugin.<key>` in your config — your keys win
over both sets.
- **Keep the package's texts:** `twoFactor: { …, texts: false }`.
- **Not translatable:** a network failure while sending the code shows the package's hardcoded
"Something went wrong" toast (rare: the server's own errors are translated).
### The redirect to the 2FA screens (`twoFactor.provider`)
The package's own admin provider decides on the server where to send the user, from an `x-pathname`