All files / src/components/UploadFile types.tsx

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63                                                                                                                             
import { IFileWithMeta, StatusValue } from "react-dropzone-uploader";
import {
  TFileAttachmentType,
  UploadProgressParams,
} from "./hooks/useUploadFiles";
import { QueryKey } from "react-query";
 
export enum FileUploadStatus {
  UPLOADED = "Uploaded!",
  IN_PROGRESS = "Uploading...",
  FILE_NOT_SUPPORTED = "File type not supported",
  FILE_TOO_LARGE = "File too large",
  FAILED = "Failed",
  DELETED = "Deleted",
}
 
export enum FileMimeTypes {
  PDF = "application/pdf",
  JPEG = "image/jpeg",
  PNG = "image/png",
  WEBP = "image/webp",
  GIF = "image/gif",
  SVG = "image/svg+xml",
  TXT = "text/plain",
  CSV = "text/csv",
}
 
 
export interface SnackbarFile {
  id: string;
  name: string;
  size: number;
  status: string;
  // This will contain the progress of request
  uploadProgress: number;
  identifier?: number | string; // file id in db or url of the file
  accountToRequest?: number; // account id to make api call to delete file after uploaded
  canBeDeleted: boolean;
  refetcherKeyOnDelete?: QueryKey;
}
 
export type TSnackbarFiles = {
  fileWithMeta: IFileWithMeta;
  status: StatusValue;
  allFiles: IFileWithMeta[];
  attachmentType?: TFileAttachmentType;
  label?: string;
  tag?: string;
  merchantId?: number;
  resourceID?: number;
  isCustomerUpload?: boolean;
  isSignatureUpload?: boolean;
  customFinish?: ({
    identifiers,
  }: {
    identifiers: (number | string)[];
  }) => void;
  customFailed?: ({ fileIds }: { fileIds: string[] }) => void;
  onSuccess?: () => void;
  refetcherKeyOnDelete?: QueryKey;
  isDeleteAllowed?: boolean;
};