diff --git a/dist/exports/admin.d.ts b/dist/exports/admin.d.ts
index 58eeac4..54da71a 100644
--- a/dist/exports/admin.d.ts
+++ b/dist/exports/admin.d.ts
@@ -1,4 +1,3 @@
-export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
/**
* Entry point: @intecion/ipal-kit/admin
*
@@ -6,5 +5,6 @@ export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
* importMap can resolve them by a stable path when ipalKit injects
* admin.components.graphics.Logo/Icon.
*/
-export { AdminIcon, AdminLogo, IntecionCredit } from '../modules/branding/index.js';
+export { AdminLogo, AdminIcon, IntecionCredit } from '../modules/branding/index.js';
+export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
export { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js';
diff --git a/dist/exports/admin.js b/dist/exports/admin.js
index 16945eb..bfc7aac 100644
--- a/dist/exports/admin.js
+++ b/dist/exports/admin.js
@@ -1,11 +1,11 @@
-export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
/**
* Entry point: @intecion/ipal-kit/admin
*
* Admin-panel UI components (white-label branding, array row labels). Separate export so Payload's
* importMap can resolve them by a stable path when ipalKit injects
* admin.components.graphics.Logo/Icon.
- */ export { AdminIcon, AdminLogo, IntecionCredit } from '../modules/branding/index.js';
+ */ export { AdminLogo, AdminIcon, IntecionCredit } from '../modules/branding/index.js';
+export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
export { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js';
//# sourceMappingURL=admin.js.map
\ No newline at end of file
diff --git a/dist/exports/admin.js.map b/dist/exports/admin.js.map
index d62c221..388002d 100644
--- a/dist/exports/admin.js.map
+++ b/dist/exports/admin.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/exports/admin.ts"],"sourcesContent":["export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js'\n/**\n * Entry point: @intecion/ipal-kit/admin\n *\n * Admin-panel UI components (white-label branding, array row labels). Separate export so Payload's\n * importMap can resolve them by a stable path when ipalKit injects\n * admin.components.graphics.Logo/Icon.\n */\nexport { AdminIcon, AdminLogo, IntecionCredit } from '../modules/branding/index.js'\nexport { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js'\n"],"names":["RowLabel","AdminIcon","AdminLogo","IntecionCredit","IntegrationAlerts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,2CAA0C;AACnE;;;;;;CAMC,GACD,SAASC,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ,+BAA8B;AACnF,SAASC,iBAAiB,QAAQ,+CAA8C"}
\ No newline at end of file
+{"version":3,"sources":["../../src/exports/admin.ts"],"sourcesContent":["/**\n * Entry point: @intecion/ipal-kit/admin\n *\n * Admin-panel UI components (white-label branding, array row labels). Separate export so Payload's\n * importMap can resolve them by a stable path when ipalKit injects\n * admin.components.graphics.Logo/Icon.\n */\nexport { AdminLogo, AdminIcon, IntecionCredit } from '../modules/branding/index.js'\nexport { RowLabel } from '../modules/admin-ui/RowLabelComponent.js'\nexport { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js'\n"],"names":["AdminLogo","AdminIcon","IntecionCredit","RowLabel","IntegrationAlerts"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ,+BAA8B;AACnF,SAASC,QAAQ,QAAQ,2CAA0C;AACnE,SAASC,iBAAiB,QAAQ,+CAA8C"}
\ No newline at end of file
diff --git a/dist/exports/client.d.ts b/dist/exports/client.d.ts
index 78e344b..edec64a 100644
--- a/dist/exports/client.d.ts
+++ b/dist/exports/client.d.ts
@@ -1,11 +1,3 @@
-export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js';
-export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js';
-export { 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';
-export { pushDataLayer } from '../modules/analytics/client.js';
-export { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from '../modules/analytics/client.js';
/**
* Entry point: ipal-kit/client
*
@@ -13,23 +5,31 @@ export { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from '../modules
* components. Kept separate from the main entry so server bundles don't pull in
* client-only code.
*/
-export { ConsentProvider, ConsentScript, CookieBanner, CookieButton, useConsent, useConsentContext, } from '../modules/consent/client.js';
+export { useConsent, ConsentProvider, useConsentContext, CookieBanner, CookieButton, ConsentScript, } from '../modules/consent/client.js';
export type { CookieBannerClassNames } from '../modules/consent/client.js';
-export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js';
-export type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js';
-export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js';
-export { useContactForm } from '../modules/forms/useContactForm.js';
-export type { ContactFormErrors, ContactFormValues, SubmitAction } from '../modules/forms/useContactForm.js';
-export { useForm } from '../modules/forms/useForm.js';
-export type { FormErrors, FormSubmitAction, Validator } from '../modules/forms/useForm.js';
-export { buildValidator, checked, custom, email, isEmail, maxLength, minLength, pattern, required, } from '../modules/forms/validators.js';
-export type { Rule } from '../modules/forms/validators.js';
-export { buildLocalizedPath, getLocaleCodes, getLocalizedSlugs, switchLocalePath, } from '../modules/i18n/index.js';
-export type { I18nConfig, LocalizedSlugs } from '../modules/i18n/index.js';
-export { AlternateLinksProvider, AlternateLinksUpdater, LanguageSwitcher, useAlternateLinks, useSetAlternateLinks, } from '../modules/i18n/index.js';
-export type { AlternateLinks, LanguageSwitcherClassNames } from '../modules/i18n/index.js';
-export { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js';
-export { LocaleView } from '../modules/pages/LocaleView.js';
export { Turnstile } from '../modules/turnstile/client.js';
export { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js';
+export { AccessibilityProvider, useAccessibility, AccessibilityWidget } from '../modules/accessibility/client.js';
+export type { A11yState, A11yTexts, A11yClassNames } from '../modules/accessibility/client.js';
+export { switchLocalePath, buildLocalizedPath, getLocalizedSlugs, getLocaleCodes, } from '../modules/i18n/index.js';
+export type { LocalizedSlugs, I18nConfig } from '../modules/i18n/index.js';
export type { TurnstileProps } from '../modules/turnstile/client.js';
+export { LocaleView } from '../modules/pages/LocaleView.js';
+export { Analytics } from '../modules/analytics/client.js';
+export type { AnalyticsProps } from '../modules/analytics/client.js';
+export { pushDataLayer } from '../modules/analytics/client.js';
+export { loadMetaPixel, loadClarity, loadLinkedIn, loadTikTok } from '../modules/analytics/client.js';
+export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js';
+export { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js';
+export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js';
+export { AlternateLinksProvider, useAlternateLinks, useSetAlternateLinks, AlternateLinksUpdater, LanguageSwitcher, } from '../modules/i18n/index.js';
+export type { AlternateLinks, LanguageSwitcherClassNames } from '../modules/i18n/index.js';
+export { useForm } from '../modules/forms/useForm.js';
+export type { FormErrors, FormSubmitAction, Validator } from '../modules/forms/useForm.js';
+export { useContactForm } from '../modules/forms/useContactForm.js';
+export type { ContactFormValues, ContactFormErrors, SubmitAction } from '../modules/forms/useContactForm.js';
+export { buildValidator, isEmail, required, email, minLength, maxLength, checked, pattern, custom, } from '../modules/forms/validators.js';
+export type { Rule } from '../modules/forms/validators.js';
+export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js';
+export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js';
+export type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js';
diff --git a/dist/exports/client.js b/dist/exports/client.js
index caa37b8..7628273 100644
--- a/dist/exports/client.js
+++ b/dist/exports/client.js
@@ -1,29 +1,29 @@
'use client';
-export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js';
-export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js';
-export { AccessibilityProvider, AccessibilityWidget, useAccessibility } from '../modules/accessibility/client.js';
-export { Analytics } from '../modules/analytics/client.js';
-export { pushDataLayer } from '../modules/analytics/client.js';
-export { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from '../modules/analytics/client.js';
/**
* Entry point: ipal-kit/client
*
* Client-side ('use client') exports — React hooks, providers, and UI
* components. Kept separate from the main entry so server bundles don't pull in
* client-only code.
- */ export { ConsentProvider, ConsentScript, CookieBanner, CookieButton, useConsent, useConsentContext } from '../modules/consent/client.js';
-export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js';
-export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js';
-export { useContactForm } from '../modules/forms/useContactForm.js';
-export { useForm } from '../modules/forms/useForm.js';
-export { buildValidator, checked, custom, email, isEmail, maxLength, minLength, pattern, required } from '../modules/forms/validators.js';
-// Pure i18n path helpers — no server/RSC deps, safe to import in client
-// components (e.g. a LanguageSwitcher that computes locale URLs on the client).
-export { buildLocalizedPath, getLocaleCodes, getLocalizedSlugs, switchLocalePath } from '../modules/i18n/index.js';
-export { AlternateLinksProvider, AlternateLinksUpdater, LanguageSwitcher, useAlternateLinks, useSetAlternateLinks } from '../modules/i18n/index.js';
-export { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js';
-export { LocaleView } from '../modules/pages/LocaleView.js';
+ */ export { useConsent, ConsentProvider, useConsentContext, CookieBanner, CookieButton, ConsentScript } from '../modules/consent/client.js';
export { Turnstile } from '../modules/turnstile/client.js';
export { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js';
+export { AccessibilityProvider, useAccessibility, AccessibilityWidget } from '../modules/accessibility/client.js';
+// Pure i18n path helpers — no server/RSC deps, safe to import in client
+// components (e.g. a LanguageSwitcher that computes locale URLs on the client).
+export { switchLocalePath, buildLocalizedPath, getLocalizedSlugs, getLocaleCodes } from '../modules/i18n/index.js';
+export { LocaleView } from '../modules/pages/LocaleView.js';
+export { Analytics } from '../modules/analytics/client.js';
+export { pushDataLayer } from '../modules/analytics/client.js';
+export { loadMetaPixel, loadClarity, loadLinkedIn, loadTikTok } from '../modules/analytics/client.js';
+export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js';
+export { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js';
+export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js';
+export { AlternateLinksProvider, useAlternateLinks, useSetAlternateLinks, AlternateLinksUpdater, LanguageSwitcher } from '../modules/i18n/index.js';
+export { useForm } from '../modules/forms/useForm.js';
+export { useContactForm } from '../modules/forms/useContactForm.js';
+export { buildValidator, isEmail, required, email, minLength, maxLength, checked, pattern, custom } from '../modules/forms/validators.js';
+export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js';
+export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js';
//# sourceMappingURL=client.js.map
\ No newline at end of file
diff --git a/dist/exports/client.js.map b/dist/exports/client.js.map
index f3bea12..7045752 100644
--- a/dist/exports/client.js.map
+++ b/dist/exports/client.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\nexport { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js'\nexport { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js'\nexport { AccessibilityProvider, AccessibilityWidget, useAccessibility } from '../modules/accessibility/client.js'\nexport type { A11yClassNames, A11yState, A11yTexts } from '../modules/accessibility/client.js'\nexport { Analytics } from '../modules/analytics/client.js'\nexport type { AnalyticsProps } from '../modules/analytics/client.js'\n\nexport { pushDataLayer } from '../modules/analytics/client.js'\nexport { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from '../modules/analytics/client.js'\n/**\n * Entry point: ipal-kit/client\n *\n * Client-side ('use client') exports — React hooks, providers, and UI\n * components. Kept separate from the main entry so server bundles don't pull in\n * client-only code.\n */\nexport {\n ConsentProvider,\n ConsentScript,\n CookieBanner,\n CookieButton,\n useConsent,\n useConsentContext,\n} from '../modules/consent/client.js'\nexport type { CookieBannerClassNames } from '../modules/consent/client.js'\nexport { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js'\nexport type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js'\nexport { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js'\nexport { useContactForm } from '../modules/forms/useContactForm.js'\nexport type { ContactFormErrors, ContactFormValues, SubmitAction } from '../modules/forms/useContactForm.js'\nexport { useForm } from '../modules/forms/useForm.js'\nexport type { FormErrors, FormSubmitAction, Validator } from '../modules/forms/useForm.js'\nexport {\n buildValidator,\n checked,\n custom,\n email,\n isEmail,\n maxLength,\n minLength,\n pattern,\n required,\n} from '../modules/forms/validators.js'\nexport type { Rule } from '../modules/forms/validators.js'\n// Pure i18n path helpers — no server/RSC deps, safe to import in client\n// components (e.g. a LanguageSwitcher that computes locale URLs on the client).\nexport {\n buildLocalizedPath,\n getLocaleCodes,\n getLocalizedSlugs,\n switchLocalePath,\n} from '../modules/i18n/index.js'\nexport type { I18nConfig, LocalizedSlugs } from '../modules/i18n/index.js'\nexport {\n AlternateLinksProvider,\n AlternateLinksUpdater,\n LanguageSwitcher,\n useAlternateLinks,\n useSetAlternateLinks,\n} from '../modules/i18n/index.js'\nexport type { AlternateLinks, LanguageSwitcherClassNames } from '../modules/i18n/index.js'\nexport { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js'\nexport { LocaleView } from '../modules/pages/LocaleView.js'\nexport { Turnstile } from '../modules/turnstile/client.js'\nexport { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js'\nexport type { TurnstileProps } from '../modules/turnstile/client.js'\n"],"names":["MaskedField","TestEmailButton","AccessibilityProvider","AccessibilityWidget","useAccessibility","Analytics","pushDataLayer","loadClarity","loadLinkedIn","loadMetaPixel","loadTikTok","ConsentProvider","ConsentScript","CookieBanner","CookieButton","useConsent","useConsentContext","formAnalyticsOnSuccess","HONEYPOT_FIELD","honeypotInputProps","isHoneypotTripped","useContactForm","useForm","buildValidator","checked","custom","email","isEmail","maxLength","minLength","pattern","required","buildLocalizedPath","getLocaleCodes","getLocalizedSlugs","switchLocalePath","AlternateLinksProvider","AlternateLinksUpdater","LanguageSwitcher","useAlternateLinks","useSetAlternateLinks","IntegrationStatusBanner","LocaleView","Turnstile","TurnstileProvider","useTurnstile"],"mappings":"AAAA;AACA,SAASA,WAAW,QAAQ,wDAAuD;AACnF,SAASC,eAAe,QAAQ,4DAA2D;AAC3F,SAASC,qBAAqB,EAAEC,mBAAmB,EAAEC,gBAAgB,QAAQ,qCAAoC;AAEjH,SAASC,SAAS,QAAQ,iCAAgC;AAG1D,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,WAAW,EAAEC,YAAY,EAAEC,aAAa,EAAEC,UAAU,QAAQ,iCAAgC;AACrG;;;;;;CAMC,GACD,SACEC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,UAAU,EACVC,iBAAiB,QACZ,+BAA8B;AAErC,SAASC,sBAAsB,QAAQ,oCAAmC;AAE1E,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,iBAAiB,QAAQ,+BAA8B;AACpG,SAASC,cAAc,QAAQ,qCAAoC;AAEnE,SAASC,OAAO,QAAQ,8BAA6B;AAErD,SACEC,cAAc,EACdC,OAAO,EACPC,MAAM,EACNC,KAAK,EACLC,OAAO,EACPC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,iCAAgC;AAEvC,wEAAwE;AACxE,gFAAgF;AAChF,SACEC,kBAAkB,EAClBC,cAAc,EACdC,iBAAiB,EACjBC,gBAAgB,QACX,2BAA0B;AAEjC,SACEC,sBAAsB,EACtBC,qBAAqB,EACrBC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,QACf,2BAA0B;AAEjC,SAASC,uBAAuB,QAAQ,qDAAoD;AAC5F,SAASC,UAAU,QAAQ,iCAAgC;AAC3D,SAASC,SAAS,QAAQ,iCAAgC;AAC1D,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,iCAAgC"}
\ No newline at end of file
+{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\n/**\n * Entry point: ipal-kit/client\n *\n * Client-side ('use client') exports — React hooks, providers, and UI\n * components. Kept separate from the main entry so server bundles don't pull in\n * client-only code.\n */\nexport {\n useConsent,\n ConsentProvider,\n useConsentContext,\n CookieBanner,\n CookieButton,\n ConsentScript,\n} from '../modules/consent/client.js'\nexport type { CookieBannerClassNames } from '../modules/consent/client.js'\nexport { Turnstile } from '../modules/turnstile/client.js'\nexport { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js'\nexport { AccessibilityProvider, useAccessibility, AccessibilityWidget } from '../modules/accessibility/client.js'\nexport type { A11yState, A11yTexts, A11yClassNames } from '../modules/accessibility/client.js'\n\n// Pure i18n path helpers — no server/RSC deps, safe to import in client\n// components (e.g. a LanguageSwitcher that computes locale URLs on the client).\nexport {\n switchLocalePath,\n buildLocalizedPath,\n getLocalizedSlugs,\n getLocaleCodes,\n} from '../modules/i18n/index.js'\nexport type { LocalizedSlugs, I18nConfig } from '../modules/i18n/index.js'\nexport type { TurnstileProps } from '../modules/turnstile/client.js'\nexport { LocaleView } from '../modules/pages/LocaleView.js'\nexport { Analytics } from '../modules/analytics/client.js'\nexport type { AnalyticsProps } from '../modules/analytics/client.js'\nexport { pushDataLayer } from '../modules/analytics/client.js'\nexport { loadMetaPixel, loadClarity, loadLinkedIn, loadTikTok } from '../modules/analytics/client.js'\nexport { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js'\nexport { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js'\nexport { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js'\nexport {\n AlternateLinksProvider,\n useAlternateLinks,\n useSetAlternateLinks,\n AlternateLinksUpdater,\n LanguageSwitcher,\n} from '../modules/i18n/index.js'\nexport type { AlternateLinks, LanguageSwitcherClassNames } from '../modules/i18n/index.js'\nexport { useForm } from '../modules/forms/useForm.js'\nexport type { FormErrors, FormSubmitAction, Validator } from '../modules/forms/useForm.js'\nexport { useContactForm } from '../modules/forms/useContactForm.js'\nexport type { ContactFormValues, ContactFormErrors, SubmitAction } from '../modules/forms/useContactForm.js'\nexport {\n buildValidator,\n isEmail,\n required,\n email,\n minLength,\n maxLength,\n checked,\n pattern,\n custom,\n} from '../modules/forms/validators.js'\nexport type { Rule } from '../modules/forms/validators.js'\nexport { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js'\nexport { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js'\nexport type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js'\n"],"names":["useConsent","ConsentProvider","useConsentContext","CookieBanner","CookieButton","ConsentScript","Turnstile","TurnstileProvider","useTurnstile","AccessibilityProvider","useAccessibility","AccessibilityWidget","switchLocalePath","buildLocalizedPath","getLocalizedSlugs","getLocaleCodes","LocaleView","Analytics","pushDataLayer","loadMetaPixel","loadClarity","loadLinkedIn","loadTikTok","MaskedField","IntegrationStatusBanner","TestEmailButton","AlternateLinksProvider","useAlternateLinks","useSetAlternateLinks","AlternateLinksUpdater","LanguageSwitcher","useForm","useContactForm","buildValidator","isEmail","required","email","minLength","maxLength","checked","pattern","custom","HONEYPOT_FIELD","honeypotInputProps","isHoneypotTripped","formAnalyticsOnSuccess"],"mappings":"AAAA;AACA;;;;;;CAMC,GACD,SACEA,UAAU,EACVC,eAAe,EACfC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,aAAa,QACR,+BAA8B;AAErC,SAASC,SAAS,QAAQ,iCAAgC;AAC1D,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,iCAAgC;AAChF,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,mBAAmB,QAAQ,qCAAoC;AAGjH,wEAAwE;AACxE,gFAAgF;AAChF,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,iBAAiB,EACjBC,cAAc,QACT,2BAA0B;AAGjC,SAASC,UAAU,QAAQ,iCAAgC;AAC3D,SAASC,SAAS,QAAQ,iCAAgC;AAE1D,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,aAAa,EAAEC,WAAW,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iCAAgC;AACrG,SAASC,WAAW,QAAQ,wDAAuD;AACnF,SAASC,uBAAuB,QAAQ,qDAAoD;AAC5F,SAASC,eAAe,QAAQ,4DAA2D;AAC3F,SACEC,sBAAsB,EACtBC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,gBAAgB,QACX,2BAA0B;AAEjC,SAASC,OAAO,QAAQ,8BAA6B;AAErD,SAASC,cAAc,QAAQ,qCAAoC;AAEnE,SACEC,cAAc,EACdC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,MAAM,QACD,iCAAgC;AAEvC,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,iBAAiB,QAAQ,+BAA8B;AACpG,SAASC,sBAAsB,QAAQ,oCAAmC"}
\ No newline at end of file
diff --git a/dist/exports/server.d.ts b/dist/exports/server.d.ts
index e3306d8..80d6e76 100644
--- a/dist/exports/server.d.ts
+++ b/dist/exports/server.d.ts
@@ -1,7 +1,3 @@
-export { sendEmail } from '../modules/email/index.js';
-export type { SendEmailArgs, SendEmailResult } from '../modules/email/index.js';
-export { submitForm } from '../modules/forms/index.js';
-export type { SubmitFormArgs, SubmitFormResult } from '../modules/forms/index.js';
/**
* Entry point: ipal-kit/server
*
@@ -14,5 +10,9 @@ export type { SubmitFormArgs, SubmitFormResult } from '../modules/forms/index.js
* Import these only from Server Actions, route handlers, or server components —
* never from the Payload config or client code.
*/
-export { checkTurnstile, verifyTurnstile } from '../modules/turnstile/index.js';
+export { verifyTurnstile, checkTurnstile } from '../modules/turnstile/index.js';
export type { TurnstileCheck, TurnstileOutcome } from '../modules/turnstile/index.js';
+export { sendEmail } from '../modules/email/index.js';
+export type { SendEmailArgs, SendEmailResult } from '../modules/email/index.js';
+export { submitForm } from '../modules/forms/index.js';
+export type { SubmitFormArgs, SubmitFormResult } from '../modules/forms/index.js';
diff --git a/dist/exports/server.js b/dist/exports/server.js
index c673da8..38d31d3 100644
--- a/dist/exports/server.js
+++ b/dist/exports/server.js
@@ -1,5 +1,3 @@
-export { sendEmail } from '../modules/email/index.js';
-export { submitForm } from '../modules/forms/index.js';
/**
* Entry point: ipal-kit/server
*
@@ -11,6 +9,8 @@ export { submitForm } from '../modules/forms/index.js';
*
* Import these only from Server Actions, route handlers, or server components —
* never from the Payload config or client code.
- */ export { checkTurnstile, verifyTurnstile } from '../modules/turnstile/index.js';
+ */ export { verifyTurnstile, checkTurnstile } from '../modules/turnstile/index.js';
+export { sendEmail } from '../modules/email/index.js';
+export { submitForm } from '../modules/forms/index.js';
//# sourceMappingURL=server.js.map
\ No newline at end of file
diff --git a/dist/exports/server.js.map b/dist/exports/server.js.map
index 7fad1a5..fc9e7af 100644
--- a/dist/exports/server.js.map
+++ b/dist/exports/server.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/exports/server.ts"],"sourcesContent":["export { sendEmail } from '../modules/email/index.js'\nexport type { SendEmailArgs, SendEmailResult } from '../modules/email/index.js'\nexport { submitForm } from '../modules/forms/index.js'\nexport type { SubmitFormArgs, SubmitFormResult } from '../modules/forms/index.js'\n/**\n * Entry point: ipal-kit/server\n *\n * Server-only runtime functions — these import 'server-only' (Turnstile secret,\n * SMTP password, nodemailer). Kept OUT of the main entry so that loading the\n * Payload config or running `payload generate:importmap` (both Node scripts,\n * no bundler) never pulls in 'server-only', which throws outside a bundled\n * server context.\n *\n * Import these only from Server Actions, route handlers, or server components —\n * never from the Payload config or client code.\n */\nexport { checkTurnstile, verifyTurnstile } from '../modules/turnstile/index.js'\nexport type { TurnstileCheck, TurnstileOutcome } from '../modules/turnstile/index.js'\n"],"names":["sendEmail","submitForm","checkTurnstile","verifyTurnstile"],"mappings":"AAAA,SAASA,SAAS,QAAQ,4BAA2B;AAErD,SAASC,UAAU,QAAQ,4BAA2B;AAEtD;;;;;;;;;;;CAWC,GACD,SAASC,cAAc,EAAEC,eAAe,QAAQ,gCAA+B"}
\ No newline at end of file
+{"version":3,"sources":["../../src/exports/server.ts"],"sourcesContent":["/**\n * Entry point: ipal-kit/server\n *\n * Server-only runtime functions — these import 'server-only' (Turnstile secret,\n * SMTP password, nodemailer). Kept OUT of the main entry so that loading the\n * Payload config or running `payload generate:importmap` (both Node scripts,\n * no bundler) never pulls in 'server-only', which throws outside a bundled\n * server context.\n *\n * Import these only from Server Actions, route handlers, or server components —\n * never from the Payload config or client code.\n */\nexport { verifyTurnstile, checkTurnstile } from '../modules/turnstile/index.js'\nexport type { TurnstileCheck, TurnstileOutcome } from '../modules/turnstile/index.js'\nexport { sendEmail } from '../modules/email/index.js'\nexport type { SendEmailArgs, SendEmailResult } from '../modules/email/index.js'\nexport { submitForm } from '../modules/forms/index.js'\nexport type { SubmitFormArgs, SubmitFormResult } from '../modules/forms/index.js'\n"],"names":["verifyTurnstile","checkTurnstile","sendEmail","submitForm"],"mappings":"AAAA;;;;;;;;;;;CAWC,GACD,SAASA,eAAe,EAAEC,cAAc,QAAQ,gCAA+B;AAE/E,SAASC,SAAS,QAAQ,4BAA2B;AAErD,SAASC,UAAU,QAAQ,4BAA2B"}
\ No newline at end of file
diff --git a/dist/globals/Notifications/index.js b/dist/globals/Notifications/index.js
index 5a0e68a..ad49331 100644
--- a/dist/globals/Notifications/index.js
+++ b/dist/globals/Notifications/index.js
@@ -6,11 +6,14 @@ import { notificationsFields } from './fields.js';
*/ export function buildNotifications() {
return {
slug: 'notifications',
+ label: 'Notifications',
+ admin: {
+ group: 'Settings'
+ },
access: {
read: ()=>true
},
- fields: notificationsFields,
- label: 'Notifications'
+ fields: notificationsFields
};
}
diff --git a/dist/globals/Notifications/index.js.map b/dist/globals/Notifications/index.js.map
index cc96b1a..3bbf8d4 100644
--- a/dist/globals/Notifications/index.js.map
+++ b/dist/globals/Notifications/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../src/globals/Notifications/index.ts"],"sourcesContent":["import type { GlobalConfig } from 'payload'\n\nimport { notificationsFields } from './fields.js'\n\n/**\n * Builds the Notifications global — localized action-result texts. Readable by\n * any authenticated panel user; server-side helpers read it with overrideAccess\n * so the frontend can resolve texts without a session.\n */\nexport function buildNotifications(): GlobalConfig {\n return {\n slug: 'notifications',\n access: {\n read: () => true, // texts are public-facing (shown to end users)\n },\n fields: notificationsFields,\n label: 'Notifications',\n }\n}\n"],"names":["notificationsFields","buildNotifications","slug","access","read","fields","label"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,cAAa;AAEjD;;;;CAIC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,MAAM;QACNC,QAAQ;YACNC,MAAM,IAAM;QACd;QACAC,QAAQL;QACRM,OAAO;IACT;AACF"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/globals/Notifications/index.ts"],"sourcesContent":["import type { GlobalConfig } from 'payload'\nimport { notificationsFields } from './fields.js'\n\n/**\n * Builds the Notifications global — localized action-result texts. Readable by\n * any authenticated panel user; server-side helpers read it with overrideAccess\n * so the frontend can resolve texts without a session.\n */\nexport function buildNotifications(): GlobalConfig {\n return {\n slug: 'notifications',\n label: 'Notifications',\n admin: { group: 'Settings' },\n access: {\n read: () => true, // texts are public-facing (shown to end users)\n },\n fields: notificationsFields,\n }\n}\n"],"names":["notificationsFields","buildNotifications","slug","label","admin","group","access","read","fields"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAa;AAEjD;;;;CAIC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,MAAM;QACNC,OAAO;QACPC,OAAO;YAAEC,OAAO;QAAW;QAC3BC,QAAQ;YACNC,MAAM,IAAM;QACd;QACAC,QAAQR;IACV;AACF"}
\ No newline at end of file
diff --git a/dist/globals/SiteIntegrations/components/MaskedField.d.ts b/dist/globals/SiteIntegrations/components/MaskedField.d.ts
index 12a4ed8..3dd3a74 100644
--- a/dist/globals/SiteIntegrations/components/MaskedField.d.ts
+++ b/dist/globals/SiteIntegrations/components/MaskedField.d.ts
@@ -1,3 +1,20 @@
import type { TextFieldClientComponent } from 'payload';
+/**
+ * Masked text input for sensitive values (SMTP password, R2 secret key,
+ * Turnstile secret key, etc.).
+ *
+ * Renders the value as a password field (••••) so secrets aren't shown in
+ * plaintext on screen — protecting against shoulder-surfing and accidental
+ * exposure when the panel is open. The value is still stored and returned
+ * normally (UI masking, NOT hashing or encryption), because the plugin must
+ * read it back to authenticate with SMTP/R2/Turnstile. A toggle reveals the
+ * value when an authorised editor genuinely needs to check it.
+ *
+ * Uses a raw driven by useField rather than @payloadcms/ui's TextInput,
+ * because TextInput doesn't expose inputProps, so there's no way to switch its
+ * inner input to type="password".
+ *
+ * Assigned via a field's admin.components.Field. Works on any `text` field.
+ */
export declare const MaskedField: TextFieldClientComponent;
export default MaskedField;
diff --git a/dist/globals/SiteIntegrations/components/MaskedField.js b/dist/globals/SiteIntegrations/components/MaskedField.js
index 2c34385..d50c3fa 100644
--- a/dist/globals/SiteIntegrations/components/MaskedField.js
+++ b/dist/globals/SiteIntegrations/components/MaskedField.js
@@ -1,51 +1,77 @@
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
+import { useField, FieldLabel, FieldDescription } from '@payloadcms/ui';
import { useState } from 'react';
-export const MaskedField = (props)=>{
- const { field, path, value: propValue, setValue: propSetValue, onChange: propOnChange } = props || {};
- const [internalValue, setInternalValue] = useState(propValue ?? '');
+/**
+ * Masked text input for sensitive values (SMTP password, R2 secret key,
+ * Turnstile secret key, etc.).
+ *
+ * Renders the value as a password field (••••) so secrets aren't shown in
+ * plaintext on screen — protecting against shoulder-surfing and accidental
+ * exposure when the panel is open. The value is still stored and returned
+ * normally (UI masking, NOT hashing or encryption), because the plugin must
+ * read it back to authenticate with SMTP/R2/Turnstile. A toggle reveals the
+ * value when an authorised editor genuinely needs to check it.
+ *
+ * Uses a raw driven by useField rather than @payloadcms/ui's TextInput,
+ * because TextInput doesn't expose inputProps, so there's no way to switch its
+ * inner input to type="password".
+ *
+ * Assigned via a field's admin.components.Field. Works on any `text` field.
+ */ export const MaskedField = ({ field, path })=>{
+ const { value, setValue } = useField({
+ path
+ });
const [revealed, setRevealed] = useState(false);
const label = typeof field?.label === 'string' ? field.label : field?.name ?? path;
- const handleChange = (e)=>{
- const newVal = e.target.value;
- setInternalValue(newVal);
- if (typeof propSetValue === 'function') {
- propSetValue(newVal);
- }
- if (typeof propOnChange === 'function') {
- propOnChange(e);
- }
- };
- const currentValue = propValue !== undefined ? propValue : internalValue;
+ const description = field?.admin?.description;
return /*#__PURE__*/ _jsxs("div", {
- className: "field-type text",
+ className: "field-type text masked-field",
children: [
- label && /*#__PURE__*/ _jsx("label", {
- className: "field-label",
- children: label
+ /*#__PURE__*/ _jsx(FieldLabel, {
+ label: label,
+ htmlFor: `field-${path}`
}),
/*#__PURE__*/ _jsxs("div", {
+ className: "field-type__wrap",
style: {
display: 'flex',
- gap: '.5rem'
+ gap: '.5rem',
+ alignItems: 'center'
},
children: [
/*#__PURE__*/ _jsx("input", {
+ id: `field-${path}`,
+ type: revealed ? 'text' : 'password',
autoComplete: "off",
- onChange: handleChange,
+ className: "field-type__input",
+ value: value ?? '',
+ onChange: (e)=>setValue(e.target.value),
style: {
flex: 1
- },
- type: revealed ? 'text' : 'password',
- value: currentValue ?? ''
+ }
}),
/*#__PURE__*/ _jsx("button", {
- onClick: ()=>setRevealed((r)=>!r),
type: "button",
+ onClick: ()=>setRevealed((r)=>!r),
+ style: {
+ background: 'none',
+ border: 'none',
+ padding: '.25rem .5rem',
+ cursor: 'pointer',
+ font: 'inherit',
+ textDecoration: 'underline',
+ opacity: 0.75,
+ whiteSpace: 'nowrap'
+ },
children: revealed ? 'Hide' : 'Reveal'
})
]
- })
+ }),
+ description && typeof description === 'string' ? /*#__PURE__*/ _jsx(FieldDescription, {
+ path: path,
+ description: description
+ }) : null
]
});
};
diff --git a/dist/globals/SiteIntegrations/components/MaskedField.js.map b/dist/globals/SiteIntegrations/components/MaskedField.js.map
index f6b1869..a8811a1 100644
--- a/dist/globals/SiteIntegrations/components/MaskedField.js.map
+++ b/dist/globals/SiteIntegrations/components/MaskedField.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../../src/globals/SiteIntegrations/components/MaskedField.tsx"],"sourcesContent":["'use client'\nimport type { TextFieldClientComponent } from 'payload'\nimport { useState } from 'react'\n\nexport const MaskedField: TextFieldClientComponent = (props: any) => {\n const { field, path, value: propValue, setValue: propSetValue, onChange: propOnChange } = props || {}\n const [internalValue, setInternalValue] = useState(propValue ?? '')\n const [revealed, setRevealed] = useState(false)\n const label = typeof field?.label === 'string' ? field.label : (field?.name ?? path)\n\n const handleChange = (e: React.ChangeEvent) => {\n const newVal = e.target.value\n setInternalValue(newVal)\n if (typeof propSetValue === 'function') {\n propSetValue(newVal)\n }\n if (typeof propOnChange === 'function') {\n propOnChange(e)\n }\n }\n\n const currentValue = propValue !== undefined ? propValue : internalValue\n\n return (\n
\n {label && }\n
\n \n \n
\n
\n )\n}\n\nexport default MaskedField\n"],"names":["useState","MaskedField","props","field","path","value","propValue","setValue","propSetValue","onChange","propOnChange","internalValue","setInternalValue","revealed","setRevealed","label","name","handleChange","e","newVal","target","currentValue","undefined","div","className","style","display","gap","input","autoComplete","flex","type","button","onClick","r"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,QAAO;AAEhC,OAAO,MAAMC,cAAwC,CAACC;IACpD,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAOC,SAAS,EAAEC,UAAUC,YAAY,EAAEC,UAAUC,YAAY,EAAE,GAAGR,SAAS,CAAC;IACpG,MAAM,CAACS,eAAeC,iBAAiB,GAAGZ,SAASM,aAAa;IAChE,MAAM,CAACO,UAAUC,YAAY,GAAGd,SAAS;IACzC,MAAMe,QAAQ,OAAOZ,OAAOY,UAAU,WAAWZ,MAAMY,KAAK,GAAIZ,OAAOa,QAAQZ;IAE/E,MAAMa,eAAe,CAACC;QACpB,MAAMC,SAASD,EAAEE,MAAM,CAACf,KAAK;QAC7BO,iBAAiBO;QACjB,IAAI,OAAOX,iBAAiB,YAAY;YACtCA,aAAaW;QACf;QACA,IAAI,OAAOT,iBAAiB,YAAY;YACtCA,aAAaQ;QACf;IACF;IAEA,MAAMG,eAAef,cAAcgB,YAAYhB,YAAYK;IAE3D,qBACE,MAACY;QAAIC,WAAU;;YACZT,uBAAS,KAACA;gBAAMS,WAAU;0BAAeT;;0BAC1C,MAACQ;gBAAIE,OAAO;oBAAEC,SAAS;oBAAQC,KAAK;gBAAQ;;kCAC1C,KAACC;wBACCC,cAAa;wBACbpB,UAAUQ;wBACVQ,OAAO;4BAAEK,MAAM;wBAAE;wBACjBC,MAAMlB,WAAW,SAAS;wBAC1BR,OAAOgB,gBAAgB;;kCAEzB,KAACW;wBAAOC,SAAS,IAAMnB,YAAY,CAACoB,IAAM,CAACA;wBAAIH,MAAK;kCACjDlB,WAAW,SAAS;;;;;;AAK/B,EAAC;AAED,eAAeZ,YAAW"}
\ No newline at end of file
+{"version":3,"sources":["../../../../src/globals/SiteIntegrations/components/MaskedField.tsx"],"sourcesContent":["'use client'\n\nimport { useField, FieldLabel, FieldDescription } from '@payloadcms/ui'\nimport { useState } from 'react'\nimport type { TextFieldClientComponent } from 'payload'\n\n/**\n * Masked text input for sensitive values (SMTP password, R2 secret key,\n * Turnstile secret key, etc.).\n *\n * Renders the value as a password field (••••) so secrets aren't shown in\n * plaintext on screen — protecting against shoulder-surfing and accidental\n * exposure when the panel is open. The value is still stored and returned\n * normally (UI masking, NOT hashing or encryption), because the plugin must\n * read it back to authenticate with SMTP/R2/Turnstile. A toggle reveals the\n * value when an authorised editor genuinely needs to check it.\n *\n * Uses a raw driven by useField rather than @payloadcms/ui's TextInput,\n * because TextInput doesn't expose inputProps, so there's no way to switch its\n * inner input to type=\"password\".\n *\n * Assigned via a field's admin.components.Field. Works on any `text` field.\n */\nexport const MaskedField: TextFieldClientComponent = ({ field, path }) => {\n const { value, setValue } = useField({ path })\n const [revealed, setRevealed] = useState(false)\n\n const label =\n typeof field?.label === 'string' ? field.label : (field?.name ?? path)\n const description = field?.admin?.description\n\n return (\n
\n )\n}\n\nexport default TestEmailButton\n"],"names":["useState","TestEmailButton","to","setTo","status","setStatus","kind","send","trim","msg","res","fetch","method","headers","credentials","body","JSON","stringify","data","json","ok","message","error","div","className","style","marginTop","label","p","opacity","fontSize","display","gap","alignItems","flexWrap","input","type","placeholder","value","onChange","e","target","flex","minWidth","button","onClick","disabled","whiteSpace","color"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,QAAO;AAEhC;;;;;;;;CAQC,GACD,OAAO,MAAMC,kBAAkB;IAC7B,MAAM,CAACC,IAAIC,MAAM,GAAGH,SAAS;IAC7B,MAAM,CAACI,QAAQC,UAAU,GAAGL,SAE1B;QAAEM,MAAM;IAAO;IAEjB,MAAMC,OAAO;QACX,IAAI,CAACL,GAAGM,IAAI,IAAI;YACdH,UAAU;gBAAEC,MAAM;gBAASG,KAAK;YAA6B;YAC7D;QACF;QACAJ,UAAU;YAAEC,MAAM;QAAU;QAC5B,IAAI;YACF,MAAMI,MAAM,MAAMC,MAAM,wBAAwB;gBAC9CC,QAAQ;gBACRC,SAAS;oBAAE,gBAAgB;gBAAmB;gBAC9CC,aAAa;gBACbC,MAAMC,KAAKC,SAAS,CAAC;oBAAEf,IAAIA,GAAGM,IAAI;gBAAG;YACvC;YACA,MAAMU,OAAO,MAAMR,IAAIS,IAAI;YAC3B,IAAID,KAAKE,EAAE,EAAE;gBACXf,UAAU;oBAAEC,MAAM;oBAAMG,KAAKS,KAAKG,OAAO,IAAI;gBAAmB;YAClE,OAAO;gBACLhB,UAAU;oBAAEC,MAAM;oBAASG,KAAKS,KAAKI,KAAK,IAAI;gBAAe;YAC/D;QACF,EAAE,OAAM;YACNjB,UAAU;gBAAEC,MAAM;gBAASG,KAAK;YAAyC;QAC3E;IACF;IAEA,qBACE,MAACc;QAAIC,WAAU;QAAaC,OAAO;YAAEC,WAAW;QAAO;;0BACrD,KAACC;gBAAMH,WAAU;0BAAc;;0BAC/B,KAACI;gBAAEH,OAAO;oBAAEI,SAAS;oBAAKC,UAAU;oBAAUJ,WAAW;gBAAE;0BAAG;;0BAG9D,MAACH;gBAAIE,OAAO;oBAAEM,SAAS;oBAAQC,KAAK;oBAASC,YAAY;oBAAUC,UAAU;gBAAO;;kCAClF,KAACC;wBACCC,MAAK;wBACLC,aAAY;wBACZC,OAAOpC;wBACPqC,UAAU,CAACC,IAAMrC,MAAMqC,EAAEC,MAAM,CAACH,KAAK;wBACrCb,OAAO;4BAAEiB,MAAM;4BAAGC,UAAU;wBAAQ;;kCAEtC,KAACC;wBACCR,MAAK;wBACLS,SAAStC;wBACTuC,UAAU1C,OAAOE,IAAI,KAAK;wBAC1BkB,WAAU;wBACVC,OAAO;4BAAEsB,YAAY;wBAAS;kCAE7B3C,OAAOE,IAAI,KAAK,YAAY,aAAa;;;;YAG7CF,OAAOE,IAAI,KAAK,sBACf,MAACsB;gBAAEH,OAAO;oBAAEuB,OAAO;oBAAmCtB,WAAW;gBAAQ;;oBAAG;oBACvEtB,OAAOK,GAAG;;;YAGhBL,OAAOE,IAAI,KAAK,yBACf,MAACsB;gBAAEH,OAAO;oBAAEuB,OAAO;oBAAmCtB,WAAW;gBAAQ;;oBAAG;oBACvEtB,OAAOK,GAAG;;;;;AAKvB,EAAC;AAED,eAAeR,gBAAe"}
\ No newline at end of file
diff --git a/dist/globals/SiteIntegrations/fields/smtp.js b/dist/globals/SiteIntegrations/fields/smtp.js
index 91051db..edc33cd 100644
--- a/dist/globals/SiteIntegrations/fields/smtp.js
+++ b/dist/globals/SiteIntegrations/fields/smtp.js
@@ -1,3 +1,4 @@
+import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js';
/**
* SMTP transport settings for outbound email.
*
@@ -5,6 +6,8 @@
* user), so all fields — including the password — stay editable in the admin
* panel while remaining inaccessible to anonymous API requests.
*/ export const smtpFields = [
+ // Status written by mailAdapter on every send (throttled) — banner on this tab.
+ buildIntegrationStatusBanner('emailStatus', 'Email'),
{
name: 'emailTransport',
type: 'select',
@@ -88,7 +91,8 @@
Field: '@intecion/ipal-kit/client#TestEmailButton'
}
}
- }
+ },
+ buildIntegrationStatusField('emailStatus')
];
//# sourceMappingURL=smtp.js.map
\ No newline at end of file
diff --git a/dist/globals/SiteIntegrations/fields/smtp.js.map b/dist/globals/SiteIntegrations/fields/smtp.js.map
index 8f94911..e4720e5 100644
--- a/dist/globals/SiteIntegrations/fields/smtp.js.map
+++ b/dist/globals/SiteIntegrations/fields/smtp.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/smtp.ts"],"sourcesContent":["import type { Field } from 'payload'\n\n/**\n * SMTP transport settings for outbound email.\n *\n * Protected at the global level (SiteIntegrations requires an authenticated\n * user), so all fields — including the password — stay editable in the admin\n * panel while remaining inaccessible to anonymous API requests.\n */\nexport const smtpFields: Field[] = [\n {\n name: 'emailTransport',\n type: 'select',\n admin: {\n description:\n 'How outbound email is sent. \"Microsoft Graph\" is only available when configured by the administrator (Intecion).',\n // The Graph option only makes sense when agency credentials exist in env.\n // We can't read process.env in the admin UI directly, so a client project\n // that hasn't set up Graph should filter this option via integrationsFields\n // override, or simply leave it on 'smtp'. The adapter enforces the real\n // availability at send time regardless of what's selected here.\n },\n defaultValue: 'smtp',\n options: [\n { label: 'SMTP', value: 'smtp' },\n { label: 'Microsoft Graph (Exchange)', value: 'graph' },\n ],\n },\n {\n type: 'row',\n admin: {\n // Hide SMTP fields when Graph is selected — they're not used then.\n condition: (_, siblingData) => siblingData?.emailTransport !== 'graph',\n },\n fields: [\n {\n name: 'smtpHost',\n type: 'text',\n admin: { placeholder: 'smtp.example.com', width: '70%' },\n },\n {\n name: 'smtpPort',\n type: 'number',\n admin: { width: '30%' },\n defaultValue: 587,\n },\n ],\n },\n {\n name: 'smtpUser',\n type: 'text',\n admin: {\n description: 'SMTP account username.',\n },\n },\n {\n name: 'smtpPassword',\n type: 'text',\n admin: {\n description: 'SMTP account password.',\n // Masked in the UI (••••) — stored plaintext, readable for SMTP auth.\n components: {\n Field: '@intecion/ipal-kit/client#MaskedField',\n },\n },\n },\n {\n name: 'smtpFromAddress',\n type: 'email',\n admin: {\n description: 'Default \"from\" address for outgoing mail.',\n },\n },\n {\n name: 'smtpFromName',\n type: 'text',\n admin: {\n description: 'Default \"from\" display name.',\n },\n },\n {\n name: 'emailTest',\n type: 'ui',\n admin: {\n components: {\n Field: '@intecion/ipal-kit/client#TestEmailButton',\n },\n },\n },\n]\n"],"names":["smtpFields","name","type","admin","description","defaultValue","options","label","value","condition","_","siblingData","emailTransport","fields","placeholder","width","components","Field"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,MAAMA,aAAsB;IACjC;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aACE;QAMJ;QACAC,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAAQC,OAAO;YAAO;YAC/B;gBAAED,OAAO;gBAA8BC,OAAO;YAAQ;SACvD;IACH;IACA;QACEN,MAAM;QACNC,OAAO;YACL,mEAAmE;YACnEM,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,mBAAmB;QACjE;QACAC,QAAQ;YACN;gBACEZ,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBAAEW,aAAa;oBAAoBC,OAAO;gBAAM;YACzD;YACA;gBACEd,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBAAEY,OAAO;gBAAM;gBACtBV,cAAc;YAChB;SACD;IACH;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACb,sEAAsE;YACtEY,YAAY;gBACVC,OAAO;YACT;QACF;IACF;IACA;QACEhB,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLa,YAAY;gBACVC,OAAO;YACT;QACF;IACF;CACD,CAAA"}
\ No newline at end of file
+{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/smtp.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js'\n\n/**\n * SMTP transport settings for outbound email.\n *\n * Protected at the global level (SiteIntegrations requires an authenticated\n * user), so all fields — including the password — stay editable in the admin\n * panel while remaining inaccessible to anonymous API requests.\n */\nexport const smtpFields: Field[] = [\n // Status written by mailAdapter on every send (throttled) — banner on this tab.\n buildIntegrationStatusBanner('emailStatus', 'Email'),\n {\n name: 'emailTransport',\n type: 'select',\n admin: {\n description:\n 'How outbound email is sent. \"Microsoft Graph\" is only available when configured by the administrator (Intecion).',\n // The Graph option only makes sense when agency credentials exist in env.\n // We can't read process.env in the admin UI directly, so a client project\n // that hasn't set up Graph should filter this option via integrationsFields\n // override, or simply leave it on 'smtp'. The adapter enforces the real\n // availability at send time regardless of what's selected here.\n },\n defaultValue: 'smtp',\n options: [\n { label: 'SMTP', value: 'smtp' },\n { label: 'Microsoft Graph (Exchange)', value: 'graph' },\n ],\n },\n {\n type: 'row',\n admin: {\n // Hide SMTP fields when Graph is selected — they're not used then.\n condition: (_, siblingData) => siblingData?.emailTransport !== 'graph',\n },\n fields: [\n {\n name: 'smtpHost',\n type: 'text',\n admin: { placeholder: 'smtp.example.com', width: '70%' },\n },\n {\n name: 'smtpPort',\n type: 'number',\n admin: { width: '30%' },\n defaultValue: 587,\n },\n ],\n },\n {\n name: 'smtpUser',\n type: 'text',\n admin: {\n description: 'SMTP account username.',\n },\n },\n {\n name: 'smtpPassword',\n type: 'text',\n admin: {\n description: 'SMTP account password.',\n // Masked in the UI (••••) — stored plaintext, readable for SMTP auth.\n components: {\n Field: '@intecion/ipal-kit/client#MaskedField',\n },\n },\n },\n {\n name: 'smtpFromAddress',\n type: 'email',\n admin: {\n description: 'Default \"from\" address for outgoing mail.',\n },\n },\n {\n name: 'smtpFromName',\n type: 'text',\n admin: {\n description: 'Default \"from\" display name.',\n },\n },\n {\n name: 'emailTest',\n type: 'ui',\n admin: {\n components: {\n Field: '@intecion/ipal-kit/client#TestEmailButton',\n },\n },\n },\n buildIntegrationStatusField('emailStatus'),\n]\n"],"names":["buildIntegrationStatusBanner","buildIntegrationStatusField","smtpFields","name","type","admin","description","defaultValue","options","label","value","condition","_","siblingData","emailTransport","fields","placeholder","width","components","Field"],"mappings":"AAEA,SAASA,4BAA4B,EAAEC,2BAA2B,QAAQ,0CAAyC;AAEnH;;;;;;CAMC,GACD,OAAO,MAAMC,aAAsB;IACjC,gFAAgF;IAChFF,6BAA6B,eAAe;IAC5C;QACEG,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aACE;QAMJ;QACAC,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAAQC,OAAO;YAAO;YAC/B;gBAAED,OAAO;gBAA8BC,OAAO;YAAQ;SACvD;IACH;IACA;QACEN,MAAM;QACNC,OAAO;YACL,mEAAmE;YACnEM,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,mBAAmB;QACjE;QACAC,QAAQ;YACN;gBACEZ,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBAAEW,aAAa;oBAAoBC,OAAO;gBAAM;YACzD;YACA;gBACEd,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBAAEY,OAAO;gBAAM;gBACtBV,cAAc;YAChB;SACD;IACH;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACb,sEAAsE;YACtEY,YAAY;gBACVC,OAAO;YACT;QACF;IACF;IACA;QACEhB,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLa,YAAY;gBACVC,OAAO;YACT;QACF;IACF;IACAlB,4BAA4B;CAC7B,CAAA"}
\ No newline at end of file
diff --git a/dist/globals/SiteIntegrations/index.js b/dist/globals/SiteIntegrations/index.js
index f87ef33..46236e7 100644
--- a/dist/globals/SiteIntegrations/index.js
+++ b/dist/globals/SiteIntegrations/index.js
@@ -52,21 +52,25 @@ import { turnstileFields } from './fields/turnstile.js';
],
hooks: {
beforeChange: [
- // Keys edited in the panel → clear the old Turnstile status, so a stale
+ // Keys edited in the panel → clear that integration's old status, so a stale
// "not working" banner doesn't linger until the next form submission.
({ context, data, originalDoc })=>{
if (context?.ipalIntegrationStatus || !data) {
return data;
}
const changed = (k)=>k in data && data[k] !== originalDoc?.[k];
+ const cleared = {
+ checkedAt: null,
+ code: null,
+ message: null,
+ since: null,
+ state: null
+ };
if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {
- data.turnstileStatus = {
- checkedAt: null,
- code: null,
- message: null,
- since: null,
- state: null
- };
+ data.turnstileStatus = cleared;
+ }
+ if (Object.keys(data).some((k)=>(k === 'emailTransport' || k.startsWith('smtp')) && changed(k))) {
+ data.emailStatus = cleared;
}
return data;
}
diff --git a/dist/globals/SiteIntegrations/index.js.map b/dist/globals/SiteIntegrations/index.js.map
index a2f5010..a72c7c5 100644
--- a/dist/globals/SiteIntegrations/index.js.map
+++ b/dist/globals/SiteIntegrations/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../src/globals/SiteIntegrations/index.ts"],"sourcesContent":["import type { Field, GlobalConfig } from 'payload'\n\nimport { isAdmin } from '../../modules/access/index.js'\nimport { analyticsFields } from './fields/analytics.js'\nimport { smtpFields } from './fields/smtp.js'\nimport { turnstileFields } from './fields/turnstile.js'\n\ntype BuildSiteIntegrationsArgs = {\n /** Extra fields injected by the client project */\n additionalFields?: Field[]\n}\n\n/**\n * Builds the SiteIntegrations global.\n *\n * Holds third-party service credentials. Access is enforced at the global\n * level — the whole global requires an authenticated user — so secrets stay\n * out of anonymous API responses while remaining editable in the admin panel\n * and readable via the server-side Local API. (Field-level read:false was\n * avoided because it also hides fields from the admin UI, making them\n * impossible to enter.)\n *\n * Unnamed tabs keep data flat (siteIntegrations.ga4MeasurementId).\n */\nexport function buildSiteIntegrations({\n additionalFields,\n}: BuildSiteIntegrationsArgs = {}): GlobalConfig {\n return {\n slug: 'site-integrations',\n access: {\n // Admin-only — secrets live here. Anonymous and non-admin users get\n // nothing through the API; admins read/edit in the panel and via Local API.\n read: ({ req: { user } }) => isAdmin(user),\n update: ({ req: { user } }) => isAdmin(user),\n },\n admin: {\n group: 'Settings',\n },\n fields: [\n {\n type: 'tabs',\n tabs: [\n { fields: analyticsFields, label: 'Analytics' },\n { fields: turnstileFields, label: 'Turnstile' },\n { fields: smtpFields, label: 'SMTP' },\n ...(additionalFields?.length\n ? [{ fields: additionalFields, label: 'Custom' }]\n : []),\n ],\n },\n ],\n hooks: {\n beforeChange: [\n // Keys edited in the panel → clear the old Turnstile status, so a stale\n // \"not working\" banner doesn't linger until the next form submission.\n ({ context, data, originalDoc }) => {\n if (context?.ipalIntegrationStatus || !data) {return data}\n const changed = (k: string) => k in data && data[k] !== originalDoc?.[k]\n if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {\n data.turnstileStatus = { checkedAt: null, code: null, message: null, since: null, state: null }\n }\n return data\n },\n ],\n },\n label: 'Site Integrations',\n }\n}\n"],"names":["isAdmin","analyticsFields","smtpFields","turnstileFields","buildSiteIntegrations","additionalFields","slug","access","read","req","user","update","admin","group","fields","type","tabs","label","length","hooks","beforeChange","context","data","originalDoc","ipalIntegrationStatus","changed","k","turnstileStatus","checkedAt","code","message","since","state"],"mappings":"AAEA,SAASA,OAAO,QAAQ,gCAA+B;AACvD,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,UAAU,QAAQ,mBAAkB;AAC7C,SAASC,eAAe,QAAQ,wBAAuB;AAOvD;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,sBAAsB,EACpCC,gBAAgB,EACU,GAAG,CAAC,CAAC;IAC/B,OAAO;QACLC,MAAM;QACNC,QAAQ;YACN,oEAAoE;YACpE,4EAA4E;YAC5EC,MAAM,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAE,EAAE,GAAKV,QAAQU;YACrCC,QAAQ,CAAC,EAAEF,KAAK,EAAEC,IAAI,EAAE,EAAE,GAAKV,QAAQU;QACzC;QACAE,OAAO;YACLC,OAAO;QACT;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;oBACJ;wBAAEF,QAAQb;wBAAiBgB,OAAO;oBAAY;oBAC9C;wBAAEH,QAAQX;wBAAiBc,OAAO;oBAAY;oBAC9C;wBAAEH,QAAQZ;wBAAYe,OAAO;oBAAO;uBAChCZ,kBAAkBa,SAClB;wBAAC;4BAAEJ,QAAQT;4BAAkBY,OAAO;wBAAS;qBAAE,GAC/C,EAAE;iBACP;YACH;SACD;QACDE,OAAO;YACLC,cAAc;gBACZ,wEAAwE;gBACxE,sEAAsE;gBACtE,CAAC,EAAEC,OAAO,EAAEC,IAAI,EAAEC,WAAW,EAAE;oBAC7B,IAAIF,SAASG,yBAAyB,CAACF,MAAM;wBAAC,OAAOA;oBAAI;oBACzD,MAAMG,UAAU,CAACC,IAAcA,KAAKJ,QAAQA,IAAI,CAACI,EAAE,KAAKH,aAAa,CAACG,EAAE;oBACxE,IAAID,QAAQ,yBAAyBA,QAAQ,qBAAqB;wBAChEH,KAAKK,eAAe,GAAG;4BAAEC,WAAW;4BAAMC,MAAM;4BAAMC,SAAS;4BAAMC,OAAO;4BAAMC,OAAO;wBAAK;oBAChG;oBACA,OAAOV;gBACT;aACD;QACH;QACAL,OAAO;IACT;AACF"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/globals/SiteIntegrations/index.ts"],"sourcesContent":["import type { Field, GlobalConfig } from 'payload'\n\nimport { isAdmin } from '../../modules/access/index.js'\nimport { analyticsFields } from './fields/analytics.js'\nimport { smtpFields } from './fields/smtp.js'\nimport { turnstileFields } from './fields/turnstile.js'\n\ntype BuildSiteIntegrationsArgs = {\n /** Extra fields injected by the client project */\n additionalFields?: Field[]\n}\n\n/**\n * Builds the SiteIntegrations global.\n *\n * Holds third-party service credentials. Access is enforced at the global\n * level — the whole global requires an authenticated user — so secrets stay\n * out of anonymous API responses while remaining editable in the admin panel\n * and readable via the server-side Local API. (Field-level read:false was\n * avoided because it also hides fields from the admin UI, making them\n * impossible to enter.)\n *\n * Unnamed tabs keep data flat (siteIntegrations.ga4MeasurementId).\n */\nexport function buildSiteIntegrations({\n additionalFields,\n}: BuildSiteIntegrationsArgs = {}): GlobalConfig {\n return {\n slug: 'site-integrations',\n access: {\n // Admin-only — secrets live here. Anonymous and non-admin users get\n // nothing through the API; admins read/edit in the panel and via Local API.\n read: ({ req: { user } }) => isAdmin(user),\n update: ({ req: { user } }) => isAdmin(user),\n },\n admin: {\n group: 'Settings',\n },\n fields: [\n {\n type: 'tabs',\n tabs: [\n { fields: analyticsFields, label: 'Analytics' },\n { fields: turnstileFields, label: 'Turnstile' },\n { fields: smtpFields, label: 'SMTP' },\n ...(additionalFields?.length\n ? [{ fields: additionalFields, label: 'Custom' }]\n : []),\n ],\n },\n ],\n hooks: {\n beforeChange: [\n // Keys edited in the panel → clear that integration's old status, so a stale\n // \"not working\" banner doesn't linger until the next form submission.\n ({ context, data, originalDoc }) => {\n if (context?.ipalIntegrationStatus || !data) {return data}\n const changed = (k: string) => k in data && data[k] !== originalDoc?.[k]\n const cleared = { checkedAt: null, code: null, message: null, since: null, state: null }\n if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {data.turnstileStatus = cleared}\n if (Object.keys(data).some((k) => (k === 'emailTransport' || k.startsWith('smtp')) && changed(k))) {\n data.emailStatus = cleared\n }\n return data\n },\n ],\n },\n label: 'Site Integrations',\n }\n}\n"],"names":["isAdmin","analyticsFields","smtpFields","turnstileFields","buildSiteIntegrations","additionalFields","slug","access","read","req","user","update","admin","group","fields","type","tabs","label","length","hooks","beforeChange","context","data","originalDoc","ipalIntegrationStatus","changed","k","cleared","checkedAt","code","message","since","state","turnstileStatus","Object","keys","some","startsWith","emailStatus"],"mappings":"AAEA,SAASA,OAAO,QAAQ,gCAA+B;AACvD,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,UAAU,QAAQ,mBAAkB;AAC7C,SAASC,eAAe,QAAQ,wBAAuB;AAOvD;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,sBAAsB,EACpCC,gBAAgB,EACU,GAAG,CAAC,CAAC;IAC/B,OAAO;QACLC,MAAM;QACNC,QAAQ;YACN,oEAAoE;YACpE,4EAA4E;YAC5EC,MAAM,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAE,EAAE,GAAKV,QAAQU;YACrCC,QAAQ,CAAC,EAAEF,KAAK,EAAEC,IAAI,EAAE,EAAE,GAAKV,QAAQU;QACzC;QACAE,OAAO;YACLC,OAAO;QACT;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;oBACJ;wBAAEF,QAAQb;wBAAiBgB,OAAO;oBAAY;oBAC9C;wBAAEH,QAAQX;wBAAiBc,OAAO;oBAAY;oBAC9C;wBAAEH,QAAQZ;wBAAYe,OAAO;oBAAO;uBAChCZ,kBAAkBa,SAClB;wBAAC;4BAAEJ,QAAQT;4BAAkBY,OAAO;wBAAS;qBAAE,GAC/C,EAAE;iBACP;YACH;SACD;QACDE,OAAO;YACLC,cAAc;gBACZ,6EAA6E;gBAC7E,sEAAsE;gBACtE,CAAC,EAAEC,OAAO,EAAEC,IAAI,EAAEC,WAAW,EAAE;oBAC7B,IAAIF,SAASG,yBAAyB,CAACF,MAAM;wBAAC,OAAOA;oBAAI;oBACzD,MAAMG,UAAU,CAACC,IAAcA,KAAKJ,QAAQA,IAAI,CAACI,EAAE,KAAKH,aAAa,CAACG,EAAE;oBACxE,MAAMC,UAAU;wBAAEC,WAAW;wBAAMC,MAAM;wBAAMC,SAAS;wBAAMC,OAAO;wBAAMC,OAAO;oBAAK;oBACvF,IAAIP,QAAQ,yBAAyBA,QAAQ,qBAAqB;wBAACH,KAAKW,eAAe,GAAGN;oBAAO;oBACjG,IAAIO,OAAOC,IAAI,CAACb,MAAMc,IAAI,CAAC,CAACV,IAAM,AAACA,CAAAA,MAAM,oBAAoBA,EAAEW,UAAU,CAAC,OAAM,KAAMZ,QAAQC,KAAK;wBACjGJ,KAAKgB,WAAW,GAAGX;oBACrB;oBACA,OAAOL;gBACT;aACD;QACH;QACAL,OAAO;IACT;AACF"}
\ No newline at end of file
diff --git a/dist/index.d.ts b/dist/index.d.ts
index 824ae01..32d7acd 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -1,76 +1,76 @@
-export type { AccessOption, Role } from './modules/access/index.js';
-export { adminOnly, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, requireRoleField, ROLE_HIERARCHY, } from './modules/access/index.js';
-export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js';
-export type { A11yState } from './modules/accessibility/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';
-export { getAnalyticsConfig } from './modules/analytics/index.js';
-export { ACCEPT_ALL_CONSENT, CONSENT_CATEGORIES, CONSENT_COOKIE, CONSENT_MAX_AGE, CONSENT_VERSION, DEFAULT_CONSENT, getConsentTexts, parseConsent, REJECT_ALL_CONSENT, serializeConsent, setDefaultConsent, updateConsent, } from './modules/consent/index.js';
-export type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js';
-export type { ContentCollectionOption, ContentOption, ResolvedRoute } from './modules/content/index.js';
-export { archiveFieldName, blocksToMarkdown, buildArchivePath, buildEntryPath, createMarkdownRenderer, createSearchRoute, getArchiveEntries, MARKDOWN_PREFIX, markdownHref, markdownResponse, parsePageParam, prefersMarkdown, resolveNotFoundPage, resolveRedirect, resolveRoute, searchContent, } from './modules/content/index.js';
-export type { ArchiveEntries } from './modules/content/index.js';
-export type { SearchResult } from './modules/content/index.js';
-export { graphAdapter } from './modules/email/graphAdapter.js';
-export type { GraphAdapterArgs } from './modules/email/graphAdapter.js';
-export { mailAdapter } from './modules/email/mailAdapter.js';
-export type { MailAdapterArgs } from './modules/email/mailAdapter.js';
-export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js';
-export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js';
-export { assertEnv, ipalEnvRules } from './modules/env/index.js';
-export type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from './modules/env/index.js';
-export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js';
-export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js';
-export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js';
-export type { FormsCollectionOverrides, FormsFieldsOverride, FormsOption, } from './modules/forms/types.js';
-export type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js';
-export { buildValidator, checked, custom, email, isEmail, maxLength, minLength, pattern, required, } from './modules/forms/validators.js';
-export type { Rule } from './modules/forms/validators.js';
-export { createContentHelpers } from './modules/frontend/index.js';
-export { createHealthRoute } from './modules/health/index.js';
-export { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js';
+export { ipalKit } from './plugin.js';
+export type { IpalOptions } from './types.js';
export type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js';
export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath, } from './modules/i18n/index.js';
+export type { PagesOption, SystemPageRole } from './modules/pages/index.js';
+export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js';
+export type { AccessOption, Role } from './modules/access/index.js';
+export { adminOnly, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, requireRoleField, ROLE_HIERARCHY, } from './modules/access/index.js';
+export type { GlobalQueryOptions } from './modules/payload/index.js';
+export { getGlobal, getSiteSettings, getSiteIntegrations, SITE_SETTINGS_SLUG, SITE_INTEGRATIONS_SLUG, } from './modules/payload/index.js';
+export type { SeoOption, SeoMeta, PageMetadata } from './modules/seo/index.js';
+export { composeTitle, buildHreflangAlternates, buildMetadata, readSiteMetaConfig, slugsAcrossLocales, } from './modules/seo/index.js';
+export type { SiteMetaConfig } from './modules/seo/index.js';
+export type { ContentOption, ContentCollectionOption, ResolvedRoute } from './modules/content/index.js';
+export { createContentHelpers } from './modules/frontend/index.js';
+export { resolveRoute, resolveRedirect, resolveNotFoundPage, blocksToMarkdown, createMarkdownRenderer, markdownResponse, prefersMarkdown, markdownHref, MARKDOWN_PREFIX, searchContent, createSearchRoute, archiveFieldName, getArchiveEntries, buildArchivePath, buildEntryPath, parsePageParam, } from './modules/content/index.js';
+export type { ArchiveEntries } from './modules/content/index.js';
+export type { SearchResult } from './modules/content/index.js';
+export { lexicalToMarkdown } from './modules/richtext/index.js';
+export type { AutoFillMapping, SitemapEntry, RobotsRules, RobotsOptions } from './modules/seo/index.js';
+export { buildAutoFillMetaHook, injectAutoFillMeta, createMetadataGenerator, createPageMetadata, buildSitemapEntries, buildRobots, AI_ASSISTANT_BOTS, AI_TRAINING_BOTS, } from './modules/seo/index.js';
export type { LocaleMiddlewareResult } from './modules/i18n/index.js';
export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER, } from './modules/i18n/index.js';
export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js';
export { resolveLocalized } from './modules/i18n/index.js';
-export { buildIntegrationStatusBanner, buildIntegrationStatusField, recordIntegrationStatus } from './modules/integrations/index.js';
-export type { IntegrationState, IntegrationStatus } from './modules/integrations/index.js';
-export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js';
-export type { BuildLinkFieldOptions, BuildLinksFieldOptions, LinkAppearance, LinkValue, ResolveLinkHrefOptions, } from './modules/links/index.js';
+export { CONSENT_CATEGORIES, DEFAULT_CONSENT, ACCEPT_ALL_CONSENT, REJECT_ALL_CONSENT, CONSENT_COOKIE, CONSENT_VERSION, CONSENT_MAX_AGE, serializeConsent, parseConsent, setDefaultConsent, updateConsent, getConsentTexts, } from './modules/consent/index.js';
+export type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js';
+export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js';
+export { graphAdapter } from './modules/email/graphAdapter.js';
+export { mailAdapter } from './modules/email/mailAdapter.js';
+export type { MailAdapterArgs } from './modules/email/mailAdapter.js';
+export type { GraphAdapterArgs } from './modules/email/graphAdapter.js';
+export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js';
+export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js';
+export type { FormsOption, FormsCollectionOverrides, FormsFieldsOverride, } from './modules/forms/types.js';
+export { buildValidator, isEmail, required, email, minLength, maxLength, checked, pattern, custom, } from './modules/forms/validators.js';
+export type { Rule } from './modules/forms/validators.js';
+export type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js';
+export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js';
+export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js';
+export { createHealthRoute } from './modules/health/index.js';
export { createMcpRoute } from './modules/mcp/index.js';
-export { buildOptimizeUploadField, buildOptimizeUploadHook, normalizeFilename, normalizeFilenameHook } from './modules/media/index.js';
-export type { OptimizeUploadOptions } from './modules/media/index.js';
-export { getNotificationTexts, NOTIFICATION_FALLBACK, 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';
-export type { GlobalQueryOptions } from './modules/payload/index.js';
-export { getGlobal, getSiteIntegrations, getSiteSettings, SITE_INTEGRATIONS_SLUG, SITE_SETTINGS_SLUG, } from './modules/payload/index.js';
-export { lexicalToMarkdown } from './modules/richtext/index.js';
+export { assertEnv, ipalEnvRules } from './modules/env/index.js';
+export type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from './modules/env/index.js';
+export type { AnalyticsConfig } from './modules/analytics/index.js';
+export { getAnalyticsConfig } from './modules/analytics/index.js';
+export { buildSlugField, toSlug } from './modules/slug/index.js';
+export { createLlmsTxtRoute, createSitemapRouteHandler, createManifestHandler } from './modules/seo/index.js';
+export { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js';
export { buildSecurityHeaders } from './modules/security/index.js';
export { buildCsp } from './modules/security/index.js';
export type { BuildCspArgs } from './modules/security/index.js';
-export type { BuildSecurityHeadersArgs, SecurityHeader } from './modules/security/index.js';
-export type { PageMetadata, SeoMeta, SeoOption } from './modules/seo/index.js';
-export { buildHreflangAlternates, buildMetadata, composeTitle, readSiteMetaConfig, slugsAcrossLocales, } from './modules/seo/index.js';
-export type { SiteMetaConfig } from './modules/seo/index.js';
-export type { AutoFillMapping, RobotsOptions, RobotsRules, SitemapEntry } from './modules/seo/index.js';
-export { AI_ASSISTANT_BOTS, AI_TRAINING_BOTS, buildAutoFillMetaHook, buildRobots, buildSitemapEntries, createMetadataGenerator, createPageMetadata, injectAutoFillMeta, } from './modules/seo/index.js';
-export { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler } from './modules/seo/index.js';
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js';
export { buildNoindexField } from './modules/seo/index.js';
+export { recordIntegrationStatus, buildIntegrationStatusField, buildIntegrationStatusBanner } from './modules/integrations/index.js';
+export type { IntegrationStatus, IntegrationState } from './modules/integrations/index.js';
+export { rowLabel } from './modules/admin-ui/index.js';
+export type { RowLabelProps } from './modules/admin-ui/index.js';
+export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js';
+export type { LinkAppearance, LinkValue, BuildLinkFieldOptions, BuildLinksFieldOptions, ResolveLinkHrefOptions, } from './modules/links/index.js';
export { buildSpeakableJsonLd } from './modules/seo/index.js';
export { buildSummaryField } from './modules/seo/index.js';
-export { buildBreadcrumbJsonLd, buildSiteNavigationJsonLd, buildWebSiteJsonLd } from './modules/seo/index.js';
-export { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd } from './modules/seo/index.js';
+export { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } from './modules/seo/index.js';
+export { buildLocalBusinessJsonLd, buildFaqJsonLd, buildServiceJsonLd } from './modules/seo/index.js';
export { buildArticleJsonLd } from './modules/seo/index.js';
export { buildLlmsTxt } from './modules/seo/index.js';
-export { buildSitemapCss, buildSitemapXml, DEFAULT_SITEMAP_CREDIT, SITEMAP_STYLE_PARAM } from './modules/seo/index.js';
+export { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js';
export type { SitemapRouteOptions, SitemapStyleOptions } from './modules/seo/index.js';
-export { buildSlugField, toSlug } from './modules/slug/index.js';
export { buildR2Storage } from './modules/storage/index.js';
-export { ipalKit } from './plugin.js';
-export type { IpalOptions } from './types.js';
+export { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } from './modules/media/index.js';
+export type { OptimizeUploadOptions } from './modules/media/index.js';
+export { buildRevalidateHook, setPublishedAtHook, buildPreventDeleteSystemPage, buildValidateUniqueRole, trackSlugHistoryHook, buildCrossLocaleFieldSync } from './modules/hooks/index.js';
+export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js';
+export type { A11yState } from './modules/accessibility/index.js';
+export type { SecurityHeader, BuildSecurityHeadersArgs } from './modules/security/index.js';
+export type { NotificationTexts, FormNotificationTexts } from './modules/notifications/index.js';
diff --git a/dist/index.js b/dist/index.js
index d8824b8..dd1ab2a 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,60 +1,60 @@
+export { ipalKit } from './plugin.js';
+export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath } from './modules/i18n/index.js';
+export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js';
export { adminOnly, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, requireRoleField, ROLE_HIERARCHY } from './modules/access/index.js';
-export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js';
-export { rowLabel } from './modules/admin-ui/index.js';
-export { getAnalyticsConfig } from './modules/analytics/index.js';
-export { ACCEPT_ALL_CONSENT, CONSENT_CATEGORIES, CONSENT_COOKIE, CONSENT_MAX_AGE, CONSENT_VERSION, DEFAULT_CONSENT, getConsentTexts, parseConsent, REJECT_ALL_CONSENT, serializeConsent, setDefaultConsent, updateConsent } from './modules/consent/index.js';
-export { archiveFieldName, blocksToMarkdown, buildArchivePath, buildEntryPath, createMarkdownRenderer, createSearchRoute, getArchiveEntries, MARKDOWN_PREFIX, markdownHref, markdownResponse, parsePageParam, prefersMarkdown, resolveNotFoundPage, resolveRedirect, resolveRoute, searchContent } from './modules/content/index.js';
-export { graphAdapter } from './modules/email/graphAdapter.js';
-export { mailAdapter } from './modules/email/mailAdapter.js';
+export { getGlobal, getSiteSettings, getSiteIntegrations, SITE_SETTINGS_SLUG, SITE_INTEGRATIONS_SLUG } from './modules/payload/index.js';
+export { composeTitle, buildHreflangAlternates, buildMetadata, readSiteMetaConfig, slugsAcrossLocales } from './modules/seo/index.js';
+export { createContentHelpers } from './modules/frontend/index.js';
+export { resolveRoute, resolveRedirect, resolveNotFoundPage, blocksToMarkdown, createMarkdownRenderer, markdownResponse, prefersMarkdown, markdownHref, MARKDOWN_PREFIX, searchContent, createSearchRoute, archiveFieldName, getArchiveEntries, buildArchivePath, buildEntryPath, parsePageParam } from './modules/content/index.js';
+// Lexical → Markdown (pure, no React) — for AI-readable output.
+export { lexicalToMarkdown } from './modules/richtext/index.js';
+export { buildAutoFillMetaHook, injectAutoFillMeta, createMetadataGenerator, createPageMetadata, buildSitemapEntries, buildRobots, AI_ASSISTANT_BOTS, AI_TRAINING_BOTS } from './modules/seo/index.js';
+export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from './modules/i18n/index.js';
+export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js';
+export { resolveLocalized } from './modules/i18n/index.js';
+export { CONSENT_CATEGORIES, DEFAULT_CONSENT, ACCEPT_ALL_CONSENT, REJECT_ALL_CONSENT, CONSENT_COOKIE, CONSENT_VERSION, CONSENT_MAX_AGE, serializeConsent, parseConsent, setDefaultConsent, updateConsent, getConsentTexts } from './modules/consent/index.js';
// Imported straight from the file, NOT from ./modules/email/index.js — that
// barrel re-exports sendEmail, which imports 'server-only' and would crash when
// Payload loads the config (or runs generate:importmap) as a plain Node script.
export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js';
-// Boot-time environment validation (fail fast on misconfigured deploys).
-export { assertEnv, ipalEnvRules } from './modules/env/index.js';
-// Panel-managed form analytics (config-time field builder).
-export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js';
+export { graphAdapter } from './modules/email/graphAdapter.js';
+export { mailAdapter } from './modules/email/mailAdapter.js';
export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js';
-export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js';
// Validation rules are pure — exported server-side too, for re-validating a
// submission inside a server action. (useForm/useContactForm are client-only →
// '@intecion/ipal-kit/client'.)
-export { buildValidator, checked, custom, email, isEmail, maxLength, minLength, pattern, required } from './modules/forms/validators.js';
-export { createContentHelpers } from './modules/frontend/index.js';
+export { buildValidator, isEmail, required, email, minLength, maxLength, checked, pattern, custom } from './modules/forms/validators.js';
+export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js';
+// Panel-managed form analytics (config-time field builder).
+export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js';
// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).
export { createHealthRoute } from './modules/health/index.js';
-export { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js';
-export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath } from './modules/i18n/index.js';
-export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from './modules/i18n/index.js';
-export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js';
-export { resolveLocalized } from './modules/i18n/index.js';
-export { buildIntegrationStatusBanner, buildIntegrationStatusField, recordIntegrationStatus } from './modules/integrations/index.js';
-export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js';
// Read-only MCP server (Claude/agents connect to the site and query it).
export { createMcpRoute } from './modules/mcp/index.js';
-export { buildOptimizeUploadField, buildOptimizeUploadHook, normalizeFilename, normalizeFilenameHook } from './modules/media/index.js';
-export { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage } from './modules/notifications/index.js';
-export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js';
-export { getGlobal, getSiteIntegrations, getSiteSettings, SITE_INTEGRATIONS_SLUG, SITE_SETTINGS_SLUG } from './modules/payload/index.js';
-// Lexical → Markdown (pure, no React) — for AI-readable output.
-export { lexicalToMarkdown } from './modules/richtext/index.js';
+// Boot-time environment validation (fail fast on misconfigured deploys).
+export { assertEnv, ipalEnvRules } from './modules/env/index.js';
+export { getAnalyticsConfig } from './modules/analytics/index.js';
+export { buildSlugField, toSlug } from './modules/slug/index.js';
+export { createLlmsTxtRoute, createSitemapRouteHandler, createManifestHandler } from './modules/seo/index.js';
+export { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js';
export { buildSecurityHeaders } from './modules/security/index.js';
export { buildCsp } from './modules/security/index.js';
-export { buildHreflangAlternates, buildMetadata, composeTitle, readSiteMetaConfig, slugsAcrossLocales } from './modules/seo/index.js';
-export { AI_ASSISTANT_BOTS, AI_TRAINING_BOTS, buildAutoFillMetaHook, buildRobots, buildSitemapEntries, createMetadataGenerator, createPageMetadata, injectAutoFillMeta } from './modules/seo/index.js';
-export { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler } from './modules/seo/index.js';
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js';
export { buildNoindexField } from './modules/seo/index.js';
+export { recordIntegrationStatus, buildIntegrationStatusField, buildIntegrationStatusBanner } from './modules/integrations/index.js';
+export { rowLabel } from './modules/admin-ui/index.js';
+export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js';
export { buildSpeakableJsonLd } from './modules/seo/index.js';
export { buildSummaryField } from './modules/seo/index.js';
-export { buildBreadcrumbJsonLd, buildSiteNavigationJsonLd, buildWebSiteJsonLd } from './modules/seo/index.js';
+export { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } from './modules/seo/index.js';
// Local SEO structured data — LocalBusiness (map pack), Service (offering), FAQPage.
-export { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd } from './modules/seo/index.js';
+export { buildLocalBusinessJsonLd, buildFaqJsonLd, buildServiceJsonLd } from './modules/seo/index.js';
export { buildArticleJsonLd } from './modules/seo/index.js';
export { buildLlmsTxt } from './modules/seo/index.js';
-export { buildSitemapCss, buildSitemapXml, DEFAULT_SITEMAP_CREDIT, SITEMAP_STYLE_PARAM } from './modules/seo/index.js';
-export { buildSlugField, toSlug } from './modules/slug/index.js';
+export { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js';
export { buildR2Storage } from './modules/storage/index.js';
-export { ipalKit } from './plugin.js';
+export { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } from './modules/media/index.js';
+export { buildRevalidateHook, setPublishedAtHook, buildPreventDeleteSystemPage, buildValidateUniqueRole, trackSlugHistoryHook, buildCrossLocaleFieldSync } from './modules/hooks/index.js';
+export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js';
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/index.js.map b/dist/index.js.map
index 1f1b9f3..f717d15 100644
--- a/dist/index.js.map
+++ b/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { AccessOption, Role } from './modules/access/index.js'\nexport {\n adminOnly,\n adminOnlyField,\n adminOrEditor,\n adminOrEditorField,\n adminOrSelf,\n authenticated,\n hasMinimumRole,\n isAdmin,\n isEditor,\n requireRole,\n requireRoleField,\n ROLE_HIERARCHY,\n} from './modules/access/index.js'\nexport { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'\nexport type { A11yState } from './modules/accessibility/index.js'\nexport { rowLabel } from './modules/admin-ui/index.js'\nexport type { RowLabelProps } from './modules/admin-ui/index.js'\nexport type { AnalyticsConfig } from './modules/analytics/index.js'\nexport { getAnalyticsConfig } from './modules/analytics/index.js'\nexport {\n ACCEPT_ALL_CONSENT,\n CONSENT_CATEGORIES,\n CONSENT_COOKIE,\n CONSENT_MAX_AGE,\n CONSENT_VERSION,\n DEFAULT_CONSENT,\n getConsentTexts,\n parseConsent,\n REJECT_ALL_CONSENT,\n serializeConsent,\n setDefaultConsent,\n updateConsent,\n} from './modules/consent/index.js'\nexport type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js'\nexport type { ContentCollectionOption, ContentOption, ResolvedRoute } from './modules/content/index.js'\nexport {\n archiveFieldName,\n blocksToMarkdown,\n buildArchivePath,\n buildEntryPath,\n createMarkdownRenderer,\n createSearchRoute,\n getArchiveEntries,\n MARKDOWN_PREFIX,\n markdownHref,\n markdownResponse,\n parsePageParam,\n prefersMarkdown,\n resolveNotFoundPage,\n resolveRedirect,\n resolveRoute,\n searchContent,\n} from './modules/content/index.js'\nexport type { ArchiveEntries } from './modules/content/index.js'\nexport type { SearchResult } from './modules/content/index.js'\nexport { graphAdapter } from './modules/email/graphAdapter.js'\nexport type { GraphAdapterArgs } from './modules/email/graphAdapter.js'\nexport { mailAdapter } from './modules/email/mailAdapter.js'\nexport type { MailAdapterArgs } from './modules/email/mailAdapter.js'\n// Imported straight from the file, NOT from ./modules/email/index.js — that\n// barrel re-exports sendEmail, which imports 'server-only' and would crash when\n// Payload loads the config (or runs generate:importmap) as a plain Node script.\nexport { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'\nexport type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'\n// Boot-time environment validation (fail fast on misconfigured deploys).\nexport { assertEnv, ipalEnvRules } from './modules/env/index.js'\nexport type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from './modules/env/index.js'\n// Panel-managed form analytics (config-time field builder).\nexport { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'\nexport { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'\nexport { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js'\nexport type {\n FormsCollectionOverrides,\n FormsFieldsOverride,\n FormsOption,\n} from './modules/forms/types.js'\nexport type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js'\n// Validation rules are pure — exported server-side too, for re-validating a\n// submission inside a server action. (useForm/useContactForm are client-only →\n// '@intecion/ipal-kit/client'.)\nexport {\n buildValidator,\n checked,\n custom,\n email,\n isEmail,\n maxLength,\n minLength,\n pattern,\n required,\n} from './modules/forms/validators.js'\nexport type { Rule } from './modules/forms/validators.js'\nexport { createContentHelpers } from './modules/frontend/index.js'\n// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).\nexport { createHealthRoute } from './modules/health/index.js'\nexport { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js'\nexport type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js'\nexport {\n buildLocalizedPath,\n getDefaultLocale,\n getLocaleCodes,\n getLocaleDefinition,\n getLocalizedSlugs,\n isValidLocale,\n LOCALE_COOKIE_NAME,\n matchAcceptLanguage,\n negotiateLocale,\n switchLocalePath,\n} from './modules/i18n/index.js'\nexport type { LocaleMiddlewareResult } from './modules/i18n/index.js'\nexport {\n createLocaleMiddleware,\n DEFAULT_MIDDLEWARE_MATCHER,\n} from './modules/i18n/index.js'\nexport { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js'\nexport { resolveLocalized } from './modules/i18n/index.js'\nexport { buildIntegrationStatusBanner, buildIntegrationStatusField, recordIntegrationStatus } from './modules/integrations/index.js'\nexport type { IntegrationState, IntegrationStatus } from './modules/integrations/index.js'\nexport { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js'\nexport type {\n BuildLinkFieldOptions,\n BuildLinksFieldOptions,\n LinkAppearance,\n LinkValue,\n ResolveLinkHrefOptions,\n} from './modules/links/index.js'\n// Read-only MCP server (Claude/agents connect to the site and query it).\nexport { createMcpRoute } from './modules/mcp/index.js'\nexport { buildOptimizeUploadField, buildOptimizeUploadHook, normalizeFilename, normalizeFilenameHook } from './modules/media/index.js'\nexport type { OptimizeUploadOptions } from './modules/media/index.js'\nexport { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage } from './modules/notifications/index.js'\nexport type { FormNotificationTexts, NotificationTexts } from './modules/notifications/index.js'\nexport type { PagesOption, SystemPageRole } from './modules/pages/index.js'\n\nexport { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'\nexport type { GlobalQueryOptions } from './modules/payload/index.js'\nexport {\n getGlobal,\n getSiteIntegrations,\n getSiteSettings,\n SITE_INTEGRATIONS_SLUG,\n SITE_SETTINGS_SLUG,\n} from './modules/payload/index.js'\n// Lexical → Markdown (pure, no React) — for AI-readable output.\nexport { lexicalToMarkdown } from './modules/richtext/index.js'\nexport { buildSecurityHeaders } from './modules/security/index.js'\nexport { buildCsp } from './modules/security/index.js'\nexport type { BuildCspArgs } from './modules/security/index.js'\nexport type { BuildSecurityHeadersArgs, SecurityHeader } from './modules/security/index.js'\nexport type { PageMetadata, SeoMeta, SeoOption } from './modules/seo/index.js'\nexport {\n buildHreflangAlternates,\n buildMetadata,\n composeTitle,\n readSiteMetaConfig,\n slugsAcrossLocales,\n} from './modules/seo/index.js'\nexport type { SiteMetaConfig } from './modules/seo/index.js'\nexport type { AutoFillMapping, RobotsOptions, RobotsRules, SitemapEntry } from './modules/seo/index.js'\nexport {\n AI_ASSISTANT_BOTS,\n AI_TRAINING_BOTS,\n buildAutoFillMetaHook,\n buildRobots,\n buildSitemapEntries,\n createMetadataGenerator,\n createPageMetadata,\n injectAutoFillMeta,\n} from './modules/seo/index.js'\nexport { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler } from './modules/seo/index.js'\nexport { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js'\nexport { buildNoindexField } from './modules/seo/index.js'\nexport { buildSpeakableJsonLd } from './modules/seo/index.js'\nexport { buildSummaryField } from './modules/seo/index.js'\nexport { buildBreadcrumbJsonLd, buildSiteNavigationJsonLd, buildWebSiteJsonLd } from './modules/seo/index.js'\n// Local SEO structured data — LocalBusiness (map pack), Service (offering), FAQPage.\nexport { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd } from './modules/seo/index.js'\nexport { buildArticleJsonLd } from './modules/seo/index.js'\nexport { buildLlmsTxt } from './modules/seo/index.js'\nexport { buildSitemapCss, buildSitemapXml, DEFAULT_SITEMAP_CREDIT, SITEMAP_STYLE_PARAM } from './modules/seo/index.js'\nexport type { SitemapRouteOptions, SitemapStyleOptions } from './modules/seo/index.js'\nexport { buildSlugField, toSlug } from './modules/slug/index.js'\nexport { buildR2Storage } from './modules/storage/index.js'\nexport { ipalKit } from './plugin.js'\nexport type { IpalOptions } from './types.js'\n"],"names":["adminOnly","adminOnlyField","adminOrEditor","adminOrEditorField","adminOrSelf","authenticated","hasMinimumRole","isAdmin","isEditor","requireRole","requireRoleField","ROLE_HIERARCHY","A11Y_COOKIE","A11Y_DEFAULT","a11yAttributes","parseA11y","serializeA11y","rowLabel","getAnalyticsConfig","ACCEPT_ALL_CONSENT","CONSENT_CATEGORIES","CONSENT_COOKIE","CONSENT_MAX_AGE","CONSENT_VERSION","DEFAULT_CONSENT","getConsentTexts","parseConsent","REJECT_ALL_CONSENT","serializeConsent","setDefaultConsent","updateConsent","archiveFieldName","blocksToMarkdown","buildArchivePath","buildEntryPath","createMarkdownRenderer","createSearchRoute","getArchiveEntries","MARKDOWN_PREFIX","markdownHref","markdownResponse","parsePageParam","prefersMarkdown","resolveNotFoundPage","resolveRedirect","resolveRoute","searchContent","graphAdapter","mailAdapter","panelSmtpAdapter","assertEnv","ipalEnvRules","buildFormAnalyticsFields","buildFormsPlugin","HONEYPOT_FIELD","honeypotInputProps","isHoneypotTripped","buildValidator","checked","custom","email","isEmail","maxLength","minLength","pattern","required","createContentHelpers","createHealthRoute","buildCrossLocaleFieldSync","buildPreventDeleteSystemPage","buildRevalidateHook","buildValidateUniqueRole","setPublishedAtHook","trackSlugHistoryHook","buildLocalizedPath","getDefaultLocale","getLocaleCodes","getLocaleDefinition","getLocalizedSlugs","isValidLocale","LOCALE_COOKIE_NAME","matchAcceptLanguage","negotiateLocale","switchLocalePath","createLocaleMiddleware","DEFAULT_MIDDLEWARE_MATCHER","createProxy","DEFAULT_PROXY_MATCHER","resolveLocalized","buildIntegrationStatusBanner","buildIntegrationStatusField","recordIntegrationStatus","buildLinkField","buildLinksField","resolveLinkHref","createMcpRoute","buildOptimizeUploadField","buildOptimizeUploadHook","normalizeFilename","normalizeFilenameHook","getNotificationTexts","NOTIFICATION_FALLBACK","resolveFormMessage","ALL_SYSTEM_PAGE_ROLES","getSystemPagePath","getGlobal","getSiteIntegrations","getSiteSettings","SITE_INTEGRATIONS_SLUG","SITE_SETTINGS_SLUG","lexicalToMarkdown","buildSecurityHeaders","buildCsp","buildHreflangAlternates","buildMetadata","composeTitle","readSiteMetaConfig","slugsAcrossLocales","AI_ASSISTANT_BOTS","AI_TRAINING_BOTS","buildAutoFillMetaHook","buildRobots","buildSitemapEntries","createMetadataGenerator","createPageMetadata","injectAutoFillMeta","createLlmsTxtRoute","createManifestHandler","createSitemapRouteHandler","buildIconsMetadata","buildOrganizationJsonLd","validateFaviconField","buildNoindexField","buildSpeakableJsonLd","buildSummaryField","buildBreadcrumbJsonLd","buildSiteNavigationJsonLd","buildWebSiteJsonLd","buildFaqJsonLd","buildLocalBusinessJsonLd","buildServiceJsonLd","buildArticleJsonLd","buildLlmsTxt","buildSitemapCss","buildSitemapXml","DEFAULT_SITEMAP_CREDIT","SITEMAP_STYLE_PARAM","buildSlugField","toSlug","buildR2Storage","ipalKit"],"mappings":"AACA,SACEA,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,kBAAkB,EAClBC,WAAW,EACXC,aAAa,EACbC,cAAc,EACdC,OAAO,EACPC,QAAQ,EACRC,WAAW,EACXC,gBAAgB,EAChBC,cAAc,QACT,4BAA2B;AAClC,SAASC,WAAW,EAAEC,YAAY,EAAEC,cAAc,EAAEC,SAAS,EAAEC,aAAa,QAAQ,mCAAkC;AAEtH,SAASC,QAAQ,QAAQ,8BAA6B;AAGtD,SAASC,kBAAkB,QAAQ,+BAA8B;AACjE,SACEC,kBAAkB,EAClBC,kBAAkB,EAClBC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,gBAAgB,EAChBC,iBAAiB,EACjBC,aAAa,QACR,6BAA4B;AAGnC,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,sBAAsB,EACtBC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,YAAY,EACZC,gBAAgB,EAChBC,cAAc,EACdC,eAAe,EACfC,mBAAmB,EACnBC,eAAe,EACfC,YAAY,EACZC,aAAa,QACR,6BAA4B;AAGnC,SAASC,YAAY,QAAQ,kCAAiC;AAE9D,SAASC,WAAW,QAAQ,iCAAgC;AAE5D,4EAA4E;AAC5E,gFAAgF;AAChF,gFAAgF;AAChF,SAASC,gBAAgB,QAAQ,sCAAqC;AAEtE,yEAAyE;AACzE,SAASC,SAAS,EAAEC,YAAY,QAAQ,yBAAwB;AAEhE,4DAA4D;AAC5D,SAASC,wBAAwB,QAAQ,yCAAwC;AACjF,SAASC,gBAAgB,QAAQ,uCAAsC;AACvE,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,iBAAiB,QAAQ,8BAA6B;AAOnG,4EAA4E;AAC5E,+EAA+E;AAC/E,gCAAgC;AAChC,SACEC,cAAc,EACdC,OAAO,EACPC,MAAM,EACNC,KAAK,EACLC,OAAO,EACPC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,gCAA+B;AAEtC,SAASC,oBAAoB,QAAQ,8BAA6B;AAClE,yEAAyE;AACzE,SAASC,iBAAiB,QAAQ,4BAA2B;AAC7D,SAASC,yBAAyB,EAAEC,4BAA4B,EAAEC,mBAAmB,EAAEC,uBAAuB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,2BAA0B;AAE1L,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,EACdC,mBAAmB,EACnBC,iBAAiB,EACjBC,aAAa,EACbC,kBAAkB,EAClBC,mBAAmB,EACnBC,eAAe,EACfC,gBAAgB,QACX,0BAAyB;AAEhC,SACEC,sBAAsB,EACtBC,0BAA0B,QACrB,0BAAyB;AAChC,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,0BAAyB;AAC5E,SAASC,gBAAgB,QAAQ,0BAAyB;AAC1D,SAASC,4BAA4B,EAAEC,2BAA2B,EAAEC,uBAAuB,QAAQ,kCAAiC;AAEpI,SAASC,cAAc,EAAEC,eAAe,EAAEC,eAAe,QAAQ,2BAA0B;AAQ3F,yEAAyE;AACzE,SAASC,cAAc,QAAQ,yBAAwB;AACvD,SAASC,wBAAwB,EAAEC,uBAAuB,EAAEC,iBAAiB,EAAEC,qBAAqB,QAAQ,2BAA0B;AAEtI,SAASC,oBAAoB,EAAEC,qBAAqB,EAAEC,kBAAkB,QAAQ,mCAAkC;AAIlH,SAASC,qBAAqB,EAAEC,iBAAiB,QAAQ,2BAA0B;AAEnF,SACEC,SAAS,EACTC,mBAAmB,EACnBC,eAAe,EACfC,sBAAsB,EACtBC,kBAAkB,QACb,6BAA4B;AACnC,gEAAgE;AAChE,SAASC,iBAAiB,QAAQ,8BAA6B;AAC/D,SAASC,oBAAoB,QAAQ,8BAA6B;AAClE,SAASC,QAAQ,QAAQ,8BAA6B;AAItD,SACEC,uBAAuB,EACvBC,aAAa,EACbC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,QACb,yBAAwB;AAG/B,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,qBAAqB,EACrBC,WAAW,EACXC,mBAAmB,EACnBC,uBAAuB,EACvBC,kBAAkB,EAClBC,kBAAkB,QACb,yBAAwB;AAC/B,SAASC,kBAAkB,EAAEC,qBAAqB,EAAEC,yBAAyB,QAAQ,yBAAwB;AAC7G,SAASC,kBAAkB,EAAEC,uBAAuB,EAAEC,oBAAoB,QAAQ,yBAAwB;AAC1G,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,qBAAqB,EAAEC,yBAAyB,EAAEC,kBAAkB,QAAQ,yBAAwB;AAC7G,qFAAqF;AACrF,SAASC,cAAc,EAAEC,wBAAwB,EAAEC,kBAAkB,QAAQ,yBAAwB;AACrG,SAASC,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,YAAY,QAAQ,yBAAwB;AACrD,SAASC,eAAe,EAAEC,eAAe,EAAEC,sBAAsB,EAAEC,mBAAmB,QAAQ,yBAAwB;AAEtH,SAASC,cAAc,EAAEC,MAAM,QAAQ,0BAAyB;AAChE,SAASC,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,OAAO,QAAQ,cAAa"}
\ No newline at end of file
+{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { ipalKit } from './plugin.js'\nexport type { IpalOptions } from './types.js'\nexport type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js'\nexport {\n buildLocalizedPath,\n getDefaultLocale,\n getLocaleCodes,\n getLocaleDefinition,\n getLocalizedSlugs,\n isValidLocale,\n LOCALE_COOKIE_NAME,\n matchAcceptLanguage,\n negotiateLocale,\n switchLocalePath,\n} from './modules/i18n/index.js'\nexport type { PagesOption, SystemPageRole } from './modules/pages/index.js'\nexport { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'\nexport type { AccessOption, Role } from './modules/access/index.js'\nexport {\n adminOnly,\n adminOnlyField,\n adminOrEditor,\n adminOrEditorField,\n adminOrSelf,\n authenticated,\n hasMinimumRole,\n isAdmin,\n isEditor,\n requireRole,\n requireRoleField,\n ROLE_HIERARCHY,\n} from './modules/access/index.js'\nexport type { GlobalQueryOptions } from './modules/payload/index.js'\nexport {\n getGlobal,\n getSiteSettings,\n getSiteIntegrations,\n SITE_SETTINGS_SLUG,\n SITE_INTEGRATIONS_SLUG,\n} from './modules/payload/index.js'\nexport type { SeoOption, SeoMeta, PageMetadata } from './modules/seo/index.js'\nexport {\n composeTitle,\n buildHreflangAlternates,\n buildMetadata,\n readSiteMetaConfig,\n slugsAcrossLocales,\n} from './modules/seo/index.js'\nexport type { SiteMetaConfig } from './modules/seo/index.js'\nexport type { ContentOption, ContentCollectionOption, ResolvedRoute } from './modules/content/index.js'\nexport { createContentHelpers } from './modules/frontend/index.js'\nexport {\n resolveRoute,\n resolveRedirect,\n resolveNotFoundPage,\n blocksToMarkdown,\n createMarkdownRenderer,\n markdownResponse,\n prefersMarkdown,\n markdownHref,\n MARKDOWN_PREFIX,\n searchContent,\n createSearchRoute,\n archiveFieldName,\n getArchiveEntries,\n buildArchivePath,\n buildEntryPath,\n parsePageParam,\n} from './modules/content/index.js'\nexport type { ArchiveEntries } from './modules/content/index.js'\nexport type { SearchResult } from './modules/content/index.js'\n// Lexical → Markdown (pure, no React) — for AI-readable output.\nexport { lexicalToMarkdown } from './modules/richtext/index.js'\nexport type { AutoFillMapping, SitemapEntry, RobotsRules, RobotsOptions } from './modules/seo/index.js'\nexport {\n buildAutoFillMetaHook,\n injectAutoFillMeta,\n createMetadataGenerator,\n createPageMetadata,\n buildSitemapEntries,\n buildRobots,\n AI_ASSISTANT_BOTS,\n AI_TRAINING_BOTS,\n} from './modules/seo/index.js'\nexport type { LocaleMiddlewareResult } from './modules/i18n/index.js'\nexport {\n createLocaleMiddleware,\n DEFAULT_MIDDLEWARE_MATCHER,\n} from './modules/i18n/index.js'\nexport { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js'\nexport { resolveLocalized } from './modules/i18n/index.js'\nexport {\n CONSENT_CATEGORIES,\n DEFAULT_CONSENT,\n ACCEPT_ALL_CONSENT,\n REJECT_ALL_CONSENT,\n CONSENT_COOKIE,\n CONSENT_VERSION,\n CONSENT_MAX_AGE,\n serializeConsent,\n parseConsent,\n setDefaultConsent,\n updateConsent,\n getConsentTexts,\n} from './modules/consent/index.js'\nexport type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js'\n// Imported straight from the file, NOT from ./modules/email/index.js — that\n// barrel re-exports sendEmail, which imports 'server-only' and would crash when\n// Payload loads the config (or runs generate:importmap) as a plain Node script.\nexport { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'\nexport { graphAdapter } from './modules/email/graphAdapter.js'\nexport { mailAdapter } from './modules/email/mailAdapter.js'\nexport type { MailAdapterArgs } from './modules/email/mailAdapter.js'\nexport type { GraphAdapterArgs } from './modules/email/graphAdapter.js'\nexport type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'\nexport { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'\nexport type {\n FormsOption,\n FormsCollectionOverrides,\n FormsFieldsOverride,\n} from './modules/forms/types.js'\n// Validation rules are pure — exported server-side too, for re-validating a\n// submission inside a server action. (useForm/useContactForm are client-only →\n// '@intecion/ipal-kit/client'.)\nexport {\n buildValidator,\n isEmail,\n required,\n email,\n minLength,\n maxLength,\n checked,\n pattern,\n custom,\n} from './modules/forms/validators.js'\nexport type { Rule } from './modules/forms/validators.js'\nexport type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js'\nexport { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js'\n// Panel-managed form analytics (config-time field builder).\nexport { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'\n// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).\nexport { createHealthRoute } from './modules/health/index.js'\n// Read-only MCP server (Claude/agents connect to the site and query it).\nexport { createMcpRoute } from './modules/mcp/index.js'\n// Boot-time environment validation (fail fast on misconfigured deploys).\nexport { assertEnv, ipalEnvRules } from './modules/env/index.js'\nexport type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from './modules/env/index.js'\nexport type { AnalyticsConfig } from './modules/analytics/index.js'\nexport { getAnalyticsConfig } from './modules/analytics/index.js'\nexport { buildSlugField, toSlug } from './modules/slug/index.js'\nexport { createLlmsTxtRoute, createSitemapRouteHandler, createManifestHandler } from './modules/seo/index.js'\n\nexport { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js'\nexport { buildSecurityHeaders } from './modules/security/index.js'\nexport { buildCsp } from './modules/security/index.js'\nexport type { BuildCspArgs } from './modules/security/index.js'\nexport { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js'\nexport { buildNoindexField } from './modules/seo/index.js'\nexport { recordIntegrationStatus, buildIntegrationStatusField, buildIntegrationStatusBanner } from './modules/integrations/index.js'\nexport type { IntegrationStatus, IntegrationState } from './modules/integrations/index.js'\nexport { rowLabel } from './modules/admin-ui/index.js'\nexport type { RowLabelProps } from './modules/admin-ui/index.js'\nexport { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js'\nexport type {\n LinkAppearance,\n LinkValue,\n BuildLinkFieldOptions,\n BuildLinksFieldOptions,\n ResolveLinkHrefOptions,\n} from './modules/links/index.js'\nexport { buildSpeakableJsonLd } from './modules/seo/index.js'\nexport { buildSummaryField } from './modules/seo/index.js'\nexport { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } from './modules/seo/index.js'\n// Local SEO structured data — LocalBusiness (map pack), Service (offering), FAQPage.\nexport { buildLocalBusinessJsonLd, buildFaqJsonLd, buildServiceJsonLd } from './modules/seo/index.js'\nexport { buildArticleJsonLd } from './modules/seo/index.js'\nexport { buildLlmsTxt } from './modules/seo/index.js'\nexport { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js'\nexport type { SitemapRouteOptions, SitemapStyleOptions } from './modules/seo/index.js'\nexport { buildR2Storage } from './modules/storage/index.js'\nexport { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } from './modules/media/index.js'\nexport type { OptimizeUploadOptions } from './modules/media/index.js'\nexport { buildRevalidateHook, setPublishedAtHook, buildPreventDeleteSystemPage, buildValidateUniqueRole, trackSlugHistoryHook, buildCrossLocaleFieldSync } from './modules/hooks/index.js'\nexport { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'\nexport type { A11yState } from './modules/accessibility/index.js'\nexport type { SecurityHeader, BuildSecurityHeadersArgs } from './modules/security/index.js'\nexport type { NotificationTexts, FormNotificationTexts } from './modules/notifications/index.js'\n"],"names":["ipalKit","buildLocalizedPath","getDefaultLocale","getLocaleCodes","getLocaleDefinition","getLocalizedSlugs","isValidLocale","LOCALE_COOKIE_NAME","matchAcceptLanguage","negotiateLocale","switchLocalePath","ALL_SYSTEM_PAGE_ROLES","getSystemPagePath","adminOnly","adminOnlyField","adminOrEditor","adminOrEditorField","adminOrSelf","authenticated","hasMinimumRole","isAdmin","isEditor","requireRole","requireRoleField","ROLE_HIERARCHY","getGlobal","getSiteSettings","getSiteIntegrations","SITE_SETTINGS_SLUG","SITE_INTEGRATIONS_SLUG","composeTitle","buildHreflangAlternates","buildMetadata","readSiteMetaConfig","slugsAcrossLocales","createContentHelpers","resolveRoute","resolveRedirect","resolveNotFoundPage","blocksToMarkdown","createMarkdownRenderer","markdownResponse","prefersMarkdown","markdownHref","MARKDOWN_PREFIX","searchContent","createSearchRoute","archiveFieldName","getArchiveEntries","buildArchivePath","buildEntryPath","parsePageParam","lexicalToMarkdown","buildAutoFillMetaHook","injectAutoFillMeta","createMetadataGenerator","createPageMetadata","buildSitemapEntries","buildRobots","AI_ASSISTANT_BOTS","AI_TRAINING_BOTS","createLocaleMiddleware","DEFAULT_MIDDLEWARE_MATCHER","createProxy","DEFAULT_PROXY_MATCHER","resolveLocalized","CONSENT_CATEGORIES","DEFAULT_CONSENT","ACCEPT_ALL_CONSENT","REJECT_ALL_CONSENT","CONSENT_COOKIE","CONSENT_VERSION","CONSENT_MAX_AGE","serializeConsent","parseConsent","setDefaultConsent","updateConsent","getConsentTexts","panelSmtpAdapter","graphAdapter","mailAdapter","buildFormsPlugin","buildValidator","isEmail","required","email","minLength","maxLength","checked","pattern","custom","HONEYPOT_FIELD","honeypotInputProps","isHoneypotTripped","buildFormAnalyticsFields","createHealthRoute","createMcpRoute","assertEnv","ipalEnvRules","getAnalyticsConfig","buildSlugField","toSlug","createLlmsTxtRoute","createSitemapRouteHandler","createManifestHandler","getNotificationTexts","resolveFormMessage","NOTIFICATION_FALLBACK","buildSecurityHeaders","buildCsp","buildIconsMetadata","buildOrganizationJsonLd","validateFaviconField","buildNoindexField","recordIntegrationStatus","buildIntegrationStatusField","buildIntegrationStatusBanner","rowLabel","buildLinkField","buildLinksField","resolveLinkHref","buildSpeakableJsonLd","buildSummaryField","buildWebSiteJsonLd","buildBreadcrumbJsonLd","buildSiteNavigationJsonLd","buildLocalBusinessJsonLd","buildFaqJsonLd","buildServiceJsonLd","buildArticleJsonLd","buildLlmsTxt","buildSitemapXml","buildSitemapCss","SITEMAP_STYLE_PARAM","DEFAULT_SITEMAP_CREDIT","buildR2Storage","normalizeFilename","normalizeFilenameHook","buildOptimizeUploadHook","buildOptimizeUploadField","buildRevalidateHook","setPublishedAtHook","buildPreventDeleteSystemPage","buildValidateUniqueRole","trackSlugHistoryHook","buildCrossLocaleFieldSync","A11Y_COOKIE","A11Y_DEFAULT","a11yAttributes","parseA11y","serializeA11y"],"mappings":"AAAA,SAASA,OAAO,QAAQ,cAAa;AAGrC,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,EACdC,mBAAmB,EACnBC,iBAAiB,EACjBC,aAAa,EACbC,kBAAkB,EAClBC,mBAAmB,EACnBC,eAAe,EACfC,gBAAgB,QACX,0BAAyB;AAEhC,SAASC,qBAAqB,EAAEC,iBAAiB,QAAQ,2BAA0B;AAEnF,SACEC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,kBAAkB,EAClBC,WAAW,EACXC,aAAa,EACbC,cAAc,EACdC,OAAO,EACPC,QAAQ,EACRC,WAAW,EACXC,gBAAgB,EAChBC,cAAc,QACT,4BAA2B;AAElC,SACEC,SAAS,EACTC,eAAe,EACfC,mBAAmB,EACnBC,kBAAkB,EAClBC,sBAAsB,QACjB,6BAA4B;AAEnC,SACEC,YAAY,EACZC,uBAAuB,EACvBC,aAAa,EACbC,kBAAkB,EAClBC,kBAAkB,QACb,yBAAwB;AAG/B,SAASC,oBAAoB,QAAQ,8BAA6B;AAClE,SACEC,YAAY,EACZC,eAAe,EACfC,mBAAmB,EACnBC,gBAAgB,EAChBC,sBAAsB,EACtBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,eAAe,EACfC,aAAa,EACbC,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,cAAc,EACdC,cAAc,QACT,6BAA4B;AAGnC,gEAAgE;AAChE,SAASC,iBAAiB,QAAQ,8BAA6B;AAE/D,SACEC,qBAAqB,EACrBC,kBAAkB,EAClBC,uBAAuB,EACvBC,kBAAkB,EAClBC,mBAAmB,EACnBC,WAAW,EACXC,iBAAiB,EACjBC,gBAAgB,QACX,yBAAwB;AAE/B,SACEC,sBAAsB,EACtBC,0BAA0B,QACrB,0BAAyB;AAChC,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,0BAAyB;AAC5E,SAASC,gBAAgB,QAAQ,0BAAyB;AAC1D,SACEC,kBAAkB,EAClBC,eAAe,EACfC,kBAAkB,EAClBC,kBAAkB,EAClBC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,YAAY,EACZC,iBAAiB,EACjBC,aAAa,EACbC,eAAe,QACV,6BAA4B;AAEnC,4EAA4E;AAC5E,gFAAgF;AAChF,gFAAgF;AAChF,SAASC,gBAAgB,QAAQ,sCAAqC;AACtE,SAASC,YAAY,QAAQ,kCAAiC;AAC9D,SAASC,WAAW,QAAQ,iCAAgC;AAI5D,SAASC,gBAAgB,QAAQ,uCAAsC;AAMvE,4EAA4E;AAC5E,+EAA+E;AAC/E,gCAAgC;AAChC,SACEC,cAAc,EACdC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,MAAM,QACD,gCAA+B;AAGtC,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,iBAAiB,QAAQ,8BAA6B;AACnG,4DAA4D;AAC5D,SAASC,wBAAwB,QAAQ,yCAAwC;AACjF,yEAAyE;AACzE,SAASC,iBAAiB,QAAQ,4BAA2B;AAC7D,yEAAyE;AACzE,SAASC,cAAc,QAAQ,yBAAwB;AACvD,yEAAyE;AACzE,SAASC,SAAS,EAAEC,YAAY,QAAQ,yBAAwB;AAGhE,SAASC,kBAAkB,QAAQ,+BAA8B;AACjE,SAASC,cAAc,EAAEC,MAAM,QAAQ,0BAAyB;AAChE,SAASC,kBAAkB,EAAEC,yBAAyB,EAAEC,qBAAqB,QAAQ,yBAAwB;AAE7G,SAASC,oBAAoB,EAAEC,kBAAkB,EAAEC,qBAAqB,QAAQ,mCAAkC;AAClH,SAASC,oBAAoB,QAAQ,8BAA6B;AAClE,SAASC,QAAQ,QAAQ,8BAA6B;AAEtD,SAASC,kBAAkB,EAAEC,uBAAuB,EAAEC,oBAAoB,QAAQ,yBAAwB;AAC1G,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,uBAAuB,EAAEC,2BAA2B,EAAEC,4BAA4B,QAAQ,kCAAiC;AAEpI,SAASC,QAAQ,QAAQ,8BAA6B;AAEtD,SAASC,cAAc,EAAEC,eAAe,EAAEC,eAAe,QAAQ,2BAA0B;AAQ3F,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,kBAAkB,EAAEC,qBAAqB,EAAEC,yBAAyB,QAAQ,yBAAwB;AAC7G,qFAAqF;AACrF,SAASC,wBAAwB,EAAEC,cAAc,EAAEC,kBAAkB,QAAQ,yBAAwB;AACrG,SAASC,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,YAAY,QAAQ,yBAAwB;AACrD,SAASC,eAAe,EAAEC,eAAe,EAAEC,mBAAmB,EAAEC,sBAAsB,QAAQ,yBAAwB;AAEtH,SAASC,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,iBAAiB,EAAEC,qBAAqB,EAAEC,uBAAuB,EAAEC,wBAAwB,QAAQ,2BAA0B;AAEtI,SAASC,mBAAmB,EAAEC,kBAAkB,EAAEC,4BAA4B,EAAEC,uBAAuB,EAAEC,oBAAoB,EAAEC,yBAAyB,QAAQ,2BAA0B;AAC1L,SAASC,WAAW,EAAEC,YAAY,EAAEC,cAAc,EAAEC,SAAS,EAAEC,aAAa,QAAQ,mCAAkC"}
\ No newline at end of file
diff --git a/dist/modules/email/mailAdapter.d.ts b/dist/modules/email/mailAdapter.d.ts
index 2483bc0..0e9f0d2 100644
--- a/dist/modules/email/mailAdapter.d.ts
+++ b/dist/modules/email/mailAdapter.d.ts
@@ -1,11 +1,11 @@
import type { PayloadEmailAdapter } from 'payload';
-import { type GraphAdapterArgs } from './graphAdapter.js';
import { type PanelSmtpAdapterArgs } from './panelSmtpAdapter.js';
+import { type GraphAdapterArgs } from './graphAdapter.js';
export type MailAdapterArgs = {
+ smtp?: PanelSmtpAdapterArgs;
+ graph?: GraphAdapterArgs;
fallbackFromAddress?: string;
fallbackFromName?: string;
- graph?: GraphAdapterArgs;
- smtp?: PanelSmtpAdapterArgs;
};
/**
* Dispatcher email adapter: wired into the config ONCE, but picks the transport
diff --git a/dist/modules/email/mailAdapter.js b/dist/modules/email/mailAdapter.js
index 8e90916..fc5b571 100644
--- a/dist/modules/email/mailAdapter.js
+++ b/dist/modules/email/mailAdapter.js
@@ -1,6 +1,9 @@
import { getSiteIntegrations } from '../payload/index.js';
-import { graphAdapter } from './graphAdapter.js';
+import { recordIntegrationStatus } from '../integrations/status.js';
import { panelSmtpAdapter } from './panelSmtpAdapter.js';
+import { graphAdapter } from './graphAdapter.js';
+const STATUS_FIELD = 'emailStatus';
+/** Error text for the panel: first line, no stack, capped — SMTP errors don't carry the password. */ const describe = (err)=>(err instanceof Error ? err.message : String(err)).split('\n')[0].slice(0, 200);
/** True when the agency Graph credentials are present in the environment. */ function graphAvailable() {
return Boolean(process.env.GRAPH_TENANT_ID && process.env.GRAPH_CLIENT_ID && process.env.GRAPH_CLIENT_SECRET && process.env.GRAPH_SENDER);
}
@@ -41,16 +44,48 @@ import { panelSmtpAdapter } from './panelSmtpAdapter.js';
sendEmail: async (message)=>{
const settings = await getSiteIntegrations(payload);
const choice = settings.emailTransport ?? 'smtp';
- if (choice === 'graph') {
- if (graphAvailable()) {
- return graph.sendEmail(message);
- }
+ const previous = settings[STATUS_FIELD];
+ const useGraph = choice === 'graph' && graphAvailable();
+ const graphFallback = choice === 'graph' && !useGraph;
+ if (graphFallback) {
// Panel asked for Graph but the agency creds aren't configured for
// this project. Fall back to SMTP rather than silently dropping mail.
payload.logger.warn('[ipal] Transport set to Graph but GRAPH_* env vars are missing; falling back to SMTP.');
- return smtp.sendEmail(message);
}
- return smtp.sendEmail(message);
+ const transport = useGraph ? 'Microsoft Graph' : 'SMTP';
+ const code = useGraph ? 'graph-error' : 'smtp-error';
+ let result;
+ try {
+ result = await (useGraph ? graph : smtp).sendEmail(message);
+ } catch (err) {
+ await recordIntegrationStatus(payload, STATUS_FIELD, previous, {
+ state: 'degraded',
+ code,
+ message: `${transport}: ${describe(err)}`
+ });
+ throw err // callers (form-builder, Send test) still see the failure
+ ;
+ }
+ // The delegates report failure as { sent: false, error, detail? } instead
+ // of throwing (a broken mailbox must not crash a form submission).
+ const failed = result;
+ if (failed && typeof failed === 'object' && failed.sent === false) {
+ await recordIntegrationStatus(payload, STATUS_FIELD, previous, {
+ state: 'degraded',
+ code,
+ message: `${transport}: ${describe(failed.detail ?? failed.error ?? 'not sent')}`
+ });
+ return result;
+ }
+ // Graph selected but unavailable is a configuration problem even if SMTP delivered.
+ await recordIntegrationStatus(payload, STATUS_FIELD, previous, graphFallback ? {
+ state: 'degraded',
+ code: 'graph-unavailable',
+ message: 'Microsoft Graph is selected but not configured on the server — e-mails are sent over SMTP.'
+ } : {
+ state: 'ok'
+ });
+ return result;
}
};
};
diff --git a/dist/modules/email/mailAdapter.js.map b/dist/modules/email/mailAdapter.js.map
index b514135..bb4b38e 100644
--- a/dist/modules/email/mailAdapter.js.map
+++ b/dist/modules/email/mailAdapter.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../src/modules/email/mailAdapter.ts"],"sourcesContent":["import type { PayloadEmailAdapter, SendEmailOptions } from 'payload'\n\nimport { getSiteIntegrations } from '../payload/index.js'\nimport { graphAdapter, type GraphAdapterArgs } from './graphAdapter.js'\nimport { panelSmtpAdapter, type PanelSmtpAdapterArgs } from './panelSmtpAdapter.js'\n\ntype TransportIntegrations = {\n /** 'smtp' | 'graph' — chosen by the editor in SiteIntegrations. */\n emailTransport?: 'graph' | 'smtp' | null\n}\n\nexport type MailAdapterArgs = {\n fallbackFromAddress?: string\n fallbackFromName?: string\n graph?: GraphAdapterArgs\n smtp?: PanelSmtpAdapterArgs\n}\n\n/** True when the agency Graph credentials are present in the environment. */\nfunction graphAvailable(): boolean {\n return Boolean(\n process.env.GRAPH_TENANT_ID &&\n process.env.GRAPH_CLIENT_ID &&\n process.env.GRAPH_CLIENT_SECRET &&\n process.env.GRAPH_SENDER,\n )\n}\n\n/**\n * Dispatcher email adapter: wired into the config ONCE, but picks the transport\n * (SMTP or Graph) per send by reading `emailTransport` from SiteIntegrations.\n * This is what makes the choice switchable in the panel — Payload builds the\n * email adapter at boot and can't swap it at runtime, so instead of choosing\n * between two adapters at boot we install one that delegates on every send.\n *\n * Availability guard: Graph only runs if its agency credentials exist in env\n * (this is *our* Exchange). If the panel says 'graph' but env isn't set up,\n * we DON'T silently fail — we log clearly and fall back to SMTP, so a client\n * flipping the switch without the backing config still gets mail out (over SMTP)\n * rather than silent nothing. If neither is usable, the send reports an error.\n *\n * @example\n * // payload.config.ts\n * import { mailAdapter } from '@intecion/ipal-kit'\n * email: mailAdapter()\n */\nexport const mailAdapter =\n (args: MailAdapterArgs = {}): PayloadEmailAdapter =>\n (deps) => {\n // Build both delegates once; each still resolves its own config per send.\n const smtp = panelSmtpAdapter({\n fallbackFromAddress: args.fallbackFromAddress,\n fallbackFromName: args.fallbackFromName,\n ...args.smtp,\n })(deps)\n const graph = graphAdapter({\n fallbackFromAddress: args.fallbackFromAddress,\n fallbackFromName: args.fallbackFromName,\n ...args.graph,\n })(deps)\n\n const { payload } = deps\n\n return {\n name: 'ipal-mail-dispatcher',\n defaultFromAddress: smtp.defaultFromAddress,\n defaultFromName: smtp.defaultFromName,\n\n sendEmail: async (message: SendEmailOptions) => {\n const settings = await getSiteIntegrations(payload)\n const choice = settings.emailTransport ?? 'smtp'\n\n if (choice === 'graph') {\n if (graphAvailable()) {\n return graph.sendEmail(message)\n }\n // Panel asked for Graph but the agency creds aren't configured for\n // this project. Fall back to SMTP rather than silently dropping mail.\n payload.logger.warn(\n '[ipal] Transport set to Graph but GRAPH_* env vars are missing; falling back to SMTP.',\n )\n return smtp.sendEmail(message)\n }\n\n return smtp.sendEmail(message)\n },\n }\n }\n"],"names":["getSiteIntegrations","graphAdapter","panelSmtpAdapter","graphAvailable","Boolean","process","env","GRAPH_TENANT_ID","GRAPH_CLIENT_ID","GRAPH_CLIENT_SECRET","GRAPH_SENDER","mailAdapter","args","deps","smtp","fallbackFromAddress","fallbackFromName","graph","payload","name","defaultFromAddress","defaultFromName","sendEmail","message","settings","choice","emailTransport","logger","warn"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,sBAAqB;AACzD,SAASC,YAAY,QAA+B,oBAAmB;AACvE,SAASC,gBAAgB,QAAmC,wBAAuB;AAcnF,2EAA2E,GAC3E,SAASC;IACP,OAAOC,QACLC,QAAQC,GAAG,CAACC,eAAe,IAC3BF,QAAQC,GAAG,CAACE,eAAe,IAC3BH,QAAQC,GAAG,CAACG,mBAAmB,IAC/BJ,QAAQC,GAAG,CAACI,YAAY;AAE5B;AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,MAAMC,cACX,CAACC,OAAwB,CAAC,CAAC,GAC3B,CAACC;QACC,0EAA0E;QAC1E,MAAMC,OAAOZ,iBAAiB;YAC5Ba,qBAAqBH,KAAKG,mBAAmB;YAC7CC,kBAAkBJ,KAAKI,gBAAgB;YACvC,GAAGJ,KAAKE,IAAI;QACd,GAAGD;QACH,MAAMI,QAAQhB,aAAa;YACzBc,qBAAqBH,KAAKG,mBAAmB;YAC7CC,kBAAkBJ,KAAKI,gBAAgB;YACvC,GAAGJ,KAAKK,KAAK;QACf,GAAGJ;QAEH,MAAM,EAAEK,OAAO,EAAE,GAAGL;QAEpB,OAAO;YACLM,MAAM;YACNC,oBAAoBN,KAAKM,kBAAkB;YAC3CC,iBAAiBP,KAAKO,eAAe;YAErCC,WAAW,OAAOC;gBAChB,MAAMC,WAAW,MAAMxB,oBAA2CkB;gBAClE,MAAMO,SAASD,SAASE,cAAc,IAAI;gBAE1C,IAAID,WAAW,SAAS;oBACtB,IAAItB,kBAAkB;wBACpB,OAAOc,MAAMK,SAAS,CAACC;oBACzB;oBACA,mEAAmE;oBACnE,sEAAsE;oBACtEL,QAAQS,MAAM,CAACC,IAAI,CACjB;oBAEF,OAAOd,KAAKQ,SAAS,CAACC;gBACxB;gBAEA,OAAOT,KAAKQ,SAAS,CAACC;YACxB;QACF;IACF,EAAC"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/modules/email/mailAdapter.ts"],"sourcesContent":["import type { PayloadEmailAdapter, SendEmailOptions } from 'payload'\nimport { getSiteIntegrations } from '../payload/index.js'\nimport { recordIntegrationStatus, type IntegrationStatus } from '../integrations/status.js'\nimport { panelSmtpAdapter, type PanelSmtpAdapterArgs } from './panelSmtpAdapter.js'\nimport { graphAdapter, type GraphAdapterArgs } from './graphAdapter.js'\n\ntype TransportIntegrations = {\n /** 'smtp' | 'graph' — chosen by the editor in SiteIntegrations. */\n emailTransport?: 'smtp' | 'graph' | null\n emailStatus?: IntegrationStatus | null\n}\n\nconst STATUS_FIELD = 'emailStatus'\n/** Error text for the panel: first line, no stack, capped — SMTP errors don't carry the password. */\nconst describe = (err: unknown) =>\n (err instanceof Error ? err.message : String(err)).split('\\n')[0].slice(0, 200)\n\nexport type MailAdapterArgs = {\n smtp?: PanelSmtpAdapterArgs\n graph?: GraphAdapterArgs\n fallbackFromAddress?: string\n fallbackFromName?: string\n}\n\n/** True when the agency Graph credentials are present in the environment. */\nfunction graphAvailable(): boolean {\n return Boolean(\n process.env.GRAPH_TENANT_ID &&\n process.env.GRAPH_CLIENT_ID &&\n process.env.GRAPH_CLIENT_SECRET &&\n process.env.GRAPH_SENDER,\n )\n}\n\n/**\n * Dispatcher email adapter: wired into the config ONCE, but picks the transport\n * (SMTP or Graph) per send by reading `emailTransport` from SiteIntegrations.\n * This is what makes the choice switchable in the panel — Payload builds the\n * email adapter at boot and can't swap it at runtime, so instead of choosing\n * between two adapters at boot we install one that delegates on every send.\n *\n * Availability guard: Graph only runs if its agency credentials exist in env\n * (this is *our* Exchange). If the panel says 'graph' but env isn't set up,\n * we DON'T silently fail — we log clearly and fall back to SMTP, so a client\n * flipping the switch without the backing config still gets mail out (over SMTP)\n * rather than silent nothing. If neither is usable, the send reports an error.\n *\n * @example\n * // payload.config.ts\n * import { mailAdapter } from '@intecion/ipal-kit'\n * email: mailAdapter()\n */\nexport const mailAdapter =\n (args: MailAdapterArgs = {}): PayloadEmailAdapter =>\n (deps) => {\n // Build both delegates once; each still resolves its own config per send.\n const smtp = panelSmtpAdapter({\n fallbackFromAddress: args.fallbackFromAddress,\n fallbackFromName: args.fallbackFromName,\n ...args.smtp,\n })(deps)\n const graph = graphAdapter({\n fallbackFromAddress: args.fallbackFromAddress,\n fallbackFromName: args.fallbackFromName,\n ...args.graph,\n })(deps)\n\n const { payload } = deps\n\n return {\n name: 'ipal-mail-dispatcher',\n defaultFromAddress: smtp.defaultFromAddress,\n defaultFromName: smtp.defaultFromName,\n\n sendEmail: async (message: SendEmailOptions) => {\n const settings = await getSiteIntegrations(payload)\n const choice = settings.emailTransport ?? 'smtp'\n const previous = settings[STATUS_FIELD]\n const useGraph = choice === 'graph' && graphAvailable()\n const graphFallback = choice === 'graph' && !useGraph\n\n if (graphFallback) {\n // Panel asked for Graph but the agency creds aren't configured for\n // this project. Fall back to SMTP rather than silently dropping mail.\n payload.logger.warn(\n '[ipal] Transport set to Graph but GRAPH_* env vars are missing; falling back to SMTP.',\n )\n }\n\n const transport = useGraph ? 'Microsoft Graph' : 'SMTP'\n const code = useGraph ? 'graph-error' : 'smtp-error'\n let result: unknown\n try {\n result = await (useGraph ? graph : smtp).sendEmail(message)\n } catch (err) {\n await recordIntegrationStatus(payload, STATUS_FIELD, previous, {\n state: 'degraded',\n code,\n message: `${transport}: ${describe(err)}`,\n })\n throw err // callers (form-builder, Send test) still see the failure\n }\n\n // The delegates report failure as { sent: false, error, detail? } instead\n // of throwing (a broken mailbox must not crash a form submission).\n const failed = result as { sent?: boolean; error?: string; detail?: string } | null\n if (failed && typeof failed === 'object' && failed.sent === false) {\n await recordIntegrationStatus(payload, STATUS_FIELD, previous, {\n state: 'degraded',\n code,\n message: `${transport}: ${describe(failed.detail ?? failed.error ?? 'not sent')}`,\n })\n return result\n }\n\n // Graph selected but unavailable is a configuration problem even if SMTP delivered.\n await recordIntegrationStatus(\n payload,\n STATUS_FIELD,\n previous,\n graphFallback\n ? {\n state: 'degraded',\n code: 'graph-unavailable',\n message: 'Microsoft Graph is selected but not configured on the server — e-mails are sent over SMTP.',\n }\n : { state: 'ok' },\n )\n return result\n },\n }\n }\n"],"names":["getSiteIntegrations","recordIntegrationStatus","panelSmtpAdapter","graphAdapter","STATUS_FIELD","describe","err","Error","message","String","split","slice","graphAvailable","Boolean","process","env","GRAPH_TENANT_ID","GRAPH_CLIENT_ID","GRAPH_CLIENT_SECRET","GRAPH_SENDER","mailAdapter","args","deps","smtp","fallbackFromAddress","fallbackFromName","graph","payload","name","defaultFromAddress","defaultFromName","sendEmail","settings","choice","emailTransport","previous","useGraph","graphFallback","logger","warn","transport","code","result","state","failed","sent","detail","error"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,sBAAqB;AACzD,SAASC,uBAAuB,QAAgC,4BAA2B;AAC3F,SAASC,gBAAgB,QAAmC,wBAAuB;AACnF,SAASC,YAAY,QAA+B,oBAAmB;AAQvE,MAAMC,eAAe;AACrB,mGAAmG,GACnG,MAAMC,WAAW,CAACC,MAChB,AAACA,CAAAA,eAAeC,QAAQD,IAAIE,OAAO,GAAGC,OAAOH,IAAG,EAAGI,KAAK,CAAC,KAAK,CAAC,EAAE,CAACC,KAAK,CAAC,GAAG;AAS7E,2EAA2E,GAC3E,SAASC;IACP,OAAOC,QACLC,QAAQC,GAAG,CAACC,eAAe,IACzBF,QAAQC,GAAG,CAACE,eAAe,IAC3BH,QAAQC,GAAG,CAACG,mBAAmB,IAC/BJ,QAAQC,GAAG,CAACI,YAAY;AAE9B;AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,MAAMC,cACX,CAACC,OAAwB,CAAC,CAAC,GAC3B,CAACC;QACC,0EAA0E;QAC1E,MAAMC,OAAOrB,iBAAiB;YAC5BsB,qBAAqBH,KAAKG,mBAAmB;YAC7CC,kBAAkBJ,KAAKI,gBAAgB;YACvC,GAAGJ,KAAKE,IAAI;QACd,GAAGD;QACH,MAAMI,QAAQvB,aAAa;YACzBqB,qBAAqBH,KAAKG,mBAAmB;YAC7CC,kBAAkBJ,KAAKI,gBAAgB;YACvC,GAAGJ,KAAKK,KAAK;QACf,GAAGJ;QAEH,MAAM,EAAEK,OAAO,EAAE,GAAGL;QAEpB,OAAO;YACLM,MAAM;YACNC,oBAAoBN,KAAKM,kBAAkB;YAC3CC,iBAAiBP,KAAKO,eAAe;YAErCC,WAAW,OAAOvB;gBAChB,MAAMwB,WAAW,MAAMhC,oBAA2C2B;gBAClE,MAAMM,SAASD,SAASE,cAAc,IAAI;gBAC1C,MAAMC,WAAWH,QAAQ,CAAC5B,aAAa;gBACvC,MAAMgC,WAAWH,WAAW,WAAWrB;gBACvC,MAAMyB,gBAAgBJ,WAAW,WAAW,CAACG;gBAE7C,IAAIC,eAAe;oBACjB,mEAAmE;oBACnE,sEAAsE;oBACtEV,QAAQW,MAAM,CAACC,IAAI,CACjB;gBAEJ;gBAEA,MAAMC,YAAYJ,WAAW,oBAAoB;gBACjD,MAAMK,OAAOL,WAAW,gBAAgB;gBACxC,IAAIM;gBACJ,IAAI;oBACFA,SAAS,MAAM,AAACN,CAAAA,WAAWV,QAAQH,IAAG,EAAGQ,SAAS,CAACvB;gBACrD,EAAE,OAAOF,KAAK;oBACZ,MAAML,wBAAwB0B,SAASvB,cAAc+B,UAAU;wBAC7DQ,OAAO;wBACPF;wBACAjC,SAAS,GAAGgC,UAAU,EAAE,EAAEnC,SAASC,MAAM;oBAC3C;oBACA,MAAMA,IAAI,0DAA0D;;gBACtE;gBAEA,0EAA0E;gBAC1E,mEAAmE;gBACnE,MAAMsC,SAASF;gBACf,IAAIE,UAAU,OAAOA,WAAW,YAAYA,OAAOC,IAAI,KAAK,OAAO;oBACjE,MAAM5C,wBAAwB0B,SAASvB,cAAc+B,UAAU;wBAC7DQ,OAAO;wBACPF;wBACAjC,SAAS,GAAGgC,UAAU,EAAE,EAAEnC,SAASuC,OAAOE,MAAM,IAAIF,OAAOG,KAAK,IAAI,aAAa;oBACnF;oBACA,OAAOL;gBACT;gBAEA,oFAAoF;gBACpF,MAAMzC,wBACJ0B,SACAvB,cACA+B,UACAE,gBACI;oBACEM,OAAO;oBACPF,MAAM;oBACNjC,SAAS;gBACX,IACA;oBAAEmC,OAAO;gBAAK;gBAEpB,OAAOD;YACT;QACF;IACF,EAAC"}
\ No newline at end of file
diff --git a/dist/modules/email/panelSmtpAdapter.js b/dist/modules/email/panelSmtpAdapter.js
index 19133e5..9fc4435 100644
--- a/dist/modules/email/panelSmtpAdapter.js
+++ b/dist/modules/email/panelSmtpAdapter.js
@@ -32,8 +32,8 @@ import { getSiteIntegrations } from '../payload/index.js';
if (!host || !user || !pass) {
payload.logger.error('[ipal] Email not sent: SMTP is not configured in Site Integrations.');
return {
- error: 'SMTP is not configured in Site Integrations.',
- sent: false
+ sent: false,
+ error: 'SMTP is not configured in Site Integrations.'
};
}
// The panel is the source of truth for the sender; fall back to whatever
@@ -48,13 +48,13 @@ import { getSiteIntegrations } from '../payload/index.js';
const stripCRLF = (v)=>String(v ?? '').replace(/[\r\n]+/g, ' ').trim();
const { default: nodemailer } = await import('nodemailer');
const transporter = nodemailer.createTransport({
- auth: {
- pass,
- user
- },
host,
port,
- secure: port === 465
+ secure: port === 465,
+ auth: {
+ user,
+ pass
+ }
});
try {
const info = await transporter.sendMail({
@@ -65,16 +65,18 @@ import { getSiteIntegrations } from '../payload/index.js';
} : {}
});
return {
- messageId: info.messageId,
- sent: true
+ sent: true,
+ messageId: info.messageId
};
} catch (err) {
// Never surface SMTP internals to the caller — a form submission
// shouldn't fail loudly because the mailbox is misconfigured.
payload.logger.error(`[ipal] Email send failed: ${err.message}`);
+ // `detail` is for the panel status (mailAdapter), not for end users.
return {
+ sent: false,
error: 'Failed to send email.',
- sent: false
+ detail: err.message
};
}
}
diff --git a/dist/modules/email/panelSmtpAdapter.js.map b/dist/modules/email/panelSmtpAdapter.js.map
index 06b1854..2c90b30 100644
--- a/dist/modules/email/panelSmtpAdapter.js.map
+++ b/dist/modules/email/panelSmtpAdapter.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../src/modules/email/panelSmtpAdapter.ts"],"sourcesContent":["import type { PayloadEmailAdapter, SendEmailOptions } from 'payload'\n\nimport { getSiteIntegrations } from '../payload/index.js'\n\n/** SMTP fields the adapter reads from SiteIntegrations. */\ntype SmtpIntegrations = {\n smtpFromAddress?: null | string\n smtpFromName?: null | string\n smtpHost?: null | string\n smtpPassword?: null | string\n smtpPort?: null | number\n smtpUser?: null | string\n}\n\nexport type PanelSmtpAdapterArgs = {\n /**\n * Used only until the panel is filled in — Payload requires a from-address\n * synchronously at boot, before any global can be read. Once SiteIntegrations\n * has an address, it wins.\n */\n fallbackFromAddress?: string\n fallbackFromName?: string\n}\n\n/**\n * Payload email adapter backed by the SMTP settings in the SiteIntegrations\n * global.\n *\n * Why this exists: Payload builds its email adapter once, at boot, from the\n * config — which would normally mean SMTP credentials living in env vars and a\n * redeploy to change them. This adapter instead resolves SMTP on every send, so\n * an editor can change the mailbox in the admin panel and the next email uses\n * it.\n *\n * Wiring it into the config means `payload.sendEmail` works everywhere — which\n * includes the form-builder's own submission emails (the ones an editor\n * configures per form under \"Emails\"). Those go out over the panel's SMTP with\n * no extra code.\n *\n * Boot-time constraints shape two details:\n * - `defaultFromAddress` / `defaultFromName` must be returned synchronously, so\n * they're placeholders; the real from-address is applied per message below.\n * - nodemailer is imported dynamically inside sendEmail, so merely loading the\n * Payload config (or running `generate:importmap`) doesn't pull it in.\n */\nexport const panelSmtpAdapter =\n (args: PanelSmtpAdapterArgs = {}): PayloadEmailAdapter =>\n ({ payload }) => ({\n name: 'ipal-panel-smtp',\n defaultFromAddress: args.fallbackFromAddress ?? 'noreply@localhost',\n defaultFromName: args.fallbackFromName ?? 'Website',\n\n sendEmail: async (message: SendEmailOptions) => {\n const smtp = await getSiteIntegrations(payload)\n\n const host = smtp.smtpHost\n const port = smtp.smtpPort ?? 587\n const user = smtp.smtpUser\n const pass = smtp.smtpPassword\n\n if (!host || !user || !pass) {\n payload.logger.error('[ipal] Email not sent: SMTP is not configured in Site Integrations.')\n return { error: 'SMTP is not configured in Site Integrations.', sent: false }\n }\n\n // The panel is the source of truth for the sender; fall back to whatever\n // the caller set (Payload fills in defaultFromAddress when unset).\n const fromAddress = smtp.smtpFromAddress\n const fromName = smtp.smtpFromName\n const from = fromAddress\n ? fromName\n ? `${fromName} <${fromAddress}>`\n : fromAddress\n : message.from\n\n // Defence in depth against header injection. Modern nodemailer already\n // normalises CRLF in standard headers, but the form-builder interpolates\n // user data into the subject via {{field}} placeholders, so strip any\n // newlines from header-bound values before they reach the transport.\n const stripCRLF = (v: unknown): string =>\n String(v ?? '')\n .replace(/[\\r\\n]+/g, ' ')\n .trim()\n\n const { default: nodemailer } = await import('nodemailer')\n\n const transporter = nodemailer.createTransport({\n auth: { pass, user },\n host,\n port,\n secure: port === 465, // implicit TLS on 465, STARTTLS otherwise\n })\n\n try {\n const info = await transporter.sendMail({\n ...message,\n from,\n ...(message.subject ? { subject: stripCRLF(message.subject) } : {}),\n })\n return { messageId: info.messageId, sent: true }\n } catch (err) {\n // Never surface SMTP internals to the caller — a form submission\n // shouldn't fail loudly because the mailbox is misconfigured.\n payload.logger.error(`[ipal] Email send failed: ${(err as Error).message}`)\n return { error: 'Failed to send email.', sent: false }\n }\n },\n })\n"],"names":["getSiteIntegrations","panelSmtpAdapter","args","payload","name","defaultFromAddress","fallbackFromAddress","defaultFromName","fallbackFromName","sendEmail","message","smtp","host","smtpHost","port","smtpPort","user","smtpUser","pass","smtpPassword","logger","error","sent","fromAddress","smtpFromAddress","fromName","smtpFromName","from","stripCRLF","v","String","replace","trim","default","nodemailer","transporter","createTransport","auth","secure","info","sendMail","subject","messageId","err"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,sBAAqB;AAsBzD;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,MAAMC,mBACX,CAACC,OAA6B,CAAC,CAAC,GAChC,CAAC,EAAEC,OAAO,EAAE,GAAM,CAAA;YAChBC,MAAM;YACNC,oBAAoBH,KAAKI,mBAAmB,IAAI;YAChDC,iBAAiBL,KAAKM,gBAAgB,IAAI;YAE1CC,WAAW,OAAOC;gBAChB,MAAMC,OAAO,MAAMX,oBAAsCG;gBAEzD,MAAMS,OAAOD,KAAKE,QAAQ;gBAC1B,MAAMC,OAAOH,KAAKI,QAAQ,IAAI;gBAC9B,MAAMC,OAAOL,KAAKM,QAAQ;gBAC1B,MAAMC,OAAOP,KAAKQ,YAAY;gBAE9B,IAAI,CAACP,QAAQ,CAACI,QAAQ,CAACE,MAAM;oBAC3Bf,QAAQiB,MAAM,CAACC,KAAK,CAAC;oBACrB,OAAO;wBAAEA,OAAO;wBAAgDC,MAAM;oBAAM;gBAC9E;gBAEA,yEAAyE;gBACzE,mEAAmE;gBACnE,MAAMC,cAAcZ,KAAKa,eAAe;gBACxC,MAAMC,WAAWd,KAAKe,YAAY;gBAClC,MAAMC,OAAOJ,cACTE,WACE,GAAGA,SAAS,EAAE,EAAEF,YAAY,CAAC,CAAC,GAC9BA,cACFb,QAAQiB,IAAI;gBAEhB,uEAAuE;gBACvE,yEAAyE;gBACzE,sEAAsE;gBACtE,qEAAqE;gBACrE,MAAMC,YAAY,CAACC,IACjBC,OAAOD,KAAK,IACTE,OAAO,CAAC,YAAY,KACpBC,IAAI;gBAET,MAAM,EAAEC,SAASC,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC;gBAE7C,MAAMC,cAAcD,WAAWE,eAAe,CAAC;oBAC7CC,MAAM;wBAAEnB;wBAAMF;oBAAK;oBACnBJ;oBACAE;oBACAwB,QAAQxB,SAAS;gBACnB;gBAEA,IAAI;oBACF,MAAMyB,OAAO,MAAMJ,YAAYK,QAAQ,CAAC;wBACtC,GAAG9B,OAAO;wBACViB;wBACA,GAAIjB,QAAQ+B,OAAO,GAAG;4BAAEA,SAASb,UAAUlB,QAAQ+B,OAAO;wBAAE,IAAI,CAAC,CAAC;oBACpE;oBACA,OAAO;wBAAEC,WAAWH,KAAKG,SAAS;wBAAEpB,MAAM;oBAAK;gBACjD,EAAE,OAAOqB,KAAK;oBACZ,iEAAiE;oBACjE,8DAA8D;oBAC9DxC,QAAQiB,MAAM,CAACC,KAAK,CAAC,CAAC,0BAA0B,EAAE,AAACsB,IAAcjC,OAAO,EAAE;oBAC1E,OAAO;wBAAEW,OAAO;wBAAyBC,MAAM;oBAAM;gBACvD;YACF;QACF,CAAA,EAAE"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/modules/email/panelSmtpAdapter.ts"],"sourcesContent":["import type { PayloadEmailAdapter, SendEmailOptions } from 'payload'\nimport { getSiteIntegrations } from '../payload/index.js'\n\n/** SMTP fields the adapter reads from SiteIntegrations. */\ntype SmtpIntegrations = {\n smtpHost?: string | null\n smtpPort?: number | null\n smtpUser?: string | null\n smtpPassword?: string | null\n smtpFromAddress?: string | null\n smtpFromName?: string | null\n}\n\nexport type PanelSmtpAdapterArgs = {\n /**\n * Used only until the panel is filled in — Payload requires a from-address\n * synchronously at boot, before any global can be read. Once SiteIntegrations\n * has an address, it wins.\n */\n fallbackFromAddress?: string\n fallbackFromName?: string\n}\n\n/**\n * Payload email adapter backed by the SMTP settings in the SiteIntegrations\n * global.\n *\n * Why this exists: Payload builds its email adapter once, at boot, from the\n * config — which would normally mean SMTP credentials living in env vars and a\n * redeploy to change them. This adapter instead resolves SMTP on every send, so\n * an editor can change the mailbox in the admin panel and the next email uses\n * it.\n *\n * Wiring it into the config means `payload.sendEmail` works everywhere — which\n * includes the form-builder's own submission emails (the ones an editor\n * configures per form under \"Emails\"). Those go out over the panel's SMTP with\n * no extra code.\n *\n * Boot-time constraints shape two details:\n * - `defaultFromAddress` / `defaultFromName` must be returned synchronously, so\n * they're placeholders; the real from-address is applied per message below.\n * - nodemailer is imported dynamically inside sendEmail, so merely loading the\n * Payload config (or running `generate:importmap`) doesn't pull it in.\n */\nexport const panelSmtpAdapter =\n (args: PanelSmtpAdapterArgs = {}): PayloadEmailAdapter =>\n ({ payload }) => ({\n name: 'ipal-panel-smtp',\n defaultFromAddress: args.fallbackFromAddress ?? 'noreply@localhost',\n defaultFromName: args.fallbackFromName ?? 'Website',\n\n sendEmail: async (message: SendEmailOptions) => {\n const smtp = await getSiteIntegrations(payload)\n\n const host = smtp.smtpHost\n const port = smtp.smtpPort ?? 587\n const user = smtp.smtpUser\n const pass = smtp.smtpPassword\n\n if (!host || !user || !pass) {\n payload.logger.error(\n '[ipal] Email not sent: SMTP is not configured in Site Integrations.',\n )\n return { sent: false, error: 'SMTP is not configured in Site Integrations.' }\n }\n\n // The panel is the source of truth for the sender; fall back to whatever\n // the caller set (Payload fills in defaultFromAddress when unset).\n const fromAddress = smtp.smtpFromAddress\n const fromName = smtp.smtpFromName\n const from = fromAddress\n ? fromName\n ? `${fromName} <${fromAddress}>`\n : fromAddress\n : message.from\n\n // Defence in depth against header injection. Modern nodemailer already\n // normalises CRLF in standard headers, but the form-builder interpolates\n // user data into the subject via {{field}} placeholders, so strip any\n // newlines from header-bound values before they reach the transport.\n const stripCRLF = (v: unknown): string => String(v ?? '').replace(/[\\r\\n]+/g, ' ').trim()\n\n const { default: nodemailer } = await import('nodemailer')\n\n const transporter = nodemailer.createTransport({\n host,\n port,\n secure: port === 465, // implicit TLS on 465, STARTTLS otherwise\n auth: { user, pass },\n })\n\n try {\n const info = await transporter.sendMail({\n ...message,\n from,\n ...(message.subject ? { subject: stripCRLF(message.subject) } : {}),\n })\n return { sent: true, messageId: info.messageId }\n } catch (err) {\n // Never surface SMTP internals to the caller — a form submission\n // shouldn't fail loudly because the mailbox is misconfigured.\n payload.logger.error(`[ipal] Email send failed: ${(err as Error).message}`)\n // `detail` is for the panel status (mailAdapter), not for end users.\n return { sent: false, error: 'Failed to send email.', detail: (err as Error).message }\n }\n },\n })\n"],"names":["getSiteIntegrations","panelSmtpAdapter","args","payload","name","defaultFromAddress","fallbackFromAddress","defaultFromName","fallbackFromName","sendEmail","message","smtp","host","smtpHost","port","smtpPort","user","smtpUser","pass","smtpPassword","logger","error","sent","fromAddress","smtpFromAddress","fromName","smtpFromName","from","stripCRLF","v","String","replace","trim","default","nodemailer","transporter","createTransport","secure","auth","info","sendMail","subject","messageId","err","detail"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,sBAAqB;AAsBzD;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,MAAMC,mBACX,CAACC,OAA6B,CAAC,CAAC,GAChC,CAAC,EAAEC,OAAO,EAAE,GAAM,CAAA;YAChBC,MAAM;YACNC,oBAAoBH,KAAKI,mBAAmB,IAAI;YAChDC,iBAAiBL,KAAKM,gBAAgB,IAAI;YAE1CC,WAAW,OAAOC;gBAChB,MAAMC,OAAO,MAAMX,oBAAsCG;gBAEzD,MAAMS,OAAOD,KAAKE,QAAQ;gBAC1B,MAAMC,OAAOH,KAAKI,QAAQ,IAAI;gBAC9B,MAAMC,OAAOL,KAAKM,QAAQ;gBAC1B,MAAMC,OAAOP,KAAKQ,YAAY;gBAE9B,IAAI,CAACP,QAAQ,CAACI,QAAQ,CAACE,MAAM;oBAC3Bf,QAAQiB,MAAM,CAACC,KAAK,CAClB;oBAEF,OAAO;wBAAEC,MAAM;wBAAOD,OAAO;oBAA+C;gBAC9E;gBAEA,yEAAyE;gBACzE,mEAAmE;gBACnE,MAAME,cAAcZ,KAAKa,eAAe;gBACxC,MAAMC,WAAWd,KAAKe,YAAY;gBAClC,MAAMC,OAAOJ,cACTE,WACE,GAAGA,SAAS,EAAE,EAAEF,YAAY,CAAC,CAAC,GAC9BA,cACFb,QAAQiB,IAAI;gBAEhB,uEAAuE;gBACvE,yEAAyE;gBACzE,sEAAsE;gBACtE,qEAAqE;gBACrE,MAAMC,YAAY,CAACC,IAAuBC,OAAOD,KAAK,IAAIE,OAAO,CAAC,YAAY,KAAKC,IAAI;gBAEvF,MAAM,EAAEC,SAASC,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC;gBAE7C,MAAMC,cAAcD,WAAWE,eAAe,CAAC;oBAC7CxB;oBACAE;oBACAuB,QAAQvB,SAAS;oBACjBwB,MAAM;wBAAEtB;wBAAME;oBAAK;gBACrB;gBAEA,IAAI;oBACF,MAAMqB,OAAO,MAAMJ,YAAYK,QAAQ,CAAC;wBACtC,GAAG9B,OAAO;wBACViB;wBACA,GAAIjB,QAAQ+B,OAAO,GAAG;4BAAEA,SAASb,UAAUlB,QAAQ+B,OAAO;wBAAE,IAAI,CAAC,CAAC;oBACpE;oBACA,OAAO;wBAAEnB,MAAM;wBAAMoB,WAAWH,KAAKG,SAAS;oBAAC;gBACjD,EAAE,OAAOC,KAAK;oBACZ,iEAAiE;oBACjE,8DAA8D;oBAC9DxC,QAAQiB,MAAM,CAACC,KAAK,CAAC,CAAC,0BAA0B,EAAE,AAACsB,IAAcjC,OAAO,EAAE;oBAC1E,qEAAqE;oBACrE,OAAO;wBAAEY,MAAM;wBAAOD,OAAO;wBAAyBuB,QAAQ,AAACD,IAAcjC,OAAO;oBAAC;gBACvF;YACF;QACF,CAAA,EAAE"}
\ No newline at end of file
diff --git a/dist/modules/forms/formsPluginConfig.d.ts b/dist/modules/forms/formsPluginConfig.d.ts
index 87dcea8..e15789a 100644
--- a/dist/modules/forms/formsPluginConfig.d.ts
+++ b/dist/modules/forms/formsPluginConfig.d.ts
@@ -3,9 +3,15 @@ import type { FormsOption } from './types.js';
/**
* Configures @payloadcms/plugin-form-builder from IPAL's FormsOption.
*
- * Provides the form/form-submissions collections and field types. Email
- * delivery is intentionally NOT handled here — the plugin's own SMTP-from-panel
- * sender (submitForm) does that, so the form-builder's built-in email (which
- * needs a Payload email adapter) is left unused.
+ * Provides the forms / form-submissions collections and field types. E-mails
+ * after a submission are the form-builder's own (Forms → Emails), sent through
+ * the project's email adapter (mailAdapter()).
+ *
+ * SECURITY: form-builder defaults form-submissions to `create: () => true`, i.e.
+ * anyone can POST /api/form-submissions and skip everything submitForm enforces
+ * (rate limit, Turnstile, GDPR consent, schema validation). Here REST/GraphQL
+ * creation is limited to logged-in users; the site submits through submitForm
+ * (server action → Local API, which bypasses access by design). A project that
+ * really needs public REST submissions can override `formSubmissionOverrides.access.create`.
*/
export declare function buildFormsPlugin(forms: FormsOption): Plugin;
diff --git a/dist/modules/forms/formsPluginConfig.js b/dist/modules/forms/formsPluginConfig.js
index aaec36a..255f5b6 100644
--- a/dist/modules/forms/formsPluginConfig.js
+++ b/dist/modules/forms/formsPluginConfig.js
@@ -1,22 +1,33 @@
import { formBuilderPlugin } from '@payloadcms/plugin-form-builder';
+/** REST/GraphQL: only logged-in users. Local API (submitForm) is unaffected. */ const submissionsCreateAccess = ({ req })=>Boolean(req.user);
/**
* Configures @payloadcms/plugin-form-builder from IPAL's FormsOption.
*
- * Provides the form/form-submissions collections and field types. Email
- * delivery is intentionally NOT handled here — the plugin's own SMTP-from-panel
- * sender (submitForm) does that, so the form-builder's built-in email (which
- * needs a Payload email adapter) is left unused.
+ * Provides the forms / form-submissions collections and field types. E-mails
+ * after a submission are the form-builder's own (Forms → Emails), sent through
+ * the project's email adapter (mailAdapter()).
+ *
+ * SECURITY: form-builder defaults form-submissions to `create: () => true`, i.e.
+ * anyone can POST /api/form-submissions and skip everything submitForm enforces
+ * (rate limit, Turnstile, GDPR consent, schema validation). Here REST/GraphQL
+ * creation is limited to logged-in users; the site submits through submitForm
+ * (server action → Local API, which bypasses access by design). A project that
+ * really needs public REST submissions can override `formSubmissionOverrides.access.create`.
*/ export function buildFormsPlugin(forms) {
+ const adminGroup = forms.adminGroup === undefined ? 'Forms' : forms.adminGroup;
+ const group = adminGroup ? {
+ group: adminGroup
+ } : {};
return formBuilderPlugin({
fields: {
- checkbox: true,
- email: true,
- message: true,
- number: true,
- payment: false,
- select: true,
text: true,
textarea: true,
+ email: true,
+ number: true,
+ select: true,
+ checkbox: true,
+ message: true,
+ payment: false,
...forms.fields
},
...forms.redirectRelationships ? {
@@ -25,12 +36,38 @@ import { formBuilderPlugin } from '@payloadcms/plugin-form-builder';
// Client-supplied collection overrides (e.g. a per-form notification
// address). The plugin provides the hook, not the opinion about which
// extra fields a form should carry.
- ...forms.formOverrides ? {
- formOverrides: forms.formOverrides
- } : {},
- ...forms.formSubmissionOverrides ? {
- formSubmissionOverrides: forms.formSubmissionOverrides
- } : {}
+ // Tidy panel by default: both collections under one sidebar group with plain
+ // labels — no per-project overrides needed just to sort the sidebar.
+ formOverrides: {
+ labels: {
+ singular: 'Form',
+ plural: 'Forms'
+ },
+ ...forms.formOverrides,
+ admin: {
+ ...group,
+ ...forms.formOverrides?.admin
+ }
+ },
+ formSubmissionOverrides: {
+ labels: {
+ singular: 'Submission',
+ plural: 'Submissions'
+ },
+ ...forms.formSubmissionOverrides,
+ admin: {
+ ...group,
+ defaultColumns: [
+ 'form',
+ 'createdAt'
+ ],
+ ...forms.formSubmissionOverrides?.admin
+ },
+ access: {
+ create: submissionsCreateAccess,
+ ...forms.formSubmissionOverrides?.access
+ }
+ }
});
}
diff --git a/dist/modules/forms/formsPluginConfig.js.map b/dist/modules/forms/formsPluginConfig.js.map
index 9fb3ee5..f60abec 100644
--- a/dist/modules/forms/formsPluginConfig.js.map
+++ b/dist/modules/forms/formsPluginConfig.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../src/modules/forms/formsPluginConfig.ts"],"sourcesContent":["import type { Plugin } from 'payload'\n\nimport { formBuilderPlugin } from '@payloadcms/plugin-form-builder'\n\nimport type { FormsOption } from './types.js'\n\n/**\n * Configures @payloadcms/plugin-form-builder from IPAL's FormsOption.\n *\n * Provides the form/form-submissions collections and field types. Email\n * delivery is intentionally NOT handled here — the plugin's own SMTP-from-panel\n * sender (submitForm) does that, so the form-builder's built-in email (which\n * needs a Payload email adapter) is left unused.\n */\nexport function buildFormsPlugin(forms: FormsOption): Plugin {\n return formBuilderPlugin({\n fields: {\n checkbox: true,\n email: true,\n message: true,\n number: true,\n payment: false,\n select: true,\n text: true,\n textarea: true,\n ...forms.fields,\n },\n ...(forms.redirectRelationships ? { redirectRelationships: forms.redirectRelationships } : {}),\n // Client-supplied collection overrides (e.g. a per-form notification\n // address). The plugin provides the hook, not the opinion about which\n // extra fields a form should carry.\n ...(forms.formOverrides ? { formOverrides: forms.formOverrides } : {}),\n ...(forms.formSubmissionOverrides\n ? { formSubmissionOverrides: forms.formSubmissionOverrides }\n : {}),\n })\n}\n"],"names":["formBuilderPlugin","buildFormsPlugin","forms","fields","checkbox","email","message","number","payment","select","text","textarea","redirectRelationships","formOverrides","formSubmissionOverrides"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,kCAAiC;AAInE;;;;;;;CAOC,GACD,OAAO,SAASC,iBAAiBC,KAAkB;IACjD,OAAOF,kBAAkB;QACvBG,QAAQ;YACNC,UAAU;YACVC,OAAO;YACPC,SAAS;YACTC,QAAQ;YACRC,SAAS;YACTC,QAAQ;YACRC,MAAM;YACNC,UAAU;YACV,GAAGT,MAAMC,MAAM;QACjB;QACA,GAAID,MAAMU,qBAAqB,GAAG;YAAEA,uBAAuBV,MAAMU,qBAAqB;QAAC,IAAI,CAAC,CAAC;QAC7F,qEAAqE;QACrE,sEAAsE;QACtE,oCAAoC;QACpC,GAAIV,MAAMW,aAAa,GAAG;YAAEA,eAAeX,MAAMW,aAAa;QAAC,IAAI,CAAC,CAAC;QACrE,GAAIX,MAAMY,uBAAuB,GAC7B;YAAEA,yBAAyBZ,MAAMY,uBAAuB;QAAC,IACzD,CAAC,CAAC;IACR;AACF"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/modules/forms/formsPluginConfig.ts"],"sourcesContent":["import { formBuilderPlugin } from '@payloadcms/plugin-form-builder'\nimport type { Plugin } from 'payload'\nimport type { FormsOption } from './types.js'\n\n/** REST/GraphQL: only logged-in users. Local API (submitForm) is unaffected. */\nconst submissionsCreateAccess = ({ req }: { req: { user?: unknown } }) => Boolean(req.user)\n\n/**\n * Configures @payloadcms/plugin-form-builder from IPAL's FormsOption.\n *\n * Provides the forms / form-submissions collections and field types. E-mails\n * after a submission are the form-builder's own (Forms → Emails), sent through\n * the project's email adapter (mailAdapter()).\n *\n * SECURITY: form-builder defaults form-submissions to `create: () => true`, i.e.\n * anyone can POST /api/form-submissions and skip everything submitForm enforces\n * (rate limit, Turnstile, GDPR consent, schema validation). Here REST/GraphQL\n * creation is limited to logged-in users; the site submits through submitForm\n * (server action → Local API, which bypasses access by design). A project that\n * really needs public REST submissions can override `formSubmissionOverrides.access.create`.\n */\nexport function buildFormsPlugin(forms: FormsOption): Plugin {\n const adminGroup = forms.adminGroup === undefined ? 'Forms' : forms.adminGroup\n const group = adminGroup ? { group: adminGroup } : {}\n return formBuilderPlugin({\n fields: {\n text: true,\n textarea: true,\n email: true,\n number: true,\n select: true,\n checkbox: true,\n message: true,\n payment: false,\n ...forms.fields,\n },\n ...(forms.redirectRelationships\n ? { redirectRelationships: forms.redirectRelationships }\n : {}),\n // Client-supplied collection overrides (e.g. a per-form notification\n // address). The plugin provides the hook, not the opinion about which\n // extra fields a form should carry.\n // Tidy panel by default: both collections under one sidebar group with plain\n // labels — no per-project overrides needed just to sort the sidebar.\n formOverrides: {\n labels: { singular: 'Form', plural: 'Forms' },\n ...forms.formOverrides,\n admin: { ...group, ...forms.formOverrides?.admin },\n },\n formSubmissionOverrides: {\n labels: { singular: 'Submission', plural: 'Submissions' },\n ...forms.formSubmissionOverrides,\n admin: { ...group, defaultColumns: ['form', 'createdAt'], ...forms.formSubmissionOverrides?.admin },\n access: {\n create: submissionsCreateAccess,\n ...forms.formSubmissionOverrides?.access,\n },\n },\n })\n}\n"],"names":["formBuilderPlugin","submissionsCreateAccess","req","Boolean","user","buildFormsPlugin","forms","adminGroup","undefined","group","fields","text","textarea","email","number","select","checkbox","message","payment","redirectRelationships","formOverrides","labels","singular","plural","admin","formSubmissionOverrides","defaultColumns","access","create"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,kCAAiC;AAInE,8EAA8E,GAC9E,MAAMC,0BAA0B,CAAC,EAAEC,GAAG,EAA+B,GAAKC,QAAQD,IAAIE,IAAI;AAE1F;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC,iBAAiBC,KAAkB;IACjD,MAAMC,aAAaD,MAAMC,UAAU,KAAKC,YAAY,UAAUF,MAAMC,UAAU;IAC9E,MAAME,QAAQF,aAAa;QAAEE,OAAOF;IAAW,IAAI,CAAC;IACpD,OAAOP,kBAAkB;QACvBU,QAAQ;YACNC,MAAM;YACNC,UAAU;YACVC,OAAO;YACPC,QAAQ;YACRC,QAAQ;YACRC,UAAU;YACVC,SAAS;YACTC,SAAS;YACT,GAAGZ,MAAMI,MAAM;QACjB;QACA,GAAIJ,MAAMa,qBAAqB,GAC3B;YAAEA,uBAAuBb,MAAMa,qBAAqB;QAAC,IACrD,CAAC,CAAC;QACN,qEAAqE;QACrE,sEAAsE;QACtE,oCAAoC;QACpC,6EAA6E;QAC7E,qEAAqE;QACrEC,eAAe;YACbC,QAAQ;gBAAEC,UAAU;gBAAQC,QAAQ;YAAQ;YAC5C,GAAGjB,MAAMc,aAAa;YACtBI,OAAO;gBAAE,GAAGf,KAAK;gBAAE,GAAGH,MAAMc,aAAa,EAAEI,KAAK;YAAC;QACnD;QACAC,yBAAyB;YACvBJ,QAAQ;gBAAEC,UAAU;gBAAcC,QAAQ;YAAc;YACxD,GAAGjB,MAAMmB,uBAAuB;YAChCD,OAAO;gBAAE,GAAGf,KAAK;gBAAEiB,gBAAgB;oBAAC;oBAAQ;iBAAY;gBAAE,GAAGpB,MAAMmB,uBAAuB,EAAED,KAAK;YAAC;YAClGG,QAAQ;gBACNC,QAAQ3B;gBACR,GAAGK,MAAMmB,uBAAuB,EAAEE,MAAM;YAC1C;QACF;IACF;AACF"}
\ No newline at end of file
diff --git a/dist/modules/forms/submitForm.d.ts b/dist/modules/forms/submitForm.d.ts
index c50135c..f4e7971 100644
--- a/dist/modules/forms/submitForm.d.ts
+++ b/dist/modules/forms/submitForm.d.ts
@@ -1,15 +1,13 @@
import 'server-only';
import type { BasePayload } from 'payload';
export type SubmitFormArgs = {
- /**
- * Name of the GDPR consent checkbox. A field with this name must be checked
- * for the submission to succeed (enforced server-side). Defaults to 'consent'.
- */
- consentFieldName?: string;
- /** Submitted field data — shape matches the form's fields. */
- data: Record;
+ payload: BasePayload;
/** Form-builder form ID this submission belongs to. */
formId: string;
+ /** Submitted field data — shape matches the form's fields. */
+ data: Record;
+ /** Turnstile token; when present it is verified, when absent it is skipped. */
+ turnstileToken?: string;
/** Client IP — used for Turnstile and rate limiting. */
ip?: string;
/**
@@ -17,15 +15,17 @@ export type SubmitFormArgs = {
* Set to 0 to disable (e.g. when a real limiter sits in front).
*/
maxPerMinute?: number;
- payload: BasePayload;
+ /**
+ * Name of the GDPR consent checkbox. A field with this name must be checked
+ * for the submission to succeed (enforced server-side). Defaults to 'consent'.
+ */
+ consentFieldName?: string;
/**
* Turnstile can't be verified because of OUR side (missing/wrong secret,
* Cloudflare unreachable): 'allow' (default) accepts the submission and shows
* the problem in the panel; 'reject' refuses it.
*/
turnstileOnConfigError?: 'allow' | 'reject';
- /** Turnstile token; when present it is verified, when absent it is skipped. */
- turnstileToken?: string;
};
/**
* Why a submission failed — a code, never a user-facing string.
@@ -45,34 +45,34 @@ export type SubmitFormArgs = {
* - `error` — persistence failed unexpectedly
*/
export type SubmitFailure = {
+ success: false;
+ reason: 'rate_limited';
+} | {
+ success: false;
+ reason: 'turnstile';
+} | {
+ success: false;
+ reason: 'validation';
/** The offending field's name, when one field is at fault. */
field?: string;
/** What was wrong with it. */
kind?: 'required' | 'too_long' | 'unknown_fields';
- reason: 'validation';
- success: false;
} | {
- field?: string;
+ success: false;
+ reason: 'not_found';
+} | {
+ success: false;
/** A GDPR consent field existed on the form but wasn't checked. */
reason: 'consent';
- success: false;
+ field?: string;
} | {
+ success: false;
reason: 'error';
- success: false;
-} | {
- reason: 'not_found';
- success: false;
-} | {
- reason: 'rate_limited';
- success: false;
-} | {
- reason: 'turnstile';
- success: false;
};
-export type SubmitFormResult = {
- submissionId: number | string;
+export type SubmitFormResult = SubmitFailure | {
success: true;
-} | SubmitFailure;
+ submissionId: string | number;
+};
/**
* Handles a form submission end to end: rate limit, verify Turnstile, validate
* against the form's own schema, then store.
@@ -86,4 +86,4 @@ export type SubmitFormResult = {
*
* server-only: touches the Turnstile secret.
*/
-export declare function submitForm({ consentFieldName, data, formId, ip, maxPerMinute, payload, turnstileOnConfigError, turnstileToken, }: SubmitFormArgs): Promise;
+export declare function submitForm({ payload, formId, data, turnstileToken, ip, maxPerMinute, consentFieldName, turnstileOnConfigError, }: SubmitFormArgs): Promise;
diff --git a/dist/modules/forms/submitForm.js b/dist/modules/forms/submitForm.js
index 3157a35..48eebdc 100644
--- a/dist/modules/forms/submitForm.js
+++ b/dist/modules/forms/submitForm.js
@@ -1,7 +1,7 @@
import 'server-only';
import { verifyTurnstile } from '../turnstile/index.js';
-import { checkRateLimit } from './rateLimit.js';
import { validateSubmission } from './validateSubmission.js';
+import { checkRateLimit } from './rateLimit.js';
/**
* Handles a form submission end to end: rate limit, verify Turnstile, validate
* against the form's own schema, then store.
@@ -14,7 +14,7 @@ import { validateSubmission } from './validateSubmission.js';
* which goes out over the configured email adapter (mailAdapter). Storing the submission is enough.
*
* server-only: touches the Turnstile secret.
- */ export async function submitForm({ consentFieldName, data, formId, ip, maxPerMinute = 5, payload, turnstileOnConfigError = 'allow', turnstileToken }) {
+ */ export async function submitForm({ payload, formId, data, turnstileToken, ip, maxPerMinute = 5, consentFieldName, turnstileOnConfigError = 'allow' }) {
// 1. Rate limit — cheapest gate, drops a flood before any real work.
if (maxPerMinute > 0 && ip) {
if (!checkRateLimit({
@@ -22,23 +22,23 @@ import { validateSubmission } from './validateSubmission.js';
max: maxPerMinute
})) {
return {
- reason: 'rate_limited',
- success: false
+ success: false,
+ reason: 'rate_limited'
};
}
}
// 2. Turnstile — verify when a token is supplied; reject on failure.
if (turnstileToken !== undefined) {
const ok = await verifyTurnstile({
- ip,
- onConfigError: turnstileOnConfigError,
+ token: turnstileToken,
payload,
- token: turnstileToken
+ ip,
+ onConfigError: turnstileOnConfigError
});
if (!ok) {
return {
- reason: 'turnstile',
- success: false
+ success: false,
+ reason: 'turnstile'
};
}
}
@@ -48,20 +48,20 @@ import { validateSubmission } from './validateSubmission.js';
if (!validation.ok) {
if (validation.reason === 'not_found') {
return {
- reason: 'not_found',
- success: false
+ success: false,
+ reason: 'not_found'
};
}
if (validation.reason === 'consent') {
return {
- field: validation.field,
+ success: false,
reason: 'consent',
- success: false
+ field: validation.field
};
}
return {
- reason: 'validation',
success: false,
+ reason: 'validation',
...validation.field ? {
field: validation.field
} : {},
@@ -84,14 +84,14 @@ import { validateSubmission } from './validateSubmission.js';
}
});
return {
- submissionId: submission.id,
- success: true
+ success: true,
+ submissionId: submission.id
};
} catch (err) {
payload.logger.error(`[ipal] Form submission failed: ${err.message}`);
return {
- reason: 'error',
- success: false
+ success: false,
+ reason: 'error'
};
}
}
diff --git a/dist/modules/forms/submitForm.js.map b/dist/modules/forms/submitForm.js.map
index 637acad..de991df 100644
--- a/dist/modules/forms/submitForm.js.map
+++ b/dist/modules/forms/submitForm.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../src/modules/forms/submitForm.ts"],"sourcesContent":["import 'server-only'\n\nimport type { BasePayload } from 'payload'\n\nimport { verifyTurnstile } from '../turnstile/index.js'\nimport { checkRateLimit } from './rateLimit.js'\nimport { validateSubmission } from './validateSubmission.js'\n\nexport type SubmitFormArgs = {\n /**\n * Name of the GDPR consent checkbox. A field with this name must be checked\n * for the submission to succeed (enforced server-side). Defaults to 'consent'.\n */\n consentFieldName?: string\n /** Submitted field data — shape matches the form's fields. */\n data: Record\n /** Form-builder form ID this submission belongs to. */\n formId: string\n /** Client IP — used for Turnstile and rate limiting. */\n ip?: string\n /**\n * Rate limit: max submissions per IP per minute. Defaults to 5.\n * Set to 0 to disable (e.g. when a real limiter sits in front).\n */\n maxPerMinute?: number\n payload: BasePayload\n /**\n * Turnstile can't be verified because of OUR side (missing/wrong secret,\n * Cloudflare unreachable): 'allow' (default) accepts the submission and shows\n * the problem in the panel; 'reject' refuses it.\n */\n turnstileOnConfigError?: 'allow' | 'reject'\n /** Turnstile token; when present it is verified, when absent it is skipped. */\n turnstileToken?: string\n}\n\n/**\n * Why a submission failed — a code, never a user-facing string.\n *\n * The plugin knows what went wrong; it deliberately doesn't decide how to say\n * it. The frontend maps these to its own copy, in its own language, and renders\n * whatever component fits — a field error, a toast, a full message. The plugin\n * has no business choosing the wording or the locale.\n *\n * - `rate_limited` — too many submissions from this IP\n * - `turnstile` — bot check failed\n * - `validation` — a field is missing/too long, or unknown keys were sent;\n * `field` and `kind` narrow it down when a specific field is\n * at fault (absent for whole-payload problems like unknown keys)\n * - `not_found` — no form with this id\n * - `consent` — a required GDPR consent checkbox was left unchecked\n * - `error` — persistence failed unexpectedly\n */\nexport type SubmitFailure =\n | {\n /** The offending field's name, when one field is at fault. */\n field?: string\n /** What was wrong with it. */\n kind?: 'required' | 'too_long' | 'unknown_fields'\n reason: 'validation'\n success: false\n }\n | {\n field?: string\n /** A GDPR consent field existed on the form but wasn't checked. */\n reason: 'consent'\n success: false\n }\n | { reason: 'error'; success: false }\n | { reason: 'not_found'; success: false }\n | { reason: 'rate_limited'; success: false }\n | { reason: 'turnstile'; success: false }\n\nexport type SubmitFormResult = { submissionId: number | string; success: true } | SubmitFailure\n\n/**\n * Handles a form submission end to end: rate limit, verify Turnstile, validate\n * against the form's own schema, then store.\n *\n * The order is cost-ascending on purpose — the cheapest checks reject first, so\n * a flood never reaches Turnstile's network call or the database.\n *\n * Emails aren't sent here. The form-builder sends whatever an editor configured\n * under the form's \"Emails\" tab (form-submissions hook → payload.sendEmail),\n * which goes out over the configured email adapter (mailAdapter). Storing the submission is enough.\n *\n * server-only: touches the Turnstile secret.\n */\nexport async function submitForm({\n consentFieldName,\n data,\n formId,\n ip,\n maxPerMinute = 5,\n payload,\n turnstileOnConfigError = 'allow',\n turnstileToken,\n}: SubmitFormArgs): Promise {\n // 1. Rate limit — cheapest gate, drops a flood before any real work.\n if (maxPerMinute > 0 && ip) {\n if (!checkRateLimit({ key: ip, max: maxPerMinute })) {\n return { reason: 'rate_limited', success: false }\n }\n }\n\n // 2. Turnstile — verify when a token is supplied; reject on failure.\n if (turnstileToken !== undefined) {\n const ok = await verifyTurnstile({ ip, onConfigError: turnstileOnConfigError, payload, token: turnstileToken })\n if (!ok) {\n return { reason: 'turnstile', success: false }\n }\n }\n\n // 3. Validate against the form's schema. A public endpoint can't trust the\n // shape of `data` — drop unknown keys, enforce required, cap length.\n const validation = await validateSubmission(payload, formId, data, consentFieldName)\n if (!validation.ok) {\n if (validation.reason === 'not_found') {\n return { reason: 'not_found', success: false }\n }\n if (validation.reason === 'consent') {\n return { field: validation.field, reason: 'consent', success: false }\n }\n return {\n reason: 'validation',\n success: false,\n ...(validation.field ? { field: validation.field } : {}),\n ...(validation.kind ? { kind: validation.kind } : {}),\n }\n }\n\n // 4. Persist (form-builder shape: submissionData array). Triggers the email\n // hook. Only validated, known fields are stored.\n try {\n const submission = await payload.create({\n collection: 'form-submissions',\n data: {\n form: formId,\n submissionData: Object.entries(validation.cleaned).map(([field, value]) => ({\n field,\n value: value == null ? '' : String(value),\n })),\n } as never,\n })\n return { submissionId: submission.id, success: true }\n } catch (err) {\n payload.logger.error(`[ipal] Form submission failed: ${(err as Error).message}`)\n return { reason: 'error', success: false }\n }\n}\n"],"names":["verifyTurnstile","checkRateLimit","validateSubmission","submitForm","consentFieldName","data","formId","ip","maxPerMinute","payload","turnstileOnConfigError","turnstileToken","key","max","reason","success","undefined","ok","onConfigError","token","validation","field","kind","submission","create","collection","form","submissionData","Object","entries","cleaned","map","value","String","submissionId","id","err","logger","error","message"],"mappings":"AAAA,OAAO,cAAa;AAIpB,SAASA,eAAe,QAAQ,wBAAuB;AACvD,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,kBAAkB,QAAQ,0BAAyB;AAqE5D;;;;;;;;;;;;CAYC,GACD,OAAO,eAAeC,WAAW,EAC/BC,gBAAgB,EAChBC,IAAI,EACJC,MAAM,EACNC,EAAE,EACFC,eAAe,CAAC,EAChBC,OAAO,EACPC,yBAAyB,OAAO,EAChCC,cAAc,EACC;IACf,qEAAqE;IACrE,IAAIH,eAAe,KAAKD,IAAI;QAC1B,IAAI,CAACN,eAAe;YAAEW,KAAKL;YAAIM,KAAKL;QAAa,IAAI;YACnD,OAAO;gBAAEM,QAAQ;gBAAgBC,SAAS;YAAM;QAClD;IACF;IAEA,qEAAqE;IACrE,IAAIJ,mBAAmBK,WAAW;QAChC,MAAMC,KAAK,MAAMjB,gBAAgB;YAAEO;YAAIW,eAAeR;YAAwBD;YAASU,OAAOR;QAAe;QAC7G,IAAI,CAACM,IAAI;YACP,OAAO;gBAAEH,QAAQ;gBAAaC,SAAS;YAAM;QAC/C;IACF;IAEA,2EAA2E;IAC3E,wEAAwE;IACxE,MAAMK,aAAa,MAAMlB,mBAAmBO,SAASH,QAAQD,MAAMD;IACnE,IAAI,CAACgB,WAAWH,EAAE,EAAE;QAClB,IAAIG,WAAWN,MAAM,KAAK,aAAa;YACrC,OAAO;gBAAEA,QAAQ;gBAAaC,SAAS;YAAM;QAC/C;QACA,IAAIK,WAAWN,MAAM,KAAK,WAAW;YACnC,OAAO;gBAAEO,OAAOD,WAAWC,KAAK;gBAAEP,QAAQ;gBAAWC,SAAS;YAAM;QACtE;QACA,OAAO;YACLD,QAAQ;YACRC,SAAS;YACT,GAAIK,WAAWC,KAAK,GAAG;gBAAEA,OAAOD,WAAWC,KAAK;YAAC,IAAI,CAAC,CAAC;YACvD,GAAID,WAAWE,IAAI,GAAG;gBAAEA,MAAMF,WAAWE,IAAI;YAAC,IAAI,CAAC,CAAC;QACtD;IACF;IAEA,4EAA4E;IAC5E,oDAAoD;IACpD,IAAI;QACF,MAAMC,aAAa,MAAMd,QAAQe,MAAM,CAAC;YACtCC,YAAY;YACZpB,MAAM;gBACJqB,MAAMpB;gBACNqB,gBAAgBC,OAAOC,OAAO,CAACT,WAAWU,OAAO,EAAEC,GAAG,CAAC,CAAC,CAACV,OAAOW,MAAM,GAAM,CAAA;wBAC1EX;wBACAW,OAAOA,SAAS,OAAO,KAAKC,OAAOD;oBACrC,CAAA;YACF;QACF;QACA,OAAO;YAAEE,cAAcX,WAAWY,EAAE;YAAEpB,SAAS;QAAK;IACtD,EAAE,OAAOqB,KAAK;QACZ3B,QAAQ4B,MAAM,CAACC,KAAK,CAAC,CAAC,+BAA+B,EAAE,AAACF,IAAcG,OAAO,EAAE;QAC/E,OAAO;YAAEzB,QAAQ;YAASC,SAAS;QAAM;IAC3C;AACF"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/modules/forms/submitForm.ts"],"sourcesContent":["import 'server-only'\nimport type { BasePayload } from 'payload'\nimport { verifyTurnstile } from '../turnstile/index.js'\nimport { validateSubmission } from './validateSubmission.js'\nimport { checkRateLimit } from './rateLimit.js'\n\nexport type SubmitFormArgs = {\n payload: BasePayload\n /** Form-builder form ID this submission belongs to. */\n formId: string\n /** Submitted field data — shape matches the form's fields. */\n data: Record\n /** Turnstile token; when present it is verified, when absent it is skipped. */\n turnstileToken?: string\n /** Client IP — used for Turnstile and rate limiting. */\n ip?: string\n /**\n * Rate limit: max submissions per IP per minute. Defaults to 5.\n * Set to 0 to disable (e.g. when a real limiter sits in front).\n */\n maxPerMinute?: number\n /**\n * Name of the GDPR consent checkbox. A field with this name must be checked\n * for the submission to succeed (enforced server-side). Defaults to 'consent'.\n */\n consentFieldName?: string\n /**\n * Turnstile can't be verified because of OUR side (missing/wrong secret,\n * Cloudflare unreachable): 'allow' (default) accepts the submission and shows\n * the problem in the panel; 'reject' refuses it.\n */\n turnstileOnConfigError?: 'allow' | 'reject'\n}\n\n/**\n * Why a submission failed — a code, never a user-facing string.\n *\n * The plugin knows what went wrong; it deliberately doesn't decide how to say\n * it. The frontend maps these to its own copy, in its own language, and renders\n * whatever component fits — a field error, a toast, a full message. The plugin\n * has no business choosing the wording or the locale.\n *\n * - `rate_limited` — too many submissions from this IP\n * - `turnstile` — bot check failed\n * - `validation` — a field is missing/too long, or unknown keys were sent;\n * `field` and `kind` narrow it down when a specific field is\n * at fault (absent for whole-payload problems like unknown keys)\n * - `not_found` — no form with this id\n * - `consent` — a required GDPR consent checkbox was left unchecked\n * - `error` — persistence failed unexpectedly\n */\nexport type SubmitFailure =\n | { success: false; reason: 'rate_limited' }\n | { success: false; reason: 'turnstile' }\n | {\n success: false\n reason: 'validation'\n /** The offending field's name, when one field is at fault. */\n field?: string\n /** What was wrong with it. */\n kind?: 'required' | 'too_long' | 'unknown_fields'\n }\n | { success: false; reason: 'not_found' }\n | {\n success: false\n /** A GDPR consent field existed on the form but wasn't checked. */\n reason: 'consent'\n field?: string\n }\n | { success: false; reason: 'error' }\n\nexport type SubmitFormResult = SubmitFailure | { success: true; submissionId: string | number }\n\n/**\n * Handles a form submission end to end: rate limit, verify Turnstile, validate\n * against the form's own schema, then store.\n *\n * The order is cost-ascending on purpose — the cheapest checks reject first, so\n * a flood never reaches Turnstile's network call or the database.\n *\n * Emails aren't sent here. The form-builder sends whatever an editor configured\n * under the form's \"Emails\" tab (form-submissions hook → payload.sendEmail),\n * which goes out over the configured email adapter (mailAdapter). Storing the submission is enough.\n *\n * server-only: touches the Turnstile secret.\n */\nexport async function submitForm({\n payload,\n formId,\n data,\n turnstileToken,\n ip,\n maxPerMinute = 5,\n consentFieldName,\n turnstileOnConfigError = 'allow',\n}: SubmitFormArgs): Promise {\n // 1. Rate limit — cheapest gate, drops a flood before any real work.\n if (maxPerMinute > 0 && ip) {\n if (!checkRateLimit({ key: ip, max: maxPerMinute })) {\n return { success: false, reason: 'rate_limited' }\n }\n }\n\n // 2. Turnstile — verify when a token is supplied; reject on failure.\n if (turnstileToken !== undefined) {\n const ok = await verifyTurnstile({ token: turnstileToken, payload, ip, onConfigError: turnstileOnConfigError })\n if (!ok) {\n return { success: false, reason: 'turnstile' }\n }\n }\n\n // 3. Validate against the form's schema. A public endpoint can't trust the\n // shape of `data` — drop unknown keys, enforce required, cap length.\n const validation = await validateSubmission(payload, formId, data, consentFieldName)\n if (!validation.ok) {\n if (validation.reason === 'not_found') {\n return { success: false, reason: 'not_found' }\n }\n if (validation.reason === 'consent') {\n return { success: false, reason: 'consent', field: validation.field }\n }\n return {\n success: false,\n reason: 'validation',\n ...(validation.field ? { field: validation.field } : {}),\n ...(validation.kind ? { kind: validation.kind } : {}),\n }\n }\n\n // 4. Persist (form-builder shape: submissionData array). Triggers the email\n // hook. Only validated, known fields are stored.\n try {\n const submission = await payload.create({\n collection: 'form-submissions',\n data: {\n form: formId,\n submissionData: Object.entries(validation.cleaned).map(([field, value]) => ({\n field,\n value: value == null ? '' : String(value),\n })),\n } as never,\n })\n return { success: true, submissionId: submission.id }\n } catch (err) {\n payload.logger.error(`[ipal] Form submission failed: ${(err as Error).message}`)\n return { success: false, reason: 'error' }\n }\n}\n"],"names":["verifyTurnstile","validateSubmission","checkRateLimit","submitForm","payload","formId","data","turnstileToken","ip","maxPerMinute","consentFieldName","turnstileOnConfigError","key","max","success","reason","undefined","ok","token","onConfigError","validation","field","kind","submission","create","collection","form","submissionData","Object","entries","cleaned","map","value","String","submissionId","id","err","logger","error","message"],"mappings":"AAAA,OAAO,cAAa;AAEpB,SAASA,eAAe,QAAQ,wBAAuB;AACvD,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,cAAc,QAAQ,iBAAgB;AAqE/C;;;;;;;;;;;;CAYC,GACD,OAAO,eAAeC,WAAW,EAC/BC,OAAO,EACPC,MAAM,EACNC,IAAI,EACJC,cAAc,EACdC,EAAE,EACFC,eAAe,CAAC,EAChBC,gBAAgB,EAChBC,yBAAyB,OAAO,EACjB;IACf,qEAAqE;IACrE,IAAIF,eAAe,KAAKD,IAAI;QAC1B,IAAI,CAACN,eAAe;YAAEU,KAAKJ;YAAIK,KAAKJ;QAAa,IAAI;YACnD,OAAO;gBAAEK,SAAS;gBAAOC,QAAQ;YAAe;QAClD;IACF;IAEA,qEAAqE;IACrE,IAAIR,mBAAmBS,WAAW;QAChC,MAAMC,KAAK,MAAMjB,gBAAgB;YAAEkB,OAAOX;YAAgBH;YAASI;YAAIW,eAAeR;QAAuB;QAC7G,IAAI,CAACM,IAAI;YACP,OAAO;gBAAEH,SAAS;gBAAOC,QAAQ;YAAY;QAC/C;IACF;IAEA,2EAA2E;IAC3E,wEAAwE;IACxE,MAAMK,aAAa,MAAMnB,mBAAmBG,SAASC,QAAQC,MAAMI;IACnE,IAAI,CAACU,WAAWH,EAAE,EAAE;QAClB,IAAIG,WAAWL,MAAM,KAAK,aAAa;YACrC,OAAO;gBAAED,SAAS;gBAAOC,QAAQ;YAAY;QAC/C;QACA,IAAIK,WAAWL,MAAM,KAAK,WAAW;YACnC,OAAO;gBAAED,SAAS;gBAAOC,QAAQ;gBAAWM,OAAOD,WAAWC,KAAK;YAAC;QACtE;QACA,OAAO;YACLP,SAAS;YACTC,QAAQ;YACR,GAAIK,WAAWC,KAAK,GAAG;gBAAEA,OAAOD,WAAWC,KAAK;YAAC,IAAI,CAAC,CAAC;YACvD,GAAID,WAAWE,IAAI,GAAG;gBAAEA,MAAMF,WAAWE,IAAI;YAAC,IAAI,CAAC,CAAC;QACtD;IACF;IAEA,4EAA4E;IAC5E,oDAAoD;IACpD,IAAI;QACF,MAAMC,aAAa,MAAMnB,QAAQoB,MAAM,CAAC;YACtCC,YAAY;YACZnB,MAAM;gBACJoB,MAAMrB;gBACNsB,gBAAgBC,OAAOC,OAAO,CAACT,WAAWU,OAAO,EAAEC,GAAG,CAAC,CAAC,CAACV,OAAOW,MAAM,GAAM,CAAA;wBAC1EX;wBACAW,OAAOA,SAAS,OAAO,KAAKC,OAAOD;oBACrC,CAAA;YACF;QACF;QACA,OAAO;YAAElB,SAAS;YAAMoB,cAAcX,WAAWY,EAAE;QAAC;IACtD,EAAE,OAAOC,KAAK;QACZhC,QAAQiC,MAAM,CAACC,KAAK,CAAC,CAAC,+BAA+B,EAAE,AAACF,IAAcG,OAAO,EAAE;QAC/E,OAAO;YAAEzB,SAAS;YAAOC,QAAQ;QAAQ;IAC3C;AACF"}
\ No newline at end of file
diff --git a/dist/modules/forms/types.d.ts b/dist/modules/forms/types.d.ts
index ec2a2b6..524c398 100644
--- a/dist/modules/forms/types.d.ts
+++ b/dist/modules/forms/types.d.ts
@@ -18,23 +18,25 @@ export type FormsCollectionOverrides = {
* form-builder plugin. Kept minimal; the plugin passes these through.
*/
export type FormsOption = {
+ /** Field types available in the form builder. Sensible defaults applied. */
+ fields?: {
+ text?: boolean;
+ textarea?: boolean;
+ email?: boolean;
+ number?: boolean;
+ select?: boolean;
+ checkbox?: boolean;
+ message?: boolean;
+ payment?: boolean;
+ };
+ /** Collections a form can redirect to (e.g. ['pages']). */
+ redirectRelationships?: string[];
/**
* Name of the checkbox field treated as a GDPR consent gate. A form field
* with this name must be checked for submission to succeed — enforced
* server-side in submitForm. Defaults to 'consent'.
*/
consentFieldName?: string;
- /** Field types available in the form builder. Sensible defaults applied. */
- fields?: {
- checkbox?: boolean;
- email?: boolean;
- message?: boolean;
- number?: boolean;
- payment?: boolean;
- select?: boolean;
- text?: boolean;
- textarea?: boolean;
- };
/**
* Override the forms collection. The plugin stays opinion-free about what a
* form needs beyond its fields — a client that wants, say, a per-form
@@ -50,6 +52,10 @@ export type FormsOption = {
formOverrides?: FormsCollectionOverrides;
/** Override the form-submissions collection (same shape). */
formSubmissionOverrides?: FormsCollectionOverrides;
- /** Collections a form can redirect to (e.g. ['pages']). */
- redirectRelationships?: string[];
+ /**
+ * Admin sidebar group for Forms + Form Submissions. Default 'Forms'.
+ * `false` = Payload default ("Collections"). An explicit `admin.group` in
+ * formOverrides / formSubmissionOverrides still wins.
+ */
+ adminGroup?: string | false;
};
diff --git a/dist/modules/forms/types.js.map b/dist/modules/forms/types.js.map
index edbc9bd..3a3fbda 100644
--- a/dist/modules/forms/types.js.map
+++ b/dist/modules/forms/types.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../src/modules/forms/types.ts"],"sourcesContent":["import type { CollectionConfig, Field } from 'payload'\n\n/**\n * Receives the collection's default fields and returns the final list — add,\n * remove, or reorder. Same shape the form-builder uses.\n */\nexport type FormsFieldsOverride = (args: { defaultFields: Field[] }) => Field[]\n\n/**\n * Overrides for a forms-related collection: replace the fields and/or any\n * other collection setting (admin, access, hooks…).\n */\nexport type FormsCollectionOverrides = {\n fields?: FormsFieldsOverride\n} & Partial>\n\n/**\n * Forms configuration — mirrors the fields a client enables in the\n * form-builder plugin. Kept minimal; the plugin passes these through.\n */\nexport type FormsOption = {\n /**\n * Name of the checkbox field treated as a GDPR consent gate. A form field\n * with this name must be checked for submission to succeed — enforced\n * server-side in submitForm. Defaults to 'consent'.\n */\n consentFieldName?: string\n /** Field types available in the form builder. Sensible defaults applied. */\n fields?: {\n checkbox?: boolean\n email?: boolean\n message?: boolean\n number?: boolean\n payment?: boolean\n select?: boolean\n text?: boolean\n textarea?: boolean\n }\n /**\n * Override the forms collection. The plugin stays opinion-free about what a\n * form needs beyond its fields — a client that wants, say, a per-form\n * notification address adds it here:\n *\n * formOverrides: {\n * fields: ({ defaultFields }) => [\n * ...defaultFields,\n * { name: 'notificationEmail', type: 'email' },\n * ],\n * }\n */\n formOverrides?: FormsCollectionOverrides\n /** Override the form-submissions collection (same shape). */\n formSubmissionOverrides?: FormsCollectionOverrides\n /** Collections a form can redirect to (e.g. ['pages']). */\n redirectRelationships?: string[]\n}\n"],"names":[],"mappings":"AAgBA;;;CAGC,GACD,WAmCC"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/modules/forms/types.ts"],"sourcesContent":["import type { CollectionConfig, Field } from 'payload'\n\n/**\n * Receives the collection's default fields and returns the final list — add,\n * remove, or reorder. Same shape the form-builder uses.\n */\nexport type FormsFieldsOverride = (args: { defaultFields: Field[] }) => Field[]\n\n/**\n * Overrides for a forms-related collection: replace the fields and/or any\n * other collection setting (admin, access, hooks…).\n */\nexport type FormsCollectionOverrides = {\n fields?: FormsFieldsOverride\n} & Partial>\n\n/**\n * Forms configuration — mirrors the fields a client enables in the\n * form-builder plugin. Kept minimal; the plugin passes these through.\n */\nexport type FormsOption = {\n /** Field types available in the form builder. Sensible defaults applied. */\n fields?: {\n text?: boolean\n textarea?: boolean\n email?: boolean\n number?: boolean\n select?: boolean\n checkbox?: boolean\n message?: boolean\n payment?: boolean\n }\n /** Collections a form can redirect to (e.g. ['pages']). */\n redirectRelationships?: string[]\n /**\n * Name of the checkbox field treated as a GDPR consent gate. A form field\n * with this name must be checked for submission to succeed — enforced\n * server-side in submitForm. Defaults to 'consent'.\n */\n consentFieldName?: string\n /**\n * Override the forms collection. The plugin stays opinion-free about what a\n * form needs beyond its fields — a client that wants, say, a per-form\n * notification address adds it here:\n *\n * formOverrides: {\n * fields: ({ defaultFields }) => [\n * ...defaultFields,\n * { name: 'notificationEmail', type: 'email' },\n * ],\n * }\n */\n formOverrides?: FormsCollectionOverrides\n /** Override the form-submissions collection (same shape). */\n formSubmissionOverrides?: FormsCollectionOverrides\n /**\n * Admin sidebar group for Forms + Form Submissions. Default 'Forms'.\n * `false` = Payload default (\"Collections\"). An explicit `admin.group` in\n * formOverrides / formSubmissionOverrides still wins.\n */\n adminGroup?: string | false\n}\n"],"names":[],"mappings":"AAgBA;;;CAGC,GACD,WAyCC"}
\ No newline at end of file
diff --git a/dist/modules/integrations/IntegrationAlerts.d.ts b/dist/modules/integrations/IntegrationAlerts.d.ts
index 19ddc64..bff0737 100644
--- a/dist/modules/integrations/IntegrationAlerts.d.ts
+++ b/dist/modules/integrations/IntegrationAlerts.d.ts
@@ -1,16 +1,16 @@
import type { Payload } from 'payload';
type Props = {
- /** Admin route, for the link. Default '/admin'. */
- adminRoute?: string;
- /** Status groups to check: field name → label. */
- checks?: Record;
/** Injected by Payload into admin server components. */
payload?: Payload;
+ /** Status groups to check: field name → label. */
+ checks?: Record;
+ /** Admin route, for the link. Default '/admin'. */
+ adminRoute?: string;
};
/**
* Dashboard alert (admin.components.beforeDashboard): lists integrations that
* are currently failing, with a link to Site Integrations. Renders nothing when
* everything is fine — and never throws (DB not ready → nothing).
*/
-export declare function IntegrationAlerts({ adminRoute, checks, payload }: Props): Promise;
+export declare function IntegrationAlerts({ payload, checks, adminRoute }: Props): Promise;
export default IntegrationAlerts;
diff --git a/dist/modules/integrations/IntegrationAlerts.js b/dist/modules/integrations/IntegrationAlerts.js
index c9aaa5a..358323c 100644
--- a/dist/modules/integrations/IntegrationAlerts.js
+++ b/dist/modules/integrations/IntegrationAlerts.js
@@ -3,12 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
* Dashboard alert (admin.components.beforeDashboard): lists integrations that
* are currently failing, with a link to Site Integrations. Renders nothing when
* everything is fine — and never throws (DB not ready → nothing).
- */ export async function IntegrationAlerts({ adminRoute = '/admin', checks = {
- turnstileStatus: 'Turnstile'
-}, payload }) {
- if (!payload) {
- return null;
- }
+ */ export async function IntegrationAlerts({ payload, checks = {
+ turnstileStatus: 'Turnstile',
+ emailStatus: 'Email'
+}, adminRoute = '/admin' }) {
+ if (!payload) return null;
let doc;
try {
doc = await payload.findGlobal({
@@ -22,21 +21,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
label,
status: doc?.[field]
})).filter((x)=>x.status?.state === 'degraded');
- if (!failing.length) {
- return null;
- }
+ if (!failing.length) return null;
return /*#__PURE__*/ _jsxs("div", {
role: "alert",
style: {
- background: 'var(--theme-error-50, rgba(229, 72, 77, 0.08))',
- border: '1px solid var(--theme-error-400, #e5484d)',
- borderRadius: 4,
marginBottom: '1.5rem',
- padding: '1rem 1.25rem'
+ padding: '1rem 1.25rem',
+ borderRadius: 4,
+ border: '1px solid var(--theme-error-400, #e5484d)',
+ background: 'var(--theme-error-50, rgba(229, 72, 77, 0.08))'
},
children: [
/*#__PURE__*/ _jsx("strong", {
- children: "Integration problem — the site still works, but a safeguard is off."
+ children: "Integration problem — the site still works, but something needs attention."
}),
/*#__PURE__*/ _jsx("ul", {
style: {
diff --git a/dist/modules/integrations/IntegrationAlerts.js.map b/dist/modules/integrations/IntegrationAlerts.js.map
index 17d95fd..cdc1460 100644
--- a/dist/modules/integrations/IntegrationAlerts.js.map
+++ b/dist/modules/integrations/IntegrationAlerts.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../../src/modules/integrations/IntegrationAlerts.tsx"],"sourcesContent":["import type { Payload } from 'payload'\n\nimport type { IntegrationStatus } from './status.js'\n\ntype Props = {\n /** Admin route, for the link. Default '/admin'. */\n adminRoute?: string\n /** Status groups to check: field name → label. */\n checks?: Record\n /** Injected by Payload into admin server components. */\n payload?: Payload\n}\n\n/**\n * Dashboard alert (admin.components.beforeDashboard): lists integrations that\n * are currently failing, with a link to Site Integrations. Renders nothing when\n * everything is fine — and never throws (DB not ready → nothing).\n */\nexport async function IntegrationAlerts({ adminRoute = '/admin', checks = { turnstileStatus: 'Turnstile' }, payload }: Props) {\n if (!payload) {return null}\n let doc: Record\n try {\n doc = (await payload.findGlobal({ slug: 'site-integrations' as never, depth: 0 })) as Record\n } catch {\n return null\n }\n const failing = Object.entries(checks)\n .map(([field, label]) => ({ label, status: doc?.[field] as IntegrationStatus | undefined }))\n .filter((x) => x.status?.state === 'degraded')\n if (!failing.length) {return null}\n\n return (\n
\n Integration problem — the site still works, but a safeguard is off.\n
\n )\n}\n\nexport default IntegrationAlerts\n"],"names":["IntegrationAlerts","adminRoute","checks","turnstileStatus","payload","doc","findGlobal","slug","depth","failing","Object","entries","map","field","label","status","filter","x","state","length","div","role","style","background","border","borderRadius","marginBottom","padding","strong","ul","margin","paddingLeft","li","message","code","a","href","replace","display","marginTop"],"mappings":";AAaA;;;;CAIC,GACD,OAAO,eAAeA,kBAAkB,EAAEC,aAAa,QAAQ,EAAEC,SAAS;IAAEC,iBAAiB;AAAY,CAAC,EAAEC,OAAO,EAAS;IAC1H,IAAI,CAACA,SAAS;QAAC,OAAO;IAAI;IAC1B,IAAIC;IACJ,IAAI;QACFA,MAAO,MAAMD,QAAQE,UAAU,CAAC;YAAEC,MAAM;YAA8BC,OAAO;QAAE;IACjF,EAAE,OAAM;QACN,OAAO;IACT;IACA,MAAMC,UAAUC,OAAOC,OAAO,CAACT,QAC5BU,GAAG,CAAC,CAAC,CAACC,OAAOC,MAAM,GAAM,CAAA;YAAEA;YAAOC,QAAQV,KAAK,CAACQ,MAAM;QAAkC,CAAA,GACxFG,MAAM,CAAC,CAACC,IAAMA,EAAEF,MAAM,EAAEG,UAAU;IACrC,IAAI,CAACT,QAAQU,MAAM,EAAE;QAAC,OAAO;IAAI;IAEjC,qBACE,MAACC;QACCC,MAAK;QACLC,OAAO;YACLC,YAAY;YACZC,QAAQ;YACRC,cAAc;YACdC,cAAc;YACdC,SAAS;QACX;;0BAEA,KAACC;0BAAO;;0BACR,KAACC;gBAAGP,OAAO;oBAAEQ,QAAQ;oBAAcC,aAAa;gBAAS;0BACtDtB,QAAQG,GAAG,CAAC,CAAC,EAAEE,KAAK,EAAEC,MAAM,EAAE,iBAC7B,MAACiB;;0CACC,MAACJ;;oCAAQd;oCAAM;;;4BAAU;4BAAEC,QAAQkB,WAAWlB,QAAQmB,QAAQ;;uBADvDpB;;0BAKb,KAACqB;gBAAEC,MAAM,GAAGnC,WAAWoC,OAAO,CAAC,OAAO,IAAI,0BAA0B,CAAC;gBAAEf,OAAO;oBAAEgB,SAAS;oBAAgBC,WAAW;gBAAS;0BAAG;;;;AAKtI;AAEA,eAAevC,kBAAiB"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/modules/integrations/IntegrationAlerts.tsx"],"sourcesContent":["import type { Payload } from 'payload'\nimport type { IntegrationStatus } from './status.js'\n\ntype Props = {\n /** Injected by Payload into admin server components. */\n payload?: Payload\n /** Status groups to check: field name → label. */\n checks?: Record\n /** Admin route, for the link. Default '/admin'. */\n adminRoute?: string\n}\n\n/**\n * Dashboard alert (admin.components.beforeDashboard): lists integrations that\n * are currently failing, with a link to Site Integrations. Renders nothing when\n * everything is fine — and never throws (DB not ready → nothing).\n */\nexport async function IntegrationAlerts({ payload, checks = { turnstileStatus: 'Turnstile', emailStatus: 'Email' }, adminRoute = '/admin' }: Props) {\n if (!payload) return null\n let doc: Record\n try {\n doc = (await payload.findGlobal({ slug: 'site-integrations' as never, depth: 0 })) as Record\n } catch {\n return null\n }\n const failing = Object.entries(checks)\n .map(([field, label]) => ({ label, status: doc?.[field] as IntegrationStatus | undefined }))\n .filter((x) => x.status?.state === 'degraded')\n if (!failing.length) return null\n\n return (\n
\n Integration problem — the site still works, but something needs attention.\n
\n Fix the keys below and save — the status is checked again on the next form submission.\n
\n
\n )\n}\n\nexport default IntegrationStatusBanner\n"],"names":["useFormFields","fmt","iso","d","Date","Number","isNaN","getTime","toLocaleString","IntegrationStatusBanner","label","statusField","state","f","value","message","code","since","checkedAt","div","style","fontSize","marginBottom","opacity","role","background","border","borderRadius","padding","strong","marginTop"],"mappings":"AAAA;;AACA,SAASA,aAAa,QAAQ,iBAAgB;AAS9C,MAAMC,MAAM,CAACC;IACX,IAAI,OAAOA,QAAQ,YAAY,CAACA,KAAK;QAAC,OAAO;IAAE;IAC/C,MAAMC,IAAI,IAAIC,KAAKF;IACnB,OAAOG,OAAOC,KAAK,CAACH,EAAEI,OAAO,MAAM,KAAKJ,EAAEK,cAAc;AAC1D;AAEA;;;;CAIC,GACD,OAAO,SAASC,wBAAwB,EAAEC,KAAK,EAAEC,WAAW,EAAS;IACnE,MAAMC,QAAQZ,cAAc,CAAC,CAACa,EAAE,GAAKA,CAAC,CAAC,GAAGF,YAAY,MAAM,CAAC,CAAC,EAAEG;IAChE,MAAMC,UAAUf,cAAc,CAAC,CAACa,EAAE,GAAKA,CAAC,CAAC,GAAGF,YAAY,QAAQ,CAAC,CAAC,EAAEG;IACpE,MAAME,OAAOhB,cAAc,CAAC,CAACa,EAAE,GAAKA,CAAC,CAAC,GAAGF,YAAY,KAAK,CAAC,CAAC,EAAEG;IAC9D,MAAMG,QAAQjB,cAAc,CAAC,CAACa,EAAE,GAAKA,CAAC,CAAC,GAAGF,YAAY,MAAM,CAAC,CAAC,EAAEG;IAChE,MAAMI,YAAYlB,cAAc,CAAC,CAACa,EAAE,GAAKA,CAAC,CAAC,GAAGF,YAAY,UAAU,CAAC,CAAC,EAAEG;IAExE,IAAI,CAACF,OAAO;QAAC,OAAO;IAAI;IAExB,IAAIA,UAAU,MAAM;QAClB,qBACE,MAACO;YAAIC,OAAO;gBAAEC,UAAU;gBAAWC,cAAc;gBAAUC,SAAS;YAAK;;gBAAG;gBACvEb;gBAAM;gBAASO,QAAQ,CAAC,OAAO,EAAEhB,IAAIgB,QAAQ,GAAG;gBAAG;;;IAG5D;IAEA,qBACE,MAACE;QACCK,MAAK;QACLJ,OAAO;YACLK,YAAY;YACZC,QAAQ;YACRC,cAAc;YACdL,cAAc;YACdM,SAAS;QACX;;0BAEA,MAACC;;oBAAQnB;oBAAM;;;YACdK,wBAAU,KAACI;gBAAIC,OAAO;oBAAEU,WAAW;gBAAU;0BAAIf;iBAAiB;0BACnE,MAACI;gBAAIC,OAAO;oBAAEC,UAAU;oBAAUS,WAAW;oBAAWP,SAAS;gBAAK;;oBACnEP,OAAO,CAAC,MAAM,EAAEA,KAAK,EAAE,CAAC,GAAG;oBAC3BC,QAAQ,CAAC,MAAM,EAAEhB,IAAIgB,OAAO,EAAE,CAAC,GAAG;oBAClCC,YAAY,CAAC,UAAU,EAAEjB,IAAIiB,WAAW,CAAC,CAAC,GAAG;;;0BAEhD,KAACC;gBAAIC,OAAO;oBAAEC,UAAU;oBAAUS,WAAW;oBAAWP,SAAS;gBAAK;0BAAG;;;;AAK/E;AAEA,eAAed,wBAAuB"}
\ No newline at end of file
+{"version":3,"sources":["../../../src/modules/integrations/IntegrationStatusBanner.tsx"],"sourcesContent":["'use client'\nimport { useFormFields } from '@payloadcms/ui'\n\ntype Props = {\n /** Name of the hidden status group (buildIntegrationStatusField). */\n statusField: string\n /** Integration name shown in the banner, e.g. 'Turnstile'. */\n label: string\n}\n\nconst fmt = (iso: unknown) => {\n if (typeof iso !== 'string' || !iso) return ''\n const d = new Date(iso)\n return Number.isNaN(d.getTime()) ? '' : d.toLocaleString()\n}\n\n/**\n * Status banner on an integration's tab (Site Integrations). Shows nothing until\n * the integration has been used once; a red box while it's failing; a short\n * green line once it works again.\n */\nexport function IntegrationStatusBanner({ statusField, label }: Props) {\n const state = useFormFields(([f]) => f[`${statusField}.state`]?.value) as string | undefined\n const message = useFormFields(([f]) => f[`${statusField}.message`]?.value) as string | undefined\n const code = useFormFields(([f]) => f[`${statusField}.code`]?.value) as string | undefined\n const since = useFormFields(([f]) => f[`${statusField}.since`]?.value)\n const checkedAt = useFormFields(([f]) => f[`${statusField}.checkedAt`]?.value)\n\n if (!state) return null\n\n if (state === 'ok') {\n return (\n
\n ✓ {label} working{since ? ` since ${fmt(since)}` : ''}.\n
\n )\n }\n\n return (\n
\n {label} is not working — forms are accepted without this check.\n {message ?
Sends through the transport selected above. Save your changes first.
-
+
setTo(e.target.value)}
- placeholder="you@example.com"
- style={{ flex: 1, minWidth: '220px' }}
type="email"
+ placeholder="you@example.com"
value={to}
+ onChange={(e) => setTo(e.target.value)}
+ style={{ flex: 1, minWidth: '220px' }}
/>
{status.kind === 'sending' ? 'Sending…' : 'Send test'}
diff --git a/src/globals/SiteIntegrations/fields/smtp.ts b/src/globals/SiteIntegrations/fields/smtp.ts
index 6285640..e12b9cc 100644
--- a/src/globals/SiteIntegrations/fields/smtp.ts
+++ b/src/globals/SiteIntegrations/fields/smtp.ts
@@ -1,5 +1,7 @@
import type { Field } from 'payload'
+import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js'
+
/**
* SMTP transport settings for outbound email.
*
@@ -8,6 +10,8 @@ import type { Field } from 'payload'
* panel while remaining inaccessible to anonymous API requests.
*/
export const smtpFields: Field[] = [
+ // Status written by mailAdapter on every send (throttled) — banner on this tab.
+ buildIntegrationStatusBanner('emailStatus', 'Email'),
{
name: 'emailTransport',
type: 'select',
@@ -87,4 +91,5 @@ export const smtpFields: Field[] = [
},
},
},
+ buildIntegrationStatusField('emailStatus'),
]
diff --git a/src/globals/SiteIntegrations/index.ts b/src/globals/SiteIntegrations/index.ts
index c63e31c..b764a7a 100644
--- a/src/globals/SiteIntegrations/index.ts
+++ b/src/globals/SiteIntegrations/index.ts
@@ -51,13 +51,15 @@ export function buildSiteIntegrations({
],
hooks: {
beforeChange: [
- // Keys edited in the panel → clear the old Turnstile status, so a stale
+ // Keys edited in the panel → clear that integration's old status, so a stale
// "not working" banner doesn't linger until the next form submission.
({ context, data, originalDoc }) => {
if (context?.ipalIntegrationStatus || !data) {return data}
const changed = (k: string) => k in data && data[k] !== originalDoc?.[k]
- if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {
- data.turnstileStatus = { checkedAt: null, code: null, message: null, since: null, state: null }
+ const cleared = { checkedAt: null, code: null, message: null, since: null, state: null }
+ if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {data.turnstileStatus = cleared}
+ if (Object.keys(data).some((k) => (k === 'emailTransport' || k.startsWith('smtp')) && changed(k))) {
+ data.emailStatus = cleared
}
return data
},
diff --git a/src/index.ts b/src/index.ts
index 64c33d1..aec77b2 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,3 +1,20 @@
+export { ipalKit } from './plugin.js'
+export type { IpalOptions } from './types.js'
+export type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js'
+export {
+ buildLocalizedPath,
+ getDefaultLocale,
+ getLocaleCodes,
+ getLocaleDefinition,
+ getLocalizedSlugs,
+ isValidLocale,
+ LOCALE_COOKIE_NAME,
+ matchAcceptLanguage,
+ negotiateLocale,
+ switchLocalePath,
+} from './modules/i18n/index.js'
+export type { PagesOption, SystemPageRole } from './modules/pages/index.js'
+export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'
export type { AccessOption, Role } from './modules/access/index.js'
export {
adminOnly,
@@ -13,102 +30,58 @@ export {
requireRoleField,
ROLE_HIERARCHY,
} from './modules/access/index.js'
-export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'
-export type { A11yState } from './modules/accessibility/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'
-export { getAnalyticsConfig } from './modules/analytics/index.js'
+export type { GlobalQueryOptions } from './modules/payload/index.js'
export {
- ACCEPT_ALL_CONSENT,
- CONSENT_CATEGORIES,
- CONSENT_COOKIE,
- CONSENT_MAX_AGE,
- CONSENT_VERSION,
- DEFAULT_CONSENT,
- getConsentTexts,
- parseConsent,
- REJECT_ALL_CONSENT,
- serializeConsent,
- setDefaultConsent,
- updateConsent,
-} from './modules/consent/index.js'
-export type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js'
-export type { ContentCollectionOption, ContentOption, ResolvedRoute } from './modules/content/index.js'
+ getGlobal,
+ getSiteSettings,
+ getSiteIntegrations,
+ SITE_SETTINGS_SLUG,
+ SITE_INTEGRATIONS_SLUG,
+} from './modules/payload/index.js'
+export type { SeoOption, SeoMeta, PageMetadata } from './modules/seo/index.js'
export {
- archiveFieldName,
+ composeTitle,
+ buildHreflangAlternates,
+ buildMetadata,
+ readSiteMetaConfig,
+ slugsAcrossLocales,
+} from './modules/seo/index.js'
+export type { SiteMetaConfig } from './modules/seo/index.js'
+export type { ContentOption, ContentCollectionOption, ResolvedRoute } from './modules/content/index.js'
+export { createContentHelpers } from './modules/frontend/index.js'
+export {
+ resolveRoute,
+ resolveRedirect,
+ resolveNotFoundPage,
blocksToMarkdown,
+ createMarkdownRenderer,
+ markdownResponse,
+ prefersMarkdown,
+ markdownHref,
+ MARKDOWN_PREFIX,
+ searchContent,
+ createSearchRoute,
+ archiveFieldName,
+ getArchiveEntries,
buildArchivePath,
buildEntryPath,
- createMarkdownRenderer,
- createSearchRoute,
- getArchiveEntries,
- MARKDOWN_PREFIX,
- markdownHref,
- markdownResponse,
parsePageParam,
- prefersMarkdown,
- resolveNotFoundPage,
- resolveRedirect,
- resolveRoute,
- searchContent,
} from './modules/content/index.js'
export type { ArchiveEntries } from './modules/content/index.js'
export type { SearchResult } from './modules/content/index.js'
-export { graphAdapter } from './modules/email/graphAdapter.js'
-export type { GraphAdapterArgs } from './modules/email/graphAdapter.js'
-export { mailAdapter } from './modules/email/mailAdapter.js'
-export type { MailAdapterArgs } from './modules/email/mailAdapter.js'
-// Imported straight from the file, NOT from ./modules/email/index.js — that
-// barrel re-exports sendEmail, which imports 'server-only' and would crash when
-// Payload loads the config (or runs generate:importmap) as a plain Node script.
-export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'
-export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'
-// Boot-time environment validation (fail fast on misconfigured deploys).
-export { assertEnv, ipalEnvRules } from './modules/env/index.js'
-export type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from './modules/env/index.js'
-// Panel-managed form analytics (config-time field builder).
-export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'
-export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'
-export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js'
-export type {
- FormsCollectionOverrides,
- FormsFieldsOverride,
- FormsOption,
-} from './modules/forms/types.js'
-export type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js'
-// Validation rules are pure — exported server-side too, for re-validating a
-// submission inside a server action. (useForm/useContactForm are client-only →
-// '@intecion/ipal-kit/client'.)
+// Lexical → Markdown (pure, no React) — for AI-readable output.
+export { lexicalToMarkdown } from './modules/richtext/index.js'
+export type { AutoFillMapping, SitemapEntry, RobotsRules, RobotsOptions } from './modules/seo/index.js'
export {
- buildValidator,
- checked,
- custom,
- email,
- isEmail,
- maxLength,
- minLength,
- pattern,
- required,
-} from './modules/forms/validators.js'
-export type { Rule } from './modules/forms/validators.js'
-export { createContentHelpers } from './modules/frontend/index.js'
-// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).
-export { createHealthRoute } from './modules/health/index.js'
-export { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js'
-export type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js'
-export {
- buildLocalizedPath,
- getDefaultLocale,
- getLocaleCodes,
- getLocaleDefinition,
- getLocalizedSlugs,
- isValidLocale,
- LOCALE_COOKIE_NAME,
- matchAcceptLanguage,
- negotiateLocale,
- switchLocalePath,
-} from './modules/i18n/index.js'
+ buildAutoFillMetaHook,
+ injectAutoFillMeta,
+ createMetadataGenerator,
+ createPageMetadata,
+ buildSitemapEntries,
+ buildRobots,
+ AI_ASSISTANT_BOTS,
+ AI_TRAINING_BOTS,
+} from './modules/seo/index.js'
export type { LocaleMiddlewareResult } from './modules/i18n/index.js'
export {
createLocaleMiddleware,
@@ -116,72 +89,99 @@ export {
} from './modules/i18n/index.js'
export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js'
export { resolveLocalized } from './modules/i18n/index.js'
-export { buildIntegrationStatusBanner, buildIntegrationStatusField, recordIntegrationStatus } from './modules/integrations/index.js'
-export type { IntegrationState, IntegrationStatus } from './modules/integrations/index.js'
-export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js'
+export {
+ CONSENT_CATEGORIES,
+ DEFAULT_CONSENT,
+ ACCEPT_ALL_CONSENT,
+ REJECT_ALL_CONSENT,
+ CONSENT_COOKIE,
+ CONSENT_VERSION,
+ CONSENT_MAX_AGE,
+ serializeConsent,
+ parseConsent,
+ setDefaultConsent,
+ updateConsent,
+ getConsentTexts,
+} from './modules/consent/index.js'
+export type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js'
+// Imported straight from the file, NOT from ./modules/email/index.js — that
+// barrel re-exports sendEmail, which imports 'server-only' and would crash when
+// Payload loads the config (or runs generate:importmap) as a plain Node script.
+export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'
+export { graphAdapter } from './modules/email/graphAdapter.js'
+export { mailAdapter } from './modules/email/mailAdapter.js'
+export type { MailAdapterArgs } from './modules/email/mailAdapter.js'
+export type { GraphAdapterArgs } from './modules/email/graphAdapter.js'
+export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'
+export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'
export type {
- BuildLinkFieldOptions,
- BuildLinksFieldOptions,
- LinkAppearance,
- LinkValue,
- ResolveLinkHrefOptions,
-} from './modules/links/index.js'
+ FormsOption,
+ FormsCollectionOverrides,
+ FormsFieldsOverride,
+} from './modules/forms/types.js'
+// Validation rules are pure — exported server-side too, for re-validating a
+// submission inside a server action. (useForm/useContactForm are client-only →
+// '@intecion/ipal-kit/client'.)
+export {
+ buildValidator,
+ isEmail,
+ required,
+ email,
+ minLength,
+ maxLength,
+ checked,
+ pattern,
+ custom,
+} from './modules/forms/validators.js'
+export type { Rule } from './modules/forms/validators.js'
+export type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js'
+export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js'
+// Panel-managed form analytics (config-time field builder).
+export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'
+// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).
+export { createHealthRoute } from './modules/health/index.js'
// Read-only MCP server (Claude/agents connect to the site and query it).
export { createMcpRoute } from './modules/mcp/index.js'
-export { buildOptimizeUploadField, buildOptimizeUploadHook, normalizeFilename, normalizeFilenameHook } from './modules/media/index.js'
-export type { OptimizeUploadOptions } from './modules/media/index.js'
-export { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage } from './modules/notifications/index.js'
-export type { FormNotificationTexts, NotificationTexts } from './modules/notifications/index.js'
-export type { PagesOption, SystemPageRole } from './modules/pages/index.js'
+// Boot-time environment validation (fail fast on misconfigured deploys).
+export { assertEnv, ipalEnvRules } from './modules/env/index.js'
+export type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from './modules/env/index.js'
+export type { AnalyticsConfig } from './modules/analytics/index.js'
+export { getAnalyticsConfig } from './modules/analytics/index.js'
+export { buildSlugField, toSlug } from './modules/slug/index.js'
+export { createLlmsTxtRoute, createSitemapRouteHandler, createManifestHandler } from './modules/seo/index.js'
-export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'
-export type { GlobalQueryOptions } from './modules/payload/index.js'
-export {
- getGlobal,
- getSiteIntegrations,
- getSiteSettings,
- SITE_INTEGRATIONS_SLUG,
- SITE_SETTINGS_SLUG,
-} from './modules/payload/index.js'
-// Lexical → Markdown (pure, no React) — for AI-readable output.
-export { lexicalToMarkdown } from './modules/richtext/index.js'
+export { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js'
export { buildSecurityHeaders } from './modules/security/index.js'
export { buildCsp } from './modules/security/index.js'
export type { BuildCspArgs } from './modules/security/index.js'
-export type { BuildSecurityHeadersArgs, SecurityHeader } from './modules/security/index.js'
-export type { PageMetadata, SeoMeta, SeoOption } from './modules/seo/index.js'
-export {
- buildHreflangAlternates,
- buildMetadata,
- composeTitle,
- readSiteMetaConfig,
- slugsAcrossLocales,
-} from './modules/seo/index.js'
-export type { SiteMetaConfig } from './modules/seo/index.js'
-export type { AutoFillMapping, RobotsOptions, RobotsRules, SitemapEntry } from './modules/seo/index.js'
-export {
- AI_ASSISTANT_BOTS,
- AI_TRAINING_BOTS,
- buildAutoFillMetaHook,
- buildRobots,
- buildSitemapEntries,
- createMetadataGenerator,
- createPageMetadata,
- injectAutoFillMeta,
-} from './modules/seo/index.js'
-export { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler } from './modules/seo/index.js'
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js'
export { buildNoindexField } from './modules/seo/index.js'
+export { recordIntegrationStatus, buildIntegrationStatusField, buildIntegrationStatusBanner } from './modules/integrations/index.js'
+export type { IntegrationStatus, IntegrationState } from './modules/integrations/index.js'
+export { rowLabel } from './modules/admin-ui/index.js'
+export type { RowLabelProps } from './modules/admin-ui/index.js'
+export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js'
+export type {
+ LinkAppearance,
+ LinkValue,
+ BuildLinkFieldOptions,
+ BuildLinksFieldOptions,
+ ResolveLinkHrefOptions,
+} from './modules/links/index.js'
export { buildSpeakableJsonLd } from './modules/seo/index.js'
export { buildSummaryField } from './modules/seo/index.js'
-export { buildBreadcrumbJsonLd, buildSiteNavigationJsonLd, buildWebSiteJsonLd } from './modules/seo/index.js'
+export { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } from './modules/seo/index.js'
// Local SEO structured data — LocalBusiness (map pack), Service (offering), FAQPage.
-export { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd } from './modules/seo/index.js'
+export { buildLocalBusinessJsonLd, buildFaqJsonLd, buildServiceJsonLd } from './modules/seo/index.js'
export { buildArticleJsonLd } from './modules/seo/index.js'
export { buildLlmsTxt } from './modules/seo/index.js'
-export { buildSitemapCss, buildSitemapXml, DEFAULT_SITEMAP_CREDIT, SITEMAP_STYLE_PARAM } from './modules/seo/index.js'
+export { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js'
export type { SitemapRouteOptions, SitemapStyleOptions } from './modules/seo/index.js'
-export { buildSlugField, toSlug } from './modules/slug/index.js'
export { buildR2Storage } from './modules/storage/index.js'
-export { ipalKit } from './plugin.js'
-export type { IpalOptions } from './types.js'
+export { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } from './modules/media/index.js'
+export type { OptimizeUploadOptions } from './modules/media/index.js'
+export { buildRevalidateHook, setPublishedAtHook, buildPreventDeleteSystemPage, buildValidateUniqueRole, trackSlugHistoryHook, buildCrossLocaleFieldSync } from './modules/hooks/index.js'
+export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'
+export type { A11yState } from './modules/accessibility/index.js'
+export type { SecurityHeader, BuildSecurityHeadersArgs } from './modules/security/index.js'
+export type { NotificationTexts, FormNotificationTexts } from './modules/notifications/index.js'
diff --git a/src/modules/email/mailAdapter.ts b/src/modules/email/mailAdapter.ts
index 41e3b1e..1758885 100644
--- a/src/modules/email/mailAdapter.ts
+++ b/src/modules/email/mailAdapter.ts
@@ -1,28 +1,34 @@
import type { PayloadEmailAdapter, SendEmailOptions } from 'payload'
-
import { getSiteIntegrations } from '../payload/index.js'
-import { graphAdapter, type GraphAdapterArgs } from './graphAdapter.js'
+import { recordIntegrationStatus, type IntegrationStatus } from '../integrations/status.js'
import { panelSmtpAdapter, type PanelSmtpAdapterArgs } from './panelSmtpAdapter.js'
+import { graphAdapter, type GraphAdapterArgs } from './graphAdapter.js'
type TransportIntegrations = {
/** 'smtp' | 'graph' — chosen by the editor in SiteIntegrations. */
- emailTransport?: 'graph' | 'smtp' | null
+ emailTransport?: 'smtp' | 'graph' | null
+ emailStatus?: IntegrationStatus | null
}
+const STATUS_FIELD = 'emailStatus'
+/** Error text for the panel: first line, no stack, capped — SMTP errors don't carry the password. */
+const describe = (err: unknown) =>
+ (err instanceof Error ? err.message : String(err)).split('\n')[0].slice(0, 200)
+
export type MailAdapterArgs = {
+ smtp?: PanelSmtpAdapterArgs
+ graph?: GraphAdapterArgs
fallbackFromAddress?: string
fallbackFromName?: string
- graph?: GraphAdapterArgs
- smtp?: PanelSmtpAdapterArgs
}
/** True when the agency Graph credentials are present in the environment. */
function graphAvailable(): boolean {
return Boolean(
process.env.GRAPH_TENANT_ID &&
- process.env.GRAPH_CLIENT_ID &&
- process.env.GRAPH_CLIENT_SECRET &&
- process.env.GRAPH_SENDER,
+ process.env.GRAPH_CLIENT_ID &&
+ process.env.GRAPH_CLIENT_SECRET &&
+ process.env.GRAPH_SENDER,
)
}
@@ -69,20 +75,58 @@ export const mailAdapter =
sendEmail: async (message: SendEmailOptions) => {
const settings = await getSiteIntegrations(payload)
const choice = settings.emailTransport ?? 'smtp'
+ const previous = settings[STATUS_FIELD]
+ const useGraph = choice === 'graph' && graphAvailable()
+ const graphFallback = choice === 'graph' && !useGraph
- if (choice === 'graph') {
- if (graphAvailable()) {
- return graph.sendEmail(message)
- }
+ if (graphFallback) {
// Panel asked for Graph but the agency creds aren't configured for
// this project. Fall back to SMTP rather than silently dropping mail.
payload.logger.warn(
'[ipal] Transport set to Graph but GRAPH_* env vars are missing; falling back to SMTP.',
)
- return smtp.sendEmail(message)
}
- return smtp.sendEmail(message)
+ const transport = useGraph ? 'Microsoft Graph' : 'SMTP'
+ const code = useGraph ? 'graph-error' : 'smtp-error'
+ let result: unknown
+ try {
+ result = await (useGraph ? graph : smtp).sendEmail(message)
+ } catch (err) {
+ await recordIntegrationStatus(payload, STATUS_FIELD, previous, {
+ state: 'degraded',
+ code,
+ message: `${transport}: ${describe(err)}`,
+ })
+ throw err // callers (form-builder, Send test) still see the failure
+ }
+
+ // The delegates report failure as { sent: false, error, detail? } instead
+ // of throwing (a broken mailbox must not crash a form submission).
+ const failed = result as { sent?: boolean; error?: string; detail?: string } | null
+ if (failed && typeof failed === 'object' && failed.sent === false) {
+ await recordIntegrationStatus(payload, STATUS_FIELD, previous, {
+ state: 'degraded',
+ code,
+ message: `${transport}: ${describe(failed.detail ?? failed.error ?? 'not sent')}`,
+ })
+ return result
+ }
+
+ // Graph selected but unavailable is a configuration problem even if SMTP delivered.
+ await recordIntegrationStatus(
+ payload,
+ STATUS_FIELD,
+ previous,
+ graphFallback
+ ? {
+ state: 'degraded',
+ code: 'graph-unavailable',
+ message: 'Microsoft Graph is selected but not configured on the server — e-mails are sent over SMTP.',
+ }
+ : { state: 'ok' },
+ )
+ return result
},
}
}
diff --git a/src/modules/email/panelSmtpAdapter.ts b/src/modules/email/panelSmtpAdapter.ts
index 3cb32b5..d790ba1 100644
--- a/src/modules/email/panelSmtpAdapter.ts
+++ b/src/modules/email/panelSmtpAdapter.ts
@@ -1,15 +1,14 @@
import type { PayloadEmailAdapter, SendEmailOptions } from 'payload'
-
import { getSiteIntegrations } from '../payload/index.js'
/** SMTP fields the adapter reads from SiteIntegrations. */
type SmtpIntegrations = {
- smtpFromAddress?: null | string
- smtpFromName?: null | string
- smtpHost?: null | string
- smtpPassword?: null | string
- smtpPort?: null | number
- smtpUser?: null | string
+ smtpHost?: string | null
+ smtpPort?: number | null
+ smtpUser?: string | null
+ smtpPassword?: string | null
+ smtpFromAddress?: string | null
+ smtpFromName?: string | null
}
export type PanelSmtpAdapterArgs = {
@@ -59,8 +58,10 @@ export const panelSmtpAdapter =
const pass = smtp.smtpPassword
if (!host || !user || !pass) {
- payload.logger.error('[ipal] Email not sent: SMTP is not configured in Site Integrations.')
- return { error: 'SMTP is not configured in Site Integrations.', sent: false }
+ payload.logger.error(
+ '[ipal] Email not sent: SMTP is not configured in Site Integrations.',
+ )
+ return { sent: false, error: 'SMTP is not configured in Site Integrations.' }
}
// The panel is the source of truth for the sender; fall back to whatever
@@ -77,18 +78,15 @@ export const panelSmtpAdapter =
// normalises CRLF in standard headers, but the form-builder interpolates
// user data into the subject via {{field}} placeholders, so strip any
// newlines from header-bound values before they reach the transport.
- const stripCRLF = (v: unknown): string =>
- String(v ?? '')
- .replace(/[\r\n]+/g, ' ')
- .trim()
+ const stripCRLF = (v: unknown): string => String(v ?? '').replace(/[\r\n]+/g, ' ').trim()
const { default: nodemailer } = await import('nodemailer')
const transporter = nodemailer.createTransport({
- auth: { pass, user },
host,
port,
secure: port === 465, // implicit TLS on 465, STARTTLS otherwise
+ auth: { user, pass },
})
try {
@@ -97,12 +95,13 @@ export const panelSmtpAdapter =
from,
...(message.subject ? { subject: stripCRLF(message.subject) } : {}),
})
- return { messageId: info.messageId, sent: true }
+ return { sent: true, messageId: info.messageId }
} catch (err) {
// Never surface SMTP internals to the caller — a form submission
// shouldn't fail loudly because the mailbox is misconfigured.
payload.logger.error(`[ipal] Email send failed: ${(err as Error).message}`)
- return { error: 'Failed to send email.', sent: false }
+ // `detail` is for the panel status (mailAdapter), not for end users.
+ return { sent: false, error: 'Failed to send email.', detail: (err as Error).message }
}
},
})
diff --git a/src/modules/forms/formsPluginConfig.ts b/src/modules/forms/formsPluginConfig.ts
index c6d3d15..c0376dd 100644
--- a/src/modules/forms/formsPluginConfig.ts
+++ b/src/modules/forms/formsPluginConfig.ts
@@ -1,37 +1,60 @@
-import type { Plugin } from 'payload'
-
import { formBuilderPlugin } from '@payloadcms/plugin-form-builder'
-
+import type { Plugin } from 'payload'
import type { FormsOption } from './types.js'
+/** REST/GraphQL: only logged-in users. Local API (submitForm) is unaffected. */
+const submissionsCreateAccess = ({ req }: { req: { user?: unknown } }) => Boolean(req.user)
+
/**
* Configures @payloadcms/plugin-form-builder from IPAL's FormsOption.
*
- * Provides the form/form-submissions collections and field types. Email
- * delivery is intentionally NOT handled here — the plugin's own SMTP-from-panel
- * sender (submitForm) does that, so the form-builder's built-in email (which
- * needs a Payload email adapter) is left unused.
+ * Provides the forms / form-submissions collections and field types. E-mails
+ * after a submission are the form-builder's own (Forms → Emails), sent through
+ * the project's email adapter (mailAdapter()).
+ *
+ * SECURITY: form-builder defaults form-submissions to `create: () => true`, i.e.
+ * anyone can POST /api/form-submissions and skip everything submitForm enforces
+ * (rate limit, Turnstile, GDPR consent, schema validation). Here REST/GraphQL
+ * creation is limited to logged-in users; the site submits through submitForm
+ * (server action → Local API, which bypasses access by design). A project that
+ * really needs public REST submissions can override `formSubmissionOverrides.access.create`.
*/
export function buildFormsPlugin(forms: FormsOption): Plugin {
+ const adminGroup = forms.adminGroup === undefined ? 'Forms' : forms.adminGroup
+ const group = adminGroup ? { group: adminGroup } : {}
return formBuilderPlugin({
fields: {
- checkbox: true,
- email: true,
- message: true,
- number: true,
- payment: false,
- select: true,
text: true,
textarea: true,
+ email: true,
+ number: true,
+ select: true,
+ checkbox: true,
+ message: true,
+ payment: false,
...forms.fields,
},
- ...(forms.redirectRelationships ? { redirectRelationships: forms.redirectRelationships } : {}),
+ ...(forms.redirectRelationships
+ ? { redirectRelationships: forms.redirectRelationships }
+ : {}),
// Client-supplied collection overrides (e.g. a per-form notification
// address). The plugin provides the hook, not the opinion about which
// extra fields a form should carry.
- ...(forms.formOverrides ? { formOverrides: forms.formOverrides } : {}),
- ...(forms.formSubmissionOverrides
- ? { formSubmissionOverrides: forms.formSubmissionOverrides }
- : {}),
+ // Tidy panel by default: both collections under one sidebar group with plain
+ // labels — no per-project overrides needed just to sort the sidebar.
+ formOverrides: {
+ labels: { singular: 'Form', plural: 'Forms' },
+ ...forms.formOverrides,
+ admin: { ...group, ...forms.formOverrides?.admin },
+ },
+ formSubmissionOverrides: {
+ labels: { singular: 'Submission', plural: 'Submissions' },
+ ...forms.formSubmissionOverrides,
+ admin: { ...group, defaultColumns: ['form', 'createdAt'], ...forms.formSubmissionOverrides?.admin },
+ access: {
+ create: submissionsCreateAccess,
+ ...forms.formSubmissionOverrides?.access,
+ },
+ },
})
}
diff --git a/src/modules/forms/submitForm.ts b/src/modules/forms/submitForm.ts
index 561497e..e91ccd0 100644
--- a/src/modules/forms/submitForm.ts
+++ b/src/modules/forms/submitForm.ts
@@ -1,21 +1,17 @@
import 'server-only'
-
import type { BasePayload } from 'payload'
-
import { verifyTurnstile } from '../turnstile/index.js'
-import { checkRateLimit } from './rateLimit.js'
import { validateSubmission } from './validateSubmission.js'
+import { checkRateLimit } from './rateLimit.js'
export type SubmitFormArgs = {
- /**
- * Name of the GDPR consent checkbox. A field with this name must be checked
- * for the submission to succeed (enforced server-side). Defaults to 'consent'.
- */
- consentFieldName?: string
- /** Submitted field data — shape matches the form's fields. */
- data: Record
+ payload: BasePayload
/** Form-builder form ID this submission belongs to. */
formId: string
+ /** Submitted field data — shape matches the form's fields. */
+ data: Record
+ /** Turnstile token; when present it is verified, when absent it is skipped. */
+ turnstileToken?: string
/** Client IP — used for Turnstile and rate limiting. */
ip?: string
/**
@@ -23,15 +19,17 @@ export type SubmitFormArgs = {
* Set to 0 to disable (e.g. when a real limiter sits in front).
*/
maxPerMinute?: number
- payload: BasePayload
+ /**
+ * Name of the GDPR consent checkbox. A field with this name must be checked
+ * for the submission to succeed (enforced server-side). Defaults to 'consent'.
+ */
+ consentFieldName?: string
/**
* Turnstile can't be verified because of OUR side (missing/wrong secret,
* Cloudflare unreachable): 'allow' (default) accepts the submission and shows
* the problem in the panel; 'reject' refuses it.
*/
turnstileOnConfigError?: 'allow' | 'reject'
- /** Turnstile token; when present it is verified, when absent it is skipped. */
- turnstileToken?: string
}
/**
@@ -52,26 +50,26 @@ export type SubmitFormArgs = {
* - `error` — persistence failed unexpectedly
*/
export type SubmitFailure =
+ | { success: false; reason: 'rate_limited' }
+ | { success: false; reason: 'turnstile' }
| {
+ success: false
+ reason: 'validation'
/** The offending field's name, when one field is at fault. */
field?: string
/** What was wrong with it. */
kind?: 'required' | 'too_long' | 'unknown_fields'
- reason: 'validation'
- success: false
}
+ | { success: false; reason: 'not_found' }
| {
- field?: string
+ success: false
/** A GDPR consent field existed on the form but wasn't checked. */
reason: 'consent'
- success: false
+ field?: string
}
- | { reason: 'error'; success: false }
- | { reason: 'not_found'; success: false }
- | { reason: 'rate_limited'; success: false }
- | { reason: 'turnstile'; success: false }
+ | { success: false; reason: 'error' }
-export type SubmitFormResult = { submissionId: number | string; success: true } | SubmitFailure
+export type SubmitFormResult = SubmitFailure | { success: true; submissionId: string | number }
/**
* Handles a form submission end to end: rate limit, verify Turnstile, validate
@@ -87,27 +85,27 @@ export type SubmitFormResult = { submissionId: number | string; success: true }
* server-only: touches the Turnstile secret.
*/
export async function submitForm({
- consentFieldName,
- data,
+ payload,
formId,
+ data,
+ turnstileToken,
ip,
maxPerMinute = 5,
- payload,
+ consentFieldName,
turnstileOnConfigError = 'allow',
- turnstileToken,
}: SubmitFormArgs): Promise {
// 1. Rate limit — cheapest gate, drops a flood before any real work.
if (maxPerMinute > 0 && ip) {
if (!checkRateLimit({ key: ip, max: maxPerMinute })) {
- return { reason: 'rate_limited', success: false }
+ return { success: false, reason: 'rate_limited' }
}
}
// 2. Turnstile — verify when a token is supplied; reject on failure.
if (turnstileToken !== undefined) {
- const ok = await verifyTurnstile({ ip, onConfigError: turnstileOnConfigError, payload, token: turnstileToken })
+ const ok = await verifyTurnstile({ token: turnstileToken, payload, ip, onConfigError: turnstileOnConfigError })
if (!ok) {
- return { reason: 'turnstile', success: false }
+ return { success: false, reason: 'turnstile' }
}
}
@@ -116,14 +114,14 @@ export async function submitForm({
const validation = await validateSubmission(payload, formId, data, consentFieldName)
if (!validation.ok) {
if (validation.reason === 'not_found') {
- return { reason: 'not_found', success: false }
+ return { success: false, reason: 'not_found' }
}
if (validation.reason === 'consent') {
- return { field: validation.field, reason: 'consent', success: false }
+ return { success: false, reason: 'consent', field: validation.field }
}
return {
- reason: 'validation',
success: false,
+ reason: 'validation',
...(validation.field ? { field: validation.field } : {}),
...(validation.kind ? { kind: validation.kind } : {}),
}
@@ -142,9 +140,9 @@ export async function submitForm({
})),
} as never,
})
- return { submissionId: submission.id, success: true }
+ return { success: true, submissionId: submission.id }
} catch (err) {
payload.logger.error(`[ipal] Form submission failed: ${(err as Error).message}`)
- return { reason: 'error', success: false }
+ return { success: false, reason: 'error' }
}
}
diff --git a/src/modules/forms/types.ts b/src/modules/forms/types.ts
index e53a6d2..2fe1540 100644
--- a/src/modules/forms/types.ts
+++ b/src/modules/forms/types.ts
@@ -19,23 +19,25 @@ export type FormsCollectionOverrides = {
* form-builder plugin. Kept minimal; the plugin passes these through.
*/
export type FormsOption = {
+ /** Field types available in the form builder. Sensible defaults applied. */
+ fields?: {
+ text?: boolean
+ textarea?: boolean
+ email?: boolean
+ number?: boolean
+ select?: boolean
+ checkbox?: boolean
+ message?: boolean
+ payment?: boolean
+ }
+ /** Collections a form can redirect to (e.g. ['pages']). */
+ redirectRelationships?: string[]
/**
* Name of the checkbox field treated as a GDPR consent gate. A form field
* with this name must be checked for submission to succeed — enforced
* server-side in submitForm. Defaults to 'consent'.
*/
consentFieldName?: string
- /** Field types available in the form builder. Sensible defaults applied. */
- fields?: {
- checkbox?: boolean
- email?: boolean
- message?: boolean
- number?: boolean
- payment?: boolean
- select?: boolean
- text?: boolean
- textarea?: boolean
- }
/**
* Override the forms collection. The plugin stays opinion-free about what a
* form needs beyond its fields — a client that wants, say, a per-form
@@ -51,6 +53,10 @@ export type FormsOption = {
formOverrides?: FormsCollectionOverrides
/** Override the form-submissions collection (same shape). */
formSubmissionOverrides?: FormsCollectionOverrides
- /** Collections a form can redirect to (e.g. ['pages']). */
- redirectRelationships?: string[]
+ /**
+ * Admin sidebar group for Forms + Form Submissions. Default 'Forms'.
+ * `false` = Payload default ("Collections"). An explicit `admin.group` in
+ * formOverrides / formSubmissionOverrides still wins.
+ */
+ adminGroup?: string | false
}
diff --git a/src/modules/integrations/IntegrationAlerts.tsx b/src/modules/integrations/IntegrationAlerts.tsx
index c2243aa..b40134e 100644
--- a/src/modules/integrations/IntegrationAlerts.tsx
+++ b/src/modules/integrations/IntegrationAlerts.tsx
@@ -1,14 +1,13 @@
import type { Payload } from 'payload'
-
import type { IntegrationStatus } from './status.js'
type Props = {
- /** Admin route, for the link. Default '/admin'. */
- adminRoute?: string
- /** Status groups to check: field name → label. */
- checks?: Record
/** Injected by Payload into admin server components. */
payload?: Payload
+ /** Status groups to check: field name → label. */
+ checks?: Record
+ /** Admin route, for the link. Default '/admin'. */
+ adminRoute?: string
}
/**
@@ -16,8 +15,8 @@ type Props = {
* are currently failing, with a link to Site Integrations. Renders nothing when
* everything is fine — and never throws (DB not ready → nothing).
*/
-export async function IntegrationAlerts({ adminRoute = '/admin', checks = { turnstileStatus: 'Turnstile' }, payload }: Props) {
- if (!payload) {return null}
+export async function IntegrationAlerts({ payload, checks = { turnstileStatus: 'Turnstile', emailStatus: 'Email' }, adminRoute = '/admin' }: Props) {
+ if (!payload) return null
let doc: Record
try {
doc = (await payload.findGlobal({ slug: 'site-integrations' as never, depth: 0 })) as Record
@@ -27,20 +26,20 @@ export async function IntegrationAlerts({ adminRoute = '/admin', checks = { turn
const failing = Object.entries(checks)
.map(([field, label]) => ({ label, status: doc?.[field] as IntegrationStatus | undefined }))
.filter((x) => x.status?.state === 'degraded')
- if (!failing.length) {return null}
+ if (!failing.length) return null
return (
- Integration problem — the site still works, but a safeguard is off.
+ Integration problem — the site still works, but something needs attention.
{failing.map(({ label, status }) => (
diff --git a/src/modules/integrations/IntegrationStatusBanner.tsx b/src/modules/integrations/IntegrationStatusBanner.tsx
index 9e0ff18..08e0ec6 100644
--- a/src/modules/integrations/IntegrationStatusBanner.tsx
+++ b/src/modules/integrations/IntegrationStatusBanner.tsx
@@ -2,14 +2,14 @@
import { useFormFields } from '@payloadcms/ui'
type Props = {
- /** Integration name shown in the banner, e.g. 'Turnstile'. */
- label: string
/** Name of the hidden status group (buildIntegrationStatusField). */
statusField: string
+ /** Integration name shown in the banner, e.g. 'Turnstile'. */
+ label: string
}
const fmt = (iso: unknown) => {
- if (typeof iso !== 'string' || !iso) {return ''}
+ if (typeof iso !== 'string' || !iso) return ''
const d = new Date(iso)
return Number.isNaN(d.getTime()) ? '' : d.toLocaleString()
}
@@ -19,18 +19,18 @@ const fmt = (iso: unknown) => {
* the integration has been used once; a red box while it's failing; a short
* green line once it works again.
*/
-export function IntegrationStatusBanner({ label, statusField }: Props) {
+export function IntegrationStatusBanner({ statusField, label }: Props) {
const state = useFormFields(([f]) => f[`${statusField}.state`]?.value) as string | undefined
const message = useFormFields(([f]) => f[`${statusField}.message`]?.value) as string | undefined
const code = useFormFields(([f]) => f[`${statusField}.code`]?.value) as string | undefined
const since = useFormFields(([f]) => f[`${statusField}.since`]?.value)
const checkedAt = useFormFields(([f]) => f[`${statusField}.checkedAt`]?.value)
- if (!state) {return null}
+ if (!state) return null
if (state === 'ok') {
return (
-
+
✓ {label} working{since ? ` since ${fmt(since)}` : ''}.