Compare commits
@@ -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).
|
||||
|
||||
|
||||
@@ -27,10 +27,14 @@ 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 { StatsView as StatsView_7568fe47d582ff15ce85d2e1873c2c23 } from '@intecion/ipal-kit/admin'
|
||||
@@ -67,10 +71,14 @@ 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#StatsView": StatsView_7568fe47d582ff15ce85d2e1873c2c23,
|
||||
|
||||
@@ -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]',
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ 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,
|
||||
@@ -77,6 +79,9 @@ export default buildConfig({
|
||||
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
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,93 @@ 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.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.
|
||||
|
||||
@@ -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
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
+82
-32
@@ -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` |
|
||||
| 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** → the editor accepts; or cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookie banner → Settings window → Cookie list headings 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 |
|
||||
| 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` |
|
||||
|
||||
@@ -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,6 +935,7 @@ 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 |
|
||||
| Fluid typography and spacing | `fluid.css` / `fluid-wide.css` (`--ipal-*` variables) | PROGRAMISTA §2.5 |
|
||||
@@ -904,6 +947,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 (drafts the editor accepts) | `ipalKit({ cookieScanner: true })` + `pnpm generate:importmap` + migration; project cookies: `cookieScanner.declarations` / `integrations` — do not type the list by hand or build your own scanner | 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,7 +956,7 @@ 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).
|
||||
@@ -924,9 +969,11 @@ payloadTotp } })`, never `twoFactor: false` without a client decision). CSP: fir
|
||||
|
||||
| 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 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 })` |
|
||||
@@ -939,8 +986,9 @@ payloadTotp } })`, never `twoFactor: false` without a client decision). CSP: fir
|
||||
| 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 +1017,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 +1150,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 +1170,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) |
|
||||
|
||||
@@ -312,6 +312,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
|
||||
|
||||
@@ -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]`.
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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,52 @@ 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 → Cookie review* → **Scan cookies**. "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. Entries with *Found by* = "Unknown — fill in" need provider, category and
|
||||
purpose: ask the client, do not guess.
|
||||
4. The editor accepts or rejects every draft (bulk edit works). Accepted → Cookie banner →
|
||||
Cookies, every language; existing text there is never overwritten. Open the banner's
|
||||
"Settings" and check each category lists its cookies.
|
||||
5. 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. Classify the new drafts (*Found by* = "Unknown — fill in"), then crawl again: 0 violations is
|
||||
the goal before handover.
|
||||
5. Optional: recipients in *Cookie check → Warning e-mails to*, 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 +96,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 (Cookie banner → 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 +104,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.
|
||||
(Cookie banner → 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` (Cookie banner → 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.
|
||||
|
||||
@@ -56,12 +56,12 @@ through this procedure. Ask only when you are missing something you cannot get y
|
||||
| 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` |
|
||||
|
||||
@@ -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) |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}>
|
||||
|
||||
@@ -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) |
|
||||
@@ -33,15 +34,15 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
|
||||
| `twoFactor.plugin` | — (required) | injected `payloadTotp` (the plugin does not import the peer) | missing function → throws |
|
||||
| `twoFactor.collectionSlug` | the panel's login collection (`admin.user`, else the first auth collection) | collection with 2FA; startup fails with `[ipal] twoFactor…` when it is not an auth collection or differs from `admin.user` | point it at the login collection |
|
||||
| `twoFactor.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 +51,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 +60,25 @@ 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 (drafts an editor accepts → Cookie banner → Cookie list), "Scan cookies" box above its list (`CookieScanButton`), `GET`/`POST /api/ipal/cookie-scan`; a scan lists the cookies of the integrations switched on + names looked up in the bundled Open Cookie Database; never deletes, never overwrites edited text, never publishes by itself | `true` / object; after switching on: `pnpm generate:importmap` + `migrate:create`. Check: *Privacy → Cookie review* → **Scan cookies** → drafts appear; set one to Accepted → it is in Cookie banner → Cookie list (cookie-scanner.md) |
|
||||
| `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 +90,24 @@ 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 drafts (`status` draft / accepted / rejected; create/read/update editor+, delete admin) | `cookieScanner` | off by default |
|
||||
| `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-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 +117,15 @@ 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` |
|
||||
| `CookieCrawlAlert` | `beforeDashboard` | `cookieScanner.crawl` and `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
|
||||
|
||||
@@ -129,9 +145,9 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
|
||||
| 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 +158,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** → accept → Cookie banner → Cookie list; `<CookieBanner settings="detailed">` lists 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 +184,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 +214,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 |
|
||||
|
||||
@@ -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,8 @@ 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`. |
|
||||
| `CookieCrawlAlert` | `@intecion/ipal-kit/admin` | Server Component: dashboard warning after a cookie crawl with violations or new unknown cookies, or a failed crawl; renders nothing otherwise. Injected with `cookieScanner.crawl` (`dashboard: false` drops it); 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`. |
|
||||
| `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 +52,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 +68,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 +112,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: Cookie banner → 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: Cookie banner → 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 +129,63 @@ 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 and admin box. The exports are building blocks for a CLI, a scheduled job or your own admin view.
|
||||
|
||||
| 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 Cookie banner → 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 +193,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 +217,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 +240,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`); 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`
|
||||
|
||||
@@ -249,13 +295,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 +371,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 +390,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 +402,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 +440,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 +462,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 +476,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. |
|
||||
@@ -456,7 +522,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 +530,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 +568,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 +580,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 +593,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 +667,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. |
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
@@ -133,7 +138,7 @@ 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.
|
||||
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,7 +323,7 @@ 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` |
|
||||
|
||||
@@ -355,8 +360,8 @@ 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`
|
||||
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 -i 'x-frame-options\|content-security-policy-report-only'`;
|
||||
an empty `PAYLOAD_SECRET` in `.env` → `pnpm dev` exits with a list of missing variables (restore it).
|
||||
|
||||
@@ -365,16 +370,16 @@ an empty `PAYLOAD_SECRET` in `.env` → `pnpm dev` exits with a list of missing
|
||||
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'`;
|
||||
`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 +415,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).
|
||||
Cookie banner → 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: Cookie banner → 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 +433,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 Cookie banner → Policy version nothing to change (`createProxy(config, { policyVersion })` pins one).
|
||||
|
||||
## 10. Navigation
|
||||
|
||||
@@ -470,14 +475,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. **Cookie banner**: 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 +520,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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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`: Cookie banner → 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,43 @@ 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 Cookie banner → 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.
|
||||
|
||||
## 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
@@ -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
|
||||
|
||||
+23
-11
@@ -28,8 +28,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 | Cookie banner → `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 +64,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 = Cookie banner → privacyLinkLabel
|
||||
const texts = await getConsentTexts({ payload, config: i18nConfig, locale })
|
||||
|
||||
return (
|
||||
@@ -84,6 +84,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 +248,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 **Cookie banner → 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 +257,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**,
|
||||
[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 +266,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 (**Cookie banner**, per language) — empty field = the element is not shown:
|
||||
|
||||
| Field | Where |
|
||||
|---|---|
|
||||
@@ -280,7 +286,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 **Cookie banner →
|
||||
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`.
|
||||
|
||||
@@ -326,7 +332,7 @@ independent consent state).
|
||||
|
||||
## 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:** Cookie banner → *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 +348,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: Cookie banner → *Cookie list* + `getCookieTable` + `<CookieTable>` from `/rsc`.
|
||||
Fill the list from the panel with the cookie scanner (`cookieScanner` option — drafts an editor accepts,
|
||||
[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 +396,11 @@ 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, 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`,
|
||||
|
||||
@@ -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
@@ -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.
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
# cookie scanner
|
||||
|
||||
Fills the cookie list (Cookie banner → Cookie list) from the admin panel. A scan lists the cookies of
|
||||
every integration the project switches on, plus any extra names, as **drafts** in a review list. An
|
||||
editor accepts, edits or rejects each one; accepting adds it to the cookie list, which feeds the
|
||||
`<CookieBanner settings="detailed">` window and `<CookieTable>` on the policy page
|
||||
([consent.md](./consent.md)).
|
||||
|
||||
What a scan never does: delete an entry, change text an editor edited, change an entry's status, or
|
||||
publish anything by itself.
|
||||
|
||||
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 cookies" box above the list is an admin component
|
||||
(`@intecion/ipal-kit/admin#CookieScanButton`). Run `pnpm generate:importmap`.
|
||||
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.
|
||||
3. **Verify** — log in as an editor, open *Privacy → Cookie review*. The box lists "Integrations in
|
||||
use" (e.g. Cookie banner, Admin panel login, Google Analytics 4). Click **Scan cookies**: drafts
|
||||
appear, each with *Found by* = Plugin integration. Set one to *Accepted*, save, open *Cookie
|
||||
Settings → Cookies*: the cookie is there, with purpose and retention in every language.
|
||||
|
||||
## How editors use it
|
||||
|
||||
| Step | What happens |
|
||||
|---|---|
|
||||
| **Scan cookies** | One draft per cookie of the integrations in use. Cookies already in Cookie banner → Cookie list are looked up too (*In the cookie list* is ticked). |
|
||||
| **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 becomes an entry with *Found by* = "Unknown — fill in" and no category. |
|
||||
| Edit a draft | Change provider, category, purpose, retention. A later scan keeps every value you changed (per language) and still updates values you left as suggested. |
|
||||
| **Accepted** | The cookie is added to Cookie banner → Cookie list in every language. When a row with that name already exists, only its empty provider / purpose / retention are filled — text written there stays, its category is not changed. An entry without a category cannot be accepted. |
|
||||
| **Rejected** | Stays in the list as rejected; later scans do not bring it back to draft. Rejecting never removes a row from Cookie banner — delete it there. |
|
||||
|
||||
Status changes work in the list's bulk edit too. Deleting review entries is admin-only and never done
|
||||
by the plugin.
|
||||
|
||||
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 only marks the entry; nothing is written to Cookie banner |
|
||||
| `crawl` | off | browser crawl through the scanner service — [Browser crawl](#browser-crawl) |
|
||||
|
||||
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 }, integrations }` |
|
||||
| Access | editor and up (`userMeetsRole`; without `access` every logged-in account), or `cookieScanner.access`; otherwise `403` |
|
||||
|
||||
The path is `COOKIE_SCAN_PATH` (`/ipal/cookie-scan`, under the API 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`), and read-only `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'` |
|
||||
| `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) |
|
||||
| `CookieCrawlAlert` (`/admin`) | the dashboard warning (injected with `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 })` | the e-mail, through `payload.sendEmail` |
|
||||
| `bearerMatches(header, token)` | constant-time bearer check |
|
||||
|
||||
Types: `CookieDeclaration`, `CookieIntegration`, `CookieScanContext`, `CookieFinding`,
|
||||
`CookieFindingSource`, `CookieStorage`, `LocalizedText`, `CookieScannerOptions`, `CookieScanSummary`,
|
||||
`CookieReviewValues`, `CookieDatabaseIndex`, `CookieScanLabels`, `OpenCookieCategory`,
|
||||
`CookieObservation`, `CookieReviewEntryRef`; 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 become **drafts**, edited text is kept, status is never changed, nothing is 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 new unknown cookies, or a failed crawl (`crawl.dashboard: false` turns it off) |
|
||||
| E-mail | opt-in per site: *Privacy → Cookie check → E-mail warnings to* (admin; comma-separated). Sent after a crawl with violations or new unknown cookies, 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 or unknown cookies then show on the dashboard and, when
|
||||
recipients are set, by e-mail.
|
||||
|
||||
### `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
|
||||
|
||||
- **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; Cookie banner → 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`; 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
@@ -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).
|
||||
|
||||
|
||||
+25
-23
@@ -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 Cookie banner → 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. **Cookie banner** — 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 Cookie banner → 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 | Cookie banner → 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,10 @@ 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 Cookie banner → 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 |
|
||||
|
||||
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 +669,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) |
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
# 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".
|
||||
- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
@@ -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
@@ -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.
|
||||
@@ -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
@@ -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
@@ -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 |
|
||||
|
||||
@@ -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
@@ -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
@@ -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).
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
+1
-1
@@ -363,7 +363,7 @@ 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).
|
||||
|
||||
|
||||
+31
-24
@@ -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
@@ -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 **Cookie banner → Cookie list** (panel):
|
||||
|
||||
| Name | Provider | Category | Purpose | Duration |
|
||||
|---|---|---|---|---|
|
||||
|
||||
+5
-5
@@ -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
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@intecion/ipal-kit",
|
||||
"version": "1.13.0",
|
||||
"version": "1.14.0",
|
||||
"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": {
|
||||
|
||||
Generated
+151
-493
File diff suppressed because it is too large
Load Diff
@@ -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)}`)
|
||||
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
*.md
|
||||
@@ -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"]
|
||||
@@ -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.
|
||||
@@ -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)
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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(/&/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
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -7,10 +7,15 @@
|
||||
*/
|
||||
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 { CookieScanButton } from '../modules/consent/scanner/CookieScanButton.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 { 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
@@ -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'
|
||||
|
||||
+3
-1
@@ -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'
|
||||
|
||||
@@ -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' },
|
||||
},
|
||||
]
|
||||
|
||||
@@ -15,9 +15,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: 'Cookie banner', pl: 'Baner cookies' },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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ęć' },
|
||||
}
|
||||
|
||||
@@ -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'),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -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'),
|
||||
]
|
||||
|
||||
@@ -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' },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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: '/' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -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' },
|
||||
}
|
||||
}
|
||||
|
||||
+85
-5
@@ -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,71 @@ 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 {
|
||||
addToCookieList,
|
||||
applyCookieFindings,
|
||||
bearerMatches,
|
||||
buildCookieCrawlEndpoints,
|
||||
buildCookieCrawlGlobal,
|
||||
buildCookieReviewCollection,
|
||||
buildCookieScanEndpoints,
|
||||
collectCookieFindings,
|
||||
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,
|
||||
DEFAULT_COOKIE_INTEGRATIONS,
|
||||
DEFAULT_DATABASE_CATEGORIES,
|
||||
DEFAULT_TRACKER_HOSTS,
|
||||
findCrawlViolations,
|
||||
finishCrawl,
|
||||
GOOGLE_TAG_HOSTS,
|
||||
indexCookieDatabase,
|
||||
ingestCrawlResult,
|
||||
loadCookieDatabase,
|
||||
lookupCookie,
|
||||
mergeCookieReview,
|
||||
mergeCookieScanLabels,
|
||||
parseCookieNames,
|
||||
parseCrawlResult,
|
||||
resolveCrawlConfig,
|
||||
runCookieScan,
|
||||
sendCrawlWarning,
|
||||
suggestionFor,
|
||||
} from './modules/consent/scanner/index.js'
|
||||
export type {
|
||||
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,12 +185,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 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).
|
||||
@@ -133,7 +209,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 +238,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,7 +253,7 @@ 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 { lexicalToMarkdown } from './modules/richtext/lexicalToMarkdown.js'
|
||||
export { buildSecurityHeaders, buildUploadSecurityHeaders } from './modules/security/index.js'
|
||||
export { buildCsp } from './modules/security/index.js'
|
||||
export type { BuildCspArgs } from './modules/security/index.js'
|
||||
@@ -212,7 +291,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'
|
||||
|
||||
@@ -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,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,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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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>),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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'
|
||||
@@ -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)
|
||||
@@ -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',
|
||||
},
|
||||
})
|
||||
@@ -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}}',
|
||||
},
|
||||
})
|
||||
@@ -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',
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,15 @@
|
||||
import { defineTexts } from '../define.js'
|
||||
|
||||
/** Admin component texts — settings. Placeholders use Payload's {{name}} syntax. */
|
||||
export const settingsTexts = defineTexts({
|
||||
en: {
|
||||
brandingCredit: 'Technology supported by Intecion.com',
|
||||
faviconNotSquare: 'The icon is not square ({{width}}×{{height}} px), so it may be cropped in tabs and search results.',
|
||||
faviconTooSmall: 'The icon is {{width}}×{{height}} px. Google shows icons of at least 48×48 px; upload a larger one.',
|
||||
},
|
||||
pl: {
|
||||
brandingCredit: 'Technologię wspiera Intecion.com',
|
||||
faviconNotSquare: 'Ikona nie jest kwadratowa ({{width}}×{{height}} px), więc może być przycięta na kartach i w wynikach wyszukiwania.',
|
||||
faviconTooSmall: 'Ikona ma {{width}}×{{height}} px. Google pokazuje ikony od 48×48 px; wgraj większą.',
|
||||
},
|
||||
})
|
||||
@@ -1,9 +1,16 @@
|
||||
'use client'
|
||||
import { useRowLabel } from '@payloadcms/ui'
|
||||
import { useRowLabel, useTranslation } from '@payloadcms/ui'
|
||||
|
||||
import type { AdminText } from '../admin-i18n/define.js'
|
||||
|
||||
import { ipalT } from '../admin-i18n/t.js'
|
||||
|
||||
export type RowLabelProps = {
|
||||
/** Shown with the row number when every path is empty, e.g. "Button" → "Button 02". */
|
||||
fallback?: string
|
||||
/**
|
||||
* Shown with the row number when every path is empty, e.g. "Button" → "Button 02".
|
||||
* A string or `{ en, pl }`; default "Item" in the admin language.
|
||||
*/
|
||||
fallback?: AdminText | Record<string, string> | string
|
||||
/** Dot paths inside the row, tried in order — the first non-empty text wins. */
|
||||
fields?: string[]
|
||||
}
|
||||
@@ -29,11 +36,18 @@ const toText = (v: unknown): string => {
|
||||
* "Fast delivery") instead of "Item 01", so an editor finds the right row
|
||||
* without expanding every one. Wire it with `rowLabel()`.
|
||||
*/
|
||||
export function RowLabel({ fallback = 'Item', fields = ['heading', 'title', 'label', 'link.label', 'name'] }: RowLabelProps) {
|
||||
export function RowLabel({ fallback, fields = ['heading', 'title', 'label', 'link.label', 'name'] }: RowLabelProps) {
|
||||
const { data, rowNumber } = useRowLabel<Record<string, unknown>>()
|
||||
const { i18n, t } = useTranslation()
|
||||
for (const f of fields) {
|
||||
const text = toText(at(data, f))
|
||||
if (text) {return <span>{text.length > 60 ? `${text.slice(0, 57)}…` : text}</span>}
|
||||
}
|
||||
return <span>{`${fallback} ${String((rowNumber ?? 0) + 1).padStart(2, '0')}`}</span>
|
||||
const name =
|
||||
typeof fallback === 'string'
|
||||
? fallback
|
||||
: fallback
|
||||
? ((fallback as Record<string, string>)[i18n.language] ?? fallback.en ?? Object.values(fallback)[0])
|
||||
: ipalT(t, 'rowLabelItem')
|
||||
return <span>{`${name} ${String((rowNumber ?? 0) + 1).padStart(2, '0')}`}</span>
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user