import { type FormSubmitAction } from './useForm.js'; /** * Field values of the STANDARD contact form. This is a preset shape — projects * that need a different field set (or dynamic builder fields) should use * `useForm` directly instead, where the shape is fully open. */ export type ContactFormValues = { consent: boolean; email: string; message: string; name: string; phone: string; topic: string; }; export type ContactFormErrors = Partial>; export type SubmitAction = FormSubmitAction; type UseContactFormOptions = { /** Generic error message shown when the action fails/throws. */ errorFallback?: string; initialTopic?: string; /** Override the per-field error message (shown via `errors.`). */ messages?: Partial>; /** Minimum message length. Default 10. */ minMessageLength?: number; /** * Called once after a successful submit — e.g. to fire a GTM `form_submit` * event: `onSuccess: (_r, v) => pushDataLayer('form_submit', { form_name: v.topic })`. */ onSuccess?: (result: { message?: string; success: boolean; }, values: ContactFormValues) => void; /** Whether consent is required (project passes true when consentText shown). */ requireConsent?: boolean; /** Whether a topic must be chosen (project passes this when topics exist). */ requireTopic?: boolean; /** Require a Turnstile token before submit (when the widget is shown). */ requireTurnstile?: boolean; submitAction: SubmitAction; }; /** * Zero-config preset over `useForm` for the everyday contact form: standard * fields (name/email/phone/topic/message/consent) and standard rules, wired * for you. Markup and styling stay 100% in the project — this only removes the * duplicated logic. * * const f = useContactForm({ submitAction, requireTurnstile: Boolean(siteKey), * requireTopic: topics.length > 0, requireConsent: Boolean(consentText) }) * * Need custom or dynamic fields? Drop the preset and call `useForm` + validators. */ export declare function useContactForm(options: UseContactFormOptions): { errorMessage: string | null; errors: Partial>; handleSubmit: (e?: { preventDefault?: (() => void) | undefined; } | undefined) => Promise; isSubmitting: boolean; isSuccess: boolean; reset: () => void; setErrors: import("react").Dispatch>>>; setField: (key: K, value: ContactFormValues[K]) => void; setTurnstileToken: import("react").Dispatch>; setValues: import("react").Dispatch>; turnstileToken: string | null; values: ContactFormValues; }; export {};