2FA screens: plain en/pl texts and tab title; CookieButton moves up above the footer
- TOTP_TEXTS (admin-ux.md wording) merged over @clocklimited/payload-2fa's long, informal texts; the project's i18n.translations still win; twoFactor.texts: false keeps the package's. Setup/verify screens titled "Two-step verification" / "Weryfikacja dwuetapowa" instead of "Payload". - CookieButton: position via --ipal-cookie-button-offset / -inset and --ipal-z-header; lifts above the footer (avoid, default COOKIE_BUTTON_AVOID) while it is on screen; side prop; className still replaces the look. - dev: a footer in the frontend layout to check the button against. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d992d131a2
commit
2886c89d8a
@@ -34,6 +34,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
@@ -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)
|
||||
|
||||
|
||||
@@ -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
@@ -378,7 +378,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:
|
||||
|
||||
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user