Added better support for GTM, improved accesibility
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user