import type { ExportSourceWire } from '../contracts/not-front-v2.wire'; import { type ExportFormat } from '../utils/piperLiteExport.util'; /** Why the export cannot be asked for, derived from the wire. */ export type ExportBlockedReason = { kind: 'missingFilters'; filters: string[]; } | { kind: 'unavailable'; code: 'too_many_pieces'; }; export type ExportState = { status: 'idle'; } | { status: 'generating'; } | { status: 'ready'; sizeBytes: number; } | { status: 'empty'; } | { status: 'tooLarge'; } | { status: 'forbidden'; } | { status: 'failed'; } | { status: 'misconfigured'; } | { status: 'blocked'; reason: ExportBlockedReason; }; export type UseExportInput = { /** `null` while the wire carries no request (blocked placements). */ source: ExportSourceWire | null; missingFilters: string[]; unavailable: 'too_many_pieces' | null; userFlow?: string; }; export type UseExportResult = { state: ExportState; /** Asks for the file; ignored while blocked or while one request is in flight. */ start: (format: ExportFormat) => void; }; /** * State machine of one download placement. One request in flight; it is * aborted on unmount and when the request key changes (url, headers, payload, * `dependsOn` values: the same rule as `useV2DataSource`). A changed key also * returns `tooLarge`, `empty`, `ready` and the failures to `idle`, because the * answer belonged to other filters. Nothing is requested while blocked. */ export declare const useExport: (input: UseExportInput) => UseExportResult;