Merge claude/consent-banner-first-paint-154f9f: the cookie banner is part of the first render

Conflicts in the docs only, both sides kept: changelog lines, AGENT.md checklist rows 12 (banner) and 13 (wrapper order),
the two iapl-upgrade blocks, PROGRAMISTA rows 76 (client hints) and 77 (banner, renumbered from 76).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 12:56:20 +01:00
co-authored by Claude Opus 5.5
28 changed files with 981 additions and 76 deletions
+20
View File
@@ -228,6 +228,22 @@ once there are more than 20.
upgrade. Run `pnpm exec iapl-skills` and commit in the same change as the version bump.
### Changed
- **The cookie banner is part of the first render** ([consent.md → First paint](./consent.md#first-paint-the-banner-is-part-of-the-first-render-1170)).
Until now `<CookieBanner>` rendered nothing until the page had hydrated, so on a first visit its text appeared late
and on a text page became the LCP element (reference site, mobile profile, 4x CPU, slow 4G: page painted at 1.0 s,
banner and LCP at 2.7 s; now banner and LCP at 1.0 s; CLS unchanged). The banner is now in the server HTML with
`hidden`, followed by one small inline script that, before the browser paints, shows it (no decision, an older
Policy version, an unreadable cookie) or keeps it hidden (current decision). **An existing site gets this by
updating, with no edit; public pages stay static / ISR.** Nothing about consent changes: no tag loads earlier, the
Consent Mode default is still pushed first, the cookie, the consent log and withdrawal are as before. A click on a
banner button before hydration is carried out once the page is live.
**What an existing site may notice:** the page's HTML is about 3 kB larger, 1.2 kB gzipped (the banner's markup and the script; the detailed cookie
list is not in it); `[data-ipal="banner"]` exists in the DOM (hidden) for a returning visitor until hydration — a
project e2e test that counts the element right after load should assert `toBeHidden()`; with a **nonce CSP** the
script needs the nonce — `<SiteProviders nonce>` passes it (without it the banner appears after hydration, as
before); with **Tailwind 3** and a `classNames.root` that sets `display`, add
`[data-ipal="banner"][hidden] { display: none !important }`. Old behaviour: `<CookieBanner firstPaint={false} />`.
`CookieButton` and `useConsent` read the decision through a store (`useSyncExternalStore`) instead of an effect.
- **New names beside the old ones** (the old ones are deprecated and go in 2.0):
`iapl()` for `ipalKit()`, `IaplOptions`, `iaplEnvRules`, `IaplEnvFeatures`, `iaplT`, `iaplVar`, `IAPL_TOKENS`,
`IAPL_BREAKPOINTS`, `IaplTokenName`, `IaplGlobalSlug`; commands `iapl`, `iapl-doctor`, `iapl-skills`, `iapl-tokens`,
@@ -260,6 +276,10 @@ once there are more than 20.
`AdminClientHintsOptions`. Doctor rule `client-hints` (info): the wrapper is inside `withPayload`, or (with
`--url`) the home page still sends `Critical-CH`. The starter and the reference site use the new order; an
existing site changes one line ("Requires project changes").
- Consent, first paint: `CookieBanner` props `firstPaint` (default `true`) and `nonce`; `ConsentProvider` props `nonce`
and `cookieValue`, `SiteProviders` prop `consentCookie` (optional server read of the consent cookie: no banner in the
HTML of a visitor who decided, at the price of dynamic pages); `consentBannerScript({ version, cookieName })` from the
root for a project's own banner; `useConsent` / `useConsentContext` also return `hydrated` and `serverRead`.
- **The Intecion Notifications Webservice (IWSN) as the default e-mail transport** ([email.md](./email.md), AGENT.md §7.2).
The admin panel calls it **IWSN**; docs, logs and the doctor use the full name.
`mailAdapter()` now picks per send: Graph when the panel says so and `GRAPH_*` is set → SMTP when the panel has a