import * as z from 'zod/v4'; import { AddressField, AdministrativeAreaField, BulletList, Checkbox, Country, DateField, Divider, Facility, EmailField, FieldConfig, File, FileUploadWithOptions, LocationInput, Office, PageHeader, Paragraph, RadioGroup, SelectField, SignatureField, TextAreaField, TextField, NumberField, NumberWithUnitField, DataField, NameField, PhoneField, IdField, DateRangeField, SelectDateRangeField, TimeField, AlphaPrintButton, HttpField, SearchField, ButtonField, LinkButtonField, VerificationStatus, QueryParamReaderField, QrReaderField, IdReaderField, LoaderField, AgeField, FieldGroup, CustomField, HiddenField, AutocompleteField, ImageViewField, Heading, UserRoleField } from './FieldConfig'; import { FieldType } from './FieldType'; import { CheckboxFieldValue, EmailValue, FieldValue, NumberFieldValue, TextValue, DataFieldValue, DateRangeFieldValue, SelectDateRangeValue, TimeValue, ButtonFieldValue, VerificationStatusValue, AgeValue, FieldUpdateValue, AutocompleteValue, DateValue } from './FieldValue'; import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue, NameFieldValue, HttpFieldUpdateValue, NumberWithUnitFieldValue, QueryParamReaderFieldUpdateValue, QrReaderFieldValue, IdReaderFieldValue, CustomFieldValue } from './CompositeFieldValue'; import { DynamicNameValue, DynamicAddressFieldValue } from './DynamicFieldValue'; import { ActionType } from './ActionType'; import { EventConfig } from './EventConfig'; /** * FieldTypeMapping.ts should include functions that map field types to different formats dynamically. * File is separated from FieldType and FieldConfig to avoid circular dependencies. * * We can move the specific mapFieldTypeTo* functions where they are used once the core fields are implemented. */ /** * Mapping of field types to Zod schema. * Useful for building dynamic validations against FieldConfig */ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: ActionType): z.ZodString | z.ZodObject<{ path: z.core.$ZodBranded; originalFilename: z.ZodString; type: z.ZodString; }, z.core.$strip> | z.ZodOptional> | z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ firstname: z.ZodOptional>; surname: z.ZodOptional>; middlename: z.ZodOptional>; }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]> | z.ZodArray; originalFilename: z.ZodString; type: z.ZodString; option: z.ZodString; }, z.core.$strip>> | z.ZodBoolean | z.ZodNumber | z.ZodOptional> | z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ loading: z.ZodOptional>; error: z.ZodOptional>>; data: z.ZodOptional>; }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]> | z.ZodObject<{ data: z.ZodRecord; }, z.core.$strip> | z.ZodObject<{ data: z.ZodAny; }, z.core.$strip> | z.ZodObject<{ numericValue: z.ZodNumber; unit: z.ZodString; }, z.core.$strip> | z.ZodObject<{ numericValue: z.ZodOptional; unit: z.ZodOptional; }, z.core.$strip> | z.core.$ZodBranded | z.ZodObject<{ age: z.ZodNumber; asOfDateRef: z.ZodString; }, z.core.$strip> | z.ZodObject<{ label: z.ZodString; value: z.ZodString; }, z.core.$strip> | z.ZodEnum<{ last7Days: "last7Days"; last30Days: "last30Days"; last90Days: "last90Days"; last365Days: "last365Days"; }> | z.ZodUnion<[z.ZodObject<{ start: z.core.$ZodBranded; end: z.core.$ZodBranded; }, z.core.$strip>, z.core.$ZodBranded]> | z.ZodEmail | z.ZodOptional>; addressType: z.ZodLiteral<"DOMESTIC">; administrativeArea: z.ZodString; }, z.core.$strip>, z.ZodObject<{ country: z.ZodString; streetLevelDetails: z.ZodOptional>; addressType: z.ZodLiteral<"INTERNATIONAL">; }, z.core.$strip>], "addressType">, z.ZodString, z.core.$ZodBranded, z.ZodObject<{ age: z.ZodNumber; asOfDateRef: z.ZodString; }, z.core.$strip>, z.ZodString, z.ZodUnion<[z.ZodObject<{ start: z.core.$ZodBranded; end: z.core.$ZodBranded; }, z.core.$strip>, z.core.$ZodBranded]>, z.ZodEnum<{ last7Days: "last7Days"; last30Days: "last30Days"; last90Days: "last90Days"; last365Days: "last365Days"; }>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ path: z.core.$ZodBranded; originalFilename: z.ZodString; type: z.ZodString; }, z.core.$strip>, z.ZodArray; originalFilename: z.ZodString; type: z.ZodString; option: z.ZodString; }, z.core.$strip>>, z.ZodObject<{ firstname: z.ZodString; surname: z.ZodString; middlename: z.ZodOptional; }, z.core.$strip>, z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ firstname: z.ZodOptional>; surname: z.ZodOptional>; middlename: z.ZodOptional>; }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]>, z.ZodNumber, z.ZodObject<{ loading: z.ZodBoolean; error: z.ZodOptional>>; data: z.ZodAny; }, z.core.$strip>, z.ZodEnum<{ verified: "verified"; authenticated: "authenticated"; failed: "failed"; pending: "pending"; }>, z.ZodOptional; updatedAt: z.ZodISODateTime; }, z.core.$strip>>>, z.ZodObject<{ data: z.ZodAny; }, z.core.$strip>, z.ZodObject<{ data: z.ZodAny; }, z.core.$strip>, z.ZodObject<{ numericValue: z.ZodNumber; unit: z.ZodString; }, z.core.$strip>, z.ZodObject<{ numericValue: z.ZodOptional; unit: z.ZodOptional; }, z.core.$strip>, z.core.$ZodBranded, z.ZodObject<{ label: z.ZodString; value: z.ZodString; }, z.core.$strip>, z.ZodNullable>>]>>; }, z.core.$strip>>> | z.ZodOptional; end: z.core.$ZodBranded; }, z.core.$strip>, z.core.$ZodBranded]>>> | z.ZodOptional>> | z.ZodOptional; unit: z.ZodOptional; }, z.core.$strip>>> | z.ZodOptional; originalFilename: z.ZodString; type: z.ZodString; }, z.core.$strip>>> | z.ZodOptional; originalFilename: z.ZodString; type: z.ZodString; option: z.ZodString; }, z.core.$strip>>>> | z.ZodOptional>; addressType: z.ZodLiteral<"DOMESTIC">; administrativeArea: z.ZodString; }, z.core.$strip>, z.ZodObject<{ country: z.ZodString; streetLevelDetails: z.ZodOptional>; addressType: z.ZodLiteral<"INTERNATIONAL">; }, z.core.$strip>], "addressType">, z.ZodString, z.core.$ZodBranded, z.ZodObject<{ age: z.ZodNumber; asOfDateRef: z.ZodString; }, z.core.$strip>, z.ZodString, z.ZodUnion<[z.ZodObject<{ start: z.core.$ZodBranded; end: z.core.$ZodBranded; }, z.core.$strip>, z.core.$ZodBranded]>, z.ZodEnum<{ last7Days: "last7Days"; last30Days: "last30Days"; last90Days: "last90Days"; last365Days: "last365Days"; }>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ path: z.core.$ZodBranded; originalFilename: z.ZodString; type: z.ZodString; }, z.core.$strip>, z.ZodArray; originalFilename: z.ZodString; type: z.ZodString; option: z.ZodString; }, z.core.$strip>>, z.ZodObject<{ firstname: z.ZodString; surname: z.ZodString; middlename: z.ZodOptional; }, z.core.$strip>, z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ firstname: z.ZodOptional>; surname: z.ZodOptional>; middlename: z.ZodOptional>; }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]>, z.ZodNumber, z.ZodObject<{ loading: z.ZodBoolean; error: z.ZodOptional>>; data: z.ZodAny; }, z.core.$strip>, z.ZodEnum<{ verified: "verified"; authenticated: "authenticated"; failed: "failed"; pending: "pending"; }>, z.ZodOptional; updatedAt: z.ZodISODateTime; }, z.core.$strip>>>, z.ZodObject<{ data: z.ZodAny; }, z.core.$strip>, z.ZodObject<{ data: z.ZodAny; }, z.core.$strip>, z.ZodObject<{ numericValue: z.ZodNumber; unit: z.ZodString; }, z.core.$strip>, z.ZodObject<{ numericValue: z.ZodOptional; unit: z.ZodOptional; }, z.core.$strip>, z.core.$ZodBranded, z.ZodObject<{ label: z.ZodString; value: z.ZodString; }, z.core.$strip>, z.ZodNullable>>]>>; }, z.core.$strip>>>>> | z.ZodOptional>; surname: z.ZodOptional>; middlename: z.ZodOptional>; }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]>>> | z.ZodOptional>; error: z.ZodOptional>>; data: z.ZodOptional>; }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]>>> | z.ZodOptional; }, z.core.$strip>>> | z.ZodObject<{ firstname: z.ZodString; surname: z.ZodString; middlename: z.ZodString | z.ZodOptional; }, z.core.$strip> | z.ZodType<{ country: string; addressType: "DOMESTIC"; administrativeArea: string; streetLevelDetails?: Record | undefined; } | { country: string; addressType: "INTERNATIONAL"; streetLevelDetails?: Record | undefined; } | { addressType: "DOMESTIC"; country?: string | null | undefined; streetLevelDetails?: Record | null | undefined; administrativeArea?: string | null | undefined; } | { addressType: "INTERNATIONAL"; country?: string | null | undefined; streetLevelDetails?: Record | null | undefined; } | null | undefined, unknown, z.core.$ZodTypeInternals<{ country: string; addressType: "DOMESTIC"; administrativeArea: string; streetLevelDetails?: Record | undefined; } | { country: string; addressType: "INTERNATIONAL"; streetLevelDetails?: Record | undefined; } | { addressType: "DOMESTIC"; country?: string | null | undefined; streetLevelDetails?: Record | null | undefined; administrativeArea?: string | null | undefined; } | { addressType: "INTERNATIONAL"; country?: string | null | undefined; streetLevelDetails?: Record | null | undefined; } | null | undefined, unknown>> | z.ZodObject>; }>, z.core.$strip> | z.ZodOptional>> | z.ZodOptional> | z.ZodOptional>> | z.ZodOptional>> | z.ZodOptional>> | z.ZodOptional>> | z.ZodOptional> | z.ZodOptional; }, z.core.$strip>>> | z.ZodOptional>; }>, z.core.$strip>>>; type FieldTypeValueMap = { [FieldType.FIELD_GROUP]: Record; [FieldType.DATE]: z.infer; [FieldType.AGE]: z.infer; [FieldType.TIME]: z.infer; [FieldType.EMAIL]: z.infer; [FieldType.DATE_RANGE]: z.infer; [FieldType.SELECT_DATE_RANGE]: z.infer; [FieldType.TEXT]: z.infer; [FieldType.TEXTAREA]: z.infer; [FieldType.DIVIDER]: z.infer; [FieldType.BULLET_LIST]: z.infer; [FieldType.PAGE_HEADER]: z.infer; [FieldType.LOCATION]: z.infer; [FieldType.SELECT]: z.infer; [FieldType.COUNTRY]: z.infer; [FieldType.RADIO_GROUP]: z.infer; [FieldType.PARAGRAPH]: z.infer; [FieldType.HEADING]: z.infer; [FieldType.AUTOCOMPLETE]: z.infer; [FieldType.IMAGE_VIEW]: z.infer; [FieldType.ADMINISTRATIVE_AREA]: z.infer; [FieldType.FACILITY]: z.infer; [FieldType.OFFICE]: z.infer; [FieldType.PHONE]: z.infer; [FieldType.LINK_BUTTON]: z.infer; [FieldType.VERIFICATION_STATUS]: z.infer; [FieldType.ID]: z.infer; [FieldType.LOADER]: z.infer; [FieldType.ALPHA_HIDDEN]: z.infer; [FieldType.USER_ROLE]: z.infer; [FieldType.NUMBER]: z.infer; [FieldType.NUMBER_WITH_UNIT]: z.infer; [FieldType.CHECKBOX]: z.infer; [FieldType.SIGNATURE]: z.infer; [FieldType.FILE]: z.infer; [FieldType.FILE_WITH_OPTIONS]: z.infer; [FieldType.ADDRESS]: z.infer; [FieldType.DATA]: z.infer; [FieldType.NAME]: z.infer; [FieldType.BUTTON]: z.infer; [FieldType.ALPHA_PRINT_BUTTON]: z.infer; [FieldType.HTTP]: z.infer; [FieldType.SEARCH]: z.infer; [FieldType.QUERY_PARAM_READER]: z.infer; [FieldType.QR_READER]: z.infer; [FieldType.ID_READER]: z.infer; [FieldType._EXPERIMENTAL_CUSTOM]: z.infer; }; export type FieldTypeToFieldValue = FieldTypeValueMap[T]; type UnionToIntersection = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never; type ExtractFieldMap = T extends { declaration: { pages: readonly (infer Page)[]; }; } ? Page extends { fields: readonly (infer Field)[]; } ? Field extends { id: infer Id extends string; type: infer Type extends FieldType; } ? Record> : never : never : never; export type EventConfigToDeclarationFormType = UnionToIntersection>; /** * Maps complex or nested field types, such as Address fields, to their corresponding empty values. */ export declare function mapFieldTypeToEmptyValue(field: FieldConfig): z.core.$brand<"CustomFieldValue"> | never[] | Record | null; export declare const isParagraphFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: Paragraph; }; export declare const isHeadingFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: Heading; }; export declare const isImageViewFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: ImageViewField; }; export declare const isDateFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: DateField; }; export declare const isAgeFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: AgeValue | undefined; config: AgeField; }; export declare const isTimeFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: TimeField; }; export declare const isDateRangeFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: DateRangeFieldValue; config: DateRangeField; }; export declare const isSelectDateRangeFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: SelectDateRangeValue; config: SelectDateRangeField; }; export declare const isPageHeaderFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: PageHeader; }; export declare const isTextFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: TextField; }; export declare const isNumberFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: number; config: NumberField; }; export declare const isNumberWithUnitFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: NumberWithUnitFieldValue; config: NumberWithUnitField; }; export declare const isNameFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: NameFieldValue; config: NameField; }; export declare const isPhoneFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: PhoneField; }; export declare const isIdFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: IdField; }; export declare const isTextAreaFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: TextAreaField; }; export declare const isSignatureFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue | undefined; }) => field is { value: FileFieldValue | undefined; config: SignatureField; }; export declare const isEmailFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: EmailField; }; export declare const isFileFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: FileFieldValue; config: File; }; export declare const isFileFieldWithOptionType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: FileFieldWithOptionValue; config: FileUploadWithOptions; }; export declare const isBulletListFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: BulletList; }; export declare const isSelectFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: SelectField; }; export declare const isAddressFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: AddressFieldValue; config: AddressField; }; export declare const isCountryFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: Country; }; export declare const isCheckboxFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: boolean; config: Checkbox; }; export declare const isRadioGroupFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: RadioGroup; }; export declare const isFieldGroupFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: Record | undefined; config: FieldGroup; }; export declare const isLocationFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: LocationInput; }; export declare const isDividerFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: Divider; }; export declare const isAdministrativeAreaFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: AdministrativeAreaField; }; /** @deprecated Moving on, we should only use FieldType.LOCATION. */ export declare const isFacilityFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: Facility; }; /** @deprecated Moving on, we should only use FieldType.LOCATION. */ export declare const isOfficeFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: Office; }; export declare const isDataFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: DataFieldValue; config: DataField; }; export declare const isButtonFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: ButtonField; }; export declare const isPrintButtonFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: AlphaPrintButton; }; export declare const isHttpFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: HttpField; }; export declare const isAutocompleteFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: AutocompleteField; }; export declare const isSearchFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: SearchField; }; export declare const isLinkButtonFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: LinkButtonField; }; export declare const isVerificationStatusType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: VerificationStatusValue | undefined; config: VerificationStatus; }; export declare const isQueryParamReaderFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: QueryParamReaderField; }; export declare const isQrReaderFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: QrReaderField; }; export declare const isIdReaderFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: IdReaderField; }; export declare const isLoaderFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: LoaderField; }; export declare const isCustomFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: CustomFieldValue; config: CustomField; }; export declare const isUserRoleFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: string; config: UserRoleField; }; export declare const isHiddenFieldType: (field: { config: FieldConfig; value: FieldValue | FieldUpdateValue; }) => field is { value: undefined; config: HiddenField; }; export type NonInteractiveFieldType = Divider | PageHeader | ImageViewField | Paragraph | Heading | BulletList | DataField | AlphaPrintButton | LinkButtonField | LoaderField | AutocompleteField; export type InteractiveFieldType = Exclude; export declare const isNonInteractiveFieldType: (field: FieldConfig) => field is NonInteractiveFieldType; export {}; //# sourceMappingURL=FieldTypeMapping.d.ts.map