import type { Attachment } from '../../core/models/api/attachment'; import type { Document, DocumentDetail, DocumentEntityType, DocumentType, ExistingDocument, ExistingDocumentWithModificationDate } from '../../core/models/api/document'; import type { ComponentApiRequestContext } from '../../core/services/types'; import type { FileSchema } from '../../types/file'; export type DocumentApiUtils = { fetchDocuments(documentDetails: DocumentDetail[], entityId: string): Promise; fetchDocument(documentDetail: DocumentDetail, entityId: string): Promise; uploadDocuments(documents: Document[], entityId: string): Promise; deleteDocument?: (documentId: string, entityId: string) => Promise; }; export declare const documentApiUtils: (context: ComponentApiRequestContext) => DocumentApiUtils; export declare const getDocument: (entityId: string | undefined, documentType: DocumentType) => ExistingDocumentWithModificationDate | undefined; export declare const getDocuments: (entityId: string | undefined, documentType: DocumentType) => ExistingDocumentWithModificationDate[]; export declare const getIdDocument: (entityId: string) => ExistingDocumentWithModificationDate | undefined; export interface CreateDocumentRequestProps { entityId: string; entityType: DocumentEntityType; documentType: DocumentType; page1: FileSchema; page2?: FileSchema; description?: string; existingDocument?: ExistingDocument; } export declare const createDocumentRequest: ({ entityId, entityType, documentType, page1, page2, description, existingDocument, }: CreateDocumentRequestProps) => Promise; export declare const fileToBase64: (file: File) => Promise; export declare const getFileExtention: (fileName: string) => string | undefined; /** * Merges existing attachments from API with newly added attachments in UI * making sure new ones override only corresponding ones based on pageType (front<->front) * Eg: user selects new front of ID, we keep the back already saved in DB, override front * * @param existing Attachments copied from API response * @param incoming New attachments * @returns merged attachments with deduped pageTypes */ export declare const mergeAttachments: (existing: Attachment[], incoming: Attachment[]) => Attachment[]; /** * Merges proof of ownership attachments by filtering based on pageName (not pageType) * since proofOfOwnership attachments may not have pageType */ export declare const mergeProofOfOwnershipAttachments: (existing: Attachment[], incoming: Attachment[]) => Attachment[];