import type { AttachmentDto, DocumentDto, DocumentOwnerType, DocumentType, ExistingDocument } from '../../api/documents/documents.types.d.ts'; import type { DocumentDetail } from '../../api/legalEntity/legalEntity.types.d.ts'; import type { ComponentApiRequestContext } from '../../core/services/types.d.ts'; import type { FileSchema } from '../../types/file.d.ts'; export interface ExistingDocumentWithModificationDate extends ExistingDocument { modificationDate: string; } export type DocumentApiUtils = { fetchDocuments(documentDetails: DocumentDetail[], entityId: string): Promise; fetchDocument(documentDetail: DocumentDetail, entityId: string): Promise; uploadDocuments(documents: Partial[], 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 isIdDocumentType: (documentType: DocumentType) => boolean; export declare const getIdDocument: (entityId: string) => ExistingDocumentWithModificationDate | undefined; export interface CreateDocumentRequestProps { entityId: string; entityType: DocumentOwnerType; documentType: DocumentType; page1: FileSchema; page2?: FileSchema; description?: string; existingDocument?: ExistingDocument; } export declare const createDocumentRequest: ({ entityId, entityType, documentType, page1, page2, description, existingDocument, }: CreateDocumentRequestProps) => Promise | undefined>; 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: AttachmentDto[], incoming: AttachmentDto[]) => { content?: string; pageName?: string; pageType?: string; }[]; /** * Merges proof of ownership attachments by filtering based on pageName (not pageType) * since proofOfOwnership attachments may not have pageType */ export declare const mergeProofOfOwnershipAttachments: (existing: AttachmentDto[], incoming: AttachmentDto[]) => { content?: string; pageName?: string; pageType?: string; }[];