import { ClientTaxDocumentation } from '@taxbit/utilities'; import { InputStep, Locale, Progress, QuestionnaireProp, QuestionnaireState } from 'types'; import { ExternalValidations } from 'types/client'; import { UsTinValidationAttempt } from '../../hooks/useUsTinValidation/useUsTinValidation'; import { Region } from '../../services/api'; import { AdaptiveMode } from '../../types/props'; import { DescriptorState } from '../types'; type InterviewConfig = { minimumAge: number; }; export type DateFormatConfig = 'dmy' | 'mdy' | 'ymd'; export type UseQuestionnaireStateProps = { data?: ClientTaxDocumentation; language?: Locale; externalValidations?: ExternalValidations; /** * Called on submit with the full `DescriptorState` (the same shape the * descriptors receive) and, separately, any collected files keyed by field. * The engine is payload-agnostic: it hands state out untransformed, and the * supplying wrapper owns the outbound transform (e.g. `transformForSignedClient`, * which reads `state.fields` + `state.config.questionnaire`) plus its side * effect (POST / hand-off). A flow with a different endpoint plugs in its own * transform here. Files are held in state (not in the JSON document); the * `files` arg is always present (empty when no file fields). */ onSubmit?: (state: DescriptorState, files: Record) => void | Promise; onProgress?: (progress: Progress) => void | Promise; step?: InputStep; questionnaire: QuestionnaireProp; config?: InterviewConfig; treatyClaims?: boolean; dateFormat?: DateFormatConfig; realTimeTinValidation?: boolean; staging?: boolean; bearerToken?: string; region?: Region; proxyDomain?: string; proxyHeaders?: Record; adaptiveMode?: AdaptiveMode; poweredByTaxbit?: boolean; }; export declare const useQuestionnaireState: ({ data: startingData, language: initialLanguage, externalValidations, onSubmit, onProgress, step: initialStep, questionnaire, config, treatyClaims, dateFormat, realTimeTinValidation, staging, bearerToken, region, proxyDomain, proxyHeaders, adaptiveMode, poweredByTaxbit, }: UseQuestionnaireStateProps) => { fields: QuestionnaireState; ui: { language: Locale; isEditing: boolean; isSubmitting: boolean; setLanguage: (lang: Locale) => void; setIsEditing: import('react').Dispatch>; goTo: (inputStep: InputStep) => void; }; config: { questionnaire: QuestionnaireProp; treatyClaims: boolean; realTimeTinValidation: boolean; dateFormat: DateFormatConfig; minimumAge: number; adaptiveMode: AdaptiveMode | undefined; poweredByTaxbit: boolean | undefined; data: ClientTaxDocumentation; }; server: { externalValidations: ExternalValidations | undefined; usTinValidations: UsTinValidationAttempt[]; }; stepName: "AccountHolderCertifications" | "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxResidenciesConfirmation" | "AccountHolderAdditionalInfo" | "AccountHolderTreatyClaims" | "AccountHolderUsTinValidation" | "ControllingPersonDetails1" | "ControllingPersonDetails2" | "ControllingPersonDetails3" | "ControllingPersonDetails4" | "ControllingPersonDetails5" | "ControllingPerson1TaxResidenciesConfirmation" | "ControllingPerson2TaxResidenciesConfirmation" | "ControllingPerson3TaxResidenciesConfirmation" | "ControllingPerson4TaxResidenciesConfirmation" | "ControllingPerson5TaxResidenciesConfirmation" | "Exemptions" | "RegardedOwnerCertifications" | "RegardedOwnerContact" | "RegardedOwnerTax" | "RegardedOwnerTreatyClaims" | "RegardedOwnerUsTinValidation" | "StandaloneResidencies" | "Summary"; onBack: (() => void) | undefined; onPersist: (newData: QuestionnaireState) => void; onSubmit: (data: QuestionnaireState) => Promise; doValidateUsTin: (name: string, usTin: string) => Promise; incrementValidationAttempt: (name: string, usTin: string) => void; isValidatingUsTin: boolean; }; export {};