import { type RefObject } from 'react'; import type { RecaptchaWidgetHandle } from '../../components/recaptcha-widget'; type Messages = Readonly>; /** * How long the button stays busy waiting for a reCAPTCHA token. Google * sends no event when the user closes a challenge, so the wait cannot be * open-ended: after this the button comes back and the user can try * again. A token that arrives later is still used. */ export declare const CAPTCHA_PATIENCE = 8000; export interface UseRegistrationSubmitOptions { /** The host's `errors` prop. */ errors: Messages | undefined; /** The host's `submitting` prop. */ submitting: boolean; /** True when the browser posts the form itself. */ native: boolean; /** True when a reCAPTCHA check guards the submit. */ captcha: boolean; /** * The first field that stops a submit, or `undefined` when every field * is valid. Called when the answer is needed, so it must read the * latest values. */ firstProblem: () => Field | undefined; /** A submit was refused because of this field. */ onRefused: (field: Field) => void; /** * Hand the values over. For a React host, call its `onSubmit`. For a * native post this is only called when a reCAPTCHA token arrives (put * the token in its field and call `form.submit()`); without reCAPTCHA * the browser posts on its own and this is not called. */ deliver: (captchaToken?: string) => void; /** The server has answered with these messages. */ onAnswer: (errors: Messages) => void; /** The browser restored the page from its back-forward cache. */ onRestore?: () => void; } export interface UseRegistrationSubmitReturn { /** True while a submit is on its way: the host is sending, the browser * is posting, or a reCAPTCHA token is awaited. */ busy: boolean; /** True when the last reCAPTCHA check failed or expired. */ captchaFailed: boolean; /** The form's `onSubmit`. */ handleSubmit: (event: { preventDefault: () => void; }) => void; /** Props for the `RecaptchaWidget`. */ captcha: { ref: RefObject; onChange: (token: string | null) => void; onError: () => void; }; } export declare function useRegistrationSubmit(options: UseRegistrationSubmitOptions): UseRegistrationSubmitReturn; export {}; //# sourceMappingURL=use-registration-submit.d.ts.map