import type { ChangeEvent } from 'react'; import type { FilePurpose } from '../../generated/experience-api-types'; import type { AsyncHandler, Handler } from '../../utils/types'; import type { File } from '../types'; export interface UseFileUploadArgs { /** * Description of the purpose this file will serve when uploaded * * Each file uploaded to Source must have an associated purpose, which indicates the constraints that * are placed on the uploaded file (what file types are allowed, maximum file sizes, etc). In addition, * each endpoint that accepts file uploads limits the file purposes that may be provided. */ purpose: FilePurpose; /** * Callback that will be invoked on a successful file upload. The uploaded file information is provided. */ onUpload: Handler; /** * Callback that will be invoked on a failed file upload. The error encountered will be provided. */ onError: Handler; } export interface UseFileUploadReturn { /** * Handler that can be attached to an which will trigger an upload on selection */ onChange: AsyncHandler, void>; /** * A boolean flag indicating whether an upload is in progress */ uploading: boolean; } /** * Custom hook to power file uploads directly to Source * * @param options options for the file upload * @returns file upload return */ export declare function useFileUpload(options: UseFileUploadArgs): UseFileUploadReturn;