Compare commits

...
46 Commits
Author SHA1 Message Date
Radosław SmolińskiandClaude Opus 5.5 6998b44431 1.14.4 upgrade notes
CI / check (push) Canceled after 0s
ipal-upgrade: "→ 1.14.4" section. PROGRAMISTA §6: item 53.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 23:02:00 +01:00
Radosław SmolińskiandClaude Opus 5.5 e1f42615f3 1.14.4
Version bump and CHANGELOG entry: fillEmptyLocales (empty languages of the
cookie texts filled, own text never overwritten), cookieScanner.adminLayout
'combined' (one Cookies entry with Review and approve / Site check tabs), Cookie
banner renamed Cookies, known issue, what projects update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 23:02:00 +01:00
Radosław Smoliński eab26c98ca Merge claude/cookie-admin-merge: fill empty languages, one Cookies entry in the admin
fillEmptyLocales (default on): text written in one language fills the empty
languages of cookie-list and cookie-review purpose/duration; a language with its
own text is never overwritten (false or per-slug fields to change it).
cookieScanner.adminLayout (default 'combined'): the Cookie banner global is
"Cookies" with "Review and approve" and "Site check" tabs; cookie-review and
cookie-crawl leave the navigation, their data, API and /admin/cookie-approval
stay ('separate' keeps the old entries). No schema change (Postgres
migrate:create: no schema changes).
2026-10-28 23:00:41 +01:00
Radosław SmolińskiandClaude Opus 5.5 cad299c132 Remove a local dev-server launch file committed by mistake
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 22:57:35 +01:00
Radosław SmolińskiandClaude Opus 5.5 49e27175ae Dev app: import map entries for the Cookies tabs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 22:57:24 +01:00
Radosław SmolińskiandClaude Opus 5.5 b10c2dc0e3 Cookies: fill empty languages, and one Cookies entry in the admin
Every language filled (fillEmptyLocales, default on): text saved in one
language goes to every language where the same field is still empty, never
over a language's own text. Applies to the cookie list (purpose, duration)
and the cookie review (purpose, duration). Scanner and approval writes give
a language without its own text the default language's text. Building
blocks: buildFillEmptyLocalesGlobalHook / CollectionHook, fillEmptyLocales,
withFillLocales.

One Cookies entry (cookieScanner.adminLayout, default combined): the
Cookie banner global is now labelled Cookies and gets Review and approve
(scan box and approval list inline) and Site check tabs, built from ui
fields. Cookie review and Cookie check leave the navigation
(admin.group false) but keep their pages, data and API. This is
presentation only: no schema change and no migration, only
generate:importmap. adminLayout separate keeps the old layout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 22:55:11 +01:00
Radosław SmolińskiandClaude Opus 5.5 a9e1adc03b 1.14.3 upgrade notes
CI / check (push) Canceled after 0s
ipal-upgrade: "→ 1.14.3" section for the cookie approval flow. PROGRAMISTA §6:
item 52.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 22:26:53 +01:00
Radosław SmolińskiandClaude Opus 5.5 44598bbef2 1.14.3
Version bump and CHANGELOG entry: Approve cookies page with one Approve and add,
New/Changed/Needs description/No longer found markers, unknownCategory,
dashboard and e-mail reminders, approval: false, new exports, the lookup change
for hand-typed rows, and what projects with cookieScanner update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 22:26:53 +01:00
Radosław Smoliński 5f4f2a07ab Merge claude/cookie-approve: one approval for everything a cookie scan finds
/admin/cookie-approval (Approve cookies): one "Approve and add" for the ticked
cookies into Cookie banner -> Cookies in every locale; statuses New, Changed,
Needs description, No longer found; never overwrites editor text, never
duplicates or deletes. Unknown cookies -> approval.unknownCategory (default
marketing). Dashboard and e-mail reminders. cookieScanner.approval: false keeps
the per-entry review. New cookie-review fields change and needsDescription
(Postgres: one enum column + index, one boolean).
2026-10-28 22:23:24 +01:00
Radosław SmolińskiandClaude Opus 5.5 9b9c5fc872 Dev app: import map entry for the cookie approval view
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 22:20:51 +01:00
Radosław SmolińskiandClaude Opus 5.5 86ff3f5ff7 Cookie scanner: one approval for everything a scan finds
After "Scan cookies" or a site check, the new Approve cookies view
(/admin/cookie-approval) lists what waits, grouped by consent category, with
provider, purpose and duration and New / Changed / Needs description markers.
One "Approve and add" puts every ticked cookie into Cookie banner -> Cookie
list in every locale. That list feeds the cookie policy table and the
detailed settings window.

- Never overwrites editor text or categories, never adds a second row (a
  pattern and a concrete name are the same cookie), never deletes.
- Unknown cookies are approved into a category that needs consent
  (approval.unknownCategory, default marketing) and flagged Needs
  description; writing a purpose clears the flag.
- Cookies a scan or crawl no longer finds are flagged No longer found, for
  review only.
- The dashboard and the crawl e-mail say how many cookies wait and link to
  the view; nothing is added without approval.
- Optional: cookieScanner.approval false keeps per-entry review.
- Migration: cookie-review gains change and needsDescription.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 22:17:46 +01:00
Radosław SmolińskiandClaude Opus 5.5 0e7966dfbb 1.14.2 upgrade notes
CI / check (push) Canceled after 0s
ipal-upgrade, PROGRAMISTA §6 item 51 and security.md point at 1.14.2 instead of
"after 1.14.1".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 21:34:09 +01:00
Radosław SmolińskiandClaude Opus 5.5 2cadb425d6 1.14.2
Version bump; the Unreleased section becomes 1.14.2: 2FA setup-loop fix
(TotpRedirectProvider), twoFactor.provider, totpRedirectTarget/totpAdminPath,
known issue (low deepmerge advisory via payload), what projects with 2FA update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 21:34:09 +01:00
Radosław Smoliński 41065940e8 Merge claude/recursing-wright-be31dd: fix the 2FA setup loop
ipal-kit swaps @clocklimited/payload-2fa's TOTPProvider (it read the path from an
x-pathname header nothing sets on /admin, so setup-totp?back=null redirected to
itself) for TotpRedirectProvider (/admin), which reads the path in the browser.
twoFactor.provider: own component, or false to keep the package's. Pure rules:
totpRedirectTarget, totpAdminPath. Server-side TOTP enforcement (the package's
access wrapper) is unchanged. Dev app: IPAL_DEV_2FA=1 turns 2FA on.
2026-10-28 21:30:03 +01:00
Radosław SmolińskiandClaude Opus 5.5 60f744e3ad Fix the 2FA setup loop: setup-totp?back=null redirected to itself
@clocklimited/payload-2fa's admin provider reads the current path from an
x-pathname request header. Nothing sets it on /admin (the createProxy matcher
skips /admin), so the path was null: every admin page, the setup screen too,
redirected to /admin/setup-totp?back=null, forever. Every new admin on a site
with 2FA got stuck.

ipalKit now swaps that provider for its own TotpRedirectProvider
(@intecion/ipal-kit/admin, client-side): it reads the path in the browser,
never redirects away from the setup/verify screens or logout, and renders
nothing while redirecting. twoFactor.provider takes a project component, or
false to keep the package's. totpRedirectTarget / totpAdminPath export the
rules. Projects run generate:importmap.

Test: test/totpRedirect.test.ts (redirect walk, provider swap). Dev app:
IPAL_DEV_2FA=1 turns 2FA on. Docs: security.md, CHANGELOG (Unreleased),
AGENT.md, ipal-setup/-upgrade/-debug/-reference, PROGRAMISTA item 51.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 21:27:19 +01:00
Radosław SmolińskiandClaude Opus 5.5 4e254057f9 1.14.1 upgrade notes
CI / check (push) Canceled after 0s
ipal-upgrade: the X-Powered-By/CSP section is now "→ 1.14.1". PROGRAMISTA §6:
item 50 for 1.14.1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 21:53:22 +01:00
Radosław SmolińskiandClaude Opus 5.5 cdf80744ea 1.14.1
Version bump and CHANGELOG entry: withSecurityConfig (hide X-Powered-By),
opt-in CSP through buildSecurityHeaders({ csp }) with report-only/enforce and
reports, createCspReportRoute, buildAdminCspHeaders, opt-in nonces, new buildCsp
flags with extra/override, ipal-audit header check; nothing required on upgrade.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 21:53:22 +01:00
Radosław Smoliński 86ff9e3df0 Merge claude/csp-powered-by-ee307c: hide X-Powered-By, opt-in CSP with reports, admin policy, nonces
withSecurityConfig hides X-Powered-By (hidePoweredBy: false to keep it).
buildSecurityHeaders({ csp }) is off unless passed; report-only first, then
enforce, with reportUri / Reporting-Endpoints. buildCsp flags with extra and
override, buildAdminCsp(Headers), createCspReportRoute. Nonces only with
createProxy({ csp }) + SiteProviders nonce, so static and ISR pages stay static.
2026-10-27 21:37:39 +01:00
Radosław SmolińskiandClaude Opus 5.5 ff4c595b91 Security: hide X-Powered-By, CSP report-only with reports, admin policy and nonces
- withSecurityConfig: poweredByHeader false + strips X-Powered-By from headers()
  (Next's and withPayload's), works on either side of withPayload
- buildSecurityHeaders({ csp }): CSP + Reporting-Endpoints; mode switches
  report-only → enforce
- buildCsp: reportUri/reportGroup, nonce + strict-dynamic, dev unsafe-eval,
  metaPixel/linkedIn/tiktok/clarity flags, media-src for R2, override
- buildAdminCsp(Headers): looser policy for Payload admin (Monaco CDN, blob workers)
- createCspReportRoute + parseCspReports: report collector for both formats
- createProxy({ csp }) + createCspNonce: per-request nonce, x-nonce header;
  SiteProviders/ThemeScript/Analytics/ConsentScript accept nonce
- docs: security.md, AGENT.md, ipal-setup/reference/upgrade; ipal-audit checks

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 21:28:11 +01:00
Radosław SmolińskiandClaude Opus 5.5 771dda1c6f 1.14.0 upgrade notes
CI / check (push) Canceled after 0s
ipal-upgrade: the 1.14.0 section walks through the 8 "What projects must
update" items. PROGRAMISTA §6: item 48 marked 1.14.0, new item 49.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 16:52:47 +01:00
Radosław SmolińskiandClaude Opus 5.5 2051a01190 1.14.0
Version bump and CHANGELOG entry: image lightbox, cookie scanner (scan and
browser crawl), admin in English and Polish, admin follow-ups, Next 16.4.3 and
sharp 0.35.5 in dev, nodemailer 10 and Node >=20.9, test/dev generate:types fix,
and what projects must update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 16:52:47 +01:00
Radosław Smoliński 117d5c642d Merge claude/deps-audit-nodemailer-2fa: dependency advisories
nodemailer ^8 -> ^10.2.1 (ships its own types; @types/nodemailer removed),
engines.node >=20.9.0. Repo-only pnpm.overrides for Payload's transitive
dependencies (undici, dompurify, fast-uri, js-yaml, browserslist, source-map-js,
fast-copy, baseline-browser-mapping); consumers are not bound by them, and the
docs recommend the dompurify/undici overrides for projects on payload 3.90.x.
pnpm audit --prod: no known vulnerabilities. New emailTransports and twoFactor tests.
2026-10-27 16:45:07 +01:00
Radosław SmolińskiandClaude Opus 5.5 007a0a3ae6 Dependency advisories: nodemailer 10, overrides for Payload's pinned deps
- nodemailer ^8.0.1 -> ^10.2.1 (advisories up to 10.1.3); drop @types/nodemailer,
  nodemailer 10 ships its own types. Node engines >=20.9.0 (nodemailer 10 needs 20+).
- pnpm.overrides (repo only, not passed to projects) for packages in payload 3.90.2's
  tree: undici and dompurify are exact-pinned upstream; fast-uri, js-yaml,
  browserslist, source-map-js, fast-copy, baseline-browser-mapping raised to fixed
  minimums. pnpm audit --prod: 19 high / 35 moderate / 11 low -> 0.
- Tests: SMTP over a local SMTP socket with real nodemailer (panelSmtpAdapter,
  sendEmail, unreachable server status), Microsoft Graph and Graph->SMTP fallback
  via mailAdapter; real payloadTotp through ipalKit, plus a check that payload-2fa
  resolves the project's payload.
- Docs: email.md, AGENT.md §4 item 12, ipal-setup, ipal-upgrade, README.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 16:42:05 +01:00
Radosław Smoliński 54fb57b7a9 Merge claude/relaxed-joliot-25dcb3: Next 16.4.3 and admin follow-ups
Dev dependencies: next and eslint-config-next 16.4.3, sharp 0.35.5 (fixes the
Next 16.0.0-16.4.0 advisories: 2 critical RCE, 1 high DoS); minimum safe Next
16.4.1 documented; peer range next >=15 unchanged.
Admin follow-ups: localised stats tab title (DocumentTitle), Polish cookie-scanner
integration names, construction notice close label, FaviconCheck hint under
Site settings -> Site icon (new import-map entry @intecion/ipal-kit/admin#FaviconCheck).
2026-10-27 16:34:01 +01:00
Radosław SmolińskiandClaude Opus 5.5 546806fe39 Admin follow-ups: localised stats tab title, scanner names, close label, favicon hint
- Statistics view: the browser-tab title follows the admin language.
  Payload's custom-view meta.title is one plain string and its custom-view
  metadata ignores i18n, so the view renders <DocumentTitle> (/admin) with the
  translated title; it re-applies the title while the view is open because
  Next streams the English metadata in after hydration. adminDocumentTitle()
  adds admin.meta.titleSuffix the way Payload does.
- Cookie scanner: CookieIntegration.label may be { en, pl, ... }. The built-in
  names without a product name come from the shared admin texts
  (cookieIntegration*, cookieSourceProject); the scan endpoint answers in the
  request's admin language and stored source names use the scanning editor's.
- Maintenance notice: getConstructionMode(locale) returns `locale`; the "x"
  close button gets a screen-reader name "Close" / "Zamknij" (locale and
  closeLabel props; constructionCloseLabel exported).
- Favicon: FaviconCheck (/admin, afterInput on Site settings -> Site icon)
  warns in the admin language when the image is under 48x48 or not square,
  without blocking the save; validateFaviconField shares faviconProblems().
- Docs, AGENT.md and skills: the above, plus Next.js 16.4.1 or later as the
  minimum safe version (AGENT.md 4.11, ipal-setup, ipal-upgrade).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 16:31:46 +01:00
Radosław SmolińskiandClaude Opus 5.5 6f32ea4cdb Dev dependencies: next and eslint-config-next 16.4.3, sharp 0.35.5
Next 16.0.0-16.4.0 is affected by GHSA-2464-fhr4-w9xw (RCE in image
optimization with SVG, fixed with sharp 0.35.5), GHSA-673q-mjm6-r5xr
(RCE in use cache) and GHSA-p3m5-59mp-jv5r (Server Actions DoS); all
fixed in 16.4.1. The peer range stays open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 16:20:13 +01:00
Radosław Smoliński e475f476d3 Merge claude/admin-ux-wording-9e043e: admin in English and Polish, reworded
Admin languages default to English + Polish unless the project sets
i18n.supportedLanguages; plugin texts under the ipal namespace, project
translations win key by key. All admin wording rewritten and fields regrouped
per docs/dev/admin-ux.md, without changing slugs, field names or the schema
(Postgres migrate:create: no schema changes). Dev app no longer leaks
generate:types; test/adminUx.test.ts.
2026-10-27 16:18:41 +01:00
Radosław SmolińskiandClaude Opus 5.5 2dafcd0852 Tests: fix test-project typecheck (casts, Rule arity) and base-to-string lint warnings
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 16:17:40 +01:00
Radosław SmolińskiandClaude Opus 5.5 a92bc51814 Admin wording follow-ups from the browser check
- stats nav link reads "Statistics overview" (it renders after all nav groups)
- form-builder e-mails array labelled in en + pl
- dev import map: RowLabel (cookie banner rows)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:49:37 +01:00
Radosław SmolińskiandClaude Opus 5.5 0a2374db18 Docs: admin languages and texts, wording rule for agents, new screen names
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:46:25 +01:00
Radosław SmolińskiandClaude Opus 5.5 6b46bc0c14 Admin panel in English and Polish, reworded per docs/dev/admin-ux.md
- admin-i18n module: AdminText { en, pl }, component texts under the ipal
  namespace (project translations win), en + pl admin languages when the
  project sets none (project's supportedLanguages wins)
- every plugin label, description, option, tab and group as { en, pl };
  explicit labels instead of auto-labels; sentence case; glossary terms
- visible renames (slugs, names, data unchanged): Cookie banner, Form
  messages, Privacy group, Search engines, Maintenance, Spam protection,
  E-mail sending, stats nav link Overview (hidden without access)
- Polish visitor defaults by page locale: cookie banner, form messages,
  validators, lightbox, accessibility widget; {field} uses the label
- fixes: e-mail status banner used Turnstile wording; developer words and
  env var names out of editor messages; stats numbers/dates in the admin
  language; test e-mail no longer says ipal-kit
- test/adminUx.test.ts: length limits, en + pl present, no developer words

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:46:25 +01:00
Radosław Smoliński eeac33ed2f Merge commit '77b826e' into claude/admin-ux-wording-9e043e 2026-10-27 15:29:39 +01:00
Radosław SmolińskiandClaude Opus 5.5 839c34ab6f dev: stop Payload spawning generate:types on every dev start (orphan leak)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:29:39 +01:00
Radosław Smoliński 77b826e6d8 Merge claude/cookie-scanner-eef8a8: cookie scanner phases 1 and 2
cookieScanner option: cookie-review collection, Scan cookies (declarations +
bundled Open Cookie Database), opt-in browser crawl through
services/cookie-crawler with the cookie-crawl global and dashboard alert.

Overlap with claude/test-no-typegen, resolved here: one test-config fix.
- the six real-Payload tests keep buildTestConfig and drop the branch's
  duplicate typescript: { autoGenerate: false } lines;
- cookieScannerIntegration and cookieCrawlIntegration use buildTestConfig
  instead of buildConfig + their own flag (testConfig.test.ts guard passes).
2026-10-27 15:26:44 +01:00
Radosław Smoliński cb7e21de20 Merge claude/image-lightbox-15eabd: shared image lightbox
LightboxProvider / LightboxTrigger / LightboxDialog and lightboxImage from
/client, RenderRichText lightbox, SiteProviders lightbox, opt-in Notifications
labels (ipalKit lightbox: true), docs/lightbox.md and agent guide.
2026-10-27 15:26:31 +01:00
Radosław Smoliński 5d587760de Merge claude/test-no-typegen: tests boot Payload without type generation
buildTestConfig (test/helpers.ts) turns typescript.autoGenerate off for the six
real-Payload tests; test/testConfig.test.ts fails if a test calls buildConfig
directly.
2026-10-27 15:26:31 +01:00
Radosław SmolińskiandClaude Opus 5.5 433984e1e1 Cookie scanner: fixes from the browser test in the dev app
- The admin box uses Payload's Button (plain <button class="btn"> rendered
  unstyled), shows "Never run" before the first crawl and the note on a
  finished crawl (e.g. "Accept all" not found).
- The dashboard warning puts its link on its own line.
- Dev sandbox: cookieScanner { crawl: true } and the regenerated import map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:21:17 +01:00
Radosław SmolińskiandClaude Opus 5.5 4bb9c663fd Cookie scanner, phase 2: browser crawl through a shared scanner service
cookieScanner.crawl (opt-in) adds "Crawl site" to the Cookie review box. The
site asks the shared scanner service (services/cookie-crawler: Node +
Playwright, Dockerfile, deployed once on Coolify) to crawl its sitemap pages
twice, with no consent and after "Accept all". The service posts cookies,
storage keys and third-party hosts back to POST /api/ipal/cookie-crawl/results
(bearer token, running job only). No browser in the site.

Findings land as drafts through the same merge rules. Anything stored before
consent that is not necessary, and tracker requests before consent, are
violations, flagged on the review entries from the latest crawl only. The
cookie-crawl global keeps the latest result (no history). A dashboard warning
(CookieCrawlAlert) and an opt-in e-mail through the project's mail adapter
follow a crawl with violations or new unknown cookies. Scheduled crawls: a
Coolify scheduled task with the token. ipalEnvRules({ cookieCrawl: true }).

Also: the six older real-Payload tests no longer leave an orphaned
payload generate:types process (typescript.autoGenerate: false).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:14:01 +01:00
Radosław SmolińskiandClaude Opus 5.5 c7c8c819ac admin-ux guide: Privacy group, label naming, default admin languages
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:13:22 +01:00
Radosław SmolińskiandClaude Opus 5.5 4c55d7aeff Admin wording and layout guide (docs/dev/admin-ux.md); dev editor login
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:10:49 +01:00
Radosław SmolińskiandClaude Opus 5.5 53a8920564 Tests: boot Payload without type generation, guard against the leak
Outside production getPayload() spawns a detached generate:types child.
With no PAYLOAD_CONFIG_PATH it never finds a config (tsconfig rootDir
'./' sends Payload's findUpSync into an endless loop), so every full
vitest run left six processes spinning at ~40% CPU.

- test/helpers.ts: buildTestConfig() = buildConfig with
  typescript.autoGenerate false
- the six tests that boot Payload use it
- test/testConfig.test.ts: fails if a test calls buildConfig directly

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 14:59:41 +01:00
Radosław SmolińskiandClaude Opus 5.5 4f69f6ed20 Cookie scanner test: no generate:types child on Payload init
Outside production, getPayload() spawns `payload generate:types` in the
background and that process never exits, leaving one orphan per test file
per run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 14:57:21 +01:00
Radosław SmolińskiandClaude Opus 5.5 a0545b6716 Cookie scanner, phase 1: declarations, database lookup, review list
ipalKit({ cookieScanner }) (opt-in) adds the cookie-review collection, a
"Scan cookies" box above its list and GET/POST /api/ipal/cookie-scan. A scan
lists the cookies of every integration the project switches on (consent,
admin login, locale, stats, GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok,
Turnstile), the project's own declarations, and extra names looked up in the
bundled Open Cookie Database, as drafts. Editors accept (→ Cookie Settings →
Cookies, every locale, only empty text filled), edit or reject. A rescan never
deletes, never changes status and never overwrites edited text.

Everything is overridable (access, collectionOverrides, integrations,
declarations, databaseCategories, labels, syncAccepted) and the building
blocks are exported. Admin labels in en + pl. Docs: cookie-scanner.md,
consent.md, AGENT.md, ipal-reference, ipal-consent-check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 14:55:20 +01:00
Radosław SmolińskiandClaude Opus 5.5 ab45cf48be Bundle the Open Cookie Database (Apache-2.0) with a refresh script
scripts/refresh-cookie-database.mjs (pnpm cookie-db:refresh) downloads the CSV
and license at a pinned commit, refuses a non-Apache license, and writes
src/modules/consent/scanner/data/openCookieDatabase.ts (source commit and
change notice in the header) plus docs/licenses/open-cookie-database-LICENSE.txt.
Nothing is fetched at runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 14:55:19 +01:00
Radosław SmolińskiandClaude Opus 5.5 7eacf1e713 Docs: image lightbox page, agent guide, skills, audit check, upgrade note
- docs/lightbox.md: setup, sizes, styling, overrides, migration from a
  hand-made modal or glightbox
- AGENT.md (§6.9, §7 catalog, §7.1, §12), ipal-reference (option, wiring,
  api.md section), ipal-site and ipal-block steps, PROGRAMISTA §6 row 48
- ipal-audit warns about lightbox libraries
- notifications.md, richtext.md, media.md, frontend.md, README index

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 14:49:38 +01:00
Radosław SmolińskiandClaude Opus 5.5 476c3ac1df Shared image lightbox: LightboxProvider, LightboxTrigger, LightboxDialog, lightboxImage
Opt-in click-to-enlarge for small images (cards, galleries, rich text):
- /client: LightboxProvider (one viewer per site), LightboxTrigger (button
  around any thumbnail, works without a provider), LightboxDialog
  (controlled viewer), useLightbox / useOptionalLightbox
- accessible dialog: aria-modal, focus trap and return, Esc, arrows,
  Home/End, swipe, counter, caption, scroll lock, reduced motion
- lightboxImage builds src + srcSet from Payload image sizes
- labels: ipalKit({ lightbox: true }) adds Notifications -> Lightbox;
  getNotificationTexts().lightbox and getSiteShell().lightboxTexts,
  English fallbacks otherwise
- RenderRichText lightbox / withLightboxUploads wrap image uploads
- SiteProviders lightbox mounts the provider
- styling from --ipal-lightbox-* variables; unstyled + classNames,
  renderImage, renderDialog, icons, loop overrides
- tests with happy-dom (vitest's pinned optional peer)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 14:49:38 +01:00
250 changed files with 16038 additions and 1942 deletions
+5 -1
View File
@@ -67,6 +67,7 @@ plugin development.
`nodemailer`, `lucide-react`, `slugify` and `server-only` are regular
`dependencies` of the plugin — they install with it; don't add them yourself.
The plugin's `nodemailer` 10 needs **Node.js 20 or later**.
What you provide are the **peer dependencies** — packages the plugin shares with
your project — in a version matching your Payload:
@@ -86,7 +87,10 @@ pnpm add @payloadcms/[email protected] # only with R2 media
```
Keep every `@payloadcms/*` at exactly the same version as `payload`
(`pnpm.overrides` — see PROGRAMISTA.md §1). Upload optimization and image
(`pnpm.overrides` — see PROGRAMISTA.md §1). Then run `pnpm audit --prod`: with
`payload` 3.90.x, Payload's own tree pins a vulnerable `undici` and `dompurify` —
add the two overrides from [AGENT.md §4 item 12](./docs/agent/AGENT.md) (recommended, not
required by the plugin). Upload optimization and image
placeholders also use the `sharp` you pass to `buildConfig({ sharp })`
(standard in a `create-payload-app` project).
+22
View File
@@ -1,3 +1,4 @@
import { TOTPField as TOTPField_3eb2cc20d1a2569c2ccbafcee15bd128 } from '@clocklimited/payload-2fa/rsc'
import { OverviewComponent as OverviewComponent_a8a977ebc872c5d5ea7ee689724c0860 } from '@payloadcms/plugin-seo/client'
import { MetaTitleComponent as MetaTitleComponent_a8a977ebc872c5d5ea7ee689724c0860 } from '@payloadcms/plugin-seo/client'
import { MetaDescriptionComponent as MetaDescriptionComponent_a8a977ebc872c5d5ea7ee689724c0860 } from '@payloadcms/plugin-seo/client'
@@ -27,17 +28,28 @@ import { StrikethroughFeatureClient as StrikethroughFeatureClient_e70f5e05f09f93
import { UnderlineFeatureClient as UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { BoldFeatureClient as BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { ItalicFeatureClient as ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { CookieScanButton as CookieScanButton_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { FaviconCheck as FaviconCheck_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { IntegrationStatusBanner as IntegrationStatusBanner_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { MaskedField as MaskedField_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { TestEmailButton as TestEmailButton_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { RowLabel as RowLabel_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { StatsNavLink as StatsNavLink_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { CookieCrawlAlert as CookieCrawlAlert_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { StatsWidget as StatsWidget_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { IntegrationAlerts as IntegrationAlerts_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { TotpRedirectProvider as TotpRedirectProvider_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { TOTPSetup as TOTPSetup_3eb2cc20d1a2569c2ccbafcee15bd128 } from '@clocklimited/payload-2fa/rsc'
import { TOTPVerify as TOTPVerify_3eb2cc20d1a2569c2ccbafcee15bd128 } from '@clocklimited/payload-2fa/rsc'
import { CookieApprovalView as CookieApprovalView_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { CookieReviewTab as CookieReviewTab_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { CookieSiteCheckTab as CookieSiteCheckTab_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { StatsView as StatsView_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc'
/** @type import('payload').ImportMap */
export const importMap = {
"@clocklimited/payload-2fa/rsc#TOTPField": TOTPField_3eb2cc20d1a2569c2ccbafcee15bd128,
"@payloadcms/plugin-seo/client#OverviewComponent": OverviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
"@payloadcms/plugin-seo/client#MetaTitleComponent": MetaTitleComponent_a8a977ebc872c5d5ea7ee689724c0860,
"@payloadcms/plugin-seo/client#MetaDescriptionComponent": MetaDescriptionComponent_a8a977ebc872c5d5ea7ee689724c0860,
@@ -67,12 +79,22 @@ export const importMap = {
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@intecion/ipal-kit/admin#CookieScanButton": CookieScanButton_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#FaviconCheck": FaviconCheck_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#IntegrationStatusBanner": IntegrationStatusBanner_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#MaskedField": MaskedField_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#TestEmailButton": TestEmailButton_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#RowLabel": RowLabel_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#StatsNavLink": StatsNavLink_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#CookieCrawlAlert": CookieCrawlAlert_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#StatsWidget": StatsWidget_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#IntegrationAlerts": IntegrationAlerts_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#TotpRedirectProvider": TotpRedirectProvider_7568fe47d582ff15ce85d2e1873c2c23,
"@clocklimited/payload-2fa/rsc#TOTPSetup": TOTPSetup_3eb2cc20d1a2569c2ccbafcee15bd128,
"@clocklimited/payload-2fa/rsc#TOTPVerify": TOTPVerify_3eb2cc20d1a2569c2ccbafcee15bd128,
"@intecion/ipal-kit/admin#CookieApprovalView": CookieApprovalView_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#CookieReviewTab": CookieReviewTab_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#CookieSiteCheckTab": CookieSiteCheckTab_7568fe47d582ff15ce85d2e1873c2c23,
"@intecion/ipal-kit/admin#StatsView": StatsView_7568fe47d582ff15ce85d2e1873c2c23,
"@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1
}
+6
View File
@@ -2,3 +2,9 @@ export const devUser = {
email: '[email protected]',
password: '[email protected]',
}
/** Second dev login with the editor role — for checking what editors see. */
export const devEditor = {
email: '[email protected]',
password: '[email protected]',
}
+8 -1
View File
@@ -1,3 +1,4 @@
import { payloadTotp } from '@clocklimited/payload-2fa'
import { sqliteAdapter } from '@payloadcms/db-sqlite'
import { lexicalEditor } from '@payloadcms/richtext-lexical'
import { ipalKit } from '../src/index.js'
@@ -67,16 +68,22 @@ export default buildConfig({
access: { authCollection: 'users' },
i18n: i18nConfig,
consentLog: true,
// Cookie review + "Crawl site" (needs IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN and a running services/cookie-crawler).
cookieScanner: { crawl: true },
forms: {},
seo: { collections: ['posts', 'pages'] },
stats: true,
// 2FA is enforced by default; the dev sandbox opts out so it boots without an authenticator.
twoFactor: false,
// IPAL_DEV_2FA=1 turns it on (first-login setup and verify screens).
twoFactor: process.env.IPAL_DEV_2FA ? { issuer: 'ipal-kit dev', plugin: payloadTotp } : false,
}),
],
secret: process.env.PAYLOAD_SECRET || 'test-secret_key',
sharp,
typescript: {
// Payload's dev init spawns `payload generate:types` on every start/recompile and never
// reaps it, so each restart left an orphan. Run `pnpm generate:types` when types change.
autoGenerate: false,
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
})
+6 -1
View File
@@ -1,6 +1,6 @@
import type { Payload } from 'payload'
import { devUser } from './helpers/credentials.js'
import { devEditor, devUser } from './helpers/credentials.js'
export const seed = async (payload: Payload) => {
const { totalDocs } = await payload.count({
@@ -23,6 +23,11 @@ export const seed = async (payload: Payload) => {
})
}
const editors = await payload.count({ collection: 'users', where: { email: { equals: devEditor.email } } })
if (!editors.totalDocs) {
await payload.create({ collection: 'users', data: { ...devEditor, roles: ['editor'] } })
}
await seedContactPage(payload)
}
+256
View File
@@ -8,6 +8,262 @@ 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.
## 1.14.4
Cookie texts in every language without retyping them, and one **Cookies** entry in the admin instead of three.
Both are on by default and can be turned off; no schema change.
### New
- **Empty languages are filled automatically** (`fillEmptyLocales`, default on): text written in one language goes
to every language where the same field is still empty — the cookie list (Cookies → Cookie list: `purpose`,
`duration`) and the cookie review (`purpose`, `retention`). A language that has its own text is never overwritten,
so editors can still change each language on its own. `fillEmptyLocales: false` turns it off; an object sets the
fields per slug (`{ 'cookie-settings': [...], 'cookie-review': [...] }`, `[]` = off for that slug). Building blocks:
`fillEmptyLocales`, `withFillLocales`, `buildFillEmptyLocalesGlobalHook`, `buildFillEmptyLocalesCollectionHook`,
type `FillEmptyLocalesTarget` (docs/hooks.md).
- **One Cookies entry in the admin** (`cookieScanner.adminLayout`, default `'combined'`): with the cookie scanner,
the Cookies global gets **Review and approve** and **Site check** tabs (`CookieReviewTab`, `CookieSiteCheckTab`,
`/admin`; `addCookieScannerTabs`). The Cookie review collection and the Cookie check global leave the navigation;
their data, API and `/admin/cookie-approval` stay. `adminLayout: 'separate'` keeps the separate entries.
`collectionOverrides` and `crawl.globalOverride` still win (e.g. `admin.group` to show an entry again).
### Changed
- The **Cookie banner** global is labelled **Cookies** (pl: Cookies) in every project; the slug `cookie-settings` and
the data are unchanged. Docs and skills use the new name.
### Known issue
- `pnpm audit --prod` still reports one **low** advisory: `deepmerge` 4.2.0–4.3.1 (GHSA-gcqx-w48m-w2h4), reached
through `payload`. No patched version exists yet; nothing to do in projects.
### What projects must update
1. `pnpm payload generate:importmap` — with `cookieScanner` it adds `@intecion/ipal-kit/admin#CookieReviewTab` and
(with `crawl`) `@intecion/ipal-kit/admin#CookieSiteCheckTab`; commit `importMap.js`. No migration (no schema change).
2. **Behaviour to know (both overridable):**
- Empty languages of the cookie texts are now filled from the language an editor writes in. To keep empty
languages empty: `ipalKit({ fillEmptyLocales: false })`.
- With `cookieScanner`, the cookie screens are one **Cookies** entry with tabs; Cookie review and Cookie check
are no longer in the navigation. To keep the old entries: `cookieScanner: { adminLayout: 'separate' }`.
3. Tell editors: **Cookie banner** is now **Cookies**; the review list and the site check are its tabs. Update
screenshots and instructions. **Check:** the admin navigation shows one **Cookies** entry; its **Review and
approve** tab lists the review entries; type a cookie purpose in one language, save → the other languages show it.
## 1.14.3
One approval for everything the cookie scanner finds: editors tick the cookies and add them all to the cookie list
at once, instead of opening every review entry. Only for projects with `cookieScanner`.
### New
- **Approve cookies** page (`/admin/cookie-approval`, `CookieApprovalView`; linked from the scan box on Privacy →
Cookie review and from the dashboard): the cookies a scan or crawl found,
grouped by category, with one **Approve and add** button for every ticked cookie. They go into Cookie banner →
Cookies in every locale. Nothing reaches the cookie list until an editor approves it. The approve and list endpoints
are for editors and up by default (`cookieScanner.access`).
- **Markers** on each review entry (new `change` and `needsDescription` fields): **New**, **Changed** (a scan changed
its suggested values), **Needs description** (no purpose yet; cleared when an editor writes one) and **No longer
found** (a scan or crawl no longer sees it). A cookie that is no longer found is flagged for review only; neither the
review entry nor the list row is deleted.
- **Never overwrites, never duplicates:** an existing list row (same name, or a pattern such as `_ga_*` that covers
it) only gets its empty texts filled; editor text is kept, and no second row is added.
- **Unknown cookies** that no integration or database knows go to `cookieScanner.approval.unknownCategory` (default
`marketing`, so they need consent until an editor describes them).
- **Reminders:** a dashboard notice while cookies wait (`CookieCrawlAlert`; `approval.dashboard: false` hides it), and
the crawl e-mail says how many cookies wait, with a link to the approval page.
- **`cookieScanner.approval: false`** keeps the old review, entry by entry.
- New exports: `approveCookies`, `loadCookieApproval`, `countPendingCookies`, `flagGoneEntries`, `nextChange`,
`sameCookie`, `buildCookieApprovalEndpoints`, `COOKIE_APPROVAL_PATH`, `COOKIE_APPROVAL_VIEW_PATH`,
`DEFAULT_UNKNOWN_CATEGORY`, `PENDING_WHERE`; `CookieApprovalView`, `CookieApprovalForm` (`/admin`); types
`CookieApprovalOptions`, `CookieApprovalItem`, `CookieApprovalList`, `CookieApprovalResult`, `CookieChange`.
### Changed
- **Hand-typed cookie list rows:** a scan looks a row up (database, integrations) only while it has no review entry.
Once it has one, the review entry and the approval page are the place to change it.
### Known issue
- `pnpm audit --prod` still reports one **low** advisory: `deepmerge` 4.2.0–4.3.1 (GHSA-gcqx-w48m-w2h4), reached
through `payload`. No patched version exists yet; nothing to do in projects.
### What projects must update
- **Projects with `cookieScanner`:**
1. `pnpm payload generate:importmap` — adds `@intecion/ipal-kit/admin#CookieApprovalView` and
`@intecion/ipal-kit/admin#CookieCrawlAlert` (the dashboard reminder now uses it even without `crawl`); commit
`importMap.js`.
2. Postgres/SQLite: `pnpm payload migrate:create` → `migrate` — the `cookie-review` collection gets `change` (an
enum column with an index) and `needs_description` (boolean). Only new columns; nothing is dropped or renamed.
MongoDB: nothing.
3. Tell editors: after a scan, open **Approve cookies** (from the scan box on Privacy → Cookie review, or the
dashboard), tick and **Approve and add**. Fill in the cookies
marked **Needs description**. **Check:** run a scan → the new cookies appear on `/admin/cookie-approval`; approve
one → it is in Cookie banner → Cookies in every language.
4. Keep the old review instead: `cookieScanner: { approval: false }`.
- Projects without `cookieScanner`: nothing.
## 1.14.2
### Fixed
- **2FA setup loop.** A user without TOTP (every new admin) was sent to `/admin/setup-totp?back=null`, and that page
redirected to itself forever. `@clocklimited/payload-2fa`'s admin provider reads the path from an `x-pathname`
request header, which nothing sets on `/admin` (the `createProxy` matcher skips it). ipal-kit now swaps in its own
provider, `TotpRedirectProvider` (`@intecion/ipal-kit/admin`): it reads the path in the browser, never redirects
away from the setup or verify screen or from logout, and renders nothing while a redirect is pending.
### New
- **`twoFactor.provider`** — your own redirect component (path or `{ path, clientProps, serverProps }`), or `false`
to keep the package's (then set `x-pathname` on `/admin` yourself). **`totpRedirectTarget` / `totpAdminPath`** —
the redirect rules as a pure function, for your own provider.
### Known issue
- `pnpm audit --prod` reports one **low** advisory: `deepmerge` 4.2.0–4.3.1, prototype poisoning in `mergeObject()`
(GHSA-gcqx-w48m-w2h4), reached through `payload` (`@clocklimited/payload-2fa` → `payload` → `deepmerge`). No patched
version exists yet; nothing to do in projects until Payload or `deepmerge` ships a fix.
### What projects must update
- **Projects with 2FA on:** `pnpm payload generate:importmap` (adds `@intecion/ipal-kit/admin#TotpRedirectProvider`),
commit `importMap.js`, `rm -rf .next`, redeploy on Coolify. **Check:** a new admin lands on
`/admin/setup-totp?back=%2Fadmin` and sees the QR code. Remove an own `x-pathname` rule on `/admin` if one was added
as a workaround.
- Projects without 2FA (`twoFactor: false`): nothing.
## 1.14.1
Response-header hardening from the intecion.com audit: hide `X-Powered-By`, and a Content-Security-Policy the project
can roll out safely (report-only first, with reports). Everything is opt-in; nothing changes until the project uses it.
### New
- **`withSecurityConfig(nextConfig, { hidePoweredBy })`** — hides `X-Powered-By` (Next's `Next.js` and the
`Next.js, Payload` that `withPayload` adds) by setting `poweredByHeader: false` and dropping the header from
`headers()` rules. Works on either side of `withPayload`. Opt out: `hidePoweredBy: false`.
- **`buildSecurityHeaders({ csp })`** — off by default (`csp: false`). Pass `buildCsp` args to add the policy:
`mode: 'report-only'` (`Content-Security-Policy-Report-Only`) or `'enforce'`; with `reportUri` the policy gets
`report-uri` / `report-to` and the `Reporting-Endpoints` header is added (`reportGroup`, default
`csp-endpoint`). A hand-written policy in `additional` still wins.
- **`createCspReportRoute()`** — a POST route for violation reports (both the legacy `application/csp-report` and the
Reporting API format), logged as one `[csp]` line each (`onReport` to send them elsewhere, `maxBytes`); `parseCspReports` for your own handler.
- **`buildAdminCspHeaders` / `buildAdminCsp`** — a policy for `/admin/:path*` that fits Payload's admin, with the same
`mode` / `reportUri` / `extra` / `override`.
- **Nonces (opt-in)** — `createProxy(config, { csp })` creates a per-request nonce, puts the policy on the request (Next
adds the nonce to its own scripts) and the response, and exposes it as the `x-nonce` request header;
`<SiteProviders nonce>` passes it to the theme script and the analytics tags (`ThemeScript`, `Analytics`,
`ConsentScript` take `nonce`). `strictDynamic` (default on with a nonce). Nonces need dynamic rendering, so they are
only for sites that render per request; static and ISR sites keep the header-only CSP. `createCspNonce`,
`CSP_NONCE_HEADER`.
- **`buildCsp` flags** — `metaPixel`, `linkedIn`, `tiktok`, `clarity` next to `analytics`, `turnstile`, `youtube`,
`googleMaps`, `r2Url`; `dev` (adds `'unsafe-eval'`, default `NODE_ENV === 'development'`); `extra` adds sources
to any directive; `override` replaces a directive (`null` drops it). `buildCspHeaders`, `buildReportingEndpoints`,
`cspHeaderKey`, types `CspDirective`, `CspSources`, `CspViolation`.
- **ipal-audit** — checks the response headers: `X-Powered-By` anywhere → ERROR; no CSP on the site or `/admin` →
WARNING; report-only for weeks with clean reports → WARNING (switch to enforce).
### Changed
- `buildCsp` allowlists are slightly wider (nothing that was allowed is now blocked): `analytics` also allows the
Google Signals hosts (`https://*.g.doubleclick.net`, `https://www.google.com`) in `connect-src` and `img-src`;
`r2Url` is also added to `media-src`; in development `'unsafe-eval'` is added (`dev: false` to turn it off).
The order of the directives in the header changed (cosmetic).
- `buildSecurityHeaders({})` output is unchanged.
### Documentation
- security.md rewritten: X-Powered-By, CSP roll-out (report-only → enforce), report route, admin policy, nonces vs
static pages. AGENT.md, ipal-setup, ipal-reference, ipal-audit, ipal-upgrade.
### What projects must update
Nothing is required. Recommended, in this order (ipal-upgrade → 1.14.1, security.md):
1. **Hide `X-Powered-By`:** `export default withPayload(withSecurityConfig(nextConfig))`; remove a hand-written
`poweredByHeader: false`. **Check:** `curl -sI <site>/pl | grep -i x-powered-by` → nothing (also `/admin`).
2. **CSP report-only:** `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', r2Url:
process.env.R2_PUBLIC_URL, …flags for what the site loads } })`, the admin rule
`{ source: '/admin/:path*', headers: buildAdminCspHeaders({ mode: 'report-only', reportUri: '/api/csp-report' }) }`
and `src/app/api/csp-report/route.ts` → `export const POST = createCspReportRoute()`. Deploy and read the `[csp]`
lines in the Coolify logs.
3. **Enforce:** after a few days of clean reports, `mode: 'enforce'` in both places; redeploy and check the pages.
4. Projects that already call `buildCsp({ analytics })` or pass `r2Url`: the policy gets the wider allowlists above
after upgrading — review them if the policy is audited line by line.
## 1.14.0
An image lightbox, a cookie scanner with a browser pre-consent check, an admin panel in English and Polish, and
dependency security fixes. Every new feature is opt-in or overridable — AGENT.md §7.1 lists the switches.
### Image lightbox
- **One shared viewer for the site** — `<LightboxProvider>`, `<LightboxTrigger>`, `<LightboxDialog>`, `useLightbox`
(`/client`) and the pure helpers `lightboxImage(media, { size })`, `lightboxIndex`, `formatLightboxCounter`,
`resolveLightboxTexts` (root and `/client`). Galleries by `group`, keyboard and swipe, focus trap, reduced motion,
unstyled mode, `classNames` / `icons` / `renderImage` / `renderDialog`.
- `<SiteProviders lightbox>` mounts the provider for the whole site (default off). `RenderRichText lightbox` makes
image uploads in rich text click-to-enlarge (opt-in); `withLightboxUploads` (`/rsc`) for your own converters.
- `ipalKit({ lightbox: true })` adds an **Image viewer** group to Form messages so editors translate the labels
(default off; English and Polish fallbacks without it). docs/lightbox.md.
### Cookie scanner
- **Phase 1 — declarations and lookup:** `ipalKit({ cookieScanner: true })` adds the **Cookie review** collection
(Privacy group) and a **Scan cookies** box above its list (`GET`/`POST /api/ipal/cookie-scan`, editors and up by
default — `cookieScanner.access`). A scan lists the cookies of the integrations the project switches on, your own
`declarations` and names looked up in the bundled Open Cookie Database (Apache-2.0, loaded only when a scan runs),
as drafts. An editor accepts (→ Cookie banner → Cookie list), edits or rejects; a rescan never overwrites edited
text, never deletes and never publishes by itself. Overrides: `collectionOverrides`, `integrations`, `labels`,
`database`, `databaseCategories`, `syncAccepted`.
- **Phase 2 — "Check site":** `cookieScanner: { crawl: true }` sends a real browser through the shared
`services/cookie-crawler` service (one Coolify deployment for all sites). It visits the site before consent and
reports cookies and tracker requests set without consent as **violations**: drafts in Cookie review, the latest
result in the `cookie-crawl` global, a dashboard warning (`CookieCrawlAlert`, `crawl.dashboard: false` to hide) and
an e-mail. Site env: `IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN` (`ipalEnvRules({ cookieCrawl: true })`);
service env: `IPAL_CRAWLER_SITES`. docs/cookie-scanner.md.
- Building blocks are exported (`runCookieScan`, `lookupCookie`, `findCrawlViolations`, `parseCrawlResult`, …).
### Admin panel in English and Polish
- **The admin speaks English and Polish by default** when the project sets no `i18n.supportedLanguages`; a project's
own list always wins. Plugin texts live under the `ipal` namespace and the project's `i18n.translations` win key
by key. New exports: `applyAdminI18n`, `ipalT`, `adminTexts`, `defineTexts`, `formatNumber`, `formatDateTime`,
`adminDocumentTitle`, `<DocumentTitle>` (`/admin`).
- **All wording rewritten** (docs/dev/admin-ux.md): plain names (Site settings, Site integrations, Cookie banner,
Form messages, Search engines, Maintenance), descriptions that say what a field does, labels as `{ en, pl }`.
- **Regrouped, same data:** a **Privacy** group (Cookie banner, Consent records, Cookie review), Forms under one group,
the `roles` field and Cookie banner → Consent version in the sidebar. No slugs, field names or columns changed
(Postgres `migrate:create` reports no schema changes).
- **Frontend texts:** validator messages are full sentences (`VALIDATION_MESSAGES`, `validationMessages(locale)`,
`localizedRules(locale)`), and `pl` locales get Polish fallbacks for consent, form messages and the lightbox
(`CONSENT_FALLBACK_PL`, `NOTIFICATION_FALLBACK_PL`, `LIGHTBOX_FALLBACK_PL`, `consentFallback`, …).
### Admin follow-ups
- The statistics tab title follows the admin language; the cookie scanner's integration names are Polish in a Polish
admin; the maintenance notice's close button has a screen-reader label in the page language.
- **Favicon warning:** `FaviconCheck` (`/admin`) shows under Site settings → Site icon when the image is under 48×48 px
or not square; saving is never blocked. `faviconProblems`, `FAVICON_MIN_SIZE` for your own checks.
### Dependencies and security
- **Next.js:** dev dependencies on `next` and `eslint-config-next` 16.4.3 and `sharp` 0.35.5. The docs set **16.4.1 as
the minimum safe Next**. The peer range stays `next >=15`.
- **nodemailer 10** (was 8; ships its own types, `@types/nodemailer` dropped). **Node.js 20.9 or later**
(`engines.node: ">=20.9.0"`; Payload 3 already needs it).
- `pnpm audit --prod` on the plugin: no known vulnerabilities. Repo-only `pnpm.overrides` fix Payload's pinned
transitive dependencies; projects are not bound by them (see "What projects must update").
### Tests and dev
- Tests boot Payload through `buildTestConfig` (`typescript.autoGenerate: false`), and a guard test fails on a raw
`buildConfig`. The dev app no longer spawns `payload generate:types` on every start. Both left orphan processes.
### What projects must update
1. `pnpm payload generate:importmap` — `FaviconCheck` and the `RowLabel` components are injected into every project.
Missing entries leave the Site settings screen or array rows broken. Then `pnpm ipal:skills`, `rm -rf .next`.
2. **Node.js 20.9 or later** — check the Coolify build image, `.nvmrc` and `engines`. Remove `nodemailer` /
`@types/nodemailer` from the project's own `package.json` if someone added them.
3. **Next.js 16.4.1 or later** (16.4.3 recommended) with **sharp 0.35.5 or later**:
`pnpm add next@^16.4.3 eslint-config-next@^16.4.3 sharp@^0.35.5`. Next 16.0.0–16.4.0 is affected by
GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr and GHSA-p3m5-59mp-jv5r (two unauthenticated remote code executions and a
Server Actions denial of service).
4. `pnpm audit --prod`. With `payload` 3.90.x add the recommended overrides to the project's `pnpm.overrides`:
`"dompurify@<3.4.17": "^3.4.17"`, `"undici@>=7 <7.30.1": "^7.30.1"`, then `pnpm install` and audit again
(AGENT.md §4 item 12).
5. **Postgres/SQLite:** `pnpm payload migrate:create` → `migrate` when turning on `cookieScanner` (the `cookie-review`
collection), `cookieScanner.crawl` (the `cookie-crawl` global) or `lightbox: true` (Form messages → Image viewer).
For the crawl set `IPAL_COOKIE_SCAN_URL` and `IPAL_COOKIE_SCAN_TOKEN` and add the site to the service's
`IPAL_CRAWLER_SITES`. Without these options there is no schema change. MongoDB: nothing.
6. **Admin languages:** the admin now offers English and Polish when the project sets no `i18n.supportedLanguages`.
To keep English only: `i18n: { supportedLanguages: { en } }` in the Payload config.
7. **Frontend texts:** default validator messages are now full sentences ("Fill in this field." instead of
"required"), and `pl` locales get Polish fallback texts where the panel fields are empty. Tests or code that
compare these strings need updating; pass your own message to a rule to keep it.
8. **Sidebar moves:** the `roles` field (users) and Cookie banner → Consent version now sit in the admin sidebar.
Data is unchanged; update screenshots and editor instructions.
## 1.13.0
Security and performance fixes from an audit, SEO/GEO and Search Console features, a seed helper, and English docs.
+2
View File
@@ -24,6 +24,7 @@ API details — one file per module:
| GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok, `defer` | [analytics.md](./analytics.md) |
| Blocks, RenderBlocks, enhanceProps | [blocks.md](./blocks.md) |
| Cookie consent, banner, settings window (in the bar / modal / large with cookie details) | [consent.md](./consent.md) |
| Cookie scanner: review list of drafts, "Scan cookies", Open Cookie Database lookup (optional) | [cookie-scanner.md](./cookie-scanner.md) |
| Under construction — locks subpages behind a popup (developer tool) | [construction.md](./construction.md) |
| Routing, archives, redirects, Markdown, search | [content.md](./content.md) |
| Site frontend: `createContentHelpers` (`@/lib/content`), `createPageRoute`, `SiteProviders` | [frontend.md](./frontend.md) |
@@ -38,6 +39,7 @@ API details — one file per module:
| Integrations (`site-integrations` global, statuses, test email) | [integrations.md](./integrations.md) |
| Links / CTA: buildLinkField, buildLinksField, resolveLinkHref, rowLabel | [links.md](./links.md) |
| Media: collection, file names, optimization, placeholders, `mediaImageProps` | [media.md](./media.md) |
| Image lightbox: enlarge a thumbnail, galleries, rich text images | [lightbox.md](./lightbox.md) |
| Site MCP server | [mcp.md](./mcp.md) |
| Form messages | [notifications.md](./notifications.md) |
| System pages, 404, generateStaticParams | [pages.md](./pages.md) |
+3 -3
View File
@@ -41,8 +41,8 @@ only checks that someone is logged in.
| Resource | Read | Write | How to change |
|---|---|---|---|
| auth collection **injected** by the plugin, with roles | admin: everyone; others: only themselves | `create` / `delete` / `unlock`: admin; `update`: admin or self | `access.authAccess`, or your own collection |
| Site Settings, Cookie Settings, Notifications | public | `editor+` | `globalOverrides` |
| Site Integrations | admin | admin | `globalOverrides` |
| Site settings, Cookie banner, Notifications | public | `editor+` | `globalOverrides` |
| Site integrations | admin | admin | `globalOverrides` |
| Forms | public (Emails tab only `editor+`) | `editor+` | `forms.formOverrides.access`, the Emails field in `formOverrides.fields` |
| Form submissions | `editor+` | REST `create`: logged-in users; `delete`: admin | `forms.formSubmissionOverrides.access` |
@@ -66,7 +66,7 @@ keeps Payload's default rules — without roles all accounts are equal.
> **Without `access` there is no `roles` field**, so `isAdmin` always returns `false`. The plugin's own
> staff features therefore check with `userMeetsRole(req, minimum)`: when the user's auth collection has no
> `roles` field, every logged-in account passes (as in Payload's default — without roles all accounts are
> equal). That keeps Site Integrations, the settings globals, `/api/ipal/test-email`, stats, consent records
> equal). That keeps Site integrations, the settings globals, `/api/ipal/test-email`, stats, consent records
> and form submissions reachable. To narrow them without roles: `globalOverrides` for the globals,
> `forms.formSubmissionOverrides` for submissions, or add `access` to get roles.
+2
View File
@@ -166,6 +166,8 @@ The provider re-applies and syncs on the client anyway. This only removes the fl
### State and attributes (`A11yState`)
Cookie `a11y-prefs` (`A11Y_COOKIE`, JSON, `path=/`, `max-age` 1 year, `samesite=lax`).
Widget texts: `texts` prop wins, otherwise `A11Y_DEFAULT_TEXTS[locale]` (`en`, `pl`; prop `locale`,
incl. `texts.on` / `texts.off` for the switches).
The helpers `A11Y_COOKIE`, `A11Y_DEFAULT`, `parseA11y`, `serializeA11y`, `a11yAttributes`
are in `@intecion/ipal-kit` (not in `/client`). The `A11yState` type is in both entries.
+102 -38
View File
@@ -62,7 +62,8 @@ Write new rules, AGENTS.md entries and plugin-gap reports in English.
6. **A section = a composition of UI primitives.** `buildLinksField()` + `<CMSLink>`, upload +
`<Media>`, `<Section>` + `<SectionHeader>`. No `ctaLabel`/`pdfUrl` fields.
**A clear panel** (§6.5a): repeated items = an "+ Add …" array with `rowLabel`, never
`cta1`/`cta2`; labels in English, short; no empty "just in case" fields.
`cta1`/`cta2`; labels short and in the panel's languages (`{ en, pl }`, guide
`docs/dev/admin-ux.md`); no empty "just in case" fields.
7. **Renderers from the plugin:** `RenderBlocks` (not a `switch`), `RenderRichText` (not
your own Lexical parser), `useForm` (not hand-made form plumbing).
8. **No `any` and no `@ts-ignore`.** Types from `@/payload-types`, `unknown` + guard.
@@ -96,21 +97,21 @@ site), **P** = a test in the panel. Full code: PROGRAMISTA.md §2.
| # | Area | What must exist (file) | Plugin API | Check |
|---|---|---|---|---|
| 1 | i18n + routing | `src/proxy.ts`, `[locale]/[[...slug]]/page.tsx` = `createPageRoute(content, {…})` + a literal `revalidate`, `not-found.tsx` = `createNotFoundPage(content, { load })` + `notFoundView.ts` (`renderNotFoundView`) | `createProxy`, `createContentHelpers`, `createPageRoute`, `createNotFoundPage` (`/rsc`) | A, S |
| 2 | **SEO** — meta | `generateMetadata` in every page route; favicon and OG from Site Settings; `htmlLimitedBots` in `next.config.ts`; SEO tab + `buildNoindexField` in Pages | `generatePageMetadata`, `buildIconsMetadata`, `buildNoindexField` | A, S |
| 2 | **SEO** — meta | `generateMetadata` in every page route; favicon and OG from Site settings; `htmlLimitedBots` in `next.config.ts`; SEO tab + `buildNoindexField` in Pages | `generatePageMetadata`, `buildIconsMetadata`, `buildNoindexField` | A, S |
| 3 | **SEO** — maps | `src/app/sitemap.xml/route.ts` (`export { sitemapRoute as GET }` + `force-dynamic`), `src/app/robots.ts` (`export { getRobots as default }` + `force-dynamic` — AI bots from the panel), `src/app/manifest.ts` — re-exports from `lib/content` | `sitemapRoute`, `getRobots` (or `robots` without the panel), `manifest` | A, S |
| 3a | **Search Console / Bing** | recommended: **domain verification via DNS** (TXT record, deployment.md §6) — the plugin does nothing, the verification fields stay empty; only for URL-prefix verification: code in **Site Settings → Search & AI** (Google, Bing, Yandex), `generatePageMetadata` adds the `<meta>` itself; sitemap `https://<domain>/sitemap.xml` submitted in GSC and Bing | panel (optional), `verificationFrom` | P |
| 4 | **SEO** — structured data | layout: `<SiteProviders shell={…}>` gives `WebSite` + `Organization` (`sameAs`) from Site Settings; local business → `createContentHelpers({ siteJsonLd })` with `buildLocalBusinessJsonLd` (`type`, hours → `formatOpeningHours`); navigation: `<SiteProviders jsonLd={[buildNavigationJsonLd(…)]}>`; page: `createPageRoute` adds `getPageJsonLd` (WebPage/BlogPosting, breadcrumbs, FAQ — `pageJsonLd: { faq }`) | `getSiteShell`, `SiteProviders`, `build*JsonLd`, `getPageJsonLd` | A, S |
| 3a | **Search Console / Bing** | recommended: **domain verification via DNS** (TXT record, deployment.md §6) — the plugin does nothing, the verification fields stay empty; only for URL-prefix verification: code in **Site settings → Search engines** (Google, Bing, Yandex), `generatePageMetadata` adds the `<meta>` itself; sitemap `https://<domain>/sitemap.xml` submitted in GSC and Bing | panel (optional), `verificationFrom` | P |
| 4 | **SEO** — structured data | layout: `<SiteProviders shell={…}>` gives `WebSite` + `Organization` (`sameAs`) from Site settings; local business → `createContentHelpers({ siteJsonLd })` with `buildLocalBusinessJsonLd` (`type`, hours → `formatOpeningHours`); navigation: `<SiteProviders jsonLd={[buildNavigationJsonLd(…)]}>`; page: `createPageRoute` adds `getPageJsonLd` (WebPage/BlogPosting, breadcrumbs, FAQ — `pageJsonLd: { faq }`) | `getSiteShell`, `SiteProviders`, `build*JsonLd`, `getPageJsonLd` | A, S |
| 5 | **GEO** — llms | `src/app/llms.txt/route.ts` (`llmsRoute`) and `src/app/llms-full.txt/route.ts` (`llmsFullRoute`) from `lib/content`; the `buildSummaryField()` field in Pages, `summaryField: 'aiSummary'` in `createContentHelpers` | `llmsRoute`, `llmsFullRoute`, `buildSummaryField` | A, S |
| 6 | **GEO** — Markdown | `src/app/md/[locale]/[[...slug]]/route.ts` (single-language: `src/app/md/[[...slug]]/route.ts`) = `export { markdownRoute as GET } from '@/lib/content'`; `createContentHelpers({ markdownAlternate: true })` (link in `<head>`); `createProxy(…, { NextResponse, markdown: true })` (without it `/md/…` gets redirected to a language) | `markdownRoute`, `markdownAlternate`, `createProxy({ markdown })` | A, S |
| 7 | **GEO** — MCP | `src/app/api/mcp/route.ts` = `export { mcpGET as GET, mcpPOST as POST } from '@/lib/content'` (public — AI browses the site: `get_site_info`, `list_pages`, `search_content`, `get_page`); name: `createContentHelpers({ mcp: { serverName } })` | `mcpGET`, `mcpPOST` | A, S |
| 8 | **GEO** — AI bots + IndexNow | robots **lets in** AI bots (default `aiBots: 'allow'`; block only on a client decision); AI bot policy and per-bot exceptions — Site Settings → Search & AI → AI crawlers (works only with `getRobots`); `ipalKit({ indexNow: true })` + `src/app/indexnow-key.txt/route.ts` (`indexNowKeyRoute`; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with `IPAL_NOINDEX=1`) | `buildRobots`, `getRobots`, `indexNowKeyRoute` | A, S |
| 8 | **GEO** — AI bots + IndexNow | robots **lets in** AI bots (default `aiBots: 'allow'`; block only on a client decision); AI bot policy and per-bot exceptions — Site settings → Search engines → AI assistants (works only with `getRobots`); `ipalKit({ indexNow: true })` + `src/app/indexnow-key.txt/route.ts` (`indexNowKeyRoute`; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with `IPAL_NOINDEX=1`) | `buildRobots`, `getRobots`, `indexNowKeyRoute` | A, S |
| 9 | **Media / R2 / speed** | `Media` with `focalPoint`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` + field; **always** `buildR2Storage(['media'], { s3Storage })` + `@payloadcms/storage-s3`; `R2_*` in `.env.example`; `<MediaPreconnect/>`; `images: buildImagesConfig()` and `buildUploadSecurityHeaders()` in `next.config.ts`; the project's `<Media>` via `mediaImageProps`/`videoProps` (§6.11b) | `buildR2Storage`, `mediaImageProps`, `videoProps`, `buildImagesConfig` | A, S |
| 10 | **Forms** | every form from a **seed** (`scripts/seed-form-*.ts`: fields, confirmation, mail to the company **and** confirmation to the customer, every language); a block with `<RenderForm>` + `formClasses.ts` (look, once); `actions.ts` = `createSubmitAction({ getCachedPayload, headers })`; `forms: {…}` in `ipalKit`; `email: mailAdapter()` | `RenderForm` (`/rsc`), `createSubmitAction`, `mailAdapter` | A, P |
| 11 | **Turnstile** | `<SiteProviders>` in `[locale]/layout.tsx` (wires `TurnstileProvider` with the key from the panel); `RenderForm` renders the widget; keys in Site Integrations | `SiteProviders`, `getTurnstileConfig`, `TurnstileProvider` | A, P |
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; `ipalKit({ consentLog: true })` (without it the `/api/ipal/consent` endpoint does not exist) + `<SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}>` (ConsentProvider, banner, CookieButton, Analytics in the right order); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookie Settings → Detail labels in every language | consent.md, analytics.md | A, `ipal-consent-check` |
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `twoFactor: { issuer, plugin: payloadTotp }`; CSP `report-only` → `enforce`; `IPAL_IP_HEADER` in production | security.md, forms.md | A |
| 11 | **Turnstile** | `<SiteProviders>` in `[locale]/layout.tsx` (wires `TurnstileProvider` with the key from the panel); `RenderForm` renders the widget; keys in Site integrations | `SiteProviders`, `getTurnstileConfig`, `TurnstileProvider` | A, P |
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; `ipalKit({ consentLog: true })` (without it the `/api/ipal/consent` endpoint does not exist) + `<SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}>` (ConsentProvider, banner, CookieButton, Analytics in the right order); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (`cookieScanner: true` → *Cookie review* → **Scan cookies** → *Approve cookies* → **Approve and add**; or cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookies → Settings window → Cookie list headings in every language | consent.md, analytics.md | A, `ipal-consent-check` |
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `withPayload(withSecurityConfig(nextConfig))` (no `X-Powered-By`); CSP: `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } })` + `buildAdminCspHeaders` on `/admin/:path*` + `src/app/api/csp-report/route.ts` (`createCspReportRoute`) → read the reports → `mode: 'enforce'`; `twoFactor: { issuer, plugin: payloadTotp }` + `generate:importmap` (`TotpRedirectProvider`; check: a new admin lands on `/admin/setup-totp?back=%2Fadmin` with the QR, no reloading); `IPAL_IP_HEADER` in production | security.md, forms.md | A |
| 14 | Operations | `src/app/api/health/route.ts` (`healthRoute`); `src/instrumentation.ts` with `assertEnv(ipalEnvRules({ storage: true, ipHeader: true }))`; staging with `IPAL_NOINDEX=1`; smoke tests (§8a) | `healthRoute`, `assertEnv`, `ipalEnvRules` | A |
| 15 | System pages | Site Settings → System Pages: homepage, 404, privacy policy, cookies; legal links in the footer by role (`getSystemLinks(locale)`) | `getSystemLinks`, `getSystemPagePath`, `getNotFoundPage` | P |
| 15 | System pages | Site settings → System pages: homepage, 404, privacy policy, cookies; legal links in the footer by role (`getSystemLinks(locale)`) | `getSystemLinks`, `getSystemPagePath`, `getNotFoundPage` | P |
| 16 | **Nothing hardcoded** | every text, link, image, file, company data from the panel; domains and keys from `.env` (§2) | — | A, P |
| 17 | **Content** | one h1, the answer at the start of each section, facts, internal links, FAQ from real questions, `aiSummary`, sameAs, consistent company data (§0c) | — | S, P |
| 18 | **Scaling** | `fluid.css` / `fluid-wide.css`, hero on `--ipal-hero-min-h`, the screen list in §6.11a (including 1366×768) | — | A, browser |
@@ -132,9 +133,9 @@ Do not make the provider or the widget conditional in code — always wire them.
| reCAPTCHA, hCaptcha, your own captcha | a second mechanism, no status in the panel | Turnstile from the plugin |
| a hand-written `<script type="application/ld+json">` | no escaping, drifts from the panel | `JsonLdGraph` |
| your own `sitemap.ts` / a text `robots.txt` in `public/` | no hreflang, noindex or system pages | `sitemapRoute`, `getRobots` from `lib/content` |
| a verification `<meta>` / `google*.html` file in code or `public/` | a deploy for every change; the code belongs to the client | DNS verification, or the code in Site Settings → Search & AI |
| a verification `<meta>` / `google*.html` file in code or `public/` | a deploy for every change; the code belongs to the client | DNS verification, or the code in Site settings → Search engines |
| your own `llms.txt` in `public/` | static, goes stale | `llmsRoute` / `llmsFullRoute` from `lib/content` |
| your own link function (`resolveHref`, `getHref`…): the homepage slug in code (`=== 'home'`), `` `/${slug}` `` | no language prefix, the homepage depends on Site Settings, `javascript:` from the panel in `href`, a dead link leads to `/` | `resolveLink(link, locale)` / `resolveNav` from `lib/content` (field: `buildLinkField`) |
| your own link function (`resolveHref`, `getHref`…): the homepage slug in code (`=== 'home'`), `` `/${slug}` `` | no language prefix, the homepage depends on Site settings, `javascript:` from the panel in `href`, a dead link leads to `/` | `resolveLink(link, locale)` / `resolveNav` from `lib/content` (field: `buildLinkField`) |
| `page` + `url` + `label` fields in globals, `prefooterButtonUrl`, `ctaLabel`; style based on content (`label === 'Tesla'`); legal link labels in code | the editor cannot choose a file / new tab / style; renaming breaks the look; Polish text in the English version | `buildLinkField` / `buildLinksField` with `appearances`, `resolveNav`, `getSystemLinks` |
| `@aws-sdk/client-s3` / your own upload to the bucket | bypasses the media hooks and the URL from `R2_PUBLIC_URL` | `buildR2Storage` |
@@ -145,7 +146,7 @@ In the project's `AGENTS.md`, under "Project decisions", one line with the item
ipal-audit-skip: mcp, llms-full — the client does not want to share content with AI agents (email 2026-03-02)
```
Keys: `llms`, `llms-full`, `markdown`, `mcp`, `jsonld`, `r2`, `turnstile`,
`analytics`, `twofactor`, `aibots`, `forms-seed` (`audit.sh` understands only these). Without this line a missing item is an error.
`analytics`, `twofactor`, `aibots`, `forms-seed`, `csp` (`audit.sh` understands only these). Without this line a missing item is an error.
---
@@ -176,13 +177,13 @@ the panel (seed, phase 6 in ipal-site), apply the rules below — without invent
- An **About us** page with people, experience, certificates (from the brief); posts with an author and a date.
- **The same company data everywhere** (name, address, phone): footer, contact, JSON-LD
(`LocalBusiness`/`Organization`), Google Business Profile. One Company global as the source.
- **Site Settings → sameAs:** the company's profiles (Google Business Profile, LinkedIn, Facebook…).
- **Site Settings → site description** (2–3 sentences: who, what, where) — feeds llms.txt, MCP and meta.
- **Site settings → sameAs:** the company's profiles (Google Business Profile, LinkedIn, Facebook…).
- **Site settings → site description** (2–3 sentences: who, what, where) — feeds llms.txt, MCP and meta.
- **`aiSummary`** of important pages: fix the auto-fill when the summary is weak (1–3 sentences, facts).
### Meta in the SEO tab
Title ≤ 60 characters, unique, key phrase first; description ≤ 155 characters, with specifics and a call to action;
a share image (1200×630) on pages with an offer — the rest inherit the default from Site Settings.
a share image (1200×630) on pages with an offer — the rest inherit the default from Site settings.
A description **unique on every page** — an empty one is filled from the content on save, but a hand-written
one is better. Google ignores the same description on many pages.
@@ -410,6 +411,25 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
9. **RSC by default.** `'use client'` only for state/interaction, in a separate file;
the section stays a server component and passes data to it. Secrets: `import 'server-only'`.
10. **Blocks do not import `lib/*`** (cycle). Server-side data → `enhanceProps`.
11. **Next.js 16.4.1 or later** (minimum safe version). 16.0.0–16.4.0 have unauthenticated RCE and DoS
advisories (GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr, GHSA-p3m5-59mp-jv5r); Payload supports no patched
15.x line. Pin `next` and `eslint-config-next` to the same 16.4.x (≥ 16.4.1) and make sure `sharp` resolves to
0.35.5 or later (`pnpm why sharp`). The plugin's peer range stays open (`next >=15`) — the minimum is yours to keep.
**Check:** `pnpm ls next sharp` → next ≥ 16.4.1, sharp ≥ 0.35.5; `pnpm dev` prints no security-upgrade warning.
12. **No open production advisories.** Node.js 20 or later (the plugin's `nodemailer` 10 requires it). Run
`pnpm audit --prod`. The plugin's own dependencies are clean; what remains comes from Payload's tree, which only
the project's lockfile can fix. With `payload` 3.90.x two packages are pinned exactly and need `pnpm.overrides`
next to the `@payloadcms/*` ones:
```json
"dompurify@<3.4.17": "^3.4.17",
"undici@>=7 <7.30.1": "^7.30.1"
```
`undici` comes from `payload` (3.92.1 and later already ship 7.30.1), `dompurify` from the admin code editor
(`@payloadcms/ui` → `monaco-editor`, which pins 3.2.7). Everything else in the report (`fast-uri`, `js-yaml`,
`browserslist`, `source-map-js`, `fast-copy`, `baseline-browser-mapping`) is a range: `pnpm update` or a fresh
lockfile picks up the fix; add an override like the ones above only if it does not. These are recommendations —
the plugin forces none of them. Never add a project dependency on `nodemailer` or `@types/nodemailer`.
**Check:** `pnpm audit --prod` → no high or critical; `pnpm why undici dompurify` → only the fixed versions.
---
@@ -428,7 +448,7 @@ the editor composes pages from them. A new page = no code.
### 5.3 MINIMUM collections
By default: `pages`, `media` + the plugin's globals (`site-settings`,
`site-integrations`, Notifications, Cookie Settings) + the project's globals
`site-integrations`, Notifications, Cookie banner) + the project's globals
(navigation, footer, company). Nothing more until the client explicitly requires it.
**`users`** is added by `ipalKit` (an auth collection with `roles` and 2FA) — do not create it, unless
@@ -460,7 +480,7 @@ Every content collection: `title`, `buildSlugField`, SEO tab, `buildNoindexField
`trackSlugHistoryHook`, structured data if relevant (seo.md). Details: content.md.
### 5.5 System pages
Site Settings → System Pages: `homepage`, `notFound` (404), `privacyPolicy`,
Site settings → System pages: `homepage`, `notFound` (404), `privacyPolicy`,
`cookiePolicy`, `termsOfService`. Link by role (`getSystemPagePath`),
never by slug. pages.md.
@@ -480,7 +500,7 @@ Three problems that must never repeat: **a zoo of CTA fields** (`ctaLabel`,
3. **Repeated items = an "+ Add …" array**, never numbered fields. Buttons: `buildLinksField()` →
the editor clicks "Add Button" as many times as needed (`maxRows` = as many as the design fits).
`cta1`/`cta2`/`cta3`, `feature1Title`…, `image2` = an audit error.
4. **A panel readable without knowing the code:** English labels of 1–3 words, collapsed rows with content
4. **A panel readable without knowing the code:** `{ en, pl }` labels of 1–3 words, collapsed rows with content
(`rowLabel`), ≤ 6 items visible after adding a block, technical settings in the sidebar.
5. **A variant instead of a copy:** a different look of the same section = `variant` (select), not a second block.
6. **No text, link or image in JSX** — everything from the panel, in every language.
@@ -523,7 +543,7 @@ before uploading — the hook only catches mistakes and asks for consent.
- `buildSectionSettingsField()` → the `settings` group (sidebar): `anchor`, `background`
(project backgrounds: `buildSectionSettingsField({ backgrounds: [{ label, value }] })`, extra fields: `fields`).
Every section has `buildSectionSettingsField()` — no `bgColor`, `sectionId` per block.
Field labels in English (the panel is in English).
Field labels as `{ en, pl }` objects (the panel runs in English and Polish; §6.5a).
### 6.3 Layer 2 — UI primitives
@@ -611,11 +631,28 @@ empty fields, without guessing, without numbered slots. You design the schema fo
2. **A row shows its content**: `admin: { initCollapsed: true, components: rowLabel('heading', 'Feature') }`
→ collapsed rows "Fast delivery", "24/7 support" instead of "Feature 01".
`buildLinksField` has this built in (row = button label).
3. **The panel in English, short.** `label` 1–3 words, Sentence case ("Heading",
"Background"); `admin.description` only when the label is not enough — one
sentence ≤ 80 characters: what it does / where it shows, with a format example
(`'Section id for #links, e.g. "pricing".'`), never how the code works. Select options
with a readable `label` ("Inverted (dark)"), not the raw value.
3. **The panel in the editors' languages, short — follow `docs/dev/admin-ux.md`**
(`node_modules/@intecion/ipal-kit/docs/dev/admin-ux.md`): its glossary, sentence case,
field order and tab / sidebar / collapsible rules.
- Every visible field has an explicit `label` — never Payload's auto-label from the name
(`ctaUrl` → "Cta Url"). Label 1–3 words, ≤ 30 characters.
- Texts are `{ en: '…', pl: '…' }` (one key per admin language of the project):
`label`, `admin.description`, option `label`, tab `label`, `labels.singular/plural`,
`admin.group`. Type: `AdminText` from `@intecion/ipal-kit`.
- `admin.description` only when the label is not enough — one sentence ≤ 120 characters:
what it does / where it shows, with a format example (`'Section id for #links, e.g. "pricing".'`),
never how the code works (no component, function, env-var or package names).
- Select options with a readable `label` ("Inverted (dark)"), not the raw value.
- The admin panel runs in English and Polish by default (ipal-kit sets
`i18n.supportedLanguages` when the project has not); set your own list to change it.
The plugin's own texts are overridable: field/global labels via `globalOverrides` /
`collectionOverrides`, component texts via `i18n.translations.<lang>.ipal.<key>`
(keys: `adminTexts` from `@intecion/ipal-kit`). Building blocks for your own admin
components: `ipalT`, `formatNumber`, `formatDateTime`, `defineTexts`, `ADMIN_LANGUAGES`,
`applyAdminI18n` (already applied by `ipalKit`), `adminDocumentTitle` + `<DocumentTitle>` (`/admin`;
a custom view's tab title in the admin language — Payload's `meta.title` is one fixed string),
types `AdminText`, `AdminLanguage`, `AdminTextKey` — details in i18n.md "Admin panel languages and texts".
**Check:** Polish panel → the view's browser tab reads in Polish.
4. **No "just in case" fields.** Every field is displayed by the component; an empty
optional field = the element does not render (the component handles it). Hide
dependent fields: `admin.condition` (video fields only with `mediaType: 'video'`,
@@ -699,11 +736,11 @@ Skill: **ipal-nav**.
- Navigation, footer, company data = **project globals** (`header`, `footer`, `company`),
built with `buildLinkField` — the company data model depends on the country (NIP/ABN/EIN).
- Menu: one level of submenu, no deeper. The CTA in the header = `links`.
- Logo and name from Site Settings — do not duplicate the fields in Header.
- Logo and name from Site settings — do not duplicate the fields in Header.
- **Footer content in `<NoSnippet>`** (`/rsc`, inside `<footer>`) — otherwise Google shows the address
from the footer as the description of every subpage. The same for the contact bar and a CTA repeated on
every page. Never on `<main>`. Details: seo.md → "Descriptions in Google".
- **Legal links in the footer** from the System Pages roles: `await getSystemLinks(locale)` (href + page title), not by hand and with no labels in code.
- **Legal links in the footer** from the System pages roles: `await getSystemLinks(locale)` (href + page title), not by hand and with no labels in code.
- Highlighting a menu item / a button variant = `appearance` from the panel (`buildLinkField({ appearances: [...] })`, any names), never a condition on content (`label === '…'`).
- Resolve links **on the server**: `await resolveNav(header.navItems, locale)` from `lib/content`
→ `{ href, label, internal, newTab, targetProps, children }[]` (dead links skipped); only this data
@@ -711,9 +748,9 @@ Skill: **ipal-nav**.
- a11y labels (menu button) — fields in the panel.
- A global changed on every page → `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]`
(it calls `revalidatePath('/', 'layout')`). `buildRevalidateHook` is for collections. The plugin's globals
(Site Settings, Site Integrations, Cookie Settings, Notifications) refresh ISR themselves once you pass
(Site settings, Site integrations, Cookie banner, Notifications) refresh ISR themselves once you pass
`ipalKit({ revalidatePath })` (from `next/cache`); without it the change shows after the `revalidate` window.
- The plugin's globals: read public (Site Integrations: admin only), write editor+. Change their access, admin
- The plugin's globals: read public (Site integrations: admin only), write editor+. Change their access, admin
or hooks with `ipalKit({ globalOverrides: { notifications: { access: { update: authenticated } } } })` —
an object merges key by key (your keys win), a function `(global) => global` takes over. Never copy a plugin global.
- Only `[locale]/layout.tsx` fetches globals and passes them as props.
@@ -739,6 +776,11 @@ Skill: **ipal-nav**.
`server-only`, secrets. Types are allowed (`import type`).
6. Plugin hooks from `@intecion/ipal-kit/client` (`useForm`, `useConsentContext`…).
7. a11y labels (`aria-label`, "Close", "Next slide") — from the panel, via props.
8. **An enlarged image is never a hand-made modal** (no `useState(index)` + `div role="dialog"`,
`glightbox`, `photoswipe`, a link to the raw file in a new tab) — `<LightboxTrigger>` around the
thumbnail (a client component you render from a server block with plain `lightboxImage(…)` data),
one `<SiteProviders lightbox>`, labels from Form messages → Image viewer (lightbox.md). `ipal-audit`
warns about lightbox libraries and hand-made image dialogs.
### 6.10 Icons
@@ -870,7 +912,7 @@ project → **plugin gap**, not a copy.
| Unusual form markup | `BuilderForm renderField` / `useBuilderForm` (`/client`) | forms.md |
| A field filled in by the page (product variant, category) | `RenderForm values` / `prepareBuilderForm` + `BuilderForm values` | forms.md |
| Sending | `createSubmitAction({ getCachedPayload, headers })` (`/server`) | forms.md |
| Message texts and step button texts | Notifications → `getFormTexts(locale)` | notifications.md |
| Message texts and step button texts | Form messages → `getFormTexts(locale)` | notifications.md |
| A form in the database | seed `ipal-form/resources/seed-form.template.ts` | forms.md, seeding.md |
| Antispam / limit / IP | honeypot in `BuilderForm`, Turnstile from `SiteProviders` (`createSubmitAction({ turnstileHostnames })` pins the domain), `clientIp`, `setRateLimitStore`, `setUnknownIpFactor` | forms.md, turnstile.md |
| GTM event after sending | `buildFormAnalyticsFields` (panel) — `RenderForm` sends it itself | forms.md |
@@ -881,7 +923,7 @@ project → **plugin gap**, not a copy.
|---|---|---|
| Metadata, canonical, hreflang, OG, X | `generatePageMetadata` (`createPageRoute` does it itself) | seo.md |
| sitemap / robots / manifest | `sitemapRoute` (splits into a sitemap index above 10 000 URLs; `sitemapOptions`, `sitemapEntries`), `getRobots` (panel) / `robots` (code only), `manifest` | seo.md |
| Search Console / Bing verification, AI crawler policy, llms.txt note | Site Settings → Search & AI (`searchSettings`); building blocks `verificationFrom`, `robotsOptionsFrom` | seo.md |
| Search Console / Bing verification, AI crawler policy, llms.txt note | Site settings → Search engines (`searchSettings`); building blocks `verificationFrom`, `robotsOptionsFrom` | seo.md |
| JSON-LD | `getSiteShell().jsonLd`, `getPageJsonLd`, `build*JsonLd`, `formatOpeningHours`, `sameAsUrls`, `<JsonLdGraph>` | seo.md |
| Product / category JSON-LD (an entry that is not an article) | `pageJsonLd.entries` + `buildProductJsonLd` | seo.md |
| llms.txt / llms-full / Markdown / MCP | `llmsRoute`, `llmsFullRoute`, `markdownRoute`, `mcpGET`/`mcpPOST`; `markdownAlternate: true`; `createProxy({ markdown: true })` | seo.md, content.md, mcp.md |
@@ -893,8 +935,10 @@ project → **plugin gap**, not a copy.
|---|---|---|
| R2, file names, optimization, preview | `buildR2Storage`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` | storage.md |
| Image / video in `<Media>` | `mediaImageProps`, `videoProps`, `MEDIA_SIZES` | storage.md |
| Enlarge an image (card, gallery, product, rich text) | `<SiteProviders lightbox>` + `<LightboxTrigger group image={lightboxImage(media, { size })}>` (`/client`), `RenderRichText lightbox`, `useLightbox`; labels: `ipalKit({ lightbox: true })` → Form messages → Image viewer | lightbox.md |
| YouTube without cookies before a click | `<YouTubeEmbed>` (`/client`) | storage.md |
| `next.config` | `buildImagesConfig`, `buildSecurityHeaders`, `buildCsp`, `buildUploadSecurityHeaders` | storage.md, security.md |
| `next.config` | `buildImagesConfig`, `buildSecurityHeaders` (`csp`), `buildCsp`, `buildCspHeaders`, `buildAdminCsp` / `buildAdminCspHeaders`, `buildUploadSecurityHeaders`, `withSecurityConfig` (hides `X-Powered-By`) | storage.md, security.md |
| CSP reports, nonces | `createCspReportRoute` (`parseCspReports`, type `CspViolation`), `createProxy({ csp })` + `<SiteProviders nonce>` (dynamic pages only), `createCspNonce`, `CSP_NONCE_HEADER`, `buildReportingEndpoints`, `cspHeaderKey`, `DEFAULT_CSP_REPORT_GROUP`; types `BuildAdminCspArgs`, `CspDirective`, `CspSources`, `CreateCspReportRouteArgs`, `WithSecurityConfigOptions` | security.md |
| Fluid typography and spacing | `fluid.css` / `fluid-wide.css` (`--ipal-*` variables) | PROGRAMISTA §2.5 |
**Consent, analytics, operations**
@@ -904,6 +948,8 @@ project → **plugin gap**, not a copy.
| Settings window: in the bar / small / large with cookie details | `<CookieBanner settings="inline" \| "modal" \| "detailed">` — do not build your own window or cookie list | consent.md → "Large window with details" |
| A consent-dependent script | `ConsentScript` | consent.md |
| Cookie table on the policy page | `<CookieTable>` (`/rsc`), `getCookieTable` | consent.md |
| Cookie list filled from the panel (scan, then one approval adds every cookie to the list, the policy table and the detailed window) | `ipalKit({ cookieScanner: true })` + `pnpm generate:importmap` + migration; the editor approves on `/admin/cookie-approval`; project cookies: `cookieScanner.declarations` / `integrations`; per-entry review: `approval: false` — do not type the list by hand or build your own scanner or approval page | cookie-scanner.md |
| Pre-consent check in a browser (button in the panel, violations, dashboard + e-mail warning) | `cookieScanner: { crawl: true }` + env `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN` (`ipalEnvRules({ cookieCrawl: true })`) + the site's `host=token` in the shared service's `IPAL_CRAWLER_SITES`; never Playwright/Chromium in the site | cookie-scanner.md → Browser crawl |
| GA4, GTM, Pixel, Clarity, LinkedIn, TikTok | IDs in the panel — `SiteProviders` loads `Analytics` (`analytics={{ defer: true }}`; `consentMode: 'basic'` = no Google request before consent) | analytics.md |
| Mail | `email: mailAdapter()`, `sendEmail` | email.md |
| Env validation, health | `assertEnv(ipalEnvRules({…}))` (`/env`), `healthRoute` | env.md |
@@ -911,36 +957,52 @@ project → **plugin gap**, not a copy.
| Rate limit (forms, MCP, search) | built in; IP from `IPAL_IP_HEADER`; several instances → `setRateLimitStore` | forms.md |
**Compliance (PL/EU) — the mechanism from the plugin, the content from the client:** policy pages
as System Pages, `CookieBanner` + `CookieButton`, a `consent` checkbox in
as System pages, `CookieBanner` + `CookieButton`, a `consent` checkbox in
forms (enforced server-side), the controller's data in a global, the cookie
table from the panel (`<CookieTable>` and the `settings="detailed"` window, scan: ipal-consent-check). You do not write legal texts. An accessibility widget — only when the client
requires it (accessibility.md).
**Security:** 2FA enforced (`ipalKit({ twoFactor: { issuer, plugin:
payloadTotp } })`, never `twoFactor: false` without a client decision). CSP: first
`report-only`, then `enforce`; no Trusted Types (they break Turnstile/GA).
payloadTotp } })`, never `twoFactor: false` without a client decision). No `X-Powered-By`:
`withPayload(withSecurityConfig(nextConfig))`. CSP in three steps (security.md → "ROLL OUT CSP"):
(1) `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', <flags for what the
site loads> } })`, the admin rule `{ source: '/admin/:path*', headers: buildAdminCspHeaders({ mode:
'report-only', reportUri }) }` AFTER the site-wide one, and `export const POST = createCspReportRoute()` in
`src/app/api/csp-report/route.ts`; (2) deploy, read the console and the `[csp]` lines in the Coolify logs,
add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both places. Check:
`curl -sI $U/pl | grep -iE 'content-security|x-powered-by'`. ISR/SSG sites keep the header policy (with
`'unsafe-inline'` — Next's inline RSC scripts cannot be hashed); nonces (`createProxy({ csp })` +
`<SiteProviders nonce>`) only on sites whose pages already render per request. No Trusted Types (they break Turnstile/GA).
### 7.1 Newer defaults — turn off / override (the plugin helps, never limits)
| Feature (default) | Turn off | Override / building blocks |
|---|---|---|
| Plugin globals: write editor+ (Site Integrations: admin) | — | `ipalKit({ globalOverrides: { <slug>: { access, admin, hooks } } })`; a function `(global) => global` takes over (`applyGlobalOverrides`) |
| Plugin globals: write editor+ (Site integrations: admin) | — | `ipalKit({ globalOverrides: { <slug>: { access, admin, hooks } } })`; a function `(global) => global` takes over (`applyGlobalOverrides`) |
| Global saves revalidate the layout (with `ipalKit({ revalidatePath })`) | omit `revalidatePath`; once: `context: { disableRevalidate: true }` | `buildGlobalRevalidateHook` on your own globals |
| 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 |
| 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` |
| Consent records / stats visits: read and delete admin (stats view and chart follow `stats-visits` read access) | omit `consentLog` / `stats` | `consentLog.collectionOverrides`, `stats.collectionOverrides` (object merges `access`/`admin`/`hooks`, function takes over; `applyCollectionOverride`) |
| Injected `users`: admin manages everyone, others only themselves | — | `access.authAccess` (your keys win); your own `users` collection wins whole |
| First registered account = admin | `access.firstUserAdmin: false` | `buildRolesField(defaultRole, { firstUserAdmin })` |
| 2FA on the panel's login collection, mismatch = startup error | `twoFactor: false` (discouraged) | `twoFactor.collectionSlug`, `allowCollectionMismatch: true` |
| 2FA on the panel's login collection, mismatch = startup error; redirect to the 2FA screens by `TotpRedirectProvider` | `twoFactor: false` (discouraged) | `twoFactor.collectionSlug`, `allowCollectionMismatch: true`, `twoFactor.provider` (own component, or `false` for the package's) |
| `enabled: false` keeps the schema | — | — (no endpoints, `onInit` or admin components; no DROP TABLE in `migrate:create`) |
| No client IP = one shared `unknown-ip` bucket at 20× the limit | `setUnknownIpFactor(0)` (only with a limiter in front) | `setUnknownIpFactor(n)`; `UNKNOWN_IP_FACTOR` |
| Turnstile token domain not checked | (default) | `createSubmitAction({ turnstileHostnames })`, `verifyTurnstile({ hostnames })` — leave empty in dev |
| Consent Mode `advanced` | `consentMode: 'basic'` | your own `<Analytics>` props (`SiteProviders analytics={false}`) |
| Locale cookie: consent read under its own stored version | — | `createProxy(config, { policyVersion })` / `createLocaleMiddleware({ policyVersion })` |
| No `X-Powered-By` (with `withSecurityConfig`) | `withSecurityConfig(config, { hidePoweredBy: false })` | — |
| CSP off until `buildSecurityHeaders({ csp })`; then hard rules, `'unsafe-eval'` only in dev | leave out `csp` | `buildCsp({ extra, override, strictDynamic, dev })`, `buildAdminCsp({ extra, override })`, `createCspReportRoute({ onReport, maxBytes })`, your own string via `additional` |
| Construction mode hides pages in Markdown, MCP | `markdown: { isPathVisible: () => true }`, `mcp: { isPathVisible: () => true }` | `isPathVisible`, `isPathVisibleIn(mode, path)`, `pathOf(url)`, type `PathVisibility` |
| Construction mode filters the sitemap and llms.txt | `underConstructionSeo: false` | `include` / `getIncludedPaths` in the low-level builders |
| `getSettings` at `depth: 1` | — | `createContentHelpers({ settingsDepth: 2 })` (every request pays) |
| Image lightbox (off) | — (opt-in: `<SiteProviders lightbox>`, `LightboxTrigger`, `RenderRichText lightbox`, `ipalKit({ lightbox: true })` for panel labels) | `texts`, `classNames`, `unstyled`, `--ipal-lightbox-*` variables, `renderImage`, `renderDialog`, `loop`, `useLightbox`, `withLightboxUploads`, `lightboxImage` |
| `RenderRichText` renders unsafe link URLs as `#` | `safeLinks={false}` (fully trusted content only) | your own `converters` |
| Search & AI tab in Site Settings | `searchSettings: false` (top level, works without `seo`; `seo.searchSettings` still works) | `searchSettings: (fields) => fields`; `verificationFrom`, `robotsOptionsFrom` |
| Search engines tab in Site settings | `searchSettings: false` (top level, works without `seo`; `seo.searchSettings` still works) | `searchSettings: (fields) => fields`; `verificationFrom`, `robotsOptionsFrom` |
| Verification `<meta>` from the panel | empty fields = no tag | `const { verification, ...meta } = await generatePageMetadata(…)` |
| AI crawler policy from the panel | `robots` instead of `getRobots`; policy `default` | `buildRobots({ ...robotsOptionsFrom(settings), aiBotRules })`; `AI_ASSISTANT_BOTS`, `AI_TRAINING_BOTS` |
| Sitemap split / CDN cache / memo | `sitemapOptions: { maxUrls: Infinity, cacheControl: false, memoSeconds: 0 }` | `sitemapEntries`, `createSitemapRouteHandler`, `buildSitemapIndexXml`, `buildSitemapEntries` |
@@ -969,7 +1031,7 @@ Rules:
texts the editor will change tomorrow.
- **Every fixed bug = a test** that would have caught it (smoke or vitest), so it does not come back.
- **Test the form for real**: sending → a record in Form Submissions → mail to the company **and**
confirmation to the customer (locally: Site Integrations → Send test + adapter logs).
confirmation to the customer (locally: Site integrations → Send test + adapter logs).
- **Do not test the plugin in the project** (e.g. whether `submitForm` validates) — ipal-kit does that. When
the plugin's behavior is wrong: plugin gap.
- Tests in the project's CI: types + audit `--quick` + build on every push; smoke on staging
@@ -1102,6 +1164,7 @@ Anything that needs a developer → move it to the panel.
| GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok | [analytics.md](../analytics.md) |
| Blocks, RenderBlocks, enhanceProps | [blocks.md](../blocks.md) |
| Cookie consent, banner | [consent.md](../consent.md) |
| Cookie scanner (review list, Open Cookie Database) | [cookie-scanner.md](../cookie-scanner.md) |
| Routing, archives, redirects, Markdown, search | [content.md](../content.md) |
| Email SMTP / Graph | [email.md](../email.md) |
| Env validation | [env.md](../env.md) |
@@ -1121,6 +1184,7 @@ Anything that needs a developer → move it to the panel.
| SEO, metadata, sitemap, JSON-LD, llms.txt | [seo.md](../seo.md) |
| Auto-slug | [slug.md](../slug.md) |
| Media: collection, file names, optimization, placeholders | [media.md](../media.md) |
| Image lightbox (enlarge, galleries, rich text images) | [lightbox.md](../lightbox.md) |
| R2, `buildImagesConfig`, YouTube | [storage.md](../storage.md) |
| Front end: `createContentHelpers` (`@/lib/content`), `createPageRoute`, `SiteProviders` | [frontend.md](../frontend.md) |
| Integrations (the `site-integrations` global, statuses, email test) | [integrations.md](../integrations.md) |
+10 -1
View File
@@ -1,6 +1,6 @@
---
name: ipal-audit
description: Audits an ipal-kit (Payload 3 + Next 16) project against AGENT.md rules with a deterministic script — the mandatory feature set (SEO, JSON-LD, llms.txt, Markdown, MCP, R2, Turnstile, panel forms, consent, 2FA, health, env), forbidden replacements (own forms, nodemailer, reCAPTCHA, hand-written JSON-LD), hardcoded texts/links, forbidden field names, monolithic sections, middleware.ts, missing ISR/generateStaticParams, hex colors, server imports in client components, extra collections, then tsc and build. Use before saying a task is done, after any block/collection/layout change, after an Impeccable pass, and when asked to review or audit the project.
description: Audits an ipal-kit (Payload 3 + Next 16) project against AGENT.md rules with a deterministic script — the mandatory feature set (SEO, JSON-LD, llms.txt, Markdown, MCP, R2, Turnstile, panel forms, consent, 2FA, health, env, security headers, X-Powered-By, CSP), forbidden replacements (own forms, nodemailer, reCAPTCHA, hand-written JSON-LD), hardcoded texts/links, forbidden field names, monolithic sections, middleware.ts, missing ISR/generateStaticParams, hex colors, server imports in client components, extra collections, then tsc and build. Use before saying a task is done, after any block/collection/layout change, after an Impeccable pass, and when asked to review or audit the project.
---
# ipal-audit
@@ -38,5 +38,14 @@ in AGENT.md §0b). Never add that line yourself just to make the audit pass.
google-analytics / googletagmanager (except Consent Mode), facebook.net,
clarity.ms, licdn, tiktok.
- **Content**: fallbacks contain no client data (`|| 'Firma X'`).
- **Response headers** (on a running build — `pnpm build && pnpm start`, or the deployed domain):
```bash
U=http://localhost:3000
for p in /pl /admin /api/health; do echo "== $p"; curl -sI "$U$p" | grep -iE 'x-powered-by|content-security-policy'; done
```
`x-powered-by` anywhere → ERROR (`withSecurityConfig`, security.md → "X-Powered-By"). No
`content-security-policy` / `content-security-policy-report-only` on `/pl` and `/admin` → WARNING (CSP not
rolled out). Report-only for more than a few weeks with clean reports → WARNING (switch to `mode: 'enforce'`).
Then open `/pl` and `/admin` in the browser: CSP lines in the console = missing sources (flags / `extra`).
Do not say "done" until the full audit (without `--quick`) has no errors.
@@ -261,6 +261,8 @@ if [ -n "$APP" ]; then
need ERROR '' "health route" "src/app/api/health/route.ts → export { healthRoute as GET } from '@/lib/content'" 'healthRoute|createHealthRoute' src/app
need ERROR '' "env validation" "src/instrumentation.ts → assertEnv(ipalEnvRules({...})) from @intecion/ipal-kit/env" 'assertEnv' src/instrumentation.ts instrumentation.ts
need ERROR '' "security headers" "next.config.ts → buildSecurityHeaders" 'buildSecurityHeaders' next.config.ts next.config.mjs next.config.js
need WARNING '' "X-Powered-By hidden" "next.config.ts → export default withPayload(withSecurityConfig(nextConfig)) — Next and withPayload send X-Powered-By: Next.js, Payload (security.md)" 'withSecurityConfig|poweredByHeader: *false' next.config.ts next.config.mjs next.config.js
need WARNING csp "Content-Security-Policy" "next.config.ts → buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } }) + buildAdminCspHeaders on /admin/:path*, then 'enforce' (security.md → ROLL OUT CSP)" "csp: *\\{|csp,|buildCsp|Content-Security-Policy" next.config.ts next.config.mjs next.config.js src/proxy.ts proxy.ts
# Consent, analytics, Turnstile (layout)
need ERROR '' "cookie consent" "<SiteProviders> (or ConsentProvider + CookieBanner + CookieButton) in [locale]/layout.tsx" 'SiteProviders|CookieBanner' src/app
need ERROR analytics "analytics" "<SiteProviders> (loads Analytics) or <Analytics> inside ConsentProvider" 'SiteProviders|<Analytics' src/app
@@ -312,6 +314,8 @@ report WARNING "<form> outside the form renderer" "§0b — panel forms render v
# Project copies of what the plugin now ships (import instead of code)
report WARNING "own form engine" "ipal-form §3 — <RenderForm> / useBuilderForm (steps, choices, Turnstile, honeypot; Emails tab never reaches the browser)" \
"$(g 'buildValidator|useForm\(' src --include=*.tsx | grep -v 'useBuilderForm')"
report WARNING "own image lightbox" "lightbox.md — <LightboxTrigger> + lightboxImage, one <SiteProviders lightbox>; labels from Notifications → Lightbox" \
"$(g "['\"](glightbox|photoswipe|yet-another-react-lightbox|react-medium-image-zoom|fslightbox-react)['\"]" src --include=*.ts --include=*.tsx)"
report WARNING "project copy of section fields / navigation" "blocks.md, links.md — buildSectionHeaderField, buildSectionSettingsField, resolveNav (lib/content)" \
"$(ls src/fields/sectionHeader.ts src/fields/sectionSettings.ts src/lib/navigation.ts 2>/dev/null)"
if [ -n "$UI" ]; then
+7 -2
View File
@@ -1,6 +1,6 @@
---
name: ipal-block
description: Builds or refactors one page section (Payload block + React component) in an ipal-kit project the correct way — a clean editor panel (repeatable things as "+ Add …" arrays with rowLabel, never cta1/cta2 slots, short English labels, no empty spare fields), shared fields from the plugin (buildSectionHeaderField, buildLinksField, buildLinkField, buildSectionSettingsField), UI primitives (Section, SectionHeader, Media, CMSLink), fixed field vocabulary, max ~80 lines of JSX, subcomponents for repeated items, registry wiring. Use when creating a new section/block (hero, features, CTA, FAQ, gallery, pricing, testimonials…), changing a block's fields, or fixing a block with ctaLabel/buttonUrl/pdfUrl fields or a monolithic component.
description: Builds or refactors one page section (Payload block + React component) in an ipal-kit project the correct way — a clean editor panel (repeatable things as "+ Add …" arrays with rowLabel, never cta1/cta2 slots, short `{ en, pl }` labels per docs/dev/admin-ux.md, no empty spare fields), shared fields from the plugin (buildSectionHeaderField, buildLinksField, buildLinkField, buildSectionSettingsField), UI primitives (Section, SectionHeader, Media, CMSLink), fixed field vocabulary, max ~80 lines of JSX, subcomponents for repeated items, registry wiring. Use when creating a new section/block (hero, features, CTA, FAQ, gallery, pricing, testimonials…), changing a block's fields, or fixing a block with ctaLabel/buttonUrl/pdfUrl fields or a monolithic component.
---
# ipal-block
@@ -39,13 +39,18 @@ File patterns (Hero, FeatureGrid + FeatureCard): `resources/section-code.md`.
`<Section settings>` → `<SectionHeader header>` → content with `<Media>`, `<CMSLink>`,
`items.map(<Card/>)`. No text, `href`, `<img>`, hex colors or inline SVG.
3. Subcomponents go in the same folder; shared by 2+ sections → `src/components/ui/`.
An image the visitor can enlarge (gallery, card, product, certificate) → wrap the `<Media>` in
`<LightboxTrigger group={`<name>-${id}`} image={lightboxImage(item.image, { size: 'hero' })}>`
(`@intecion/ipal-kit/client`; skip the trigger when `lightboxImage` returns `null`). No
`useState` dialog, no `glightbox` — lightbox.md.
4. Add `config.ts` to `layout` in `src/collections/Pages.ts`,
and the component to `src/blocks/registry.ts` (key = slug).
5. `pnpm generate:types`.
## 3. Check
- `Component.tsx` ≤ ~80 lines of JSX.
- **Empty block test** in the panel: ≤ 6 items at the start, everything in English,
- **Empty block test** in the panel: ≤ 6 items at the start, every label and description
readable in English and Polish (switch the admin language in Account),
"+ Add Button / Add Feature", collapsed rows showing their content, every field shows something.
First `rowLabel` in the project → `pnpm payload generate:importmap`.
- Run the **ipal-audit** skill (`--quick`), fix every `[ERROR]`.
+4 -3
View File
@@ -1,6 +1,6 @@
---
name: ipal-collection
description: Decides whether something should be a Payload collection, a global, or a block, and builds a content collection the ipal-kit way (title, buildSlugField, SEO tab, buildNoindexField, trackSlugHistoryHook, revalidate hook, archive page from System Pages, sitemap and routing via content option). Use when the user asks for a blog, news, products, portfolio, testimonials, authors, categories, or any new collection — and whenever you are about to create a file in src/collections.
description: Decides whether something should be a Payload collection, a global, or a block, and builds a content collection the ipal-kit way (title, buildSlugField, SEO tab, buildNoindexField, trackSlugHistoryHook, revalidate hook, archive page from System pages, sitemap and routing via content option). Use when the user asks for a blog, news, products, portfolio, testimonials, authors, categories, or any new collection — and whenever you are about to create a file in src/collections.
---
# ipal-collection
@@ -35,10 +35,11 @@ Ask only when the brief leaves a business question open (e.g. "do posts have aut
`buildRevalidateHook`, `setPublishedAtHook` (dated entries), uploads via
`media`, links via `buildLinkField()`. Field names per AGENT.md §6.5.
Panel (AGENT.md §6.5a): `admin.useAsTitle`, `defaultColumns` (3–4), `admin.group: 'Content'`,
`labels` in English, arrays with `labels` + `rowLabel()`, settings in the sidebar.
`labels` and every field `label` as `{ en, pl }` (rules: `docs/dev/admin-ux.md` in the package),
arrays with `labels` + `rowLabel()`, settings in the sidebar.
2. With URLs: add it to `content.config.ts` → `{ slug, perPage }`.
**No URL prefix in code** — the editor assigns the archive page in
Site Settings (`<slug>Archive`). The plugin handles routing, sitemap,
Site settings (`<slug>Archive`). The plugin handles routing, sitemap,
generateStaticParams, hreflang.
3. Entry list = a block (EntriesList) with `getEntries`; the entry page uses
`resolveRoute` (type `entry`); JSON-LD per seo.md (e.g. Article).
+58 -6
View File
@@ -27,7 +27,7 @@ before analytics or marketing consent — check the project's choice in "Project
| Violation | Cause → fix |
|---|---|
| pixel loaded without consent | script wired by hand / copied `Analytics` → ID in Site Integrations, `<Analytics>` from the plugin (analytics.md) |
| pixel loaded without consent | script wired by hand / copied `Analytics` → ID in Site integrations, `<Analytics>` from the plugin (analytics.md) |
| tracking cookie set without consent | same; or GTM fires a tag without an `ad_storage` condition (analytics.md → GTM) |
| GA hit with consent GRANTED | `setDefaultConsent` not before the tag — `<Analytics>` must be inside `<ConsentProvider>` (`SiteProviders` does this itself) |
| YouTube / Maps before consent (warning) | `ConsentScript` (consent.md), `youtube-nocookie.com` or "click to load" |
@@ -41,9 +41,61 @@ before analytics or marketing consent — check the project's choice in "Project
The script needs buttons with `data-ipal="accept"` / `"reject"` — the plugin's
`CookieBanner` has them in every `settings` mode (`inline`, `modal`, `detailed`). A custom banner in the project violates AGENT.md §7.
## Cookie list from the panel (`cookieScanner`)
When the project has `ipalKit({ cookieScanner: true })` (cookie-scanner.md), the editor fills the
list in the panel and you check it:
1. Not on yet → turn it on, `pnpm generate:importmap`, `pnpm payload migrate:create cookie-scanner`
(Postgres), commit the migration. Embeds and widgets the plugin does not inject (YouTube, maps,
chat): add them as `cookieScanner.declarations` (or an `integrations` entry with `isEnabled`) —
never a hand-typed list in code.
2. *Privacy → Cookies → Review and approve* → **Scan cookies** (with `adminLayout: 'separate'`: *Privacy → Cookie review*). "Integrations in use" must match the IDs in Site
Integrations; a filled ID that is missing → **ipal-debug**.
3. Run the browser scan below and paste every cookie it reports as unknown into **More cookie
names**, scan again. Cookies marked **Needs description** need provider, category and
purpose: ask the client, do not guess (Edit on the approval page opens the entry).
4. **Approve** in the same tab (also at `/admin/cookie-approval`): the cookies are grouped by category, new /
changed / needs-description marked. Untick anything that should not be listed, then **Approve
and add** — every ticked cookie goes to Cookies → Cookie list in every language (and so
to the cookie policy table and the banner's detailed window); existing text is never
overwritten, no row is duplicated. Unknown cookies land in `marketing` (or
`approval.unknownCategory`) flagged "Needs description" — describe them before handover.
Open the banner's "Settings" and check each category lists its cookies. A project with
`approval: false` accepts entry by entry (Status → Accepted, bulk edit works).
5. *No longer found* on the approval page = a cookie a scan stopped seeing; it stays in the cookie
list. Remove the row there only when the site really no longer sets it.
6. Database lookups come with category `functional` when the Open Cookie Database says
"Functional" (it files some trackers there) — lower to `necessary` only when the cookie really
is needed for the site to work.
## Pre-consent check from the panel (`cookieScanner.crawl`)
When the project has `cookieScanner: { crawl: true }` (cookie-scanner.md → Browser crawl):
1. Not on yet and the client wants it → turn it on; env `IPAL_COOKIE_SCAN_URL` +
`IPAL_COOKIE_SCAN_TOKEN` (`openssl rand -hex 32`) in Coolify; ask the team to add
`<host>=<token>` to the scanner service's `IPAL_CRAWLER_SITES`; `generate:importmap`,
`migrate:create cookie-crawl`. Never add Playwright or Chromium to the site.
2. *Cookie review* → **Check site**. "Check site" disabled → the box names the missing variable.
Failed → *Privacy → Cookie check → Error* ("Could not reach the scanner service" = URL / DNS /
firewall; a Cloudflare challenge page = allow the Coolify server's IP).
3. Filter the list by **Violation**: every entry is a non-necessary cookie or key stored before
consent — fix it as in the table above (or, if it really is necessary, set its category and accept
it). *Cookie check → Violations* also lists tracker **requests** before consent.
4. Describe the cookies marked **Needs description**, approve on *Approve cookies* (the dashboard
links there while cookies wait), then crawl again: 0 violations and nothing waiting is the goal
before handover. A crawl never adds anything to the cookie banner by itself.
5. Optional: recipients in *Cookie check → Warning e-mails to* (the e-mail also says when cookies
wait for approval and links to the approval page), and a weekly Coolify scheduled task
`curl -X POST -H "Authorization: Bearer $IPAL_COOKIE_SCAN_TOKEN" $NEXT_PUBLIC_SERVER_URL/api/ipal/cookie-crawl`.
Record both in `AGENTS.md` → "Project decisions".
## Cookie list for the cookie policy (cookie-scan)
After every change of tools (new pixel, chat, map, video) and before handing the site over:
After every change of tools (new pixel, chat, map, video) and before handing the site over
(with `cookieScanner` on, use step 1 below to find what really appears in the browser, then feed the
unknown names to the panel scan above instead of step 2):
1. Scan the running site (without consent and after "Accept all", homepage + up to 10 pages from the sitemap):
```bash
@@ -53,7 +105,7 @@ After every change of tools (new pixel, chat, map, video) and before handing the
**non-necessary cookie set before consent** — fix it as in the table above. `[WARNING] unknown` —
find the provider and purpose, set `category` (`necessary|functional|analytics|marketing`) and `purpose`
in `cookies.json`. Do not guess — ask if you do not know.
2. Import into the panel (Cookie Settings → Cookies), each language separately (scan with `--lang en` for English):
2. Import into the panel (Cookies → Cookie list), each language separately (scan with `--lang en` for English):
```bash
LOCALE=pl pnpm payload run .agents/skills/ipal-consent-check/scripts/import-cookies.ts cookie-scan/cookies.json
```
@@ -61,18 +113,18 @@ After every change of tools (new pixel, chat, map, video) and before handing the
the scan did not see — the editor does that in the panel. The same list feeds the
`<CookieBanner settings="detailed">` window (an expandable list under each category) — after the import open
"Settings" in the banner and check that every category shows its cookies and that the labels
(Cookie Settings → Detail labels) are in that language.
(Cookies → Settings window → Cookie list headings) are in that language.
3. The cookie policy page shows the table from the panel — **do not paste the list into the policy text**:
```tsx
import { getCookieTable } from '@intecion/ipal-kit'
import { CookieTable } from '@intecion/ipal-kit/rsc'
import { getCachedPayload, getSiteShell } from '@/lib/content'
const rows = await getCookieTable({ payload: await getCachedPayload(), locale })
const { consent } = await getSiteShell(locale) // category names from Cookie Settings
const { consent } = await getSiteShell(locale) // category names from Cookie banner
<CookieTable rows={rows} categories={consent.categories} labels={labels} />
```
`labels` = `{ name, category, provider, purpose, duration }` (all required). The plugin panel
has only `provider` / `purpose` / `duration` (Cookie Settings → Detail labels = `consent.details`);
has only `provider` / `purpose` / `duration` (Cookies → Settings window → Cookie list headings = `consent.details`);
take the `name` and `category` headers from (localized) fields of the project block. The table is unstyled
(`classNames`: `table`, `caption`, `tr`, `th`, `td`; optional `caption`). A project "Cookie
table" block on the policy page is a good place — then the editor decides where it appears.
+3 -2
View File
@@ -52,16 +52,17 @@ through this procedure. Ask only when you are missing something you cannot get y
| Symptom | Cause | Fix |
|---|---|---|
| `PayloadComponent not found in importMap` (e.g. `@intecion/ipal-kit/admin#RowLabel`) | importMap out of date after a plugin update / adding `rowLabel` | `pnpm payload generate:importmap`, restart |
| new admin stuck on `/admin/setup-totp?back=null` (the page keeps redirecting to itself) | ipal-kit ≤ 1.14.1: the 2FA package's provider needs an `x-pathname` header nothing sets on `/admin`; or `twoFactor.provider: false` without that header | update ipal-kit, `pnpm payload generate:importmap` (`TotpRedirectProvider`), restart; check: `/admin/setup-totp?back=%2Fadmin` shows the QR (security.md) |
| `Cannot destructure property 'config'` / UI hooks without context | two copies of `@payloadcms/ui` | `pnpm why @payloadcms/ui`; one version + `pnpm.overrides`; `ls node_modules/@intecion/ipal-kit/node_modules/@payloadcms` = empty |
| empty SEO tab, no Forms | mismatched `@payloadcms/*` versions | all `@payloadcms/*` = the `payload` version |
| upload rejected "Image is … Tick Optimize" | `buildOptimizeUploadHook` (intended) | tick the checkbox or prepare the file; limit in the hook options |
| video upload rejected | `maxVideoBytes` limit | export as the message says (H.264, 720–1080p, fast start) |
| change in the panel not visible | no Save / ISR without revalidation | collection: `buildRevalidateHook`; your own global (Header, Footer…): `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]` (ipal-nav); the plugin's globals (Site Settings, Site Integrations, Cookie Settings, Notifications): pass `ipalKit({ revalidatePath })` (from `next/cache`) — without it the change waits until the `revalidate` window ends |
| change in the panel not visible | no Save / ISR without revalidation | collection: `buildRevalidateHook`; your own global (Header, Footer…): `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]` (ipal-nav); the plugin's globals (Site settings, Site integrations, Cookie banner, Notifications): pass `ipalKit({ revalidatePath })` (from `next/cache`) — without it the change waits until the `revalidate` window ends |
### Front end / routing / SEO
| Symptom | Cause | Fix |
|---|---|---|
| `/pl` → 404 | Homepage not assigned in System Pages | set it in the panel |
| `/pl` → 404 | Homepage not assigned in System pages | set it in the panel |
| `/en/*` → 404, `/pl/*` works | slug/title missing in EN | `ipal-locale-add` → `locale-coverage` |
| language switcher → 404 | prefix swap instead of `AlternateLinksUpdater` | i18n.md → AlternateLinks |
| metadata in `<body>` (seo-check) | streaming: no `htmlLimitedBots`, explicit `<head>`, dynamic page | AGENT §4; `generatePageMetadata` |
+5 -5
View File
@@ -58,7 +58,7 @@ checkbox, **Checkbox group** (multiple choice, min/max), message, **Step** (spli
country, state (on by default in form-builder, rendered as a text field).
Turning a type off: `forms.fields: { country: false, state: false }`.
- **Multi-step form:** the editor inserts a **Step** block (title, description) — the fields below it form one
screen. The Next/Back buttons and "Step 1 of 3" come from **Notifications → Form messages** (next, back,
screen. The Next/Back buttons and "Step 1 of 3" come from **Form messages → Form messages** (next, back,
stepOf). Next validates only the current step; a server error returns to the step with the field; focus
moves to the new step. No Step = one screen.
- `width` ≤ 50 → class `fieldHalf`, otherwise `fieldFull`.
@@ -121,8 +121,8 @@ Details the seed already covers, which you check after every manual change in th
body `{{*:table}}`) **and** confirmation to the sender (`emailTo: {{email}}`) — both mandatory.
The email field must have `name: 'email'` (the plugin accepts exactly one address in it).
5. **Analytics (GTM / dataLayer)**: Event name `generate_lead` / `form_submit`, parameters `form_name`.
6. **Site Integrations**: mail transport (SMTP/Graph) + **Send test**; Turnstile keys.
7. **Notifications → form.\***: texts in every language.
6. **Site integrations**: mail transport (SMTP/Graph) + **Send test**; Turnstile keys.
7. **Form messages → form.\***: texts in every language.
## 6. Check it yourself before you say "done"
- [ ] submitting with empty required fields → errors at the fields, no request;
@@ -132,7 +132,7 @@ Details the seed already covers, which you check after every manual change in th
- [ ] unticked consent → a message from Notifications (not the English fallback);
- [ ] 6 quick submissions → `rate_limited`;
- [ ] Turnstile with keys → widget visible; submitting without solving the widget → `turnstile`;
wrong secret → the form goes through, and the panel (dashboard + Site Integrations → Turnstile) shows a red alert;
wrong secret → the form goes through, and the panel (dashboard + Site integrations → Turnstile) shows a red alert;
- [ ] Turnstile without keys → no widget, the form goes through;
- [ ] second language → labels and messages in that language;
- [ ] GTM Preview → an event with the name from the panel after success;
@@ -146,7 +146,7 @@ Details the seed already covers, which you check after every manual change in th
| no Forms collection in the panel | form-builder vs payload version mismatch → same version, `pnpm.overrides` |
| the block renders nothing | `form` is an ID (`depth` too low) or `formTexts`/`sendForm` missing in enhanceProps |
| `reason: 'validation'`, `kind: 'unknown_fields'` | the frontend sends a field the form does not have (custom renderer with an extra field, typo in `name`) |
| "Next/Back" buttons in English | empty Notifications → Form messages → next / back / stepOf in that language |
| "Next/Back" buttons in English | empty Form messages → next / back / stepOf in that language |
| `reason: 'not_found'` | `formId` from another database (seeded on dev, another ID on prod) — use a relationship from the panel, not a fixed ID in code |
| submission exists, no email | missing `email: mailAdapter()`, empty Emails tab, transport in the panel; server logs |
| always `turnstile` | wrong key pair / domain in Cloudflare (BuilderForm resets the token after an error) |
+5 -5
View File
@@ -1,6 +1,6 @@
---
name: ipal-locale-add
description: Adds a new language to an ipal-kit site (or turns a single-language site into a multilingual one) end to end — i18n.config, routing, Postgres migration, slugs and titles per page, globals (Header, Footer, Site Settings, Cookie Settings, Notifications), forms, SEO (hreflang, sitemap), language switcher — and proves completeness with a coverage script and ipal-seo-check. Use when the user asks for a new language/locale/translation version of the site.
description: Adds a new language to an ipal-kit site (or turns a single-language site into a multilingual one) end to end — i18n.config, routing, Postgres migration, slugs and titles per page, globals (Header, Footer, Site settings, Cookie banner, Notifications), forms, SEO (hreflang, sitemap), language switcher — and proves completeness with a coverage script and ipal-seo-check. Use when the user asks for a new language/locale/translation version of the site.
---
# ipal-locale-add
@@ -50,17 +50,17 @@ Fill them in this order (panel or a Local API script with `locale: 'de'`):
| What | Where | Effect if missing |
|---|---|---|
| slug + title of every page | Pages (and other collections with a URL) | 404 in the new language |
| Homepage/404/policy | System Pages (shared relations) + their slug in `de` | `/de` → 404, empty policy link |
| Homepage/404/policy | System pages (shared relations) + their slug in `de` | `/de` → 404, empty policy link |
| Header / Footer — link labels | navigation globals | empty menu items |
| Site Settings — name, description, OG | Site Settings | title/OG from the fallback |
| Cookie Settings — all texts + `privacyLinkLabel`, Detail labels, Cookies (`purpose`, `duration`) | Cookie Settings | banner / `detailed` window in another language (GDPR: consent must be understandable); scan + import with `--lang <code>` (ipal-consent-check) |
| Site settings — name, description, OG | Site settings | title/OG from the fallback |
| Cookie banner — all texts + `privacyLinkLabel`, Detail labels, Cookies (`purpose`, `duration`) | Cookie banner | banner / `detailed` window in another language (GDPR: consent must be understandable); scan + import with `--lang <code>` (ipal-consent-check) |
| Notifications — `form.*` | Notifications | form messages from the English fallback |
| Forms — field labels, confirmation, Emails | Forms (every form) | form in the wrong language |
| SEO tab — meta title/description | every page | duplicates/gaps in seo-check |
| Media — `alt` (if localized) | Media | a11y |
Slugs in the new language: words in that language, lowercase, no diacritics
(`ueber-uns`, not `über-uns`). The home page is the page assigned in System Pages → Homepage —
(`ueber-uns`, not `über-uns`). The home page is the page assigned in System pages → Homepage —
fill in its slug in `de` like any page (coverage checks it), but its address is always `/de`.
When writing through the Local API: `payload.update({ collection, id, locale: 'de', fallbackLocale: false, data })`:
- **`fallbackLocale: false` is mandatory** — without it (with `fallback: true`) Payload
+3 -3
View File
@@ -1,6 +1,6 @@
---
name: ipal-nav
description: Builds the site header, footer, mobile menu and company data in an ipal-kit project — Header/Footer/Company globals with buildLinkField from the plugin, server-side link resolution (resolveNav from the plugin), a small client MobileNav, legal links from System Pages, revalidation on change. Use when creating or changing navigation, menu, header, footer, contact details, social links or the company global.
description: Builds the site header, footer, mobile menu and company data in an ipal-kit project — Header/Footer/Company globals with buildLinkField from the plugin, server-side link resolution (resolveNav from the plugin), a small client MobileNav, legal links from System pages, revalidation on change. Use when creating or changing navigation, menu, header, footer, contact details, social links or the company global.
---
# ipal-nav
@@ -27,9 +27,9 @@ Requires the UI primitives from `../ipal-block/resources/section-code.md` (like
Do not create `lib/navigation.ts`.
4. `src/components/layout/Header.tsx`, `Footer.tsx` (server), `MobileNav.tsx`
(`'use client'`, open state only, data via props, `import type { NavItem } from '@intecion/ipal-kit'`).
5. **Legal links in the footer** from the System Pages roles: `getSystemLinks(locale)` (href + page
5. **Legal links in the footer** from the System pages roles: `getSystemLinks(locale)` (href + page
title) — not as manual items. Copyright year from code, name from `Company`.
6. Logo from Site Settings via `<Media>` — do not duplicate the field in Header.
6. Logo from Site settings via `<Media>` — do not duplicate the field in Header.
7. Wire it in `src/app/(frontend)/[locale]/layout.tsx` (fetch the globals through
cached getters in `lib/`, pass them as props).
@@ -7,7 +7,7 @@
Navigation, footer and company data are **project globals** (the model depends on the client
and the country), built from the same shared fields as sections. Logo and name live in
Site Settings — do not duplicate them in Header.
Site settings — do not duplicate them in Header.
```ts
// src/globals/Header.ts
@@ -79,7 +79,7 @@ export const Footer: GlobalConfig = {
```
- **Legal links in the footer** (privacy policy, cookies, terms): `await getSystemLinks(locale)` from `lib/content`
— href and label (page title) from System Pages; do not add them by hand to `columns`, do not write labels in code.
— href and label (page title) from System pages; do not add them by hand to `columns`, do not write labels in code.
- Highlighted menu item / button in a different colour = a style in the admin panel:
`buildLinkField({ appearances: ['default', { label: 'Highlighted', value: 'highlight' }] })` → a class in the project.
- **Company data** (name, address, NIP/ABN, phone) — the project's `company` global;
@@ -117,7 +117,7 @@ export async function Header({ header, locale }: { header: HeaderData; locale: s
return (
<header className="border-b">
<nav className="container flex items-center justify-between py-4">
{/* logo: Site Settings → <Media> */}
{/* logo: Site settings → <Media> */}
<ul className="hidden gap-6 md:flex">
{items.map((item) => (
<li key={item.href}>
+54 -26
View File
@@ -22,7 +22,8 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `i18n.defaultLocale` | — | `localization.defaultLocale`, `/` redirect in the proxy | must be in `locales` |
| `i18n.fallback` | `true` | `localization.fallback` | `false` |
| `i18n.locales[]` `{ code, label, rtl? }` | — | list of languages (min. 1); `rtl: true` → `rtl` in Payload | adding a language: skill **ipal-locale-add** |
| `access` | none | `roles` field (`user` < `editor` < `admin`, `saveToJWT`) in the auth collection | omit → **no roles**: every logged-in account passes the plugin's admin/editor checks (`userMeetsRole`): Site Integrations, the e-mail test, stats, consent-records, settings globals, `form-submissions`. Narrow them with `globalOverrides` / collection overrides |
| admin languages (no option) | English + Polish | `i18n.supportedLanguages` set to `{ en, pl }` when the project has none; plugin component texts in `i18n.translations.<lang>.ipal` (`adminTexts`); every plugin label is `{ en, pl }` (rules: `docs/dev/admin-ux.md`) | your own `i18n.supportedLanguages` wins; override a component text with `i18n.translations.<lang>.ipal.<key>`; field/global labels via `globalOverrides` / `collectionOverrides` — see i18n.md "Admin panel languages and texts" |
| `access` | none | `roles` field (`user` < `editor` < `admin`, `saveToJWT`) in the auth collection | omit → **no roles**: every logged-in account passes the plugin's admin/editor checks (`userMeetsRole`): Site integrations, the e-mail test, stats, consent-records, settings globals, `form-submissions`. Narrow them with `globalOverrides` / collection overrides |
| `access.authCollection` | — (required in `access`) | collection that gets `roles`; also the slug of the injected auth collection | your own collection with that slug wins |
| `access.defaultRole` | `'user'` | `defaultValue` of the `roles` field | `'editor'` / `'admin'` |
| `access.authAccess` | `{ create: adminOnly, delete: adminOnly, read: adminOrSelf, unlock: adminOnly, update: adminOrSelf }` | access of the auth collection the plugin **injects** (Payload's default lets any logged-in account edit or delete every other account) | your keys win, e.g. `{ read: authenticated }`; your own collection with that slug wins whole (give it `adminOrSelf` / `adminOnly` yourself) |
@@ -32,16 +33,17 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `twoFactor.issuer` | — (required) | name in the authenticator app | — |
| `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.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` | 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 | — |
| `whiteLabel.logoField` / `iconField` / `nameField` | `'logo'` / `'favicon'` / `'siteName'` | fields in Site Settings | any upload/text field |
| `whiteLabel.logoField` / `iconField` / `nameField` | `'logo'` / `'favicon'` / `'siteName'` | fields in Site settings | any upload/text field |
| `whiteLabel.titleSuffix` | none | `admin.meta.titleSuffix` (tab title) | — |
| `whiteLabel.credit` | on | `IntecionCredit` in `afterLogin` and `afterNavLinks` | `false`; `{ text, url }` overrides |
| `pages` | none | Site Settings → **System Pages** (page roles) and **Under construction** tabs | omit → neither tab |
| `pages.slug` | — (required in `pages`) | the project's pages collection (System Pages relations, construction, IndexNow) | — |
| `pages` | none | Site settings → **System pages** (page roles) and **Maintenance** tabs | omit → neither tab |
| `pages.slug` | — (required in `pages`) | the project's pages collection (System pages relations, construction, IndexNow) | — |
| `pages.roles` | all: `homepage`, `notFound`, `privacyPolicy`, `cookiePolicy`, `termsOfService` | which assignments to show | subset of the array |
| `content` | none | `<slug>Archive` field in System Pages per collection (entry URL = archive page slug) | **ignored without `pages`** (no archive fields; IndexNow still works) |
| `content` | none | `<slug>Archive` field in System pages per collection (entry URL = archive page slug) | **ignored without `pages`** (no archive fields; IndexNow still works) |
| `content.collections[]` `{ slug, label?, perPage? }` | `label` = slug, `perPage` 10 | archive entry; the same value goes to `createContentHelpers({ content })` | the project creates the collection (skill **ipal-collection**) |
| `seo` | none | `@payloadcms/plugin-seo` (`meta` group + `titleOverride`), Content/SEO tabs, auto-fill hook | omit |
| `seo.collections` | — (required) | collections with `meta` | — |
@@ -50,7 +52,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `seo.fields` | `[]` | extra fields in the SEO group | — |
| `seo.uploadsCollection` | `'media'` | upload collection `meta.image` relates to | any upload collection slug |
| `seo.generateTitle` / `generateDescription` | plugin-seo | preview / generation in the panel | your own function `({ doc }) => string` |
| `seo.searchSettings` | tab on (the tab exists with or without `seo`) | Site Settings → **Search & AI** tab: `searchVerification.google/bing/yandex` (→ `<meta>` via `generatePageMetadata`), `aiCrawlers.policy` + `aiCrawlers.rules[]` (→ robots.txt via `getRobots`), localized `llmsIntro` (→ top of `/llms.txt`); empty fields change nothing. Postgres: `migrate:create` after upgrading | `false` = no tab, but this key exists only inside `seo` (which needs `collections`); without `seo` use the top-level `searchSettings: false`. When both are set, the top-level `searchSettings` wins; `(fields) => fields` = your own set (keep the names `searchVerification`, `aiCrawlers`, `llmsIntro` or read your own fields in your routes) |
| `seo.searchSettings` | tab on (the tab exists with or without `seo`) | Site settings → **Search engines** tab: `searchVerification.google/bing/yandex` (→ `<meta>` via `generatePageMetadata`), `aiCrawlers.policy` + `aiCrawlers.rules[]` (→ robots.txt via `getRobots`), localized `llmsIntro` (→ top of `/llms.txt`); empty fields change nothing. Postgres: `migrate:create` after upgrading | `false` = no tab, but this key exists only inside `seo` (which needs `collections`); without `seo` use the top-level `searchSettings: false`. When both are set, the top-level `searchSettings` wins; `(fields) => fields` = your own set (keep the names `searchVerification`, `aiCrawlers`, `llmsIntro` or read your own fields in your routes) |
| `searchSettings` | tab on | same tab and values as `seo.searchSettings`, but a top-level option: works **with or without `seo`**; read as `searchSettings ?? seo.searchSettings`, so it wins when both are set | `false` = no tab; `(fields) => fields` = your own set |
| — (no option) | `uploadsCollection: 'media'` | meta image from the `media` collection | currently always `media` (gap) |
| `forms` | none | `@payloadcms/plugin-form-builder`: `forms`, `form-submissions` collections | omit |
@@ -59,17 +61,28 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `forms.formOverrides` | Form/Forms labels, `emails` readable by logged-in users only | overrides the `forms` collection (`fields: ({ defaultFields }) => …`, `slug`, `admin`, `access`…) | any `CollectionConfig` |
| `forms.formSubmissionOverrides` | create: logged-in, read: editor+, delete: admin | overrides `form-submissions` | `access.create` etc. wins |
| `forms.redirectRelationships` | none | collections a form can redirect to | `['pages']` |
| `forms.emailLayout` | `false` | `beforeEmail` with a layout (logo, colour, footer) + Site Settings → **Emails** tab; `{{*:table}}` readable | `true` |
| `forms.emailLayout` | `false` | `beforeEmail` with a layout (logo, colour, footer) + Site settings → **Emails** tab; `{{*:table}}` readable | `true` |
| `forms.beforeEmail` | none | your own e-mail changes (after the layout) | form-builder function |
| `forms.consentFieldName` | `'consent'` | name of the GDPR consent field `submitForm` requires (read from `config.custom.ipal`) | `createSubmitAction({ consentFieldName })` / `submitForm` argument wins |
| `consentLog` | off | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min) | `true` / `{ retentionDays }` (default 1095) |
| `consentLog.collectionOverrides` | none | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug) | e.g. `{ access: { read: ({ req }) => req.user?.email === '[email protected]' } }` — narrows who reads records in a project without roles |
| `cookieScanner` | off | `cookie-review` collection, "Scan cookies" box above its list (`CookieScanButton`), `GET`/`POST /api/ipal/cookie-scan`, and (unless `approval: false`) the *Approve cookies* view `/admin/cookie-approval` (`CookieApprovalView`) + `GET`/`POST /api/ipal/cookie-approval` + the dashboard reminder; a scan lists the cookies of the integrations switched on + names looked up in the bundled Open Cookie Database; one **Approve and add** puts the ticked cookies into Cookies → Cookie list (so `<CookieTable>` and the detailed window); never deletes, never overwrites edited text, never duplicates, nothing reaches the banner before approval | `true` / object; after switching on: `pnpm generate:importmap` + `migrate:create`. Check: *Privacy → Cookie review* → **Scan cookies** → "Waiting for approval: N" → **Review and approve** → **Approve and add** → the cookies are in Cookies → Cookie list (cookie-scanner.md) |
| `cookieScanner.adminLayout` | `'combined'` | one *Cookies* entry: *Review and approve* and (with `crawl`) *Site check* tabs on the `cookie-settings` global (`ui` fields, `CookieReviewTab` / `CookieSiteCheckTab`); `cookie-review` and `cookie-crawl` get `admin.group: false` (out of the nav, pages and API kept) | `'separate'`; no migration, `generate:importmap` |
| `fillEmptyLocales` | on | afterChange hooks: text saved in one language fills the empty languages of `cookie-settings` `cookies.purpose` / `cookies.duration` and `cookie-review` `purpose` / `retention`; never overwrites a language's own text | `false`; `{ 'cookie-settings': [...], 'cookie-review': [...] }` (`[]` = off); check: add a cookie in Polish, switch the locale to English → same purpose |
| `cookieScanner.approval` | on | `false` = per-entry review only (no view, endpoint or reminder); `{ unknownCategory, dashboard }` — category for cookies nothing knows (default `'marketing'`, must need consent), dashboard reminder | adds `change` + `needsDescription` to `cookie-review` → `migrate:create` when upgrading |
| `cookieScanner.declarations` / `.integrations` | built-ins only | the project's own cookies (`CookieDeclaration[]`), or `(defaults) => CookieIntegration[]` to add / change / drop integrations (`key`, `label`, `declarations`, `isEnabled(ctx)`) | e.g. a chat widget on when `ctx.integrations.chatId` is filled |
| `cookieScanner.access` / `.collectionOverrides` / `.labels` | editor+ / none / `en` + `pl` | who may scan; changes `cookie-review` like `consentLog.collectionOverrides`; admin labels per language (`CookieScanLabels`) | object or function |
| `cookieScanner.crawl` | off | browser pre-consent check through the shared scanner service (`services/cookie-crawler`, Coolify): **Check site** in the review box, `cookie-crawl` global (latest result only), `GET`/`POST /api/ipal/cookie-crawl`, `POST /api/ipal/cookie-crawl/results` (token), `violation` / `violationDetail` / `seenBeforeConsent` on `cookie-review`, `CookieCrawlAlert` on the dashboard, e-mail to *Cookie check → Warning e-mails to* | `true` / `CookieCrawlOptions`; env `IPAL_COOKIE_SCAN_URL` + `IPAL_COOKIE_SCAN_TOKEN`; `generate:importmap` + `migrate:create`. Check: the review box's **Check site** is enabled → click → "Last crawl …" with counts; `curl -X POST -H "Authorization: Bearer $IPAL_COOKIE_SCAN_TOKEN" $U/api/ipal/cookie-crawl` → 202 |
| `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` |
| `stats` | off | `stats-visits` collection, `POST /api/ipal/hit`, `/<admin>/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 |
| `indexNow` | `false` | `afterChange` hook (publish → IndexNow, production + https only) in the `pages.slug ?? 'pages'` collection and each one from `content` | `true` + `indexnow-key.txt` route |
| `siteSettingsFields` | none | **Custom** tab in Site Settings | `Field[]` |
| `integrationsFields` | none | **Custom** tab in Site Integrations | `Field[]` |
| `lightbox` | `false` | **Image viewer** group in the Form messages global (`notifications`) (image viewer labels: open, dialog, previous, next, close, counter — localized); read by `getNotificationTexts(...).lightbox` / `getSiteShell().lightboxTexts`. Postgres: `migrate:create` | omit = English fallbacks + the `texts` prop; `lightboxNotificationFields` for your own global; `globalOverrides.notifications` |
| `siteSettingsFields` | none | **Custom** tab in Site settings | `Field[]` |
| `integrationsFields` | none | **Custom** tab in Site integrations | `Field[]` |
| `globalOverrides` | none | changes the plugin's globals (`site-settings`, `site-integrations`, `cookie-settings`, `notifications`): an object merges `access` / `admin` / `hooks` key by key (your keys win, your hooks run after the plugin's), other keys replace; a function `(global) => global` takes over | e.g. `{ notifications: { access: { update: authenticated } } }`; the way to change the plugin globals' access or hooks |
| `revalidatePath` | none | `revalidatePath` from `next/cache` (injected): saving any plugin global revalidates the whole layout (`buildGlobalRevalidateHook`) | omit = globals change after the ISR window; once: `context: { disableRevalidate: true }` |
| `enabled` | `true` | `false` → collections, globals and fields stay (schema and migrations unchanged), but no plugin endpoints (`/api/ipal/*`), no `onInit` work and no admin components; `i18n` is validated anyway | `false`; check: `payload migrate:create` after switching produces no DROP TABLE |
@@ -81,20 +94,26 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| auth collection (`users`) | `{ slug, auth: true, useAsTitle: 'email' }`, when the project has none (slug: `access.authCollection` → `twoFactor.collectionSlug` → `admin.user` → `'users'`); with `access`: create/delete/unlock admin only, read/update admin or self | `access.authAccess`; your own collection with that slug | yours wins |
| `forms`, `form-submissions` | form-builder + ipal blocks `step`, `checkboxGroup`, `time` | `forms` | omit `forms` |
| `consent-records` | proof of consent (id, choices, policy version; `consentLog.collectionOverrides`) | `consentLog` | off by default |
| global `cookie-crawl` | latest browser crawl (status, counts, violations, third-party hosts) + e-mail recipients; read editor+, update admin | `cookieScanner.crawl` (`globalOverride`) | off by default |
| `cookie-review` | cookie scanner entries (`status` draft / accepted / rejected, `change` new / changed / gone, `needsDescription`; create/read/update editor+, delete admin) | `cookieScanner` | off by default |
| view `/admin/cookie-approval` | *Approve cookies*: everything waiting, grouped by category, one **Approve and add** | `cookieScanner.approval` | `approval: false` |
| `stats-visits` | visits without IP (admin reads/deletes; `stats.collectionOverrides`) | `stats` | off by default |
| global `site-settings` | General, Theme, [System Pages], [Emails], [Under construction], Search & AI, [Custom]; public read, write editor+ | `pages`, `content`, `forms.emailLayout`, `searchSettings` / `seo.searchSettings`, `siteSettingsFields` | always present; access/hooks/fields: `globalOverrides` |
| global `site-integrations` | Analytics, Turnstile, SMTP, IndexNow, [Custom]; admin only | `integrationsFields` | always present; `globalOverrides` |
| global `site-settings` | General, Theme, [System pages], [E-mails], [Maintenance], Search engines, [More]; public read, write editor+ | `pages`, `content`, `forms.emailLayout`, `searchSettings` / `seo.searchSettings`, `siteSettingsFields` | always present; access/hooks/fields: `globalOverrides` |
| global `site-integrations` | Analytics, Turnstile, SMTP, IndexNow, [More]; admin only | `integrationsFields` | always present; `globalOverrides` |
| global `cookie-settings` | banner texts, categories, cookie list; public read, write editor+ | `globalOverrides` | always present; `globalOverrides` |
| global `notifications` | form messages per language; public read, write editor+ | `globalOverrides` | always present; `globalOverrides` |
| global revalidation hook | `afterChange` on the four globals → `revalidatePath('/', 'layout')` | `revalidatePath` | omit `revalidatePath` |
| `POST /api/ipal/test-email` | SMTP/Graph test (admin only) | — | **currently always** |
| `POST /api/ipal/consent` | saves consent | `consentLog` | off by default |
| `POST /api/ipal/hit` | page view for stats | `stats` | off by default |
| `GET`/`POST /api/ipal/cookie-crawl`, `POST /api/ipal/cookie-crawl/results` | crawl status / start (editor+ or bearer token) / the scanner service's callback (token, running job only) | `cookieScanner.crawl` | off by default |
| `GET`/`POST /api/ipal/cookie-approval` | the approval list (`?locale=`) / approve (`{ ids? }`), editor+ | `cookieScanner.approval` (`access`) | `approval: false` |
| `GET`/`POST /api/ipal/cookie-scan` | integrations a scan covers / run a scan (`{ names? }`), editor+ | `cookieScanner` (`access`) | off by default |
| `localization` | from `i18n` | `i18n` | **currently always** |
| `routes.admin` | from `adminRoute` | `adminRoute` | — |
| `beforeChange` meta auto-fill hook | in `seo.collections` | `seo.autoFill` | `autoFill: false` |
| `afterChange` IndexNow hook | pages + content | `indexNow` | off by default |
| `onInit` | Cookie Settings button migration + log `[ipal] Plugin initialized.` (your `onInit` runs first) | — | **currently always** |
| `onInit` | Cookie banner button migration + log `[ipal] Plugin initialized.` (your `onInit` runs first) | — | **currently always** |
**Import map** (`@intecion/ipal-kit/admin#…`) — after every option change: `pnpm generate:importmap`
(`pnpm payload generate:importmap`), otherwise the panel is blank / a component is missing.
@@ -104,12 +123,17 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `AdminLogo`, `AdminIcon` | `graphics.Logo/Icon` | `whiteLabel` |
| `IntecionCredit` | `afterLogin`, `afterNavLinks` | `whiteLabel` and `credit !== false` |
| `StatsNavLink`, `StatsView` (`views.ipalStats`, `/stats`), `StatsWidget` (`beforeDashboard`) | nav, view, dashboard | `stats` (`dashboard: false` without the widget) |
| `CookieScanButton` | `beforeListTable` of `cookie-review` (with **Check site** when `crawl` is on) | `cookieScanner` |
| `CookieReviewTab`, `CookieSiteCheckTab` | `ui` fields in the `cookie-settings` tabs | `cookieScanner` with `adminLayout !== 'separate'` (Site check: `crawl`) |
| `CookieApprovalView` (+ client `CookieApprovalForm`) | `views.ipalCookieApproval`, path `/cookie-approval` | `cookieScanner` and `approval !== false` |
| `CookieCrawlAlert` | `beforeDashboard` | `cookieScanner` with `approval.dashboard !== false` ("Waiting for approval"), or `crawl` with `dashboard !== false` |
| `IntegrationAlerts` | `beforeDashboard` | **currently always** (renders nothing when everything works) |
| `IntegrationStatusBanner` | UI field in the Site Integrations tabs | always (with the global) |
| `IntegrationStatusBanner` | UI field in the Site integrations tabs | always (with the global) |
| `MaskedField` | SMTP / Turnstile secrets | always |
| `TestEmailButton` | Site Integrations → SMTP | always |
| `TestEmailButton` | Site integrations → SMTP | always |
| `MetaDescriptionCheck` | below `meta.description` | `seo` and `descriptionCheck !== false` |
| `RowLabel` | array row labels | only when the project uses `rowLabel(...)` (admin-ui) |
| `FaviconCheck` | below Site settings → Site icon (`afterInput`) | always (with the global); remove with a `globalOverrides['site-settings']` function |
| `RowLabel` | array row labels (Cookie banner categories and cookie list; your own `rowLabel(...)`) | always |
## 3. What the project wires itself
@@ -123,15 +147,15 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
| proxy | `src/proxy.ts` | `export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true })` + `export const config = { matcher: ['/((?!api\|admin\|_next\|.*\\..*).*)'] }` (a literal!) | `curl -sI $U/` → `/pl`; `curl -s -H 'Accept: text/markdown' $U/pl` → Markdown | i18n.md, PROGRAMISTA §2.6 |
| proxy (Next 15 / custom) | `middleware`/`proxy.ts` | `createLocaleMiddleware({ config, … })` (`/next/middleware` or the main entry) | as above | i18n.md |
| env validation | `src/instrumentation.ts` | `if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true, ipHeader: true }))` from `@intecion/ipal-kit/env` | remove a variable → startup fails with the list of missing ones | env.md |
| Next config | `next.config.ts` | `withPayload({ images: buildImagesConfig(), htmlLimitedBots: /Googlebot\|Bingbot…/i, headers: async () => [{ source: '/:path*', headers: buildSecurityHeaders({ hsts }) }, ...buildUploadSecurityHeaders()] })` | `curl -sI $U/pl \| grep -i 'x-content-type\|strict-transport'` | security.md, storage.md, PROGRAMISTA §2.9 |
| CSP | `next.config.ts` | `buildCsp({ mode: 'report-only', … })` → later `enforce` | browser console without violations | security.md |
| Next config | `next.config.ts` | `withPayload(withSecurityConfig({ images: buildImagesConfig(), htmlLimitedBots: /Googlebot\|Bingbot…/i, headers: async () => [{ source: '/:path*', headers: buildSecurityHeaders({ hsts, csp }) }, { source: '/admin/:path*', headers: buildAdminCspHeaders(csp) }, ...buildUploadSecurityHeaders()] }))` | `curl -sI $U/pl \| grep -iE 'x-content-type\|strict-transport\|x-powered-by'` (no `x-powered-by`) | security.md, storage.md, PROGRAMISTA §2.9 |
| CSP | `next.config.ts`, `src/app/api/csp-report/route.ts` | `csp = { mode: 'report-only', reportUri: '/api/csp-report', r2Url, <flags> }` in `buildSecurityHeaders` + `buildAdminCspHeaders`; route `export const POST = createCspReportRoute()`; after clean reports `mode: 'enforce'` | `curl -sI $U/pl \| grep -i content-security-policy-report-only`; browser console and `[csp]` log lines without violations | security.md |
| data / routes | `src/lib/content.ts` | `export const { … } = createContentHelpers({ config, content, i18n: i18nConfig, baseUrl, markdownAlternate: true, summaryField: 'aiSummary', mcp: { serverName } })` | `pnpm tsc --noEmit` | frontend.md, PROGRAMISTA §2.7 |
| layout | `app/(frontend)/[locale]/layout.tsx` | `const shell = await getSiteShell(locale)`; `<SiteProviders shell={shell} logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />} theme stats>` | HTML: `<script type="application/ld+json">` (WebSite+Organization), cookie banner | frontend.md, consent.md |
| theme | layout | `<SiteProviders theme>` (or `<ThemeScript {...shell.theme} />` from `/rsc`), `<html suppressHydrationWarning>`; switcher `<ThemeSwitcher>` (`/client`) | `data-theme` on `<html>` before hydration | theme.md |
| catch-all | `app/(frontend)/[locale]/[[...slug]]/page.tsx` | `export const revalidate = 3600`; `const route = createPageRoute(content, { blocks, notFound, permanentRedirect, blockProps })`; `export default route.Page`; `generateMetadata`, `generateStaticParams` | `curl -s $U/pl/<slug>` 200; change the slug → the old one gives 308 | frontend.md, pages.md |
| 404 | `[locale]/not-found.tsx` + `notFoundView.ts` | `export default createNotFoundPage(content, { load: loadNotFoundView })`; `'use server'` `renderNotFoundView(content, { blocks }, locale)` | `curl -sI $U/pl/xyz` → 404 with content from System Pages | pages.md |
| 404 | `[locale]/not-found.tsx` + `notFoundView.ts` | `export default createNotFoundPage(content, { load: loadNotFoundView })`; `'use server'` `renderNotFoundView(content, { blocks }, locale)` | `curl -sI $U/pl/xyz` → 404 with content from System pages | pages.md |
| sitemap | `app/sitemap.xml/route.ts` | `export { sitemapRoute as GET } from '@/lib/content'` + `dynamic = 'force-dynamic'` (or `sitemap.ts` with `sitemap` — never both; only `sitemapRoute` splits a large site into a `<sitemapindex>` with `?part=N` parts above 10 000 URLs) | `curl -s $U/sitemap.xml` (hreflang, XSL style); `curl -sI` → `Cache-Control: public, max-age=0, s-maxage=3600…`; a database error → 503 + `Retry-After` | seo.md |
| robots | `app/robots.ts` | `export { getRobots as default } from '@/lib/content'` + `force-dynamic` (AI crawler policy from Site Settings → Search & AI); `robots` (sync) ignores the panel | `curl -s $U/robots.txt` (Sitemap:, AI bots, `User-agent` groups from the panel) | seo.md |
| robots | `app/robots.ts` | `export { getRobots as default } from '@/lib/content'` + `force-dynamic` (AI crawler policy from Site settings → Search engines); `robots` (sync) ignores the panel | `curl -s $U/robots.txt` (Sitemap:, AI bots, `User-agent` groups from the panel) | seo.md |
| manifest | `app/manifest.ts` | `export { manifest as default }` + `force-dynamic` | `curl -s $U/manifest.webmanifest` | seo.md |
| llms | `app/llms.txt/route.ts`, `app/llms-full.txt/route.ts` | `export { llmsRoute as GET }` / `llmsFullRoute` + `force-dynamic` | `curl -s $U/llms.txt` | seo.md |
| Markdown | `app/md/[locale]/[[...slug]]/route.ts` | `export { markdownRoute as GET }` + `force-dynamic` | `curl -s $U/md/pl` | content.md |
@@ -142,16 +166,19 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
| Pages | `src/collections/Pages.ts` | `buildSlugField({ from: 'title' })`, `buildNoindexField()`, `buildSummaryField()`, `slugHistory` field + `trackSlugHistoryHook`, `buildRevalidateHook({ revalidatePath, config })` → `afterChange`/`afterDelete` | edit in the panel → the page refreshes without a deploy | slug.md, hooks.md, seo.md |
| Pages — protection | as above | `beforeDelete: [buildPreventDeleteSystemPage({ settingsSlug: 'site-settings' })]`; `setPublishedAtHook`, `buildCrossLocaleFieldSync(...)` as needed | delete the homepage → error | hooks.md |
| Media | `src/collections/Media.ts` | `upload: { focalPoint: true }`, `hooks.beforeOperation: [normalizeFilenameHook, buildOptimizeUploadHook(), buildMediaPlaceholderHook()]`, fields `buildOptimizeUploadField()`, `buildMediaPlaceholderField()`, `alt` | upload `Zdjęcie Ś.JPG` → `zdjecie-s.jpg`, placeholder in the document | media.md |
| image lightbox (optional) | layout + blocks | `lightbox: true` in `ipalKit`; `<SiteProviders shell lightbox>`; `<LightboxTrigger group image={lightboxImage(media, { size: 'hero' })}>` around the thumbnail (`/client`); `<RenderRichText lightbox>` | keyboard: Tab to a thumbnail, Enter → dialog with focus on Close, ←/→, Esc → focus back; Network: a resized file on a phone | lightbox.md |
| image on the frontend | `Media` primitive | `<Image {...mediaImageProps(media, { sizes })} />`, video `videoProps` | blur before load | media.md |
| storage | `payload.config.ts` | `buildR2Storage(['media'], { s3Storage })` — always (without `R2_*` = local disk) | upload → URL from `R2_PUBLIC_URL` | storage.md |
| e-mail | `payload.config.ts` | `email: mailAdapter()` (SMTP from the panel / Graph from env; also `panelSmtpAdapter`, `graphAdapter`, `sendEmail` from `/server`) | Site Integrations → SMTP → **Send test** | email.md |
| e-mail | `payload.config.ts` | `email: mailAdapter()` (SMTP from the panel / Graph from env; also `panelSmtpAdapter`, `graphAdapter`, `sendEmail` from `/server`) | Site integrations → SMTP → **Send test** | email.md |
| forms — action | `app/(frontend)/[locale]/actions.ts` | `'use server'`; `export const sendForm = createSubmitAction({ getCachedPayload, headers })` (`/server`) | submit → document in Form Submissions + e-mails | forms.md, skill **ipal-form** |
| forms — render | form block | `<RenderForm form={form} action={sendForm} locale={locale} texts={formTexts} classNames={formClasses} />` (`/rsc`) | form from the panel, Turnstile, message from Notifications | forms.md |
| Turnstile | panel / env | `SiteProviders` wires `TurnstileProvider`; keys in Site Integrations → Turnstile or env; server: `verifyTurnstile` (`/server`) | widget in the form; dashboard alert on a bad key | turnstile.md |
| Turnstile | panel / env | `SiteProviders` wires `TurnstileProvider`; keys in Site integrations → Turnstile or env; server: `verifyTurnstile` (`/server`) | widget in the form; dashboard alert on a bad key | turnstile.md |
| consent | layout + policy page | banner via `SiteProviders`; table `<CookieTable rows={…} labels={…} />` (`/rsc`) from `getCookieTable` | `ipal-consent-check`; delete the consent cookie → the banner comes back | consent.md |
| cookie crawl | config + env + service | `cookieScanner: { crawl: true }`, `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN`, site in the service's `IPAL_CRAWLER_SITES`; optional Coolify scheduled task `curl -X POST -H "Authorization: Bearer $IPAL_COOKIE_SCAN_TOKEN" $U/api/ipal/cookie-crawl` | **Check site** → "Last crawl …: N pages, N violations"; *Privacy → Cookie check* | cookie-scanner.md → Browser crawl |
| cookie list | config | `cookieScanner: true` (+ `declarations` for embeds/chat), `generate:importmap`, `migrate:create` | *Cookie review* → **Scan cookies** → **Review and approve** → **Approve and add** → Cookies → Cookie list; `<CookieBanner settings="detailed">` and `<CookieTable>` list it | cookie-scanner.md |
| proof of consent | config + layout | `consentLog: true` + `logEndpoint="/api/ipal/consent"` | after a click, a document in Consent Records | consent.md |
| stats | config + layout | `stats: true` + `<SiteProviders stats={{ locale }}>` (or `<PageStats locale />` inside `ConsentProvider`) | `/<admin>/stats`; `POST /api/ipal/hit` request in Network | stats.md |
| analytics | layout | `SiteProviders` wires `Analytics` (ID from Site Integrations → Analytics); Consent Mode: `analytics={{ consentMode: 'basic' }}` = no request to Google before consent, default `'advanced'` = the Google tag loads at once with every signal `denied` | Meta/other pixels only after consent; in `basic` no `gtm.js` / `gtag/js` in Network before consent | analytics.md, gtm-meta-pixel.md |
| analytics | layout | `SiteProviders` wires `Analytics` (ID from Site integrations → Analytics); Consent Mode: `analytics={{ consentMode: 'basic' }}` = no request to Google before consent, default `'advanced'` = the Google tag loads at once with every signal `denied` | Meta/other pixels only after consent; in `basic` no `gtm.js` / `gtag/js` in Network before consent | analytics.md, gtm-meta-pixel.md |
| extra JSON-LD | layout / `lib/content` | `jsonLd={[buildNavigationJsonLd(…)]}`; `siteJsonLd` → `buildLocalBusinessJsonLd` | Rich Results Test | seo.md |
| links and navigation | components | `buildLinkField`/`buildLinksField` in fields; `resolveNav`, `resolveLink`, `getSystemLinks` | a menu link still works after a slug change | links.md, skill **ipal-nav** |
| blocks | `src/blocks/registry.ts` | `blocks` for `createPageRoute`; fields `buildSectionHeaderField`, `buildSectionSettingsField` | block visible on the page | blocks.md, skill **ipal-block** |
@@ -165,7 +192,7 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
| key | use |
|---|---|
| `getCachedPayload` | `await getCachedPayload()` — Local API (actions, routes) |
| `getSettings(locale)` | Site Settings (`depth: 1`: relations as documents, theirs as ids; `settingsDepth` option changes it) |
| `getSettings(locale)` | Site settings (`depth: 1`: relations as documents, theirs as ids; `settingsDepth` option changes it) |
| `getConfiguredLocales()` | layout: `notFound()` for an unknown language |
| `resolveRoute`, `getEntries`, `getNotFoundPage`, `resolvePageRedirect` | your own page / archive instead of `createPageRoute` |
| `generatePageMetadata`, `generateStaticParams`, `getPageJsonLd` | used by `createPageRoute`; call by hand in your own pages |
@@ -195,9 +222,10 @@ and what throws without `i18n`: frontend.md. `SiteProviders` props: `shell`, `ba
| `R2_BUCKET`, `R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY` | `storage: true` + production, or when at least one is set (all or none) | local disk (in prod files disappear on redeploy); incomplete set → warning | env |
| `R2_PUBLIC_URL` | optional; required only with `ipalEnvRules({ storage: { requirePublicUrl: true } })` (then like the other `R2_*`); absolute URL in prod when set | empty (default) → media served by the app at `/api/media/file/…` (Media needs `access.read: () => true`); set it only for a media domain on Cloudflare (storage.md); `R2_PUBLIC_URL` alone in dev = media read-only; `/media` allowed outside prod; also used by `buildImagesConfig`, `MediaPreconnect`, CSP | env |
| `GRAPH_TENANT_ID`, `GRAPH_CLIENT_ID`, `GRAPH_CLIENT_SECRET`, `GRAPH_SENDER` | `emailGraph: true` / Graph transport in the panel | `mailAdapter` falls back to SMTP from the panel (logged) | env (agency Exchange) |
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | `turnstile: true` (names: `siteKeyVar`/`secretVar`) | fallback for keys from Site Integrations → Turnstile; neither set → Turnstile off | panel (takes precedence) or env |
| `INDEXNOW_KEY` | no | key from Site Integrations → IndexNow (generated) | env or panel |
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | `turnstile: true` (names: `siteKeyVar`/`secretVar`) | fallback for keys from Site integrations → Turnstile; neither set → Turnstile off | panel (takes precedence) or env |
| `INDEXNOW_KEY` | no | key from Site integrations → IndexNow (generated) | env or panel |
| `IPAL_IP_HEADER` | `ipHeader: true` + production | rate limit trusts any IP header (spoofing) + warning in prod | env: `cf-connecting-ip` (Cloudflare) / `x-forwarded-for` (Traefik/nginx) |
| `IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN` | `cookieScanner.crawl` (`ipalEnvRules({ cookieCrawl: true })` requires both in production; token ≥ 16 chars) | **Check site** disabled, the box names the missing variable | env; the token also goes into the scanner service's `IPAL_CRAWLER_SITES` as `host=token` |
| `IPAL_NOINDEX` | no; `1`/`true`/`yes` **staging/preview only** | — (when set: robots Disallow, meta noindex, `X-Robots-Tag`, IndexNow sends nothing) | staging env |
| `NEXT_PHASE` | set by Next | only tells `next build` from runtime: during the build an unreachable database gives an empty sitemap; at runtime the sitemap throws (route → 503) | do not set by hand |
| `NEXT_RUNTIME` | set by Next | `instrumentation.ts` checks for `nodejs`; missing (scripts, seed) → `buildRevalidateHook` does not revalidate | do not set by hand |
+134 -31
View File
@@ -12,7 +12,7 @@ project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/d
|---|---|---|
| `ipalKit(options)` | `@intecion/ipal-kit` | Payload 3 plugin (`plugins: [ipalKit({...})]`) — the only wiring point: adds globals (SiteSettings, SiteIntegrations, CookieSettings, Notifications), roles, enforced 2FA, SEO, forms, i18n (localization), white-label, stats, consent log, `/api/ipal/*` endpoints; no auth collection → injects a simple `users`. Validates `i18n` right away (fail fast). `enabled: false` = schema stays, behaviour off. |
**Types:** `IpalOptions` — `ipalKit()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IpalGlobalSlug` — see Payload globals below.
**Types:** `IpalOptions` — `ipalKit()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IpalGlobalSlug` — see Payload globals below.
## Admin (import map) (`admin`, `branding`, `admin-ui`, `globals/SiteIntegrations`) — details: `node_modules/@intecion/ipal-kit/docs/white-label.md`, `…/docs/integrations.md`, `…/docs/email.md`, `…/docs/links.md`
@@ -25,6 +25,13 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `RowLabel` | `@intecion/ipal-kit/admin` | Array row title in the panel taken from the row content (e.g. "Fast delivery" instead of "Item 01"). Do not wire by hand — use `rowLabel()`; after adding, `pnpm generate:importmap`. |
| `AdminLogo` | `@intecion/ipal-kit/admin` | Server Component: large panel logo (login screen) from SiteSettings `logo`, fallback `siteName`. Injected by the plugin with `whiteLabel`; after turning the option on, `pnpm generate:importmap`. |
| `AdminIcon` | `@intecion/ipal-kit/admin` | Server Component: small panel nav icon from SiteSettings `favicon`, fallback initials. Injected by the plugin with `whiteLabel`; after turning the option on, `pnpm generate:importmap`. |
| `CookieReviewTab` | `@intecion/ipal-kit/admin` | Client: the *Review and approve* tab of *Cookies* — scan box + approval list inline (reloads after approving; waits while the form has unsaved changes) + link to the review entries. Injected by `addCookieScannerTabs` (combined layout); `pnpm generate:importmap`. |
| `CookieSiteCheckTab` | `@intecion/ipal-kit/admin` | Client: the *Site check* tab — start a check, status, latest violations, link to the warning e-mails. Injected with `crawl` in the combined layout. |
| `CookieApprovalView` | `@intecion/ipal-kit/admin` | Server Component: the *Approve cookies* view at `/admin/cookie-approval` — everything waiting, grouped by consent category, one **Approve and add**. Injected with `cookieScanner` (unless `approval: false`); after turning it on, `pnpm generate:importmap`. |
| `CookieApprovalForm` | `@intecion/ipal-kit/admin` | Client part of the view: tick boxes, markers (New / Changed / Needs description), Edit links, the button. Props `pending`, `gone`, `unknownCategory`, `labels?`, `adminRoute?` — reuse it in your own view. |
| `CookieCrawlAlert` | `@intecion/ipal-kit/admin` | Server Component: dashboard warning — "Waiting for approval: N" with a link to the approval view, and with the crawl violations or a failed crawl; renders nothing otherwise. Props `approval`, `crawl`. Injected with `cookieScanner` (`approval.dashboard: false` / `crawl.dashboard: false` drop its parts); after turning it on, `pnpm generate:importmap`. |
| `CookieScanButton` | `@intecion/ipal-kit/admin` | "Scan cookies" box above the *Cookie review* list: integrations in use, optional extra names, runs `POST /api/ipal/cookie-scan`. Injected by the plugin with `cookieScanner`; after turning it on, `pnpm generate:importmap`. |
| `TotpRedirectProvider` | `@intecion/ipal-kit/admin` | Client admin provider: sends a user without TOTP to `/admin/setup-totp?back=…` and a user whose session has not passed TOTP to `/admin/verify-totp?back=…` (path read in the browser; never redirects away from those screens or logout; renders nothing while redirecting). Injected by the plugin with `twoFactor` in place of the package's header-based provider; swap with `twoFactor.provider`. After upgrading, `pnpm generate:importmap`. Check: a new admin lands on `setup-totp?back=%2Fadmin` with the QR code. Props type `TotpRedirectProviderProps` (`forceSetup`) |
| `IntecionCredit` | `@intecion/ipal-kit/admin` | The line "Technology supported by Intecion.com" below the nav and below the login form (`variant: 'nav' \| 'login'`). Injected by the plugin with `whiteLabel`; turn off: `whiteLabel: { credit: false }`. |
## Readable array rows in the panel (`admin-ui`) — details: `node_modules/@intecion/ipal-kit/docs/links.md`
@@ -50,7 +57,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `hasMinimumRole(user, minimum)` | `@intecion/ipal-kit` | Predicate → `boolean`: whether the user has a role ≥ `minimum` (reads `user.roles` safely). For your own access logic/hooks. |
| `isAdmin(user)` | `@intecion/ipal-kit` | Predicate → `boolean`: `admin` role. |
| `isEditor(user)` | `@intecion/ipal-kit` | Predicate → `boolean`: `editor` or higher. |
| `userMeetsRole(req, minimum)` | `@intecion/ipal-kit` | Predicate → `boolean` with `req` (`{ payload, user }`): role ≥ `minimum`, **or** any logged-in user when the user's auth collection has no `roles` field (the project omitted `access`). The plugin's staff features use it (Site Integrations, settings globals, test e-mail, stats, consent records, form submissions). Use it in your own access when the project may run without roles. |
| `userMeetsRole(req, minimum)` | `@intecion/ipal-kit` | Predicate → `boolean` with `req` (`{ payload, user }`): role ≥ `minimum`, **or** any logged-in user when the user's auth collection has no `roles` field (the project omitted `access`). The plugin's staff features use it (Site integrations, settings globals, test e-mail, stats, consent records, form submissions). Use it in your own access when the project may run without roles. |
| `ROLE_HIERARCHY` | `@intecion/ipal-kit` | Constant `['user', 'editor', 'admin']` (lowest first) — a higher role meets the requirements of a lower one. The plugin injects the `roles` field into the auth collection (`access.authCollection`). |
| `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. |
| `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. |
@@ -66,6 +73,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `useAccessibility()` | `@intecion/ipal-kit/client` | Hook → `{ state, set(key, value), reset() }` — for your own accessibility UI. Inside `AccessibilityProvider`. |
| `A11Y_COOKIE` | `@intecion/ipal-kit` | Preferences cookie name: `'a11y-prefs'` — read it in SSR to set attributes without a flash. |
| `A11Y_DEFAULT` | `@intecion/ipal-kit` | Default `A11yState` (everything off, `contrast: 'default'`, `textSize: 0`, `lineHeight: 0`). |
| `A11Y_DEFAULT_TEXTS` | `@intecion/ipal-kit/client` | Accessibility widget texts per language (`en`, `pl`); the widget's `locale` prop picks one, `texts` wins |
| `parseA11y(raw)` | `@intecion/ipal-kit` | Cookie value → `A11yState` (`A11Y_DEFAULT` on error). For SSR in the layout. |
| `serializeA11y(state)` | `@intecion/ipal-kit` | `A11yState` → JSON string for the cookie. |
| `a11yAttributes(state)` | `@intecion/ipal-kit` | `A11yState` → `{ 'data-a11y-*': string \| null }` (null = remove the attribute). To set attributes on `<html>` in SSR. |
@@ -109,14 +117,14 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `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<ConsentTexts>`; pass to `ConsentProvider texts`. |
| `getCookieTable({ payload, locale? })` | `@intecion/ipal-kit` | Server: Cookie Settings → Cookies rows in one language → `Promise<CookieTableRow[]>` (does not throw) — for `CookieTable`. |
| `getCookieTable({ payload, locale? })` | `@intecion/ipal-kit` | Server: Cookies → Cookie list rows in one language → `Promise<CookieTableRow[]>` (does not throw) — for `CookieTable`. |
| `setDefaultConsent(state)` | `@intecion/ipal-kit` | Google Consent Mode `consent default` (with `wait_for_update`). `Analytics` calls it itself before loading Google tags — do not call. |
| `updateConsent(state)` | `@intecion/ipal-kit` | Google Consent Mode `consent update` after the decision. `useConsent` calls it itself — do not call. |
| `parseConsent(raw, version?)` | `@intecion/ipal-kit` | Consent cookie value → `ConsentState \| null` (null: missing, error or a different policy version). For server-side gating. |
| `readConsentRecord(raw, version?)` | `@intecion/ipal-kit` | Like `parseConsent`, but the full record `{ id, state, timestamp, version } \| null`. |
| `serializeConsent(state, version?, id?)` | `@intecion/ipal-kit` | `ConsentState` → encoded cookie value (with timestamp and version). Usually the provider does this. |
| `CONSENT_COOKIE` | `@intecion/ipal-kit` | Consent cookie name: `'cookie-consent'`. |
| `CONSENT_VERSION` | `@intecion/ipal-kit` | Default policy version: `1` (overridden in the panel: Cookie Settings → Policy version; changing it invalidates old consents). |
| `CONSENT_VERSION` | `@intecion/ipal-kit` | Default policy version: `1` (overridden in the panel: Cookies → Policy version; changing it invalidates old consents). |
| `CONSENT_MAX_AGE` | `@intecion/ipal-kit` | Consent cookie lifetime in seconds: 180 days. |
| `CONSENT_CATEGORIES` | `@intecion/ipal-kit` | `['necessary', 'functional', 'analytics', 'marketing']`; `necessary` always on. |
| `DEFAULT_CONSENT` | `@intecion/ipal-kit` | State before the decision: only `necessary: true`. |
@@ -126,20 +134,80 @@ 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`, `<CookieTable locale>` defaults).
**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.
## Cookie scanner (`consent/scanner`) — details: `node_modules/@intecion/ipal-kit/docs/cookie-scanner.md`
Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection, endpoints, admin box and approval view. The exports are building blocks for a CLI, a scheduled job or your own admin view.
**One approval** (`cookieScanner.approval`, on by default):
| Export | Import from | What it does / when |
|---|---|---|
| `loadCookieApproval({ payload, locale, req? })` | `@intecion/ipal-kit` | What waits (`pending`: drafts and accepted cookies marked changed) and what is no longer found (`gone`), texts in one content locale → `CookieApprovalList` of `CookieApprovalItem`s. |
| `approveCookies({ payload, ids?, unknownCategory?, addToList?, req? })` | `@intecion/ipal-kit` | **Approve and add**: accepts the pending entries (all, or `ids`) and adds them to Cookies → Cookie list in every locale — no duplicates (`sameCookie`), editor text and categories kept, unknown ones get `unknownCategory` + "Needs description" → `CookieApprovalResult`. |
| `countPendingCookies(payload)` / `PENDING_WHERE` | `@intecion/ipal-kit` | How many cookies wait (dashboard, e-mail) / the `Where` for them. |
| `buildCookieApprovalEndpoints(options)` | `@intecion/ipal-kit` | `GET`/`POST /api/ipal/cookie-approval` — the plugin wires them; call only to wire by hand. |
| `flagGoneEntries({ payload, keep, where, req? })` | `@intecion/ipal-kit` | Marks entries a scan no longer finds `change: 'gone'` (never deletes) → count. |
| `nextChange(existing, changed)` | `@intecion/ipal-kit` | Pure marker rule → `CookieChange` (`'new' \| 'changed' \| 'gone'`) or null. |
| `addCookieScannerTabs(global, { approval, crawl, labels, unknownCategory? })` | `@intecion/ipal-kit` | Adds the *Review and approve* / *Site check* tabs (`ui` fields) to a global's `tabs` field — the plugin does it for `cookie-settings` (`adminLayout: 'combined'`). |
| `sameCookie(a, b)` | `@intecion/ipal-kit` | Same name, or one is a pattern covering the other (`_ga_*` / `_ga_XYZ`). |
| `COOKIE_APPROVAL_PATH` / `COOKIE_APPROVAL_VIEW_PATH` / `DEFAULT_UNKNOWN_CATEGORY` | `@intecion/ipal-kit` | `'/ipal/cookie-approval'` / `'/cookie-approval'` (admin route) / `'marketing'`. |
**Types:** `CookieApprovalOptions` (`approval`), `CookieApprovalItem`, `CookieApprovalList`, `CookieApprovalResult`, `CookieChange`.
| Export | Import from | What it does / when |
|---|---|---|
| `runCookieScan({ payload, plugin, options?, names?, req? })` | `@intecion/ipal-kit` | The whole scan as `POST /api/ipal/cookie-scan` runs it → `{ enabled, summary }` (`plugin` = `{ localeCount, stats }`). |
| `collectCookieFindings({ ctx, integrations?, declarations?, names?, database?, databaseCategories? })` | `@intecion/ipal-kit` | Findings for the project without writing: enabled integrations' cookies, project declarations, extra names looked up (declarations → built-ins → Open Cookie Database → `unknown`). |
| `applyCookieFindings({ payload, findings, req?, collection? })` | `@intecion/ipal-kit` | Writes findings to `cookie-review` as drafts: new names created, existing ones updated only where the editor did not change the value; status untouched, nothing deleted → `CookieScanSummary`. |
| `cookieScanContext(payload, plugin, req?)` | `@intecion/ipal-kit` | Builds the `CookieScanContext` (Site integrations + module switches). |
| `parseCookieNames(input)` | `@intecion/ipal-kit` | Text box / array → clean, unique names (max 200; no spaces, `;`, `,`, `=`). |
| `mergeCookieReview(current, previous, next)` | `@intecion/ipal-kit` | Pure "never overwrite an edit" rule, per field and per locale. |
| `suggestionFor(finding, locales)` | `@intecion/ipal-kit` | A finding's values resolved per locale (own language → English → first). |
| `addToCookieList({ payload, entry, req? })` | `@intecion/ipal-kit` | What accepting does: adds the row to Cookies → Cookie list or fills only its empty text, every locale → `'added' \| 'filled' \| 'unchanged'`. |
| `loadCookieDatabase()` / `indexCookieDatabase(rows)` / `lookupCookie(index, name, categories?)` | `@intecion/ipal-kit` | Bundled Open Cookie Database (Apache-2.0, loaded on first use): exact name, then the longest wildcard prefix → `CookieFinding \| null`. |
| `DEFAULT_DATABASE_CATEGORIES` | `@intecion/ipal-kit` | Database → consent category map (Functional → `functional` on purpose; override with `cookieScanner.databaseCategories`). |
| `DEFAULT_COOKIE_INTEGRATIONS` | `@intecion/ipal-kit` | Built-in declarations: consent cookie, admin login, `NEXT_LOCALE`, `ipal_vid`, GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok, Turnstile — each with its `isEnabled` check. |
| `cookieNameMatches(pattern, name)` | `@intecion/ipal-kit` | `*` at the end = prefix, else exact. |
| `buildCookieReviewCollection(options)` / `buildCookieScanEndpoints(options, plugin)` | `@intecion/ipal-kit` | The collection and the GET/POST endpoints — the plugin wires them with `cookieScanner`; call only to wire by hand. |
| `COOKIE_REVIEW_SLUG` / `COOKIE_SCAN_PATH` | `@intecion/ipal-kit` | `'cookie-review'` / `'/ipal/cookie-scan'`. |
| `COOKIE_SCAN_LABELS` / `mergeCookieScanLabels(overrides)` | `@intecion/ipal-kit` | Admin labels (`en`, `pl`) and the merge `cookieScanner.labels` uses. |
**Browser crawl** (`cookieScanner.crawl`; the browser runs in the shared service `services/cookie-crawler`, never in the site):
| Export | Import from | What it does / when |
|---|---|---|
| `buildCookieCrawlGlobal(labels)` / `buildCookieCrawlEndpoints({ labels, options, plugin })` | `@intecion/ipal-kit` | The `cookie-crawl` global (latest result only) and the three crawl endpoints — the plugin wires them with `crawl`; call only to wire by hand. |
| `resolveCrawlConfig(crawlOptions, payload)` | `@intecion/ipal-kit` | Options → env (`IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN`) → `serverURL` / `NEXT_PUBLIC_SERVER_URL` → `ResolvedCrawlConfig` (null = missing). |
| `parseCrawlResult(body)` | `@intecion/ipal-kit` | Validates the service's JSON → `CrawlResult` (`CrawlObservation`, `CrawlRequest`) or null; junk dropped. |
| `ingestCrawlResult({ payload, result, options, config, labels, plugin, req? })` | `@intecion/ipal-kit` | Applies a result: clears the previous flags, drafts for new names (same merge rules), `seenBeforeConsent` / `violation` / `violationDetail` → `CrawlIngestSummary`. |
| `finishCrawl({ payload, labels, result, summary?, siteUrl?, req? })` | `@intecion/ipal-kit` | Writes the `cookie-crawl` global (done / failed) and sends the e-mail warning when recipients are set. |
| `findCrawlViolations({ observations, requests, categoryOf, consentMode?, trackerHosts? })` | `@intecion/ipal-kit` | Pure rule: stored before consent and not `necessary` (unclassified counts), tracker requests before consent → `CrawlViolation[]`. |
| `DEFAULT_TRACKER_HOSTS` / `GOOGLE_TAG_HOSTS` | `@intecion/ipal-kit` | Request hosts that are violations before consent; Google's only with `consentMode: 'basic'`. |
| `sendCrawlWarning({ payload, labels, siteUrl, summary, to })` | `@intecion/ipal-kit` | The warning e-mail through `payload.sendEmail` (the project's mail adapter); never throws. |
| `bearerMatches(header, token)` | `@intecion/ipal-kit` | Constant-time `Authorization: Bearer` check. |
| `COOKIE_CRAWL_SLUG` / `COOKIE_CRAWL_PATH` / `COOKIE_CRAWL_RESULTS_PATH` | `@intecion/ipal-kit` | `'cookie-crawl'` / `'/ipal/cookie-crawl'` / `'/ipal/cookie-crawl/results'`. |
| `COOKIE_SCAN_URL_ENV` / `COOKIE_SCAN_TOKEN_ENV` | `@intecion/ipal-kit` | `'IPAL_COOKIE_SCAN_URL'` / `'IPAL_COOKIE_SCAN_TOKEN'`. |
**Types:** `CookieScannerOptions` (the option), `CookieDeclaration`, `CookieIntegration`, `CookieScanContext`, `CookieFinding`, `CookieFindingSource`, `CookieStorage`, `LocalizedText`, `CookieScanSummary`, `CookieReviewValues`, `CookieDatabaseIndex`, `CookieScanLabels`, `OpenCookieCategory`, `CookieObservation` (a name with `storage` / `domain` for `collectCookieFindings`), `CookieReviewEntryRef` (`applyCookieFindings` `entries`); crawl: `CookieCrawlOptions`, `ResolvedCrawlConfig`, `CrawlResult`, `CrawlObservation`, `CrawlRequest`, `CrawlViolation`, `CrawlIngestSummary`.
## Under construction (`construction`) — details: `node_modules/@intecion/ipal-kit/docs/construction.md`
| Export | Import from | What it does / when |
|---|---|---|
| `ConstructionNotice` | `@intecion/ipal-kit/client` | "Under construction" popup: `{ mode, classNames? }` — opens after a redirect from a blocked address (`?notice=construction`) and on a click on a link to an unavailable page; texts from the panel, renders nothing when the mode is off. In `[locale]/layout.tsx` with `mode={await getConstructionMode(locale)}`. |
| `ConstructionNotice` | `@intecion/ipal-kit/client` | "Under construction" popup: `{ mode, classNames?, locale?, closeLabel? }` — with no button text in the panel the button shows `×` and gets a screen-reader name in the page language ("Close" / "Zamknij"; `locale` defaults to `mode.locale`, `closeLabel` overrides the text); opens after a redirect from a blocked address (`?notice=construction`) and on a click on a link to an unavailable page; texts from the panel, renders nothing when the mode is off. In `[locale]/layout.tsx` with `mode={await getConstructionMode(locale)}`. |
| `isPathAllowed(pathname, allowedPaths)` | `@intecion/ipal-kit` | Whether the path is allowed in under-construction mode (exact match, no trailing `/`) → `boolean`. `createPageRoute` uses it itself — by hand only in your own routes. |
| `isPathVisibleIn(mode, pathname)` | `@intecion/ipal-kit` | `true` when the mode is off or the path is allowed — the rule behind `isPathVisible` from `createContentHelpers`. For your own routes when you already hold the `ConstructionMode`. |
| `pathOf(url)` | `@intecion/ipal-kit` | Pathname of an absolute or relative URL — feed a result URL to a `PathVisibility` check. |
| `constructionNoticeHref(homePath)` | `@intecion/ipal-kit` | Redirect address for a blocked page: `${homePath}?notice=construction`. `createPageRoute` uses it itself. |
| `CONSTRUCTION_NOTICE_PARAM` | `@intecion/ipal-kit` | Name of the query parameter that opens the popup: `'notice'` (value `construction`). |
**Types:** `ConstructionMode` (root and `/client`) — `{ enabled, allowedPaths, homePath, texts }` from `getConstructionMode(locale)`; `PathVisibility` — `(path, locale) => boolean | Promise<boolean>` (`isPathVisible` from `createContentHelpers`; the `isPathVisible` option of the Markdown, MCP and search routes); `ConstructionNoticeClassNames` (`/client`) — popup classes.
**Types:** `ConstructionMode` (root and `/client`) — `{ enabled, allowedPaths, homePath, locale, texts }` from `getConstructionMode(locale)`;
`CONSTRUCTION_CLOSE_LABEL`, `CONSTRUCTION_CLOSE_LABEL_PL`, `constructionCloseLabel(locale?)` (root and `/client`) — the close button's screen-reader name; `PathVisibility` — `(path, locale) => boolean | Promise<boolean>` (`isPathVisible` from `createContentHelpers`; the `isPathVisible` option of the Markdown, MCP and search routes); `ConstructionNoticeClassNames` (`/client`) — popup classes.
## Content and routing (`content`) — details: `node_modules/@intecion/ipal-kit/docs/content.md`
@@ -147,12 +215,12 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|---|---|---|
| `resolveRoute({ payload, locale, segments, page, content, draft? })` | `@intecion/ipal-kit` | resolves a catch-all path → `{ type: 'home'\|'page'\|'archive'\|'entry', doc, … }` or `null` (404); usually through `resolveRoute` from `createContentHelpers` |
| `getArchiveEntries({ payload, collection, locale, page, perPage, sort?, where?, depth?, draft? })` | `@intecion/ipal-kit` | fetches a page of archive entries (`ArchiveEntries`); `getEntries` from `createContentHelpers` has the defaults |
| `archiveFieldName(slug)` | `@intecion/ipal-kit` | name of the archive field in System Pages (`'posts'` → `'postsArchive'`); the plugin adds these fields itself |
| `archiveFieldName(slug)` | `@intecion/ipal-kit` | name of the archive field in System pages (`'posts'` → `'postsArchive'`); the plugin adds these fields itself |
| `buildEntryPath({ locale, archiveSlug, entrySlug })` | `@intecion/ipal-kit` | entry path `/pl/artykuly/moj-post` (always with the locale prefix) |
| `buildArchivePath({ locale, archiveSlug, page })` | `@intecion/ipal-kit` | listing path with `?page=N` pagination (page 1 without a query) |
| `parsePageParam(value)` | `@intecion/ipal-kit` | `?page=` → number ≥ 1 (junk/missing → 1) |
| `resolveRedirect({ payload, locale, segments, config, homeSlug, collections? })` | `@intecion/ipal-kit` | looks up an old slug in `slugHistory` → path for `permanentRedirect` or `null`; pairs with `trackSlugHistoryHook` — do not write your own lookup |
| `resolveNotFoundPage({ payload, locale, pagesSlug?, settingsSlug? })` | `@intecion/ipal-kit` | page assigned as 404 in System Pages or `null`; does not throw (with the helpers: `getNotFoundPage`) |
| `resolveNotFoundPage({ payload, locale, pagesSlug?, settingsSlug? })` | `@intecion/ipal-kit` | page assigned as 404 in System pages or `null`; does not throw (with the helpers: `getNotFoundPage`) |
| `blocksToMarkdown(layout, { overrides? })` | `@intecion/ipal-kit` | page blocks → Markdown by field naming convention (heading, body, items…) |
| `createMarkdownRenderer({ content, collection?, layoutField?, overrides?, frontmatter?, baseUrl?, config? })` | `@intecion/ipal-kit` | returns `render({ payload, locale, slug })` → page Markdown (GEO) or `null` |
| `createMarkdownRoute({ getCachedPayload, content, config, baseUrl })` | `@intecion/ipal-kit` | ready `GET` handler for the `/md/...` route; usually `markdownRoute` from `createContentHelpers` is enough |
@@ -171,7 +239,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| Export | Import from | What it does / when |
|---|---|---|
| `mailAdapter({ smtp?, graph?, fallbackFromAddress?, fallbackFromName? })` | `@intecion/ipal-kit` | recommended adapter for `buildConfig({ email })`: on every send picks SMTP or Graph per the panel setting and saves the integration status; the plugin does not set `config.email` itself |
| `panelSmtpAdapter({ fallbackFromAddress?, fallbackFromName? })` | `@intecion/ipal-kit` | Payload adapter that always sends through the SMTP configured in Site Integrations |
| `panelSmtpAdapter({ fallbackFromAddress?, fallbackFromName? })` | `@intecion/ipal-kit` | Payload adapter that always sends through the SMTP configured in Site integrations |
| `graphAdapter({ fallbackFromAddress?, fallbackFromName? })` | `@intecion/ipal-kit` | Payload adapter through Microsoft Graph (Exchange/M365; `GRAPH_*` credentials from env) |
| `sendEmail({ payload, to, subject, html, text?, from?, replyTo? })` | `@intecion/ipal-kit/server` | sends your own e-mail (your HTML) always through SMTP from the panel → `{ sent: true, messageId }` / `{ sent: false, error }`; does not throw; server code only |
@@ -194,11 +262,11 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `createPageRoute(content, { blocks, notFound, permanentRedirect, redirect?, … })` | `@intecion/ipal-kit/rsc` | ready `[[...slug]]` catch-all page → `{ Page, generateMetadata, generateStaticParams }` (blocks, slug history redirects, JSON-LD, under-construction mode); does not paginate `?page=` |
| `createNotFoundPage(content, { load } \| { blocks, fallback?, … })` | `@intecion/ipal-kit/rsc` | default export of `not-found.tsx` — the 404 page chosen in the panel or a fallback (the lazy `load` variant is recommended) |
| `renderNotFoundView(content, { blocks, fallback?, blockProps?, layoutField? }, locale)` | `@intecion/ipal-kit/rsc` | 404 content in one language — called from a server action for the lazy `createNotFoundPage({ load })` (pages.md) |
| `SiteProviders` | `@intecion/ipal-kit/rsc` | layout component: `shell={await getSiteShell(locale)}` mounts consent, cookie banner, analytics, Turnstile, site JSON-LD, theme script; does not mount `AlternateLinksProvider` |
| `SiteProviders` | `@intecion/ipal-kit/rsc` | layout component: `shell={await getSiteShell(locale)}` mounts consent, cookie banner, analytics, Turnstile, site JSON-LD, theme script (and `lightbox` → `LightboxProvider`); `nonce` (from `x-nonce`) goes on the theme script and the GA4/GTM tag; does not mount `AlternateLinksProvider` |
Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders` and the returned `@/lib/content` keys: `node_modules/@intecion/ipal-kit/docs/frontend.md`.
**Types:** `ContentHelpers` — `createContentHelpers` result; `SiteShell` — layout data from `getSiteShell` (consent, analytics, theme, jsonLd, settings, formTexts, turnstileSiteKey); `PageJsonLdOptions`, `EntryJsonLdContext` — `getPageJsonLd` options / your own JSON-LD nodes for entries (root); `PageRouteOptions`, `NotFoundPageOptions`, `NotFoundViewOptions`, `SiteProvidersProps` (`/rsc`) — options of `createPageRoute`, `createNotFoundPage`, `renderNotFoundView` and `SiteProviders` props.
**Types:** `ContentHelpers` — `createContentHelpers` result; `SiteShell` — layout data from `getSiteShell` (consent, analytics, theme, jsonLd, settings, formTexts, lightboxTexts, turnstileSiteKey); `PageJsonLdOptions`, `EntryJsonLdContext` — `getPageJsonLd` options / your own JSON-LD nodes for entries (root); `PageRouteOptions`, `NotFoundPageOptions`, `NotFoundViewOptions`, `SiteProvidersProps` (`/rsc`) — options of `createPageRoute`, `createNotFoundPage`, `renderNotFoundView` and `SiteProviders` props.
## Health check (`health`) — details: `node_modules/@intecion/ipal-kit/docs/deployment.md`
@@ -212,6 +280,9 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
|---|---|---|
| `buildRevalidateHook({ revalidatePath, config, homeSlug? })` | `@intecion/ipal-kit` | → `{ afterChange, afterDelete }` that revalidate ISR for the document paths in all languages; the project injects `revalidatePath` from `next/cache` |
| `buildGlobalRevalidateHook({ revalidatePath })` | `@intecion/ipal-kit` | Global `afterChange`: `revalidatePath('/', 'layout')` — the whole site picks up the change. The plugin adds it to its own globals when you pass `ipalKit({ revalidatePath })`; wire it yourself on your own globals (Header, Footer). Skip once: `context: { disableRevalidate: true }`. |
| `buildFillEmptyLocalesGlobalHook({ global, fields })` / `buildFillEmptyLocalesCollectionHook({ collection, fields })` | `@intecion/ipal-kit` | `afterChange`: text saved in one language fills the same field in every language where it is empty; never overwrites a language's own text. Fields `'field'` or `'array.subField'` (rows matched by id). The plugin adds them to the cookie list and the cookie review (`fillEmptyLocales`). |
| `fillEmptyLocales({ payload, target, source, sourceLocale, fields, req? })` | `@intecion/ipal-kit` | The core of those hooks (`FillEmptyLocalesTarget`: `{ global }` or `{ collection, id }`) → locales changed. |
| `withFillLocales(kind, config, fields)` | `@intecion/ipal-kit` | Adds the right hook to a global (`'global'`) or collection (`'collection'`) config; no fields = unchanged. |
| `setPublishedAtHook` | `@intecion/ipal-kit` | `beforeChange`: sets `publishedAt` on first publish (does not overwrite an existing date) |
| `trackSlugHistoryHook` | `@intecion/ipal-kit` | `beforeChange`: appends the old slug to the `slugHistory` field (add the field yourself); `resolveRedirect` reads it |
| `buildPreventDeleteSystemPage({ settingsSlug?, roleFields? })` | `@intecion/ipal-kit` | `beforeDelete`: blocks deleting a page assigned to a system role (homepage, policies) |
@@ -233,7 +304,7 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
| `negotiateLocale({ config, cookieLocale, acceptLanguage })` | `@intecion/ipal-kit` | language choice: cookie → Accept-Language → default |
| `matchAcceptLanguage(header, config)` | `@intecion/ipal-kit` | matches the `Accept-Language` header to the configured languages |
| `LOCALE_COOKIE_NAME` | `@intecion/ipal-kit` | constant `'NEXT_LOCALE'` — cookie with the chosen language (functional, saved only with consent) |
| `createProxy(i18nConfig, { NextResponse, markdown?, exposeHeaders?, consentCategory?, cookieName?, policyVersion? })` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | recommended `proxy.ts`: language negotiation, redirect `/` → `/{locale}`, cookie with consent, `x-locale`/`x-pathname` headers, optional Markdown routes |
| `createProxy(i18nConfig, { NextResponse, markdown?, exposeHeaders?, consentCategory?, cookieName?, policyVersion?, csp? })` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | recommended `proxy.ts`: language negotiation, redirect `/` → `/{locale}`, cookie with consent, `x-locale`/`x-pathname` headers, optional Markdown routes; `csp` (buildCsp args) = a nonce CSP per request + `x-nonce` for `<SiteProviders nonce>` (dynamic pages only, security.md) |
| `createLocaleMiddleware({ config, cookieName?, policyVersion? })` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | lower level: a `req → LocaleMiddlewareResult` function for your own proxy. The locale cookie is saved only with `functional` consent (`consentCategory: 'necessary'` = always), read under the version the consent was stored with; `policyVersion` pins one version |
| `DEFAULT_PROXY_MATCHER` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | alias of `DEFAULT_MIDDLEWARE_MATCHER` for `createProxy`; paste the value into `config.matcher` as a literal |
| `DEFAULT_MIDDLEWARE_MATCHER` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | array `['/((?!api\|admin\|_next\|.*\\..*).*)']` (excludes `api`, `admin`, `_next`, files); paste into `config.matcher` as a literal — Next reads the matcher statically |
@@ -249,13 +320,13 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
| Export | Import from | What it does / when |
|---|---|---|
| `recordIntegrationStatus(payload, field, previous, { state, code?, message? })` | `@intecion/ipal-kit` | saves the state of your own integration in Site Integrations (only on change / every 10 min); does not throw. For e-mail and Turnstile the plugin calls it itself — do not call |
| `recordIntegrationStatus(payload, field, previous, { state, code?, message? })` | `@intecion/ipal-kit` | saves the state of your own integration in Site integrations (only on change / every 10 min); does not throw. For e-mail and Turnstile the plugin calls it itself — do not call |
| `buildIntegrationStatusField(name)` | `@intecion/ipal-kit` | hidden status group field (`state`, `code`, `message`, `since`, `checkedAt`) for `integrationsFields` |
| `buildIntegrationStatusBanner(statusField, label)` | `@intecion/ipal-kit` | UI field with a status banner on the integration tab (`integrationsFields`; then `pnpm generate:importmap`) |
| `buildIntegrationStatusBanner(statusField, label, texts?)` | `@intecion/ipal-kit` | UI field with a status banner on the integration tab (`label` string or `{ en, pl }`; `texts` = `{ failing, hint }` keys of your own `ipal` translations) (`integrationsFields`; then `pnpm generate:importmap`) |
| `IntegrationAlerts` | `@intecion/ipal-kit/admin` | dashboard alert about integrations in the `degraded` state; always injected by the plugin (`beforeDashboard`); your own integrations: a second instance with `checks` |
| `IntegrationStatusBanner` | `@intecion/ipal-kit/admin` | status banner on the tab; injected by the plugin / `buildIntegrationStatusBanner` through the import map (`pnpm generate:importmap`), the project does not import it |
**Types:** `IntegrationState` (`'ok' | 'degraded'`), `IntegrationStatus` — integration state and saved status.
**Types:** `IntegrationState` (`'ok' | 'degraded'`), `IntegrationStatus` — integration state and saved status; `IntegrationLabel` (`string | { en, pl }`) — banner / alert label; `IntegrationBannerTexts` (`{ failing, hint }` text keys) — third argument of `buildIntegrationStatusBanner` for your own wording.
## Forms (`forms`) — details: `node_modules/@intecion/ipal-kit/docs/forms.md`
@@ -325,6 +396,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| `pattern(re, msg?)` | `@intecion/ipal-kit/client`, `@intecion/ipal-kit` | Rule: matches a regex (empty values skipped — combine with `required`) |
| `custom(test, msg)` | `@intecion/ipal-kit/client`, `@intecion/ipal-kit` | Rule from any predicate `(value, values) => boolean` |
| `isEmail(v)` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | Standalone e-mail check → boolean |
| `localizedRules(locale)`, `validationMessages(locale)`, `VALIDATION_MESSAGES` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | Validators with default messages in the page language (en/pl); type `ValidationMessages` |
### Analytics
@@ -343,7 +415,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| `resolveLinkHref(link, { locale, config, homeSlug?, archives?, pagesSlug? })` | `@intecion/ipal-kit` | Link value → href or `null` (empty / page missing in the language / unsafe URL); the page must be populated |
| `resolveLink(link, options)` | `@intecion/ipal-kit` | Panel link → `ResolvedLink` (`href`, `label`, `newTab`, `internal`, `targetProps`, `appearance`) or `null` — for your own `CMSLink` |
| `resolveNav(items, { locale, config, homeSlug?, linkField?, childrenField? })` | `@intecion/ipal-kit` | Menu items from the Header/Footer global → serializable `NavItem[]` (any depth, dead links skipped) |
| `resolveSystemLinks(settings, { locale, config, roles?, … })` | `@intecion/ipal-kit` | Links to system pages from Site Settings (privacy/cookies/terms) with the page title as the label → `SystemLink[]`; in a project usually `getSystemLinks` from `lib/content` |
| `resolveSystemLinks(settings, { locale, config, roles?, … })` | `@intecion/ipal-kit` | Links to system pages from Site settings (privacy/cookies/terms) with the page title as the label → `SystemLink[]`; in a project usually `getSystemLinks` from `lib/content` |
| `homeSlugFrom(settings, field?)` | `@intecion/ipal-kit` | Homepage slug from `SiteSettings.homepage` (populated) or `undefined` |
| `safeHref(url)` | `@intecion/ipal-kit` | The URL when safe (http(s), mailto, tel, sms, #, `/` path), otherwise `null` — blocks `javascript:`/`data:` |
@@ -355,6 +427,24 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
|---|---|---|
| `createMcpRoute({ getCachedPayload, config, baseUrl?, serverName?, … })` | `@intecion/ipal-kit` | Read-only MCP server for the site (JSON-RPC: `get_site_info`, `list_pages`, `search_content`, `get_page`) as a route handler → `{ GET, POST }` in `app/api/mcp/route.ts`; with a per-IP rate limit. Usually through `mcpGET`/`mcpPOST` from `lib/content` |
## Image lightbox (`lightbox`) — details: `node_modules/@intecion/ipal-kit/docs/lightbox.md`
| Export | Import from | What it does / when |
|---|---|---|
| `LightboxProvider({ texts?, classNames?, icons?, loop?, unstyled?, renderImage?, renderDialog? })` | `@intecion/ipal-kit/client` | One shared viewer for the site (or `<SiteProviders lightbox>`); renders nothing until an image is opened |
| `LightboxTrigger({ image, group?, children, className?, style?, unstyled?, texts?, 'aria-label'? })` | `@intecion/ipal-kit/client` | `<button>` around any thumbnail that opens the large image; same `group` = one gallery in page order; works without a provider (own viewer) |
| `useLightbox()` / `useOptionalLightbox()` | `@intecion/ipal-kit/client` | `open(images, index, returnFocus)`, `openGroup(group, start)`, `next`, `previous`, `close`, `isOpen`, `index`, `images`, `texts` — for your own controls; the optional one returns `null` outside a provider |
| `LightboxDialog({ images, index, onClose, onIndexChange, … })` | `@intecion/ipal-kit/client` | The viewer itself, controlled (dialog role, focus trap and return, Esc, arrows, Home/End, swipe, counter, caption, scroll lock, reduced motion) |
| `lightboxImage(media, { size?, sizes?, srcSet?, alt?, caption? })` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | Payload media doc → `LightboxImage` (`src` from `size`, `srcSet` from every Payload size + original, alt, caption) or `null` (video, PDF, id) |
| `withLightboxUploads(converters?, { group?, image?, triggerClassName? })` | `@intecion/ipal-kit/rsc` | Wraps rich text image uploads in `LightboxTrigger` on top of your converters (`RenderRichText lightbox` uses it) |
| `LIGHTBOX_FALLBACK`, `resolveLightboxTexts(texts)` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | English labels; partial texts → full set (empty → fallback) |
| `LIGHTBOX_FALLBACK_PL`, `lightboxFallback(locale)` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | Polish lightbox labels; set for a page language. `resolveLightboxTexts(texts, locale)` uses it |
| `lightboxIndex(index, delta, total, loop?)`, `formatLightboxCounter(template, current, total)` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | Wrap / clamp a gallery index; "{current} / {total}" → "2 / 5" |
| `prefersReducedMotion()` | `@intecion/ipal-kit/client` | OS reduced motion or the AccessibilityWidget switch (`data-a11y-motion="reduce"`) |
| `lightboxNotificationFields` | `@intecion/ipal-kit` | The Form messages → Image viewer field group (added by `ipalKit({ lightbox: true })`) — to place in your own global |
**Types:** `LightboxImage`, `LightboxTexts`, `LightboxClassNames`, `LightboxRenderImage`, `LightboxImageOptions` (root and `/client`); `LightboxApi`, `LightboxProviderProps`, `LightboxTriggerProps`, `LightboxDialogProps` (`/client`); `RichTextLightboxOptions` (`/rsc`). Styling: `--ipal-lightbox-*` CSS variables, `data-ipal="lightbox…"` hooks.
## Media (`media`) — details: `node_modules/@intecion/ipal-kit/docs/media.md`
| Export | Import from | What it does / when |
@@ -375,17 +465,18 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `getNotificationTexts({ payload, locale? })` | `@intecion/ipal-kit` | Reads the Notifications global in a language → `NotificationTexts` (`form.success`, `error`, `validation`, `next`, `back`, `stepOf`, …) with an EN fallback per field; source of `texts` for `RenderForm` (usually `getFormTexts` from `lib/content`) |
| `getNotificationTexts({ payload, locale? })` | `@intecion/ipal-kit` | Reads the Form messages global (`notifications`) in a language → `NotificationTexts` (`form.success`, `error`, `validation`, `next`, `back`, `stepOf`, …) with an EN fallback per field; source of `texts` for `RenderForm` (usually `getFormTexts` from `lib/content`) |
| `resolveFormMessage(result, texts)` | `@intecion/ipal-kit` | `SubmitFormResult` code → text from the panel (`{field}` filled in for `validation`, `error` without exception details); `createSubmitAction` calls it itself |
| `NOTIFICATION_FALLBACK` | `@intecion/ipal-kit` | Constant: built-in English `form.*` texts used when a panel field is empty |
| `NOTIFICATION_FALLBACK_PL`, `notificationFallback(locale)` | `@intecion/ipal-kit` | Polish defaults; picks the set for a page language (`pl` → Polish, else English) |
**Types:** `NotificationTexts`, `FormNotificationTexts` — resolved notification texts (`form` group).
**Types:** `NotificationTexts`, `FormNotificationTexts` — resolved notification texts (`form` group; `lightbox` group = `LightboxTexts`, see Image lightbox).
## System pages (`pages`) — details: `node_modules/@intecion/ipal-kit/docs/pages.md`
| Export | Import from | What it does / when |
|---|---|---|
| `getSystemPagePath({ page, locale, config, homeSlug? })` | `@intecion/ipal-kit` | Page assigned in Site Settings (read with `locale: 'all'`) → path in the language (`/pl` for the homepage, `/en/privacy-policy`) or `undefined` |
| `getSystemPagePath({ page, locale, config, homeSlug? })` | `@intecion/ipal-kit` | Page assigned in Site settings (read with `locale: 'all'`) → path in the language (`/pl` for the homepage, `/en/privacy-policy`) or `undefined` |
| `ALL_SYSTEM_PAGE_ROLES` | `@intecion/ipal-kit` | Constant: all system page roles in a fixed order: `homepage`, `notFound`, `privacyPolicy`, `cookiePolicy`, `termsOfService` |
| `LocaleView({ views, defaultLocale })` | `@intecion/ipal-kit/client` | Picks, from ready per-language views, the one from the URL (`/en/...`) — in `not-found.tsx` without `headers()` (the route stays static); used by `createNotFoundPage` |
| `NotFoundLoader({ load, locales, defaultLocale })` | `@intecion/ipal-kit/client` | Lazy 404 content: fetches the view from a server action only when the 404 is shown (smaller RSC payload on every page); used by `createNotFoundPage(content, { load })` |
@@ -396,8 +487,8 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `getSiteSettings<T>(payload, { locale?, depth? })` | `@intecion/ipal-kit` | Reads the Site Settings global (generated type `SiteSetting` as `T`) |
| `getSiteIntegrations<T>(payload, { locale?, depth? })` | `@intecion/ipal-kit` | Reads the Site Integrations global with secrets (the Local API bypasses access) — server only, never raw to the client |
| `getSiteSettings<T>(payload, { locale?, depth? })` | `@intecion/ipal-kit` | Reads the Site settings global (generated type `SiteSetting` as `T`) |
| `getSiteIntegrations<T>(payload, { locale?, depth? })` | `@intecion/ipal-kit` | Reads the Site integrations global with secrets (the Local API bypasses access) — server only, never raw to the client |
| `getGlobal<T>(payload, slug, { locale?, depth? })` | `@intecion/ipal-kit` | Thin `payload.findGlobal` wrapper for any global (the project's too) |
| `SITE_SETTINGS_SLUG` | `@intecion/ipal-kit` | Constant: global slug `'site-settings'` |
| `SITE_INTEGRATIONS_SLUG` | `@intecion/ipal-kit` | Constant: global slug `'site-integrations'` |
@@ -410,7 +501,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `RenderRichText({ data, converters?, className?, headingIds?, safeLinks? })` | `@intecion/ipal-kit/rsc` | Renders a richText (Lexical) field through Payload's official converter; your own classes via `converters`, `headingIds` adds anchors to headings (the same ids as `extractHeadings`). Unsafe link URLs (`javascript:`, `data:`…) render as `#`; `safeLinks={false}` turns that off (fully trusted content only). Instead of a hand-written renderer. |
| `RenderRichText({ data, converters?, className?, headingIds?, lightbox?, safeLinks? })` | `@intecion/ipal-kit/rsc` | Renders a richText (Lexical) field through Payload's official converter; `lightbox` = click-to-enlarge images (lightbox.md); your own classes via `converters`, `headingIds` adds anchors to headings (the same ids as `extractHeadings`). Unsafe link URLs (`javascript:`, `data:`…) render as `#`; `safeLinks={false}` turns that off (fully trusted content only). Instead of a hand-written renderer. |
| `extractHeadings(data, { levels? })` | `@intecion/ipal-kit`, `@intecion/ipal-kit/rsc` | List of headings `{ id, level, text }` (h2 by default) for a table of contents — ids match `RenderRichText headingIds`. |
| `headingText(node)` | `@intecion/ipal-kit` | Plain text of a Lexical node (a heading with bold, links…). |
| `buildTableOfContentsField({ name? })` | `@intecion/ipal-kit` | `tableOfContents` group field (show + localized label) for a text block/section — table of contents toggle in the panel. |
@@ -442,11 +533,19 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
| Export | Import from | What it does / when |
|---|---|---|
| `buildSecurityHeaders({ hsts?, additional?, coop?, frameOptions?, permissionsPolicy?, referrerPolicy?, … })` | `@intecion/ipal-kit` | Returns `SecurityHeader[]` (HSTS, X-Frame-Options, nosniff, Referrer-Policy, Permissions-Policy, COOP; with `IPAL_NOINDEX` also `X-Robots-Tag`) for `headers()` in `next.config.ts`. Add CSP via `additional`. |
| `buildCsp({ mode?, r2Url?, turnstile?, analytics?, googleMaps?, youtube?, extra? })` | `@intecion/ipal-kit` | Returns `{ key, value }` with a hardened CSP (`base-uri`, `object-src` etc.) + sources for the enabled integrations; put it into `additional`. Start with `mode: 'report-only'`. |
| `buildSecurityHeaders({ hsts?, csp?, additional?, coop?, frameOptions?, permissionsPolicy?, referrerPolicy?, … })` | `@intecion/ipal-kit` | Returns `SecurityHeader[]` (HSTS, X-Frame-Options, nosniff, Referrer-Policy, Permissions-Policy, COOP; with `IPAL_NOINDEX` also `X-Robots-Tag`) for `headers()` in `next.config.ts`. `csp` = `buildCsp` args → the CSP header (+ `Reporting-Endpoints` with `reportUri`); off by default. `additional` overrides by key. |
| `withSecurityConfig(nextConfig, { hidePoweredBy? })` | `@intecion/ipal-kit` | Next config wrapper: `poweredByHeader: false` + drops `X-Powered-By` from `headers()` (Next's "Next.js" and withPayload's "Next.js, Payload"). `withPayload(withSecurityConfig(nextConfig))`; `hidePoweredBy: false` = no change. |
| `totpRedirectTarget({ adminRoute, forceSetup?, pathname, user, excludePaths? })`, `totpAdminPath(adminRoute, path)` | `@intecion/ipal-kit` | The 2FA redirect rules as pure functions: the setup / verify URL (with `back`) to send this user to, or `null` (no path, api key, already on a TOTP screen or logout). For an own `twoFactor.provider`. Types `TotpRedirectArgs`, `TotpUser` |
| `buildCsp({ mode?, reportUri?, reportGroup?, r2Url?, analytics?, metaPixel?, linkedIn?, tiktok?, clarity?, turnstile?, youtube?, googleMaps?, nonce?, strictDynamic?, dev?, extra?, override? })` | `@intecion/ipal-kit` | Returns `{ key, value }` with a hardened CSP (`base-uri`, `object-src`, `frame-ancestors`, `form-action`) + sources for the enabled integrations. `mode: 'report-only'` → `…-Report-Only` (start here), `'enforce'` later. `extra` adds to any directive, `override` replaces / drops one (`null`). `dev` (default `NODE_ENV === 'development'`) adds `'unsafe-eval'`. `nonce` → `'nonce-…' 'strict-dynamic'`. |
| `buildCspHeaders(args)` | `@intecion/ipal-kit` | `[csp, Reporting-Endpoints]` (the second only with `reportUri`). |
| `buildAdminCsp(args)` / `buildAdminCspHeaders(args)` | `@intecion/ipal-kit` | Looser policy for Payload's admin: Monaco from `cdn.jsdelivr.net`, `blob:` workers, `https:` images, Live Preview `frame-src 'self'`, `frame-ancestors 'self'`. Rule `{ source: '/admin/:path*', headers: buildAdminCspHeaders({ mode, reportUri }) }` AFTER the site-wide rule. |
| `createCspReportRoute({ onReport?, maxBytes? })` | `@intecion/ipal-kit` | `POST` handler for `reportUri` (`src/app/api/csp-report/route.ts`): both report formats, body cap 16 KB, always `204`; default sink = one `[csp] …` `console.warn` line per violation (Coolify logs). |
| `parseCspReports(body)` | `@intecion/ipal-kit` | Normalises a report body (`csp-report` object or Reporting API array) to `CspViolation[]` — for your own collector. |
| `buildReportingEndpoints(url, group?)`, `cspHeaderKey(mode?)`, `DEFAULT_CSP_REPORT_GROUP` | `@intecion/ipal-kit` | Building blocks: the `Reporting-Endpoints` header, the header name for a mode, the default `report-to` group (`'csp-endpoint'`). |
| `createCspNonce()`, `CSP_NONCE_HEADER` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | A per-request nonce and the request header (`x-nonce`) `createProxy({ csp })` passes it in — for your own proxy. Nonces make pages dynamic (no ISR). |
| `buildUploadSecurityHeaders({ collections? })` | `@intecion/ipal-kit` | `headers()` entries for `/api/<upload>/file/*` (`media` by default): files from disk are displayed, never executed (sandbox). Needed for media without R2. |
**Types:** `BuildCspArgs`, `BuildSecurityHeadersArgs` — builder options; `SecurityHeader` — `{ key, value }` in the Next.js shape.
**Types:** `BuildCspArgs`, `BuildAdminCspArgs`, `BuildSecurityHeadersArgs`, `WithSecurityConfigOptions`, `CreateCspReportRouteArgs` — builder options; `CspDirective`, `CspSources` — directive names / sources per directive; `CspViolation` — one normalised report; `SecurityHeader` — `{ key, value }` in the Next.js shape.
## SEO (`seo`) — details: `node_modules/@intecion/ipal-kit/docs/seo.md`
@@ -456,7 +555,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| Export | Import from | What it does / when |
|---|---|---|
| `createPageMetadata({ config, baseUrl, content?, … })` | `@intecion/ipal-kit` | Page metadata generator with the plugin's convention resolvers wired in (Pages, SiteSettings, `meta`, System Pages, archives); call it with `{ payload, locale, slug }`. Normally through `generatePageMetadata` from `createContentHelpers`. |
| `createPageMetadata({ config, baseUrl, content?, … })` | `@intecion/ipal-kit` | Page metadata generator with the plugin's convention resolvers wired in (Pages, SiteSettings, `meta`, System pages, archives); call it with `{ payload, locale, slug }`. Normally through `generatePageMetadata` from `createContentHelpers`. |
| `createMetadataGenerator({ config, baseUrl, resolveDocument, … })` | `@intecion/ipal-kit` | As above, but with your own resolvers — for routes with non-standard conventions. |
| `buildMetadata({ meta, siteName, locale, config, slugs, baseUrl, … })` | `@intecion/ipal-kit` | Builds a Next.js `Metadata` object (title, canonical, hreflang, OG, Twitter, robots) from ready data; fetches nothing. The lowest level. |
| `composeTitle({ pageTitle, siteName, separator?, order? })` | `@intecion/ipal-kit` | Full title "Page \| Company" (or the other way round), without duplicating the site name. |
@@ -464,7 +563,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| `slugsAcrossLocales({ payload, collection, id, config })` | `@intecion/ipal-kit` | Document slug in all languages (separate query, depth 0) — input for hreflang. |
| `readSiteMetaConfig({ payload, locale, pagesSlug?, settingsSlug?, settings? })` | `@intecion/ipal-kit` | Reads from SiteSettings: site name, separator (with padding), title order, homepage slug per language, default description and OG image. |
| `buildIconsMetadata(favicon)` | `@intecion/ipal-kit` | `icons` (favicon, apple-touch-icon) from the favicon upload in the panel — once in the root layout `generateMetadata`. |
| `verificationFrom(settings)` | `@intecion/ipal-kit` | Site Settings → Search & AI verification codes → Next `Metadata.verification` (`google`, `yandex`, `other['msvalidate.01']` for Bing); `undefined` when every field is empty. `generatePageMetadata` adds it itself — by hand only in your own metadata. |
| `verificationFrom(settings)` | `@intecion/ipal-kit` | Site settings → Search engines verification codes → Next `Metadata.verification` (`google`, `yandex`, `other['msvalidate.01']` for Bing); `undefined` when every field is empty. `generatePageMetadata` adds it itself — by hand only in your own metadata. |
| `createManifestHandler({ getCachedPayload, config, settingsSlug? })` | `@intecion/ipal-kit` | `app/manifest.ts` handler from SiteSettings; without a database at build time it returns a minimal manifest. Usually `manifest` from `createContentHelpers`. |
| `NoSnippet({ as?, children })` | `@intecion/ipal-kit/client`, `@intecion/ipal-kit/rsc` | Wrapper with `data-nosnippet` — keeps repeated text (footer: address, hours, phone) out of Google snippets. Do not wrap `<main>`. |
@@ -502,7 +601,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| `buildRobots({ baseUrl, aiBots?, disallowParams?, extraDisallow?, … })` | `@intecion/ipal-kit` | `app/robots.ts` rules: blocks admin/API, points to the sitemap, explicitly allows AI bots (`aiBots: 'allow' \| 'block-training' \| 'disallow'`); with `IPAL_NOINDEX` blocks everything. Usually `robots` from `createContentHelpers`. |
| `AI_ASSISTANT_BOTS` | `@intecion/ipal-kit` | List of user agents of AI assistant/search bots (ClaudeBot, PerplexityBot…). |
| `AI_TRAINING_BOTS` | `@intecion/ipal-kit` | List of user agents of model-training crawlers (GPTBot, Google-Extended…). |
| `robotsOptionsFrom(settings)` | `@intecion/ipal-kit` | Site Settings → Search & AI → AI crawlers as `buildRobots` options (`aiBots` unless the policy is `default`, `aiBotRules`; invalid user agents dropped). `getRobots` from `createContentHelpers` uses it — own robots: `buildRobots({ ...robotsOptionsFrom(settings), … })`. |
| `robotsOptionsFrom(settings)` | `@intecion/ipal-kit` | Site settings → Search engines → AI assistants as `buildRobots` options (`aiBots` unless the policy is `default`, `aiBotRules`; invalid user agents dropped). `getRobots` from `createContentHelpers` uses it — own robots: `buildRobots({ ...robotsOptionsFrom(settings), … })`. |
| `buildLlmsTxt({ payload, config, baseUrl, full?, content?, summaryField?, … })` | `@intecion/ipal-kit` | `/llms.txt` content (or `llms-full.txt` with `full`) from the panel, same rules as the sitemap. |
| `createLlmsTxtRoute({ getCachedPayload, config, baseUrl, full?, … })` | `@intecion/ipal-kit` | Ready `GET` handler for `/llms.txt` / `/llms-full.txt`. Usually `llmsRoute` / `llmsFullRoute` from `createContentHelpers`. |
| `collectSiteIndex({ payload, config, baseUrl?, content?, locales?, … })` | `@intecion/ipal-kit` | Shared index of public documents per language (URL, title, description, dates) — the source for llms.txt, MCP `list_pages`, IndexNow. Use it before you write your own site listing. |
@@ -514,7 +613,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| `buildIndexNowHook({ config, contentCollection?, baseUrl?, settingsSlug? })` | `@intecion/ipal-kit` | `afterChange` hook: after publish, sends the URLs in all languages to IndexNow (in the background, production only). With `ipalKit({ indexNow: true })` the plugin wires it itself on pages and content collections — do not call. |
| `submitToIndexNow({ payload, urls, baseUrl? })` | `@intecion/ipal-kit` | Manual POST of a batch of URLs to IndexNow; never throws, returns `boolean`. |
| `createIndexNowKeyRoute({ getCachedPayload })` | `@intecion/ipal-kit` | `GET` handler for the key file (`/indexnow-key.txt`) for verification. Usually `indexNowKeyRoute` from `createContentHelpers`. |
| `getIndexNowKey(payload)` | `@intecion/ipal-kit` | IndexNow key: env `INDEXNOW_KEY`, then Site Integrations; `''` when missing. |
| `getIndexNowKey(payload)` | `@intecion/ipal-kit` | IndexNow key: env `INDEXNOW_KEY`, then Site integrations; `''` when missing. |
| `INDEXNOW_KEY_ENV` | `@intecion/ipal-kit` | `'INDEXNOW_KEY'` — name of the env variable with the key. |
| `INDEXNOW_KEY_PATH` | `@intecion/ipal-kit` | `'/indexnow-key.txt'` — path of the key file route. |
@@ -527,7 +626,11 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| `buildAutoFillMetaHook(mapping?)` | `@intecion/ipal-kit` | `beforeChange` hook that fills empty `meta.title`/`meta.description` from content. The plugin wires it itself on the `seo.collections` collections (option `seo.autoFill`) — do not call. |
| `injectAutoFillMeta(config, seo)` | `@intecion/ipal-kit` | Injects the hook above into the SEO collections. The plugin wires it itself — do not call. |
| `SKIP_AUTO_FILL` | `@intecion/ipal-kit` | `'ipalSkipAutoFill'` — `context` key (`context: { [SKIP_AUTO_FILL]: true }`) that turns off meta auto-fill and the AI summary on save (migrations, scripts). |
| `validateFaviconField` | `@intecion/ipal-kit` | `FieldHook` that warns when the favicon is < 48×48 or not square. The plugin wires it itself on the favicon field in SiteSettings — call it only for your own favicon field. |
| `validateFaviconField` | `@intecion/ipal-kit` | `FieldHook` that logs a server warning when the favicon is < 48×48 or not square (never blocks the save). The plugin wires it itself on the favicon field in SiteSettings — call it only for your own favicon field. |
| `DocumentTitle` | `@intecion/ipal-kit/admin` | Client component `{ title }`: sets the browser-tab title of a custom admin view after load, so it follows the admin language (Payload's view `meta.title` is one fixed string). Render it in your view with a translated title; the statistics view uses it. |
| `adminDocumentTitle(title, titleSuffix?)` | `@intecion/ipal-kit` | `"Title - Suffix"` the way Payload builds a tab title — pass `req.payload.config.admin.meta.titleSuffix`. |
| `FaviconCheck` | `@intecion/ipal-kit/admin` | Hint under the site icon in Site settings: the chosen image is under 48×48 px or not square (text in the admin language, saving never blocked). Injected by the plugin; `pnpm generate:importmap`. Props: `fieldPath` (default the field it sits under), `mediaSlug` (`'media'`) — for your own favicon field: `admin.components.afterInput: [{ path: '@intecion/ipal-kit/admin#FaviconCheck', clientProps: { fieldPath: 'icon' } }]`. |
| `faviconProblems(media)`, `FAVICON_MIN_SIZE` | `@intecion/ipal-kit` | The check both use: `{ width, height, mimeType }` → `FaviconProblem[]` (`{ key: 'faviconTooSmall' \| 'faviconNotSquare', width, height }`); SVG and unknown sizes pass. Types: `FaviconProblem` (root), `FaviconCheckProps` (`/admin`). |
| `MetaDescriptionCheck` | `@intecion/ipal-kit/admin` | Hint below the meta description in the SEO tab (description duplicated from the global or another document). Injected by the plugin; after turning the option on, `pnpm generate:importmap`. |
**Types:** `PageMetadata`, `OgImage` — `buildMetadata` result and OG image; `SeoMeta`, `SeoOption`, `AutoFillMapping` — the `meta` group, the plugin's `seo` option and the auto-fill mapping; `SiteMetaConfig` — `readSiteMetaConfig` result; `RobotsOptions`, `RobotsRules` — `buildRobots` options and result; `AiBotsPolicy` (`'allow' \| 'block-training' \| 'disallow' \| false`), `AiBotRule` (`{ userAgent, access: 'allow' \| 'disallow' }`, `aiBotRules`, wins over the policy); `VerificationMetadata` — `verificationFrom` result; `SitemapEntry`, `SitemapRouteOptions`, `SitemapStyleOptions` — sitemap entry, handler and style options; `CollectSiteIndexArgs`, `SiteIndexEntry` — `collectSiteIndex` arguments and entry; `NoSnippetProps` (`/client`, `/rsc`) — `NoSnippet` props.
@@ -597,7 +700,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| Export | Import from | What it does / when |
|---|---|---|
| `getTurnstileConfig(payload)` | `@intecion/ipal-kit` | `{ enabled, siteKey }` from Site Integrations (env fallback); enabled only when both keys are set. In the server layout → `TurnstileProvider`. |
| `getTurnstileConfig(payload)` | `@intecion/ipal-kit` | `{ enabled, siteKey }` from Site integrations (env fallback); enabled only when both keys are set. In the server layout → `TurnstileProvider`. |
| `TurnstileProvider({ siteKey, children })` | `@intecion/ipal-kit/client` | Provides the site key to the whole app; with `siteKey` null the widgets render nothing. |
| `useTurnstile()` | `@intecion/ipal-kit/client` | In a form: `{ token, TurnstileWidget, reset, … }`; pass the token to `submitForm`. Requires the provider. |
| `useOptionalTurnstile()` | `@intecion/ipal-kit/client` | Like `useTurnstile`, but without a provider it returns `enabled: false` instead of throwing — for shared components. |
+3 -3
View File
@@ -28,7 +28,7 @@ Checks the **running** app, not the code — exactly what Googlebot gets.
| unknown URL returns 200 | no `notFound()` in the catch-all |
| sitemap URLs not 200 | the sitemap lists redirecting addresses (old slugs) |
| robots.txt points to localhost | `NEXT_PUBLIC_SERVER_URL` not set in the build |
| no JSON-LD structured data | no `<SiteProviders>` / `<JsonLdGraph>` in `[locale]/layout.tsx`, or an empty name in Site Settings |
| no JSON-LD structured data | no `<SiteProviders>` / `<JsonLdGraph>` in `[locale]/layout.tsx`, or an empty name in Site settings |
| `/llms.txt` / `/llms-full.txt` → 404 | no route (`export { llmsRoute as GET }` / `llmsFullRoute` from `lib/content`) |
| Markdown version `/md/…` → 404 | no `src/app/md/[locale]/[[...slug]]/route.ts`; the page is noindex/draft |
| `sitemap.xml → 503` | database unreachable while building the sitemap (`sitemapRoute` returns 503 + Retry-After instead of an empty one) — check `DATABASE_URL` / database health |
@@ -37,8 +37,8 @@ Checks the **running** app, not the code — exactly what Googlebot gets.
3. `no verification meta tag` (INFO — not counted as an error or warning) — with domain
verification by DNS (recommended, docs/deployment.md §6) this is the correct state; do nothing. Only for
URL-prefix verification, paste the code in **Site Settings → Search & AI**.
`robots.txt blocks AI bots` — also check Site Settings → Search & AI → AI crawlers
URL-prefix verification, paste the code in **Site settings → Search engines**.
`robots.txt blocks AI bots` — also check Site settings → Search engines → AI assistants
(when the project uses `getRobots`, the editor may have changed the policy).
4. Judge each `[WARNING]`: a missing description / duplicate titles are **content in the panel** —
fill them in from the brief or list them in the report for the client.
+50 -28
View File
@@ -39,6 +39,10 @@ legacy-peer-deps=true
pnpm add @intecion/ipal-kit @payloadcms/plugin-seo @payloadcms/plugin-form-builder \
@payloadcms/storage-s3 @clocklimited/payload-2fa@3.0.0-beta.7 tailwindcss @tailwindcss/postcss
```
**Next.js 16.4.1 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, AGENT.md §4 item 11):
`pnpm add next@^16.4.1 eslint-config-next@^16.4.1 sharp@^0.35.5` when create-payload-app gave you an older one.
**Node.js 20 or later** (the plugin's `nodemailer` 10 requires it). After the install, `pnpm audit --prod` → no high or
critical; with `payload` 3.90.x add the `dompurify` and `undici` overrides from AGENT.md §4 item 12.
`nodemailer`, `lucide-react`, `slugify`, `server-only` come with the plugin — do not add them (your own
`lucide-react` only `~0.400.0`). In `package.json`: pin every `@payloadcms/*` (ui, next, db-*, richtext-lexical,
plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact `payload` version**, then
@@ -46,7 +50,8 @@ plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact
`"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack"`.
**Check.** `ls node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` exists;
`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `ls src/middleware.ts` → not found.
`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.1,
sharp ≥ 0.35.5; `ls src/middleware.ts` → not found.
404 on `pnpm add` = missing `@intecion:registry` line; 401 = stale `_authToken` in `~/.npmrc` (PROGRAMISTA §1).
**Turn off / override.** `@payloadcms/storage-s3` and `@clocklimited/payload-2fa` are optional peers — only unneeded
@@ -132,8 +137,8 @@ behind Cloudflare, `x-forwarded-for` behind a plain proxy), `IPAL_NOINDEX` (empt
One language: one entry in `locales`, no `[locale]` folder (i18n.md).
**Check.** `pnpm payload generate:importmap` (whiteLabel adds admin components) and `pnpm generate:types` without
errors; `pnpm dev`, `/admin`: first-user screen → after saving, TOTP setup is enforced (QR);
the panel shows Site Settings, Site Integrations, Cookie Settings, Notifications, the Forms group, Consent records.
errors (the import map lists `@intecion/ipal-kit/admin#TotpRedirectProvider`); `pnpm dev`, `/admin`: first-user screen → after saving, TOTP setup is enforced (`/admin/setup-totp?back=%2Fadmin`, QR, no reloading);
the panel shows Site settings, Site integrations, Cookie banner, Notifications, the Forms group, Consent records.
`curl -s -o /dev/null -w '%{http_code}' -X POST localhost:3000/api/ipal/consent -H 'content-type: application/json'
-d '{"id":"0123456789abcdef","version":1,"state":{"necessary":true,"functional":false,"analytics":false,"marketing":false}}'` → `201`.
@@ -290,7 +295,7 @@ exports `route.Page`, `route.generateMetadata`, `route.generateStaticParams`.
`notFoundView.ts` (`'use server'`, `loadNotFoundView(locale)` → `renderNotFoundView(content, { blocks: blockRegistry }, locale)`)
and `not-found.tsx` (`export default createNotFoundPage(content, { load: loadNotFoundView })`) — both from `/rsc`, PROGRAMISTA §2.8.
**Check.** `curl -sI localhost:3000/ | grep -i location` → `/pl`; after stage 11 (Homepage in System Pages)
**Check.** `curl -sI localhost:3000/ | grep -i location` → `/pl`; after stage 11 (Homepage in System pages)
`curl -s -A Googlebot localhost:3000/pl | grep -o '<link rel="canonical"[^>]*>'` — in `<head>`, plus `hreflang`
and `rel="alternate" type="text/markdown"`; `/pl/nie-ma-takiej` → 404 with content from the panel; `/admin` and `/_next` → no 500;
`pnpm build` shows `●` (SSG) next to `[[...slug]]`.
@@ -318,26 +323,39 @@ and `rel="alternate" type="text/markdown"`; `/pl/nie-ma-takiej` → 404 with con
| File | Content |
|---|---|
| `src/app/sitemap.xml/route.ts` | `export { sitemapRoute as GET } from '@/lib/content'` + `export const dynamic = 'force-dynamic'` |
| `src/app/robots.ts` | `export { getRobots as default } from '@/lib/content'` + `force-dynamic` (AI crawler policy from Site Settings → Search & AI; `robots` = code only) |
| `src/app/robots.ts` | `export { getRobots as default } from '@/lib/content'` + `force-dynamic` (AI crawler policy from Site settings → Search engines; `robots` = code only) |
| `src/app/manifest.ts` | `export { manifest as default } from '@/lib/content'` + `force-dynamic` |
| `src/app/api/health/route.ts` | `export { healthRoute as GET } from '@/lib/content'` + `force-dynamic` |
| `src/app/api/csp-report/route.ts` | `import { createCspReportRoute } from '@intecion/ipal-kit'` + `export const POST = createCspReportRoute()` (CSP violation reports → `[csp]` lines in the logs) |
```ts
// next.config.ts
import { withPayload } from '@payloadcms/next/withPayload'
import { buildCsp, buildImagesConfig, buildSecurityHeaders, buildUploadSecurityHeaders } from '@intecion/ipal-kit'
import {
buildAdminCspHeaders, buildImagesConfig, buildSecurityHeaders, buildUploadSecurityHeaders, withSecurityConfig,
} from '@intecion/ipal-kit'
const csp = buildCsp({ mode: 'report-only', r2Url: process.env.R2_PUBLIC_URL, turnstile: true, analytics: true })
const securityHeaders = buildSecurityHeaders({ hsts: process.env.NODE_ENV === 'production', additional: [csp] })
// CSP step 1: report-only. After the reports are clean (security.md → "ROLL OUT CSP"): mode 'enforce'.
const csp = { mode: 'report-only', reportUri: '/api/csp-report', r2Url: process.env.R2_PUBLIC_URL } as const
const securityHeaders = buildSecurityHeaders({
hsts: process.env.NODE_ENV === 'production',
// flags for what the site loads: analytics, metaPixel, linkedIn, tiktok, clarity, turnstile, youtube, googleMaps
csp: { ...csp, turnstile: true, analytics: true },
})
export default withPayload({
// withSecurityConfig: no X-Powered-By (Next's and Payload's)
export default withPayload(withSecurityConfig({
images: { ...buildImagesConfig() },
htmlLimitedBots:
/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Yandex|DuckDuckBot|Baiduspider|Screaming Frog|AhrefsBot|SemrushBot/i,
async headers() {
return [{ source: '/:path*', headers: securityHeaders }, ...buildUploadSecurityHeaders()]
return [
{ source: '/:path*', headers: securityHeaders },
{ source: '/admin/:path*', headers: buildAdminCspHeaders(csp) }, // after the site-wide rule
...buildUploadSecurityHeaders(),
]
},
})
}))
```
```ts
// src/instrumentation.ts — import from /env (the root pulls in Payload → Edge/Turbopack crash)
@@ -355,26 +373,30 @@ export function register() {
**Check.** `curl -s localhost:3000/sitemap.xml | head` → `<urlset` with `xhtml:link hreflang`; in the browser
the "XML Sitemap" style; `curl -s localhost:3000/robots.txt` → `Sitemap:`, `Disallow: /admin`, AI bots (GPTBot,
ClaudeBot…) with `Allow` (a policy picked in Site Settings → Search & AI → AI crawlers shows up after a reload);
`curl -sI localhost:3000/sitemap.xml | grep -i cache-control` → `s-maxage=3600`; `/manifest.webmanifest` → JSON with the name from Site Settings; `/api/health` → `200`
(`503` without a database); `curl -sI localhost:3000/pl | grep -i 'x-frame-options\|content-security-policy-report-only'`;
ClaudeBot…) with `Allow` (a policy picked in Site settings → Search engines → AI assistants shows up after a reload);
`curl -sI localhost:3000/sitemap.xml | grep -i cache-control` → `s-maxage=3600`; `/manifest.webmanifest` → JSON with the name from Site settings; `/api/health` → `200`
(`503` without a database); `curl -sI localhost:3000/pl | grep -iE 'x-frame-options|content-security-policy-report-only|reporting-endpoints|x-powered-by'`
→ the first three, NO `x-powered-by`; `/pl` and `/admin` in the browser → no `[Report Only]` CSP lines in the console
(each one → a flag or `extra`, see security.md); `curl -si -X POST localhost:3000/api/csp-report -H 'content-type: application/csp-report' -d '{"csp-report":{}}' | head -1` → `204`;
an empty `PAYLOAD_SECRET` in `.env` → `pnpm dev` exits with a list of missing variables (restore it).
**Turn off / override.** `robots`: `aiBots: 'block-training' | 'disallow' | false` (only on a client decision →
`ipal-audit-skip: aibots`), `adminRoute: false` (hidden panel), `extraDisallow`; `sitemapStyle: false` (raw XML)
or your own text; `buildSecurityHeaders({ frameOptions, coop, hsts, additional })` — an `additional` entry with the same key
overrides the default; CSP: `buildCsp` flags (`youtube`, `googleMaps`, `extra`), after a clean console `mode: 'enforce'`;
overrides the default; CSP: `buildCsp` flags (`youtube`, `googleMaps`, `metaPixel`, `linkedIn`, …), `extra`, `override`, no `csp`
= no policy; after clean reports `mode: 'enforce'` (site and admin); nonces only for pages that already render per request
(`createProxy({ csp })` + `<SiteProviders nonce>`); `withSecurityConfig(config, { hidePoweredBy: false })` keeps `X-Powered-By`;
`buildImagesConfig({ extraHosts })`; env validation is fully opt-in — filter/add rules
(`ipalEnvRules(…).filter(…)`). Staging: `IPAL_NOINDEX=1` (also stops IndexNow). Search & AI: `robots` instead of
(`ipalEnvRules(…).filter(…)`). Staging: `IPAL_NOINDEX=1` (also stops IndexNow). Search engines: `robots` instead of
`getRobots` ignores the panel; `ipalKit({ searchSettings: false })` removes the tab; per-bot exceptions in code:
`createContentHelpers({ robots: { aiBotRules: [{ userAgent, access }] } })`. Sitemap: `sitemapOptions: { maxUrls,
cacheControl, memoSeconds }`, `sitemapEntries: (entries) => entries` (add/remove URLs), `underConstructionSeo: false`.
**Search & AI panel step.** Nothing in code — the tab exists by default. **Postgres:** after installing or upgrading
**Search engines panel step.** Nothing in code — the tab exists by default. **Postgres:** after installing or upgrading
the plugin run `pnpm payload migrate:create` (new columns `search_verification_*`, `ai_crawlers_policy`, the
`ai_crawlers_rules` table, localized `llms_intro`) → `pnpm payload migrate`; SQLite/Mongo: nothing. Search Console:
verify the **domain via DNS** (stage 11) and leave the verification fields empty; only for URL-prefix verification
paste the code into Site Settings → Search & AI (never into code). `llmsIntro` (per language): 2–4 sentences of facts
paste the code into Site settings → Search engines (never into code). `llmsIntro` (per language): 2–4 sentences of facts
from the brief (who, what, where, since when, for whom) — it goes at the top of `/llms.txt`. Check:
`curl -s localhost:3000/llms.txt | head` (the note under the description).
@@ -410,16 +432,16 @@ list is currently fixed; block Markdown: `markdown: { overrides }` in `createCon
**Steps.** Skill **ipal-form**: a block with `<RenderForm>` (`/rsc`), `src/components/forms/formClasses.ts`, the action from stage 6
(one per project), every form from a **seed** `scripts/seed-form-*.ts` (email to the company + confirmation to the customer,
every language, consent checkbox). Cookies: skill **ipal-consent-check** — `cookie-scan.mjs` → `import-cookies.ts` into
Cookie Settings → Cookies; on the cookie policy page a block with `<CookieTable>` (`/rsc`, data from `getCookieTable`);
the same list appears in the `settings="detailed"` dialog (labels: Cookie Settings → Detail labels, every language).
Cookies → Cookie list; on the cookie policy page a block with `<CookieTable>` (`/rsc`, data from `getCookieTable`);
the same list appears in the `settings="detailed"` dialog (labels: Cookies → Settings window → Cookie list headings, every language).
**Check.** Panel → Forms: the seeded form; a submission on `/pl` → an entry in Form Submissions + 2 emails (SMTP:
Site Integrations → SMTP → Send test); with Turnstile test keys the widget is visible, without a token the submission is rejected;
Site integrations → SMTP → Send test); with Turnstile test keys the widget is visible, without a token the submission is rejected;
`node .agents/skills/ipal-consent-check/scripts/consent-check.mjs http://localhost:3000/pl` = 0 errors;
after a choice in the banner a new record in Consent records.
**Turn off / override.** Turnstile: both keys empty (panel and env) → no widget and no verification; fail-closed
`turnstileOnConfigError: 'reject'`; the Turnstile/SMTP fields in Site Integrations currently always. Form look:
`turnstileOnConfigError: 'reject'`; the Turnstile/SMTP fields in Site integrations currently always. Form look:
`formClasses`, unusual ones → `useBuilderForm` (no copy of the engine). Banner: `settings`, `controls`, `order`,
`equalChoice`, `classNames`, tokens; no `consentLog` = no register and no endpoint (then remove `logEndpoint`).
**Consent Mode choice** (record it in "Project decisions"): `'advanced'` (default) — the Google tag loads at once with
@@ -428,7 +450,7 @@ no request to `googletagmanager.com` before analytics or marketing consent (a cl
Check in `basic`: DevTools → Network shows no `gtm.js` / `gtag/js` before consent. Analytics: empty IDs in the panel or
`analytics={false}`. Forms: `createSubmitAction({ turnstileHostnames: ['client.pl'] })` rejects a token solved on
another domain (leave it empty in dev — Cloudflare test keys report `example.com`). The locale cookie respects consent;
after an editor bumps Cookie Settings → Policy version nothing to change (`createProxy(config, { policyVersion })` pins one).
after an editor bumps Cookies → Policy version nothing to change (`createProxy(config, { policyVersion })` pins one).
## 10. Navigation
@@ -470,14 +492,14 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
**Panel steps for the user** (`/admin`, paste them this list with the gaps from the report):
1. First user with the **admin** role + 2FA setup (TOTP app).
2. **Site Settings → General**: site name, logo, favicon (PNG), description.
2. **Site settings → General**: site name, logo, favicon (PNG), description.
3. **Pages**: home page (title and slug **in every language**, otherwise `/en` → 404), 404, privacy policy,
cookie policy (with the `CookieTable` block), terms if needed; `noindex` on the policies; AI summary.
4. **Site Settings → System Pages**: Homepage (without it `/pl` → 404), 404, policies; content collection archives.
5. **Cookie Settings**: banner texts, Privacy link label, Policy version, Cookies (import from the scan), Detail labels —
4. **Site settings → System pages**: Homepage (without it `/pl` → 404), 404, policies; content collection archives.
5. **Cookies**: banner texts, Privacy link label, Policy version, Cookies (import from the scan), Detail labels —
in every language.
6. **Notifications**: form messages in every language.
7. **Site Integrations**: SMTP or Graph (From Name/Address; Send test), Turnstile (for testing site
7. **Site integrations**: SMTP or Graph (From Name/Address; Send test), Turnstile (for testing site
`1x00000000000000000000AA`, secret `1x0000000000000000000000000000000AA`; production keys from the client), analytics/pixel
IDs, IndexNow → generate key. Mail/Turnstile errors show up as a dashboard alert.
8. **Forms**: check the addresses in the Emails tab of the seeded forms.
@@ -515,7 +537,7 @@ prepare the list with values, a human adds them, you verify with `dig`). Full ta
From domain: SMTP from the panel → the domain of the *From address* (records from the mailbox provider); Graph → From is
always `GRAPH_SENDER` (agency domain, set once — nothing in the project). After DNS: *Send test* and in the received
email `Authentication-Results: spf=pass dkim=pass dmarc=pass`. We verify Search Console **via DNS** —
the verification fields in Site Settings → Search & AI stay **empty** (only URL-prefix verification uses them; the plugin then adds the `<meta>` itself); submit the sitemap `https://client.pl/sitemap.xml`
the verification fields in Site settings → Search engines stay **empty** (only URL-prefix verification uses them; the plugin then adds the `<meta>` itself); submit the sitemap `https://client.pl/sitemap.xml`
once by hand in GSC and Bing (no API). Turnstile, IndexNow, llms, MCP — no DNS.
Final report: what is wired, what is missing (data, keys, decisions), the DNS record list with values (`dig` status), every `ipal-audit-skip`, any
+11 -6
View File
@@ -28,7 +28,7 @@ between phases. Before each phase, go through the "Anticipate" table in AGENT.md
4. Which address should form submissions go to? (without it the form seed won't run — the only question without which I can't deliver forms)
5. Analytics: GA4/GTM/pixel IDs? (off until the IDs are entered in the panel)
6. R2 details: bucket, endpoint, keys, media domain? (R2 is always wired; until the keys arrive, media stay local in dev)
7. Turnstile keys? (test keys in dev; you'll enter production keys in Site Integrations)
7. Turnstile keys? (test keys in dev; you'll enter production keys in Site integrations)
8. AI access to content (llms.txt, Markdown, MCP, AI bots)? (on — I turn it off only at your explicit request)
9. Translations: should I make drafts for approval? (yes, marked in the report)
```
@@ -44,7 +44,7 @@ between phases. Before each phase, go through the "Anticipate" table in AGENT.md
## Phase 2 — Content model
- Pages = `Pages` + blocks. Collections only for lists with URLs (**ipal-collection**).
- Globals: Header, Footer, Company (**ipal-nav**), Site Settings, System Pages.
- Globals: Header, Footer, Company (**ipal-nav**), Site settings, System pages.
- Every section from the site map → an existing block, a variant of an existing one (`variant`)
or a new block. Goal: as few blocks as possible, as many variants as possible.
- Schema change with content in the database → **ipal-migrate-fields**, never "live".
@@ -55,6 +55,11 @@ between phases. Before each phase, go through the "Anticipate" table in AGENT.md
Order: Hero → recurring sections (FeatureGrid, CTA, FAQ…) → specific ones.
Every block: schema from the field dictionary, composition of primitives, zero text in JSX
(`ipal-audit --quick` after every block — fix errors right away).
**Enlarged images** (gallery, cards, product photos, certificates, rich text): the shared lightbox,
never a hand-made modal or a lightbox library — `ipalKit({ lightbox: true })` + migration,
`<SiteProviders lightbox>` once, `<LightboxTrigger group={`gallery-${id}`} image={lightboxImage(media, { size })}>`
around the thumbnail, `RenderRichText lightbox` for article images, Form messages → Image viewer labels
in every language (lightbox.md). Check with the keyboard: Enter opens, ←/→ browse, Esc returns focus.
## Phase 5 — Forms → **ipal-form**
Every form = a seed from `ipal-form/resources/seed-form.template.ts` (fields, confirmation, email to the
@@ -72,18 +77,18 @@ form with fields in JSX, an `api/contact` route, `nodemailer`, reCAPTCHA (AGENT.
On production (rules: `node_modules/@intecion/ipal-kit/docs/seeding.md`): `SEED_DRY_RUN=1` first, back up the
database, then the real run. It only creates what is missing; `SEED_UPDATE=1` there is refused without
`IPAL_SEED_ALLOW_PROD_UPDATE=1` and still skips pages an editor changed (`skip (edited)`).
3. System Pages: Homepage, 404, privacy policy (the page exists; the policy
text comes from the client → placeholder). Cookie Settings (with Detail labels and the Cookies list
3. System pages: Homepage, 404, privacy policy (the page exists; the policy
text comes from the client → placeholder). Cookie banner (with Detail labels and the Cookies list
from the scan), Notifications — texts in every language.
4. **ipal-locale-add → `locale-coverage`** = 0 gaps (or deliberate ones listed in the report).
5. Images: leave upload fields empty (the editor adds them) or upload files from
the brief via the panel — prepared (WebP/JPG ≤ 1.5 MB, ≤ 2560 px).
## Phase 7 — Integrations (panel, not code)
Site Integrations: email transport + **Send test**, Turnstile (both keys — one
Site integrations: email transport + **Send test**, Turnstile (both keys — one
key = Turnstile off and a red alert on the dashboard), analytics/pixels
(only with IDs from the client), consent (categories matching the tools in use).
Site Settings: name, description (feeds llms.txt and MCP), OG image, favicon. SEO tab: meta
Site settings: name, description (feeds llms.txt and MCP), OG image, favicon. SEO tab: meta
title/description of every page (≤ 60 / ≤ 155 characters, unique); `aiSummary` —
keep the auto-fill or fix it when the summary is weak.
+85 -8
View File
@@ -47,25 +47,25 @@ a custom RenderBlocks for `h1` (→ `isFirst`). Links to posts: `buildLinkField(
`NEXT_RUNTIME` condition around the `revalidatePath` injected into `buildRevalidateHook` (a global's own `afterChange` hook keeps it — ipal-nav), the form focus guard, a custom theme (→ `ThemeScript`/`ThemeSwitcher`),
a custom table of contents (→ `extractHeadings` + `TableOfContents` + `headingIds`), catching `notFound` for a redirect
(→ `onMissing: 'redirectHome'`), background colour only for JPEG in `<Media>`, a custom type instead of `CmsLink['appearance']`
(→ per-shape types from `generate:types`: `CmsLink`, `CmsLinkPlain`, `CmsLinkNoLabel`, `CmsLinkPlainNoLabel`; style: `LinkAppearance`). Cookie Settings: `buttons.save` →
(→ per-shape types from `generate:types`: `CmsLink`, `CmsLinkPlain`, `CmsLinkNoLabel`, `CmsLinkPlainNoLabel`; style: `LinkAppearance`). Cookie banner: `buttons.save` →
`buttons.savePreferences` — in `migrate:create` choose **rename** for the column to keep the texts.
**→ 1.12.3 (PROGRAMISTA §6, item 46):** Postgres/SQLite: `migrate:create` (new Cookie Settings group →
**→ 1.12.3 (PROGRAMISTA §6, item 46):** Postgres/SQLite: `migrate:create` (new Cookie banner group →
`detailLabels`, only new columns — no rename). A custom cookie settings window or a cookie list added to
the banner → `<CookieBanner settings="detailed">` and remove the copy. With `detailed`: Cookie Settings → Cookies filled in
the banner → `<CookieBanner settings="detailed">` and remove the copy. With `detailed`: Cookies → Cookie list filled in
(scan, **ipal-consent-check**) and Detail labels in every language.
**→ 1.13.0 (PROGRAMISTA §6, item 47; CHANGELOG "What projects must update" — do all 7, in order):**
1. **Project without `access`** (no `roles` field): every logged-in account can now use the plugin's admin and editor
features (Site Integrations, settings globals, test e-mail, stats, consent records, forms, form submissions); before,
features (Site integrations, settings globals, test e-mail, stats, consent records, forms, form submissions); before,
nobody could through the API. Check who can log in (`grep -rn "auth:" src/collections`, open sign-up, customer
accounts). Untrusted accounts → add `access` (roles), or narrow with `globalOverrides`, `forms.formOverrides` /
`forms.formSubmissionOverrides`, `consentLog.collectionOverrides`, `stats.collectionOverrides`. Verify: log in as a
non-staff account → `GET /api/globals/site-integrations` is 403.
2. **Project with `access`:** plain `user` accounts can no longer edit Site Settings, Cookie Settings, Notifications or
2. **Project with `access`:** plain `user` accounts can no longer edit Site settings, Cookie banner, Notifications or
forms, or create/delete users. List staff accounts in the panel (Users → Roles) and give them `editor` / `admin`, or
loosen with `globalOverrides`, `forms.formOverrides.access`, `access.authAccess`. Verify: an editor saves Site Settings.
3. **Postgres/SQLite:** `pnpm payload migrate:create` → `migrate` (Site Settings → Search & AI:
loosen with `globalOverrides`, `forms.formOverrides.access`, `access.authAccess`. Verify: an editor saves Site settings.
3. **Postgres/SQLite:** `pnpm payload migrate:create` → `migrate` (Site settings → Search engines:
`search_verification_*`, `ai_crawlers_policy`, the `ai_crawlers_rules` table, localized `llms_intro`). With
`enabled: false` the migration now keeps (or restores) the plugin's tables — check it has no DROP TABLE. MongoDB: nothing.
4. `pnpm payload generate:importmap`, `pnpm ipal:skills`, `rm -rf .next`.
@@ -75,13 +75,90 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
startup (`allowCollectionMismatch: true`); requests without a client IP share one limited bucket (proxy hides the IP
→ `IPAL_IP_HEADER`, or `setUnknownIpFactor`); `RenderRichText` turns unsafe link URLs into `#` (`safeLinks`).
6. **Review the new options with the user** (AGENT.md §7.1): `consentMode: 'basic'`, `revalidatePath`,
`turnstileHostnames`, Site Settings → Search & AI (verification codes, or keep DNS verification), `app/robots.ts` →
`turnstileHostnames`, Site settings → Search engines (verification codes, or keep DNS verification), `app/robots.ts` →
`export { getRobots as default }` + `force-dynamic`, `createSearchRoute({ …, isPathVisible })`, `access.firstUserAdmin`.
7. **Remove the workarounds:** a plugin after `ipalKit` that adds `afterChange` or access to the plugin globals →
`ipalKit({ revalidatePath })` / `globalOverrides`; a hand-written global revalidation hook →
`buildGlobalRevalidateHook({ revalidatePath })`; `consentFieldName` passed only because the option was ignored →
`forms.consentFieldName` works now; your own seed guard / upsert code → `@intecion/ipal-kit/seed` (`createSeeder`).
**Every upgrade — Next.js 16.4.1 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.1 →
`pnpm add next@^16.4.1 eslint-config-next@^16.4.1 sharp@^0.35.5`, `rm -rf .next`, build, redeploy on Coolify
(a new image ships the fixed next and sharp). **Check:** `pnpm dev` prints no security-upgrade warning.
**Every upgrade — dependency advisories** (AGENT.md §4 item 12): `pnpm audit --prod`; with `payload` 3.90.x add the
`dompurify` and `undici` overrides, `pnpm install`, audit again. **Check:** no high or critical.
**→ 1.14.0 (PROGRAMISTA §6, items 48–49; CHANGELOG "What projects must update" — do all 8, in order):**
1. `pnpm payload generate:importmap` — `@intecion/ipal-kit/admin#FaviconCheck` (hint under Site settings → Site icon)
and the `RowLabel` entries are injected into every project; then `pnpm ipal:skills`, `rm -rf .next`. **Check:** pick
a 32×32 PNG as the site icon → a warning appears under the field; saving still works.
2. **Node.js 20.9 or later** (the plugin's `nodemailer` 10 needs it) — check the Coolify build image and `.nvmrc` /
`engines`. Remove `nodemailer` and `@types/nodemailer` from the project's own `package.json` if someone added them
(the plugin's copy is the one `mailAdapter` uses). **Check:** Site integrations → E-mail sending → send a test
e-mail over SMTP (and over Microsoft Graph when the project uses it).
3. **Next.js 16.4.1 or later** — the "Every upgrade — Next.js" step above (`next@^16.4.3`, `sharp@^0.35.5`).
4. **Dependency advisories** — the "Every upgrade — dependency advisories" step above (`dompurify` / `undici` overrides
on payload 3.90.x). **Check:** `pnpm audit --prod` → no high or critical.
5. **Cookie list kept by hand** → offer `cookieScanner: true` (+ `crawl: true` with `IPAL_COOKIE_SCAN_URL`,
`IPAL_COOKIE_SCAN_TOKEN` and the site in the service's `IPAL_CRAWLER_SITES`, cookie-scanner.md); an own image modal →
`lightbox: true` + `<SiteProviders lightbox>` (PROGRAMISTA item 48). Turning either on → Postgres/SQLite
`migrate:create` → `migrate`. Without them: no schema change.
6. **Admin languages:** English and Polish by default when the project sets no `i18n.supportedLanguages`. Ask the
client; English only → `i18n: { supportedLanguages: { en } }`. Own admin texts → `i18n.translations.<lang>.ipal`.
7. **Frontend texts:** validator messages are full sentences and `pl` locales get Polish fallbacks — grep the
project's tests and code for the old strings (`'required'`, `'invalid email'`) and update them.
8. **Sidebar:** `roles` (users) and Cookies → Consent version moved to the sidebar — update editor instructions.
Nothing else to change: the statistics tab title, the cookie scanner's integration names and the maintenance
notice's close button follow the language by themselves.
**→ 1.14.2 (PROGRAMISTA §6, item 51; 2FA setup loop; security.md) — required with 2FA on:**
1. `pnpm payload generate:importmap` — the plugin swaps `@clocklimited/payload-2fa/rsc#TOTPProvider` for
`@intecion/ipal-kit/admin#TotpRedirectProvider`; commit `importMap.js`, `rm -rf .next`, redeploy on Coolify.
**Check:** log in as a new admin (or a throwaway one) → `/admin/setup-totp?back=%2Fadmin` with the QR code, no
reloading; after the code → back on `/admin`. A project that wrote its own `x-pathname` proxy rule for `/admin`
as a workaround can drop it.
**→ 1.14.1 (PROGRAMISTA §6, item 50; X-Powered-By, CSP; security.md) — nothing required, recommended in this order:**
1. **Hide `X-Powered-By`** — `next.config.ts`: `export default withPayload(withSecurityConfig(nextConfig))`
(import `withSecurityConfig` from `@intecion/ipal-kit`); remove a hand-written `poweredByHeader: false` or a header
override if the project had one. **Check:** `curl -sI localhost:3000/pl | grep -i x-powered-by` → nothing (also on
`/admin` and `/api/health`).
2. **CSP, report-only first** — no CSP yet, or a hand-written one → `buildSecurityHeaders({ csp: { mode: 'report-only',
reportUri: '/api/csp-report', r2Url: process.env.R2_PUBLIC_URL, <flags for what the site loads> } })`, the admin rule
`{ source: '/admin/:path*', headers: buildAdminCspHeaders({ mode: 'report-only', reportUri: '/api/csp-report' }) }`
after the site-wide one, and `src/app/api/csp-report/route.ts` = `export const POST = createCspReportRoute()`.
Flags: what the panel's Site integrations and the code load (analytics, metaPixel, linkedIn, tiktok, clarity,
turnstile, youtube, googleMaps); anything else → `extra`. **Check:** `curl -sI localhost:3000/pl | grep -iE
'content-security-policy-report-only|reporting-endpoints'`; the main pages and `/admin` in a browser, accept the
cookie banner → no `[Report Only]` lines in the console. Deploy.
3. **Enforce later** — after a few days of clean `[csp]` lines in the Coolify logs: `mode: 'enforce'` in both places,
redeploy, check the pages again. Record the date in `AGENTS.md` → "Project decisions".
**→ 1.14.3 (PROGRAMISTA §6, item 52; cookie approval; cookie-scanner.md) — only with `cookieScanner`:**
1. `pnpm payload generate:importmap` — `@intecion/ipal-kit/admin#CookieApprovalView` and
`@intecion/ipal-kit/admin#CookieCrawlAlert` (the dashboard reminder, also without `crawl`); commit `importMap.js`.
2. Postgres/SQLite: `pnpm payload migrate:create` → `migrate` (`cookie_review.change` enum + index,
`cookie_review.needs_description`); check the migration only adds columns. MongoDB: nothing.
3. Tell the editors about **Approve cookies** (`/admin/cookie-approval`, linked from the scan box on Privacy →
Cookie review and from the dashboard): tick, **Approve and add**, then
describe the ones marked **Needs description**. The client wants the old entry-by-entry review →
`cookieScanner: { approval: false }`; unknown cookies in another category → `approval: { unknownCategory }`.
4. Behaviour: hand-typed Cookie list rows are looked up only while they have no review entry.
**Check:** run a scan → the cookies appear on `/admin/cookie-approval`; approve one → it is in Cookies →
Cookies in every language; the dashboard shows the reminder while cookies wait. Without `cookieScanner`: nothing.
**→ 1.14.4 (PROGRAMISTA §6, item 53; cookie languages and one Cookies entry; consent.md, cookie-scanner.md):**
1. `pnpm payload generate:importmap` — with `cookieScanner`: `@intecion/ipal-kit/admin#CookieReviewTab` and (with
`crawl`) `@intecion/ipal-kit/admin#CookieSiteCheckTab`; commit `importMap.js`. No migration.
2. **Ask the client** about the two new defaults (both overridable): empty languages of the cookie texts fill
themselves from the language an editor writes in (`ipalKit({ fillEmptyLocales: false })` to turn it off); with
`cookieScanner` the cookie screens become one **Cookies** entry with **Review and approve** and **Site check** tabs
(`cookieScanner: { adminLayout: 'separate' }` for the old entries).
3. Editor instructions and screenshots: **Cookie banner** is now **Cookies**.
**Check:** one **Cookies** entry in the admin navigation; its tabs list the review entries and the site check;
type a cookie purpose in one language and save → the other languages show it, and a language with its own text keeps it.
## 2. Inventory (no code changes)
For **every** item in the PROGRAMISTA §6 table show evidence (grep / file) of whether
it applies to the project. Run the **ipal-audit** skill (`--quick`) and attach the result.
+3 -3
View File
@@ -18,7 +18,7 @@ according to the consent from the consent module:
## Config
No options in `payload.config` — the plugin reads the IDs from the **Site
Integrations** global (Settings → Site Integrations):
Integrations** global (Settings → Site integrations):
| Field (`name`) | Format (validated) | Consent category |
|---|---|---|
@@ -222,7 +222,7 @@ Container ID and keep GA4 alone, to rule out the container as a variable.
## Turn off, override, extend
- **Turn off:** do not mount `<Analytics>` (or `SiteProviders analytics={false}`), or leave the ID
fields in Site Integrations empty. The *Analytics* tab in the `site-integrations` global is currently
fields in Site integrations empty. The *Analytics* tab in the `site-integrations` global is currently
always added (you can hide or change it with `ipalKit({ globalOverrides: { 'site-integrations': … } })`).
- **Override:** the `<Analytics>` props are plain IDs — you can pass your own instead of
`getAnalyticsConfig`; `consentMode` (`'advanced'` / `'basic'`) sets when the Google tag may load;
@@ -232,7 +232,7 @@ Container ID and keep GA4 alone, to rule out the container as a variable.
categories to Google signals currently cannot be changed with an option.
- **Extend:** other scripts → `ConsentScript` ([consent.md](./consent.md)); low-level
`loadMetaPixel` / `loadClarity` / `loadLinkedIn` / `loadTikTok`, `pushDataLayer` from `/client`;
`setDefaultConsent` / `updateConsent` from the root; your own fields in Site Integrations via
`setDefaultConsent` / `updateConsent` from the root; your own fields in Site integrations via
`ipalKit({ integrationsFields })` (*Custom* tab).
## Meta Pixel via GTM
+52 -13
View File
@@ -14,8 +14,10 @@ project.
## Config
The **CookieSettings** global (slug `cookie-settings`, group *Settings*) is always
built. Public read (`read: () => true` — the banner reads it for anonymous
The **CookieSettings** global — **Cookies** in the admin (slug `cookie-settings`, group *Privacy*) — is always
built. Tabs: *Banner*, *Settings window*, *Categories*, *Cookie list*; with the cookie scanner also
*Review and approve* and *Site check* (one entry for everything about cookies — see
[cookie-scanner.md → Admin layout](./cookie-scanner.md#admin-layout)). Public read (`read: () => true` — the banner reads it for anonymous
visitors); `update` is limited to the `admin` and `editor` roles (`adminOrEditor` —
consent texts are legal copy, not for plain `user` accounts). To change it:
`ipalKit({ globalOverrides: { 'cookie-settings': { access: { update } } } })`.
@@ -28,8 +30,8 @@ from a separate field.
| What | Where from |
|---|---|
| Where it leads | Site Settings → System Pages → Privacy Policy |
| Link text | Cookie Settings → `privacyLinkLabel` (per language) |
| Where it leads | Site settings → System pages → Privacy Policy |
| Link text | Cookies → `privacyLinkLabel` (per language) |
| When the text is empty | title of the policy page in that language |
`privacyPolicy` options in `getConsentTexts`: omit (automatic), `false` (no
@@ -64,8 +66,8 @@ export default async function Layout({ children, params }) {
const { locale } = await params
const payload = await getPayload({ config })
// texts from Cookie Settings; the policy link is automatic:
// target = System Pages → Privacy Policy, text = Cookie Settings → privacyLinkLabel
// texts from Cookie banner; the policy link is automatic:
// target = System pages → Privacy Policy, text = Cookies → privacyLinkLabel
const texts = await getConsentTexts({ payload, config: i18nConfig, locale })
return (
@@ -84,6 +86,11 @@ export default async function Layout({ children, params }) {
the opposite (it shows only after a decision and reopens the banner); both
render only after mounting on the client.
Built-in banner texts follow the page language: `consentFallback(locale)` → `CONSENT_FALLBACK_PL` on `pl`,
`CONSENT_FALLBACK` (English) otherwise; panel values always win. Category names for your own selects:
`CONSENT_CATEGORY_LABELS` (`{ en, pl }` per category), `consentCategoryOptions()`. `<CookieTable>`
takes `locale` and optional `labels`; defaults: `COOKIE_TABLE_LABELS` (`@intecion/ipal-kit/rsc`).
`getConsentTexts({ payload, config, locale, privacyPolicy?, settingsSlug? })` —
`settingsSlug` is the SiteSettings slug for the automatic link (default
`'site-settings'`). Empty fields in the panel → English fallback.
@@ -243,7 +250,7 @@ Three settings modes to pick in the project — one prop:
<CookieBanner equalChoice controls="switch" settings="detailed" />
```
The cookie list comes from **Cookie Settings → Cookies** (the same source as `<CookieTable>` on the policy
The cookie list comes from **Cookies → Cookie list** (the same source as `<CookieTable>` on the policy
page), filtered by category — a category without entries has no expandable list. List labels: **Cookie
Settings → Detail labels** (`cookies` — e.g. "Cookies used", the counter is added automatically; `provider`,
`purpose`, `duration`), per language; empty → English. `getConsentTexts` passes this in `texts.cookies` /
@@ -252,7 +259,8 @@ window width `max-w-4xl` — change it with `classNames.dialog`.
Which mode to choose: the project design decides. If the brief is silent → `'detailed'` (at the moment of
consent the user sees which cookies are set and by whom — full information where the decision is made),
provided the Cookies list is filled from a scan (`ipal-consent-check` → cookie-scan); an empty list = a
provided the Cookies list is filled from a scan (`ipalKit({ cookieScanner: true })` → *Cookie review* → **Scan cookies** → *Approve cookies* → **Approve and add**,
[cookie-scanner.md](./cookie-scanner.md), or `ipal-consent-check` → cookie-scan); an empty list = a
window without expandable lists, then `'modal'` is enough. Record the decision in `AGENTS.md` →
"Project decisions".
@@ -260,7 +268,7 @@ Recommendation (AGENT.md §7): tokens and `classNames` first — then fixes from
project. When you need a completely different layout, you can build your own window; the data is in the
context: `useConsentContext()` → `texts.cookies`, `texts.details`, `state`, `savePreferences`.
Texts from the panel (**Cookie Settings**, per language) — empty field = the element is not shown:
Texts from the panel (**Cookies**, per language) — empty field = the element is not shown:
| Field | Where |
|---|---|
@@ -280,7 +288,7 @@ The elements also have stable `data-ipal` handles for CSS and e2e tests (used by
`accept`, `back`, `save`; in modal mode also `consent-overlay`, `consent-dialog`, `close`; in detailed mode
additionally `category-<category>` (card) and `cookies` (expandable list).
Accessibility: the banner dialog and `CookieButton` have an `aria-label` from **Cookie Settings →
Accessibility: the banner dialog and `CookieButton` have an `aria-label` from **Cookies →
title** or **settingsTitle** (per language) — no hard-coded texts in the components. The modal has
`aria-modal`, focus on ✕ after opening and closes on Escape; switches have `role="switch"` and `aria-checked`.
@@ -324,9 +332,32 @@ independent consent state).
> The consent mechanism for the locale is also described from the i18n side:
> [i18n.md](./i18n.md#locale-cookie-and-consent-gdpr).
## Every language filled (`fillEmptyLocales`)
The cookie list's **Purpose** and **Duration** are per language. Text an editor writes in one language
is copied to every language where that field is still empty, when the document is saved — a cookie
added in Polish is not blank on the English page. A language that already has its own text is never
overwritten, so each language can still be changed on its own. The same applies to the cookie review
entries (purpose, duration). Cookie scanner and approval writes do the same with their own texts:
English and Polish where they exist, the default language's text for any other language.
Payload's `localization.fallback` covers only part of this: an empty language *reads* as the default
language's text, but nothing is stored, the admin shows the field empty, and the text always comes
from the default language, not from the one just edited.
| Option | Default | |
|---|---|---|
| `fillEmptyLocales` | `true` | `false` = off; `{ 'cookie-settings': ['cookies.purpose'], 'cookie-review': [] }` = choose the fields per slug (`[]` = off for that slug). Field paths: `'field'` or `'arrayField.subField'` |
Building blocks for your own globals and collections (`@intecion/ipal-kit`):
`buildFillEmptyLocalesGlobalHook({ global, fields })`, `buildFillEmptyLocalesCollectionHook({ collection, fields })`
(afterChange hooks), `fillEmptyLocales({ payload, target, source, sourceLocale, fields, req? })` (the
core, `FillEmptyLocalesTarget` = `{ global }` or `{ collection, id }`), and `withFillLocales(kind, config, fields)`
to add the hook to a config. Nothing to migrate.
## Policy version, withdrawing consent, consent log, cookie table (1.9.1)
- **New consent after a policy change:** Cookie Settings → *Policy version* (sidebar). Raise it by 1
- **New consent after a policy change:** Cookies → *Consent version* (sidebar). Raise it by 1
after adding a tool or changing the policy — every visitor will see the banner again.
`getConsentTexts` passes the version to `<ConsentProvider texts>` automatically.
- **Withdrawing consent deletes the tools' cookies** (`_ga`, `_ga_*`, `_gid`, `_fbp`, `_gcl_*`, Clarity,
@@ -342,8 +373,9 @@ independent consent state).
choices, the policy version and the time — **no IP and no user agent**. *Consent records* collection
(admin only), automatic cleanup after `retentionDays` (default 1095). Details below. Postgres:
`migrate:create`.
- **Cookie table** for the policy page: Cookie Settings → *Cookies* (filled by a scan,
skill `ipal-consent-check` → cookie-scan) + `getCookieTable` + `<CookieTable>` from `/rsc`.
- **Cookie table** for the policy page: Cookies → *Cookie list* + `getCookieTable` + `<CookieTable>` from `/rsc`.
Fill the list from the panel with the cookie scanner (`cookieScanner` option — one approval adds every cookie found to the list, the table and the detailed window,
[cookie-scanner.md](./cookie-scanner.md)) and check the real site with `ipal-consent-check` → cookie-scan.
- Consent cookie: `cookie-consent` (`CONSENT_COOKIE`), JSON `{ id, state, timestamp, version }`,
`max-age` 180 days (`CONSENT_MAX_AGE`), `samesite=lax`, `Secure` on HTTPS. Consent with another
policy version is treated as no decision.
@@ -389,6 +421,13 @@ ipalKit({
global (write access is `admin` + `editor` by default, hooks, admin options):
`ipalKit({ globalOverrides: { 'cookie-settings': { access: { update } } } })` — your access rules win,
your hooks run after the plugin's; a function gets the plugin's global and returns the one to use.
- **Cookie list from the panel:** `ipalKit({ cookieScanner: true })` — opt-in: scan, then one **Approve and add**
on the *Approve cookies* page puts every cookie found into the cookie list (and so into `<CookieTable>` and the
detailed window); `cookieScanner: { approval: false }` keeps per-entry review. See
[cookie-scanner.md](./cookie-scanner.md) (off, overrides and building blocks there).
- **Pre-consent check in a real browser:** `cookieScanner: { crawl: true }` + the shared scanner service
— **Check site** in the panel, violations (non-necessary cookies or trackers before consent), dashboard
warning, optional e-mail ([cookie-scanner.md → Browser crawl](./cookie-scanner.md#browser-crawl)).
- **Extend:** `cookieMap` (your own cookies to delete), `ConsentScript` (scripts without Consent
Mode), `useConsentContext()` (your own UI: `state`, `acceptAll`, `rejectAll`, `savePreferences`,
`reopen`, `texts`), server-safe helpers (`parseConsent`, `readConsentRecord`, `CONSENT_COOKIE`,
+9 -7
View File
@@ -5,13 +5,13 @@ subpages (e.g. a brief), and everything else is blocked — no code changes, one
## Panel
**Site Settings → Under construction** (the tab is there when the `pages` module is on):
**Site settings → Maintenance** (the tab is there when the `pages` module is on):
| Field | Meaning |
|---|---|
| Site under construction | turns the mode on |
| Pages still available | pages that still open; **the home page is always available** |
| Notice title / text / Close button label | popup content (per language); empty button → `×` |
| Notice title / text / Close button label | popup content (per language); empty button → `×` with a screen-reader name in the page language ("Close" / "Zamknij") |
Fields in the SiteSettings global: group `construction` → `enabled`, `allowedPages` (relationship to the pages
collection, hasMany), `title`, `message`, `buttonLabel` (localized).
@@ -67,24 +67,26 @@ import { ConstructionNotice } from '@intecion/ipal-kit/client'
`ConstructionMode`). Pure logic: `isPathAllowed(pathname, allowedPaths)`,
`constructionNoticeHref(homePath)`, the constant `CONSTRUCTION_NOTICE_PARAM` (`@intecion/ipal-kit`).
New fields in Site Settings = a migration in the project (`payload migrate:create`).
New fields in Site settings = a migration in the project (`payload migrate:create`).
## Turn off, override, extend
- **Turn off:** the *Site under construction* switch in the admin panel. The *Under construction* tab is
- **Turn off:** the *Maintenance mode* switch in the admin panel. The *Maintenance* tab is
currently always added when the `pages` module is on (there is no separate option). Without `redirect` in
`createPageRoute` addresses are not blocked; without `<ConstructionNotice>` links are not intercepted.
Markdown / MCP without the filter even with the mode on:
`createContentHelpers({ markdown: { isPathVisible: () => true }, mcp: { isPathVisible: () => true } })`;
sitemap / llms.txt without the filter: `createContentHelpers({ underConstructionSeo: false })`.
- **Override:** popup look through `classNames` (`overlay`, `dialog`, `title`, `message`, `button`);
- **Override:** the `×` button's screen-reader name through `closeLabel` (default by `locale`, which defaults to
`mode.locale` from `getConstructionMode(locale)`; `constructionCloseLabel(locale)` is the default);
popup look through `classNames` (`overlay`, `dialog`, `title`, `message`, `button`);
texts in the admin panel. Your own rule = your own `isPathVisible` function in the options above or in `createSearchRoute`.
Access/hooks of the Site Settings global: `ipalKit({ globalOverrides: { 'site-settings': … } })`.
Access/hooks of the Site settings global: `ipalKit({ globalOverrides: { 'site-settings': … } })`.
- **Extend:** `getConstructionMode(locale)` + `isPathVisibleIn` / `isPathAllowed` / `pathOf` /
`constructionNoticeHref` let you add blocking in your own routes.
- **Check:** mode on → `/md/pl/<hidden>` = 404, MCP `get_page` = "No page found",
`list_pages` does not show it, the sitemap does not list it.
- **One rule for all visitors** — pages stay static (ISR), with no session check. Saving Site Settings
- **One rule for all visitors** — pages stay static (ISR), with no session check. Saving Site settings
revalidates the whole site only when the project passes `ipalKit({ revalidatePath })`
(see [hooks.md](./hooks.md)); without it, already rendered/cached pages show the old state until the ISR
window ends.
+5 -5
View File
@@ -9,7 +9,7 @@ picked as this collection's archive.
```
posts collection ──(config)──► "this is an archive collection"
"Artykuły" page ──(System Pages)──► "I am the archive of the posts collection"
"Artykuły" page ──(System pages)──► "I am the archive of the posts collection"
entry ──► belongs to posts, nothing more
```
@@ -45,7 +45,7 @@ ipalKit({
})
```
Each item adds to **Site Settings → System Pages** a relationship field
Each item adds to **Site settings → System pages** a relationship field
"{label} — archive page" named `{slug}Archive` (`archiveFieldName('posts')` →
`'postsArchive'`), pointing at the `pages.slug` collection.
@@ -86,7 +86,7 @@ const route = await resolveRoute({
```
Without `draft: true`, documents with a `_status` other than `published` (page, archive,
entry) give `null`. The page assigned as 404 in System Pages also gives `null`
entry) give `null`. The page assigned as 404 in System pages also gives `null`
(a real 404 instead of a soft 404).
Logic: the first segment is matched against the slugs of the archive pages from System
@@ -125,7 +125,7 @@ the factory and shared — that is why it is a factory, not loose functions. Wit
`cache()` would not dedupe across helpers, and Next calls generateMetadata and
the page component separately.
`getSettings(locale)` reads Site Settings with **`depth: 1`** — relationships (logo, pages in menus,
`getSettings(locale)` reads Site settings with **`depth: 1`** — relationships (logo, pages in menus,
system pages) arrive as documents (`slug`, `title`), but **their** relationships arrive as IDs.
The page that `resolveRoute` renders (home page, archive, regular page) is fetched
separately with `depth: 2`. Need more depth in the layout (e.g. the image of a page linked in the menu)?
@@ -326,7 +326,7 @@ export const dynamic = 'force-dynamic'
`createMarkdownRoute` / `markdownRoute`: 404 for unknown/unpublished pages, database error → 503.
Under-construction mode: with `isPathVisible` (`markdownRoute` from `createContentHelpers` passes it by itself),
pages hidden by Site Settings → Under construction also give 404.
pages hidden by Site settings → Maintenance also give 404.
The full AI set: this endpoint + `llms.txt` (see [seo.md](./seo.md)) + letting
bots in through robots.txt.
+471
View File
@@ -0,0 +1,471 @@
# cookie scanner
Fills the cookie list (Cookies → Cookie list) from the admin panel. A scan lists the cookies of
every integration the project switches on, plus any extra names, in a review list. The editor then
sees **one summary** — *Approve cookies*, grouped by consent category, new / changed / unknown marked —
and one button, **Approve and add**, puts every ticked cookie everywhere it is listed: the cookie list,
which feeds the `<CookieBanner settings="detailed">` window and `<CookieTable>` on the policy page
([consent.md](./consent.md)). Projects that prefer it keep per-entry review (`approval: false`).
What a scan never does: delete an entry, change text an editor edited, change an entry's status,
add a second row for a cookie that is already listed, or add anything to the cookie banner before
the editor approves.
Opt-in (`cookieScanner`, default off). Nothing is fetched at runtime and no browser is needed.
A second, also opt-in step — **Check site** (`cookieScanner.crawl`, see [Browser crawl](#browser-crawl)) —
opens the site in a real browser twice (no consent / after "Accept all") through a shared scanner
service, reports every non-necessary cookie or tracker present before consent as a violation, and adds
what it finds to the same review list. The browser runs in the service, never in the site.
## Turn it on
```ts
// payload.config.ts
ipalKit({
// …
cookieScanner: true,
})
```
Then, in the project:
1. **Import map** — the scan box, the *Review and approve* / *Site check* tabs and the approval view
are admin components (`@intecion/ipal-kit/admin#CookieScanButton`, `#CookieReviewTab`,
`#CookieSiteCheckTab`, `#CookieApprovalView`). Run `pnpm generate:importmap` (again after upgrading
to the combined layout — the two tab components are new).
2. **Postgres / SQLite migration** — the option adds the `cookie-review` collection (with localized
`purpose` and `retention`). Run `pnpm payload migrate:create cookie-scanner`, commit the migration;
Coolify runs `payload migrate` on deploy (deployment.md). MongoDB: nothing to do.
**Upgrading a project that already had `cookieScanner` (1.14.x or earlier):** the approval step adds two
fields to `cookie-review` — `change` (select) and `needsDescription` (checkbox). Run
`pnpm payload migrate:create cookie-approval` and commit it. Existing entries keep their status;
accepted ones are not re-approved, drafts show up on the approval page without a marker.
3. **Verify** — log in as an editor, open *Privacy → Cookies → Review and approve*. The box lists
"Integrations in use" (e.g. Cookie banner, Admin panel login, Google Analytics 4). Click **Scan
cookies**: the cookies found appear below, grouped by category. Click **Approve and add**; the page
reloads — open the *Cookie list* tab: the cookies are there, with purpose and duration in every
language.
## Admin layout
One **Cookies** entry in *Privacy* holds everything (`adminLayout: 'combined'`, the default):
| Tab | What it is |
|---|---|
| Banner, Settings window, Categories | the banner texts ([consent.md](./consent.md)) |
| Cookie list | the cookies shown in the banner's detailed window and the cookie policy table |
| Review and approve | the scan box and the approval list inline; **Edit cookies one by one** opens the review entries |
| Site check | only with `crawl`: start a check, its status, the violations of the latest check, a link to the warning e-mail settings |
The review list (`cookie-review`) and the site check result (`cookie-crawl`) leave the navigation
(`admin.group: false`) but keep their pages, data and API — links from the dashboard, the e-mail and
**Edit** still open them, and `/admin/cookie-approval` still works. The two tabs are `ui` fields: no data,
no schema change, **no migration** — only `pnpm generate:importmap`. Approving in the tab writes the
cookie list of the same screen, so the page reloads afterwards; while the screen has unsaved changes the
button waits ("Save your changes first.").
`adminLayout: 'separate'` keeps the older layout: *Cookie review* and *Cookie check* as their own
navigation entries, no extra tabs. A project's `collectionOverrides` / `crawl.globalOverride` (e.g. its own
`admin.group`) win in both layouts.
Every language is filled: text written in one language (in the cookie list or a review entry) goes to
the languages where that field is still empty, never over a language's own text
([consent.md → Every language filled](./consent.md#every-language-filled-fillemptylocales)).
## How editors use it
| Step | What happens |
|---|---|
| **Scan cookies** | Every cookie of the integrations in use goes into the review list, marked **New**. Rows typed into the cookie list by hand are looked up once (*In the cookie list* is ticked). Nothing is added to the cookie banner yet. |
| **More cookie names** (optional text box) | Names seen in the browser (DevTools → Application → Cookies), one per line. Each is looked up in the project's declarations, every built-in integration, then the Open Cookie Database. A name nothing knows is marked **Needs description**. |
| **Review and approve** | The *Review and approve* tab of *Cookies* (the same list is also at `/admin/cookie-approval`, linked from the dashboard and the e-mail): one table per consent category (Necessary, Functional, Analytics, Marketing, then *Not yet described*), each cookie with provider, purpose and duration in the content language that matches the admin language, markers **New**, **Changed**, **Needs description**, an **Edit** link and a tick box. |
| Untick or edit | Untick a cookie to leave it waiting; **Edit** opens its review entry (provider, category, purpose, duration per language). A later scan keeps every value you changed and still updates values you left as suggested. |
| **Approve and add** | Every ticked cookie becomes *Accepted* and is added to *Cookies → Cookie list* in every language, with the plugin's English and Polish texts (a language without its own text gets the default language's text). A row that already lists the cookie — the same name, or a pattern that covers it, e.g. `_ga_*` and `_ga_XYZ123` — is never duplicated: only its empty provider / purpose / duration are filled, its text and category stay. The cookie list feeds the cookie policy table and the banner's detailed window, so the cookie appears there too. |
| Unknown cookies | Approved into a category that needs consent (`approval.unknownCategory`, default `marketing`) and flagged **Needs description** on the review entry; writing a purpose clears the flag. |
| A scan finds a change | An accepted cookie whose suggested text changed is marked **Changed** and waits for approval again; approving it fills only empty text in the cookie list. |
| A cookie disappears | An integration switched off, a declaration removed, or a cookie the site check no longer sees: the entry is marked **No longer found** and listed under that heading on the approval page. Nothing is deleted — the cookie list keeps its row until an editor removes it there. Found again → the mark goes away. |
| Per-entry review | Still works: set *Status* to *Accepted* on one entry (or in bulk edit) to add just that cookie. *Rejected* entries stay out and later scans do not bring them back. Rejecting never removes a row from the cookie list. |
Deleting review entries is admin-only and never done by the plugin. While cookies wait, the
dashboard shows "Waiting for approval: N" with a link to the approval view (`approval.dashboard: false`
turns it off).
Labels are in English and Polish and follow the editor's admin language; `cookieScanner.labels` adds
languages or changes text. The built-in integrations without a product name (Cookie banner, Admin panel
login, Language choice, Built-in statistics) take their names from the shared admin texts
(`adminTexts`, keys `cookieIntegration*`, and `cookieSourceProject` for your own declarations), so the scan
box lists them in the editor's language; the *Source* stored on a review entry is in the language of
whoever ran the scan (English for a site check). Rename one through `cookieScanner.integrations`
(`label: { en: '…', pl: '…' }`).
## What the plugin declares
Each integration the plugin injects declares its cookies in one place
(`DEFAULT_COOKIE_INTEGRATIONS`): name or pattern (`*` at the end = prefix), provider, category,
purpose and retention (English and Polish), and whether it may be set before consent. Only the
integrations switched on in this project are part of a scan:
| Integration | On when | Cookies |
|---|---|---|
| Cookie banner | always | `cookie-consent` (necessary, 6 months) |
| Admin panel login | always | `payload-token` (`<cookiePrefix>-token`, necessary, editors only) |
| Language choice | more than one locale in `i18n` | `NEXT_LOCALE` (functional, session) |
| Built-in statistics | `stats` option | `ipal_vid` (analytics, 6 months) |
| Google Analytics 4 | GA4 ID in Site integrations | `_ga`, `_ga_*` (analytics, 2 years) |
| Google Tag Manager | GTM ID in Site integrations | `_gcl_*` (marketing — the Conversion Linker; other tags in the container: add their names or declare them) |
| Meta Pixel | Pixel ID | `_fbp`, `_fbc` (marketing, 3 months) |
| Microsoft Clarity | Clarity ID | `_clck`, `_clsk`, `CLID`, `MUID` |
| LinkedIn Insight Tag | partner ID | `li_fat_id`, `bcookie`, `lidc`, `UserMatchHistory` |
| TikTok Pixel | Pixel ID | `_ttp`, `_tt_enable_cookie` |
| Cloudflare Turnstile | both Turnstile keys set | `cf_clearance` (necessary; only when pre-clearance is on in Cloudflare) |
An ID that fails its format check counts as off. The theme switcher (`ipal-theme` in localStorage)
and the accessibility widget (`a11y-prefs`) have no plugin option, so they are not declared: add
them with `declarations` when the site uses them.
## Open Cookie Database
Unknown names are looked up in a bundled copy of the
[Open Cookie Database](https://github.com/jkwakman/Open-Cookie-Database) (about 2,300 entries,
Apache License 2.0). The package ships the license text in
[licenses/open-cookie-database-LICENSE.txt](./licenses/open-cookie-database-LICENSE.txt); the
data module names the upstream commit and the changes made (converted from CSV, two columns left
out). The table is loaded only when a scan runs.
Category mapping (`DEFAULT_DATABASE_CATEGORIES`):
| Database | Consent category |
|---|---|
| Analytics | analytics |
| Marketing | marketing |
| Necessary, Security | necessary |
| Functional, Personalization | functional |
"Functional" is **not** mapped to necessary on purpose: the database files some trackers there
(Hotjar's user id), and a lookup nobody checked yet must not skip consent. The editor lowers the
category when a cookie really is necessary, or the project changes the map:
`cookieScanner: { databaseCategories: { Functional: 'necessary' } }`.
Refresh the copy (maintainers of ipal-kit, not projects):
```bash
pnpm cookie-db:refresh
```
`scripts/refresh-cookie-database.mjs` downloads the CSV and the license at the latest commit (or
`--ref <sha>`), refuses to write if the license is no longer Apache-2.0, and rewrites
`src/modules/consent/scanner/data/openCookieDatabase.ts` and the license file. Review the diff,
run the tests, commit.
## Options
`cookieScanner: true` or an object (`CookieScannerOptions`, every key optional):
| Key | Default | What it does |
|---|---|---|
| `declarations` | `[]` | The project's own cookies (custom embeds, chat, YouTube): `CookieDeclaration[]`, always part of a scan |
| `integrations` | built-ins | `(defaults) => integrations` — filter, change or add `CookieIntegration`s (each: `key`, `label` — one string or `{ en, pl, … }` per admin language, `declarations`, `isEnabled(ctx)`) |
| `database` | `true` | `false` = no Open Cookie Database lookup |
| `databaseCategories` | table above | Partial map from database category to consent category |
| `access` | editor and up | `({ req }) => boolean` — who may scan, start a crawl and read its status |
| `collectionOverrides` | — | Change `cookie-review`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function takes over (keep the slug) |
| `labels` | `en`, `pl` | `{ de: { scanButton: 'Cookies scannen', … } }` — merged over the plugin's labels (`CookieScanLabels`) |
| `syncAccepted` | `true` | `false` = accepting or approving only marks the entry; nothing is written to Cookie banner |
| `approval` | on | one summary and one **Approve and add** for everything found — `false` = per-entry review only (no view, no endpoint, no dashboard reminder); `{ unknownCategory, dashboard }` — see below |
| `approval.unknownCategory` | `'marketing'` | category given to cookies nothing knows when they are approved; pick one that needs consent (`functional`, `analytics`, `marketing`) |
| `approval.dashboard` | `true` | `false` = no "Waiting for approval" reminder on the dashboard |
| `crawl` | off | browser crawl through the scanner service — [Browser crawl](#browser-crawl) |
| `adminLayout` | `'combined'` | one *Cookies* entry with *Review and approve* and *Site check* tabs; `'separate'` = own navigation entries — [Admin layout](#admin-layout) |
A project declaration:
```ts
import type { CookieDeclaration } from '@intecion/ipal-kit'
const youtube: CookieDeclaration = {
name: 'VISITOR_INFO1_LIVE',
vendor: 'Google (YouTube)',
category: 'marketing',
domain: 'youtube.com',
purpose: { en: 'YouTube: player preferences and bandwidth estimate.', pl: 'YouTube: preferencje odtwarzacza.' },
retention: { en: '6 months', pl: '6 mies.' },
setBeforeConsent: false,
}
ipalKit({ cookieScanner: { declarations: [youtube] } })
```
A project integration that is on only when a field is filled:
```ts
import type { CookieIntegration } from '@intecion/ipal-kit'
const chat: CookieIntegration = {
key: 'chat',
label: 'Live chat',
isEnabled: (ctx) => Boolean(ctx.integrations.chatWidgetId),
declarations: [/* CookieDeclaration … */],
}
ipalKit({ cookieScanner: { integrations: (defaults) => [...defaults, chat] } })
```
`ctx` (`CookieScanContext`) has `payload`, `integrations` (the Site integrations global, depth 0) and
`plugin` (`{ localeCount, stats }`).
## Endpoint
| | |
|---|---|
| `GET /api/ipal/cookie-scan` | `{ ok, integrations: [{ key, label }] }` — what a scan covers; `label` in the admin language of the request |
| `POST /api/ipal/cookie-scan` | body `{ names?: string[] \| string }` (newline or comma separated, up to 200, names with spaces, `;`, `,` or `=` dropped) → `{ ok, summary: { created, updated, unchanged, unknown, newUnknown, gone }, integrations }` |
| `GET /api/ipal/cookie-approval?locale=pl` | `{ ok, pending, gone }` — `CookieApprovalItem`s (`id`, `name`, `category`, `vendor`, `purpose`, `retention`, `change`, `unknown`) in that content locale (default locale otherwise) |
| `POST /api/ipal/cookie-approval` | body `{ ids?: (string \| number)[] }` — approves those pending entries (all pending without `ids`) → `{ ok, result: { added, filled, unchanged, needsDescription, skipped } }` |
| Access | editor and up (`userMeetsRole`; without `access` every logged-in account), or `cookieScanner.access`; otherwise `403` |
Paths: `COOKIE_SCAN_PATH` (`/ipal/cookie-scan`), `COOKIE_APPROVAL_PATH` (`/ipal/cookie-approval`), under the
API route; the admin view is at `COOKIE_APPROVAL_VIEW_PATH` (`/cookie-approval`) under the admin route.
## Collection `cookie-review`
`COOKIE_REVIEW_SLUG`, group *Settings*. Fields: `name`, `storage` (`cookie` / `localStorage` /
`sessionStorage`), `category`, `vendor`, `domain`, `purpose` (localized), `retention` (localized),
`setBeforeConsent`, `status` (`draft` / `accepted` / `rejected`), `needsDescription` (set when an
unknown cookie is approved without a purpose; cleared when a purpose is written), and read-only
`change` (`new` / `changed` / `gone` — what the latest scan noticed; approving clears it), `source`
(`integration` / `project` / `database` / `unknown` / `manual`), `sourceDetail`, `listed`,
`lastScannedAt`; hidden `key` (`storage:name`, unique — what a rescan matches) and `suggested` (the
last scan's values — a value still equal to it was not edited). Access: create / read / update
editor and up, delete admin.
## Building blocks
All from `@intecion/ipal-kit` (server-safe), for your own admin view, a CLI or a scheduled job:
| Export | What it does |
|---|---|
| `runCookieScan({ payload, plugin, options?, names?, req? })` | the whole scan as the endpoint runs it → `{ enabled, summary }` |
| `collectCookieFindings({ ctx, integrations?, declarations?, names?, database?, databaseCategories? })` | findings without writing anything; `names` are strings or `CookieObservation`s (`{ name, storage?, domain? }`); `matches` maps each to its review key |
| `applyCookieFindings({ payload, findings, entries?, req?, collection? })` | writes findings as drafts with the merge rules above → `CookieScanSummary` (`created`, `updated`, `unchanged`, `unknown`, `newUnknown`); `entries` collects `CookieReviewEntryRef`s |
| `cookieScanContext(payload, plugin, req?)` | the `CookieScanContext` a scan uses |
| `parseCookieNames(input)` | the panel's text box → clean names |
| `mergeCookieReview(current, previous, next)`, `suggestionFor(finding, locales)` | the "never overwrite an edit" rule, pure |
| `addToCookieList({ payload, entry, req? })` | what accepting does: add the row or fill its empty text → `'added' \| 'filled' \| 'unchanged'`; a row with the same name or a covering pattern counts as the same cookie (`sameCookie(a, b)`) |
| `loadCookieApproval({ payload, locale, req? })` | the approval list → `CookieApprovalList` (`pending`, `gone`) |
| `approveCookies({ payload, ids?, unknownCategory?, addToList?, req? })` | what **Approve and add** does → `CookieApprovalResult` |
| `countPendingCookies(payload)`, `PENDING_WHERE` | how many wait / the query for them (drafts, and accepted cookies marked changed) |
| `buildCookieApprovalEndpoints(options)` | the GET/POST approval endpoints, to wire by hand |
| `flagGoneEntries({ payload, keep, where, req? })`, `nextChange(existing, changed)` | the "no longer found" flag and the marker rule (`CookieChange`) |
| `DEFAULT_UNKNOWN_CATEGORY` | `'marketing'` |
| `CookieApprovalView`, `CookieApprovalForm` (`/admin`) | the approval view (server) and its form (client), injected as `views.ipalCookieApproval` |
| `loadCookieDatabase()`, `indexCookieDatabase(rows)`, `lookupCookie(index, name, categories?)` | the Open Cookie Database lookup |
| `DEFAULT_COOKIE_INTEGRATIONS`, `DEFAULT_DATABASE_CATEGORIES`, `cookieNameMatches(pattern, name)` | declarations and matching |
| `buildCookieReviewCollection(options)`, `buildCookieScanEndpoints(options, plugin)` | the collection and endpoints, to wire by hand |
| `COOKIE_SCAN_LABELS`, `mergeCookieScanLabels(overrides)` | admin labels |
| `CookieScanButton` (`/admin`) | the box above the list (with **Check site** when `crawl` is on) |
| `CookieReviewTab`, `CookieSiteCheckTab` (`/admin`) | the two tabs of the combined layout (client components; props `approval`, `labels`, `unknownCategory` / `labels`) |
| `addCookieScannerTabs(global, { approval, crawl, labels, unknownCategory? })` | adds those tabs to a global with a `tabs` field — for a project that builds its own cookie global |
| `CookieScanButton` props `scan` / `onChange` | hide the scan part (the Site check tab) / called after a scan or a finished check |
| `CookieApprovalForm` props `onApproved` / `blockedReason` | after approving (the tab reloads the page) / why the button waits |
| `CookieCrawlAlert` (`/admin`) | the dashboard warning: cookies waiting for approval, and with `crawl` violations or a failed check (props `approval`, `crawl`) |
| `buildCookieCrawlGlobal(labels)`, `buildCookieCrawlEndpoints({ labels, options, plugin })` | the crawl's global and endpoints, to wire by hand |
| `resolveCrawlConfig(crawlOptions, payload)` | options + env + `serverURL` → `ResolvedCrawlConfig` (what is missing) |
| `parseCrawlResult(body)` | validates the service's JSON (`CrawlResult`, `CrawlObservation`, `CrawlRequest`) |
| `ingestCrawlResult({ payload, result, options, config, labels, plugin })`, `finishCrawl(…)` | applies a result: drafts, flags (→ `CrawlIngestSummary`), then the global and the e-mail |
| `findCrawlViolations({ observations, requests, categoryOf, consentMode?, trackerHosts? })` | the violation rule, pure (`CrawlViolation`) |
| `DEFAULT_TRACKER_HOSTS`, `GOOGLE_TAG_HOSTS` | request hosts that count before consent |
| `sendCrawlWarning({ payload, labels, siteUrl, summary, to, pending? })` | the e-mail, through `payload.sendEmail`; with `pending` it says approval is waiting and links to the approval view |
| `bearerMatches(header, token)` | constant-time bearer check |
Types: `CookieDeclaration`, `CookieIntegration`, `CookieScanContext`, `CookieFinding`,
`CookieFindingSource`, `CookieStorage`, `LocalizedText`, `CookieScannerOptions`, `CookieScanSummary`,
`CookieReviewValues`, `CookieDatabaseIndex`, `CookieScanLabels`, `OpenCookieCategory`,
`CookieObservation`, `CookieReviewEntryRef`; approval: `CookieApprovalOptions`, `CookieApprovalItem`,
`CookieApprovalList`, `CookieApprovalResult`, `CookieChange`; crawl: `CookieCrawlOptions`, `ResolvedCrawlConfig`,
`CrawlResult`, `CrawlObservation`, `CrawlRequest`, `CrawlViolation`, `CrawlIngestSummary`.
## Browser crawl
What a page really sets — a GTM tag, an iframe, a script pasted into a block — shows only in a
browser. `cookieScanner.crawl` adds **Check site** to the *Cookie review* box. One shared **scanner
service** (`services/cookie-crawler` in the ipal-kit repository, run by the team on Coolify) does the
browsing for every site:
```
editor ── Check site ──▶ site POST /api/ipal/cookie-crawl
site ── POST {IPAL_COOKIE_SCAN_URL}/crawl (Bearer token) ──▶ scanner service
crawls the sitemap pages twice:
1. fresh profile, no decision
2. fresh profile, clicks "Accept all"
site POST /api/ipal/cookie-crawl/results (Bearer token) ◀── cookies, storage keys, third-party hosts
→ drafts in Cookie review, violations, Cookie check global (`cookie-crawl`), dashboard warning, e-mail
```
### Turn it on in a site
```ts
ipalKit({
cookieScanner: { crawl: true },
})
```
1. **Env** (Coolify → the site → Environment Variables):
| Variable | Value |
|---|---|
| `IPAL_COOKIE_SCAN_URL` | the service's URL, e.g. `https://cookie-crawler.intecion.net` |
| `IPAL_COOKIE_SCAN_TOKEN` | a random token of at least 16 characters (`openssl rand -hex 32`), the same one as in the service's `IPAL_CRAWLER_SITES` entry for this site |
| `NEXT_PUBLIC_SERVER_URL` | already set — the public origin the service crawls and calls back (or Payload `serverURL`, or `crawl.siteUrl`) |
Validate them at startup: `assertEnv(ipalEnvRules({ cookieCrawl: true }))` (required in production).
2. **Import map:** `pnpm generate:importmap` (the dashboard warning `CookieCrawlAlert`).
3. **Migration (Postgres / SQLite):** `crawl` adds the `cookie-crawl` global and three fields to
`cookie-review` (`violation`, `violationDetail`, `seenBeforeConsent`):
`pnpm payload migrate:create cookie-crawl`, commit; Coolify runs `payload migrate` on deploy.
4. **Service:** add the site to the service's `IPAL_CRAWLER_SITES` (below) and redeploy the service.
5. **Verify:** *Cookie review* shows "Check site" enabled (when disabled, the box names the missing env
var). Click it: the status says "Crawling…", then after one to a few minutes "Last crawl …: N pages,
N violations, N new unknown" and the list reloads. *Privacy → Cookie check* shows the latest
result. A test: put a `<script>document.cookie='_fbp=x'</script>` in a block on a staging page →
the next crawl reports `_fbp` as a violation and the dashboard shows the warning.
### What a crawl records and reports
| | |
|---|---|
| Pages | the site URL + up to `maxPages` (default 20, max 100) same-origin URLs from `/sitemap.xml` (one level of sitemap index) |
| Recorded per run | cookies (name, domain), `localStorage` and `sessionStorage` keys, hosts of third-party requests, with the first pages they appeared on |
| New findings | every cookie / key goes through the same lookup and merge rules as **Scan cookies** — new names wait on the approval page (marked **New**), edited text is kept, status is never changed, nothing is added to the cookie banner before approval |
| Disappeared | an accepted cookie the crawl no longer sees (and nothing still declares) is marked **No longer found** — for review only, never deleted |
| Violation (cookie or key) | seen **before consent** and its review entry's category is not `necessary` — an entry without a category counts too, until an editor classifies it |
| Violation (request) | a request **before consent** to a tracker host (`DEFAULT_TRACKER_HOSTS`: Meta, LinkedIn, TikTok, Clarity, Bing, Hotjar, YouTube). Google's tag hosts (`GOOGLE_TAG_HOSTS`) count only with `consentMode: 'basic'` — in `advanced` (the plugin's default) the Google tag may load before consent with every signal denied |
| Review entries | `seenBeforeConsent`, `violation` and `violationDetail` ("before consent on /, /about") — from the **latest crawl only**: every crawl clears the previous flags |
| Cookie check global (`cookie-crawl`) | latest result only (no history): status, started / finished, by whom, pages, counts, violations, third-party hosts, error |
| "Accept all" not found | the second run had no consent — the global's error says so (`crawl.acceptSelector` for a custom banner) |
| Dashboard | a warning above the dashboard after a crawl with violations or a failed crawl (`crawl.dashboard: false` turns it off), and "Waiting for approval: N" with **Review and approve** while cookies wait (`approval.dashboard`) |
| E-mail | opt-in per site: *Privacy → Cookie check → E-mail warnings to* (admin; comma-separated). Sent after a crawl with violations, new unknown cookies, or new cookies waiting for approval — then it says "Cookies waiting for approval: N. Nothing is added to the cookie banner until you approve them." and links to the approval view. Through the project's Payload email adapter (`email: mailAdapter()`, email.md). Empty = no e-mail |
A crawl still "running" after 30 minutes counts as failed (the service never reported back), and a new
one may start. One crawl per site at a time (`409` otherwise).
### Scheduled crawls
A Coolify **Scheduled Task** on the site's application (or any cron) starts a crawl with the token —
no editor session needed:
```bash
curl -fsS -X POST -H "Authorization: Bearer $IPAL_COOKIE_SCAN_TOKEN" "$NEXT_PUBLIC_SERVER_URL/api/ipal/cookie-crawl"
```
Weekly is plenty (`0 6 * * 1`). New violations, unknown cookies and cookies waiting for approval then
show on the dashboard and, when recipients are set, by e-mail. Nothing a scheduled crawl finds is added
to the cookie banner until an editor approves it.
### `crawl` options
`crawl: true` or `CookieCrawlOptions`:
| Key | Default | What it does |
|---|---|---|
| `serviceUrl` | env `IPAL_COOKIE_SCAN_URL` | scanner service base URL |
| `token` | env `IPAL_COOKIE_SCAN_TOKEN` | shared secret (≥ 16 characters); shorter = not configured |
| `siteUrl` | Payload `serverURL`, else `NEXT_PUBLIC_SERVER_URL` | public origin to crawl; the callback goes to `<siteUrl>/api/ipal/cookie-crawl/results` |
| `maxPages` | `20` (max 100) | sitemap pages besides the site URL |
| `acceptSelector` | `[data-ipal="accept"]` | the banner's "Accept all" button (the plugin's `CookieBanner` has it in every mode) |
| `consentMode` | `'advanced'` | `'basic'` = Google tag requests before consent are violations too — match the project's `SiteProviders analytics={{ consentMode }}` |
| `trackerHosts` | `DEFAULT_TRACKER_HOSTS` | `(defaults) => [...defaults, 'widget.chat.example']` |
| `dashboard` | `true` | `false` = no dashboard warning |
| `globalOverride` | — | change the `cookie-crawl` global like `globalOverrides` (object merges `access` / `admin` / `hooks`, a function takes over) |
Access: start a crawl and read its status — editor and up (`cookieScanner.access`), or the bearer
token; the results endpoint — the bearer token only, and only for the running job id; the
`cookie-crawl` global — read editor and up, update (the e-mail field) admin.
### Endpoints
| | |
|---|---|
| `GET /api/ipal/cookie-crawl` | `{ configured, missing, status, startedAt, finishedAt, summary, error }` |
| `POST /api/ipal/cookie-crawl` | starts a crawl → `202`; `403`, `409` (one is running), `503` (not configured), `502` (service unreachable — the global says why) |
| `POST /api/ipal/cookie-crawl/results` | the service's callback: `Authorization: Bearer <token>`, body = the wire format (`CrawlResult`) → `200`; `401`, `400`, `409` (not the running job) |
Paths: `COOKIE_CRAWL_PATH`, `COOKIE_CRAWL_RESULTS_PATH`; env names: `COOKIE_SCAN_URL_ENV`,
`COOKIE_SCAN_TOKEN_ENV`; global slug `COOKIE_CRAWL_SLUG`.
### Scanner service on Coolify
One service for every site the team runs. Code: `services/cookie-crawler/` in the ipal-kit repository
(Node + Playwright, no other dependency; not part of the npm package).
1. **Coolify → Project → New Resource → Application** from the ipal-kit Git repository.
- Build pack: **Dockerfile**; base directory `services/cookie-crawler`; Dockerfile `Dockerfile`.
- Port: `3000`. Health check path: `/health` (the image also has a Docker `HEALTHCHECK`).
- Domain: e.g. `https://cookie-crawler.intecion.net` (Coolify issues the certificate).
- Resources: 1–2 GB RAM, 1 CPU per concurrent crawl (Chromium). Keep `CRAWLER_CONCURRENCY=1`
unless the server has room.
2. **Environment variables:**
| Variable | Default | |
|---|---|---|
| `IPAL_CRAWLER_SITES` | — (required) | `acme.pl=TOKEN1,shop.example.com=TOKEN2` — the sites it may crawl, each with its own token (≥ 16 characters; `www.` is ignored). A token only opens its own site |
| `PORT` | `3000` | |
| `CRAWLER_CONCURRENCY` | `1` | crawls at the same time |
| `CRAWLER_QUEUE_MAX` | `20` | waiting crawls; more → `429` |
| `CRAWLER_JOB_TIMEOUT_MS` | `600000` | a longer crawl is reported as failed |
| `CRAWLER_WAIT_MS` | `3000` | wait on every page for late tags (`defer` analytics) |
| `CRAWLER_ALLOW_HTTP` | unset | `1` only for local tests; sites must be https |
3. **Deploy**, then check: `curl https://cookie-crawler.intecion.net/health` → `{"ok":true,…}`.
4. **Adding a site:** generate a token, add `host=token` to `IPAL_CRAWLER_SITES`, redeploy the service;
set the same token as the site's `IPAL_COOKIE_SCAN_TOKEN`.
5. **Updating Playwright:** the npm version in `services/cookie-crawler/package.json` and the image tag
in its `Dockerfile` (`mcr.microsoft.com/playwright:v1.64.0-noble`) must match; change both, redeploy.
What the service refuses: a site not in `IPAL_CRAWLER_SITES`, a token that is not that site's, a
callback URL on another origin than the site, plain http. It crawls only the listed origins (no
open proxy), runs Chromium as the image's non-root user, and keeps nothing after a crawl.
**DNS and network:**
- One DNS record for the service: `cookie-crawler.<team domain>` → `A`/`AAAA` to the Coolify server
(the team runs the zone; add it with the other records, deployment.md §6). No record is needed per
site.
- The **site** must reach the service URL (outbound HTTPS from the site container), and the **service**
must reach each site's public URL (outbound HTTPS) — the crawl must go through the public domain,
CDN and proxy, as a visitor's browser does. On the same Coolify server both go out and back through
the public domain; do not point `siteUrl` at an internal container name (cookies are set for the
public domain).
- Sites behind Cloudflare (WAF, Bot Fight Mode, "Under Attack"): allow the Coolify server's IP, or the
crawl sees a challenge page instead of the site. Every crawler request carries the header
`X-Ipal-Cookie-Crawler: 1` for a WAF rule.
- The crawler's page views land in the site's stats and analytics like any visitor without consent
(cookieless) and with consent on the second run. Filter the Coolify server's IP in GA4 if it matters.
### From a laptop or CI
The same crawl, without the service: `cd services/cookie-crawler && npm install && npx playwright
install chromium`, then `node cli.mjs https://acme.pl --pages 10` prints the result as JSON (exit code
1 when anything but the consent cookie is stored before consent). It does not know the site's
categories — the panel's **Check site** gives the verdict. `ipal-consent-check` → cookie-scan
(`cookie-scan.mjs`) stays the quick check for projects without the service; paste the names it reports
as unknown into **More cookie names**.
## Turn off, override, extend
- **Separate screens:** `adminLayout: 'separate'`.
- **Turn off one approval:** `approval: false` — per-entry review only (set *Accepted* on each entry), no
approval view, endpoint or reminder.
- **Turn off the crawl only:** omit `crawl` (default) — no `cookie-crawl` global, no crawl endpoints, no
dashboard warning, no violation fields; `dashboard: false` keeps the crawl without the warning.
- **Turn off:** omit `cookieScanner` (default). Turning it off later keeps no endpoint and no
collection; Cookies → Cookie list keeps every row (it is still edited by hand or by the skill's
import script).
- **Override:** `collectionOverrides` (access, admin, hooks), `access` (who scans), `labels`,
`databaseCategories`, `integrations` (change or drop a built-in), `syncAccepted: false`,
`approval.unknownCategory`, `approval.dashboard`; for the
crawl `serviceUrl`, `token`, `siteUrl`, `maxPages`, `acceptSelector`, `consentMode`, `trackerHosts`,
`globalOverride`.
- **Extend:** `declarations` and `integrations` for the project's own cookies; the building blocks
above for your own UI, CLI or scheduled scan; the crawl's wire format (`CrawlResult`) to feed results
from another crawler.
+9 -6
View File
@@ -38,7 +38,7 @@ GRAPH_CLIENT_SECRET=<azure-app-secret>
GRAPH_SENDER=noreply@mailservice.intecion.net # shared mailbox
```
All 4 are needed. When Graph is selected in the panel and one is missing — `mailAdapter()` sends through
the SMTP from the panel and reports it in Site Integrations (status `graph-unavailable`). See email.md.
the SMTP from the panel and reports it in Site integrations (status `graph-unavailable`). See email.md.
### Storage — R2 (OPTIONAL in dev, recommended in production)
@@ -72,8 +72,9 @@ URLs point at that domain. Outside production, `R2_PUBLIC_URL` alone → read-on
| `R2_SECRET_ACCESS_KEY` | ⬜ (✅ prod) | storage | R2 secret |
| `R2_PUBLIC_URL` | ⬜ (✅ prod only with `storage: { requirePublicUrl: true }`) | storage | media domain attached to the bucket; empty = media through the app (§6); dev: also the `/media` path |
| `IPAL_IP_HEADER` | ⬜ (✅ prod) | forms | header with the real IP for the rate limit (`cf-connecting-ip`, `x-forwarded-for`); without it, a warning in the log |
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | ⬜ | forms | fallback when the Turnstile keys are not in Site Integrations |
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | ⬜ | forms | fallback when the Turnstile keys are not in Site integrations |
| `INDEXNOW_KEY` | ⬜ | SEO | IndexNow key (takes precedence over the key from the panel) |
| `IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN` | ⬜ (✅ prod with `ipalEnvRules({ cookieCrawl: true })`) | consent | cookie crawl (`cookieScanner.crawl`): the shared scanner service's URL and this site's token ([cookie-scanner.md](./cookie-scanner.md#browser-crawl)) |
| `IPAL_NOINDEX` | ⬜ | SEO | `1`/`true`/`yes` **on staging only** — the whole site is noindex (robots, meta, `X-Robots-Tag`) |
"✅ prod" = required by `ipalEnvRules({ storage: true })` / `({ ipHeader: true })` with
@@ -82,7 +83,7 @@ startup when these variables are missing.
**Rule:** all secrets are agency/infrastructure variables — in `.env`
(dev) and the Coolify app's Environment Variables (prod, §4.2), NEVER in the repo. Per-project data editable by the
editor goes to the PANEL (Site Settings, Site Integrations), not to env.
editor goes to the PANEL (Site settings, Site integrations), not to env.
### .env.example — always in the repo
@@ -377,7 +378,7 @@ the container disk → add a Coolify **Persistent Storage** volume for the uploa
### Integrations in the panel
Mail (SMTP/Graph) and Turnstile errors are visible in the panel after deploy: an alert on the dashboard and a banner on
the Site Integrations tab — see [integrations.md](./integrations.md).
the Site integrations tab — see [integrations.md](./integrations.md).
### Other hosts
@@ -422,7 +423,7 @@ checks with `dig` after propagation. Check on the zone's authoritative server
| 9 | Media in R2 | **default: none** — `R2_PUBLIC_URL` empty, media served by the app; with a media domain: the R2 Custom Domain in the Cloudflare account that hosts that zone (see below) | — | through the app: `curl -sI https://klient.pl/api/media/file/<file>` → 200; media domain: `curl -sI https://<media-domain>/<file>` → 200 (root `/` may return 404, storage.md) |
**Which domain gets SPF/DKIM/DMARC (rows 6–8)** — the one in the **From** address of sent mail:
- **SMTP from the panel** transport → the domain from the *From address* field in Site Integrations (usually the client's
- **SMTP from the panel** transport → the domain from the *From address* field in Site integrations (usually the client's
domain); the records come from that mailbox's provider;
- **Graph** transport → From is always `GRAPH_SENDER` (agency mailbox, [email.md](./email.md)) —
SPF/DKIM/DMARC are set once for the agency domain, not per project; the address from the panel goes into Reply-To.
@@ -446,11 +447,13 @@ be attached. Options, in order of preference:
3. A reverse proxy/cache on the Coolify server (`media.klient.pl` → the bucket) — possible, more moving parts.
4. `*.r2.dev` — rate-limited, **dev/testing only**, never production.
**Cookie checker (once per team, not per site):** `cookie-crawler.<team domain>` → `A`/`AAAA` to the Coolify server running the scanner service ([cookie-scanner.md](./cookie-scanner.md#scanner-service-on-coolify)). A site using `cookieScanner.crawl` needs no record of its own.
**No DNS records needed:** Turnstile (hostname list set in the Cloudflare panel on the widget, not in
DNS), IndexNow (key file served by the app), llms.txt, MCP, Markdown, sitemap.
**Search Console through DNS, not a meta tag.** We verify with a TXT record (row 4) — it covers
all protocols and subdomains. The meta tag verification fields in Site Settings (if the plugin
all protocols and subdomains. The meta tag verification fields in Site settings (if the plugin
version has them) are **optional and normally empty**. We do not use the Search Console API — submit the
sitemap `https://klient.pl/sitemap.xml` once by hand in GSC (and in Bing).
+29 -23
View File
@@ -160,12 +160,12 @@ export default buildConfig({
ipalKit({
i18n: i18nConfig,
access: { authCollection: 'users' },
pages: { slug: 'pages' }, // System Pages (homepage, 404, policies)
pages: { slug: 'pages' }, // System pages (homepage, 404, policies)
content: contentConfig, // collections with an archive (blog…), optional
seo: { collections: ['pages'] },
forms: { redirectRelationships: ['pages'] },
twoFactor: { issuer: 'Nazwa Klienta', plugin: payloadTotp },
whiteLabel: true, // logo/name from Site Settings in the admin panel
whiteLabel: true, // logo/name from Site settings in the admin panel
indexNow: true, // publish → Bing / ChatGPT Search (production)
consentLog: true, // proof of consent (GDPR Art. 7(1)), no personal data
// adminRoute: '/its', // + move app/(payload)/admin → its and put `its` in the proxy matcher (§2.6)
@@ -288,7 +288,7 @@ type Props = { children: React.ReactNode; params: Promise<{ locale: string }> }
export default async function LocaleLayout({ children, params }: Props) {
const { locale } = await params
if (!(await getConfiguredLocales()).includes(locale)) notFound()
const shell = await getSiteShell(locale) // consent, analytics, Turnstile, site JSON-LD, Site Settings
const shell = await getSiteShell(locale) // consent, analytics, Turnstile, site JSON-LD, Site settings
return (
<html lang={locale}>
{/* NO <head> — Next manages it itself */}
@@ -304,7 +304,7 @@ export default async function LocaleLayout({ children, params }: Props) {
}
```
`SiteProviders` wires things in the right order: `MediaPreconnect`, `JsonLdGraph` (WebSite + Organization
from Site Settings), `ConsentProvider` → `TurnstileProvider` (always — it turns itself off without keys) →
from Site settings), `ConsentProvider` → `TurnstileProvider` (always — it turns itself off without keys) →
banner, `CookieButton`, `Analytics` (inside consent). It adds no markup. You can change or
turn off every part: `banner={<CookieBanner classNames={…} />}` / `false`, `cookieButton`,
`analytics={{ defer: true }}` / `false`, `jsonLd={[buildNavigationJsonLd(…)]}`, `cookieMap`,
@@ -312,7 +312,7 @@ turn off every part: `banner={<CookieBanner classNames={…} />}` / `false`, `co
Pick the consent settings window with the banner's `settings` prop: `'inline'` (default — categories in the bar),
`'modal'` (small window in the center) or `'detailed'` (large window: each category with a switch, a description and
an expandable list of cookies from Cookie Settings → Cookies). Example:
an expandable list of cookies from Cookies → Cookie list). Example:
`banner={<CookieBanner equalChoice controls="switch" settings="detailed" />}` — description: consent.md, the
`settings="detailed"` section.
@@ -367,7 +367,7 @@ export default createNotFoundPage(content, { load: loadNotFoundView })
export { sitemapRoute as GET } from '@/lib/content'
export const dynamic = 'force-dynamic'
// src/app/robots.ts — robots from code + the AI crawler policy from Site Settings → Search & AI
// src/app/robots.ts — robots from code + the AI crawler policy from Site settings → Search engines
export { getRobots as default } from '@/lib/content'
export const dynamic = 'force-dynamic'
@@ -384,7 +384,7 @@ export const dynamic = 'force-dynamic'
export { markdownRoute as GET } from '@/lib/content'
export const dynamic = 'force-dynamic'
// src/app/indexnow-key.txt/route.ts — IndexNow key (from Site Integrations or INDEXNOW_KEY)
// src/app/indexnow-key.txt/route.ts — IndexNow key (from Site integrations or INDEXNOW_KEY)
export { indexNowKeyRoute as GET } from '@/lib/content'
export const dynamic = 'force-dynamic'
@@ -429,14 +429,14 @@ pnpm dev
### 2.11 Configuration in the admin panel (`/admin`)
1. First user (admin) + 2FA setup.
2. **Site Settings → General** — site name, logo, favicon (PNG).
2. **Site settings → General** — site name, logo, favicon (PNG).
3. **Pages** — the homepage with a title **in every language** (empty EN slug = 404 on `/en`).
4. **Site Settings → System Pages** — Homepage (without it `/pl` → 404), 404,
4. **Site settings → System pages** — Homepage (without it `/pl` → 404), 404,
policies; archives of content collections.
5. **Cookie Settings** — banner texts per language; **Cookies** (list from the scan, `ipal-consent-check`) and **Detail
5. **Cookies** — banner texts per language; **Cookies** (list from the scan, `ipal-consent-check`) and **Detail
labels** (captions of the list in the `settings="detailed"` window) — also in every language.
6. **Notifications** — form messages per language.
7. **Site Integrations** — SMTP/Graph (From Name, From Address), Turnstile, analytics/pixel
7. **Site integrations** — SMTP/Graph (From Name, From Address), Turnstile, analytics/pixel
IDs, IndexNow (integrations.md). Mail / Turnstile problems show as an alert on the
dashboard and a banner on the tab.
@@ -457,7 +457,7 @@ pnpm dev
| `R2_PUBLIC_URL` | ⬜ | **empty by default** — media served through the app (`/api/media/file/…`); a media domain whose zone is on Cloudflare only for media-heavy sites (storage.md, deployment.md §6); in dev alone = read-only media |
| `NODE_ENV` | ⬜ | `development` / `production` / `test` — `production` tightens the `ipalEnvRules` rules (R2, `IPAL_IP_HEADER`) |
| `IPAL_NOINDEX` | ⬜ | `1` **only on staging / preview** — the whole site out of Google (robots, meta, header) |
| `INDEXNOW_KEY` | ⬜ | IndexNow key, when not set in the admin panel (Site Integrations → IndexNow generates one itself) |
| `INDEXNOW_KEY` | ⬜ | IndexNow key, when not set in the admin panel (Site integrations → IndexNow generates one itself) |
| `IPAL_IP_HEADER` | ✅ prod | header with the real IP for the rate limit: `cf-connecting-ip` behind Cloudflare, `x-forwarded-for` behind plain Traefik/nginx (forms.md) |
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | ⬜ | fallback when the Turnstile keys are not in the admin panel (`ipalEnvRules({ turnstile: true })` makes them required) |
@@ -545,7 +545,7 @@ Test without a database: `DATABASE_URI=mongodb://invalid-host:27017/x pnpm build
### 4.6 Email — SMTP or Graph
Client on M365/Exchange → Graph (SMTP AUTH is often turned off). Own SMTP/Gmail →
SMTP. The switch is in the admin panel (Site Integrations → SMTP → Email Transport).
SMTP. The switch is in the admin panel (Site integrations → SMTP → Email Transport).
Graph, one-time: App registration in Azure, the `Mail.Send` application permission
+ **Grant admin consent**, the `GRAPH_*` variables. `from.address` always =
`GRAPH_SENDER` (otherwise `ErrorSendAsDenied`); sender name from the admin panel; the
@@ -559,7 +559,7 @@ visitor's address goes into `replyTo`. More: email.md.
the policies and terms — we are not a law firm. Put this in the contract.
- [ ] Policy pages created (privacy, cookies, terms if there are services/sales/accounts)
- [ ] Roles assigned in System Pages; content filled in (not a placeholder); `noindex` on policies
- [ ] Roles assigned in System pages; content filled in (not a placeholder); `noindex` on policies
- [ ] The banner shows on the first visit; "Reject" is as easy as "Accept"
- [ ] Pixels (Meta, LinkedIn, TikTok) and Clarity do **not** load before consent (check Network).
GA4/GTM load right away in Consent Mode v2 with default `denied` (advanced mode:
@@ -610,10 +610,10 @@ Do one item at a time, build, check. Order by importance:
| 15j | the form front end sends `fetch('/api/form-submissions')` (from this version REST returns 403 for anonymous users) | rewrite as a server action + `submitForm` (skill `ipal-form`) | forms.md |
| 15k | Turnstile secret saved by code (`updateGlobal` in `onInit` / an action) or own `verify` without `remoteip` | delete the workaround: secret in the admin panel or env `TURNSTILE_SECRET_KEY`; the plugin does not send `remoteip` and logs the rejection reason | turnstile.md |
| 15l | a Turnstile outage blocked forms | nothing in the project: on an error on our side the plugin accepts the submission and shows an alert in the admin panel; `generate:importmap`, Postgres: `migrate:create` | turnstile.md |
| 15m | own plugin moving Notifications into a group; `formOverrides`/`formSubmissionOverrides` only for labels and the admin group | delete — the plugin itself puts Notifications → Settings, and forms → the "Forms" group with labels (`forms.adminGroup`) | forms.md |
| 15n | mail errors visible only in logs | nothing in the project: `mailAdapter()` shows the send error on the dashboard and in Site Integrations → SMTP; `generate:importmap`, Postgres: `migrate:create` | email.md |
| 16 | Hard-coded 404 | 404 role in System Pages + `getNotFoundPage` | pages.md |
| 16a | `privacyPolicy: { label: 'Polityka prywatności', … }` in the layout | delete the whole parameter; enter the text in Cookie Settings → Privacy link label | consent.md |
| 15m | own plugin moving Notifications into a group; `formOverrides`/`formSubmissionOverrides` only for labels and the admin group | delete — the plugin itself puts Form messages → Settings, and forms → the "Forms" group with labels (`forms.adminGroup`) | forms.md |
| 15n | mail errors visible only in logs | nothing in the project: `mailAdapter()` shows the send error on the dashboard and in Site integrations → SMTP; `generate:importmap`, Postgres: `migrate:create` | email.md |
| 16 | Hard-coded 404 | 404 role in System pages + `getNotFoundPage` | pages.md |
| 16a | `privacyPolicy: { label: 'Polityka prywatności', … }` in the layout | delete the whole parameter; enter the text in Cookies → Privacy link label | consent.md |
| 17 | **AI/GEO (mandatory since 1.9.0)** | llms.txt + llms-full.txt, the `/md/…` route, `markdownAlternate: true`, `prefersMarkdown` in the proxy, `/api/mcp`, `buildSummaryField`, AI bots allowed — AGENT.md §0b | content.md, seo.md, mcp.md |
| 18 | **1.9.0** — `TurnstileProvider siteKey` from `getSiteIntegrations(…).turnstileSiteKey` | `getTurnstileConfig(payload).siteKey`. Note: with both keys set `submitForm` **requires** a token — a form without the widget will be rejected | turnstile.md |
| 19 | **1.9.0** — `twoFactor: { issuer }` without `plugin` | add `plugin: payloadTotp` (the fallback with a dynamic import was removed — startup fails with an error) | security.md |
@@ -622,11 +622,11 @@ Do one item at a time, build, check. Order by importance:
| 22 | **1.9.1** — hand-written `actions.ts` / `md` route / no form seed | `createSubmitAction`, `createMarkdownRoute`, seed from `ipal-form` (mail to the company + to the visitor) | forms.md, content.md |
| 23 | **1.9.1** — `createProxy` without `markdown: true` | add it — otherwise `/md/…` redirects to `/pl/md/…` | content.md |
| 24 | **1.9.1** — page JSON-LD assembled by hand | `getPageJsonLd`, `buildNavigationJsonLd`, `sameAsUrls`, `formatOpeningHours` | seo.md |
| 25 | **1.9.1** — consent: version, log, table | Cookie Settings → Policy version; `consentLog: true` + `logEndpoint`; `<CookieBanner equalChoice>`; scan + `<CookieTable>`; Postgres: `migrate:create` | consent.md |
| 25 | **1.9.1** — consent: version, log, table | Cookies → Policy version; `consentLog: true` + `logEndpoint`; `<CookieBanner equalChoice>`; scan + `<CookieTable>`; Postgres: `migrate:create` | consent.md |
| 26 | **1.9.1** — media: `priority`, no placeholders, `images` in next.config | `<Media>` through `mediaImageProps`/`videoProps`, `buildMediaPlaceholderHook`, `buildImagesConfig`, `buildUploadSecurityHeaders` | media.md, storage.md |
| 27 | **1.9.1** — staging indexed | `IPAL_NOINDEX=1` in the staging env | seo.md |
| 28 | **1.9.2** — own `FormRenderer` (a copy of the engine on `useForm`) | **security:** it passed the whole form document, including the Emails tab, to the browser (company addresses in the HTML). Block → `<RenderForm form action locale texts classNames>`, styling into `formClasses.ts`, delete `FormRenderer.tsx`; unusual form → `useBuilderForm` | forms.md |
| 29 | **1.9.2** — multi-step forms / choice lists built in code | admin panel: the **Step**, **Radio**, **Checkbox group**, **Date** blocks; Notifications → next / back / stepOf; Postgres: `migrate:create` | forms.md |
| 29 | **1.9.2** — multi-step forms / choice lists built in code | admin panel: the **Step**, **Radio**, **Checkbox group**, **Date** blocks; Form messages → next / back / stepOf; Postgres: `migrate:create` | forms.md |
| 30 | **1.9.2** — layout assembled by hand (ConsentProvider, TurnstileProvider, Analytics, JsonLdGraph, MediaPreconnect) | `<SiteProviders shell={await getSiteShell(locale)} …>` — the same options (banner, analytics, jsonLd, logEndpoint) | PROGRAMISTA §2.8 |
| 31 | **1.9.2** — catch-all page and `not-found.tsx` written by hand | `createPageRoute(content, {…})` / `createNotFoundPage(content, {…})` from `/rsc`; `revalidate` stays a literal | pages.md |
| 32 | **1.9.2** — llms/md/mcp/health/indexnow/manifest routes with configuration in every file | re-export from `lib/content` (`llmsRoute`, `llmsFullRoute`, `markdownRoute`, `mcpGET`/`mcpPOST`, `healthRoute`, `indexNowKeyRoute`, `manifest`); `summaryField`, `mcp` once in `createContentHelpers` | PROGRAMISTA §2.7 |
@@ -643,8 +643,14 @@ Do one item at a time, build, check. Order by importance:
| 43 | **1.11.1** — `<Media>` sets the background color only for JPEG | delete the condition — `mediaImageProps` does it itself (`placeholderColor`) | media.md |
| 44 | **1.11.1** — `CmsLink['appearance']` replaced with an own type because the type depended on field order | types per shape: `CmsLink`, `CmsLinkPlain`, `CmsLinkNoLabel`; `pnpm generate:types` and fix the imports | links.md |
| 45 | **1.11.1** — format description in a form field label / time as text | the **Placeholder** field in the admin panel, the **Time** type; Postgres: `migrate:create` | forms.md |
| 46 | **1.12.3** — own cookie settings window / cookie list in the banner written in the project | `<CookieBanner settings="detailed">` (list from Cookie Settings → Cookies, captions: Detail labels); delete your own version; Postgres: `migrate:create` | consent.md |
| 47 | **1.13.0** — staff access, Search & AI, seed scripts, workarounds around plugin globals | without `access`: every logged-in account gets the staff features → `access` or `globalOverrides` / `formOverrides` / `formSubmissionOverrides` / `collectionOverrides`; with `access`: staff need `editor`/`admin`; Postgres: `migrate:create`; check `settingsDepth`, `sitemap()` throwing, 2FA slug, client IP; own seed code → `@intecion/ipal-kit/seed`; global hooks/access plugins → `revalidatePath` / `globalOverrides` | CHANGELOG 1.13.0, AGENT.md §7.1, seo.md, seeding.md |
| 46 | **1.12.3** — own cookie settings window / cookie list in the banner written in the project | `<CookieBanner settings="detailed">` (list from Cookies → Cookie list, captions: Detail labels); delete your own version; Postgres: `migrate:create` | consent.md |
| 47 | **1.13.0** — staff access, Search engines, seed scripts, workarounds around plugin globals | without `access`: every logged-in account gets the staff features → `access` or `globalOverrides` / `formOverrides` / `formSubmissionOverrides` / `collectionOverrides`; with `access`: staff need `editor`/`admin`; Postgres: `migrate:create`; check `settingsDepth`, `sitemap()` throwing, 2FA slug, client IP; own seed code → `@intecion/ipal-kit/seed`; global hooks/access plugins → `revalidatePath` / `globalOverrides` | CHANGELOG 1.13.0, AGENT.md §7.1, seo.md, seeding.md |
| 48 | **1.14.0 — image lightbox** — own image modal (`useState(index)` + `div role="dialog"`), `glightbox` / other lightbox library, thumbnails linking to the raw file in a new tab | `ipalKit({ lightbox: true })` + Postgres `migrate:create`; `<SiteProviders lightbox>`; `<LightboxTrigger group image={lightboxImage(media, { size })}>` around the thumbnail; delete the old dialog and `pnpm remove glightbox`; old label fields → Form messages → Image viewer | lightbox.md → "Replacing a hand-made modal" |
| 49 | **1.14.0** — import map, Node, Next, audit, cookie list, admin languages | `pnpm payload generate:importmap` (`FaviconCheck`, `RowLabel`); Node 20.9+; `next@^16.4.3` + `sharp@^0.35.5` (Next ≤16.4.0 has two RCEs); `pnpm audit --prod` + `dompurify` / `undici` overrides on payload 3.90.x; hand-kept cookie list → `cookieScanner` (+ `crawl`, `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN`) + `migrate:create`; English-only admin → `i18n.supportedLanguages`; tests on validator strings → full sentences | CHANGELOG 1.14.0, cookie-scanner.md, i18n.md, AGENT.md §4 items 11–12 |
| 50 | **1.14.1** — `X-Powered-By: Next.js, Payload` in responses, no CSP or a hand-written one | `withPayload(withSecurityConfig(nextConfig))`; `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', …flags } })` + `buildAdminCspHeaders` on `/admin/:path*` + `export const POST = createCspReportRoute()`; after clean reports `mode: 'enforce'`; nonces (`createProxy({ csp })` + `<SiteProviders nonce>`) only for dynamic sites | security.md, CHANGELOG 1.14.1 |
| 51 | **1.14.2** — a new admin stuck on `/admin/setup-totp?back=null` (the page keeps redirecting to itself), or an own `x-pathname` rule on `/admin` added as a workaround | `pnpm payload generate:importmap` (`TotpRedirectProvider`), commit `importMap.js`, redeploy; delete the workaround; own redirect rules → `twoFactor.provider` | security.md → "The redirect to the 2FA screens", CHANGELOG |
| 52 | **1.14.3** — editors open every Cookie review entry one by one to accept it | with `cookieScanner`: `pnpm payload generate:importmap` (`CookieApprovalView`, `CookieCrawlAlert`), Postgres/SQLite `migrate:create` (`change`, `needs_description`); editors use Approve cookies (`/admin/cookie-approval`, linked from Privacy → Cookie review); old flow: `cookieScanner: { approval: false }` | cookie-scanner.md, CHANGELOG 1.14.3 |
| 53 | **1.14.4** — cookie texts retyped in every language; three cookie entries in the admin navigation | `pnpm payload generate:importmap` (`CookieReviewTab`, `CookieSiteCheckTab`); empty languages fill themselves (`fillEmptyLocales: false` to keep them empty); with `cookieScanner` one **Cookies** entry with tabs (`cookieScanner: { adminLayout: 'separate' }` for the old entries); Cookie banner is now called Cookies — update editor instructions; no migration | consent.md, cookie-scanner.md, hooks.md, CHANGELOG 1.14.4 |
After updating the package: `pnpm ipal:skills` (new skill versions), `pnpm payload generate:importmap`, `rm -rf .next`, restart dev, grep for the new symbol in
`node_modules/@intecion/ipal-kit/dist`.
@@ -667,7 +673,7 @@ After updating the package: `pnpm ipal:skills` (new skill versions), `pnpm paylo
| Banner without styles | no Tailwind or no `@source` for the plugin |
| `/admin`, `/_next` → 500 | the proxy matcher is not an inline literal |
| `slug.join is not a function` | `[slug]` instead of `[[...slug]]` |
| `/pl` → 404 | Homepage not assigned in System Pages |
| `/pl` → 404 | Homepage not assigned in System pages |
| `/en/*` → 404, `/pl/*` works | empty title/slug in EN |
| `Missing <html> and <body>` | root layout deleted, and `[locale]/layout.tsx` does not have them |
| Routes `ƒ` despite `generateStaticParams` | the build does not see the database (§4.3) |
+192
View File
@@ -0,0 +1,192 @@
# admin-ux.md — wording and layout of the admin panel
> **Who it is for:** anyone (person or agent) who adds or changes a collection,
> global, field, admin view, button or default text in ipal-kit — or in a project
> built on it. Projects can override every label and description the plugin ships;
> this guide is what the defaults follow, and what new fields in projects should follow.
The reader is an **editor**: a marketing or office person who knows the business,
not the code. Every screen must be clear to them without a developer at hand.
---
## 1. Tone
- **Professional and plain.** Write as a careful colleague would: calm, neutral, polite.
No jokes, no exclamation marks, no "Oops".
- **Say what it does for the site, not how it works.** "Shown in search results" — not
"Rendered via buildIconsMetadata".
- **No developer words** in labels, descriptions, placeholders, toasts or errors:
no function, component, hook, file, skill or env-var names (`<CookieTable>`,
`buildIconsMetadata`, `ipal-consent-check`, `SMTP_HOST`), no `camelCase`, no
`settings="detailed"`, no arrows like `Empty →`.
Developer notes belong in code comments and `docs/`.
- **Product names stay** when the editor must find that product: Google Analytics,
Google Tag Manager, Meta Pixel, Microsoft Clarity, Cloudflare Turnstile, Bing Webmaster Tools.
- **Address the editor directly**, in the imperative: "Add your LinkedIn profile", "Leave empty to…".
- **Errors say what to do:** "Enter a full address, e.g. https://example.com" — not "Invalid URL".
Errors an editor can see never name env vars, config files or packages; the developer
detail goes to the server log.
- **No package or vendor names** (ipal-kit, Intecion) in labels, descriptions, test e-mails
or messages. "Ask your administrator" instead of "configured by Intecion". The one exception is
the vendor credit under the navigation (`whiteLabel.credit`), which exists to name the vendor.
## 2. Length
| Element | Limit | Example |
|---|---|---|
| Collection / global name | 1–2 words | Site settings, Consent log |
| Tab, group, collapsible | 1–2 words | General, Search engines |
| Field label | 1–3 words, max **30 characters** | Site name, Share image |
| Select option | 1–4 words | Page first |
| Button | 1–3 words, a verb | Send test e-mail |
| Description | **one short sentence**, max **120 characters**; only where it helps | Shown when a page has no image of its own. |
| Placeholder | an example value, not an instruction | `e.g. G-XXXXXXX` |
| Toast / inline message | one sentence | Test e-mail sent to anna@example.com. |
| Empty state | one sentence + what to do next | No submissions yet. They appear here when someone sends a form. |
- **Skip the description** when the label says it all (Title, Logo, Phone).
A description that repeats the label is noise.
- **One sentence, one idea.** If a field needs a paragraph, the field is too
complex: split it, give it a good default, or move the explanation to `docs/`.
- Description text ends with a full stop. Labels, tabs and buttons don't.
## 3. Language and translations
- The plugin ships every admin string in **every language it supports: English (`en`) and
Polish (`pl`)**. A label or description is `{ en: '…', pl: '…' }`, never a bare string.
- **Every field gets an explicit `label`.** Never rely on Payload's auto-label from the
field name (`Ga4 Measurement Id`, `Linked In Partner Id`, `Same As`).
- Custom admin components (views, widgets, buttons) take their strings from the plugin's
translations (`config.i18n.translations`, merged with the project's), not hardcoded JSX.
- Visitor-facing defaults (cookie banner, form messages, step buttons, 404) ship in `en`
and `pl`, and pick the language of the page being viewed. An empty field in the
CMS falls back to the default **for that language**, never to English on a Polish page.
- Polish follows the same rules: short, neutral, formal (`Wpisz…`, `Zostaw puste…`;
no `Ty`/`Pan` forms — impersonal or imperative).
- **Admin languages:** when the project has not set `i18n.supportedLanguages`, the plugin
turns on English and Polish for the admin panel. A project that sets its own list keeps it.
- A project overrides any of it through the plugin's override options; the project's
value wins (CLAUDE.md main rule).
## 4. Glossary — one word per concept
Use these terms everywhere: labels, descriptions, docs, toasts. Never a synonym.
| Concept | English | Polish | Not |
|---|---|---|---|
| The admin panel | admin panel | `panel administracyjny` | CMS, backend, dashboard (for the whole panel) |
| A web page in the CMS | page | `strona` | site (for one page), document |
| 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 |
| 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 |
| Built-in visit counting | statistics | `statystyki` | analytics (= Google Analytics etc.), stats |
| Third-party tracking tools | analytics | `analityka` | tracking, pixels (in labels) |
| Anti-spam check on forms | spam protection (Cloudflare Turnstile) | `ochrona przed spamem` | captcha, Turnstile (alone) |
| Image shown when a link is shared | share image | `obraz udostępniania` | Open Graph image, OG image, meta image |
| Text shown under a result in Google | description (search result) | `opis (w wynikach wyszukiwania)` | meta description |
| Title in the browser tab / Google | page title | `tytuł strony` | meta title, SEO title |
| Web address part after the domain | address (URL) | `adres (URL)` | slug, path, route |
| The visible name of a field in a form | label | `etykieta` | name (= technical key) |
| Technical key of a form field | field key | `klucz pola` | name |
| Search engines and AI | search engines, AI assistants | `wyszukiwarki, asystenci AI` | crawlers, bots (except the advanced bot rules) |
| Outgoing e-mail server | e-mail sending | `wysyłka e-mail` | transport, SMTP (as a tab name) |
| Under-construction mode | maintenance mode | `tryb prac technicznych` | under construction, coming soon |
| Role | role: admin, editor, user | `rola: administrator, redaktor, użytkownik` | |
Product names that stay as they are: Google Analytics 4, Google Tag Manager,
Meta Pixel, Microsoft Clarity, LinkedIn Insight Tag, TikTok Pixel, Cloudflare Turnstile,
IndexNow, Google Search Console, Bing Webmaster Tools, Yandex Webmaster, llms.txt (only
in parentheses after a plain name).
## 5. Capitalisation and punctuation
- **Sentence case** everywhere: "Site settings", "Share image", "Send test e-mail" — not
"Site Settings". Only product names keep their capitals.
- Polish: sentence case as well ("Ustawienia witryny").
- No full stop in labels, tabs, buttons, option labels. Full stop at the end of descriptions,
toasts and empty states.
- Examples go in descriptions as `e.g. "Privacy policy"` (pl: `np. „Polityka prywatności"`),
in placeholders as the bare example value.
- Variables in editable texts use `{name}` and are named in the description:
"Use {field} for the field name."
## 6. Describing options
- **Select / radio:** the option label is the result, short: `Page first`, `Site first`.
Put a live example in the description or after a dash only when it decides the choice:
`Page first — About us | Acme`.
- **Checkbox:** label states the "on" state as a positive: "Show theme switch", not
"Disable theme switch" / "Allow Theme Toggle".
- **Empty-means-default fields:** say it once, the same way everywhere:
"Leave empty to use the default." (pl: `Zostaw puste, aby użyć domyślnej wartości.`).
The default itself goes in the placeholder.
- **Number fields** state the unit in the label: "Session length (minutes)".
- **Danger** (consent reset, secret rotation): say the consequence, plainly:
"Changing it asks every visitor for consent again."
## 7. Field order and grouping
Order inside a document, top to bottom:
1. **What the visitor sees first**: title, main text, image.
2. **Content details**: sections, lists, links.
3. **Behaviour and options**: switches, selects, conditions.
4. **Technical and rare**: keys, IDs, versions, advanced rules — last, collapsed.
Rules:
- **Required fields first** within their group.
- **Related fields together**: a `row` for 2–3 short fields that belong together
(host + port, name + provider + category); never more than 3 in a row.
- **Sidebar** (`position: 'sidebar'`) for metadata the editor sets once and rarely
touches: address (URL), publish date, status, version, role. Never for content.
- **Tabs** when a document has 2+ clearly separate areas the editor visits on their own
(Content / SEO; General / Theme / Search engines). Max ~6 tabs. One-field tabs are not
allowed — merge them. Tab names are nouns, 1–2 words.
- **Collapsible** for an optional or advanced block inside a tab ("Advanced", "Bot rules"),
collapsed by default.
- **Group** (named data group) only when the data is a group; its label is a short
noun ("Buttons"), with no description unless it adds something.
- **Arrays** get a singular/plural `labels` and a row label that shows the item's name.
- Fields that only work with another setting (`admin.condition`) hide until they apply,
rather than explaining in a description when they apply.
- Admin navigation: collections and globals sit in a few fixed groups —
**Content**, **Forms**, **Settings**, **Privacy**, **Statistics** (pl: `Treści`, `Formularze`,
`Ustawienia`, `Prywatność`, `Statystyki`). Settings holds configuration only; logs and records
(consent log, visits) go to their own group. A nav link or view the user cannot open is
hidden, never shown with "You do not have access".
- **One entry per feature.** Screens that serve one feature become tabs of one global, not
separate navigation entries: *Cookies* holds the banner texts, the cookie list, *Review and
approve* and *Site check*. Supporting collections and globals leave the navigation with
`admin.group: false` (their pages and API stay, links still open them) and appear as `ui`-field
tabs. Logs stay separate (*Consent log*).
- A global or collection is named for what the editor finds in it ("Form messages"), not
for the mechanism behind it ("Notifications"). Renaming the visible label never changes
the slug.
## 8. Custom views, widgets, buttons
- Every view has a page title (browser tab) and a heading that match its nav link.
- Buttons: verb first ("Send test e-mail", "Scan cookies"); a busy state
("Sending…"); a result toast; a clear error with the next step.
- Empty states: what is missing + when it will appear or what to do.
- Numbers come with a unit or a short label under them ("Visits", "Page views").
- Numbers, dates and plurals follow the admin language (`Intl` with the user's language),
never a fixed `en-US`; plurals use `Intl.PluralRules`, not `visit(s)`.
- A status message names the right thing: a shared banner component takes its wording
from the integration it reports on.
- Explanations of how a feature works (privacy model, data kept) go in one sentence
under the heading — not in each card.
## 9. Checklist for a new field (projects too)
- [ ] Explicit `label`, 1–3 words, sentence case, `{ en, pl }` (or the project's languages).
- [ ] Description only if it helps; one sentence, ≤ 120 characters, no developer words.
- [ ] Terms from the glossary.
- [ ] Placeholder is an example value.
- [ ] Placed by the order rules; sidebar / tab / collapsible chosen by §7.
- [ ] Visitor-facing default exists in every language the site has.
+4 -4
View File
@@ -188,7 +188,7 @@ Do this according to PROGRAMISTA.md §2.8–2.9 and seo.md:
api/health/route.ts — every route that reads the database with export const dynamic = 'force-dynamic',
- next.config.ts: htmlLimitedBots, buildSecurityHeaders,
- page metadata through generatePageMetadata from lib/content (shared cache), favicon through buildIconsMetadata,
- JSON-LD: Organization + WebSite come from SiteProviders using Site Settings; local business → siteJsonLd in createContentHelpers (seo.md),
- JSON-LD: Organization + WebSite come from SiteProviders using Site settings; local business → siteJsonLd in createContentHelpers (seo.md),
- src/instrumentation.ts with assertEnv(ipalEnvRules(...)) imported from @intecion/ipal-kit/env (env.md).
No CSP yet — that comes in step 14.
Plan first.
@@ -208,7 +208,7 @@ Do this according to AGENT.md §6.8, code from node_modules/@intecion/ipal-kit/d
- globals/Company.ts for market <PL/AU/…>: name, address, <NIP/ABN/…>, phone, email —
all localized where it is text,
- menu through resolveNav from lib/content (plugin, NOT lib/navigation.ts), components/layout/Header.tsx, Footer.tsx, MobileNav.tsx,
- legal links in the footer from System Pages roles, NOT by hand,
- legal links in the footer from System pages roles, NOT by hand,
- the project's own globals (Header, Footer, Company) get buildGlobalRevalidateHook (afterChange); plugin globals refresh through ipalKit({ revalidatePath }).
Wire it into [locale]/layout.tsx. a11y labels from the admin panel.
Plan first.
@@ -260,7 +260,7 @@ Do this according to forms.md, turnstile.md, email.md:
- RenderForm handles the honeypot and the GTM event from the admin panel by itself (forms.md).
Plan first.
```
Check: admin panel → Site Integrations → Send test; submitting the form without consent → rejected.
Check: admin panel → Site integrations → Send test; submitting the form without consent → rejected.
---
@@ -268,7 +268,7 @@ Check: admin panel → Site Integrations → Send test; submitting the form with
```
Verify and finish according to consent.md and analytics.md:
- Analytics through SiteProviders (inside consent), IDs only from Site Integrations,
- Analytics through SiteProviders (inside consent), IDs only from Site integrations,
- whether to turn on defer (Core Web Vitals) — <yes/no>,
- Meta Pixel: <in the admin panel | in GTM> (never both),
- policy link in the banner: automatic (no privacyPolicy parameter in the code).
+19 -12
View File
@@ -10,14 +10,21 @@ and the editor picks the transport in the panel. A separate `sendEmail` helper (
## Dependency
`nodemailer` (`^8`) is already in the plugin's `dependencies` — the project does not need to
install it. Graph is plain `fetch`, no extra packages.
`nodemailer` (`^10.2.1`) is already in the plugin's `dependencies` — the project does not need to
install it (nodemailer 10 ships its own types, so `@types/nodemailer` is not needed either). Graph is plain
`fetch`, no extra packages.
- **Node.js 20 or later** — nodemailer 10 requires it (the Coolify images run Node 22).
- **Why `^10.2.1`:** every nodemailer up to 10.1.3 has open advisories (address parser ReDoS, recipient-domain
bypass, `raw`/`resolveContent` file access). Do not pin an older nodemailer in the project.
- **Since nodemailer 9**, attachments given as an `href`/`path` URL are fetched with TLS certificate validation.
A mail with an attachment from a host with a self-signed certificate now fails instead of sending.
## Config
No plugin options — SMTP (`smtpHost`, `smtpPort` (default 587), `smtpUser`,
`smtpPassword`, `smtpFromAddress`, `smtpFromName`) and `emailTransport` live in
SiteIntegrations (SMTP tab). The editor configures them in the panel. The plugin does **not** set
SiteIntegrations (E-mail sending tab). The editor configures them in the panel. The plugin does **not** set
`config.email` — you wire the adapter yourself (below).
## Front — sendEmail (server)
@@ -41,7 +48,7 @@ if (result.sent) {
```
- Always the SMTP from the panel (not Graph, not `mailAdapter`); without `smtpHost`/`smtpUser`/`smtpPassword`
→ `{ sent: false, error: 'SMTP is not configured in Site Integrations.' }`.
→ `{ sent: false, error: 'SMTP is not configured in Site integrations.' }`.
- `from` overrides the address (the name still comes from `smtpFromName`); without `from` and without
`smtpFromAddress` → `{ sent: false, error: 'No from-address configured.' }`.
- **The HTML is your argument** — the plugin has no templates, it sends what you pass.
@@ -95,7 +102,7 @@ mail will not go out.
## Masking secrets in the panel (MaskedField)
Sensitive fields in Site Integrations (`smtpPassword`, `turnstileSecretKey`) are
Sensitive fields in Site integrations (`smtpPassword`, `turnstileSecretKey`) are
masked in the UI — they show `••••` instead of plaintext, with
a Reveal/Hide button. This is UI masking, NOT hashing or encryption:
the value in the database is plaintext (it must be recoverable for SMTP / Turnstile authentication).
@@ -144,7 +151,7 @@ import { mailAdapter } from '@intecion/ipal-kit'
email: mailAdapter(), // SMTP or Graph — chosen in the panel, on EVERY send
```
`mailAdapter` is a dispatcher: it reads `emailTransport` from Site Integrations on every
`mailAdapter` is a dispatcher: it reads `emailTransport` from Site integrations on every
send (no value → `'smtp'`), so the switch in the panel works without a restart.
Graph only when all 4 `GRAPH_*` variables are in env — otherwise a clear log and
fallback to SMTP (mail is not lost silently).
@@ -197,13 +204,13 @@ import { mailAdapter } from '@intecion/ipal-kit'
email: mailAdapter()
```
Panel → Site Integrations → SMTP → **Email Transport** (SMTP / Microsoft Graph).
Panel → Site integrations → SMTP → **Email Transport** (SMTP / Microsoft Graph).
The dispatcher reads this choice per send. Guard: if Graph is selected but the
secrets are missing in .env → log + fallback to SMTP (no silent failure).
## Test send — button in the panel
The SMTP tab has a **Send test** button: enter an address, click, and a test
The E-mail sending tab has a **Send test** button: enter an address, click, and a test
mail goes out through the CURRENT transport (`payload.sendEmail`). It shows the result (✓/✗ with the error). Endpoint
`POST /api/ipal/test-email`, body `{ to }` (`admin` role only — needs roles from the `access` option:
not logged in → 401, other role → 403, bad address → 400, failed send → 502).
@@ -216,10 +223,10 @@ Save your changes before the test — the endpoint reads from the database, not
## Send status in the panel
`mailAdapter()` stores the send result in Site Integrations (at most once per 10 min
`mailAdapter()` stores the send result in Site integrations (at most once per 10 min
while an error persists, immediately when the state changes). When sending fails:
- **Dashboard** — a red alert with the cause and a link to Site Integrations,
- **Site Integrations → SMTP** — a banner with the error (e.g. `SMTP: connect ECONNREFUSED …`,
- **Dashboard** — a red alert with the cause and a link to Site integrations,
- **Site integrations → SMTP** — a banner with the error (e.g. `SMTP: connect ECONNREFUSED …`,
`SMTP: SMTP is not configured…`, `SMTP: Invalid login: 535 …`,
`Microsoft Graph: Graph sendMail failed (403).`) and the time.
@@ -234,7 +241,7 @@ send (e.g. **Send test**) the current one appears.
## Turn off, override, extend
- **Turn off:** the plugin does not set `config.email` itself — without `email:` in `buildConfig` Payload uses
its mock (mail only in the console). The SMTP fields in Site Integrations and the endpoint
its mock (mail only in the console). The SMTP fields in Site integrations and the endpoint
`POST /api/ipal/test-email` are currently always added.
- **Choosing the transport:** `mailAdapter()` (the panel decides) or a fixed `panelSmtpAdapter()` /
`graphAdapter()`; any other Payload adapter (e.g. `@payloadcms/email-nodemailer`) also works —
+2 -1
View File
@@ -61,6 +61,7 @@ use).
ipalEnvRules({
storage?: boolean | { requirePublicUrl?: boolean }, // R2_* (R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_ENDPOINT; R2_PUBLIC_URL optional)
emailGraph?: boolean, // GRAPH_* (GRAPH_TENANT_ID, GRAPH_CLIENT_ID, GRAPH_CLIENT_SECRET, GRAPH_SENDER — e-mail)
cookieCrawl?: boolean, // IPAL_COOKIE_SCAN_URL (url), IPAL_COOKIE_SCAN_TOKEN (≥ 16 chars) — required in production; cookieScanner.crawl (cookie-scanner.md)
ipHeader?: boolean, // IPAL_IP_HEADER — required in production, optional outside it (header name [a-z0-9-])
turnstile?: boolean | { siteKeyVar?: string; secretVar?: string }, // NEXT_PUBLIC_TURNSTILE_SITE_KEY, TURNSTILE_SECRET_KEY
serverUrlVar?: string, // default 'NEXT_PUBLIC_SERVER_URL'
@@ -84,7 +85,7 @@ read; DB/secret are Payload variables — their names can be overridden.
that always uses a media domain).
**`turnstile: true`** makes both Turnstile variables **required**, even though the plugin takes the keys
from the panel first (Site Integrations) and env is only a fallback — turn it on only when you keep the keys
from the panel first (Site integrations) and env is only a fallback — turn it on only when you keep the keys
in env.
The plugin also reads (outside the preset — add your own rules if you want to validate them):
+10 -7
View File
@@ -57,7 +57,7 @@ ipalKit({
| `fields` | see below | builder field types; `false` turns a type off, an object (block) replaces it; `true` = the default ipal block |
| `redirectRelationships` | — | collections a form can redirect to |
| `formOverrides` / `formSubmissionOverrides` | — | collection overrides (`fields` as a function + any collection settings) |
| `emailLayout` | `false` | nice emails + the Site Settings → Emails tab |
| `emailLayout` | `false` | nice emails + the Site settings → E-mails tab |
| `beforeEmail` | — | the form-builder's `beforeEmail` (after the layout, when `emailLayout`) |
| `consentFieldName` | `'consent'` | name of the GDPR consent field for `submitForm` / `createSubmitAction` (the call's argument wins) |
@@ -82,7 +82,7 @@ import { RenderForm } from '@intecion/ipal-kit/rsc'
```
- `form` — the relation from the block (depth ≥ 1; an ID or null → nothing renders),
- `action` — `sendForm` from `createSubmitAction` (below), `texts` — `getFormTexts(locale)` from `lib/content`
(Notifications → Form messages),
(Form messages → Form messages),
- `classNames` — the **only** place for looks (`src/components/forms/formClasses.ts`, template in ipal-form);
the plugin has no styles at all. Keys: `form, progress, step, stepTitle, stepDescription, fields,
field, fieldHalf, fieldFull, label, input, textarea, select, checkbox, checkboxLabel, choices,
@@ -118,7 +118,7 @@ the time block: `timeBlock`. New fields in form blocks = a migration (`pnpm payl
A **Step** block (title, description, per language) starts a new screen; fields above the first Step are screen 1.
`BuilderForm`: "Step 1 of 3" (`stepOf`), Next validates only the current step, Back keeps the
values, focus moves to the new step, Turnstile is on the last step, a field error from the server goes back
to the step with that field. Button texts: Notifications → Form messages → `next`, `back`, `stepOf`.
to the step with that field. Button texts: Form messages → `next`, `back`, `stepOf`.
### Conditional fields and steps ("Show only when")
Every form block (built-in, **Checkbox group**, **Step**, message) has a
@@ -275,7 +275,7 @@ messages the editor configured (Forms → form → Emails), through
email: mailAdapter(), // from '@intecion/ipal-kit' — SMTP or Graph according to the panel (email.md)
```
Then they go through the transport chosen in Site Integrations (SMTP or Graph). The editor sets recipients, subject and
Then they go through the transport chosen in Site integrations (SMTP or Graph). The editor sets recipients, subject and
body (placeholders: `{{field}}`, `{{*}}`, `{{*:table}}`) without touching the code.
`submitForm` is responsible only for Turnstile verification and storing. It stores the submission in the page's language
@@ -291,7 +291,7 @@ forms: { emailLayout: true } // optional: beforeEmail: (emails, args)
instead of values (Checkbox group too), a checked checkbox = ✓, empty answers skipped, groups by
step (Step titles). Only fields the visitor saw (the server does not store fields hidden by a condition).
- Every email gets a **template** (tables + inline CSS — Gmail, Outlook, Apple Mail): a header with the logo,
the body from the panel, a footer. Settings: **Site Settings → Emails** — logo (**PNG/JPG**, SVG does not work in
the body from the panel, a footer. Settings: **Site settings → Emails** — logo (**PNG/JPG**, SVG does not work in
Gmail/Outlook; empty = the site name), accent colour (hex), footer (per language). The link to the site and the
absolute logo address come from `serverURL` in `buildConfig` (set it from `NEXT_PUBLIC_SERVER_URL`).
- An error while building the template never blocks sending — the original email goes out, the error goes to the log.
@@ -532,8 +532,11 @@ const f = useForm({ initialValues, submitAction, validate })
### Validators (pure — also server-side)
`required`, `email`, `minLength`, `maxLength`, `checked`, `pattern`, `custom`,
`isEmail`, `buildValidator`. Each takes its own message. They are pure (no
`'use client'`), so you can use the same rules to re-validate in a server action.
`isEmail`, `buildValidator`. Each takes its own message; without one it uses the English
default from `VALIDATION_MESSAGES` (type `ValidationMessages`). `localizedRules(locale)` returns the
same rules with the defaults in the page language (`validationMessages(locale)`: Polish for `pl`,
English otherwise). They are pure (no `'use client'`), so you can use the same rules to
re-validate in a server action.
### errors are a STRING, not a boolean
+8 -6
View File
@@ -38,8 +38,8 @@ and shared by the helpers (generateMetadata and the page share queries).
| `mcp` | — | `{ serverName, serverVersion, rateLimit, maxBatch, clientIp, isPathVisible }` for `mcpGET`/`mcpPOST` (mcp.md) |
| `pageJsonLd` | — | default `getPageJsonLd` options: `breadcrumbs`, `entryType`, `entries`, `faq`, `pageType` |
| `robots` | — | `RobotsOptions` for `robots` and `getRobots` (seo.md); `aiBotRules: [{ userAgent, access }]` = per-bot exceptions from code (the panel's rules come after them) |
| `settingsDepth` | `1` | depth of `getSettings`: Site Settings relations arrive as documents, theirs as ids (the archive page is read separately at depth 2); `2` = every request pays for more |
| `siteJsonLd` | WebSite + Organization from Site Settings | a function replaces it, `false` = none |
| `settingsDepth` | `1` | depth of `getSettings`: Site settings relations arrive as documents, theirs as ids (the archive page is read separately at depth 2); `2` = every request pays for more |
| `siteJsonLd` | WebSite + Organization from Site settings | a function replaces it, `false` = none |
| `sitemapEntries` | — | `(entries) => entries` — final sitemap list: add URLs of your own routes, remove some, set `priority` |
| `sitemapImages` | the document's SEO image | `(doc) => url[]` |
| `sitemapOptions` | `{ maxUrls: 10000, cacheControl: 'public, max-age=0, s-maxage=3600, stale-while-revalidate=86400', memoSeconds: 300 }` | `sitemapRoute`: above `maxUrls` it serves a `<sitemapindex>` with `?part=N` parts (`Infinity` = never split); `cacheControl: false` = no header; `memoSeconds: 0` = no in-process memo |
@@ -56,14 +56,14 @@ and shared by the helpers (generateMetadata and the page share queries).
| `getSettings` | `(locale)` — SiteSettings, `depth: 1` (`settingsDepth`), one read per language per request |
| `resolveRoute` | `(locale, segments, page)` → `ResolvedRoute \| null` (content.md) |
| `getEntries` | `(collection, locale, page, perPage)` → `ArchiveEntries` |
| `getNotFoundPage` | `(locale)` — 404 page from System Pages or `null`, does not throw (pages.md) |
| `getNotFoundPage` | `(locale)` — 404 page from System pages or `null`, does not throw (pages.md) |
| `generatePageMetadata` | `(locale, segments, page = 1)` → `Metadata` for `generateMetadata` |
| `getPageJsonLd` | `(locale, segments, options?)` → nodes for `<JsonLdGraph>` (WebPage / BlogPosting / CollectionPage, BreadcrumbList, FAQPage); `[]` for noindex |
| `generateStaticParams` | see below |
| `sitemap` | `app/sitemap.ts`: `export { sitemap as default }` (does not split; a database error throws at runtime, `[]` only during `next build`) |
| `sitemapRoute` | `app/sitemap.xml/route.ts`: `export { sitemapRoute as GET }` |
| `robots` | `app/robots.ts`: `export { robots as default }` — rules from code only (sync) |
| `getRobots` | `app/robots.ts`: `export { getRobots as default }` + `export const dynamic = 'force-dynamic'` — `robots` plus the AI crawler policy and per-bot rules from Site Settings → Search & AI, read per request; database unreachable → the code options |
| `getRobots` | `app/robots.ts`: `export { getRobots as default }` + `export const dynamic = 'force-dynamic'` — `robots` plus the AI crawler policy and per-bot rules from Site settings → Search engines, read per request; database unreachable → the code options |
| `manifest` | `app/manifest.ts`: `export { manifest as default }` |
| `llmsRoute`, `llmsFullRoute` | `app/llms.txt/route.ts`, `app/llms-full.txt/route.ts` (seo.md) |
| `markdownRoute` | `app/md/[locale]/[[...slug]]/route.ts` (content.md) |
@@ -145,7 +145,7 @@ import { getSiteShell } from '@/lib/content'
```
Renders: `<ThemeScript>` (when `theme`), `<MediaPreconnect>`, `<JsonLdGraph>` (site JSON-LD + `jsonLd`),
`<ConsentProvider>` with `<TurnstileProvider>`, `<CookieBanner>`, `<CookieButton>`, `<Analytics>`, `<PageStats>`.
`<ConsentProvider>` with `<TurnstileProvider>` (and `<LightboxProvider>` when `lightbox`), `<CookieBanner>`, `<CookieButton>`, `<Analytics>`, `<PageStats>`.
It does not mount `AlternateLinksProvider` (i18n.md) — add it yourself if you use `LanguageSwitcher`.
| Prop | Default | What it does |
@@ -157,6 +157,7 @@ It does not mount `AlternateLinksProvider` (i18n.md) — add it yourself if you
| `analytics` | on | extra `<Analytics>` props or `false` = no tags |
| `cookieMap` | — | extra cookies per category to clean up after consent is withdrawn |
| `jsonLd` | `[]` | extra JSON-LD nodes |
| `lightbox` | off | `true` / `{ texts, classNames, icons, loop, unstyled }` → one `<LightboxProvider>` for the site; texts from `shell.lightboxTexts` (Form messages → Image viewer) — lightbox.md |
| `preconnect` | `true` | `<link rel=preconnect>` to the media origin |
| `stats` | off | `true`/props → `<PageStats>` (stats.md) |
| `theme` | `false` | `<ThemeScript>` before the first paint (theme.md) |
@@ -168,7 +169,8 @@ It does not mount `AlternateLinksProvider` (i18n.md) — add it yourself if you
- Any key from `createContentHelpers` can be left out of the destructuring or replaced with your own function
of the same name in `src/lib/content.ts` (e.g. your own `generateStaticParams` with entries).
- `createPageRoute`: your own view through `render`, your own 404/redirect through `onMissing`, extra block props through `blockProps`, JSON-LD through `jsonLd`.
- `SiteProviders`: `lightbox` is off by default; for `renderImage` / `renderDialog` (functions) mount `<LightboxProvider>` yourself in a client component instead (lightbox.md).
- `SiteProviders`: `banner`, `cookieButton`, `analytics` accept your own element or `false`; `analytics={{ consentMode: 'basic' }}` = no request to Google before consent (default `'advanced'`: the tag loads with every signal `denied`).
- Search & AI from the panel: `robots` instead of `getRobots` ignores it; your own robots: `buildRobots({ ...robotsOptionsFrom(settings), … })`; drop the verification tags: `const { verification, ...meta } = await generatePageMetadata(…)`.
- Search engines from the panel: `robots` instead of `getRobots` ignores it; your own robots: `buildRobots({ ...robotsOptionsFrom(settings), … })`; drop the verification tags: `const { verification, ...meta } = await generatePageMetadata(…)`.
- Construction filter in Markdown / MCP: `markdown: { isPathVisible: () => true }`, `mcp: { isPathVisible: () => true }`; in the sitemap and llms.txt: `underConstructionSeo: false`.
- `createPageRoute` pagination and the `generateStaticParams` scope currently cannot be changed with an option — only with your own code.
+3 -3
View File
@@ -14,7 +14,7 @@ Related: [analytics.md](./analytics.md), [consent.md](./consent.md),
## What the plugin does FOR you (you do not configure this in code)
- **Loads the GTM container** — `Analytics` takes the `GTM Container ID` from the panel
(Settings → Site Integrations). Zero code.
(Settings → Site integrations). Zero code.
- **Consent Mode v2** — before loading the container it sends `consent default`
(the saved decision or everything `denied`), and after a click in the banner `consent
update`. The GTM container itself loads **before consent** (advanced mode) — that is why
@@ -33,7 +33,7 @@ Integrations empty (otherwise the plugin loads a second pixel → double countin
## 0. Prerequisites (Payload panel)
1. **GTM Container ID** in Settings → Site Integrations (`GTM-XXXXXXX`).
1. **GTM Container ID** in Settings → Site integrations (`GTM-XXXXXXX`).
2. **Cookie banner** active (`CookieBanner` + `ConsentProvider`) — otherwise
Consent Mode gets no decision.
3. **Analytics field on the form** — add `buildFormAnalyticsFields()` to the
@@ -189,7 +189,7 @@ forms + analytics modules, not GTM configuration.
## Turn off, override, extend
- **Turn off:** empty *GTM Container ID* in Site Integrations = the container does not load; empty
- **Turn off:** empty *GTM Container ID* in Site integrations = the container does not load; empty
*Event name* on the form = no `form_submit`.
- **Override:** event name and parameters per form in the panel; instead of `formAnalyticsOnSuccess`
you can call `pushDataLayer(event, params)` in `onSuccess` with your own data.
+26 -4
View File
@@ -61,12 +61,12 @@ in the Local API call.
### Globals — buildGlobalRevalidateHook / `ipalKit({ revalidatePath })`
A global (Site Settings, Cookie Settings, the project's menu) feeds the layout of **every** page — logo, menu,
A global (Site settings, Cookie banner, the project's menu) feeds the layout of **every** page — logo, menu,
consent texts, analytics IDs. Without revalidation, ISR pages kept the old values until the end of the
`revalidate` window. Saving a global → `revalidatePath('/', 'layout')` (the whole site).
```ts
// payload.config.ts — the plugin's globals (Site Settings, Site Integrations, Cookie Settings, Notifications)
// payload.config.ts — the plugin's globals (Site settings, Site integrations, Cookie banner, Notifications)
import { revalidatePath } from 'next/cache'
ipalKit({ …, revalidatePath })
@@ -113,9 +113,9 @@ import { buildPreventDeleteSystemPage } from '@intecion/ipal-kit'
hooks: { beforeDelete: [buildPreventDeleteSystemPage({ settingsSlug: 'site-settings' })] }
```
It reads Site Settings in the same `req` (the delete transaction).
It reads Site settings in the same `req` (the delete transaction).
To delete — first detach the role in Site Settings (a deliberate decision).
To delete — first detach the role in Site settings (a deliberate decision).
Options: `settingsSlug` (`'site-settings'`), `roleFields` (default `['homepage',
'privacyPolicy', 'cookiePolicy', 'termsOfService']` — **without `notFound`**; the 404 page and
@@ -232,6 +232,28 @@ A sync error is logged; the save does not fail.
---
## buildFillEmptyLocalesGlobalHook / buildFillEmptyLocalesCollectionHook — text into empty languages
The text counterpart of `buildCrossLocaleFieldSync`: text saved in one language goes to every
language where that field is still empty; a language with its own text is never overwritten. The
plugin adds it to the cookie list and the cookie review (`ipalKit({ fillEmptyLocales })`, consent.md).
On your own global or collection:
```ts
import { buildFillEmptyLocalesGlobalHook } from '@intecion/ipal-kit'
hooks: {
afterChange: [buildFillEmptyLocalesGlobalHook({ global: 'footer', fields: ['tagline', 'links.label'] })],
}
```
Fields: `'field'` or `'arrayField.subField'` (rows matched by their id). The collection variant takes
`{ collection, fields }`. It skips its own writes (`context.ipalFillLocales`) and the cookie scanner's,
puts `req.locale` back afterwards, and logs instead of failing the save. Core function:
`fillEmptyLocales`; `withFillLocales(kind, config, fields)` adds the hook to a config.
---
## buildNoindexField — checkbox → meta.noindex (a field, not a hook)
A sidebar `noindex` checkbox kept in sync with `meta.noindex` (which the sitemap and
+47
View File
@@ -375,6 +375,52 @@ export const config = { matcher: ['/((?!api|admin|_next|.*\\..*).*)'] }
Use `DEFAULT_PROXY_MATCHER` as a reference value, but if Next complains
about the matcher — paste it inline. This is a Next limitation, not a plugin one.
## 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*.
- **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:
```ts
import { en } from 'payload/i18n/en'
import { de } from 'payload/i18n/de'
export default buildConfig({ i18n: { supportedLanguages: { en, de } }, /* … */ })
```
- **Field and global texts** the plugin ships (labels, descriptions, options, tabs, groups)
are `{ en, pl }` objects (type `AdminText`). Change one through the override options —
`globalOverrides`, `collectionOverrides` — like any other field setting.
- **Component texts** (statistics view, test e-mail, integration alerts, cookie scan…) live in
`adminTexts` (`{ en: {…}, pl: {…} }`) and are read through Payload's translations under
the `ipal` namespace. Override any key per language; your value wins:
```ts
export default buildConfig({
i18n: { translations: { pl: { ipal: { statsHeading: 'Ruch na stronie' } } } },
})
```
A language the plugin has no texts for (e.g. `de`) gets the English ones until you
add yours.
- **Building blocks** for your own admin components: `ipalT(t, key, vars)` reads a plugin
text through Payload's `t`; `formatNumber(n, language)` and `formatDateTime(iso, language, timeZone?)`
format in the admin language; `defineTexts({ en, pl })` declares a text set whose Polish keys
must match the English ones; `ADMIN_LANGUAGES` lists the plugin's languages;
`applyAdminI18n(config)` is the config step itself (already applied by `ipalKit`).
- **Browser-tab title of a custom admin view:** Payload takes a view's `meta.title` as one
plain string and never translates it (its custom-view metadata ignores `i18n`), so the
server-rendered title stays in that one language. Render `<DocumentTitle title={…} />`
(`@intecion/ipal-kit/admin`) in the view with the translated title; after the page loads
the tab follows the admin language. `adminDocumentTitle(title, config.admin.meta.titleSuffix)`
builds the same "Title - Suffix" Payload would. The statistics view does this already:
its tab reads *Statystyki* in the Polish panel.
- **Wording rules** for every label you add: [dev/admin-ux.md](./dev/admin-ux.md).
- **Verify:** switch *Account → Language* to Polski — every plugin global, collection and
view reads in Polish; `pnpm test` runs `test/adminUx.test.ts` in the plugin.
## Turn off, override, extend
- `i18n` is required — the module cannot be turned off; one language = mode without the `/pl` prefix.
@@ -382,3 +428,4 @@ about the matcher — paste it inline. This is a Next limitation, not a plugin o
- Proxy: `createProxy` with options (`consentCategory`, `cookieName`, `exposeHeaders`, `markdown`, `policyVersion`) or your own proxy on `createLocaleMiddleware` + `negotiateLocale` / `matchAcceptLanguage`.
- Switcher: `LanguageSwitcher` (`classNames`, `renderLabel`) or your own on `useAlternateLinks()`.
- Paths: `buildLocalizedPath` / `switchLocalePath` with `homeSlug` and `prefix` — for your own link helpers.
- Admin languages: your own `i18n.supportedLanguages` wins over the plugin's en + pl default; component texts via `i18n.translations.<lang>.ipal.<key>`.
+15 -9
View File
@@ -1,4 +1,4 @@
# integrations — the Site Integrations global and integration status in the admin panel
# integrations — the Site integrations global and integration status in the admin panel
External service keys edited in the admin panel, plus a notice for the editor when one of them
stops working — no crons, no polling: the server records the status when it actually uses an integration.
@@ -6,7 +6,7 @@ stops working — no crons, no polling: the server records the status when it ac
Related: [email.md](./email.md) (SMTP/Graph), [turnstile.md](./turnstile.md),
[analytics.md](./analytics.md), [seo.md](./seo.md) (IndexNow), [deployment.md](./deployment.md).
## The `site-integrations` global (panel: Settings → Site Integrations)
## The `site-integrations` global (panel: Settings → Site integrations)
Currently always added by the plugin. Tabs (unnamed — flat data, e.g. `ga4MeasurementId`):
@@ -36,7 +36,7 @@ The "Send test" button (SMTP) calls `POST /api/ipal/test-email` (endpoint curren
- **Changing keys in the admin panel** (Turnstile, `emailTransport` / `smtp*`) clears that integration's old status.
- **`IntegrationAlerts`** (`@intecion/ipal-kit/admin`) — the plugin always wires it into
`admin.components.beforeDashboard`: a list of integrations in the `degraded` state + Turnstile key
problems + an "Open Site Integrations" link (from `adminRoute`). When everything works it renders nothing.
problems + an "Open Site integrations" link (from `adminRoute`). When everything works it renders nothing.
- **`IntegrationStatusBanner`** (`/admin`) — a banner on the tab: red on error (message,
code, since when), a green line after a fix, nothing before first use.
@@ -49,7 +49,9 @@ import { buildIntegrationStatusBanner, buildIntegrationStatusField, recordIntegr
ipalKit({
integrationsFields: [
buildIntegrationStatusBanner('crmStatus', 'CRM'), // UI field `crmStatusBanner`
// UI field `crmStatusBanner`; label as a string or { en, pl }; optional third argument
// { failing, hint } = keys of your own texts in i18n.translations.<lang>.ipal
buildIntegrationStatusBanner('crmStatus', { en: 'CRM', pl: 'CRM' }),
{ name: 'crmApiKey', type: 'text' },
buildIntegrationStatusField('crmStatus'), // hidden group: state, code, message, since, checkedAt
],
@@ -62,10 +64,14 @@ await recordIntegrationStatus(payload, 'crmStatus', previous, { state: 'ok' })
After adding the banner: `pnpm payload generate:importmap`; Postgres: `migrate:create`.
Types: `IntegrationState` (`'ok' | 'degraded'`), `IntegrationStatus`. The dashboard
`IntegrationAlerts` checks only `emailStatus` and `turnstileStatus` by default (prop `checks`) —
to show your own integration, wire a second `IntegrationAlerts` with `checks: { crmStatus: 'CRM' }`
into `beforeDashboard`.
Types: `IntegrationState` (`'ok' | 'degraded'`), `IntegrationStatus`, `IntegrationLabel`
(`string | { en, pl }`), `IntegrationBannerTexts` (`{ failing, hint }` — text keys). Without
texts the banner says "{label} is not working."; the plugin's own banners use
`statusEmailFailing` / `statusEmailHint` and `statusTurnstileFailing` / `statusTurnstileHint`
(override per language in `i18n.translations.<lang>.ipal`, see i18n.md "Admin panel languages and texts").
The dashboard `IntegrationAlerts` checks only `emailStatus` and `turnstileStatus` by default
(prop `checks`, labels as strings or `{ en, pl }`) — to show your own integration, wire a second
`IntegrationAlerts` with `checks: { crmStatus: 'CRM' }` into `beforeDashboard`.
## Turn off / override
@@ -73,5 +79,5 @@ into `beforeDashboard`.
are **currently always added** — there is no option to turn them off. Workaround: a project plugin
wired after `ipalKit()` that removes / replaces the entry in `config.globals`, `config.endpoints` or
`admin.components.beforeDashboard`.
- Extension: `integrationsFields` (Custom tab). The plugin's tabs, access and labels cannot
- Extension: `integrationsFields` (the *More* tab). The plugin's tabs, access and labels cannot
currently be overridden with an option.
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+215
View File
@@ -0,0 +1,215 @@
# Image lightbox
One shared viewer for images that appear small — a card, a gallery grid, a product thumbnail, an
image inside rich text. The visitor clicks the thumbnail and sees the large version; images in the
same group browse with arrows, keys and swipe. Optional: nothing renders and nothing is added to the
schema until you use it.
- `<LightboxProvider>` (`/client`) — one per layout; owns the viewer.
- `<LightboxTrigger>` (`/client`) — a `<button>` around any thumbnail (`next/image`, `<img>`, your
`<Media>`). Works without a provider too (brings its own viewer).
- `lightboxImage(media, options)` (main entry and `/client`) — a Payload media doc → the large image,
with a `srcSet` from every Payload image size.
- `RenderRichText lightbox` (`/rsc`) — click-to-enlarge for images in rich text.
- `useLightbox()` (`/client`) — open, close, next, previous for your own controls.
- `<LightboxDialog>` (`/client`) — the viewer itself, controlled, for full control.
## What the visitor gets
- A full-screen dialog over the page (portal to `<body>`): `role="dialog"`, `aria-modal`, a name from
the texts, the caption linked with `aria-describedby`.
- Focus moves to Close, Tab and Shift+Tab stay inside the dialog, focus returns to the trigger on close.
- Esc closes, ← / → browse, Home / End jump to the first / last image; a click outside the image closes.
- Swipe left / right on touch screens (40 px threshold; vertical scrolling and pinch-zoom still work).
- Visible controls (44 px targets, the browser's focus ring kept), a live "2 / 5" counter, an
optional caption.
- The page does not scroll behind the dialog (scrollbar gap compensated).
- No animation when the visitor asked for reduced motion — the OS setting or the plugin's
AccessibilityWidget (`data-a11y-motion="reduce"`).
- The neighbouring images preload, so the next arrow press is instant.
- The browser picks the right file from `srcSet` (a phone does not download the 4K original).
## Setup
### 1. One provider for the site
```tsx
// app/(frontend)/[locale]/layout.tsx — Server Component
import { getNotificationTexts } from '@intecion/ipal-kit'
import { SiteProviders } from '@intecion/ipal-kit/rsc'
const payload = await getCachedPayload()
const { lightbox } = await getNotificationTexts({ payload, locale })
<SiteProviders shell={shell} lightbox={{ texts: lightbox }}>…</SiteProviders>
```
Without `SiteProviders`, mount it yourself: `<LightboxProvider texts={lightbox}>` from `/client`.
The provider renders nothing until an image is opened.
### 2. Labels in every language (the plugin's i18n)
```ts
// payload.config.ts
ipalKit({ …, lightbox: true })
```
Adds the **Lightbox** group to **Settings → Notifications**: trigger name ("Enlarge image"), dialog
name ("Image viewer"), Previous, Next, Close and the counter (`{current} / {total}`) — localized per
language. `getNotificationTexts(...).lightbox` reads them; an empty field falls back to English
(`LIGHTBOX_FALLBACK`). On Postgres this adds columns: run `pnpm payload migrate:create` and commit the
migration (Coolify runs `migrate` on deploy). Fill the labels in every language, or seed them.
Without `lightbox: true` the components still work: they use the `texts` you pass and English for the
rest. The field group is exported (`lightboxNotificationFields`) if you prefer it in your own global.
### 3. Wrap thumbnails
```tsx
import { lightboxImage, LightboxTrigger } from '@intecion/ipal-kit/client'
import { MEDIA_SIZES, mediaImageProps } from '@intecion/ipal-kit'
import Image from 'next/image'
// a gallery block — every image in one group, browsed in page order
{images.map(({ id, image }) => {
const thumb = mediaImageProps(image, { sizes: MEDIA_SIZES.third })
const large = lightboxImage(image, { size: 'hero' })
if (!thumb || !large) return null
return (
<LightboxTrigger key={id} group={`gallery-${blockId}`} image={large} className="group block overflow-hidden rounded-lg">
<Image {...thumb} className="transition group-hover:scale-105" />
</LightboxTrigger>
)
})}
```
- `group` — triggers with the same group form one gallery, in page order (whatever order they
mounted in). One group per block (`gallery-${id}`) keeps two galleries apart. No group = that image
alone.
- `image` — plain data (`{ src, srcSet?, sizes?, width?, height?, alt, caption? }`), so a Server
Component can render the trigger. `lightboxImage` builds it from a Payload doc; any other source works.
- `children` — the thumbnail, rendered as you like. With `next/image` `fill`, give the trigger a size
(`className="relative aspect-[4/3]"`).
- The button's accessible name is `texts.open + ": " + alt` ("Enlarge image: Red sofa"); pass
`aria-label` to change it.
### 4. Rich text images (opt-in)
```tsx
<RenderRichText data={post.content} lightbox />
<RenderRichText data={post.content} lightbox={{ group: 'post', image: { size: 'hero' }, triggerClassName: 'my-8' }} />
```
Every image upload becomes a trigger; PDFs and videos are left alone. Your own `upload` converter
still renders the inline image — the plugin only wraps what it returns. Default group: `'richtext'`
(every rich text on the page is one gallery); `group: false` opens each image alone. A caption or alt
from the upload node's fields wins over the document's. For your own renderer:
`converters={withLightboxUploads(myConverters, options)}` (`/rsc`).
### 5. Your own controls
```tsx
'use client'
import { useLightbox } from '@intecion/ipal-kit/client'
const box = useLightbox()
<button onClick={(e) => box.open(images, 0, e.currentTarget)}>{labels.viewAll}</button>
// box.openGroup('gallery-1', 2) · box.next() · box.previous() · box.close() · box.isOpen · box.index
```
A product page with a stage image: the stage can be the trigger, and the thumbnail strip keeps
choosing the stage image — `box.open(productImages, activeIndex, e.currentTarget)`.
## Media sizes
`lightboxImage(media, { size?, sizes?, srcSet?, alt?, caption? })`:
| option | default | effect |
|---|---|---|
| `size` | original file | the Payload image size used as `src` (fallback when the browser ignores `srcSet`), e.g. `'hero'` |
| `srcSet` | `true` | every generated size + the original as `url 768w, …`; `false` = `src` only |
| `sizes` | `'100vw'` | `sizes` of the large image |
| `alt` | the doc's `alt` | override |
| `caption` | the doc's `caption` when it is a string | override; `false` = none |
Returns `null` for a video, PDF or unpopulated id — render the thumbnail without a trigger.
A collection without `imageSizes` still works: the original file is the large image. For a phone-
friendly viewer add at least one large size (e.g. `hero` 1920 wide) to the Media collection.
## Styling
Out of the box the viewer is styled inline from CSS variables — override them on `:root` or any parent:
| variable | default |
|---|---|
| `--ipal-lightbox-backdrop` | `rgb(0 0 0 / 0.9)` |
| `--ipal-lightbox-color` | `#fff` |
| `--ipal-lightbox-padding` | `4rem 1rem` |
| `--ipal-lightbox-z-index` | `1000` |
| `--ipal-lightbox-image-max-height` | `calc(100dvh - 9rem)` |
| `--ipal-lightbox-control-bg` | `rgb(255 255 255 / 0.14)` |
| `--ipal-lightbox-control-color` | `inherit` |
| `--ipal-lightbox-control-size` | `2.75rem` |
| `--ipal-lightbox-control-radius` | `999px` |
| `--ipal-lightbox-inset` | `1rem` |
| `--ipal-lightbox-caption-color` | `inherit` |
| `--ipal-lightbox-caption-size` | `0.95rem` |
| `--ipal-lightbox-duration` | `200ms` (fade; none with reduced motion) |
```css
:root { --ipal-lightbox-backdrop: rgb(15 23 42 / 0.95); --ipal-lightbox-control-bg: var(--color-brand); }
```
Full control: `unstyled` (on the provider — applies to triggers too — or on one trigger / dialog)
drops every inline style; style with `classNames` (`dialog`, `figure`, `image`, `caption`, `counter`,
`button`, `close`, `previous`, `next`) and the `data-ipal` hooks: `lightbox`, `lightbox-backdrop`,
`lightbox-figure`, `lightbox-caption`, `lightbox-counter`, `lightbox-previous`, `lightbox-next`,
`lightbox-close`, `lightbox-trigger` (+ `data-group`). Icons: `icons={{ close, previous, next }}`.
## Turn off, override, extend
| Feature | Default | Turn off / override |
|---|---|---|
| Whole feature | off — nothing renders without a trigger | don't use the components |
| Form messages → Image viewer labels | off | `ipalKit({ lightbox: true })`; `lightboxNotificationFields` for your own global; `globalOverrides.notifications` |
| Texts | panel → `lightboxFallback(locale)` (`LIGHTBOX_FALLBACK_PL` on `pl`, else `LIGHTBOX_FALLBACK`) | `texts` on the provider / trigger / dialog; `resolveLightboxTexts` |
| Provider in `SiteProviders` | off | `lightbox` prop; or your own `<LightboxProvider>` in a client component |
| Large image markup | `<img srcSet>` | `renderImage={({ image, imgProps, index }) => <Image … />}` (provider, client only) |
| The whole viewer | `LightboxDialog` | `renderDialog={(props) => <MyViewer {...props} />}` — same props, your markup |
| Wrap-around | on | `loop={false}` |
| Swipe threshold | 40 px | `swipeThreshold` on `LightboxDialog` |
| Rich text | off | `RenderRichText lightbox`; `withLightboxUploads(converters, options)` |
| Look | inline styles from `--ipal-lightbox-*` | CSS variables; `unstyled` + `classNames` + `data-ipal` |
Building blocks: `lightboxImage`, `lightboxIndex` (wrap / clamp), `formatLightboxCounter`,
`resolveLightboxTexts(texts, locale?)`, `LIGHTBOX_FALLBACK`, `LIGHTBOX_FALLBACK_PL`, `lightboxFallback`, `prefersReducedMotion`, `useOptionalLightbox` (null
outside a provider), `useLightbox`, `LightboxDialog`.
## Replacing a hand-made modal (migration)
Projects built before this feature open images in different ways: a `glightbox` wrapper, an inline
`div role="dialog"` with `next/image fill`, a link to the raw file in a new tab, or nothing. Move them
to the shared lightbox:
1. **Config:** `ipalKit({ lightbox: true })`, then `pnpm payload migrate:create` (Postgres) and commit
the migration. Fill **Forms → Form messages → Image viewer** in every language — copy the labels
from the old block fields (e.g. `closeLabel`, `prevLabel`, `nextLabel`) or seed them.
2. **Layout:** `<SiteProviders lightbox={{ texts: (await getNotificationTexts({ payload, locale })).lightbox }}>`.
3. **Gallery block:** replace the clickable `<div>` / custom `<button>` + `useState(index)` + dialog
with `<LightboxTrigger group={`gallery-${id}`} image={lightboxImage(image, { size: 'hero' })!}>`
around the existing thumbnail. Delete the dialog, its keydown listener, its scroll lock and its
`useState`. Keep the thumbnail markup and its hover effect (`ZoomIn` icon overlay can stay inside
the trigger as `aria-hidden`).
4. **glightbox:** remove the wrapper, the dynamic `import('glightbox')`, its CSS and the
`glightbox` dependency (`pnpm remove glightbox`).
5. **"Open in a new tab" links** (certificates, diplomas): swap `<a href={image.url} target="_blank">`
for a `LightboxTrigger` — the visitor stays on the page.
6. **Block label fields** for close / previous / next that only served the old modal: stop reading
them; remove them in a later release with a migration (skill **ipal-migrate-fields**) once the
panel texts are filled.
7. **Check:** keyboard only — Tab to a thumbnail, Enter opens, focus is on Close, ← / → browse, Tab
stays in the dialog, Esc closes and focus is back on the thumbnail; the page does not scroll behind
the dialog; on a phone, swipe browses; DevTools → Network shows a resized file, not the original,
on a narrow screen.
Source: `src/modules/lightbox/`, `src/modules/richtext/withLightboxUploads.tsx`. Tests:
`test/lightbox.test.ts`.
+3 -3
View File
@@ -64,7 +64,7 @@ A downloadable file is a `file` type link — **not** a separate `pdfUrl` field.
Page, category, product — one field: `buildLinkField({ relationTo: ['pages', 'categories', 'products'] })`
(a polymorphic relation; one collection = as before). A collection entry with `content` resolves to
`/{locale}/{archive-page}/{entry}` — `resolveLink` / `resolveNav` / `getLinkOptions` from `lib/content`
take the archives from Site Settings themselves (`archives: { categories: 'kategorie' }`). Without lib/content:
take the archives from Site settings themselves (`archives: { categories: 'kategorie' }`). Without lib/content:
`resolveLinkHref(link, { config, locale, archives, pagesSlug })`. An entry with no assigned archive → `null`
(the link does not render). The entry path is built by `buildEntryPath`, which **always**
adds `/{locale}` — on a single-language site a link to an entry gets a needless `/pl/…` prefix
@@ -124,7 +124,7 @@ export async function CMSLink({ link, locale, className, children }: { link: Cms
```
**Do not write your own version** (`resolveHref`, `getHref`, `` `/${slug}` ``, `slug === 'home'`): it loses the language
prefix, the home page from Site Settings, the `javascript:` filter and dead links. `ipal-audit` reports it as an
prefix, the home page from Site settings, the `javascript:` filter and dead links. `ipal-audit` reports it as an
ERROR. A field in a different shape (e.g. `page` + `url`) is mapped onto the plugin's shape instead of computing the href:
`resolveLink(url?.trim() ? { type: 'external', url } : { type: 'internal', page }, locale)`.
@@ -142,7 +142,7 @@ const legal = await getSystemLinks(locale) // from lib/con
await getSystemLinks(locale, ['privacyPolicy', 'termsOfService']) // selected roles
// without lib/content: resolveSystemLinks(settings, { locale, config: i18nConfig, homeSlug, roles })
```
Pages are assigned in Site Settings → System Pages; **the label is the page title** in the given language, so there
Pages are assigned in Site settings → System pages; **the label is the page title** in the given language, so there
is no text in code (a hard-coded "Polityka prywatności" breaks the EN version). An unassigned role → skipped.
## Menu — `resolveNav`
+3 -3
View File
@@ -20,7 +20,7 @@ no `next/server` import.
| Tool | Arguments | Returns |
|-----------|-----------|--------|
| `get_site_info` | `locale?` | site name and description (Site Settings), languages, home page and sitemap URLs |
| `get_site_info` | `locale?` | site name and description (Site settings), languages, home page and sitemap URLs |
| `list_pages` | `locale?`, `limit?` (default 50, max 200) | published pages **and archive-collection entries** (e.g. blog): title, URL, description (a table of contents). The source is the same index as llms.txt (`collectSiteIndex`), which reads at most 1000 documents per collection |
| `search_content` | `query` (required), `locale?`, `limit?` (default 10, max 50) | list of pages (only the `collection` collection): title, URL, description (or `summaryField`) |
| `get_page` | `path` (e.g. `/pl/o-nas`; without a language prefix → default language) | the page as clean Markdown |
@@ -31,7 +31,7 @@ can browse it like a regular visitor. Mandatory in every project (AGENT.md §0b)
All tools are **read-only** and return only **published** content (drafts and `meta.noindex`
filtered out — the same rule as sitemap/llms). Under-construction mode: with `isPathVisible`
(passed automatically by `createContentHelpers` — the `mcpGET`/`mcpPOST` route), pages hidden
by Site Settings → Under construction drop out of `list_pages` and `search_content`, and
by Site settings → Maintenance drop out of `list_pages` and `search_content`, and
`get_page` answers "No page found". The full `createMcpRoute` variant without `isPathVisible`
does not know about construction mode and serves all published content.
@@ -75,7 +75,7 @@ runs `initialize` → `tools/list` → and can then call `get_site_info`,
| `config` | — (required) | `I18nConfig` |
| `baseUrl` | — | origin for URLs in results (without it URLs are relative and there is no sitemap link) |
| `collection` | `'pages'` | pages collection |
| `settingsSlug` | `'site-settings'` | Site Settings global slug |
| `settingsSlug` | `'site-settings'` | Site settings global slug |
| `content` | — | archive collections (`list_pages`, `get_page` for entries) |
| `summaryField` | — | field with a richer AI description (`buildSummaryField`), preferred in results |
| `isPathVisible` | — (from `createContentHelpers`: set) | `(path, locale) => boolean` — hides pages hidden by under-construction mode |
+4
View File
@@ -148,5 +148,9 @@ props or `null` (video, PDF, a bare id, no `width`/`height`):
- `'background'`: `autoPlay` (off with `reducedMotion: true`), `muted`, `loop`, `preload="metadata"`;
- always `playsInline`; `poster` — a URL or a Media document.
**Enlarging an image** (card, gallery, product thumbnail): wrap the `<Media>` in `<LightboxTrigger
image={lightboxImage(resource, { size: 'hero' })}>` — `lightboxImage` builds the large image with a
`srcSet` from every Payload size. Do not build your own modal: [lightbox.md](./lightbox.md).
**`MEDIA_SIZES`** — starting points for `sizes`: `full` (`100vw`), `half`, `third`, `quarter`,
`thumb` (`160px`). You can replace any value with your own string.
+12 -5
View File
@@ -17,10 +17,17 @@ No options — the **Notifications** global (slug `notifications`, panel group *
the texts in the panel (Notifications tab), grouped per context. Group `form`:
`success`, `error`, `rateLimited`, `turnstile`, `validation`, `consent`,
`notFound` and the multi-step form buttons: `next` ("Next"), `back` ("Back"),
`stepOf` ("Step {current} of {total}"). Every empty field → fallback (`NOTIFICATION_FALLBACK`, EN,
exported from `@intecion/ipal-kit`).
`stepOf` ("Step {current} of {total}"). Every empty field → the built-in default in the page language
(`notificationFallback(locale)`: `NOTIFICATION_FALLBACK_PL` for `pl`, else `NOTIFICATION_FALLBACK` — EN;
all exported from `@intecion/ipal-kit`). In `validation`, `{field}` is the field's label in the page language.
For forms: `getFormTexts(locale)` from `lib/content` = the `form` group in the given language.
Group `lightbox` (only with `ipalKit({ lightbox: true })` — adds columns, run a migration on Postgres):
`open` ("Enlarge image"), `dialog` ("Image viewer"), `previous`, `next`, `close`, `counter`
("{current} / {total}"). `getNotificationTexts(...).lightbox` always returns the full set (fallback
`LIGHTBOX_FALLBACK`), and `getSiteShell(locale).lightboxTexts` carries it to `<SiteProviders lightbox>`.
Details: [lightbox.md](./lightbox.md).
## Helper — getNotificationTexts
Reads the texts from the global per language, with a fallback per field. The counterpart of `getConsentTexts`:
@@ -29,7 +36,7 @@ Reads the texts from the global per language, with a fallback per field. The cou
import { getNotificationTexts } from '@intecion/ipal-kit'
const notifications = await getNotificationTexts({ payload, locale }) // in lib/content: getFormTexts(locale) = .form
// notifications.form.error, notifications.form.success, ...
// notifications.form.error, notifications.form.success, ..., notifications.lightbox.close
```
## Mapping the result — resolveFormMessage
@@ -74,8 +81,8 @@ users), so the frontend reads them without a session. Write: `editor+` (`adminOr
## Turn off, override, extend
- **Turn off:** none — the `notifications` global is currently always added (also without the `forms` option).
- **Override texts:** in the panel, per language; empty field → `NOTIFICATION_FALLBACK` (EN).
- **Turn off:** none — the `notifications` global is currently always added (also without the `forms` option). The `lightbox` group is opt-in (`ipalKit({ lightbox: true })`); `lightboxNotificationFields` puts it in your own global instead.
- **Override texts:** in the panel, per language; empty field → `notificationFallback(locale)` (Polish on `pl` pages, English otherwise).
The fallbacks cannot be swapped with a plugin option — apply your own default texts in the project
on the result of `getNotificationTexts` (e.g. `texts.form.error ||= '…'`).
- **Override access / hooks / admin:** `ipalKit({ globalOverrides: { notifications: … } })` — an object merges
+6 -6
View File
@@ -20,11 +20,11 @@ ipalKit({
| `slug` | — (required) | slug of the client's Pages collection |
| `roles` | all (`ALL_SYSTEM_PAGE_ROLES`) | which roles to show as fields |
Adds a **System Pages** tab in SiteSettings with relationship fields (field name = role:
Adds a **System pages** tab in SiteSettings with relationship fields (field name = role:
`homepage`, `notFound`, `privacyPolicy`, `cookiePolicy`, `termsOfService`) to your
Pages collection. The editor picks which document plays which role. The plugin does not
know your collection — you give the slug in the option. The `pages` option also turns on the
**Under construction** tab ([construction.md](./construction.md)) and is required by `content`.
**Maintenance** tab ([construction.md](./construction.md)) and is required by `content`.
## Front end — resolving a role's path
@@ -66,7 +66,7 @@ import { ALL_SYSTEM_PAGE_ROLES } from '@intecion/ipal-kit'
## 404 page — chosen in the admin panel (since 1.7.12)
Site Settings → System Pages → **404 (Not Found)**. The editor picks:
Site settings → System pages → **404 (Not Found)**. The editor picks:
- a dedicated "Not found" page (e.g. slug `strona-nie-znaleziona`), **or**
- the home page (some clients prefer that), **or**
@@ -126,7 +126,7 @@ The `redirect` option (from `next/navigation`) turns on under-construction mode
**Missing page → home page** (1.11.1): `onMissing: 'redirectHome'` (needs `redirect`) — a URL with no page
and no old slug (e.g. a retired `/pl/uslugi`) redirects (307) to the home page in the same language
(System Pages → Homepage). No home page assigned, or the home page itself missing → a plain 404.
(System pages → Homepage). No home page assigned, or the home page itself missing → a plain 404.
Default `'notFound'`; your own decision: `onMissing: ({ locale, segments }) => redirect(…)`.
```tsx
@@ -151,7 +151,7 @@ import { getConfiguredLocales, getNotFoundPage } from '@/lib/content'
/**
* 404 view. The editor picks which page plays the 404 role in
* Site Settings → System Pages → "404 (Not Found)" — a dedicated page or the
* Site settings → System pages → "404 (Not Found)" — a dedicated page or the
* homepage — or leaves it empty → the fallback below.
*
* not-found.tsx receives no params, and reading headers() here would turn the
@@ -297,7 +297,7 @@ else skip it — otherwise you lose SSG and SEO.
## Turn off, override, extend
- Turn off: omit the `pages` option — the System Pages and Under construction tabs disappear (and `content` stops working).
- Turn off: omit the `pages` option — the System pages and Maintenance tabs disappear (and `content` stops working).
- `roles` limits the set of role fields; field labels and descriptions are currently fixed (in English).
- You cannot add your own roles with the `pages` option — add extra SiteSettings fields with `siteSettingsFields` (the "Custom" tab, payload-helpers.md), but then call the helpers (`getSystemPagePath`, `getSystemLinks`) by hand: `getSystemPagePath({ page: settings.myRole, … })`, `getSystemLinks(locale, ['myRole'])`.
- 404: `createNotFoundPage` (`load` / `blocks` / `fallback` / `blockProps`) or a fully custom `not-found.tsx` (above).
+2 -2
View File
@@ -17,8 +17,8 @@ The `site-settings` (`SITE_SETTINGS_SLUG`), `site-integrations` (`SITE_INTEGRATI
SiteSettings tabs (unnamed — flat data): **General** (`siteName`, `siteDescription`,
`titleOrder`, `titleSeparator`, `logo`, `defaultShareImage`, `sameAs`, `favicon`, …),
**Theme** (`defaultTheme`, `allowThemeToggle`, `themeToggleLabel`), **System Pages**
(from `pages` / `content`), **Emails** (from `forms.emailLayout`), **Under construction**
**Theme** (`defaultTheme`, `allowThemeToggle`, `themeToggleLabel`), **System pages**
(from `pages` / `content`), **E-mails** (from `forms.emailLayout`), **Maintenance**
(from `pages`), **Custom** (from `siteSettingsFields`).
**Access:** SiteSettings has `read: () => true` — **the whole global, including fields from
+13
View File
@@ -89,6 +89,18 @@ const items = block.tableOfContents?.show ? extractHeadings(block.content) : []
- `buildTableOfContentsField({ name = 'tableOfContents' })` — a "Show table of contents" switch + a localized label (type `TableOfContentsSettings`).
A new field in a block = a migration (`pnpm payload migrate:create`).
## Click-to-enlarge images (lightbox, opt-in)
```tsx
<RenderRichText data={post.content} lightbox />
<RenderRichText data={post.content} lightbox={{ group: 'post', image: { size: 'hero' }, triggerClassName: 'my-8' }} />
```
Each image upload is wrapped in `<LightboxTrigger>` (`/client`); the images of the page browse as one
gallery (default group `'richtext'`, `group: false` = each alone). Your own `upload` converter still
renders the inline image. Your own renderer: `converters={withLightboxUploads(myConverters, options)}`
(`/rsc`). Details, labels and styling: [lightbox.md](./lightbox.md).
## lexicalToMarkdown — richText → Markdown (for AI)
For readability by AI agents (Markdown per page, llms-full) you need
@@ -127,6 +139,7 @@ project already has (it is the editor). No extra dependencies.
- The module has no option in `ipalKit()` — it adds nothing to the schema; you use the components and functions or you don't.
- Override the look of nodes through `converters` (spread `defaultConverters`); heading ids through `headingIds` (`levels`, `className`).
- Image lightbox: off by default; `lightbox` turns it on, `withLightboxUploads` is the building block (lightbox.md).
- Link filtering: on by default; `safeLinks={false}` turns it off for fully trusted content.
- `extractHeadings(data, { levels })` and `headingText(node)` — building blocks for your own table of contents; style `<TableOfContents>` with `classNames`, the active-section threshold with `offset`.
- `lexicalToMarkdown` has no options (the handled nodes are fixed; unknown ones degrade to text) — another format needs your own converter.
+232 -110
View File
@@ -2,15 +2,16 @@
Generic HTTP security headers (HSTS, X-Frame-Options, nosniff,
Referrer-Policy, Permissions-Policy, Cross-Origin-Opener-Policy; `X-Robots-Tag` on staging)
as a function for `next.config`. CSP is DELIBERATELY
left out — it depends on the project's domains, so it stays in the project.
as a function for `next.config`, `withSecurityConfig` to hide `X-Powered-By`, and an opt-in
Content-Security-Policy (`buildCsp`, report-only first, a separate admin policy, optional nonces and a
report collector).
## Rule
Headers that are IDENTICAL across projects are provided once by the plugin. CSP
(Content-Security-Policy) needs to know the domains of a specific project (where
scripts, images, fonts and analytics load from), so it cannot be generic —
it stays in the project and is added through `additional`.
Headers that are IDENTICAL across projects are provided once by the plugin and are on by default. CSP
(Content-Security-Policy) needs to know the domains of a specific project (where scripts, images, fonts
and analytics load from), so it is OFF until the project turns on the `buildCsp` flags for what it
loads — through `buildSecurityHeaders({ csp })`, or its own policy through `additional`.
## Usage — next.config.ts
@@ -21,23 +22,28 @@ application (including `/admin` and static files), and the proxy skips those rou
// next.config.ts
import { withPayload } from '@payloadcms/next/withPayload'
import type { NextConfig } from 'next'
import { buildSecurityHeaders } from '@intecion/ipal-kit'
import { buildAdminCspHeaders, buildSecurityHeaders, buildUploadSecurityHeaders, withSecurityConfig } from '@intecion/ipal-kit'
const prod = process.env.NODE_ENV === 'production'
const csp = { mode: 'report-only', reportUri: '/api/csp-report' } as const // later: mode 'enforce'
const securityHeaders = buildSecurityHeaders({
hsts: process.env.NODE_ENV === 'production', // IMPORTANT: off in dev (http)
additional: [
// the project's CSP — it knows its own domains:
// { key: 'Content-Security-Policy', value: "default-src 'self'; ..." },
],
hsts: prod, // IMPORTANT: off in dev (http)
csp: { ...csp, r2Url: process.env.R2_PUBLIC_URL, analytics: true, turnstile: true },
})
const nextConfig: NextConfig = {
async headers() {
return [{ source: '/:path*', headers: securityHeaders }]
return [
{ source: '/:path*', headers: securityHeaders },
{ source: '/admin/:path*', headers: buildAdminCspHeaders({ ...csp, r2Url: process.env.R2_PUBLIC_URL }) },
...buildUploadSecurityHeaders(),
]
},
}
export default withPayload(nextConfig)
// withSecurityConfig: no X-Powered-By (Next's and Payload's)
export default withPayload(withSecurityConfig(nextConfig))
```
## Options
@@ -52,7 +58,8 @@ export default withPayload(nextConfig)
| `referrerPolicy` | `'strict-origin-when-cross-origin'` | Referrer-Policy; `null` = no header |
| `permissionsPolicy` | blocks camera/mic/geolocation | Permissions-Policy; your own string, or `null` = no header |
| `coop` | `'same-origin'` | Cross-Origin-Opener-Policy; `'same-origin-allow-popups'`, or `false` = no header |
| `additional` | `[]` | extra headers (e.g. CSP); the same key overrides |
| `csp` | `false` | `buildCsp` args → the CSP header (+ `Reporting-Endpoints` with `reportUri`) |
| `additional` | `[]` | extra headers; the same key overrides (also the `csp` ones) |
With `IPAL_NOINDEX=1` (staging), `X-Robots-Tag: noindex, nofollow` is added to every response.
@@ -65,133 +72,204 @@ domain. Wire it alongside: `[{ source: '/:path*', headers: securityHeaders }, ..
HSTS over HTTP on localhost can lock the browser into HTTPS for localhost.
ALWAYS turn it off in dev: `hsts: process.env.NODE_ENV === 'production'`.
## Overriding and CSP
## X-Powered-By — hide it (`withSecurityConfig`)
`additional` with the same key OVERRIDES the default (e.g. change X-Frame-Options
to SAMEORIGIN). A new key (like CSP) is added. CSP always goes through `additional` —
the plugin does not generate it, because it depends on the project.
A response header `X-Powered-By: Next.js, Payload` tells scanners which software (and which known
advisories) to try. Audits flag it. Where it comes from:
### Why CSP stays in the project (not the plugin)
- **Next.js** sends `X-Powered-By: Next.js` unless the config says `poweredByHeader: false`.
- **Payload's `withPayload`** switches Next's header off and adds its own `X-Powered-By: Next.js, Payload`
for `/:path*` through `headers()` — also unless the config it wraps says `poweredByHeader: false`.
Payload's REST/GraphQL handlers add nothing of their own.
`withSecurityConfig(nextConfig, { hidePoweredBy = true })` sets `poweredByHeader: false` AND drops any
`X-Powered-By` entry from `headers()` rules, so both orders work:
`withPayload(withSecurityConfig(nextConfig))` (recommended) or `withSecurityConfig(withPayload(nextConfig))`.
Turn off: `withSecurityConfig(nextConfig, { hidePoweredBy: false })`, or do not call it. Without the helper,
`poweredByHeader: false` in the config passed to `withPayload` has the same effect.
Check: `curl -sI https://<DOMAIN>/pl | grep -i x-powered-by` prints nothing. Behind Coolify the proxy
(Traefik or Caddy) adds no `X-Powered-By`; if the header comes back in production, look for a
"Custom labels" header middleware in the Coolify app, or a Cloudflare Transform Rule.
Keep the software updated as well — hiding the header does not remove the advisories (the minimum safe
Next.js is listed in the agent guide, §4).
## Content-Security-Policy
### Why CSP is opt-in
HSTS, nosniff and Referrer-Policy are IDENTICAL for every project → the plugin
generates them. CSP lists the SPECIFIC domains the project loads from (its R2,
analytics, Turnstile, fonts). A generic CSP would be either too loose (`*` =
useless) or would break the site. So the plugin provides the mechanism (`additional`),
and the project supplies a CSP that fits it.
useless) or would break the site. So the plugin provides the hardened skeleton and one flag per
integration it ships (`buildCsp`), and the project turns on what it uses.
### buildCsp — CSP generator (recommended over writing it by hand)
Instead of writing a raw CSP in every project (risk of forgetting base-uri,
object-src), use `buildCsp` — it has hard OWASP/Lighthouse rules built in, and you
turn on only the flags for what the project loads:
```ts
// next.config.ts
import { buildCsp, buildSecurityHeaders } from '@intecion/ipal-kit'
import { buildCsp } from '@intecion/ipal-kit'
const csp = buildCsp({
mode: 'report-only', // start here; 'enforce' once the console is clean
r2Url: process.env.R2_PUBLIC_URL, // R2 media → img-src
turnstile: true, // challenges.cloudflare.com → script/frame/connect
analytics: true, // GTM + GA
youtube: true, // youtube → frame-src
mode: 'report-only', // start here; 'enforce' once the reports are clean
reportUri: '/api/csp-report', // where browsers send violations (createCspReportRoute)
r2Url: process.env.R2_PUBLIC_URL, // R2 media → img-src, media-src
turnstile: true, // Cloudflare Turnstile
analytics: true, // GA4 / GTM
metaPixel: true, linkedIn: true, tiktok: true, clarity: true, // the pixels the plugin loads
youtube: true, // YouTubeEmbed
googleMaps: true, // Google Maps
// extra: { 'script-src': ['https://other-script.example'] }, // extra sources
})
const securityHeaders = buildSecurityHeaders({
hsts: process.env.NODE_ENV === 'production',
additional: [csp],
// extra: { 'script-src': ['https://other-script.example'] }, // add sources to any directive
// override: { 'frame-ancestors': ["'self'"], 'style-src': null }, // replace / drop a directive
})
// → { key: 'Content-Security-Policy-Report-Only', value: "default-src 'self'; …" }
```
**Hard rules built in** (always on, impossible to forget): `base-uri 'self'`,
`object-src 'none'`, `frame-ancestors 'none'`. These are the ones Lighthouse/OWASP
require and that are easy to miss when writing CSP by hand.
`buildCspHeaders(args)` returns `[csp, Reporting-Endpoints]` (the second only with `reportUri`);
`buildSecurityHeaders({ csp: args })` does the same inside the site-wide list.
Base sources: `default-src 'self'`, `form-action 'self'`, `script-src 'self' 'unsafe-inline'`
(Next / analytics), `style-src 'self' 'unsafe-inline' https://fonts.googleapis.com`. `r2Url` goes into
`img-src` only as an absolute address (`https://…`); `youtube` also adds `i.ytimg.com` (the
`YouTubeEmbed` poster); `googleMaps` adds `*.googleapis.com`, `*.gstatic.com`, `*.google.com`, `*.ggpht.com`,
`*.googleusercontent.com` (iframe and Maps JS).
**Hard rules built in** (always on unless you `override` them): `base-uri 'self'`,
`object-src 'none'`, `frame-ancestors 'none'`, `form-action 'self'`.
`buildCsp` does NOT add `'unsafe-eval'` (it weakens CSP) — add it through `extra` only
if a library requires it. `mode` defaults to `'enforce'` (`Content-Security-Policy`);
`'report-only'` gives `…-Report-Only` — start with it when rolling out.
**What each flag allows** — the plugin's own components need exactly these:
CSP is still "in the project" (you pick the flags for what you load), but the skeleton
comes from the plugin — every project has the same hardened foundation.
| Flag | Plugin part | Sources |
|---|---|---|
| (always) | Next, Tailwind, next/font, `ThemeScript`, `JsonLdGraph`, consent banner, lightbox, `MediaPreconnect` | `'self'`, `'unsafe-inline'` (script, style), `data:`/`blob:` images, Google Fonts |
| `r2Url` | media on R2 | the URL → `img-src`, `media-src` (a site-relative `/media` is already `'self'`) |
| `analytics` | `Analytics` GA4 / GTM | `script-src *.googletagmanager.com`; `connect-src`/`img-src` `*.google-analytics.com`, `*.analytics.google.com`, `*.googletagmanager.com`, `*.g.doubleclick.net`, `www.google.com` |
| `metaPixel` | `loadMetaPixel`, fbevents via `ConsentScript` | `connect.facebook.net` (script, connect), `www.facebook.com` (connect, img, frame) |
| `linkedIn` | `loadLinkedIn` | `snap.licdn.com` (script); `px.ads.linkedin.com`, `px4.ads.linkedin.com`, `www.linkedin.com` (connect, img) |
| `tiktok` | `loadTikTok` | `analytics.tiktok.com` (script, connect, img) |
| `clarity` | `loadClarity` | `*.clarity.ms` (script, connect, img), `c.bing.com` (img) |
| `turnstile` | `Turnstile` | `challenges.cloudflare.com` (script, frame, connect) |
| `youtube` | `YouTubeEmbed` | `www.youtube.com`, `www.youtube-nocookie.com` (frame), `i.ytimg.com` (img) |
| `googleMaps` | Maps iframe / Maps JS | `*.googleapis.com`, `*.gstatic.com`, `*.google.com`, `*.ggpht.com`, `*.googleusercontent.com`, `blob:` workers |
| `dev` | `next dev` | `'unsafe-eval'` (React dev tooling). Default `process.env.NODE_ENV === 'development'` |
### Building CSP by hand (if you need full control)
Plausible or another script through `ConsentScript` → add its host with `extra`. GTM tags you add in
the GTM panel (Hotjar, Ads…) load their own hosts → add them with `extra` as the reports show them.
Read the media domain from `R2_PUBLIC_URL` (env), do not hard-code it. Match the other
sources to what the project actually loads:
**Why `'unsafe-inline'` stays without a nonce.** Next streams the page's RSC payload in inline
`<script>` tags (`self.__next_f.push(…)`) that differ per page and per render — a static header cannot
list their hashes, and static/ISR HTML cannot carry a per-request nonce. So a header-only CSP keeps
`'unsafe-inline'` in `script-src`; it still blocks every script from a host you did not list, `<object>`,
`<base>` hijacking, framing and form posts to other sites. `style-src 'unsafe-inline'` stays in every mode:
React, Next and the plugin set inline `style` attributes, which a nonce cannot cover. `buildCsp` never adds
`'unsafe-eval'` in production.
### Nonces (stricter; dynamic pages only)
Next adds a per-request nonce to its own scripts when the request carries a CSP header with
`'nonce-…'` (enforcing or report-only). `createProxy(i18nConfig, { NextResponse, csp: { … } })` does it:
a fresh nonce per request, the policy on the request (for Next) and the response, and the nonce as the
`x-nonce` request header. The policy then gets `'nonce-…' 'strict-dynamic'`: scripts the nonced Next
bootstrap loads (the plugin's analytics, pixels, Turnstile) are trusted, and CSP3 browsers ignore the
host list and `'unsafe-inline'` (both stay as a fallback for old browsers). `strictDynamic: false`
keeps host-based checks.
```ts
// next.config.ts
const r2Url = process.env.R2_PUBLIC_URL || ''
const csp = [
"default-src 'self'",
// scripts: self + Turnstile (Cloudflare) + analytics (GTM/GA if you use them)
"script-src 'self' 'unsafe-inline' https://challenges.cloudflare.com https://*.googletagmanager.com",
// styles: self + inline (Tailwind) + Google Fonts
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
// images: self + R2 media (from env!) + data:
`img-src 'self' data: https://*.google-analytics.com https://*.googletagmanager.com ${r2Url}`.trim(),
"font-src 'self' https://fonts.gstatic.com data:",
// GA4: wildcards are required — EU traffic goes to region1.google-analytics.com
"connect-src 'self' https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com",
// frames: Turnstile (captcha widget)
"frame-src https://challenges.cloudflare.com",
"form-action 'self'",
"frame-ancestors 'none'", // replaces X-Frame-Options in modern browsers
].join('; ')
const securityHeaders = buildSecurityHeaders({
hsts: process.env.NODE_ENV === 'production',
additional: [{ key: 'Content-Security-Policy', value: csp }],
// proxy.ts
export const proxy = createProxy(i18nConfig, {
NextResponse, markdown: true,
csp: { mode: 'report-only', reportUri: '/api/csp-report', analytics: true, r2Url: process.env.R2_PUBLIC_URL },
})
// app/(frontend)/[locale]/layout.tsx
import { headers } from 'next/headers'
const nonce = (await headers()).get('x-nonce') // CSP_NONCE_HEADER
<SiteProviders shell={shell} theme nonce={nonce}>… // ThemeScript + GA4/GTM tag get the nonce
```
Match the sources to the project: Google Maps (`https://maps.googleapis.com`,
`https://*.google.com`), other embeds, other analytics. Anything you do not list
will be blocked.
Costs and rules:
- Reading `headers()` makes every page under the proxy matcher **dynamic** — no ISR, no static HTML, a
render per request. That is why nonces are opt-in; ISR sites keep the header-only policy.
- The proxy matcher skips `/api`, `/admin`, `/_next` and files — those keep the `next.config` headers. Do
NOT also send the site CSP from `next.config` for the frontend paths (two policies = both apply); keep
only the admin rule and `buildUploadSecurityHeaders` there.
- Your own proxy: `createCspNonce()` + `buildCsp({ nonce })`, set the policy on the request headers
(`NextResponse.next({ request: { headers } })`) and on the response, like `createProxy` does.
- `ConsentScript nonce`, `ThemeScript nonce`, `Analytics nonce` exist for policies without `'strict-dynamic'`.
### Payload admin — its own, looser policy
The admin (`/admin`, or your `adminRoute`) is a large client app the project does not control: inline
scripts and styles, the Monaco code editor loaded from `cdn.jsdelivr.net` with `blob:` workers, image
previews from any `https:` host, and the Live Preview iframe (`frame-src 'self'`). `buildAdminCsp(args)` /
`buildAdminCspHeaders(args)` give that policy with the same hard rules, `frame-ancestors 'self'`, and the
same `mode`, `reportUri`, `extra`, `override`. Put its rule AFTER the site-wide one — Next uses the
last matching rule for the same header key:
```ts
{ source: '/:path*', headers: securityHeaders },
{ source: '/admin/:path*', headers: buildAdminCspHeaders({ mode: 'report-only', reportUri: '/api/csp-report' }) },
```
With a custom `adminRoute` (e.g. `/its`), use that path in `source`.
### Collecting reports
`createCspReportRoute({ onReport?, maxBytes = 16384 })` — a `POST` handler for `reportUri`. It accepts
both formats (`application/csp-report` from `report-uri`, `application/reports+json` from `report-to`),
caps the body, always answers `204`, and by default logs one `console.warn` line per violation:
`[csp] report script-src-elem blocked=https://x.example/a.js page=https://site/pl`. Read them in the
Coolify app's **Logs**. Plug `onReport` into `payload.logger`, Sentry or a database for more.
```ts
// app/api/csp-report/route.ts (a fixed route wins over Payload's /api/[...slug])
import { createCspReportRoute } from '@intecion/ipal-kit'
export const POST = createCspReportRoute()
```
Third-party option: point `reportUri` at a collector (report-uri.com, Sentry's security endpoint,
uriports) and skip the route. `parseCspReports(body)` normalises both formats for your own handler.
### ROLL OUT CSP CAREFULLY — Report-Only first
A CSP that is too strict **breaks the site** (blocks scripts/styles/images). NEVER deploy
an enforcing CSP blindly. The safe method:
1. **Reporting first** — use the key `Content-Security-Policy-Report-Only`
(not `Content-Security-Policy`). The browser REPORTS violations in the console
but does NOT block — the site works as usual.
```ts
additional: [{ key: 'Content-Security-Policy-Report-Only', value: csp }]
```
2. **Open the site** → DevTools → Console → look for "Content Security Policy"
violations. Each violation = a missing domain. Add it to the matching CSP
directive.
3. **Go through the whole site** — home page, forms (Turnstile!),
gallery (R2 images), pages with maps/embeds. Collect every violation.
4. **Only when the console is clean** → change the key to `Content-Security-Policy`
(enforcing). Now CSP protects without breaking anything.
1. **Report-only** — `mode: 'report-only'` with `reportUri`. The browser REPORTS violations (console +
the report route) but does NOT block — the site works as usual. Deploy it.
2. **Read the reports** — DevTools → Console ("Content Security Policy" / "[Report Only]") on every page
type, and the `[csp]` lines in the Coolify logs (real visitors, other browsers). Go through the whole
site — home page, forms (Turnstile!), gallery (R2 images), embeds, cookie banner accept (analytics and
pixels load only after consent), the admin. Give it a few days of real traffic.
3. **Fix each violation** — a missing host of yours → the matching flag or `extra`; noise from browser
extensions (`chrome-extension://`, `moz-extension://`) → ignore.
4. **Enforce** — when the reports are clean, change `mode: 'report-only'` to `mode: 'enforce'` (site and
admin). Keep `reportUri`: enforced violations keep being reported. Check the pages once more.
### Building CSP by hand (if you need full control)
Pass your own string through `additional` (same key overrides `csp`):
```ts
const securityHeaders = buildSecurityHeaders({
hsts: process.env.NODE_ENV === 'production',
additional: [{ key: 'Content-Security-Policy-Report-Only', value: "default-src 'self'; base-uri 'self'; object-src 'none'; …" }],
})
```
Read the media domain from `R2_PUBLIC_URL` (env), do not hard-code it. Anything you do not list will be
blocked once enforced.
### Checking headers in production
```bash
# check which headers actually go out:
curl -sI https://<DOMAIN>/pl | grep -i "strict-transport\|content-type-options\|referrer\|content-security\|x-frame"
curl -sI https://<DOMAIN>/pl | grep -iE "strict-transport|content-type-options|referrer|content-security|reporting-endpoints|x-frame|x-powered-by"
```
If HSTS/nosniff/Referrer are there but CSP is missing → add CSP (above). If ALL of them
are missing despite buildSecurityHeaders in the config → check that `headers()` is
wired and that Cloudflare (if it sits in front of the app) does not filter headers.
Expected: HSTS, nosniff, Referrer, `content-security-policy-report-only` (or `content-security-policy`
after enforcing), and NO `x-powered-by`. If ALL of them are missing despite buildSecurityHeaders in the
config → check that `headers()` is wired and that Cloudflare (if it sits in front of the app) does not
filter headers.
> Cloudflare note: if CF sits in front of the app, it may override/filter
> Cloudflare / Coolify note: if CF sits in front of the app, it may override/filter
> headers. Then set them in CF as well (Transform Rules → Modify Response Header),
> or make sure CF passes the origin's headers through.
> or make sure CF passes the origin's headers through. Coolify's proxy passes the app's headers
> through unchanged; a header middleware added in the app's "Custom labels" can add or drop them.
## COOP (Cross-Origin-Opener-Policy) — on by default
@@ -312,6 +390,37 @@ gets the injected plugin.
The plugin sets `forceSetup: true` — every user MUST set up TOTP after
logging in. There is no per-user "on/off" option.
### Import map (required)
The 2FA screens and the redirect to them are admin components. After adding `twoFactor`, and after every
ipal-kit upgrade, run:
```bash
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.
### 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`
request header. Nothing sets that header on `/admin` (the `createProxy` matcher skips `/admin`), so up to
1.14.1 a user without TOTP was sent to `/admin/setup-totp?back=null`, and the setup screen redirected
to itself forever. Since 1.14.2, ipal-kit swaps in its own provider,
`TotpRedirectProvider`: it reads the path in the browser, never redirects away from the setup or verify
screen or from logout, and renders nothing while a redirect is pending, so the panel does not flash.
No project change is needed apart from `generate:importmap`.
- `twoFactor.provider: '@/components/MyTotp#MyTotp'` (or a `{ path, clientProps, serverProps }` object):
your own component. It gets clientProps `forceSetup` and the package's serverProps `pluginOptions`.
The pure logic is exported: `totpRedirectTarget({ adminRoute, forceSetup, pathname, user })` returns
the URL to send the user to, or `null`.
- `twoFactor.provider: false`: keep the package's provider. Then a proxy must set `x-pathname` on every
`/admin` request, or the loop comes back.
The provider only steers the UI. Data access is still checked by the package's access wrapper.
### Turning it off (DISCOURAGED)
```ts
@@ -323,10 +432,14 @@ twoFactor: false // ONLY when the project really cannot use 2FA (rare)
### How it works for the user
1. Logs in (email + password)
2. On first login: redirected to TOTP Setup (QR + secret)
2. On first login: redirected to TOTP Setup (`/admin/setup-totp?back=%2Fadmin`, QR + secret)
3. Scans the QR with an app (Google Authenticator, Authy, 1Password, Microsoft Authenticator)
4. Enters the code → 2FA is active
5. Next logins: email + password + TOTP code
4. Enters the code → 2FA is active, back to the page from `back`
5. Next logins: email + password + TOTP code (`/admin/verify-totp?back=…`)
**Check:** log in as a new admin. The address must end at `/admin/setup-totp?back=%2Fadmin` and the page must
show the QR code. `back=null` or a page that keeps reloading means the import map is stale (run
`pnpm generate:importmap`) or `provider: false` without an `x-pathname` header on `/admin`.
### Resetting 2FA (admin)
@@ -363,17 +476,26 @@ data access, not just the UI.
an auth collection or differs from `admin.user` — deliberate exception: `twoFactor.allowCollectionMismatch: true`.
- Injected auth collection with roles: `unlock` is admin-only too. You can override all of it:
`access.authAccess`, `access.firstUserAdmin: false`, `globalOverrides`, `forms.formOverrides`.
- Site Settings, Cookie Settings, Notifications and the Forms collection: write is `editor+` only; a form's
- Site settings, Cookie banner, Notifications and the Forms collection: write is `editor+` only; a form's
Emails tab (recipients, BCC) is readable only by `editor+`.
- Full table: [access.md](./access.md#what-the-plugin-locks-down-by-itself).
## Turn off, override, extend
- **Turn off:** headers — do not call `buildSecurityHeaders`, or `null` / `false` per header (`frameOptions`,
`referrerPolicy`, `permissionsPolicy`, `coop`), `hsts: false`; 2FA — `twoFactor: false` (discouraged).
- **Override:** `additional` (the same key overrides the plugin's header), `buildCsp({ extra })`, `mode`;
2FA — `collectionSlug`, `allowCollectionMismatch`, your own TOTP options by wrapping `plugin`;
`referrerPolicy`, `permissionsPolicy`, `coop`), `hsts: false`; CSP — leave out `csp` (the default);
X-Powered-By hiding — `withSecurityConfig(config, { hidePoweredBy: false })` or do not call it;
2FA — `twoFactor: false` (discouraged).
- **Override:** `additional` (the same key overrides the plugin's header and the `csp` ones),
`buildCsp({ extra, override, mode, strictDynamic })`, `buildAdminCsp({ extra, override })`,
`createCspReportRoute({ onReport, maxBytes })`;
2FA — `collectionSlug`, `allowCollectionMismatch`, your own TOTP options by wrapping `plugin`,
`provider` (your own redirect component, or `false` for the package's);
access — `access.authAccess`, `access.firstUserAdmin`, `globalOverrides` ([access.md](./access.md)).
- **Extend:** `buildCsp`, `buildUploadSecurityHeaders({ collections })` for your own upload collections.
- **Check:** `curl -sI https://domain/ | grep -iE "strict-transport|x-frame|referrer|permissions|cross-origin|content-security"`;
- **Extend:** `totpRedirectTarget` / `totpAdminPath` (2FA redirect rules) for your own provider;
`buildCsp` / `buildCspHeaders` / `buildReportingEndpoints` / `cspHeaderKey` /
`parseCspReports` / `createCspNonce` (`CSP_NONCE_HEADER`, `DEFAULT_CSP_REPORT_GROUP`) for your own proxy
or collector; `buildUploadSecurityHeaders({ collections })` for your own upload collections.
- **Check:** `curl -sI https://domain/pl | grep -iE "strict-transport|x-frame|referrer|permissions|cross-origin|content-security|x-powered-by"`
(no `x-powered-by`; `content-security-policy-report-only` while rolling out);
on staging also `x-robots-tag`; startup with a wrong `twoFactor.collectionSlug` fails with `[ipal] twoFactor…`.
+31 -24
View File
@@ -48,7 +48,7 @@ production): `payload.update({ …, context: { [SKIP_AUTO_FILL]: true } })` —
that save (1.12.2).
Under the description field in the SEO tab there is a hint (`MetaDescriptionCheck`, `/admin`):
the description is empty, the same as `siteDescription` from Site Settings, or the same as in
the description is empty, the same as `siteDescription` from Site settings, or the same as in
another document of the collection. It only informs — it does not block saving. Length is shown
by the plugin-seo counter.
@@ -58,14 +58,14 @@ are other fields there already (slug, roles), leaving an empty SEO tab.
## Titles — configured from the panel
No code, per site (Site Settings → General):
No code, per site (Site settings → General):
- **Title Order** — `Page first` (O nas | Acme) or `Site first` (Acme | O nas)
- **Title Separator** — `|` `–` `-` `·` `/`
Per page (SEO tab):
- **Title Override** — the typed text goes to the browser tab verbatim, ignoring both
- **Exact page title** — the typed text goes to the browser tab verbatim, ignoring both
settings above. Use it for the home page, where composition would give "Acme | Acme".
Default: `Title | Site name`.
@@ -117,7 +117,7 @@ injected cached loaders — everything below applies to it too.
## createPageMetadata (low level)
When you do not use `createContentHelpers` or the route has its own conventions. It knows
the plugin conventions (pages collection, SiteSettings, System Pages, meta group):
the plugin conventions (pages collection, SiteSettings, System pages, meta group):
```ts
// app/(frontend)/[locale]/[[...slug]]/page.tsx
@@ -144,7 +144,7 @@ resolveRoute }` option lets you pass your own cached functions (that is what `ge
Handles: title (order/separator/override from the panel), description, canonical,
hreflang for all locales, OG, home collapsed to `/pl` (home slug read from
System Pages).
System pages).
Without `NEXT_PUBLIC_SERVER_URL`, canonical and hreflang are relative (`/pl` instead of
`https://…/pl`).
@@ -309,7 +309,7 @@ What the sitemap contains:
- blog posts with the archive prefix (`/pl/artykuly/moj-post`)
Skips: drafts (`_status !== 'published'`) and documents with `meta.noindex`. When
**Site Settings → Under construction** is on — everything except the pages that
**Site settings → Maintenance** is on — everything except the pages that
stay open (home page + "Pages still available"), because the rest redirects to the
notice and a crawler would index that instead of the content. `llms.txt` does the same.
@@ -418,9 +418,16 @@ favicon field. SVG → scales; PNG → should be ≥48×48 (validation warns, se
### Enforcing the size (validation)
The favicon field in SiteSettings has the `validateFaviconField` validation — it warns
the editor on save if the favicon is <48×48 or not square. The editor
sees a warning instead of silently uploading a favicon Google will not show.
The favicon field in SiteSettings shows a hint right under it (`FaviconCheck`, `/admin`)
as soon as the editor picks an image under 48×48 px or one that is not square — in the
admin language, without blocking the save. The same check (`faviconProblems`) runs on
save in `validateFaviconField` and goes to the server log.
- **Wire:** nothing beyond `pnpm payload generate:importmap` (the plugin adds the component).
- **Your own favicon field:** `admin.components.afterInput: [{ path: '@intecion/ipal-kit/admin#FaviconCheck', clientProps: { fieldPath: 'icon', mediaSlug: 'media' } }]`.
- **Turn off:** a `globalOverrides['site-settings']` function that drops `afterInput` from the field.
- **Texts:** `i18n.translations.<lang>.ipal.faviconTooSmall` / `faviconNotSquare` (`{{width}}`, `{{height}}`).
- **Verify:** Site settings → Site icon → choose a 32×32 PNG → the warning appears; save still works.
### Organization JSON-LD (branding)
@@ -854,7 +861,7 @@ phrases), pages with parameters, search results. The plugin supports this throug
- internal search results
The editor ticks `noindex` in the panel (the page's SEO field), the plugin generates the tag.
Alternatively: add `noindex` to System Pages with legal roles automatically.
Alternatively: add `noindex` to System pages with legal roles automatically.
### buildNoindexField — a friendly checkbox in the sidebar
@@ -1088,8 +1095,8 @@ Requires a filled siteDescription and sensible page meta.description values
meta description.
Since 1.13:
- under the description goes the editor's note from **Site Settings → Search & AI → About the site for
AI assistants** (facts to quote, per language) — see the "Search & AI" section below;
- under the description goes the editor's note from **Site settings → Search engines → About the site for
AI assistants** (facts to quote, per language) — see the "Search engines" section below;
- the list is no longer cut at 1000 documents (read in batches; `collectSiteIndex({ limit })`
still trims it if you want);
- `llmsRoute` / `llmsFullRoute` from `createContentHelpers` show only the open pages when "Under construction"
@@ -1190,8 +1197,8 @@ buildRobots({
### AI bots from the panel — getRobots (1.13)
The editor sets the policy and exceptions in **Site Settings → Search & AI → AI crawlers**.
For robots.txt to read them, replace `robots` with `getRobots` (async, reads Site Settings
The editor sets the policy and exceptions in **Site settings → Search engines → AI assistants**.
For robots.txt to read them, replace `robots` with `getRobots` (async, reads Site settings
per request):
```ts
@@ -1248,9 +1255,9 @@ Two sitemaps under different paths confuse crawlers. Pick one:
Both are equally good for Google — it is about readability for humans, not SEO.
## Search & AI — Search Console verification, AI bots, llms.txt note (1.13)
## Search engines — Search Console verification, AI bots, llms.txt note (1.13)
The **Site Settings → Search & AI** tab (on by default; empty fields change
The **Site settings → Search engines** tab (on by default; empty fields change
nothing; `ipalKit({ searchSettings: false })` removes it — also without `seo` (`seo: { searchSettings }` still works; the top-level option wins); the function
`searchSettings: (fields) => fields` gets the plugin's fields and returns your own — add, remove,
relabel; the helpers read the names `searchVerification` / `aiCrawlers` / `llmsIntro`):
@@ -1397,15 +1404,15 @@ It complements Markdown/llms: the assistant extracts the page's key content more
- **`buildLocalBusinessJsonLd({ type: 'Dentist', openingHours: company.hours, … })`** — `type` is any
schema.org type; hours as the editor's text (PL/EN/DE: "Pn-Pt: 8-17, Sob: 9-13, Nd nieczynne") →
`formatOpeningHours` → `['Mo-Fr 08:00-17:00', 'Sa 09:00-13:00']`. Unreadable text is skipped.
- **Site Settings → sameAs** (company profiles) → `sameAsUrls(settings)` for Organization/LocalBusiness.
- **Site Settings → Default share image** works as the OG image of pages without their own (it used to be ignored).
- **Site settings → sameAs** (company profiles) → `sameAsUrls(settings)` for Organization/LocalBusiness.
- **Site settings → Default share image** works as the OG image of pages without their own (it used to be ignored).
Metadata has an X/Twitter card, image dimensions and alt, and entries get `og:type=article` with dates.
- **Sitemap with images** (`<image:image>`): by default the page's SEO image; your own source:
`createContentHelpers({ sitemapImages: (doc) => [...] })`.
- **IndexNow:** `ipalKit({ indexNow: true })` + the route `src/app/indexnow-key.txt/route.ts`
(`createIndexNowKeyRoute`). After a page/entry is published, its addresses in all languages go to Bing &
co. (ChatGPT Search and Copilot use Bing's index). Production with public https only.
Key: Site Integrations → IndexNow (generated on save) or `INDEXNOW_KEY`. Google does not
Key: Site integrations → IndexNow (generated on save) or `INDEXNOW_KEY`. Google does not
support IndexNow — for Google, use the sitemap.
Key route from `lib/content`: `export { indexNowKeyRoute as GET } from '@/lib/content'`.
By hand (e.g. content imported by a script): `submitToIndexNow({ payload, urls })` (key: `getIndexNowKey(payload)`)
@@ -1425,17 +1432,17 @@ It complements Markdown/llms: the assistant extracts the page's key content more
## Turn off, override, extend
- **Turn off the module:** leave out `seo` in `ipalKit()` — no SEO tab and no auto-fill. The Site Settings →
Search & AI tab stays (remove it with the top-level `searchSettings: false`). The front helpers (`buildMetadata`, `buildRobots`, the JSON-LD builders) are plain functions and work without it.
- **Turn off the module:** leave out `seo` in `ipalKit()` — no SEO tab and no auto-fill. The Site settings →
Search engines tab stays (remove it with the top-level `searchSettings: false`). The front helpers (`buildMetadata`, `buildRobots`, the JSON-LD builders) are plain functions and work without it.
- **Auto-fill:** `autoFill: false` turns it off; `autoFill: { title, description, content, descriptionLength }`
remaps the source fields. Skip it for one save with `context: { [SKIP_AUTO_FILL]: true }`.
- **Description hint:** `descriptionCheck: false` removes it; `descriptionCheck: { settingsSlug, siteDescriptionField }`
points it at another global/field.
- **Titles and descriptions:** `generateTitle` / `generateDescription` replace plugin-seo's generators;
`fields` adds your own fields to the SEO group. Per page, **Title Override** beats the composed title.
- **Search & AI tab:** `ipalKit({ searchSettings: false })` removes it (with or without `seo`); `searchSettings: (fields) => fields` adds, removes or
`fields` adds your own fields to the SEO group. Per page, **Exact page title** beats the composed title.
- **Search engines tab:** `ipalKit({ searchSettings: false })` removes it (with or without `seo`); `searchSettings: (fields) => fields` adds, removes or
relabels fields (keep `searchVerification` / `aiCrawlers` / `llmsIntro`, or read your own fields in your routes).
- **The Site Settings global itself** (where the SEO fields live): `ipalKit({ globalOverrides: { 'site-settings': … } })`
- **The Site settings global itself** (where the SEO fields live): `ipalKit({ globalOverrides: { 'site-settings': … } })`
— an object is merged over the plugin's global (`access`, `admin` and `hooks` key by key: your access rules win,
your hooks run after the plugin's; other keys such as `fields` replace the plugin's); a function
`(global) => global` gives full control (drop a plugin hook, append fields). The same works for
+5 -3
View File
@@ -52,7 +52,9 @@ Adds:
blocked — written only by the endpoint with `overrideAccess`),
- `POST /api/ipal/hit`,
- the **`<adminRoute>/stats`** view (default `/admin/stats`; it uses `ipalKit({ adminRoute })`, not
`routes.admin` set by hand in the config) + a nav link (`StatsNavLink`),
`routes.admin` set by hand in the config) + a nav link *Statistics overview* (`StatsNavLink`, hidden for users who cannot read `stats-visits`),
its browser tab reads *Statistics* / *Statystyki* in the admin language (set after load through
`DocumentTitle`, because Payload's view `meta.title` is one fixed string — i18n.md),
- a 30-day chart on the dashboard (`StatsWidget`),
- `STATS_SLUG` (`'stats-visits'`) from `@intecion/ipal-kit` — for your own queries.
@@ -84,7 +86,7 @@ fallback `fetch` with `keepalive`). It renders nothing. Props (`PageStatsProps`)
Body: `{ p: path, r?: referrer, l?: locale, v?: visitorId }`. Always answers `204` (also on an
error, a rejection and when the limit of 60 requests/min per IP is exceeded — scope `stats`). `v` is
stored only when the request's consent cookie has `analytics: true` under the current *Policy version*
(version read from Cookie Settings, cached 1 min). Path: must start with `/`, max 300 characters;
(version read from Cookie banner, cached 1 min). Path: must start with `/`, max 300 characters;
visit: max 200 page views. `locale` is stored when it matches `xx` / `xx-XX`.
`VISITOR_COOKIE` (`'ipal_vid'`) from `/client` — the cookie name, e.g. for your own cookie table.
@@ -123,7 +125,7 @@ changes when `day` changes in the `timeZone` zone.
## For the privacy policy and the cookie table
Add a row in **Cookie Settings → Cookies** (panel):
Add a row in **Cookies → Cookie list** (panel):
| Name | Provider | Category | Purpose | Duration |
|---|---|---|---|---|
+5 -5
View File
@@ -1,7 +1,7 @@
# Light / dark theme (1.11.1)
Theme logic from the plugin, the look in the project. The plugin provides: a pre-paint script (no flash
of the light theme), an unstyled switcher, the `useTheme` hook, fields in Site Settings → Theme, and a Turnstile
of the light theme), an unstyled switcher, the `useTheme` hook, fields in Site settings → Theme, and a Turnstile
widget theme that matches the page.
## How it works
@@ -10,11 +10,11 @@ widget theme that matches the page.
- `<ThemeScript>` (an inline script, the first child of `<body>`) sets `data-theme="light|dark"` and
`color-scheme` on `<html>` before the first paint.
- Order: the visitor's choice from `localStorage` (key `ipal-theme`, only when "Allow theme toggle" is on)
→ Site Settings → Default theme → with `System`, the device setting (`prefers-color-scheme`).
→ Site settings → Default theme → with `System`, the device setting (`prefers-color-scheme`).
- `localStorage`, not a cookie: it is an interface preference, it does not track and needs no consent.
- A change in one tab carries over to the others (the `storage` event).
## Site Settings → Theme
## Site settings → Theme
| Field | Meaning |
|---|---|
@@ -87,11 +87,11 @@ redraws the widget (the token must be obtained again). A fixed theme: `turnstile
## Turn off, override, extend
- **Turn off:** without `SiteProviders theme` / `<ThemeScript>` no theme is set (base CSS);
`allowThemeToggle` off = the visitor's choice is ignored. The *Theme* tab in Site Settings is
`allowThemeToggle` off = the visitor's choice is ignored. The *Theme* tab in Site settings is
currently always added.
- **Override:** `ThemeScript` takes `allowToggle` / `defaultTheme` directly (it does not have to read from the admin panel);
`ThemeSwitcher` — `classNames`, `label`, `renderIcon`; `applyTheme(..., { persist, transitionMs })`.
- **Extend:** your own switcher on `useTheme()`; `themeScript()` as script text for your own
tag; `themeConfigFrom(settings)` to read the settings.
Your own fields in Site Settings (e.g. extra tokens) — `ipalKit({ siteSettingsFields })`, they go to the
Your own fields in Site settings (e.g. extra tokens) — `ipalKit({ siteSettingsFields })`, they go to the
*Custom* tab.
+5 -5
View File
@@ -7,7 +7,7 @@ reads the secret server-side.
## Config
No options — the `turnstileSiteKey` / `turnstileSecretKey` fields are in
SiteIntegrations (Turnstile tab). The editor enters the keys in the panel (env fallback:
SiteIntegrations (Spam protection tab). The editor enters the keys in the panel (env fallback:
`NEXT_PUBLIC_TURNSTILE_SITE_KEY` / `TURNSTILE_SECRET_KEY`).
**On = both keys set.** Then the widget shows, and `submitForm`
@@ -95,9 +95,9 @@ and for `degraded` (a problem on our side, see below) — depending on
> always → `reason: 'turnstile'`.
On `degraded` the panel shows the problem:
- **Dashboard** — a red "Integration problem…" alert with a link to Site Integrations
- **Dashboard** — a red "Integration problem…" alert with a link to Site integrations
(`admin.components.beforeDashboard`, wired by the plugin automatically),
- **Site Integrations → Turnstile** — a banner with the cause, code and time.
- **Site integrations → Turnstile** — a banner with the cause, code and time.
The server saves the status when it verifies a form (no cron), at most once per 10 min
while the error lasts, and at once when the state changes. Saving new keys in the panel
@@ -222,11 +222,11 @@ full control or have an unusual case. The provider is a convenience layer over i
## Turn off, override, extend
- **Turn off:** leave both keys empty (panel and env) → no widget, `submitForm` skips the check.
The Turnstile fields in Site Integrations are currently always added.
The Turnstile fields in Site integrations are currently always added.
- **Fail closed:** `turnstileOnConfigError: 'reject'` in `submitForm` / `createSubmitAction`
(or `onConfigError: 'reject'` in `verifyTurnstile`).
- **Keys:** the panel wins; empty field → env `NEXT_PUBLIC_TURNSTILE_SITE_KEY` / `TURNSTILE_SECRET_KEY`.
- **Access to the keys:** Site Integrations is admin-only (read and update); change it with
- **Access to the keys:** Site integrations is admin-only (read and update); change it with
`ipalKit({ globalOverrides: { 'site-integrations': { access: … } } })` — keep `read` restricted, the secret lives there.
- **Look:** `theme` on `<Turnstile>` / `<TurnstileWidget theme>`, `turnstileTheme` in `RenderForm` / `BuilderForm`.
- **Your own integration:** `checkTurnstile` (full `pass` / `reject` / `degraded` classification),
+18 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@intecion/ipal-kit",
"version": "1.13.0",
"version": "1.14.4",
"description": "Intecion Payload Advanced Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.",
"license": "MIT",
"repository": {
@@ -70,6 +70,7 @@
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
"build:types": "tsc --outDir dist --rootDir ./src",
"clean": "rimraf {dist,*.tsbuildinfo}",
"cookie-db:refresh": "node scripts/refresh-cookie-database.mjs",
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
"dev": "next dev dev --turbo",
"dev:generate-importmap": "pnpm dev:payload generate:importmap",
@@ -89,7 +90,7 @@
},
"dependencies": {
"lucide-react": "^0.400.0",
"nodemailer": "^8.0.1",
"nodemailer": "^10.2.1",
"server-only": "^0.0.1",
"slugify": "^1.6.6"
},
@@ -119,15 +120,14 @@
"@swc-node/register": "1.10.9",
"@swc/cli": "0.6.0",
"@types/node": "22.20.5",
"@types/nodemailer": "^8.0.1",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"copyfiles": "2.4.1",
"cross-env": "^7.0.3",
"eslint": "^9.23.0",
"eslint-config-next": "16.4.0",
"eslint-config-next": "16.4.3",
"graphql": "^16.8.1",
"next": "16.4.0",
"next": "16.4.3",
"open": "^10.1.0",
"payload": "3.90.2",
"prettier": "^3.4.2",
@@ -135,14 +135,14 @@
"react": "19.3.0",
"react-dom": "19.3.0",
"rimraf": "3.0.2",
"sharp": "0.34.5",
"sharp": "0.35.5",
"sort-package-json": "^2.10.0",
"typescript": "5.9.3",
"vite-tsconfig-paths": "6.0.5",
"vitest": "5.0.4"
},
"engines": {
"node": "^18.20.2 || >=20.9.0",
"node": ">=20.9.0",
"pnpm": "^9 || ^10 || ^11"
},
"publishConfig": {
@@ -153,7 +153,17 @@
"sharp",
"esbuild",
"unrs-resolver"
]
],
"overrides": {
"baseline-browser-mapping@<2.11.0": "^2.11.0",
"browserslist@<4.28.7": "^4.28.7",
"dompurify@<3.4.17": "^3.4.17",
"fast-copy@<3.1.0": "^3.1.0",
"fast-uri@<3.1.9": "^3.1.9",
"js-yaml@>=4 <4.3.2": "^4.3.2",
"source-map-js@<1.2.2": "^1.2.2",
"undici@>=7 <7.30.1": "^7.30.1"
}
},
"peerDependenciesMeta": {
"@clocklimited/payload-2fa": {
+151 -493
View File
File diff suppressed because it is too large Load Diff
+125
View File
@@ -0,0 +1,125 @@
#!/usr/bin/env node
// Refreshes the bundled copy of the Open Cookie Database (Apache-2.0,
// https://github.com/jkwakman/Open-Cookie-Database) that the cookie scanner
// looks unknown cookie names up in. Nothing is fetched at runtime — run this,
// review the diff, commit.
//
// pnpm cookie-db:refresh # latest commit on master
// pnpm cookie-db:refresh --ref <sha>
//
// Writes:
// src/modules/consent/scanner/data/openCookieDatabase.ts (rows, source commit, date)
// docs/licenses/open-cookie-database-LICENSE.txt (the upstream license, verbatim)
import { mkdirSync, writeFileSync } from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const REPO = 'jkwakman/Open-Cookie-Database'
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
const args = process.argv.slice(2)
const refArg = args.indexOf('--ref') >= 0 ? args[args.indexOf('--ref') + 1] : undefined
async function get(url) {
const res = await fetch(url, { headers: { 'User-Agent': 'ipal-kit cookie-db refresh' } })
if (!res.ok) {throw new Error(`${url}: HTTP ${res.status}`)}
return res
}
const ref = refArg ?? (await (await get(`https://api.github.com/repos/${REPO}/commits/master`)).json()).sha
const raw = (file) => `https://raw.githubusercontent.com/${REPO}/${ref}/${file}`
const csv = await (await get(raw('open-cookie-database.csv'))).text()
const license = await (await get(raw('LICENSE'))).text()
if (!/Apache License\s+Version 2\.0/.test(license)) {
console.error('The upstream license is no longer Apache-2.0 — check it before bundling. Nothing written.')
process.exit(1)
}
/** RFC 4180 CSV: quoted fields, "" escapes, newlines inside quotes. */
function parseCsv(text) {
const rows = []
let row = []
let field = ''
let quoted = false
for (let i = 0; i < text.length; i++) {
const ch = text[i]
if (quoted) {
if (ch === '"' && text[i + 1] === '"') {field += '"'; i++}
else if (ch === '"') {quoted = false}
else {field += ch}
} else if (ch === '"') {quoted = true}
else if (ch === ',') {row.push(field); field = ''}
else if (ch === '\n' || ch === '\r') {
if (ch === '\r' && text[i + 1] === '\n') {i++}
row.push(field); field = ''
if (row.some((f) => f !== '')) {rows.push(row)}
row = []
} else {field += ch}
}
if (field || row.length) {row.push(field); rows.push(row)}
return rows
}
const [header, ...body] = parseCsv(csv)
const col = (name) => {
const i = header.findIndex((h) => h.trim().toLowerCase() === name.toLowerCase())
if (i < 0) {throw new Error(`Column "${name}" missing — the upstream CSV changed, update this script.`)}
return i
}
const C = {
category: col('Category'),
controller: col('Data Controller'),
description: col('Description'),
domain: col('Domain'),
name: col('Cookie / Data Key name'),
platform: col('Platform'),
retention: col('Retention period'),
wildcard: col('Wildcard match'),
}
const clean = (s) => (s ?? '').replace(/\s+/g, ' ').trim()
const rows = body
.map((r) => [
clean(r[C.name]),
clean(r[C.platform]),
clean(r[C.category]),
clean(r[C.domain]),
clean(r[C.description]),
clean(r[C.retention]),
clean(r[C.controller]),
clean(r[C.wildcard]) === '1' ? 1 : 0,
])
.filter((r) => r[0])
const today = new Date().toISOString().slice(0, 10)
const out = `/* eslint-disable */
// GENERATED by scripts/refresh-cookie-database.mjs — do not edit by hand.
//
// Open Cookie Database, https://github.com/${REPO}
// Commit ${ref}, fetched ${today}.
// Licensed under the Apache License, Version 2.0 — full text in
// docs/licenses/open-cookie-database-LICENSE.txt (shipped with the package).
//
// Changes made by ipal-kit: converted from open-cookie-database.csv to this
// module; the columns "ID" and "User Privacy & GDPR Rights Portals" were left
// out and whitespace was collapsed. The data is otherwise unchanged.
/** [name, platform, category, domain, description, retention, data controller, wildcard (1 = name is a prefix)] */
export type OpenCookieRow = readonly [string, string, string, string, string, string, string, 0 | 1]
export const OPEN_COOKIE_DATABASE_SOURCE = {
commit: '${ref}',
fetchedAt: '${today}',
license: 'Apache-2.0',
url: 'https://github.com/${REPO}',
} as const
export const OPEN_COOKIE_DATABASE: readonly OpenCookieRow[] = [
${rows.map((r) => ` ${JSON.stringify(r)},`).join('\n')}
]
`
const dataFile = path.join(root, 'src/modules/consent/scanner/data/openCookieDatabase.ts')
mkdirSync(path.dirname(dataFile), { recursive: true })
writeFileSync(dataFile, out)
const licenseFile = path.join(root, 'docs/licenses/open-cookie-database-LICENSE.txt')
mkdirSync(path.dirname(licenseFile), { recursive: true })
writeFileSync(licenseFile, license)
console.log(`Open Cookie Database @ ${ref.slice(0, 7)}: ${rows.length} rows → ${path.relative(root, dataFile)}`)
+3
View File
@@ -0,0 +1,3 @@
node_modules
npm-debug.log
*.md
+17
View File
@@ -0,0 +1,17 @@
# ipal cookie crawler — one shared service for all sites (docs/cookie-scanner.md → Coolify).
# The Playwright image ships Chromium and its system libraries; the npm package
# version must match the image tag.
FROM mcr.microsoft.com/playwright:v1.64.0-noble
WORKDIR /app
ENV NODE_ENV=production
COPY package.json package-lock.json ./
RUN npm ci --omit=dev --no-audit --no-fund
COPY lib.mjs crawl.mjs server.mjs cli.mjs ./
# The image's non-root user; Chromium runs sandboxed as this user.
USER pwuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \
CMD node -e "fetch('http://127.0.0.1:'+(process.env.PORT||3000)+'/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
CMD ["node", "server.mjs"]
+11
View File
@@ -0,0 +1,11 @@
# ipal cookie crawler
The browser half of ipal-kit's cookie scanner: one shared service that crawls a site twice (no
consent / after "Accept all") and posts cookies, storage keys and third-party hosts back to the
site. Sites never run a browser.
Setup, Coolify deploy, env and network notes: `docs/cookie-scanner.md` → "Browser crawl" in the
ipal-kit repository (also shipped in `node_modules/@intecion/ipal-kit/docs/`).
- `node server.mjs` — the service (`IPAL_CRAWLER_SITES="acme.pl=TOKEN"`).
- `node cli.mjs https://acme.pl --pages 10` — the same crawl from a laptop or CI, JSON on stdout.
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env node
// Same crawl as the service, from a laptop or CI — prints the result as JSON.
// node cli.mjs <siteUrl> [--pages 20] [--accept '[data-ipal="accept"]'] [--wait 3000]
// Exit code: 0 = nothing stored before consent but the consent cookie, 1 = something else was, 2 = setup problem.
// The verdict per cookie needs the site's categories: the panel's "Crawl site" does that.
import { crawlSite } from './crawl.mjs'
const args = process.argv.slice(2)
const opt = (name, def) => (args.includes(`--${name}`) ? args[args.indexOf(`--${name}`) + 1] : def)
if (!args[0] || args[0].startsWith('--')) {
console.error('Usage: node cli.mjs <siteUrl> [--pages N] [--accept selector] [--wait ms]')
process.exit(2)
}
let chromium
try {
;({ chromium } = await import('playwright'))
} catch {
console.error('Playwright not found: npm install (in services/cookie-crawler) && npx playwright install chromium')
process.exit(2)
}
const result = await crawlSite({
acceptSelector: opt('accept', '[data-ipal="accept"]'),
chromium,
maxPages: Number(opt('pages', 20)),
siteUrl: args[0],
waitMs: Number(opt('wait', 3000)),
})
console.log(JSON.stringify(result, null, 2))
const early = result.observations.filter((o) => o.before && o.name !== 'cookie-consent')
if (early.length) {console.error(`Stored before consent: ${early.map((o) => o.name).join(', ')} — classify them in the panel.`)}
process.exit(early.length ? 1 : 0)
+76
View File
@@ -0,0 +1,76 @@
// The crawl itself: two fresh browser profiles over the same pages — one with
// no consent decision, one after clicking "Accept all". Records cookies,
// localStorage / sessionStorage keys and third-party request hosts per page.
import { bareHost, discoverPages, isFirstParty, mergeRuns } from './lib.mjs'
async function run(browser, pages, { accept, acceptSelector, pageTimeoutMs, siteHost, waitMs }) {
const context = await browser.newContext()
const result = { accepted: false, cookies: [], requests: [], storage: [] }
let current = '/'
const seen = new Set()
const once = (key) => (seen.has(key) ? false : (seen.add(key), true))
context.on('request', (request) => {
let host
try {
host = new URL(request.url()).hostname.toLowerCase()
} catch {
return
}
if (!host || isFirstParty(host, siteHost) || !once(`r:${host}:${current}`)) {return}
result.requests.push({ host, page: current })
})
try {
const page = await context.newPage()
await page.setExtraHTTPHeaders({ 'X-Ipal-Cookie-Crawler': '1' })
for (const [i, url] of pages.entries()) {
current = new URL(url).pathname
await page.goto(url, { timeout: pageTimeoutMs, waitUntil: 'load' }).catch(() => {})
if (accept && i === 0) {
const button = page.locator(acceptSelector).first()
if (await button.count().catch(() => 0)) {
await button.click({ timeout: 5_000 }).then(() => (result.accepted = true)).catch(() => {})
}
}
await page.waitForTimeout(waitMs)
const keys = await page
.evaluate(() => ({ localStorage: Object.keys(localStorage), sessionStorage: Object.keys(sessionStorage) }))
.catch(() => ({ localStorage: [], sessionStorage: [] }))
for (const [storage, names] of Object.entries(keys)) {
for (const name of names) {if (once(`s:${storage}:${name}:${current}`)) {result.storage.push({ name, page: current, storage })}}
}
for (const c of await context.cookies()) {
if (once(`c:${c.name}:${current}`)) {result.cookies.push({ domain: c.domain, name: c.name, page: current })}
}
}
} finally {
await context.close()
}
return result
}
/**
* Crawls a site and returns the wire format (without jobId):
* `{ ok: true, pages, observations, requests, accepted }`. `chromium` is
* Playwright's (injected — the caller decides how it is installed).
*/
export async function crawlSite({
acceptSelector = '[data-ipal="accept"]',
chromium,
fetchImpl = fetch,
maxPages = 20,
pageTimeoutMs = 30_000,
siteUrl,
waitMs = 3_000,
}) {
const pages = await discoverPages(siteUrl, Math.min(100, Math.max(0, maxPages)), fetchImpl)
const siteHost = bareHost(siteUrl)
const browser = await chromium.launch()
try {
const options = { acceptSelector, pageTimeoutMs, siteHost, waitMs }
const before = await run(browser, pages, { ...options, accept: false })
const after = await run(browser, pages, { ...options, accept: true })
return { accepted: after.accepted, ok: true, pages: pages.map((p) => new URL(p).pathname), ...mergeRuns(before, after) }
} finally {
await browser.close()
}
}
+107
View File
@@ -0,0 +1,107 @@
// Pure helpers of the ipal cookie crawler (no browser, no network) — tested in
// test/cookieCrawler.test.ts. Wire format: src/modules/consent/scanner/crawl/result.ts.
import { createHash, timingSafeEqual } from 'node:crypto'
/** `acme.pl=TOKEN,shop.example.com=TOKEN2` → [{ host, token }]. Tokens shorter than 16 chars are refused. */
export function parseSites(value = '') {
const sites = []
for (const pair of value.split(/[,\n]/)) {
const i = pair.indexOf('=')
if (i < 1) {continue}
const host = pair.slice(0, i).trim().toLowerCase().replace(/^www\./, '')
const token = pair.slice(i + 1).trim()
if (host && token.length >= 16) {sites.push({ host, token })}
}
return sites
}
/** Host without `www.`, lower case. */
export const bareHost = (url) => new URL(url).hostname.toLowerCase().replace(/^www\./, '')
function sameToken(a, b) {
const x = createHash('sha256').update(String(a)).digest()
const y = createHash('sha256').update(String(b)).digest()
return timingSafeEqual(x, y)
}
/**
* Checks a crawl request: the site must be listed, the bearer token must be that
* site's token, the callback must be on the same origin as the site, and only
* https (http only when allowHttp — local tests). Returns an error string or null.
*/
export function checkCrawlRequest({ allowHttp = false, authorization, body, sites }) {
if (!body || typeof body !== 'object') {return 'bad_request'}
const { callbackUrl, jobId, siteUrl } = body
if (typeof jobId !== 'string' || !/^[0-9a-f]{16,64}$/.test(jobId)) {return 'bad_job_id'}
let site, callback
try {
site = new URL(siteUrl)
callback = new URL(callbackUrl)
} catch {
return 'bad_url'
}
const protocols = allowHttp ? ['https:', 'http:'] : ['https:']
if (!protocols.includes(site.protocol)) {return 'https_only'}
if (callback.origin !== site.origin) {return 'callback_not_on_site'}
const entry = sites.find((s) => s.host === bareHost(site.href))
if (!entry) {return 'site_not_allowed'}
const token = typeof authorization === 'string' && authorization.startsWith('Bearer ') ? authorization.slice(7).trim() : ''
if (!token || !sameToken(token, entry.token)) {return 'unauthorized'}
return null
}
/**
* Pages to visit: the site URL, then up to `max` same-origin URLs from
* /sitemap.xml (one level of sitemap index followed). Never throws.
*/
export async function discoverPages(siteUrl, max, fetchImpl = fetch) {
const origin = new URL(siteUrl).origin
const pages = [new URL(siteUrl).href]
const text = async (url) => {
try {
const res = await fetchImpl(url, { signal: AbortSignal.timeout(15_000) })
return res.ok ? await res.text() : ''
} catch {
return ''
}
}
const locs = (xml) => [...xml.matchAll(/<loc>\s*([^<\s]+)\s*<\/loc>/g)].map((m) => m[1].replace(/&amp;/g, '&'))
let xml = await text(`${origin}/sitemap.xml`)
if (/<sitemapindex/i.test(xml)) {
const children = locs(xml).filter((u) => u.startsWith(origin)).slice(0, 5)
xml = (await Promise.all(children.map(text))).join('\n')
}
for (const url of locs(xml)) {
if (pages.length > max) {break}
if (url.startsWith(`${origin}/`) && !pages.includes(url)) {pages.push(url)}
}
return pages
}
/** True for the site's own host and its subdomains. */
export function isFirstParty(host, siteHost) {
const h = host.toLowerCase().replace(/^www\./, '')
return h === siteHost || h.endsWith(`.${siteHost}`)
}
/**
* Two runs (no consent / accept all) → the wire format's observations and
* requests. A run: { cookies: [{ name, domain, page }], storage: [{ name, storage, page }],
* requests: [{ host, page }] } — first sighting per page.
*/
export function mergeRuns(before, after) {
const obs = new Map()
const reqs = new Map()
const add = (map, key, base, flag, page) => {
const entry = map.get(key) ?? { ...base, after: false, before: false, pages: [] }
entry[flag] = true
if (page && entry.pages.length < 5 && !entry.pages.includes(page)) {entry.pages.push(page)}
map.set(key, entry)
}
for (const [run, flag] of [[before, 'before'], [after, 'after']]) {
for (const c of run.cookies) {add(obs, `cookie:${c.name}`, { domain: c.domain.replace(/^\./, ''), name: c.name, storage: 'cookie' }, flag, c.page)}
for (const s of run.storage) {add(obs, `${s.storage}:${s.name}`, { name: s.name, storage: s.storage }, flag, s.page)}
for (const r of run.requests) {add(reqs, r.host, { host: r.host }, flag, r.page)}
}
return { observations: [...obs.values()], requests: [...reqs.values()] }
}
+46
View File
@@ -0,0 +1,46 @@
{
"name": "@intecion/ipal-cookie-crawler",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@intecion/ipal-cookie-crawler",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"playwright": "1.64.0"
},
"engines": {
"node": ">=20"
}
},
"node_modules/playwright": {
"version": "1.64.0",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.0.tgz",
"integrity": "sha512-kVzTnYFYEyQ9RGzBjNCd2+yEqWmVbxl3AHPynv3qQ6JTjv4a+kwRcnqQwIpuP3NnrnIrE/Q6wWAIAvMfIE2/Yg==",
"license": "Apache-2.0",
"dependencies": {
"playwright-core": "1.64.0"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=20"
}
},
"node_modules/playwright-core": {
"version": "1.64.0",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.0.tgz",
"integrity": "sha512-T9r+MZkTECl2+oUcZ26YgZzTrYidTsIhYYkJix+6iDOymOb1FB2RLLSOxRGnZGv5DStt+aduIVbt+E8WygXYpg==",
"license": "Apache-2.0",
"bin": {
"playwright-core": "cli.js"
},
"engines": {
"node": ">=20"
}
}
}
}
+18
View File
@@ -0,0 +1,18 @@
{
"name": "@intecion/ipal-cookie-crawler",
"version": "1.0.0",
"private": true,
"description": "Headless-browser cookie crawler for ipal-kit sites (Cookie review → Crawl site). Runs as one shared service, never inside a site.",
"license": "MIT",
"type": "module",
"scripts": {
"crawl": "node cli.mjs",
"start": "node server.mjs"
},
"dependencies": {
"playwright": "1.64.0"
},
"engines": {
"node": ">=20"
}
}
+163
View File
@@ -0,0 +1,163 @@
// ipal cookie crawler — HTTP service (deploy: docs/cookie-scanner.md → "Scanner service on Coolify").
//
// GET /health → { ok, running, queued }
// POST /crawl → Authorization: Bearer <the site's token>
// { jobId, siteUrl, callbackUrl, maxPages?, acceptSelector? } → 202 { ok, queued }
// The crawl runs in the background; the result is POSTed to callbackUrl with the
// same bearer token.
//
// Env: IPAL_CRAWLER_SITES="acme.pl=TOKEN,shop.example.com=TOKEN2" (required), PORT (3000),
// CRAWLER_CONCURRENCY (1), CRAWLER_QUEUE_MAX (20), CRAWLER_JOB_TIMEOUT_MS (600000),
// CRAWLER_WAIT_MS (3000), CRAWLER_ALLOW_HTTP (unset; "1" only for local tests).
import { createServer } from 'node:http'
import { pathToFileURL } from 'node:url'
import { checkCrawlRequest, parseSites } from './lib.mjs'
const MAX_BODY = 64 * 1024
function readJson(req) {
return new Promise((resolve) => {
let size = 0
const chunks = []
req.on('data', (c) => {
size += c.length
if (size > MAX_BODY) {req.destroy()}
else {chunks.push(c)}
})
req.on('end', () => {
try {
resolve(JSON.parse(Buffer.concat(chunks).toString('utf8')))
} catch {
resolve(null)
}
})
req.on('error', () => resolve(null))
})
}
const send = (res, status, body) => {
res.writeHead(status, { 'Content-Type': 'application/json' })
res.end(JSON.stringify(body))
}
/** POST the result to the site; 3 tries (0 s, 5 s, 30 s). */
async function deliver({ callbackUrl, fetchImpl, log, result, token }, delays = [0, 5_000, 30_000]) {
for (const delay of delays) {
if (delay) {await new Promise((r) => setTimeout(r, delay))}
try {
const res = await fetchImpl(callbackUrl, {
body: JSON.stringify(result),
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
method: 'POST',
signal: AbortSignal.timeout(60_000),
})
if (res.ok || (res.status >= 400 && res.status < 500)) {
log(`result for ${result.jobId} → ${callbackUrl}: HTTP ${res.status}`)
return res.status
}
} catch (err) {
log(`result for ${result.jobId} → ${callbackUrl} failed: ${err?.message ?? err}`)
}
}
return 0
}
/**
* The service as a function of its parts, so tests can inject `crawl` and
* `fetchImpl`. `crawl(job) → wire result without jobId`.
*/
export function createCrawlerServer({
allowHttp = false,
concurrency = 1,
crawl,
deliveryDelays,
fetchImpl = fetch,
jobTimeoutMs = 600_000,
log = (m) => console.log(`[crawler] ${m}`),
queueMax = 20,
sites,
}) {
const queue = []
let running = 0
const idle = []
const pump = () => {
while (running < concurrency && queue.length) {
const job = queue.shift()
running++
void (async () => {
let result
let timer
try {
result = await Promise.race([
crawl(job),
new Promise((_, reject) => {
timer = setTimeout(() => reject(new Error(`crawl took longer than ${jobTimeoutMs} ms`)), jobTimeoutMs)
}),
])
result = { ...result, jobId: job.jobId }
} catch (err) {
result = { error: String(err?.message ?? err).slice(0, 300), jobId: job.jobId, ok: false }
} finally {
clearTimeout(timer)
}
log(`crawled ${job.siteUrl} (${job.jobId}): ${result.ok ? `${result.pages.length} pages` : result.error}`)
await deliver({ callbackUrl: job.callbackUrl, fetchImpl, log, result, token: job.token }, deliveryDelays)
running--
if (!running && !queue.length) {idle.splice(0).forEach((r) => r())}
pump()
})()
}
}
const server = createServer(async (req, res) => {
const url = new URL(req.url ?? '/', 'http://x')
if (req.method === 'GET' && url.pathname === '/health') {return send(res, 200, { ok: true, queued: queue.length, running })}
if (req.method !== 'POST' || url.pathname !== '/crawl') {return send(res, 404, { ok: false })}
const body = await readJson(req)
const error = checkCrawlRequest({ allowHttp, authorization: req.headers.authorization, body, sites })
if (error) {return send(res, error === 'unauthorized' || error === 'site_not_allowed' ? 401 : 400, { error, ok: false })}
if (queue.length >= queueMax) {return send(res, 429, { error: 'queue_full', ok: false })}
const token = req.headers.authorization.slice(7).trim()
queue.push({
acceptSelector: typeof body.acceptSelector === 'string' ? body.acceptSelector.slice(0, 200) : undefined,
callbackUrl: body.callbackUrl,
jobId: body.jobId,
maxPages: Number.isFinite(body.maxPages) ? body.maxPages : 20,
siteUrl: body.siteUrl,
token,
})
send(res, 202, { ok: true, queued: queue.length + running })
pump()
})
/** Resolves when nothing is queued or running (tests). */
server.whenIdle = () => (running || queue.length ? new Promise((r) => idle.push(r)) : Promise.resolve())
return server
}
// Run directly: `node server.mjs`
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
const sites = parseSites(process.env.IPAL_CRAWLER_SITES)
if (!sites.length) {
console.error('[crawler] IPAL_CRAWLER_SITES is empty — set "host=token" pairs (token ≥ 16 chars).')
process.exit(1)
}
const { chromium } = await import('playwright')
const { crawlSite } = await import('./crawl.mjs')
const waitMs = Number(process.env.CRAWLER_WAIT_MS) || 3_000
const server = createCrawlerServer({
allowHttp: process.env.CRAWLER_ALLOW_HTTP === '1',
concurrency: Number(process.env.CRAWLER_CONCURRENCY) || 1,
crawl: (job) => crawlSite({ acceptSelector: job.acceptSelector, chromium, maxPages: job.maxPages, siteUrl: job.siteUrl, waitMs }),
jobTimeoutMs: Number(process.env.CRAWLER_JOB_TIMEOUT_MS) || 600_000,
queueMax: Number(process.env.CRAWLER_QUEUE_MAX) || 20,
sites,
})
const port = Number(process.env.PORT) || 3000
server.listen(port, () => console.log(`[crawler] listening on :${port} for ${sites.map((s) => s.host).join(', ')}`))
const stop = () => server.close(() => process.exit(0))
process.on('SIGTERM', stop)
process.on('SIGINT', stop)
}
+11
View File
@@ -7,10 +7,21 @@
*/
export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js'
export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js'
export { DocumentTitle } from '../modules/admin-i18n/DocumentTitle.js'
export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js'
export { AdminIcon, AdminLogo, IntecionCredit } from '../modules/branding/index.js'
export { CookieApprovalForm } from '../modules/consent/scanner/CookieApprovalForm.js'
export { CookieApprovalView } from '../modules/consent/scanner/CookieApprovalView.js'
export { CookieReviewTab } from '../modules/consent/scanner/CookieReviewTab.js'
export { CookieScanButton } from '../modules/consent/scanner/CookieScanButton.js'
export { CookieSiteCheckTab } from '../modules/consent/scanner/CookieSiteCheckTab.js'
export { CookieCrawlAlert } from '../modules/consent/scanner/crawl/CookieCrawlAlert.js'
export { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js'
export { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js'
export { TotpRedirectProvider } from '../modules/security/totp/TotpRedirectProvider.js'
export type { TotpRedirectProviderProps } from '../modules/security/totp/TotpRedirectProvider.js'
export { FaviconCheck } from '../modules/seo/FaviconCheck.js'
export type { FaviconCheckProps } from '../modules/seo/FaviconCheck.js'
export { MetaDescriptionCheck } from '../modules/seo/MetaDescriptionCheck.js'
export { StatsNavLink } from '../modules/stats/admin/StatsNavLink.js'
export { StatsView } from '../modules/stats/admin/StatsView.js'
+10 -2
View File
@@ -1,5 +1,5 @@
'use client'
export { AccessibilityProvider, AccessibilityWidget, useAccessibility } from '../modules/accessibility/client.js'
export { A11Y_DEFAULT_TEXTS, AccessibilityProvider, AccessibilityWidget, useAccessibility } from '../modules/accessibility/client.js'
export type { A11yClassNames, A11yState, A11yTexts } from '../modules/accessibility/client.js'
export { Analytics } from '../modules/analytics/client.js'
export type { AnalyticsProps } from '../modules/analytics/client.js'
@@ -25,6 +25,7 @@ export {
export type { CookieBannerAction, CookieBannerClassNames, CookieSettingsAction } from '../modules/consent/client.js'
export { ConstructionNotice } from '../modules/construction/ConstructionNotice.js'
export type { ConstructionNoticeClassNames } from '../modules/construction/ConstructionNotice.js'
export { CONSTRUCTION_CLOSE_LABEL, CONSTRUCTION_CLOSE_LABEL_PL, constructionCloseLabel } from '../modules/construction/texts.js'
export type { ConstructionMode } from '../modules/construction/types.js'
export { BuilderForm } from '../modules/forms/BuilderForm.js'
export type { BuilderFieldRenderArgs, BuilderFormClassNames, BuilderFormProps } from '../modules/forms/BuilderForm.js'
@@ -53,12 +54,15 @@ export {
custom,
email,
isEmail,
localizedRules,
maxLength,
minLength,
pattern,
required,
VALIDATION_MESSAGES,
validationMessages,
} from '../modules/forms/validators.js'
export type { Rule } from '../modules/forms/validators.js'
export type { Rule, ValidationMessages } from '../modules/forms/validators.js'
export {
AlternateLinksProvider,
AlternateLinksUpdater,
@@ -76,6 +80,10 @@ export {
switchLocalePath,
} from '../modules/i18n/index.js'
export type { I18nConfig, LocalizedSlugs } from '../modules/i18n/index.js'
export { LightboxDialog, LightboxProvider, LightboxTrigger, prefersReducedMotion, useLightbox, useOptionalLightbox } from '../modules/lightbox/client.js'
export type { LightboxApi, LightboxDialogProps, LightboxProviderProps, LightboxTriggerProps } from '../modules/lightbox/client.js'
export { formatLightboxCounter, LIGHTBOX_FALLBACK, LIGHTBOX_FALLBACK_PL, lightboxFallback, lightboxImage, lightboxIndex, resolveLightboxTexts } from '../modules/lightbox/index.js'
export type { LightboxClassNames, LightboxImage, LightboxImageOptions, LightboxRenderImage, LightboxTexts } from '../modules/lightbox/index.js'
export { LocaleView } from '../modules/pages/LocaleView.js'
export { NotFoundLoader } from '../modules/pages/NotFoundLoader.js'
export { TableOfContents } from '../modules/richtext/TableOfContents.js'
+1
View File
@@ -10,3 +10,4 @@
export { createProxy, DEFAULT_PROXY_MATCHER } from '../modules/i18n/createProxy.js'
export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from '../modules/i18n/localeMiddleware.js'
export type { LocaleMiddlewareResult } from '../modules/i18n/localeMiddleware.js'
export { createCspNonce, CSP_NONCE_HEADER } from '../modules/security/cspNonce.js'
+3 -1
View File
@@ -12,7 +12,7 @@ export type {
EnhanceProps,
RenderBlocksProps,
} from '../modules/blocks/index.js'
export { CookieTable } from '../modules/consent/CookieTable.js'
export { COOKIE_TABLE_LABELS, CookieTable } from '../modules/consent/CookieTable.js'
export type { CookieTableLabels } from '../modules/consent/CookieTable.js'
export { prepareBuilderForm, publicForm, RenderForm } from '../modules/forms/RenderForm.js'
export type { PrepareBuilderFormArgs, PreparedBuilderForm, RenderFormProps, SendFormAction } from '../modules/forms/RenderForm.js'
@@ -25,6 +25,8 @@ export type { SiteProvidersProps } from '../modules/frontend/SiteProviders.js'
export { extractHeadings } from '../modules/richtext/headings.js'
export { RenderRichText } from '../modules/richtext/index.js'
export type { RenderRichTextProps } from '../modules/richtext/index.js'
export { withLightboxUploads } from '../modules/richtext/withLightboxUploads.js'
export type { RichTextLightboxOptions } from '../modules/richtext/withLightboxUploads.js'
export { JsonLdGraph } from '../modules/seo/index.js'
export { NoSnippet } from '../modules/seo/NoSnippet.js'
export type { NoSnippetProps } from '../modules/seo/NoSnippet.js'
+223 -132
View File
@@ -1,163 +1,254 @@
import type { Field } from 'payload'
import { CONSENT_CATEGORIES } from '../../modules/consent/categories.js'
import { rowLabel } from '../../modules/admin-ui/index.js'
import { consentCategoryOptions } from '../../modules/consent/categoryLabels.js'
const DEFAULT_HINT = { en: 'Leave empty to use the default.', pl: 'Zostaw puste, aby użyć domyślnej wartości.' }
const HIDDEN_HINT = { en: 'Leave empty to hide it.', pl: 'Zostaw puste, aby go nie pokazywać.' }
/**
* Fields for the CookieSettings global — GDPR consent banner copy, editable
* per locale. The privacy-policy link TARGET is NOT stored here: it comes from
* the pages module (system page role 'privacyPolicy'), keeping one source of
* truth. Only the link's visible text lives here (privacyLinkLabel).
*
* The tabs are unnamed (presentation only): the data stays flat, as before.
*/
export const cookieSettingsFields: Field[] = [
{
name: 'policyVersion',
type: 'number',
admin: {
description:
'Raise by 1 when you add a tool or change the cookie policy — every visitor is asked for consent again.',
description: {
en: 'Raise by 1 after adding a tool or changing the cookie policy, and every visitor is asked for consent again.',
pl: 'Zwiększ o 1 po dodaniu narzędzia lub zmianie polityki cookies, a każdy odwiedzający zostanie ponownie zapytany o zgodę.',
},
position: 'sidebar',
step: 1,
},
defaultValue: 1,
label: { en: 'Consent version', pl: 'Wersja zgody' },
min: 1,
required: true,
},
{
name: 'eyebrow',
type: 'text',
admin: {
description: 'Small label above the banner title, e.g. "Privacy & cookies". Empty → not shown.',
},
localized: true,
},
{
name: 'title',
type: 'text',
admin: {
description: 'Banner heading, e.g. "We respect your privacy". Empty → not shown.',
},
localized: true,
},
{
name: 'message',
type: 'textarea',
admin: {
description: 'Main consent message shown in the banner.',
},
localized: true,
},
{
name: 'settingsTitle',
type: 'text',
admin: {
description: 'Heading for the detailed settings panel.',
},
localized: true,
},
{
name: 'settingsDescription',
type: 'textarea',
admin: {
description: 'Intro under the settings heading — what cookies are for and that the choice can be changed later.',
},
localized: true,
},
{
name: 'alwaysActiveLabel',
type: 'text',
admin: {
description: 'Badge next to the Necessary category, e.g. "Always active". Empty → a disabled switch/checkbox is shown instead.',
},
localized: true,
},
{
name: 'privacyLinkLabel',
type: 'text',
admin: {
description:
'Text of the privacy-policy link in the banner, e.g. "Privacy policy". The link target is the page assigned as Privacy Policy in Site Settings → System Pages. Empty → the page title is used.',
},
localized: true,
},
{
name: 'buttons',
type: 'group',
admin: {
description: 'Button labels.',
},
fields: [
{ name: 'acceptAll', type: 'text', localized: true },
{ name: 'reject', type: 'text', localized: true },
{ name: 'settings', type: 'text', localized: true },
// Not `save`: Mongoose reserves that path name and warns on every start/build.
{ name: 'savePreferences', type: 'text', label: 'Save', localized: true },
{ name: 'back', type: 'text', localized: true },
type: 'tabs',
tabs: [
{
name: 'close',
type: 'text',
admin: { description: 'Screen-reader label of the ✕ button in the settings dialog.' },
localized: true,
},
],
},
{
name: 'detailLabels',
type: 'group',
admin: {
description:
'Labels of the cookie list in the detailed settings window (CookieBanner settings="detailed"). The list itself comes from Cookies below.',
},
fields: [
{ name: 'cookies', type: 'text', admin: { description: 'Expander under each category, e.g. "Cookies used" — the count is added.' }, localized: true },
{ name: 'provider', type: 'text', localized: true },
{ name: 'purpose', type: 'text', localized: true },
{ name: 'duration', type: 'text', localized: true },
],
},
{
name: 'categories',
type: 'array',
admin: {
description: 'Per-category titles and descriptions.',
},
fields: [
{
name: 'key',
type: 'select',
options: CONSENT_CATEGORIES.map((c) => ({ label: c, value: c })),
required: true,
},
{ name: 'title', type: 'text', localized: true },
{ name: 'description', type: 'textarea', localized: true },
],
},
{
name: 'cookies',
type: 'array',
admin: {
description:
'Cookies the site uses — shown on the cookie policy page (<CookieTable>) and per category in the detailed settings window. Fill it from a scan: ipal-consent-check → cookie-scan.',
initCollapsed: true,
},
fields: [
{
type: 'row',
fields: [
{ name: 'name', type: 'text', admin: { width: '40%' }, required: true },
{ name: 'provider', type: 'text', admin: { description: 'e.g. Google, this site', width: '30%' } },
{
name: 'category',
type: 'select',
admin: { width: '30%' },
defaultValue: 'necessary',
options: CONSENT_CATEGORIES.map((c) => ({ label: c, value: c })),
required: true,
name: 'eyebrow',
type: 'text',
admin: { description: HIDDEN_HINT, placeholder: { en: 'Privacy & cookies', pl: 'Prywatność i cookies' } },
label: { en: 'Label above title', pl: 'Etykieta nad tytułem' },
localized: true,
},
{
name: 'title',
type: 'text',
admin: { description: HIDDEN_HINT, placeholder: { en: 'We respect your privacy', pl: 'Dbamy o prywatność' } },
label: { en: 'Title', pl: 'Tytuł' },
localized: true,
},
{
name: 'message',
type: 'textarea',
admin: { description: DEFAULT_HINT },
label: { en: 'Message', pl: 'Treść' },
localized: true,
},
{
name: 'privacyLinkLabel',
type: 'text',
admin: {
description: {
en: 'Leave empty to use the title of the privacy policy page set in Site settings.',
pl: 'Zostaw puste, aby użyć tytułu strony polityki prywatności wskazanej w ustawieniach witryny.',
},
placeholder: { en: 'Privacy policy', pl: 'Polityka prywatności' },
},
label: { en: 'Privacy link text', pl: 'Tekst linku' },
localized: true,
},
{
name: 'buttons',
type: 'group',
admin: { description: DEFAULT_HINT },
fields: [
{
type: 'row',
fields: [
{ name: 'acceptAll', type: 'text', admin: { placeholder: { en: 'Accept all', pl: 'Akceptuj wszystkie' } }, label: { en: 'Accept all', pl: 'Akceptuj wszystkie' }, localized: true },
{ name: 'reject', type: 'text', admin: { placeholder: { en: 'Reject', pl: 'Odrzuć' } }, label: { en: 'Reject', pl: 'Odrzuć' }, localized: true },
{ name: 'settings', type: 'text', admin: { placeholder: { en: 'Settings', pl: 'Ustawienia' } }, label: { en: 'Settings', pl: 'Ustawienia' }, localized: true },
],
},
{
type: 'row',
fields: [
// Not `save`: Mongoose reserves that path name and warns on every start/build.
{ name: 'savePreferences', type: 'text', admin: { placeholder: { en: 'Save preferences', pl: 'Zapisz ustawienia' } }, label: { en: 'Save', pl: 'Zapisz' }, localized: true },
{ name: 'back', type: 'text', admin: { placeholder: { en: 'Back', pl: 'Wstecz' } }, label: { en: 'Back', pl: 'Wstecz' }, localized: true },
{
name: 'close',
type: 'text',
admin: {
description: { en: 'Read aloud by screen readers for the ✕ button.', pl: 'Odczytywany przez czytniki ekranu dla przycisku ✕.' },
placeholder: { en: 'Close', pl: 'Zamknij' },
},
label: { en: 'Close', pl: 'Zamknij' },
localized: true,
},
],
},
],
label: { en: 'Buttons', pl: 'Przyciski' },
},
],
label: { en: 'Banner', pl: 'Baner' },
},
{
fields: [
{
name: 'settingsTitle',
type: 'text',
admin: { description: DEFAULT_HINT, placeholder: { en: 'Cookie settings', pl: 'Ustawienia cookies' } },
label: { en: 'Title', pl: 'Tytuł' },
localized: true,
},
{
name: 'settingsDescription',
type: 'textarea',
admin: {
description: {
en: 'What cookies are for and that the choice can be changed later, or leave empty to hide it.',
pl: 'Do czego służą cookies i że wybór można później zmienić, lub zostaw puste, aby go nie pokazywać.',
},
},
label: { en: 'Introduction', pl: 'Wstęp' },
localized: true,
},
{
name: 'alwaysActiveLabel',
type: 'text',
admin: {
description: {
en: 'Shown next to necessary cookies; leave empty to show a locked switch instead.',
pl: 'Widoczne przy niezbędnych cookies; zostaw puste, aby pokazać zablokowany przełącznik.',
},
placeholder: { en: 'Always active', pl: 'Zawsze aktywne' },
},
label: { en: 'Always active badge', pl: 'Oznaczenie „zawsze aktywne”' },
localized: true,
},
{
name: 'detailLabels',
type: 'group',
admin: {
description: {
en: 'Shown above the cookie list under each category; leave empty to use the default.',
pl: 'Widoczne nad listą cookies w każdej kategorii; zostaw puste, aby użyć domyślnej wartości.',
},
},
fields: [
{
name: 'cookies',
type: 'text',
admin: {
description: { en: 'The number of cookies is added after it.', pl: 'Po tekście dodawana jest liczba cookies.' },
placeholder: { en: 'Cookies used', pl: 'Używane cookies' },
},
label: { en: 'List toggle', pl: 'Rozwijanie listy' },
localized: true,
},
{
type: 'row',
fields: [
{ name: 'provider', type: 'text', admin: { placeholder: { en: 'Provider', pl: 'Dostawca' } }, label: { en: 'Provider', pl: 'Dostawca' }, localized: true },
{ name: 'purpose', type: 'text', admin: { placeholder: { en: 'Purpose', pl: 'Cel' } }, label: { en: 'Purpose', pl: 'Cel' }, localized: true },
{ name: 'duration', type: 'text', admin: { placeholder: { en: 'Duration', pl: 'Okres' } }, label: { en: 'Duration', pl: 'Okres' }, localized: true },
],
},
],
label: { en: 'Cookie list headings', pl: 'Nagłówki listy cookies' },
},
],
label: { en: 'Settings window', pl: 'Okno ustawień' },
},
{
fields: [
{
name: 'categories',
type: 'array',
admin: {
components: rowLabel(['title', 'key'], { en: 'Category', pl: 'Kategoria' }),
description: {
en: 'A category not listed here uses the default title and description.',
pl: 'Kategoria spoza listy używa domyślnego tytułu i opisu.',
},
},
fields: [
{
name: 'key',
type: 'select',
label: { en: 'Category', pl: 'Kategoria' },
options: consentCategoryOptions(),
required: true,
},
{ name: 'title', type: 'text', label: { en: 'Title', pl: 'Tytuł' }, localized: true },
{ name: 'description', type: 'textarea', label: { en: 'Description', pl: 'Opis' }, localized: true },
],
label: { en: 'Categories', pl: 'Kategorie' },
labels: { plural: { en: 'Categories', pl: 'Kategorie' }, singular: { en: 'Category', pl: 'Kategoria' } },
},
],
label: { en: 'Categories', pl: 'Kategorie' },
},
{
fields: [
{
name: 'cookies',
type: 'array',
admin: {
components: rowLabel(['name'], { en: 'Cookie', pl: 'Plik cookie' }),
description: {
en: 'Shown on the cookie policy page and in the settings window; fill it from Cookie review.',
pl: 'Widoczna na stronie polityki cookies i w oknie ustawień; uzupełnij ją z przeglądu cookies.',
},
initCollapsed: true,
},
fields: [
{
type: 'row',
fields: [
{ name: 'name', type: 'text', admin: { placeholder: '_ga', width: '40%' }, label: { en: 'Name', pl: 'Nazwa' }, required: true },
{ name: 'provider', type: 'text', admin: { placeholder: 'Google', width: '30%' }, label: { en: 'Provider', pl: 'Dostawca' } },
{
name: 'category',
type: 'select',
admin: { width: '30%' },
defaultValue: 'necessary',
label: { en: 'Category', pl: 'Kategoria' },
options: consentCategoryOptions(),
required: true,
},
],
},
{ name: 'purpose', type: 'textarea', label: { en: 'Purpose', pl: 'Cel' }, localized: true },
{
name: 'duration',
type: 'text',
admin: { placeholder: { en: '2 years', pl: '2 lata' } },
label: { en: 'Duration', pl: 'Okres' },
localized: true,
},
],
label: { en: 'Cookies', pl: 'Cookies' },
labels: { plural: { en: 'Cookies', pl: 'Cookies' }, singular: { en: 'Cookie', pl: 'Cookie' } },
},
],
label: { en: 'Cookie list', pl: 'Lista cookies' },
},
{ name: 'purpose', type: 'textarea', localized: true },
{ name: 'duration', type: 'text', admin: { description: 'e.g. "2 years", "session"' }, localized: true },
],
labels: { plural: 'Cookies', singular: 'Cookie' },
},
]
+4 -3
View File
@@ -4,7 +4,8 @@ import { userMeetsRole } from '../../modules/access/index.js'
import { cookieSettingsFields } from './fields.js'
/**
* Builds the CookieSettings global — consent banner copy managed by editors.
* Builds the CookieSettings global ("Cookies" in the admin) — consent banner copy and the
* cookie list, managed by editors. With the cookie scanner it also carries its tabs.
* Public read (the banner needs it on the frontend for anonymous visitors).
*/
export function buildCookieSettings(): GlobalConfig {
@@ -15,9 +16,9 @@ export function buildCookieSettings(): GlobalConfig {
update: ({ req }) => userMeetsRole(req, 'editor'), // consent texts are legal copy — not for plain 'user' accounts
},
admin: {
group: 'Settings',
group: { en: 'Privacy', pl: 'Prywatność' },
},
fields: cookieSettingsFields,
label: 'Cookie Settings',
label: { en: 'Cookies', pl: 'Cookies' },
}
}
+102 -70
View File
@@ -1,10 +1,33 @@
import type { Field } from 'payload'
import { LIGHTBOX_FALLBACK, LIGHTBOX_FALLBACK_PL } from '../../modules/lightbox/texts.js'
import { NOTIFICATION_FALLBACK, NOTIFICATION_FALLBACK_PL } from '../../modules/notifications/defaults.js'
const EN = NOTIFICATION_FALLBACK.form
const PL = NOTIFICATION_FALLBACK_PL.form
/** A form text: the default in both languages is the placeholder. */
const formText = (
name: keyof typeof EN,
label: { en: string; pl: string },
extra: { description?: { en: string; pl: string }; width?: string } = {},
): Field => ({
name,
type: 'text',
admin: {
placeholder: { en: EN[name], pl: PL[name] },
...(extra.description ? { description: extra.description } : {}),
...(extra.width ? { width: extra.width } : {}),
},
label,
localized: true,
})
/**
* Fields for the Notifications global — localized user-facing texts for action
* results (form submission outcomes, and future contexts). Every text is
* localized: true so each language has its own value. Empty fields fall back to
* built-in English defaults (see modules/notifications/defaults).
* the built-in defaults of the page's language (see modules/notifications/defaults).
*
* Grouped per context. `form` holds the outcomes of submitForm; more groups
* (e.g. `newsletter`, `system`) can be added the same way without touching
@@ -16,83 +39,92 @@ export const notificationsFields: Field[] = [
name: 'form',
type: 'group',
admin: {
description:
'Messages shown after a form is submitted. Leave a field empty to use the built-in default.',
description: {
en: 'Shown to visitors after they send a form; leave a field empty to use the default.',
pl: 'Widoczne dla odwiedzających po wysłaniu formularza; zostaw pole puste, aby użyć domyślnej wartości.',
},
},
fields: [
{
name: 'success',
type: 'text',
admin: { placeholder: 'Thank you — your message has been sent.' },
localized: true,
},
{
name: 'error',
type: 'text',
admin: { placeholder: 'Something went wrong. Please try again later.' },
localized: true,
},
{
name: 'rateLimited',
type: 'text',
admin: { placeholder: 'Too many attempts. Please wait a moment and try again.' },
localized: true,
},
{
name: 'turnstile',
type: 'text',
admin: { placeholder: 'Captcha verification failed. Please try again.' },
localized: true,
},
{
name: 'validation',
type: 'text',
admin: {
description:
'Shown on a validation error. Use {field} to insert the offending field name.',
placeholder: 'Please check the {field} field and try again.',
formText('success', { en: 'Sent', pl: 'Wysłano' }),
formText('error', { en: 'Error', pl: 'Błąd' }),
formText('validation', { en: 'Field error', pl: 'Błąd pola' }, {
description: { en: 'Use {field} for the field label.', pl: 'Użyj {field}, aby wstawić etykietę pola.' },
}),
formText('consent', { en: 'Consent missing', pl: 'Brak zgody' }, {
description: {
en: 'Shown when the privacy policy box is not ticked.',
pl: 'Widoczny, gdy pole zgody na politykę prywatności nie jest zaznaczone.',
},
localized: true,
},
{
name: 'consent',
type: 'text',
admin: {
description: 'Shown when the GDPR consent checkbox is left unchecked.',
placeholder: 'Please accept the privacy policy to continue.',
},
localized: true,
},
{
name: 'notFound',
type: 'text',
admin: { placeholder: 'This form is no longer available.' },
localized: true,
},
}),
formText('turnstile', { en: 'Spam check failed', pl: 'Błąd weryfikacji' }),
formText('rateLimited', { en: 'Too many attempts', pl: 'Zbyt wiele prób' }),
formText('notFound', { en: 'Form unavailable', pl: 'Formularz niedostępny' }),
{
type: 'row',
fields: [
{
name: 'next',
type: 'text',
admin: { description: 'Step-by-step forms: button to the next step.', placeholder: 'Next', width: '33%' },
localized: true,
},
{
name: 'back',
type: 'text',
admin: { description: 'Step-by-step forms: button to the previous step.', placeholder: 'Back', width: '33%' },
localized: true,
},
{
name: 'stepOf',
type: 'text',
admin: { description: 'Progress — {current} and {total} are replaced.', placeholder: 'Step {current} of {total}', width: '34%' },
localized: true,
},
formText('next', { en: 'Next button', pl: 'Przycisk „Dalej”' }, { width: '33%' }),
formText('back', { en: 'Back button', pl: 'Przycisk „Wstecz”' }, { width: '33%' }),
formText('stepOf', { en: 'Step counter', pl: 'Licznik kroków' }, {
description: { en: 'Use {current} and {total} for the numbers.', pl: 'Użyj {current} i {total}, aby wstawić liczby.' },
width: '34%',
}),
],
},
],
label: 'Form messages',
label: { en: 'Forms', pl: 'Formularze' },
},
]
const lightboxText = (
name: keyof typeof LIGHTBOX_FALLBACK,
label: { en: string; pl: string },
width: string,
description?: { en: string; pl: string },
): Field => ({
name,
type: 'text',
admin: { placeholder: { en: LIGHTBOX_FALLBACK[name], pl: LIGHTBOX_FALLBACK_PL[name] }, width, ...(description ? { description } : {}) },
label,
localized: true,
})
/**
* The "Lightbox" group — labels of the image viewer (<LightboxProvider texts>).
* Added by ipalKit `lightbox: true`; exported so a project can place it in its
* own global instead.
*/
export const lightboxNotificationFields: Field = {
name: 'lightbox',
type: 'group',
admin: {
description: {
en: 'Read by screen readers in the enlarged image view; leave a field empty to use the default.',
pl: 'Odczytywane przez czytniki ekranu w podglądzie zdjęcia; zostaw pole puste, aby użyć domyślnej wartości.',
},
},
fields: [
{
type: 'row',
fields: [
lightboxText('open', { en: 'Enlarge button', pl: 'Przycisk powiększenia' }, '50%', {
en: 'The image description is added after it.',
pl: 'Po tekście dodawany jest opis zdjęcia.',
}),
lightboxText('dialog', { en: 'Viewer name', pl: 'Nazwa podglądu' }, '50%'),
],
},
{
type: 'row',
fields: [
lightboxText('previous', { en: 'Previous button', pl: 'Przycisk „Poprzednie”' }, '25%'),
lightboxText('next', { en: 'Next button', pl: 'Przycisk „Następne”' }, '25%'),
lightboxText('close', { en: 'Close button', pl: 'Przycisk „Zamknij”' }, '25%'),
lightboxText('counter', { en: 'Image counter', pl: 'Licznik zdjęć' }, '25%', {
en: 'Use {current} and {total} for the numbers.',
pl: 'Użyj {current} i {total}, aby wstawić liczby.',
}),
],
},
],
label: { en: 'Image viewer', pl: 'Podgląd zdjęć' },
}
+8 -7
View File
@@ -1,22 +1,23 @@
import type { GlobalConfig } from 'payload'
import { userMeetsRole } from '../../modules/access/index.js'
import { notificationsFields } from './fields.js'
import { lightboxNotificationFields, notificationsFields } from './fields.js'
/**
* Builds the Notifications global — localized action-result texts. Readable by
* Builds the Notifications global (shown as "Form messages") — localized action-result texts. Readable by
* any authenticated panel user; server-side helpers read it with overrideAccess
* so the frontend can resolve texts without a session.
* so the frontend can resolve texts without a session. `lightbox` adds the
* image-viewer labels (ipalKit `lightbox: true`).
*/
export function buildNotifications(): GlobalConfig {
export function buildNotifications({ lightbox = false }: { lightbox?: boolean } = {}): GlobalConfig {
return {
slug: 'notifications',
access: {
read: () => true, // texts are public-facing (shown to end users)
update: ({ req }) => userMeetsRole(req, 'editor'),
},
admin: { group: 'Settings' },
fields: notificationsFields,
label: 'Notifications',
admin: { group: { en: 'Forms', pl: 'Formularze' } },
fields: lightbox ? [...notificationsFields, lightboxNotificationFields] : notificationsFields,
label: { en: 'Form messages', pl: 'Komunikaty formularzy' },
}
}
@@ -2,9 +2,11 @@
import type { TextFieldClientComponent } from 'payload'
import { FieldDescription, FieldLabel, useField } from '@payloadcms/ui'
import { FieldDescription, FieldLabel, useField, useTranslation } from '@payloadcms/ui'
import { useState } from 'react'
import { ipalT } from '../../../modules/admin-i18n/t.js'
/**
* Masked text input for sensitive values (SMTP password, R2 secret key,
* Turnstile secret key, etc.).
@@ -23,11 +25,12 @@ import { useState } from 'react'
* Assigned via a field's admin.components.Field. Works on any `text` field.
*/
export const MaskedField: TextFieldClientComponent = ({ field, path }) => {
const { t } = useTranslation()
const { setValue, value } = useField<string>({ path })
const [revealed, setRevealed] = useState(false)
const label =
typeof field?.label === 'string' ? field.label : (field?.name ?? path)
// A string or one string per language — FieldLabel / FieldDescription translate it.
const label = field?.label || field?.name || path
const description = field?.admin?.description
return (
@@ -60,11 +63,11 @@ export const MaskedField: TextFieldClientComponent = ({ field, path }) => {
}}
type="button"
>
{revealed ? 'Hide' : 'Reveal'}
{ipalT(t as never, revealed ? 'maskedHide' : 'maskedShow')}
</button>
</div>
{description && typeof description === 'string' ? (
{description && typeof description !== 'function' ? (
<FieldDescription description={description} path={path} />
) : null}
</div>
@@ -1,17 +1,21 @@
'use client'
import { useTranslation } from '@payloadcms/ui'
import { useState } from 'react'
import { ipalT } from '../../../modules/admin-i18n/t.js'
/**
* Admin UI: a small "send test email" tool for the SiteIntegrations email tab.
* Admin UI: a small "send test e-mail" tool for the SiteIntegrations e-mail tab.
* Enter an address, click Send, and it POSTs to /api/ipal/test-email, which
* sends through the currently-selected transport (SMTP or Graph). Shows the
* result inline so you can confirm delivery — or read the exact error — without
* leaving the panel.
* result inline so you can confirm delivery without leaving the panel.
*
* Assigned via a `ui` field's admin.components.Field.
* Assigned via a `ui` field's admin.components.Field. Texts: `testEmail*` keys.
*/
export const TestEmailButton = () => {
const { t } = useTranslation()
const text = (key: Parameters<typeof ipalT>[1], vars?: Record<string, unknown>) => ipalT(t as never, key, vars)
const [to, setTo] = useState('')
const [status, setStatus] = useState<
{ kind: 'error'; msg: string } | { kind: 'idle' } | { kind: 'ok'; msg: string } | { kind: 'sending' }
@@ -19,7 +23,7 @@ export const TestEmailButton = () => {
const send = async () => {
if (!to.trim()) {
setStatus({ kind: 'error', msg: 'Enter a recipient address.' })
setStatus({ kind: 'error', msg: text('testEmailInvalidRecipient') })
return
}
setStatus({ kind: 'sending' })
@@ -32,27 +36,25 @@ export const TestEmailButton = () => {
})
const data = await res.json()
if (data.ok) {
setStatus({ kind: 'ok', msg: data.message ?? 'Test email sent.' })
setStatus({ kind: 'ok', msg: data.message ?? text('testEmailSent', { to: to.trim() }) })
} else {
setStatus({ kind: 'error', msg: data.error ?? 'Send failed.' })
setStatus({ kind: 'error', msg: data.error ?? text('testEmailFailed') })
}
} catch {
setStatus({ kind: 'error', msg: 'Request failed. Is the server running?' })
setStatus({ kind: 'error', msg: text('testEmailNoConnection') })
}
}
return (
<div className="field-type" style={{ marginTop: '1rem' }}>
<label className="field-label" htmlFor="ipal-test-email-to">Send a test email</label>
<p style={{ fontSize: '.85rem', marginTop: 0, opacity: 0.7 }}>
Sends through the transport selected above. Save your changes first.
</p>
<label className="field-label" htmlFor="ipal-test-email-to">{text('testEmailLabel')}</label>
<p style={{ fontSize: '.85rem', marginTop: 0, opacity: 0.7 }}>{text('testEmailHint')}</p>
<div style={{ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '.5rem' }}>
<input
aria-label="Test email recipient"
aria-label={text('testEmailRecipient')}
id="ipal-test-email-to"
onChange={(e) => setTo(e.target.value)}
placeholder="you@example.com"
placeholder="anna@example.com"
style={{ flex: 1, minWidth: '220px' }}
type="email"
value={to}
@@ -64,7 +66,7 @@ export const TestEmailButton = () => {
style={{ whiteSpace: 'nowrap' }}
type="button"
>
{status.kind === 'sending' ? 'Sending…' : 'Send test'}
{status.kind === 'sending' ? text('testEmailSending') : text('testEmailSend')}
</button>
</div>
{status.kind === 'ok' && (
@@ -73,7 +75,7 @@ export const TestEmailButton = () => {
</p>
)}
{status.kind === 'error' && (
<p style={{ color: 'var(--theme-error-500, crimson)', marginTop: '.5rem' }}>
<p role="alert" style={{ color: 'var(--theme-error-500, crimson)', marginTop: '.5rem' }}>
✗ {status.msg}
</p>
)}
@@ -1,5 +1,7 @@
import type { Field } from 'payload'
import type { AdminText } from '../../../modules/admin-i18n/index.js'
import { validateAnalyticsId } from '../../../modules/analytics/idFormats.js'
/**
@@ -7,59 +9,61 @@ import { validateAnalyticsId } from '../../../modules/analytics/idFormats.js'
* read restriction. Google tags (GA4/GTM) use Consent Mode; the rest load only
* after the matching consent category is granted (see modules/analytics).
*/
const GOOGLE: AdminText = {
en: "Follows the visitor's choice in the cookie banner (Google Consent Mode).",
pl: 'Uwzględnia wybór odwiedzającego w banerze cookies (Google Consent Mode).',
}
const AFTER_MARKETING: AdminText = {
en: 'Loads after the visitor accepts marketing cookies.',
pl: 'Wczytuje się po zaakceptowaniu przez odwiedzającego cookies marketingowych.',
}
const AFTER_ANALYTICS: AdminText = {
en: 'Loads after the visitor accepts analytics cookies.',
pl: 'Wczytuje się po zaakceptowaniu przez odwiedzającego cookies analitycznych.',
}
export const analyticsFields: Field[] = [
{
name: 'ga4MeasurementId',
type: 'text',
admin: {
description: 'Google Analytics 4 Measurement ID. (Google — Consent Mode)',
placeholder: 'G-XXXXXXXXXX',
},
admin: { description: GOOGLE, placeholder: 'G-XXXXXXXXXX' },
label: { en: 'Google Analytics 4 ID', pl: 'ID Google Analytics 4' },
validate: validateAnalyticsId('ga4MeasurementId', 'G-XXXXXXXXXX'),
},
{
name: 'gtmContainerId',
type: 'text',
admin: {
description: 'Google Tag Manager container ID. (Google — Consent Mode)',
placeholder: 'GTM-XXXXXXX',
},
admin: { description: GOOGLE, placeholder: 'GTM-XXXXXXX' },
label: { en: 'Google Tag Manager ID', pl: 'ID Google Tag Manager' },
validate: validateAnalyticsId('gtmContainerId', 'GTM-XXXXXXX'),
},
{
name: 'metaPixelId',
type: 'text',
admin: {
description: 'Meta (Facebook) Pixel ID. Loads only after MARKETING consent.',
placeholder: '1234567890123456',
},
admin: { description: AFTER_MARKETING, placeholder: '1234567890123456' },
label: { en: 'Meta Pixel ID', pl: 'ID Meta Pixel' },
validate: validateAnalyticsId('metaPixelId', '1234567890123456'),
},
{
name: 'clarityProjectId',
type: 'text',
admin: {
description: 'Microsoft Clarity project ID (heatmaps). Loads only after ANALYTICS consent.',
placeholder: 'abcdefghij',
},
admin: { description: AFTER_ANALYTICS, placeholder: 'abcdefghij' },
label: { en: 'Microsoft Clarity ID', pl: 'ID Microsoft Clarity' },
validate: validateAnalyticsId('clarityProjectId', 'abcdefghij'),
},
{
name: 'linkedInPartnerId',
type: 'text',
admin: {
description: 'LinkedIn Insight Tag partner ID. Loads only after MARKETING consent.',
placeholder: '1234567',
},
admin: { description: AFTER_MARKETING, placeholder: '1234567' },
label: { en: 'LinkedIn Insight Tag ID', pl: 'ID LinkedIn Insight Tag' },
validate: validateAnalyticsId('linkedInPartnerId', '1234567'),
},
{
name: 'tiktokPixelId',
type: 'text',
admin: {
description: 'TikTok Pixel ID. Loads only after MARKETING consent.',
placeholder: 'CXXXXXXXXXXXXXXXXXXX',
},
admin: { description: AFTER_MARKETING, placeholder: 'CXXXXXXXXXXXXXXXXXXX' },
label: { en: 'TikTok Pixel ID', pl: 'ID TikTok Pixel' },
validate: validateAnalyticsId('tiktokPixelId', 'CXXXXXXXXXXXXXXXXXXX'),
},
]
+59 -30
View File
@@ -1,23 +1,33 @@
import type { Field } from 'payload'
import type { Condition, Field } from 'payload'
import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js'
/**
* SMTP transport settings for outbound email.
* E-mail sending settings (SMTP, or Microsoft Graph set up on the server).
*
* Protected at the global level (SiteIntegrations requires an authenticated
* user), so all fields — including the password — stay editable in the admin
* panel while remaining inaccessible to anonymous API requests.
*/
// SMTP fields only matter with the SMTP transport — hidden while Graph is selected.
const usesSmtp: Condition = (_, siblingData) => siblingData?.emailTransport !== 'graph'
export const smtpFields: Field[] = [
// Status written by mailAdapter on every send (throttled) — banner on this tab.
buildIntegrationStatusBanner('emailStatus', 'Email'),
buildIntegrationStatusBanner(
'emailStatus',
{ en: 'E-mail sending', pl: 'Wysyłka e-mail' },
{ failing: 'statusEmailFailing', hint: 'statusEmailHint' },
),
{
name: 'emailTransport',
type: 'select',
admin: {
description:
'How outbound email is sent. "Microsoft Graph" is only available when configured by the administrator (Intecion).',
description: {
en: 'Microsoft Graph works only when your administrator has set it up on the server.',
pl: 'Microsoft Graph działa tylko wtedy, gdy administrator skonfiguruje go na serwerze.',
},
// The Graph option only makes sense when agency credentials exist in env.
// We can't read process.env in the admin UI directly, so a client project
// that hasn't set up Graph should filter this option via integrationsFields
@@ -25,62 +35,81 @@ export const smtpFields: Field[] = [
// availability at send time regardless of what's selected here.
},
defaultValue: 'smtp',
label: { en: 'Sending method', pl: 'Sposób wysyłki' },
options: [
{ label: 'SMTP', value: 'smtp' },
{ label: 'Microsoft Graph (Exchange)', value: 'graph' },
{ label: { en: 'SMTP server', pl: 'Serwer SMTP' }, value: 'smtp' },
{ label: { en: 'Microsoft Graph (Exchange)', pl: 'Microsoft Graph (Exchange)' }, value: 'graph' },
],
},
{
type: 'row',
admin: {
// Hide SMTP fields when Graph is selected — they're not used then.
condition: (_, siblingData) => siblingData?.emailTransport !== 'graph',
},
fields: [
{
name: 'smtpFromAddress',
type: 'email',
admin: {
description: {
en: 'E-mails are sent from this address; with Microsoft Graph, replies go to it.',
pl: 'Z tego adresu wychodzą e-maile; przy Microsoft Graph trafiają na niego odpowiedzi.',
},
placeholder: '[email protected]',
width: '50%',
},
label: { en: 'Sender address', pl: 'Adres nadawcy' },
},
{
name: 'smtpFromName',
type: 'text',
admin: {
description: {
en: 'The name recipients see, e.g. the company name.',
pl: 'Nazwa widoczna dla odbiorcy, np. nazwa firmy.',
},
width: '50%',
},
label: { en: 'Sender name', pl: 'Nazwa nadawcy' },
},
],
},
{
type: 'row',
admin: { condition: usesSmtp },
fields: [
{
name: 'smtpHost',
type: 'text',
admin: { placeholder: 'smtp.example.com', width: '70%' },
label: { en: 'Server', pl: 'Serwer' },
},
{
name: 'smtpPort',
type: 'number',
admin: { width: '30%' },
admin: {
description: { en: 'Usually 587, or 465.', pl: 'Zwykle 587 lub 465.' },
width: '30%',
},
defaultValue: 587,
label: { en: 'Port', pl: 'Port' },
},
],
},
{
name: 'smtpUser',
type: 'text',
admin: {
description: 'SMTP account username.',
},
admin: { condition: usesSmtp },
label: { en: 'User name', pl: 'Nazwa użytkownika' },
},
{
name: 'smtpPassword',
type: 'text',
admin: {
description: 'SMTP account password.',
// Masked in the UI (••••) — stored plaintext, readable for SMTP auth.
components: {
Field: '@intecion/ipal-kit/admin#MaskedField',
},
condition: usesSmtp,
},
},
{
name: 'smtpFromAddress',
type: 'email',
admin: {
description: 'Default "from" address for outgoing mail.',
},
},
{
name: 'smtpFromName',
type: 'text',
admin: {
description: 'Default "from" display name.',
},
label: { en: 'Password', pl: 'Hasło' },
},
{
name: 'emailTest',
@@ -3,7 +3,7 @@ import type { Field } from 'payload'
import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js'
/**
* Cloudflare Turnstile credentials.
* Cloudflare Turnstile credentials (spam protection on forms).
*
* siteKey is public (rendered in the widget); secretKey is used for
* server-side verification. Both are protected at the global level
@@ -12,24 +12,36 @@ import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../..
*/
export const turnstileFields: Field[] = [
// Status written by the server when it verifies a form (checkTurnstile) — banner on this tab.
buildIntegrationStatusBanner('turnstileStatus', 'Turnstile'),
buildIntegrationStatusBanner(
'turnstileStatus',
{ en: 'Spam protection', pl: 'Ochrona przed spamem' },
{ failing: 'statusTurnstileFailing', hint: 'statusTurnstileHint' },
),
{
name: 'turnstileSiteKey',
type: 'text',
admin: {
description: 'Public site key rendered in the Turnstile widget.',
description: {
en: 'Public key of the Cloudflare Turnstile widget.',
pl: 'Klucz publiczny widżetu Cloudflare Turnstile.',
},
},
label: { en: 'Site key', pl: 'Klucz witryny' },
},
{
name: 'turnstileSecretKey',
type: 'text',
admin: {
description: 'Secret key used for server-side verification.',
// Masked in the UI (••••) — stored plaintext, readable for verification.
components: {
Field: '@intecion/ipal-kit/admin#MaskedField',
},
description: {
en: 'Private key of the same widget; fill in both keys to turn spam protection on.',
pl: 'Klucz prywatny tego samego widżetu; uzupełnij oba klucze, aby włączyć ochronę.',
},
},
label: { en: 'Secret key', pl: 'Klucz tajny' },
},
buildIntegrationStatusField('turnstileStatus'),
]
+14 -7
View File
@@ -36,18 +36,25 @@ export function buildSiteIntegrations({
update: ({ req }) => userMeetsRole(req, 'admin'),
},
admin: {
group: 'Settings',
group: { en: 'Settings', pl: 'Ustawienia' },
},
fields: [
{
type: 'tabs',
tabs: [
{ fields: analyticsFields, label: 'Analytics' },
{ fields: turnstileFields, label: 'Turnstile' },
{ fields: smtpFields, label: 'SMTP' },
{ fields: indexNowFields, label: 'IndexNow' },
{ fields: analyticsFields, label: { en: 'Analytics', pl: 'Analityka' } },
{
description: {
en: 'Cloudflare Turnstile checks that forms are sent by people, not bots.',
pl: 'Cloudflare Turnstile sprawdza, czy formularze wysyłają ludzie, a nie boty.',
},
fields: turnstileFields,
label: { en: 'Spam protection', pl: 'Ochrona przed spamem' },
},
{ fields: smtpFields, label: { en: 'E-mail sending', pl: 'Wysyłka e-mail' } },
{ fields: indexNowFields, label: { en: 'IndexNow', pl: 'IndexNow' } },
...(additionalFields?.length
? [{ fields: additionalFields, label: 'Custom' }]
? [{ fields: additionalFields, label: { en: 'More', pl: 'Więcej' } }]
: []),
],
},
@@ -68,6 +75,6 @@ export function buildSiteIntegrations({
},
],
},
label: 'Site Integrations',
label: { en: 'Site integrations', pl: 'Integracje' },
}
}
+88 -47
View File
@@ -5,14 +5,22 @@ import { validateFaviconField } from '../../../modules/seo/index.js'
/**
* General site identity fields.
* Consumed by SEO/OG (siteName, defaultShareImage) and frontend (logo).
*
* Order (admin-ux §7): what visitors see first (name, description, images),
* then the profiles list, then the title format options in one row. The row is
* presentation only — data stays flat.
*/
export const generalFields: Field[] = [
{
name: 'siteName',
type: 'text',
admin: {
description: 'Used in page titles and Open Graph metadata.',
description: {
en: 'Shown in page titles and when a link is shared.',
pl: 'Widoczna w tytułach stron i przy udostępnianiu linków.',
},
},
label: { en: 'Site name', pl: 'Nazwa witryny' },
localized: true,
required: true,
},
@@ -20,76 +28,109 @@ export const generalFields: Field[] = [
name: 'siteDescription',
type: 'textarea',
admin: {
description:
'Fallback meta description when a page has none. Also used for llms.txt and Open Graph.',
description: {
en: 'Shown in search results for pages without their own description.',
pl: 'Widoczny w wynikach wyszukiwania stron bez własnego opisu.',
},
},
label: { en: 'Site description', pl: 'Opis witryny' },
localized: true,
},
{
name: 'titleOrder',
type: 'select',
admin: {
description: 'Which comes first in browser tabs.',
},
defaultValue: 'page-first',
options: [
{ label: 'Page first — About Us | Acme', value: 'page-first' },
{ label: 'Site first — Acme | About Us', value: 'site-first' },
],
},
{
name: 'titleSeparator',
type: 'select',
admin: {
description: 'Separates the page title from the site name in browser tabs.',
},
defaultValue: '|',
options: [
{ label: 'Pipe — Page | Site', value: '|' },
{ label: 'Dash — Page – Site', value: '–' },
{ label: 'Hyphen — Page - Site', value: '-' },
{ label: 'Bullet — Page · Site', value: '·' },
{ label: 'Slash — Page / Site', value: '/' },
],
},
{
name: 'logo',
type: 'upload',
label: { en: 'Logo', pl: 'Logo' },
relationTo: 'media',
},
{
name: 'favicon',
type: 'upload',
admin: {
description: 'Primary site logo.',
// Warns under the field when the chosen icon is too small or not square (never blocks saving).
components: { afterInput: ['@intecion/ipal-kit/admin#FaviconCheck'] },
description: {
en: 'Square PNG or SVG, at least 48×48 px, shown in browser tabs and search results.',
pl: 'Kwadratowy plik PNG lub SVG, co najmniej 48×48 px, widoczny na kartach przeglądarki i w wynikach wyszukiwania.',
},
},
hooks: {
// Logs the same check on the server (the panel shows it through FaviconCheck).
beforeValidate: [validateFaviconField],
},
label: { en: 'Site icon (favicon)', pl: 'Ikona witryny (favicon)' },
relationTo: 'media',
},
{
name: 'defaultShareImage',
type: 'upload',
admin: {
description: 'Fallback Open Graph image when a page has none.',
description: {
en: 'Shown when a link to a page without its own image is shared.',
pl: 'Widoczny przy udostępnianiu linku do strony bez własnego obrazu.',
},
},
label: { en: 'Share image', pl: 'Obraz udostępniania' },
relationTo: 'media',
},
{
name: 'sameAs',
type: 'array',
admin: {
description:
'Official profiles of this business (Google Business Profile, LinkedIn, Facebook, Wikipedia…). Tells search engines and AI which entity the site belongs to.',
description: {
en: 'Your business on Google, LinkedIn, Facebook and similar, so search engines and AI assistants recognise you.',
pl: 'Profile firmy w Google, LinkedIn, Facebooku itp., dzięki którym wyszukiwarki i asystenci AI rozpoznają firmę.',
},
initCollapsed: true,
},
fields: [{ name: 'url', type: 'text', required: true, validate: (v: unknown) => (typeof v === 'string' && /^https?:\/\/\S+$/.test(v)) || 'Full URL, e.g. https://www.linkedin.com/company/acme' }],
labels: { plural: 'Profiles', singular: 'Profile' },
fields: [
{
name: 'url',
type: 'text',
admin: { placeholder: 'https://www.linkedin.com/company/acme' },
label: { en: 'Address (URL)', pl: 'Adres (URL)' },
required: true,
validate: (v: unknown, { req }: { req?: { i18n?: { language?: string } } } = {}) =>
(typeof v === 'string' && /^https?:\/\/\S+$/.test(v)) ||
(req?.i18n?.language === 'pl'
? 'Wpisz pełny adres, np. https://www.linkedin.com/company/acme'
: 'Enter a full address, e.g. https://www.linkedin.com/company/acme'),
},
],
label: { en: 'Official profiles', pl: 'Oficjalne profile' },
labels: { plural: { en: 'Profiles', pl: 'Profile' }, singular: { en: 'Profile', pl: 'Profil' } },
},
{
name: 'favicon',
type: 'upload',
admin: {
description:
'Square icon, PNG or SVG, min. 48×48px (Google requires this to show it in search). Rendered via buildIconsMetadata.',
},
hooks: {
// Warn the editor if the favicon is too small / not square for Google.
beforeValidate: [validateFaviconField],
},
relationTo: 'media',
type: 'row',
fields: [
{
name: 'titleOrder',
type: 'select',
admin: {
description: {
en: 'Order of the page name and the site name in the browser tab.',
pl: 'Kolejność nazwy strony i nazwy witryny na karcie przeglądarki.',
},
},
defaultValue: 'page-first',
label: { en: 'Title order', pl: 'Kolejność w tytule' },
options: [
{ label: { en: 'Page first — About us | Acme', pl: 'Najpierw strona — O nas | Acme' }, value: 'page-first' },
{ label: { en: 'Site first — Acme | About us', pl: 'Najpierw witryna — Acme | O nas' }, value: 'site-first' },
],
},
{
name: 'titleSeparator',
type: 'select',
defaultValue: '|',
label: { en: 'Title separator', pl: 'Separator w tytule' },
options: [
{ label: { en: 'Pipe — Page | Site', pl: 'Kreska pionowa — Strona | Witryna' }, value: '|' },
{ label: { en: 'Dash — Page – Site', pl: 'Półpauza — Strona – Witryna' }, value: '–' },
{ label: { en: 'Hyphen — Page - Site', pl: 'Dywiz — Strona - Witryna' }, value: '-' },
{ label: { en: 'Bullet — Page · Site', pl: 'Kropka — Strona · Witryna' }, value: '·' },
{ label: { en: 'Slash — Page / Site', pl: 'Ukośnik — Strona / Witryna' }, value: '/' },
],
},
],
},
]
+15 -9
View File
@@ -12,32 +12,38 @@ export const themeFields: Field[] = [
name: 'defaultTheme',
type: 'select',
admin: {
description: 'Theme applied on a visitor’s first visit. System = the visitor’s device setting.',
description: {
en: 'Used on a visitor’s first visit.',
pl: 'Używany przy pierwszej wizycie.',
},
},
defaultValue: 'light',
label: { en: 'Default theme', pl: 'Domyślny motyw' },
options: [
{ label: 'Light', value: 'light' },
{ label: 'Dark', value: 'dark' },
{ label: 'System', value: 'system' },
{ label: { en: 'Light', pl: 'Jasny' }, value: 'light' },
{ label: { en: 'Dark', pl: 'Ciemny' }, value: 'dark' },
{ label: { en: 'Device setting', pl: 'Ustawienie urządzenia' }, value: 'system' },
],
required: true,
},
{
name: 'allowThemeToggle',
type: 'checkbox',
admin: {
description: 'Show a light/dark switch on the site.',
},
defaultValue: true,
label: { en: 'Show theme switch', pl: 'Pokaż przełącznik motywu' },
},
{
name: 'themeToggleLabel',
type: 'text',
admin: {
condition: (data) => Boolean(data?.allowThemeToggle),
description: 'Name of the switch read by screen readers, e.g. "Dark mode".',
description: {
en: 'Read aloud by screen readers.',
pl: 'Odczytywana przez czytniki ekranu.',
},
placeholder: { en: 'Dark mode', pl: 'Tryb ciemny' },
},
label: 'Toggle label',
label: { en: 'Switch label', pl: 'Etykieta przełącznika' },
localized: true,
},
]
+16 -14
View File
@@ -7,14 +7,14 @@ import { themeFields } from './fields/theme.js'
type BuildSiteSettingsArgs = {
/** Extra fields injected by the client project */
additionalFields?: Field[]
/** "Under construction" tab (developer tool) — given when the pages module is on. */
/** "Maintenance" tab (maintenance mode) — given when the pages module is on. */
constructionFields?: Field[]
/** "Emails" tab — given with `forms: { emailLayout: true }`. */
/** "E-mails" tab — given with `forms: { emailLayout: true }`. */
emailFields?: Field[]
/** "Search & AI" tab — search-engine verification, AI crawlers, llms.txt note (seo module). */
/** "Search engines" tab — search-engine verification, AI assistants, llms.txt note (seo module). */
searchFields?: Field[]
/**
* Fields for the "System Pages" tab — page assignments by role (homepage,
* Fields for the "System pages" tab — page assignments by role (homepage,
* privacy policy, collection archives). Assembled by the caller, which is the
* only place that knows which modules are enabled. The tab is omitted when
* this is empty.
@@ -33,7 +33,7 @@ type BuildSiteSettingsArgs = {
*
* Uses unnamed tabs — data stays flat (siteSettings.siteName, not
* siteSettings.general.siteName). Client-provided fields land in their own
* "Custom" tab so core data paths never shift.
* "More" tab so core data paths never shift. Tab labels are presentation only.
*/
export function buildSiteSettings({
additionalFields,
@@ -51,7 +51,7 @@ export function buildSiteSettings({
update: ({ req }) => userMeetsRole(req, 'editor'),
},
admin: {
group: 'Settings',
group: { en: 'Settings', pl: 'Ustawienia' },
},
fields: [
{
@@ -59,22 +59,24 @@ export function buildSiteSettings({
tabs: [
{
fields: generalFields,
label: 'General',
label: { en: 'General', pl: 'Ogólne' },
},
{
fields: themeFields,
label: 'Theme',
label: { en: 'Theme', pl: 'Motyw' },
},
...(systemPageFields?.length
? [{ fields: systemPageFields, label: 'System Pages' }]
? [{ fields: systemPageFields, label: { en: 'System pages', pl: 'Strony systemowe' } }]
: []),
...(searchFields?.length ? [{ fields: searchFields, label: 'Search & AI' }] : []),
...(emailFields?.length ? [{ fields: emailFields, label: 'Emails' }] : []),
...(constructionFields?.length ? [{ fields: constructionFields, label: 'Under construction' }] : []),
...(additionalFields?.length ? [{ fields: additionalFields, label: 'Custom' }] : []),
...(searchFields?.length ? [{ fields: searchFields, label: { en: 'Search engines', pl: 'Wyszukiwarki' } }] : []),
...(emailFields?.length ? [{ fields: emailFields, label: { en: 'E-mails', pl: 'E-maile' } }] : []),
...(constructionFields?.length
? [{ fields: constructionFields, label: { en: 'Maintenance', pl: 'Prace techniczne' } }]
: []),
...(additionalFields?.length ? [{ fields: additionalFields, label: { en: 'More', pl: 'Więcej' } }] : []),
],
},
],
label: 'Site Settings',
label: { en: 'Site settings', pl: 'Ustawienia witryny' },
}
}
+145 -9
View File
@@ -1,3 +1,4 @@
export { lightboxNotificationFields } from './globals/Notifications/fields.js'
export { applyGlobalOverrides } from './globals/overrides.js'
export type { GlobalOverride, GlobalOverrides, IpalGlobalSlug } from './globals/overrides.js'
export type { AccessOption, Role } from './modules/access/index.js'
@@ -22,6 +23,9 @@ export {
// components would load React UI into payload.config / the CLI (test/entryGraph).
export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/state.js'
export type { A11yState } from './modules/accessibility/state.js'
export { applyAdminI18n } from './modules/admin-i18n/apply.js'
export { ADMIN_LANGUAGES, adminDocumentTitle, adminTexts, defineTexts, formatDateTime, formatNumber, ipalT } from './modules/admin-i18n/index.js'
export type { AdminLanguage, AdminText, AdminTextKey } from './modules/admin-i18n/index.js'
export { rowLabel } from './modules/admin-ui/index.js'
export type { RowLabelProps } from './modules/admin-ui/index.js'
export type { AnalyticsConfig } from './modules/analytics/index.js'
@@ -35,10 +39,15 @@ export {
buildConsentLogCollection,
buildConsentLogEndpoint,
CONSENT_CATEGORIES,
CONSENT_CATEGORY_LABELS,
CONSENT_COOKIE,
CONSENT_FALLBACK,
CONSENT_FALLBACK_PL,
CONSENT_LOG_SLUG,
CONSENT_MAX_AGE,
CONSENT_VERSION,
consentCategoryOptions,
consentFallback,
DEFAULT_CONSENT,
getConsentTexts,
getCookieTable,
@@ -50,7 +59,88 @@ export {
updateConsent,
} from './modules/consent/index.js'
export type { ConsentCategory, ConsentLogOptions, ConsentState, ConsentTexts, CookieTableRow } from './modules/consent/index.js'
// Cookie scanner — review list, scan, declarations, Open Cookie Database lookup (docs/cookie-scanner.md).
export {
addCookieScannerTabs,
addToCookieList,
applyCookieFindings,
approveCookies,
bearerMatches,
buildCookieApprovalEndpoints,
buildCookieCrawlEndpoints,
buildCookieCrawlGlobal,
buildCookieReviewCollection,
buildCookieScanEndpoints,
collectCookieFindings,
COOKIE_APPROVAL_PATH,
COOKIE_APPROVAL_VIEW_PATH,
COOKIE_CRAWL_PATH,
COOKIE_CRAWL_RESULTS_PATH,
COOKIE_CRAWL_SLUG,
COOKIE_REVIEW_SLUG,
COOKIE_SCAN_LABELS,
COOKIE_SCAN_PATH,
COOKIE_SCAN_TOKEN_ENV,
COOKIE_SCAN_URL_ENV,
cookieNameMatches,
cookieScanContext,
countPendingCookies,
DEFAULT_COOKIE_INTEGRATIONS,
DEFAULT_DATABASE_CATEGORIES,
DEFAULT_TRACKER_HOSTS,
DEFAULT_UNKNOWN_CATEGORY,
findCrawlViolations,
finishCrawl,
flagGoneEntries,
GOOGLE_TAG_HOSTS,
indexCookieDatabase,
ingestCrawlResult,
loadCookieApproval,
loadCookieDatabase,
lookupCookie,
mergeCookieReview,
mergeCookieScanLabels,
nextChange,
parseCookieNames,
parseCrawlResult,
PENDING_WHERE,
resolveCrawlConfig,
runCookieScan,
sameCookie,
sendCrawlWarning,
suggestionFor,
} from './modules/consent/scanner/index.js'
export type {
CookieApprovalItem,
CookieApprovalList,
CookieApprovalOptions,
CookieApprovalResult,
CookieChange,
CookieCrawlOptions,
CookieDatabaseIndex,
CookieDeclaration,
CookieFinding,
CookieFindingSource,
CookieIntegration,
CookieObservation,
CookieReviewEntryRef,
CookieReviewValues,
CookieScanContext,
CookieScanLabels,
CookieScannerOptions,
CookieScanSummary,
CookieStorage,
CrawlIngestSummary,
CrawlObservation,
CrawlRequest,
CrawlResult,
CrawlViolation,
LocalizedText,
OpenCookieCategory,
ResolvedCrawlConfig,
} from './modules/consent/scanner/index.js'
export { constructionNoticeHref, isPathAllowed, isPathVisibleIn } from './modules/construction/logic.js'
export { CONSTRUCTION_CLOSE_LABEL, CONSTRUCTION_CLOSE_LABEL_PL, constructionCloseLabel } from './modules/construction/texts.js'
export type { ConstructionMode } from './modules/construction/types.js'
export { CONSTRUCTION_NOTICE_PARAM } from './modules/construction/types.js'
export { pathOf } from './modules/construction/visibility.js'
@@ -112,17 +202,33 @@ export {
custom,
email,
isEmail,
localizedRules,
maxLength,
minLength,
pattern,
required,
VALIDATION_MESSAGES,
validationMessages,
} from './modules/forms/validators.js'
export type { Rule } from './modules/forms/validators.js'
export type { Rule, ValidationMessages } from './modules/forms/validators.js'
export type { ContentHelpers, EntryJsonLdContext, PageJsonLdOptions, SiteShell } from './modules/frontend/createContentHelpers.js'
export { createContentHelpers } from './modules/frontend/index.js'
// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).
export { createHealthRoute } from './modules/health/index.js'
export { buildCrossLocaleFieldSync, buildGlobalRevalidateHook, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js'
export {
buildCrossLocaleFieldSync,
buildFillEmptyLocalesCollectionHook,
buildFillEmptyLocalesGlobalHook,
buildGlobalRevalidateHook,
buildPreventDeleteSystemPage,
buildRevalidateHook,
buildValidateUniqueRole,
fillEmptyLocales,
setPublishedAtHook,
trackSlugHistoryHook,
withFillLocales,
} from './modules/hooks/index.js'
export type { FillEmptyLocalesTarget } from './modules/hooks/index.js'
export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/createProxy.js'
export { getLocalizedSlugs } from './modules/i18n/getLocalizedSlugs.js'
export { getDefaultLocale, getLocaleCodes, getLocaleDefinition, isValidLocale } from './modules/i18n/helpers.js'
@@ -133,7 +239,10 @@ export { buildLocalizedPath, switchLocalePath } from './modules/i18n/localizedPa
export { LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale } from './modules/i18n/negotiateLocale.js'
export { resolveLocalized } from './modules/i18n/resolveLocalized.js'
export { buildIntegrationStatusBanner, buildIntegrationStatusField, recordIntegrationStatus } from './modules/integrations/index.js'
export type { IntegrationState, IntegrationStatus } from './modules/integrations/index.js'
export type { IntegrationBannerTexts, IntegrationLabel, IntegrationState, IntegrationStatus } from './modules/integrations/index.js'
// Image lightbox — pure helpers (components live in /client).
export { formatLightboxCounter, LIGHTBOX_FALLBACK, LIGHTBOX_FALLBACK_PL, lightboxFallback, lightboxImage, lightboxIndex, resolveLightboxTexts } from './modules/lightbox/index.js'
export type { LightboxClassNames, LightboxImage, LightboxImageOptions, LightboxRenderImage, LightboxTexts } from './modules/lightbox/index.js'
export { buildLinkField, buildLinksField, homeSlugFrom, resolveLink, resolveLinkHref, resolveNav, resolveSystemLinks, safeHref } from './modules/links/index.js'
export type {
BuildLinkFieldOptions,
@@ -159,7 +268,7 @@ export {
videoProps,
} from './modules/media/index.js'
export type { MediaImageOptions, MediaImageProps, VideoMode, VideoProps } from './modules/media/index.js'
export { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage } from './modules/notifications/index.js'
export { getNotificationTexts, NOTIFICATION_FALLBACK, NOTIFICATION_FALLBACK_PL, notificationFallback, resolveFormMessage } from './modules/notifications/index.js'
export type { FormNotificationTexts, NotificationTexts } from './modules/notifications/index.js'
export type { PagesOption, SystemPageRole } from './modules/pages/index.js'
export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'
@@ -174,10 +283,36 @@ export {
export { buildTableOfContentsField, extractHeadings, headingText } from './modules/richtext/headings.js'
export type { ExtractHeadingsOptions, HeadingItem, HeadingLevel } from './modules/richtext/headings.js'
// Lexical → Markdown (pure, no React) — for AI-readable output.
export { lexicalToMarkdown } from './modules/richtext/index.js'
export { buildSecurityHeaders, buildUploadSecurityHeaders } from './modules/security/index.js'
export { buildCsp } from './modules/security/index.js'
export type { BuildCspArgs } from './modules/security/index.js'
export { lexicalToMarkdown } from './modules/richtext/lexicalToMarkdown.js'
export {
buildAdminCsp,
buildAdminCspHeaders,
buildCsp,
buildCspHeaders,
buildReportingEndpoints,
buildSecurityHeaders,
buildUploadSecurityHeaders,
createCspNonce,
createCspReportRoute,
CSP_NONCE_HEADER,
cspHeaderKey,
DEFAULT_CSP_REPORT_GROUP,
parseCspReports,
totpAdminPath,
totpRedirectTarget,
withSecurityConfig,
} from './modules/security/index.js'
export type {
BuildAdminCspArgs,
BuildCspArgs,
CreateCspReportRouteArgs,
CspDirective,
CspSources,
CspViolation,
TotpRedirectArgs,
TotpUser,
WithSecurityConfigOptions,
} from './modules/security/index.js'
export type { BuildSecurityHeadersArgs, SecurityHeader } from './modules/security/index.js'
export type { OgImage } from './modules/seo/buildMetadata.js'
@@ -212,7 +347,8 @@ export {
injectAutoFillMeta,
} from './modules/seo/index.js'
export { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler } from './modules/seo/index.js'
export { buildIconsMetadata, buildOrganizationJsonLd, sameAsUrls, validateFaviconField } from './modules/seo/index.js'
export { buildIconsMetadata, buildOrganizationJsonLd, FAVICON_MIN_SIZE, faviconProblems, sameAsUrls, validateFaviconField } from './modules/seo/index.js'
export type { FaviconProblem } from './modules/seo/index.js'
export { buildNoindexField } from './modules/seo/index.js'
export { buildSpeakableJsonLd } from './modules/seo/index.js'
export { buildSummaryField, SKIP_AUTO_FILL } from './modules/seo/index.js'
+13 -5
View File
@@ -5,6 +5,12 @@ import type { Role } from './types.js'
import { isAdmin } from './predicates.js'
import { ROLE_HIERARCHY } from './types.js'
const ROLE_LABELS: Record<Role, { en: string; pl: string }> = {
admin: { en: 'Administrator', pl: 'Administrator' },
editor: { en: 'Editor', pl: 'Redaktor' },
user: { en: 'User', pl: 'Użytkownik' },
}
/**
* Builds the fixed `roles` field the plugin injects into the auth collection.
*
@@ -32,7 +38,11 @@ export function buildRolesField(defaultRole: Role = 'user', { firstUserAdmin = t
update: ({ req: { user } }) => isAdmin(user),
},
admin: {
description: 'Role hierarchy: admin > editor > user.',
description: {
en: 'Administrators manage everything; editors manage content.',
pl: 'Administrator zarządza wszystkim, redaktor — treścią.',
},
position: 'sidebar',
},
defaultValue: [defaultRole],
hasMany: true,
@@ -49,10 +59,8 @@ export function buildRolesField(defaultRole: Role = 'user', { firstUserAdmin = t
},
}
: {}),
options: ROLE_HIERARCHY.map((role) => ({
label: role.charAt(0).toUpperCase() + role.slice(1),
value: role,
})),
label: { en: 'Roles', pl: 'Role' },
options: ROLE_HIERARCHY.map((role) => ({ label: ROLE_LABELS[role], value: role })),
required: true,
saveToJWT: true,
}
@@ -14,6 +14,10 @@ export type A11yTexts = {
contrastInverted?: string
grayscale?: string
lineHeight?: string
/** Switch state "off". */
off?: string
/** Switch state "on". */
on?: string
open?: string
readableFont?: string
reduceMotion?: string
@@ -24,25 +28,46 @@ export type A11yTexts = {
}
/**
* English defaults. The widget is end-user facing and multilingual projects run
* in many locales, so the plugin ships a neutral English baseline — NOT Polish.
* Localize by passing `texts` for the active locale (see the component doc).
* Default texts in English and Polish. `locale` picks the set (Polish for
* 'pl' / 'pl-PL', English for anything else); `texts` overrides any of them.
*/
const DEFAULT_TEXTS: Required<A11yTexts> = {
bigCursor: 'Large cursor',
close: 'Close',
contrast: 'Contrast',
contrastHigh: 'High',
contrastInverted: 'Inverted',
grayscale: 'Grayscale',
lineHeight: 'Line spacing',
open: 'Open accessibility panel',
readableFont: 'Readable font',
reduceMotion: 'Reduce motion',
reset: 'Reset',
textSize: 'Text size',
title: 'Accessibility',
underlineLinks: 'Underline links',
export const A11Y_DEFAULT_TEXTS: { en: Required<A11yTexts>; pl: Required<A11yTexts> } = {
en: {
bigCursor: 'Large cursor',
close: 'Close',
contrast: 'Contrast',
contrastHigh: 'High',
contrastInverted: 'Inverted',
grayscale: 'Grayscale',
lineHeight: 'Line spacing',
off: 'Off',
on: 'On',
open: 'Open accessibility panel',
readableFont: 'Readable font',
reduceMotion: 'Reduce motion',
reset: 'Reset',
textSize: 'Text size',
title: 'Accessibility',
underlineLinks: 'Underline links',
},
pl: {
bigCursor: 'Duży kursor',
close: 'Zamknij',
contrast: 'Kontrast',
contrastHigh: 'Wysoki',
contrastInverted: 'Odwrócony',
grayscale: 'Skala szarości',
lineHeight: 'Odstęp między wierszami',
off: 'Wył.',
on: 'Wł.',
open: 'Otwórz panel dostępności',
readableFont: 'Czytelna czcionka',
reduceMotion: 'Ogranicz animacje',
reset: 'Przywróć domyślne',
textSize: 'Rozmiar tekstu',
title: 'Dostępność',
underlineLinks: 'Podkreśl linki',
},
}
export type A11yClassNames = {
@@ -67,26 +92,25 @@ export type A11yClassNames = {
*
* <AccessibilityWidget classNames={{ button: 'a11y-btn', panel: 'a11y-panel' }} />
*
* Labels default to English; localize per locale by passing `texts` for the
* active language. Keep the translations in the project (or a localized global)
* and pass the active locale's set — the plugin stays content-agnostic:
* Labels: pass the page's `locale` for the built-in English or Polish set;
* another language (or different wording) goes in `texts`, which wins key by key:
*
* const A11Y: Record<string, A11yTexts> = {
* pl: { title: 'Dostępność', textSize: 'Rozmiar tekstu', … },
* de: { title: 'Barrierefreiheit', … },
* }
* <AccessibilityWidget texts={A11Y[locale]} classNames={…} />
* <AccessibilityWidget locale={locale} classNames={…} />
* <AccessibilityWidget locale={locale} texts={locale === 'de' ? { title: 'Barrierefreiheit', … } : undefined} />
*/
export function AccessibilityWidget({
classNames,
locale,
texts,
}: {
classNames?: A11yClassNames
/** Page language — picks the default texts (Polish for 'pl', else English). */
locale?: string
texts?: A11yTexts
}) {
const { reset, set, state } = useAccessibility()
const [open, setOpen] = useState(false)
const t = { ...DEFAULT_TEXTS, ...texts }
const t = { ...(locale?.toLowerCase().startsWith('pl') ? A11Y_DEFAULT_TEXTS.pl : A11Y_DEFAULT_TEXTS.en), ...texts }
const cn = classNames ?? {}
const toggle = <K extends keyof A11yState>(key: K) => set(key, !state[key] as A11yState[K])
@@ -179,7 +203,7 @@ export function AccessibilityWidget({
onClick={() => toggle(key)}
type="button"
>
{state[key] ? 'ON' : 'OFF'}
{state[key] ? t.on : t.off}
</button>
</div>
))}
+1 -1
View File
@@ -1,6 +1,6 @@
'use client'
export { AccessibilityProvider, useAccessibility } from './AccessibilityProvider.js'
export { AccessibilityWidget } from './AccessibilityWidget.js'
export { A11Y_DEFAULT_TEXTS, AccessibilityWidget } from './AccessibilityWidget.js'
export type { A11yClassNames, A11yTexts } from './AccessibilityWidget.js'
export type { A11yState } from './state.js'
export { A11Y_COOKIE, a11yAttributes, parseA11y } from './state.js'
+1 -1
View File
@@ -1,5 +1,5 @@
export { AccessibilityProvider, useAccessibility } from './AccessibilityProvider.js'
export { AccessibilityWidget } from './AccessibilityWidget.js'
export { A11Y_DEFAULT_TEXTS, AccessibilityWidget } from './AccessibilityWidget.js'
export type { A11yClassNames, A11yTexts } from './AccessibilityWidget.js'
export {
A11Y_COOKIE,
+27
View File
@@ -0,0 +1,27 @@
'use client'
import { useEffect } from 'react'
/**
* Sets the browser-tab title of a custom admin view in the admin language.
*
* Payload takes a custom view's `meta.title` as one plain string and does not
* translate it, so the server-rendered title stays in English. The view
* renders this with its translated title (server side, from `req.i18n`) and
* the tab follows the editor's language once the page has loaded.
*
* On a full page load Next streams the view's metadata in after hydration and
* writes the English title back, so the title is re-applied whenever the head
* changes while the view is open.
*/
export function DocumentTitle({ title }: { title: string }) {
useEffect(() => {
const apply = () => {
if (document.title !== title) {document.title = title}
}
apply()
const observer = new MutationObserver(apply)
observer.observe(document.head, { characterData: true, childList: true, subtree: true })
return () => observer.disconnect()
}, [title])
return null
}
+32
View File
@@ -0,0 +1,32 @@
import type { Config } from 'payload'
import { en } from 'payload/i18n/en'
import { pl } from 'payload/i18n/pl'
import { deepMergeSimple } from 'payload/shared'
import { adminTexts } from './texts/index.js'
/**
* Admin languages and the plugin's component texts.
*
* - `i18n.supportedLanguages`: English and Polish when the project set none;
* a project's own list always wins.
* - `i18n.translations`: the plugin's texts under the `ipal` namespace, with the
* project's translations merged on top (the project wins key by key). A
* language the plugin has no texts for gets the English ones.
*/
export function applyAdminI18n(config: Config): Config {
const supportedLanguages = config.i18n?.supportedLanguages ?? { en, pl }
const plugin: Record<string, { ipal: Record<string, string> }> = {}
for (const lang of Object.keys(supportedLanguages)) {
plugin[lang] = { ipal: lang === 'pl' ? adminTexts.pl : adminTexts.en }
}
return {
...config,
i18n: {
...config.i18n,
supportedLanguages,
translations: deepMergeSimple(plugin, (config.i18n?.translations ?? {}) as Record<string, unknown>),
},
}
}
+14
View File
@@ -0,0 +1,14 @@
/** A visible admin string in every language the plugin ships. Payload accepts it as `label`, `description`, option `label`, tab `label`, `admin.group`. */
export type AdminText = { en: string; pl: string }
/** Languages the plugin ships admin texts in. */
export const ADMIN_LANGUAGES = ['en', 'pl'] as const
export type AdminLanguage = (typeof ADMIN_LANGUAGES)[number]
/**
* Declares one group of component texts. The Polish set must have exactly the
* English keys, so a missing translation is a type error.
*/
export function defineTexts<T extends Record<string, string>>(texts: { en: T; pl: Record<keyof T, string> }) {
return texts
}
+6
View File
@@ -0,0 +1,6 @@
// Client-safe: types, texts and helpers. The config transform (applyAdminI18n) lives in apply.ts.
export type { AdminLanguage, AdminText } from './define.js'
export { ADMIN_LANGUAGES, defineTexts } from './define.js'
export { adminDocumentTitle, formatDateTime, formatNumber, ipalT } from './t.js'
export { adminTexts } from './texts/index.js'
export type { AdminTextKey } from './texts/index.js'
+22
View File
@@ -0,0 +1,22 @@
import type { AdminTextKey } from './texts/index.js'
type TFunction = (key: never, vars?: Record<string, unknown>) => string
/**
* Reads one plugin text through Payload's `t` (from `useTranslation()` in client
* components, `i18n.t` in server components), so a project's own
* `i18n.translations.<lang>.ipal.<key>` wins over the plugin's.
*/
export function ipalT(t: TFunction, key: AdminTextKey, vars?: Record<string, unknown>): string {
return t(`ipal:${key}` as never, vars)
}
/** Number in the admin language's format (1 234 in Polish, 1,234 in English). */
export const formatNumber = (n: number, language: string) => new Intl.NumberFormat(language).format(n)
/** Date and time in the admin language's format. */
export const formatDateTime = (iso: string, language: string, timeZone?: string) =>
new Intl.DateTimeFormat(language, { dateStyle: 'medium', timeStyle: 'short', ...(timeZone ? { timeZone } : {}) }).format(new Date(iso))
/** The tab title Payload builds for a view: its title plus `admin.meta.titleSuffix`. */
export const adminDocumentTitle = (title: string, titleSuffix?: null | string) => (titleSuffix ? `${title} ${titleSuffix}` : title)
+19
View File
@@ -0,0 +1,19 @@
import { defineTexts } from '../define.js'
/** Admin component texts — consent. Placeholders use Payload's {{name}} syntax. */
export const consentTexts = defineTexts({
en: {
cookieIntegrationAdmin: 'Admin panel login',
cookieIntegrationConsent: 'Cookie banner',
cookieIntegrationLocale: 'Language choice',
cookieIntegrationStats: 'Built-in statistics',
cookieSourceProject: 'Project',
},
pl: {
cookieIntegrationAdmin: 'Logowanie do panelu',
cookieIntegrationConsent: 'Baner cookies',
cookieIntegrationLocale: 'Wybór języka',
cookieIntegrationStats: 'Wbudowane statystyki',
cookieSourceProject: 'Projekt',
},
})
+112
View File
@@ -0,0 +1,112 @@
import { defineTexts } from '../define.js'
/**
* Admin component texts — content (statistics, SEO hints, row labels).
* Placeholders use Payload's {{name}} syntax. Plural sets end in One / Few /
* Many / Other (Intl.PluralRules categories); English uses One and Other.
*/
export const contentTexts = defineTexts({
en: {
// Statistics: nav link, view, widget, chart
statsBack: 'Back to statistics',
statsChartDay: '{{day}} · Visits: {{visits}} · Page views: {{views}}',
statsChartTable: 'Table',
statsColDay: 'Day',
statsColDevice: 'Device',
statsColEntryPage: 'Entry page',
statsColLastVisit: 'Last visit',
statsColPage: 'Page',
statsColReferrer: 'Referrer',
statsColViews: 'Views',
statsColVisitor: 'Visitor',
statsConsentedVisits: 'Visits with analytics consent',
statsDeviceDesktop: 'Desktop',
statsDeviceMobile: 'Mobile',
statsDeviceTablet: 'Tablet',
statsDirect: '(direct)',
statsFrom: 'from {{referrer}}',
statsIntro: 'Last 30 days, counted without cookies and without storing IP addresses.',
statsNavLink: 'Statistics overview',
statsNoAccess: 'You do not have access to statistics.',
statsNoData: 'No data yet. It appears after the first visits.',
statsNoVisitors: 'No visitor has accepted analytics cookies yet.',
statsPagesFew: '{{count}} pages',
statsPagesMany: '{{count}} pages',
statsPagesOne: '{{count}} page',
statsPagesOther: '{{count}} pages',
statsPagesPerVisit: 'Pages per visit',
statsPageViews: 'Page views',
statsSinglePageVisits: 'Single-page visits',
statsTitle: 'Statistics',
statsUnknownDevice: 'Unknown device',
statsVisitorErase: 'To erase this visitor’s data, filter the visits list by this visitor ID and delete the results.',
statsVisitorHeading: 'Visitor',
statsVisitorHistory: 'Visitor history (with consent)',
statsVisitorLink: 'Visitor {{id}}',
statsVisitorVisitsFew: '{{count}} visits recorded with analytics consent.',
statsVisitorVisitsMany: '{{count}} visits recorded with analytics consent.',
statsVisitorVisitsOne: '{{count}} visit recorded with analytics consent.',
statsVisitorVisitsOther: '{{count}} visits recorded with analytics consent.',
statsVisits: 'Visits',
statsVisitsPerDay: 'Visits per day',
statsWidgetLink: 'All statistics',
statsWidgetSummary: 'Last 30 days · Visits: {{visits}} · Page views: {{views}}',
// SEO: description check under the search result description
seoDescEmpty: 'Empty. The page uses the site description, the same as every other page.',
seoDescEmptyAutoFill: 'Empty. On save it is filled from the page content; writing your own is better.',
seoDescSameAs: 'Same description as “{{name}}”. Google ignores a description repeated across pages; make each one unique.',
seoDescSameAsSite: 'Same as the site description. Google ignores a description repeated across pages; write one for this page.',
// Array rows without a name
rowLabelItem: 'Item',
},
pl: {
rowLabelItem: 'Element',
seoDescEmpty: 'Puste. Strona użyje opisu witryny, takiego samego jak na innych stronach.',
seoDescEmptyAutoFill: 'Puste. Przy zapisie zostanie uzupełnione treścią strony; lepiej napisać własny opis.',
seoDescSameAs: 'Taki sam opis jak na stronie „{{name}}”. Google pomija opis powtarzany na wielu stronach; każdy powinien być inny.',
seoDescSameAsSite: 'Taki sam jak opis witryny. Google pomija opis powtarzany na wielu stronach; napisz opis tej strony.',
statsBack: 'Wróć do statystyk',
statsChartDay: '{{day}} · Wizyty: {{visits}} · Odsłony: {{views}}',
statsChartTable: 'Tabela',
statsColDay: 'Dzień',
statsColDevice: 'Urządzenie',
statsColEntryPage: 'Strona wejścia',
statsColLastVisit: 'Ostatnia wizyta',
statsColPage: 'Strona',
statsColReferrer: 'Strona odsyłająca',
statsColViews: 'Odsłony',
statsColVisitor: 'Odwiedzający',
statsConsentedVisits: 'Wizyty ze zgodą na analitykę',
statsDeviceDesktop: 'Komputer',
statsDeviceMobile: 'Telefon',
statsDeviceTablet: 'Tablet',
statsDirect: '(bezpośrednio)',
statsFrom: 'z {{referrer}}',
statsIntro: 'Ostatnie 30 dni, liczone bez cookies i bez zapisywania adresów IP.',
statsNavLink: 'Podsumowanie statystyk',
statsNoAccess: 'Brak dostępu do statystyk.',
statsNoData: 'Brak danych. Pojawią się po pierwszych wizytach.',
statsNoVisitors: 'Żaden odwiedzający nie zaakceptował jeszcze cookies analitycznych.',
statsPagesFew: '{{count}} strony',
statsPagesMany: '{{count}} stron',
statsPagesOne: '{{count}} strona',
statsPagesOther: '{{count}} strony',
statsPagesPerVisit: 'Strony na wizytę',
statsPageViews: 'Odsłony',
statsSinglePageVisits: 'Wizyty jednostronicowe',
statsTitle: 'Statystyki',
statsUnknownDevice: 'Nieznane urządzenie',
statsVisitorErase: 'Aby usunąć dane tego odwiedzającego, przefiltruj listę wizyt po jego identyfikatorze i usuń wyniki.',
statsVisitorHeading: 'Odwiedzający',
statsVisitorHistory: 'Historia odwiedzających (za zgodą)',
statsVisitorLink: 'Odwiedzający {{id}}',
statsVisitorVisitsFew: '{{count}} wizyty zapisane za zgodą na analitykę.',
statsVisitorVisitsMany: '{{count}} wizyt zapisanych za zgodą na analitykę.',
statsVisitorVisitsOne: '{{count}} wizyta zapisana za zgodą na analitykę.',
statsVisitorVisitsOther: '{{count}} wizyty zapisanej za zgodą na analitykę.',
statsVisits: 'Wizyty',
statsVisitsPerDay: 'Wizyty dziennie',
statsWidgetLink: 'Wszystkie statystyki',
statsWidgetSummary: 'Ostatnie 30 dni · Wizyty: {{visits}} · Odsłony: {{views}}',
},
})
+12
View File
@@ -0,0 +1,12 @@
import { consentTexts } from './consent.js'
import { contentTexts } from './content.js'
import { integrationsTexts } from './integrations.js'
import { settingsTexts } from './settings.js'
/** Every admin component text, by language. Payload reads them as `ipal:<key>`. */
export const adminTexts = {
en: { ...settingsTexts.en, ...integrationsTexts.en, ...consentTexts.en, ...contentTexts.en },
pl: { ...settingsTexts.pl, ...integrationsTexts.pl, ...consentTexts.pl, ...contentTexts.pl },
}
export type AdminTextKey = keyof typeof adminTexts.en
@@ -0,0 +1,104 @@
import { defineTexts } from '../define.js'
/** Admin component texts — integrations. Placeholders use Payload's {{name}} syntax. */
export const integrationsTexts = defineTexts({
en: {
// Dashboard alert (IntegrationAlerts)
alertsHeading: 'An integration needs attention. The site still works.',
alertsLink: 'Go to Site integrations',
alertsUnknownError: 'Unknown error.',
// Masked secret field
maskedHide: 'Hide',
maskedShow: 'Show',
// Status banner on an integration's tab (IntegrationStatusBanner)
statusCode: 'Code: {{code}}.',
statusEmailFailing: 'E-mail sending is not working. Form notifications may not arrive.',
statusEmailHint: 'Correct the settings below, save and send a test e-mail.',
statusFailing: '{{label}} is not working.',
statusHint: 'Correct the settings below and save.',
statusLastChecked: 'Last checked {{date}}.',
statusSince: 'Since {{date}}.',
statusTurnstileFailing: 'Spam protection is not working. Forms are accepted without this check.',
statusTurnstileHint: 'Correct the keys below and save. The status updates after the next form submission.',
statusWorking: '{{label}}: working.',
statusWorkingSince: '{{label}}: working since {{date}}.',
// Status messages, by status code
statusEmailGraphUnavailable:
'Microsoft Graph is selected but not set up on the server, so e-mails go over SMTP. Ask your administrator.',
statusTurnstileBadResponse: 'Cloudflare sent an unexpected response.',
statusTurnstileInternalError: 'Cloudflare reported an internal error. It usually passes on its own.',
statusTurnstileInvalidSecret: 'Cloudflare rejected the secret key. Both keys must come from the same widget.',
statusTurnstileMissingSecret: 'The secret key is missing.',
statusTurnstileNetworkError: 'The server could not reach Cloudflare.',
statusTurnstileNoSecretKey: 'The secret key is missing, so spam protection is off. Fill in both keys or clear both.',
statusTurnstileNoSiteKey: 'The site key is missing, so spam protection is off. Fill in both keys or clear both.',
// Test e-mail (button + endpoint)
testEmailBody: 'This is a test message from {{site}}. If it arrived, e-mail sending works.',
testEmailBodyGeneric: 'This is a test message from your website. If it arrived, e-mail sending works.',
testEmailFailed: 'The test e-mail was not sent. Check the settings above and try again.',
testEmailForbidden: 'Only an administrator can send a test e-mail.',
testEmailHint: 'Save your changes first. The test uses the saved settings.',
testEmailInvalidRecipient: 'Enter a valid e-mail address, e.g. [email protected].',
testEmailLabel: 'Test e-mail',
testEmailLoggedOut: 'Your session has ended. Log in again.',
testEmailNoConnection: 'Could not reach the server. Check your connection and try again.',
testEmailNotConfigured: 'Fill in the server, user name and password, then save.',
testEmailRecipient: 'Recipient address',
testEmailSend: 'Send test e-mail',
testEmailSending: 'Sending…',
testEmailSent: 'Test e-mail sent to {{to}}.',
testEmailSubject: 'Test e-mail from {{site}}',
testEmailSubjectGeneric: 'Test e-mail from your website',
},
pl: {
alertsHeading: 'Integracja wymaga uwagi. Witryna nadal działa.',
alertsLink: 'Przejdź do integracji',
alertsUnknownError: 'Nieznany błąd.',
maskedHide: 'Ukryj',
maskedShow: 'Pokaż',
statusCode: 'Kod: {{code}}.',
statusEmailFailing: 'Wysyłka e-mail nie działa. Powiadomienia z formularzy mogą nie docierać.',
statusEmailHint: 'Popraw ustawienia poniżej, zapisz i wyślij testowy e-mail.',
statusFailing: '{{label}}: nie działa.',
statusHint: 'Popraw ustawienia poniżej i zapisz.',
statusLastChecked: 'Ostatnie sprawdzenie: {{date}}.',
statusSince: 'Od {{date}}.',
statusTurnstileFailing: 'Ochrona przed spamem nie działa. Formularze są przyjmowane bez tej kontroli.',
statusTurnstileHint: 'Popraw klucze poniżej i zapisz. Status odświeży się po następnym zgłoszeniu z formularza.',
statusWorking: '{{label}}: działa.',
statusWorkingSince: '{{label}}: działa od {{date}}.',
statusEmailGraphUnavailable:
'Wybrano Microsoft Graph, ale nie jest on skonfigurowany na serwerze, więc e-maile idą przez SMTP. Zapytaj administratora.',
statusTurnstileBadResponse: 'Cloudflare zwrócił nieoczekiwaną odpowiedź.',
statusTurnstileInternalError: 'Cloudflare zgłosił błąd wewnętrzny. Zwykle ustępuje samoczynnie.',
statusTurnstileInvalidSecret: 'Cloudflare odrzucił klucz tajny. Oba klucze muszą pochodzić z tego samego widżetu.',
statusTurnstileMissingSecret: 'Brak klucza tajnego.',
statusTurnstileNetworkError: 'Serwer nie może połączyć się z Cloudflare.',
statusTurnstileNoSecretKey: 'Brak klucza tajnego, więc ochrona przed spamem jest wyłączona. Uzupełnij oba klucze albo usuń oba.',
statusTurnstileNoSiteKey: 'Brak klucza witryny, więc ochrona przed spamem jest wyłączona. Uzupełnij oba klucze albo usuń oba.',
testEmailBody: 'To jest wiadomość testowa z witryny {{site}}. Jeśli dotarła, wysyłka e-mail działa.',
testEmailBodyGeneric: 'To jest wiadomość testowa z witryny. Jeśli dotarła, wysyłka e-mail działa.',
testEmailFailed: 'Nie wysłano testowego e-maila. Sprawdź ustawienia powyżej i spróbuj ponownie.',
testEmailForbidden: 'Tylko administrator może wysłać testowy e-mail.',
testEmailHint: 'Najpierw zapisz zmiany. Test używa zapisanych ustawień.',
testEmailInvalidRecipient: 'Wpisz poprawny adres e-mail, np. [email protected].',
testEmailLabel: 'Testowy e-mail',
testEmailLoggedOut: 'Sesja wygasła. Zaloguj się ponownie.',
testEmailNoConnection: 'Brak połączenia z serwerem. Sprawdź połączenie i spróbuj ponownie.',
testEmailNotConfigured: 'Uzupełnij serwer, nazwę użytkownika i hasło, a następnie zapisz.',
testEmailRecipient: 'Adres odbiorcy',
testEmailSend: 'Wyślij testowy e-mail',
testEmailSending: 'Wysyłanie…',
testEmailSent: 'Testowy e-mail wysłano na adres {{to}}.',
testEmailSubject: 'Testowy e-mail z witryny {{site}}',
testEmailSubjectGeneric: 'Testowy e-mail z witryny',
},
})

Some files were not shown because too many files have changed in this diff Show More