import type { CollectionSlug, Field, Plugin } from 'payload' /** * Factory shape of @clocklimited/payload-2fa's `payloadTotp` export — injected * so the plugin never imports the optional peer itself. `collection` is * `CollectionSlug` (not `string`): payloadTotp requires it, and in a project * with generated payload-types it's a narrowed union — `string` would make * `plugin: payloadTotp` fail to type-check. */ export type TotpPluginFactory = (options: { collection: CollectionSlug forceSetup: boolean totp: { issuer: string } }) => Plugin import type { AccessOption } from './modules/access/types.js' import type { ContentOption } from './modules/content/types.js' import type { FormsOption } from './modules/forms/types.js' import type { I18nConfig } from './modules/i18n/types.js' import type { PagesOption } from './modules/pages/types.js' import type { SeoOption } from './modules/seo/types.js' /** * Configuration options for the IPAL plugin. * Passed by the client project in payload.config.ts. */ export type IpalOptions = { /** * Role-based access control. Injects a fixed `roles` field * (admin > editor > user) into the client's auth collection. */ access?: AccessOption /** * Custom admin panel route, e.g. '/its' instead of the default '/admin'. * The plugin sets config.routes.admin. IMPORTANT: this alone isn't enough — * the project must ALSO move its panel folder to match: * app/(payload)/its/[[...segments]]/page.tsx (and the not-found). The plugin * can't create files in the project's app/. See docs/security.md. * * This is obscurity, not security: it hides the panel from dumb bots scanning * /admin, but real protection is strong auth + 2FA + rate limiting. */ adminRoute?: string /** * Collections whose entries live under an archive page — blog posts, case * studies, anything with a listing. Adds an "archive page" assignment per * collection in SiteSettings; the assigned page's localized slug becomes the * URL segment (/pl/artykuly/moj-post, /en/articles/my-post). Requires `pages`. */ content?: ContentOption /** Disable the plugin without uninstalling (keeps DB schema intact) */ enabled?: boolean /** * Forms — form-builder collections (forms, form-submissions) plus the * callable submitForm (Turnstile + persistence + SMTP-from-panel email). */ forms?: FormsOption /** Internationalization — locales, default locale, fallback behavior */ i18n: I18nConfig /** Additional fields injected into SiteIntegrations global */ integrationsFields?: Field[] /** * System-page assignments (homepage, privacy, cookies) in SiteSettings. * Provide the slug of the client's Pages collection to enable. */ pages?: PagesOption /** * SEO — adds meta fields to chosen collections (via @payloadcms/plugin-seo) * and enables locale-aware metadata helpers. */ seo?: SeoOption /** Additional fields injected into SiteSettings global */ siteSettingsFields?: Field[] /** * Two-factor authentication (TOTP), ENFORCED for every user. Wires * @clocklimited/payload-2fa with forceSetup — no per-project opt-out. Every * user must configure an authenticator app after login; TOTP is checked before * data access (not just the admin UI). Requires the peer dep installed and an * issuer name (shown in the authenticator app). * * Pass `false` ONLY for a project that genuinely can't use 2FA (rare, discouraged) * — default is enforced. See docs/security.md. */ twoFactor?: | { /** Auth collection slug. Defaults to 'users'. */ collectionSlug?: CollectionSlug /** Name shown in the authenticator app (e.g. company/site name). */ issuer: string /** * The 2FA plugin factory, INJECTED from the project: * `import { payloadTotp } from '@clocklimited/payload-2fa'`. REQUIRED in * Next — injecting it (the same pattern as NextResponse / revalidatePath) * means the plugin never dynamically imports the optional peer, which * Next can't bundle ("Cannot find module '@clocklimited/payload-2fa'", * even on public frontend pages). serverExternalPackages is no fix: the * package imports its own .css, which Node can't load. If omitted, the * plugin falls back to a dynamic import — works only outside Next * (payload CLI). See docs/security.md. */ plugin?: TotpPluginFactory } | false /** * White-label the admin panel: show the CLIENT's brand (logo + name) in the * admin — login screen and nav — pulled from SiteSettings, set by the editor * in the panel (no brand hardcoded in code). `true` wires it with defaults * (SiteSettings `logo`/`favicon`/`siteName`); the object form overrides the * global slug, field names, or the browser-tab title suffix. * * Injects admin.components.graphics.Logo/Icon pointing at * `@intecion/ipal-kit/admin`. After enabling, run `pnpm generate:importmap` * so Payload can resolve the components. See docs/white-label.md. */ whiteLabel?: | { /** * Vendor credit ("Technology by Intecion.com") at the bottom of the * admin nav. Default on; `false` hides it, or override text/url. */ credit?: | { text?: string url?: string } | boolean /** Upload field for the small nav icon. Default 'favicon'. */ iconField?: string /** Upload field for the login/nav logo. Default 'logo'. */ logoField?: string /** Field with the site name. Default 'siteName'. */ nameField?: string /** SiteSettings global slug. Default 'site-settings'. */ settingsSlug?: string /** Static browser-tab title suffix (e.g. ' · Acme Admin'). */ titleSuffix?: string } | boolean }