From 13d669b757f785855b92aef779e038d3bd9db543 Mon Sep 17 00:00:00 2001 From: rasm-its Date: Mon, 12 Oct 2026 12:47:28 +0200 Subject: [PATCH] fix(2fa): static import for @clocklimited/payload-2fa and @payload-config alias to prevent webpack runtime error --- dist/modules/branding/adminGraphics.js | 4 ++-- dist/modules/branding/adminGraphics.js.map | 2 +- dist/plugin.js | 4 ++-- dist/plugin.js.map | 2 +- package.json | 2 +- src/modules/branding/adminGraphics.tsx | 4 ++-- src/plugin.ts | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dist/modules/branding/adminGraphics.js b/dist/modules/branding/adminGraphics.js index c08b7c3..aa92492 100644 --- a/dist/modules/branding/adminGraphics.js +++ b/dist/modules/branding/adminGraphics.js @@ -3,8 +3,8 @@ import { getPayload } from 'payload'; async function loadBranding(settingsSlug, nameField, imageField) { try { // Consumer alias — resolved in the project's build, hidden from plugin tsc. - const spec = '@payload-config'; - const mod = await import(spec); + // @ts-ignore + const mod = await import('@payload-config'); const payload = await getPayload({ config: mod.default }); diff --git a/dist/modules/branding/adminGraphics.js.map b/dist/modules/branding/adminGraphics.js.map index 2b310c3..cd3c469 100644 --- a/dist/modules/branding/adminGraphics.js.map +++ b/dist/modules/branding/adminGraphics.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/modules/branding/adminGraphics.tsx"],"sourcesContent":["import { getPayload } from 'payload'\n\n/**\n * White-label admin branding: the Payload admin panel's logo (login + nav) and\n * icon, pulled from the project's SiteSettings so each client sees THEIR brand,\n * set by the editor in the panel — not hardcoded per project. Wired\n * automatically by `ipalKit({ whiteLabel: true })` (it injects\n * admin.components.graphics.Logo/Icon pointing here).\n *\n * Server Components — they read the SiteSettings global at render. Data access\n * uses the project's `@payload-config` alias (universal in Payload 3 Next apps),\n * loaded via a variable specifier so the PLUGIN's own typecheck doesn't try to\n * resolve it (same pattern as the optional 2FA import). Everything is wrapped in\n * try/catch: on the login screen before the DB is ready, or a build with no DB,\n * the component falls back to the site name text, then to null (Payload's own\n * default) — never throws, never blocks the panel.\n *\n * A0: no client brand in code. The logo/name come from the panel; if nothing is\n * set, nothing is forced.\n */\n\ntype BrandingProps = {\n /** SiteSettings global slug. Default 'site-settings'. */\n settingsSlug?: string\n /** Field holding the site name. Default 'siteName'. */\n nameField?: string\n /** Upload field to render as the image. Default 'logo' (Logo) / 'favicon' (Icon). */\n imageField?: string\n}\n\ntype MediaLike = { url?: string | null } | null | undefined\n\nasync function loadBranding(\n settingsSlug: string,\n nameField: string,\n imageField: string,\n): Promise<{ name: string | null; url: string | null }> {\n try {\n // Consumer alias — resolved in the project's build, hidden from plugin tsc.\n const spec = '@payload-config'\n const mod = (await import(spec)) as { default: unknown }\n const payload = await getPayload({ config: mod.default as never })\n const settings = (await payload.findGlobal({\n slug: settingsSlug as never,\n depth: 1,\n })) as Record\n\n const name = typeof settings[nameField] === 'string' ? (settings[nameField] as string) : null\n const image = settings[imageField] as MediaLike\n const url =\n image && typeof image === 'object' && typeof image.url === 'string' ? image.url : null\n return { name, url }\n } catch {\n return { name: null, url: null }\n }\n}\n\n/** Admin panel logo (login screen + nav). SiteSettings `logo`, falls back to `siteName`. */\nexport async function AdminLogo(props: BrandingProps = {}) {\n const { settingsSlug = 'site-settings', nameField = 'siteName', imageField = 'logo' } = props\n const { name, url } = await loadBranding(settingsSlug, nameField, imageField)\n if (url) {\n return (\n \n )\n }\n if (name) return
{name}
\n return null // nothing configured → Payload's default\n}\n\n/** Admin panel icon (small nav glyph). SiteSettings `favicon`, falls back to initials. */\nexport async function AdminIcon(props: BrandingProps = {}) {\n const { settingsSlug = 'site-settings', nameField = 'siteName', imageField = 'favicon' } = props\n const { name, url } = await loadBranding(settingsSlug, nameField, imageField)\n if (url) {\n return (\n \n )\n }\n if (name) return
{name.slice(0, 2).toUpperCase()}
\n return null\n}\n\n/**\n * Discreet vendor credit shown at the bottom of the admin nav: \"Technology by\n * Intecion.com\". This is the PLUGIN VENDOR's credit (Intecion ships ipal-kit),\n * not client data — so a sensible default here is fine and A0-safe. The client's\n * own brand still owns the logo/name above (AdminLogo); this is a small line\n * stating who provides the technology. Text/URL overridable; turn it off with\n * `whiteLabel: { credit: false }`.\n *\n * Wired by ipalKit into admin.components.afterNavLinks.\n */\nexport function IntecionCredit(props: { text?: string; url?: string } = {}) {\n const { text = 'Technology by Intecion.com', url = 'https://intecion.com' } = props\n return (\n \n {text}\n \n )\n}\n"],"names":["getPayload","loadBranding","settingsSlug","nameField","imageField","spec","mod","payload","config","default","settings","findGlobal","slug","depth","name","image","url","AdminLogo","props","img","src","alt","style","maxHeight","maxWidth","width","height","div","fontSize","fontWeight","AdminIcon","slice","toUpperCase","IntecionCredit","text","a","href","target","rel","display","padding","opacity","textDecoration"],"mappings":";AAAA,SAASA,UAAU,QAAQ,UAAS;AAgCpC,eAAeC,aACbC,YAAoB,EACpBC,SAAiB,EACjBC,UAAkB;IAElB,IAAI;QACF,4EAA4E;QAC5E,MAAMC,OAAO;QACb,MAAMC,MAAO,MAAM,MAAM,CAACD;QAC1B,MAAME,UAAU,MAAMP,WAAW;YAAEQ,QAAQF,IAAIG,OAAO;QAAU;QAChE,MAAMC,WAAY,MAAMH,QAAQI,UAAU,CAAC;YACzCC,MAAMV;YACNW,OAAO;QACT;QAEA,MAAMC,OAAO,OAAOJ,QAAQ,CAACP,UAAU,KAAK,WAAYO,QAAQ,CAACP,UAAU,GAAc;QACzF,MAAMY,QAAQL,QAAQ,CAACN,WAAW;QAClC,MAAMY,MACJD,SAAS,OAAOA,UAAU,YAAY,OAAOA,MAAMC,GAAG,KAAK,WAAWD,MAAMC,GAAG,GAAG;QACpF,OAAO;YAAEF;YAAME;QAAI;IACrB,EAAE,OAAM;QACN,OAAO;YAAEF,MAAM;YAAME,KAAK;QAAK;IACjC;AACF;AAEA,0FAA0F,GAC1F,OAAO,eAAeC,UAAUC,QAAuB,CAAC,CAAC;IACvD,MAAM,EAAEhB,eAAe,eAAe,EAAEC,YAAY,UAAU,EAAEC,aAAa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raphics.tsx"],"sourcesContent":["import { getPayload } from 'payload'\n\n/**\n * White-label admin branding: the Payload admin panel's logo (login + nav) and\n * icon, pulled from the project's SiteSettings so each client sees THEIR brand,\n * set by the editor in the panel — not hardcoded per project. Wired\n * automatically by `ipalKit({ whiteLabel: true })` (it injects\n * admin.components.graphics.Logo/Icon pointing here).\n *\n * Server Components — they read the SiteSettings global at render. Data access\n * uses the project's `@payload-config` alias (universal in Payload 3 Next apps),\n * loaded via a variable specifier so the PLUGIN's own typecheck doesn't try to\n * resolve it (same pattern as the optional 2FA import). Everything is wrapped in\n * try/catch: on the login screen before the DB is ready, or a build with no DB,\n * the component falls back to the site name text, then to null (Payload's own\n * default) — never throws, never blocks the panel.\n *\n * A0: no client brand in code. The logo/name come from the panel; if nothing is\n * set, nothing is forced.\n */\n\ntype BrandingProps = {\n /** SiteSettings global slug. Default 'site-settings'. */\n settingsSlug?: string\n /** Field holding the site name. Default 'siteName'. */\n nameField?: string\n /** Upload field to render as the image. Default 'logo' (Logo) / 'favicon' (Icon). */\n imageField?: string\n}\n\ntype MediaLike = { url?: string | null } | null | undefined\n\nasync function loadBranding(\n settingsSlug: string,\n nameField: string,\n imageField: string,\n): Promise<{ name: string | null; url: string | null }> {\n try {\n // Consumer alias — resolved in the project's build, hidden from plugin tsc.\n // @ts-ignore\n const mod = (await import('@payload-config')) as { default: unknown }\n const payload = await getPayload({ config: mod.default as never })\n const settings = (await payload.findGlobal({\n slug: settingsSlug as never,\n depth: 1,\n })) as Record\n\n const name = typeof settings[nameField] === 'string' ? (settings[nameField] as string) : null\n const image = settings[imageField] as MediaLike\n const url =\n image && typeof image === 'object' && typeof image.url === 'string' ? image.url : null\n return { name, url }\n } catch {\n return { name: null, url: null }\n }\n}\n\n/** Admin panel logo (login screen + nav). SiteSettings `logo`, falls back to `siteName`. */\nexport async function AdminLogo(props: BrandingProps = {}) {\n const { settingsSlug = 'site-settings', nameField = 'siteName', imageField = 'logo' } = props\n const { name, url } = await loadBranding(settingsSlug, nameField, imageField)\n if (url) {\n return (\n \n )\n }\n if (name) return
{name}
\n return null // nothing configured → Payload's default\n}\n\n/** Admin panel icon (small nav glyph). SiteSettings `favicon`, falls back to initials. */\nexport async function AdminIcon(props: BrandingProps = {}) {\n const { settingsSlug = 'site-settings', nameField = 'siteName', imageField = 'favicon' } = props\n const { name, url } = await loadBranding(settingsSlug, nameField, imageField)\n if (url) {\n return (\n \n )\n }\n if (name) return
{name.slice(0, 2).toUpperCase()}
\n return null\n}\n\n/**\n * Discreet vendor credit shown at the bottom of the admin nav: \"Technology by\n * Intecion.com\". This is the PLUGIN VENDOR's credit (Intecion ships ipal-kit),\n * not client data — so a sensible default here is fine and A0-safe. The client's\n * own brand still owns the logo/name above (AdminLogo); this is a small line\n * stating who provides the technology. Text/URL overridable; turn it off with\n * `whiteLabel: { credit: false }`.\n *\n * Wired by ipalKit into admin.components.afterNavLinks.\n */\nexport function IntecionCredit(props: { text?: string; url?: string } = {}) {\n const { text = 'Technology by Intecion.com', url = 'https://intecion.com' } = props\n return (\n \n {text}\n \n )\n}\n"],"names":["getPayload","loadBranding","settingsSlug","nameField","imageField","mod","payload","config","default","settings","findGlobal","slug","depth","name","image","url","AdminLogo","props","img","src","alt","style","maxHeight","maxWidth","width","height","div","fontSize","fontWeight","AdminIcon","slice","toUpperCase","IntecionCredit","text","a","href","target","rel","display","padding","opacity","textDecoration"],"mappings":";AAAA,SAASA,UAAU,QAAQ,UAAS;AAgCpC,eAAeC,aACbC,YAAoB,EACpBC,SAAiB,EACjBC,UAAkB;IAElB,IAAI;QACF,4EAA4E;QAC5E,aAAa;QACb,MAAMC,MAAO,MAAM,MAAM,CAAC;QAC1B,MAAMC,UAAU,MAAMN,WAAW;YAAEO,QAAQF,IAAIG,OAAO;QAAU;QAChE,MAAMC,WAAY,MAAMH,QAAQI,UAAU,CAAC;YACzCC,MAAMT;YACNU,OAAO;QACT;QAEA,MAAMC,OAAO,OAAOJ,QAAQ,CAACN,UAAU,KAAK,WAAY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KiB,KAAK,CAAC,GAAG,GAAGC,WAAW;;IAC/E,OAAO;AACT;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASC,eAAef,QAAyC,CAAC,CAAC;IACxE,MAAM,EAAEgB,OAAO,4BAA4B,EAAElB,MAAM,sBAAsB,EAAE,GAAGE;IAC9E,qBACE,KAACiB;QACCC,MAAMpB;QACNqB,QAAO;QACPC,KAAI;QACJhB,OAAO;YACLiB,SAAS;YACTC,SAAS;YACTZ,UAAU;YACVa,SAAS;YACTC,gBAAgB;QAClB;kBAECR;;AAGP"} \ No newline at end of file diff --git a/dist/plugin.js b/dist/plugin.js index e6078db..5f71915 100644 --- a/dist/plugin.js +++ b/dist/plugin.js @@ -67,8 +67,8 @@ import { buildSeoPlugin, injectAutoFillMeta, injectSeoTabs } from './modules/seo // optional peer dependency at build time (it isn't in the plugin's own // node_modules). Avoids TS2307 without @ts-expect-error; the module // exists at runtime in projects that installed it. - const pkg = '@clocklimited/payload-2fa'; - const mod = await import(pkg); + // @ts-ignore + const mod = await import('@clocklimited/payload-2fa'); // The package exports `payloadTotp`; older/other builds may use // `totpPlugin`. Accept either so a rename doesn't break us. const totp = mod.payloadTotp ?? mod.totpPlugin; diff --git a/dist/plugin.js.map b/dist/plugin.js.map index a714ce3..cb5bb75 100644 --- a/dist/plugin.js.map +++ b/dist/plugin.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type { Config, Plugin } from 'payload'\n\nimport type { IpalOptions } from './types.js'\n\nimport { buildCookieSettings } from './globals/CookieSettings/index.js'\nimport { buildNotifications } from './globals/Notifications/index.js'\nimport { buildSiteIntegrations } from './globals/SiteIntegrations/index.js'\nimport { buildSiteSettings } from './globals/SiteSettings/index.js'\nimport { injectRoles } from './modules/access/index.js'\nimport { buildArchiveFields } from './modules/content/index.js'\nimport { testEmailEndpoint } from './modules/email/test/testEmailEndpoint.js'\nimport { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'\nimport { buildLocalizationConfig, validateI18nConfig } from './modules/i18n/index.js'\nimport { buildSystemPagesFields } from './modules/pages/index.js'\nimport { buildSeoPlugin, injectAutoFillMeta, injectSeoTabs } from './modules/seo/index.js'\n\n/**\n * IPAL (Intecion Payload Advanced Library) plugin for Payload CMS 3.\n *\n * @example\n * ```ts\n * import { ipalKit } from 'ipal-kit'\n *\n * export default buildConfig({\n * plugins: [\n * ipalKit({\n * i18n: {\n * locales: [\n * { code: 'pl', label: 'Polski' },\n * { code: 'en', label: 'English' },\n * ],\n * defaultLocale: 'pl',\n * },\n * access: { authCollection: 'users' },\n * }),\n * ],\n * })\n * ```\n */\nexport const ipalKit = (options: IpalOptions): Plugin => {\n // Validate eagerly — fail fast before Payload boots\n validateI18nConfig(options.i18n)\n\n return async (incomingConfig: Config): Promise => {\n // Early return when disabled — schema stays, behavior off\n if (options.enabled === false) {\n return incomingConfig\n }\n\n let config = { ...incomingConfig }\n\n // --- custom admin route (e.g. '/its' instead of '/admin') ---\n // Sets config.routes.admin; the project must move its app/(payload)//\n // folder to match (plugin can't create files in the project's app/).\n if (options.adminRoute) {\n config.routes = { ...(config.routes ?? {}), admin: options.adminRoute }\n }\n\n // --- enforced 2FA (TOTP) via @clocklimited/payload-2fa ---\n // Enforced by default (forceSetup) unless twoFactor is explicitly false. The\n // plugin is a PEER dependency imported dynamically — ipal-kit doesn't bundle\n // it, so projects that opt out (twoFactor: false) needn't install it, and the\n // import never runs under generate:importmap when 2FA is off. Wrapping access\n // control (not just admin UI) means TOTP gates data access — no API bypass.\n if (options.twoFactor !== false) {\n const tf = options.twoFactor\n if (!tf?.issuer) {\n throw new Error(\n '[ipal] twoFactor.issuer is required (name shown in the authenticator ' +\n 'app). Pass twoFactor: { issuer: \"Your Site\" }, or twoFactor: false to ' +\n 'opt out (discouraged).',\n )\n }\n try {\n // Dynamic specifier via a variable so TS doesn't try to resolve this\n // optional peer dependency at build time (it isn't in the plugin's own\n // node_modules). Avoids TS2307 without @ts-expect-error; the module\n // exists at runtime in projects that installed it.\n const pkg = '@clocklimited/payload-2fa'\n const mod = (await import(pkg)) as {\n payloadTotp?: (opts: Record) => Plugin\n totpPlugin?: (opts: Record) => Plugin\n }\n // The package exports `payloadTotp`; older/other builds may use\n // `totpPlugin`. Accept either so a rename doesn't break us.\n const totp = mod.payloadTotp ?? mod.totpPlugin\n if (typeof totp !== 'function') {\n throw new Error(\n 'expected export payloadTotp (or totpPlugin) to be a function — ' +\n 'check the installed @clocklimited/payload-2fa version',\n )\n }\n config = await totp({\n collection: tf.collectionSlug ?? 'users',\n forceSetup: true, // ENFORCED — every user must set up TOTP; no opt-out\n totp: { issuer: tf.issuer },\n })(config)\n } catch (err) {\n throw new Error(\n '[ipal] 2FA is enforced but @clocklimited/payload-2fa is not installed. ' +\n 'Run: pnpm add @clocklimited/payload-2fa — or set twoFactor: false to ' +\n `opt out (discouraged). Original error: ${String(err)}`,\n )\n }\n }\n\n // --- white-label admin branding ---\n // Inject admin.components.graphics.Logo/Icon pointing at the plugin's\n // /admin export. The components read SiteSettings at render, so each client\n // sees their own brand from the panel (no brand in code). Project must run\n // `pnpm generate:importmap` so Payload resolves the component paths.\n if (options.whiteLabel) {\n const wl = options.whiteLabel === true ? {} : options.whiteLabel\n const serverProps: Record = {}\n if (wl.settingsSlug) {serverProps.settingsSlug = wl.settingsSlug}\n if (wl.nameField) {serverProps.nameField = wl.nameField}\n const logoProps = { ...serverProps, ...(wl.logoField ? { imageField: wl.logoField } : {}) }\n const iconProps = { ...serverProps, ...(wl.iconField ? { imageField: wl.iconField } : {}) }\n\n // Vendor credit (\"Technology by Intecion.com\") under the nav — on by\n // default, hidden with credit:false, text/url overridable.\n const creditOn = wl.credit !== false\n const creditProps =\n wl.credit && typeof wl.credit === 'object'\n ? {\n ...(wl.credit.text ? { text: wl.credit.text } : {}),\n ...(wl.credit.url ? { url: wl.credit.url } : {}),\n }\n : {}\n\n config.admin = {\n ...(config.admin ?? {}),\n components: {\n ...(config.admin?.components ?? {}),\n graphics: {\n ...(config.admin?.components?.graphics ?? {}),\n Icon: { path: '@intecion/ipal-kit/admin#AdminIcon', serverProps: iconProps },\n Logo: { path: '@intecion/ipal-kit/admin#AdminLogo', serverProps: logoProps },\n },\n ...(creditOn\n ? {\n afterNavLinks: [\n ...(config.admin?.components?.afterNavLinks ?? []),\n { path: '@intecion/ipal-kit/admin#IntecionCredit', serverProps: creditProps },\n ],\n }\n : {}),\n },\n ...(wl.titleSuffix\n ? { meta: { ...(config.admin?.meta ?? {}), titleSuffix: wl.titleSuffix } }\n : {}),\n }\n }\n\n // --- i18n ---\n config.localization = buildLocalizationConfig(options.i18n)\n\n // --- access: inject roles into the client's auth collection ---\n if (options.access) {\n config = injectRoles(config, options.access)\n }\n\n // --- seo: apply @payloadcms/plugin-seo directly ---\n // NOTE: apply the plugin function to the config immediately rather than\n // pushing it onto config.plugins. Payload has already iterated the plugins\n // array by the time IPAL runs, so nested plugins added to that list are\n // never executed. Calling the plugin as (config) => config applies its\n // transform now.\n if (options.seo) {\n config = await buildSeoPlugin({ seo: options.seo })(config)\n // Auto-fill empty meta from document content on save\n config = injectAutoFillMeta(config, options.seo)\n // Wrap fields into Content + SEO tabs (replaces plugin-seo's tabbedUI,\n // which breaks when other fields already exist in the collection)\n config = injectSeoTabs(config, options.seo)\n }\n\n // --- forms: apply @payloadcms/plugin-form-builder directly ---\n if (options.forms) {\n config = await buildFormsPlugin(options.forms)(config)\n }\n\n // --- globals ---\n // The System Pages tab collects every \"which page plays this role\"\n // assignment. Composing it here keeps SiteSettings unaware of which modules\n // are enabled — it just renders the fields it's given.\n const systemPageFields = [\n ...(options.pages ? buildSystemPagesFields(options.pages) : []),\n ...(options.content && options.pages\n ? buildArchiveFields(options.content, options.pages.slug)\n : []),\n ]\n\n config.globals = [\n ...(config.globals ?? []),\n buildSiteSettings({\n additionalFields: options.siteSettingsFields,\n systemPageFields,\n }),\n buildSiteIntegrations({ additionalFields: options.integrationsFields }),\n buildCookieSettings(),\n buildNotifications(),\n ]\n\n config.endpoints = [...(config.endpoints ?? []), testEmailEndpoint]\n\n // --- hooks: onInit ---\n const incomingOnInit = config.onInit\n config.onInit = async (payload) => {\n if (incomingOnInit) {await incomingOnInit(payload)}\n payload.logger.info('[ipal] Plugin initialized.')\n }\n\n return config\n }\n}\n"],"names":["buildCookieSettings","buildNotifications","buildSiteIntegrations","buildSiteSettings","injectRoles","buildArchiveFields","testEmailEndpoint","buildFormsPlugin","buildLocalizationConfig","validateI18nConfig","buildSystemPagesFields","buildSeoPlugin","injectAutoFillMeta","injectSeoTabs","ipalKit","options","i18n","incomingConfig","enabled","config","adminRoute","routes","admin","twoFactor","tf","issuer","Error","pkg","mod","totp","payloadTotp","totpPlugin","collection","collectionSlug","forceSetup","err","String","whiteLabel","wl","serverProps","settingsSlug","nameField","logoProps","logoField","imageField","iconProps","iconField","creditOn","credit","creditProps","text","url","components","graphics","Icon","path","Logo","afterNavLinks","titleSuffix","meta","localization","access","seo","forms","systemPageFields","pages","content","slug","globals","additionalFields","siteSettingsFields","integrationsFields","endpoints","incomingOnInit","onInit","payload","logger","info"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,oCAAmC;AACvE,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,qBAAqB,QAAQ,sCAAqC;AAC3E,SAASC,iBAAiB,QAAQ,kCAAiC;AACnE,SAASC,WAAW,QAAQ,4BAA2B;AACvD,SAASC,kBAAkB,QAAQ,6BAA4B;AAC/D,SAASC,iBAAiB,QAAQ,4CAA2C;AAC7E,SAASC,gBAAgB,QAAQ,uCAAsC;AACvE,SAASC,uBAAuB,EAAEC,kBAAkB,QAAQ,0BAAyB;AACrF,SAASC,sBAAsB,QAAQ,2BAA0B;AACjE,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,aAAa,QAAQ,yBAAwB;AAE1F;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,MAAMC,UAAU,CAACC;IACtB,oDAAoD;IACpDN,mBAAmBM,QAAQC,IA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AACE,IAAI,IACtD,EAAE;SACP;QAEDhD,OAAOiD,OAAO,GAAG;eACXjD,OAAOiD,OAAO,IAAI,EAAE;YACxBjE,kBAAkB;gBAChBkE,kBAAkBtD,QAAQuD,kBAAkB;gBAC5CN;YACF;YACA9D,sBAAsB;gBAAEmE,kBAAkBtD,QAAQwD,kBAAkB;YAAC;YACrEvE;YACAC;SACD;QAEDkB,OAAOqD,SAAS,GAAG;eAAKrD,OAAOqD,SAAS,IAAI,EAAE;YAAGlE;SAAkB;QAEnE,wBAAwB;QACxB,MAAMmE,iBAAiBtD,OAAOuD,MAAM;QACpCvD,OAAOuD,MAAM,GAAG,OAAOC;YACrB,IAAIF,gBAAgB;gBAAC,MAAMA,eAAeE;YAAQ;YAClDA,QAAQC,MAAM,CAACC,IAAI,CAAC;QACtB;QAEA,OAAO1D;IACT;AACF,EAAC"} \ No newline at end of file +{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type { Config, Plugin } from 'payload'\n\nimport type { IpalOptions } from './types.js'\n\nimport { buildCookieSettings } from './globals/CookieSettings/index.js'\nimport { buildNotifications } from './globals/Notifications/index.js'\nimport { buildSiteIntegrations } from './globals/SiteIntegrations/index.js'\nimport { buildSiteSettings } from './globals/SiteSettings/index.js'\nimport { injectRoles } from './modules/access/index.js'\nimport { buildArchiveFields } from './modules/content/index.js'\nimport { testEmailEndpoint } from './modules/email/test/testEmailEndpoint.js'\nimport { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'\nimport { buildLocalizationConfig, validateI18nConfig } from './modules/i18n/index.js'\nimport { buildSystemPagesFields } from './modules/pages/index.js'\nimport { buildSeoPlugin, injectAutoFillMeta, injectSeoTabs } from './modules/seo/index.js'\n\n/**\n * IPAL (Intecion Payload Advanced Library) plugin for Payload CMS 3.\n *\n * @example\n * ```ts\n * import { ipalKit } from 'ipal-kit'\n *\n * export default buildConfig({\n * plugins: [\n * ipalKit({\n * i18n: {\n * locales: [\n * { code: 'pl', label: 'Polski' },\n * { code: 'en', label: 'English' },\n * ],\n * defaultLocale: 'pl',\n * },\n * access: { authCollection: 'users' },\n * }),\n * ],\n * })\n * ```\n */\nexport const ipalKit = (options: IpalOptions): Plugin => {\n // Validate eagerly — fail fast before Payload boots\n validateI18nConfig(options.i18n)\n\n return async (incomingConfig: Config): Promise => {\n // Early return when disabled — schema stays, behavior off\n if (options.enabled === false) {\n return incomingConfig\n }\n\n let config = { ...incomingConfig }\n\n // --- custom admin route (e.g. '/its' instead of '/admin') ---\n // Sets config.routes.admin; the project must move its app/(payload)//\n // folder to match (plugin can't create files in the project's app/).\n if (options.adminRoute) {\n config.routes = { ...(config.routes ?? {}), admin: options.adminRoute }\n }\n\n // --- enforced 2FA (TOTP) via @clocklimited/payload-2fa ---\n // Enforced by default (forceSetup) unless twoFactor is explicitly false. The\n // plugin is a PEER dependency imported dynamically — ipal-kit doesn't bundle\n // it, so projects that opt out (twoFactor: false) needn't install it, and the\n // import never runs under generate:importmap when 2FA is off. Wrapping access\n // control (not just admin UI) means TOTP gates data access — no API bypass.\n if (options.twoFactor !== false) {\n const tf = options.twoFactor\n if (!tf?.issuer) {\n throw new Error(\n '[ipal] twoFactor.issuer is required (name shown in the authenticator ' +\n 'app). Pass twoFactor: { issuer: \"Your Site\" }, or twoFactor: false to ' +\n 'opt out (discouraged).',\n )\n }\n try {\n // Dynamic specifier via a variable so TS doesn't try to resolve this\n // optional peer dependency at build time (it isn't in the plugin's own\n // node_modules). Avoids TS2307 without @ts-expect-error; the module\n // exists at runtime in projects that installed it.\n // @ts-ignore\n const mod = (await import('@clocklimited/payload-2fa')) as {\n payloadTotp?: (opts: Record) => Plugin\n totpPlugin?: (opts: Record) => Plugin\n }\n // The package exports `payloadTotp`; older/other builds may use\n // `totpPlugin`. Accept either so a rename doesn't break us.\n const totp = mod.payloadTotp ?? mod.totpPlugin\n if (typeof totp !== 'function') {\n throw new Error(\n 'expected export payloadTotp (or totpPlugin) to be a function — ' +\n 'check the installed @clocklimited/payload-2fa version',\n )\n }\n config = await totp({\n collection: tf.collectionSlug ?? 'users',\n forceSetup: true, // ENFORCED — every user must set up TOTP; no opt-out\n totp: { issuer: tf.issuer },\n })(config)\n } catch (err) {\n throw new Error(\n '[ipal] 2FA is enforced but @clocklimited/payload-2fa is not installed. ' +\n 'Run: pnpm add @clocklimited/payload-2fa — or set twoFactor: false to ' +\n `opt out (discouraged). Original error: ${String(err)}`,\n )\n }\n }\n\n // --- white-label admin branding ---\n // Inject admin.components.graphics.Logo/Icon pointing at the plugin's\n // /admin export. The components read SiteSettings at render, so each client\n // sees their own brand from the panel (no brand in code). Project must run\n // `pnpm generate:importmap` so Payload resolves the component paths.\n if (options.whiteLabel) {\n const wl = options.whiteLabel === true ? {} : options.whiteLabel\n const serverProps: Record = {}\n if (wl.settingsSlug) {serverProps.settingsSlug = wl.settingsSlug}\n if (wl.nameField) {serverProps.nameField = wl.nameField}\n const logoProps = { ...serverProps, ...(wl.logoField ? { imageField: wl.logoField } : {}) }\n const iconProps = { ...serverProps, ...(wl.iconField ? { imageField: wl.iconField } : {}) }\n\n // Vendor credit (\"Technology by Intecion.com\") under the nav — on by\n // default, hidden with credit:false, text/url overridable.\n const creditOn = wl.credit !== false\n const creditProps =\n wl.credit && typeof wl.credit === 'object'\n ? {\n ...(wl.credit.text ? { text: wl.credit.text } : {}),\n ...(wl.credit.url ? { url: wl.credit.url } : {}),\n }\n : {}\n\n config.admin = {\n ...(config.admin ?? {}),\n components: {\n ...(config.admin?.components ?? {}),\n graphics: {\n ...(config.admin?.components?.graphics ?? {}),\n Icon: { path: '@intecion/ipal-kit/admin#AdminIcon', serverProps: iconProps },\n Logo: { path: '@intecion/ipal-kit/admin#AdminLogo', serverProps: logoProps },\n },\n ...(creditOn\n ? {\n afterNavLinks: [\n ...(config.admin?.components?.afterNavLinks ?? []),\n { path: '@intecion/ipal-kit/admin#IntecionCredit', serverProps: creditProps },\n ],\n }\n : {}),\n },\n ...(wl.titleSuffix\n ? { meta: { ...(config.admin?.meta ?? {}), titleSuffix: wl.titleSuffix } }\n : {}),\n }\n }\n\n // --- i18n ---\n config.localization = buildLocalizationConfig(options.i18n)\n\n // --- access: inject roles into the client's auth collection ---\n if (options.access) {\n config = injectRoles(config, options.access)\n }\n\n // --- seo: apply @payloadcms/plugin-seo directly ---\n // NOTE: apply the plugin function to the config immediately rather than\n // pushing it onto config.plugins. Payload has already iterated the plugins\n // array by the time IPAL runs, so nested plugins added to that list are\n // never executed. Calling the plugin as (config) => config applies its\n // transform now.\n if (options.seo) {\n config = await buildSeoPlugin({ seo: options.seo })(config)\n // Auto-fill empty meta from document content on save\n config = injectAutoFillMeta(config, options.seo)\n // Wrap fields into Content + SEO tabs (replaces plugin-seo's tabbedUI,\n // which breaks when other fields already exist in the collection)\n config = injectSeoTabs(config, options.seo)\n }\n\n // --- forms: apply @payloadcms/plugin-form-builder directly ---\n if (options.forms) {\n config = await buildFormsPlugin(options.forms)(config)\n }\n\n // --- globals ---\n // The System Pages tab collects every \"which page plays this role\"\n // assignment. Composing it here keeps SiteSettings unaware of which modules\n // are enabled — it just renders the fields it's given.\n const systemPageFields = [\n ...(options.pages ? buildSystemPagesFields(options.pages) : []),\n ...(options.content && options.pages\n ? buildArchiveFields(options.content, options.pages.slug)\n : []),\n ]\n\n config.globals = [\n ...(config.globals ?? []),\n buildSiteSettings({\n additionalFields: options.siteSettingsFields,\n systemPageFields,\n }),\n buildSiteIntegrations({ additionalFields: options.integrationsFields }),\n buildCookieSettings(),\n buildNotifications(),\n ]\n\n config.endpoints = [...(config.endpoints ?? []), testEmailEndpoint]\n\n // --- hooks: onInit ---\n const incomingOnInit = config.onInit\n config.onInit = async (payload) => {\n if (incomingOnInit) {await incomingOnInit(payload)}\n payload.logger.info('[ipal] Plugin initialized.')\n }\n\n return config\n }\n}\n"],"names":["buildCookieSettings","buildNotifications","buildSiteIntegrations","buildSiteSettings","injectRoles","buildArchiveFields","testEmailEndpoint","buildFormsPlugin","buildLocalizationConfig","validateI18nConfig","buildSystemPagesFields","buildSeoPlugin","injectAutoFillMeta","injectSeoTabs","ipalKit","options","i18n","incomingConfig","enabled","config","adminRoute","routes","admin","twoFactor","tf","issuer","Error","mod","totp","payloadTotp","totpPlugin","collection","collectionSlug","forceSetup","err","String","whiteLabel","wl","serverProps","settingsSlug","nameField","logoProps","logoField","imageField","iconProps","iconField","creditOn","credit","creditProps","text","url","components","graphics","Icon","path","Logo","afterNavLinks","titleSuffix","meta","localization","access","seo","forms","systemPageFields","pages","content","slug","globals","additionalFields","siteSettingsFields","integrationsFields","endpoints","incomingOnInit","onInit","payload","logger","info"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,oCAAmC;AACvE,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,qBAAqB,QAAQ,sCAAqC;AAC3E,SAASC,iBAAiB,QAAQ,kCAAiC;AACnE,SAASC,WAAW,QAAQ,4BAA2B;AACvD,SAASC,kBAAkB,QAAQ,6BAA4B;AAC/D,SAASC,iBAAiB,QAAQ,4CAA2C;AAC7E,SAASC,gBAAgB,QAAQ,uCAAsC;AACvE,SAASC,uBAAuB,EAAEC,kBAAkB,QAAQ,0BAAyB;AACrF,SAASC,sBAAsB,QAAQ,2BAA0B;AACjE,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,aAAa,QAAQ,yBAAwB;AAE1F;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,MAAMC,UAAU,CAACC;IACtB,oDAAoD;IACpDN,mBAAmBM,QAAQC,IAAI;IAE/B,OAAO,OAAOC;QACZ,0DAA0D;QAC1D,IAAIF,QAAQG,OAAO,KAAK,OAAO;YAC7B,OAAOD;QACT;QAEA,IAAIE,SAAS;YAAE,GAAGF,cAAc;QAAC;QAEjC,+DAA+D;QAC/D,6EAA6E;QAC7E,qEAAqE;QACrE,IAAIF,QAAQK,UAAU,EAAE;YACtBD,OAAOE,MAAM,GAAG;gBAAE,GAAIF,OAAOE,MAAM,IAAI,CAAC,CAAC;gBAAGC,OAAOP,Q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nE,wBAAwB;QACxB,MAAMkE,iBAAiBrD,OAAOsD,MAAM;QACpCtD,OAAOsD,MAAM,GAAG,OAAOC;YACrB,IAAIF,gBAAgB;gBAAC,MAAMA,eAAeE;YAAQ;YAClDA,QAAQC,MAAM,CAACC,IAAI,CAAC;QACtB;QAEA,OAAOzD;IACT;AACF,EAAC"} \ No newline at end of file diff --git a/package.json b/package.json index cf00785..decd366 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@intecion/ipal-kit", - "version": "1.7.2", + "version": "1.7.3", "description": "Intecion Payload Advanced Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.", "license": "MIT", "repository": { diff --git a/src/modules/branding/adminGraphics.tsx b/src/modules/branding/adminGraphics.tsx index 3aa7346..7d94b57 100644 --- a/src/modules/branding/adminGraphics.tsx +++ b/src/modules/branding/adminGraphics.tsx @@ -37,8 +37,8 @@ async function loadBranding( ): Promise<{ name: string | null; url: string | null }> { try { // Consumer alias — resolved in the project's build, hidden from plugin tsc. - const spec = '@payload-config' - const mod = (await import(spec)) as { default: unknown } + // @ts-ignore + const mod = (await import('@payload-config')) as { default: unknown } const payload = await getPayload({ config: mod.default as never }) const settings = (await payload.findGlobal({ slug: settingsSlug as never, diff --git a/src/plugin.ts b/src/plugin.ts index 2bd530b..841066b 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -76,8 +76,8 @@ export const ipalKit = (options: IpalOptions): Plugin => { // optional peer dependency at build time (it isn't in the plugin's own // node_modules). Avoids TS2307 without @ts-expect-error; the module // exists at runtime in projects that installed it. - const pkg = '@clocklimited/payload-2fa' - const mod = (await import(pkg)) as { + // @ts-ignore + const mod = (await import('@clocklimited/payload-2fa')) as { payloadTotp?: (opts: Record) => Plugin totpPlugin?: (opts: Record) => Plugin }