import { HttpBackend, HttpClient, HttpEvent } from '@angular/common/http'; import { OnDestroy } from '@angular/core'; import { AlertsService, HttpService, LoaderNotificationService } from '@ieeesa-npm/utility'; import { FileUploadPresignedUrl, GetFileDownloadPresignedUrlByAttachmentIdResponse } from '../models/file-upload-presigned-url-res.model'; import { Observable, Subject } from 'rxjs'; import { FileUploadPayload } from '../models/file-upload-payload-model'; import { FileAttachmentInfo, GetFileUploadPresignedUrlsResponse } from '../models/file-upload-response.model'; import { DeleteFileResponse } from '../models/file-info.model'; import { DownloadAttachment } from '../models/download-file.model'; import * as i0 from "@angular/core"; /** * This service interacts with the server to obtain pre-signed URLs for file upload and uploads files to Amazon S3. * @class FileUploadService */ export declare class FileUploadService implements OnDestroy { httpService: HttpService; alertService: AlertsService; loaderNotificationService: LoaderNotificationService; destroy$: Subject; constants: { ariaLabel: { clear: string; warning: string; previousMonth: string; nextMonth: string; menuIcon: string; close: string; search: string; addFormGroup: string; }; button: { cancel: string; ok: string; add: string; }; modalConfig: { ariaLabel: string; autoFocus: string; width: string; }; chips: { noOfDefaultVisibleChips: number; label: { viewAll: string; viewLess: string; }; ariaLabel: { chipsList: string; }; icons: { arrow: { id: number; iconURL: string; toolTip: string; ariaLabel: string; }; remove: { id: number; iconURL: string; toolTip: string; ariaLabel: string; }; check: { id: number; iconURL: string; toolTip: string; ariaLabel: string; }; }; }; dataTable: { label: { clearAll: string; }; message: { noRecordFound: string; }; ariaLabel: { search: string; selectAll: string; select: string; link: string; pagination: string; }; buttons: { id: number; iconURL: string; toolTip: string; ariaLabel: string; }[]; }; datePicker: { selectDateLabel: string; dateFormatLabel: string; startDateLabel: string; endDateLabel: string; datePickerIcon: string; }; dropdown: { placeholderText: string; }; filter: { label: { filterBy: string; applyButton: string; clearAll: string; }; buttons: { id: number; iconURL: string; toolTip: string; ariaLabel: string; }[]; }; textarea: { maxLengthDefault: number; leftCharacters: string; }; autocomplete: { minCharToSearch: number; debounceTime: number; }; multiSelectAutoComplete: { label: { clearAll: string; }; ariaLabel: { selectedOption: string; removeOption: string; }; icons: { remove: string; clearAll: string; }; }; header: { alt: { logo: string; }; ariaLabel: { helpLink: string; hamburgerMenu: string; }; label: { signOut: string; }; buttons: { id: number; iconURL: string; toolTip: string; ariaLabel: string; }[]; userProfileMenuOptions: { id: number; iconURL: string; label: string; ariaLabel: string; toolTip: string; isToolTipNeeded: boolean; }[]; errors: { "2029": string; }; }; footer: { alt: { logo: string; }; links: { label: string; ariaLabel: string; redirectUrl: string; }[]; ieeeLogo: string; copyright: { link: string; textPart1: string; textPart2: string; hyperLinkPart3: string; textPart4: string; }; }; welcome: { buttons: { label: string; ariaLabel: string; url: string; }[]; }; breadcrumb: { label: { initial: string; }; }; loader: { ariaLabel: { spinner: string; }; }; defaultWelcomeBgColor: string; timePicker: { defaultTimeFormat: number; timePickerIcon: string; }; colorPicker: { label: { select: string; cancel: string; }; ariaLabel: { colorPicker: string; next: string; back: string; select: string; cancel: string; hexCodeInput: string; palette: string; }; defaultColor: string; ariaDescription: string; ariaDescribedById: string; paletteColors: { name: string; hexCode: string; }[]; }; fileUpload: { label: { fileUpload: string; allowedFileSize1: string; allowedFileSize2: string; allowedFileFormat: string; browseFiles: string; uploadProgress: string; upload: string; mb: string; uploadFor: string; uploadErrorMsg: string; of: string; filesUploaded: string; fileAlreadyExists: string; }; ariaLabel: { fileUpload: string; browseFiles: string; fileUploadIcon: string; removeFileIcon: string; deleteFileIcon: string; fileDownload: string; fileUploadInput: string; }; iconUrl: { fileUploadIcon: string; fileRemoveIcon: string; deleteIcon: string; }; buttons: { id: number; ariaLabel: string; iconURL: string; toolTip: string; disabled: boolean; }[]; message: { error: { ER1002: string; invalidFileFormat: string; invalidFileSize: string; "2026": string; "2059": string; "2060": string; "2061": string; "2062": string; "2063": string; "2064": string; }; }; limit: { maxFilesUploadedOnce: number; }; }; list: { defaultIndentation: number; dragAndDropIconUrl: string; }; search: { minCharToSearch: number; searchIcon: string; }; richTextEditor: { label: { editor: string; }; ariaLabel: { editor: string; colorPicker: string; }; }; fileDownload: { buttons: { id: number; ariaLabel: string; iconURL: string; toolTip: string; disabled: boolean; }[]; preSignedDuration: string; message: { errors: { ER1002: string; "5038": string; "6027": string; "6028": string; }; }; }; breakPointMaxWidth: string; }; apiBaseUrl: string; fileByteArray: Uint8Array | undefined; httpClient: HttpClient; isFileUploading: boolean; filesNameOfUploadFailed: string[]; noOfFilesUploadedSuccessfully: number; uploadedFileName: string; constructor(httpService: HttpService, handler: HttpBackend, alertService: AlertsService, loaderNotificationService: LoaderNotificationService); /** * Sets the base URL for API requests. * @param {string} apiBaseUrl -API base URL. * @memberof FileUploadService */ setApiBaseUrl(apiBaseUrl: string): void; /** * Gets API base URL for API requests. * @return {*} {string} * @memberof FileUploadService */ getApiBaseUrl(): string; /** * Retrieves presigned URL for uploading files to Amazon S3 bucket. * @param {(File | FileList)} file * @return {Observable} * @memberof FileUploadService */ getFileUploadPresignedUrl(file: File | FileList, appId: string): Observable; /** * Gets pre-signed URL for the files to be uploaded in S3 bucket * @param {FileUploadPayload} fileUploadPayload * @param {string} fileUploadAPIPath * @return {Observable} * @memberof FileUploadService */ getPreSignedURL(fileUploadPayload: FileUploadPayload, fileUploadAPIPath: string): Observable; /** * Uploads file to AWS S3 using a pre-signed URL. * @param {string} preSignedUrl * @param files * @param isMultipleFileUpload * @return {Observable} -Returns an observable that emits the response after uploading the file to S3. * @memberof FileUploadService */ uploadFileToS3(preSignedUrl: FileAttachmentInfo[] | string, files: File | FileList, isMultipleFileUpload?: boolean): Observable; /** * Makes http call to AWS to upload file in S3 bucket * @param {string} preSignedUrl * @param {File} file * @param {string} fileType * @param {number} fileSize * @return {*} {Observable} * @memberof FileUploadService */ httpCallToAWS(preSignedUrl: string, file: File, fileType: string, fileSize: number): Observable; /** * Gets file upload progress. * @param {*} message * @memberof FileUploadService */ showProgress(message: any): void; /** * Return distinct message for sent, upload progress, & response events. * @param {HttpEvent} event * @param {(File | FileList)} file * @return {*} * @memberof FileUploadService */ getEventMessage(event: HttpEvent, file: File): string | boolean; /** * Converts file to byte array. * @param {File} file * @memberof FileUploadService */ convertFileToByteArray(file: File): void; /** * Resets file byte array format to undefined. * @memberof FileUploadService */ clearFileByteArray(): void; /** * Sets file upload status. * @param {boolean} status * @memberof FileUploadService */ setFileUploadStatus(status: boolean): void; /** * Returns file upload status. * @return {boolean} * @memberof FileUploadService */ getFileUploadStatus(): boolean; /** * Retrieves presigned URL for downloading files to Amazon S3 bucket. * @param {(File | FileList)} file * @return {Observable} * @memberof FileUploadService */ getFileDownloadPresignedUrls(file: File | FileList | string | DownloadAttachment, isPublicAPI?: boolean, domainUrl?: string, presignedApiUrl?: string): Observable; /** * Downloads file to AWS S3 using a presigned URL. * @return {Observable} * @memberof FileUploadService */ downloadFile(fileDownloadPresignedUrl: string): Observable; /** * Validates the total size of the files uploaded. * @param {(File | FileList)} files -The files to be validated. * @param {number} maxFileSize * @param {boolean} isMultiFileUpload * @return {boolean} -Returns true if the total size of files is within the specified limit, otherwise false. * @memberof FileUploadService */ validateFileSize(files: File | FileList, maxFileSize: number, isMultiFileUpload: boolean): boolean; /** * Validates the file types of the uploaded files. * @param {(File | FileList)} files * @param {string[]} allowedFileTypes * @param {boolean} isMultiFileUpload * @return {boolean} -Returns true if all files have valid extensions, otherwise false. * @memberof FileUploadService */ validateFileTypes(files: File | FileList, allowedFileTypes: string[], isMultiFileUpload: boolean): boolean; /** * Extracts and returns the extension of a file from its name. * @private * @param {string} fileName * @return {string} -The file extension in lowercase. * @memberof FileUploadService */ private getFileExtension; /** * Delete the file from AWS S3 based on the given fileId along with deleteFileApiPath. * @return {Observable} * @memberof FileUploadService */ deleteFile(deleteFileApiPath: string): Observable; /** * Implementation of ngOnDestroy lifecycle hook method to unsubscribe the open observable subscriptions. * @memberof FileUploadService */ ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }