import { Region } from 'services/api'; import { QuestionnaireProp } from 'types'; import { ClientTaxDocumentationStatus } from '../../types/client/ClientTaxDocumentationStatus'; import { SafeProxyHeaders } from '../../types/props'; type UseTaxbitProps> = { bearerToken: string; questionnaire: QuestionnaireProp; staging?: boolean; onError?: (error: Error) => void | Promise; region?: Region; proxyDomain?: never; proxyHeaders?: never; prepopulateWithSavedData?: boolean; } | { bearerToken: string; questionnaire: QuestionnaireProp; staging?: never; region?: never; proxyDomain?: string; proxyHeaders?: SafeProxyHeaders; onError?: (error: Error) => void | Promise; prepopulateWithSavedData?: boolean; }; export declare const useTaxbit: >({ bearerToken, questionnaire, staging, onError, region, proxyDomain, proxyHeaders, prepopulateWithSavedData, }: UseTaxbitProps) => { serverData: import('@taxbit/utilities').SignedClientTaxDocumentation | undefined; statusData: ClientTaxDocumentationStatus | undefined; canGetDocumentUrl: boolean; generateDocumentUrl: () => void; isGeneratingDocumentUrl: boolean; documentUrl: string | undefined; /** * True iff the user has at least one OPEN W-Form issue the SDK's curing * widget can resolve. Derived from `statusData.wFormQuestionnaire`, so * it's available regardless of which `questionnaire` the host passes — * the status fetch returns all questionnaire slices. Host gates the * `` mount on this boolean. */ needsCuringDocumentation: boolean; /** * True while the underlying status fetch is in flight. Hosts gating UI * on `needsCuringDocumentation` should defer to this first — otherwise * the loading state reads as "no curing needed" (predicate is `false` * while `statusData` is undefined), causing a brief flash before the * real answer arrives. */ isLoading: boolean; error: Error | undefined; /** * Re-issue the underlying status + submission fetches. Useful when the * host knows server state has changed (e.g. after a questionnaire or * curing submit) and needs `needsCuringDocumentation` / `statusData` / * `serverData` to reflect the latest. Only re-runs the fetch effects — * no component remount required. Returns a `Promise` that resolves * when both fetches settle, so callers can `await` before reading * derived state (avoids the closure-stale race in the same render cycle * as the trigger). */ refresh: () => Promise; /** * Re-fetch just the status (drives `needsCuringDocumentation`). * Resolves when that fetch settles. */ refreshStatus: () => Promise; /** * Re-fetch just the submission (drives `serverData`). * Resolves when that fetch settles. */ refreshSubmission: () => Promise; }; export {};