type UploadStatus = "idle" | "pending" | "uploading" | "processing" | "complete" | "error"; interface UploadFile { id: string; file: File; progress: number; status: UploadStatus; error?: string; url?: string; assetId?: string; } interface UploadConfig { /** * Maximum file size in bytes * @default 10 * 1024 * 1024 (10MB) */ maxSize?: number; /** * Accepted file types (MIME types or extensions) * @example ["image/*", ".pdf", "video/mp4"] */ accept?: string[]; /** * Maximum number of files allowed * @default 10 */ maxFiles?: number; } interface UploadHandler { /** * Called to get a presigned URL for uploading */ getUploadUrl: (file: File) => Promise<{ uploadUrl: string; assetId?: string; }>; /** * Called after the file has been uploaded to confirm/finalize */ onUploadComplete?: (assetId: string, file: File) => Promise<{ url?: string; }>; /** * Called when an upload fails */ onError?: (error: Error, file: File) => void; } interface Stack0HandlerOptions { /** * Your API endpoint that returns a presigned upload URL * This endpoint should use the Stack0 SDK server-side * @example "/api/upload" */ endpoint: string; /** * Optional confirm endpoint called after upload completes * If not provided, uses `${endpoint}/confirm` * @example "/api/upload/confirm" */ confirmEndpoint?: string; /** * Additional headers to send with requests (e.g., auth tokens) */ headers?: Record; /** * Optional folder path to include in the request */ folder?: string; } export type { Stack0HandlerOptions as S, UploadHandler as U, UploadConfig as a, UploadFile as b, UploadStatus as c };