// src/blocks/FormBlock/Component.tsx — SERVER part: rich text from the panel + bound action. // Block config (src/blocks/FormBlock/config.ts): slug 'formBlock', fields // { name: 'form', type: 'relationship', relationTo: 'forms', required: true } + the // shared section fields (eyebrow/heading/intro, anchor, background) — ipal-block. // Page query depth ≥ 1, otherwise `form` is just an ID. Wrap the output in the // project's
/ like every other block. // Blocks never import lib/* or app/* (AGENT.md §4.10) — texts and the server action // come in through enhanceProps from the page route (SKILL.md, step 4). import type { ReactNode } from 'react' import type { FormNotificationTexts } from '@intecion/ipal-kit' import { RichText } from '@/components/RichText' import { FormRenderer, type BuilderForm, type FormAction } from '@/components/forms/FormRenderer' type Props = { form?: BuilderForm | string | number | null locale: string formTexts?: FormNotificationTexts sendForm?: (formId: string, locale: string, values: Record, token?: string) => ReturnType } export function FormBlock({ form, locale, formTexts, sendForm }: Props) { if (!form || typeof form !== 'object' || !formTexts || !sendForm) return null // never a fake/hardcoded form const messages: Record = {} form.fields?.forEach((f, i) => { if (f.blockType === 'message' && f.message) messages[i] = }) const confirmation = form.confirmationMessage ? : null return ( ) }