Added better support for GTM, improved accesibility

This commit is contained in:
2026-10-11 14:46:47 +02:00
parent fd6fb426b3
commit 6be783bc5a
53 changed files with 849 additions and 110 deletions
+7
View File
@@ -30,6 +30,11 @@ type UseContactFormOptions = {
messages?: Partial<Record<keyof ContactFormValues, string>>
/** 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). */
@@ -56,6 +61,7 @@ export function useContactForm(options: UseContactFormOptions) {
initialTopic = '',
messages,
minMessageLength = 10,
onSuccess,
requireConsent = false,
requireTopic = false,
requireTurnstile = false,
@@ -84,6 +90,7 @@ export function useContactForm(options: UseContactFormOptions) {
phone: '',
topic: initialTopic,
},
onSuccess,
requireTurnstile,
submitAction,
validate,