import type { FormDescriptor, FormField, JsonValue } from '@fun-xyz/fiat-contract/types'; import type { SubmitTransition } from '../../domains/fiat/selectTransitions'; /** * A form's answers as a screen edits them, keyed by field id. Serialised into * the `FORM_VALUES` payload's entry list when the body is assembled. */ export type FormValues = Record; /** * What local validation can say. * * Each names one fixable thing, because the server will not: it answers a * malformed answer with `INVALID_VALUE` on the whole submission and marks no * field, so a form checked only by the server can report nothing more useful * than "something is wrong". */ export type FormFieldIssue = 'REQUIRED' | 'PATTERN' | 'COUNTRY_CODE' | 'DATE_FORMAT' | 'DATE_FUTURE'; /** * The input a form's values ride in, read off the transition rather than * assumed: the name is the server's (`values` in the recorded response) and * the `FORM_VALUES` spec is what marks it. */ export declare function formValuesInput(transition: SubmitTransition): string | undefined; /** * Whether the field is answered by a value the form submits. * * `HOSTED_LINK` is an errand the user runs elsewhere and `FILE` streams to the * document endpoint, so neither has a value to carry. */ export declare function isValueField(field: FormField): boolean; /** * Whether the form requires a field nothing here can answer. * * Neither type carries a value, so {@link validateForm} has nothing to check * and would call the form complete: * * - `FILE` streams to `POST /fiat/kyc/document`, an upload path this build has * not installed. * - `HOSTED_LINK` is an errand run elsewhere, and nothing reports back that the * user ran it. * * Submitting either way sends a form the server will reject, re-entering * `INPUT_REQUIRED` with the same fields and nothing marked wrong. */ export declare function requiresUnanswerableField(form: FormDescriptor): boolean; /** Per-field issues, keyed by field id. Empty means nothing local to fix. */ export declare function validateForm(form: FormDescriptor, values: FormValues): Record; /** Whether the form is worth sending. */ export declare function canSubmitForm(form: FormDescriptor, values: FormValues): boolean; //# sourceMappingURL=formValues.d.ts.map