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D,CACtFZ,EAAGA,IAAMC,EAAQ,MACjBY,GAAI,sCAEpBH,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAaC,eAAc3L,EAAAA,EAAA,GACPyL,OAAOC,aAAaC,gBAAkB,IACtCA,I,MCtC3BE,EAAOC,QAAU5M,O,OCAjB2M,EAAOC,QAAUC,U,eCCjB,IAAIC,EAAI,EAAQ,IACZC,EAAO,EAAQ,IACfC,EAAY,EAAQ,IACpBC,EAA6B,EAAQ,KACrCC,EAAU,EAAQ,KAClBC,EAAU,EAAQ,KAKtBL,EAAE,CAAEjE,OAAQ,UAAWuE,MAAM,EAAMC,OAJO,EAAQ,MAIgC,CAChF7H,WAAY,SAAoB8H,GAC9B,IAAIC,EAAIhN,KACJiN,EAAaP,EAA2BQ,EAAEF,GAC1CzH,EAAU0H,EAAW1H,QACrBC,EAASyH,EAAWzH,OACpBzC,EAAS4J,GAAQ,WACnB,IAAIQ,EAAiBV,EAAUO,EAAEzH,SAC7B6H,EAAS,GACTC,EAAU,EACVC,EAAY,EAChBV,EAAQG,GAAU,SAAUQ,GAC1B,IAAIrI,EAAQmI,IACRG,GAAgB,EACpBF,IACAd,EAAKW,EAAgBH,EAAGO,GAASE,MAAK,SAAUlF,GAC1CiF,IACJA,GAAgB,EAChBJ,EAAOlI,GAAS,CAAEE,OAAQ,YAAamD,MAAOA,KAC5C+E,GAAa/H,EAAQ6H,OACtB,SAAU1M,GACP8M,IACJA,GAAgB,EAChBJ,EAAOlI,GAAS,CAAEE,OAAQ,WAAYsI,OAAQhN,KAC5C4M,GAAa/H,EAAQ6H,YAGzBE,GAAa/H,EAAQ6H,MAGzB,OADIrK,EAAOrC,OAAO8E,EAAOzC,EAAOwF,OACzB0E,EAAWM,Y,eCvCtB,EAAQ,Q","sources":["webpack://united-malt/./src/modules/upload-manager/upload-manager.tsx?ffbf","webpack://united-malt/./src/modules/upload-manager/components/upload-button.tsx?976c","webpack://united-malt/./src/modules/upload-manager/components/upload-box.tsx?2664","webpack://united-malt/./src/modules/upload-manager/components/progress-bar.tsx?ba1f","webpack://united-malt/./src/modules/upload-manager/upload-manager.view.tsx?ac31","webpack://united-malt/./lib/upload-manager/module-registration.js?1100","webpack://united-malt/external var \"React\"?0d3b","webpack://united-malt/external var \"ReactDOM\"?853b","webpack://united-malt/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.promise.all-settled.js?72d7","webpack://united-malt/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/esnext.promise.all-settled.js?c5a9"],"sourcesContent":["//==============================================================================\r\n// Manages file uploads\r\n//\r\n// The definition file contains references to document uploads for onboarding,\r\n// but this is a completely generic upload system.\r\n//\r\n// This works by requesting secure upload tokens from an external source, then\r\n// using those tokens to upload the file to cloud storage.\r\n//\r\n// The actual upload mechanism will be isolated as much as possible, to allow\r\n// for easy retargeting. The initial version targets Azure blob storage, but\r\n// switching to any other provider that works with access tokens, such as\r\n// AWS S3, should be very simple.\r\n//==============================================================================\r\nimport * as React from 'react';\r\nimport { observer } from 'mobx-react';\r\nimport { observable, IObservableArray } from 'mobx';\r\n\r\nimport { IFileWithSas, ISASEntity } from '../../actions/DataServiceEntities.g';\r\nimport { generateUrisAsync } from '../../actions/DataActionExtension.g';\r\n\r\nimport { UploadNotificationHandler } from '../umg-onboarding-form';\r\n\r\nimport { IUploadManagerData } from './upload-manager.data';\r\nimport { IUploadManagerProps } from './upload-manager.props.autogenerated';\r\n\r\n//==============================================================================\r\n// INTERFACES\r\n//==============================================================================\r\ninterface UploadManagerRealProps extends IUploadManagerProps {\r\n changeHandler: UploadNotificationHandler;\r\n}\r\n\r\nexport type UploadHandler = (files: FileList) => Promise;\r\nexport type RemoveFileHandler = (file: UploadableFile) => void;\r\n\r\nexport interface IUploadManagerViewProps extends UploadManagerRealProps {\r\n initiateUpload: UploadHandler;\r\n removeFile: RemoveFileHandler;\r\n fileList: UploadableFiles;\r\n progress: UploadProgress[];\r\n errors: UploadError[];\r\n}\r\n\r\n// Keep track of uploaded files\r\nexport interface UploadableFile {\r\n name: string; // Base filename\r\n size: number; // File size\r\n file?: File; // Reference to the upload file object, needed for the actual upload\r\n url?: string; // This is the secure URL to upload the file\r\n identifier?: string; // After upload completes, this is the unique identifier to access the file\r\n}\r\nexport type UploadableFiles = UploadableFile[];\r\n\r\nexport interface UploadProgress {\r\n name: string; // Filename\r\n size: number; // Not really needed, but could be useful\r\n progress: number; // 0-1\r\n}\r\n\r\nexport interface UploadError {\r\n filename?: string;\r\n message: string;\r\n}\r\n\r\n//==============================================================================\r\n// CLASS DEFINITION\r\n//==============================================================================\r\n/**\r\n * UploadManager component\r\n * @extends {React.Component}\r\n */\r\n@observer\r\nclass UploadManager extends React.Component {\r\n\r\n @observable private fileList: UploadableFiles = [];\r\n @observable private errors: UploadError[] = [];\r\n @observable private progress: UploadProgress[] = [];\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n constructor(props: UploadManagerRealProps) {\r\n super(props);\r\n\r\n this.initiateUpload = this.initiateUpload.bind(this);\r\n this.removeFile = this.removeFile.bind(this);\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n public render(): JSX.Element | null {\r\n\r\n // An array iterator or length check is required for an observable array to cause re-renders\r\n // @ts-expect-error\r\n const bogus = this.errors.length + this.fileList.length + this.progress.length;\r\n\r\n const viewProps: IUploadManagerViewProps = {\r\n ...this.props,\r\n fileList: this.fileList,\r\n errors: this.errors,\r\n initiateUpload: this.initiateUpload,\r\n removeFile: this.removeFile,\r\n progress: this.progress,\r\n };\r\n\r\n return this.props.renderView(viewProps);\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Centralize (but stupidly simple) error manager\r\n //----------------------------------------------------------\r\n private addError(error: string, filename?: string): void {\r\n this.errors.push({\r\n message: error,\r\n filename\r\n });\r\n }\r\n\r\n //----------------------------------------------------------\r\n // The upload was initiated via click or drag and drop\r\n //----------------------------------------------------------\r\n private async initiateUpload(files: FileList): Promise {\r\n\r\n // Clear old errors\r\n this.errors = [];\r\n\r\n // Verify each file\r\n const validFiles = this.validateRequestedUploads(files);\r\n\r\n // Request SAS tokens for each file\r\n const secureURLs = await this.requestSecureUploadURLs(validFiles);\r\n\r\n // Abort if none\r\n if (!secureURLs) { return; }\r\n\r\n // Upload files\r\n await this.uploadFiles(secureURLs);\r\n\r\n // Inform our imperial overlord about changes to the file list\r\n this.props.changeHandler(this.fileList);\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Verifies all of the requested file uploads against extension\r\n // We could also validate against max upload size, but we\r\n // don't have that info. It's easier to let retail server\r\n // handle that check.\r\n //----------------------------------------------------------\r\n private validateRequestedUploads(files: FileList): UploadableFile[] {\r\n\r\n // Convert the list of allowed extensions to lowercase\r\n const validExtensions = (this.props.config.acceptedFormats || []).map(entry => entry.toLowerCase());\r\n\r\n // Convert from FileList to an array\r\n const simplifiedList: UploadableFile[] = [];\r\n for (let i = 0; i < files.length; i++) {\r\n simplifiedList.push({\r\n name: files[i].name,\r\n size: files[i].size,\r\n file: files[i]\r\n });\r\n }\r\n\r\n // Add valid files to the list\r\n return simplifiedList.filter(file => {\r\n const extension = file.name.split('.').pop();\r\n\r\n // This code could be a lot shorter, but we want to think about every possibility and set the correct messaging based on the case\r\n\r\n // All extensions are accepted\r\n if (!validExtensions.length) {\r\n return true;\r\n }\r\n\r\n // No extension supplied\r\n if (!extension) {\r\n this.addError(this.props.resources.unknownFileType, file.name);\r\n return false;\r\n }\r\n\r\n // Extension supplied, but not in the whitelist\r\n if (!validExtensions.includes(extension.toLowerCase())) {\r\n this.addError(this.props.resources.invalidFileExtension, file.name);\r\n return false;\r\n }\r\n\r\n // There was an extension, and it's a valid one\r\n return true;\r\n });\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Performs the retail server call to fetch secure upload URLs\r\n //----------------------------------------------------------\r\n private async requestSecureUploadURLs(fileList: UploadableFile[]): Promise {\r\n\r\n // Convert file list to request format\r\n const requestPayload: ISASEntity = {\r\n Id: 0,\r\n UploadFiles: fileList.map(entry => ({\r\n Name: entry.name,\r\n Size: Math.ceil(entry.size / 1024), // The server expects kilobytes and doesn't accept decimals\r\n })),\r\n };\r\n\r\n // Perform the request\r\n try {\r\n const result = await generateUrisAsync({ callerContext: this.props.context.actionContext }, requestPayload);\r\n const mappedResults: UploadableFile[] = this.mapResults(result.FilesWithSas || [], fileList);\r\n\r\n // Handle any errors -- @FIXME/dg: Switch to error code support\r\n result.ErrorFiles!.forEach(error => {\r\n error.ValidationErrors!.forEach(entry => this.addError(this.errorCodeToString(entry), error.Name));\r\n });\r\n\r\n return mappedResults;\r\n }\r\n catch (err) {\r\n this.addError(this.props.resources.unknownError);\r\n return [];\r\n }\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private errorCodeToString(code: string): string {\r\n const { resources, config } = this.props;\r\n\r\n // Convert between error codes and error messages in resources\r\n const errorCodeMap = {\r\n ERR_INVALID_EXTENSION: resources.invalidFileExtension,\r\n ERR_FILE_SIZE_ZERO: resources.uploadFileTooSmall,\r\n ERR_FILE_SIZE_EXCEEDS_MAX_LIMIT: resources.uploadFileTooBig,\r\n };\r\n\r\n const message = errorCodeMap[code] || resources.unknownError;\r\n\r\n return message\r\n .replace('{s}', formatFileSize((config.maxFileSize || 5120) * 1024));\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Combines a file list with name and size, and a secure URL\r\n // list with name and URL\r\n //----------------------------------------------------------\r\n private mapResults(urlList: IFileWithSas[], fileList: UploadableFile[]) {\r\n const output: UploadableFile[] = [];\r\n\r\n // Step through the list of successful results\r\n urlList.forEach(entry => {\r\n\r\n // Find the matching record in our file list\r\n const match = fileList.find(file => file.name === entry.Name);\r\n if (!match || !entry.SasUri) {\r\n return console.error('NO MATCH FOUND!', entry.Name); // @FIXME/dg: Improve error handling after dev complete\r\n }\r\n\r\n // Add the URL to the UploadableFile record\r\n match.url = entry.SasUri;\r\n\r\n // Add the UploadableFile record to our filtered output\r\n output.push(match);\r\n });\r\n\r\n return output;\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Uploads multiple files at once, in parallel\r\n // This could have issues with a lot of files at once,\r\n // and might be best with a capped parallel pattern instead.\r\n // However, I think the browser will enforce that cap on its\r\n // own, and it's very unlikely more than a couple files will\r\n // be uploaded at once.\r\n //----------------------------------------------------------\r\n private async uploadFiles(filesToUpload: UploadableFile[]) {\r\n\r\n // Initiate uploads and wait for all to complete (successfully or not)\r\n const promises = filesToUpload.map(entry => this.doUpload(entry));\r\n const result = await Promise.allSettled(promises);\r\n\r\n // Process the results\r\n result.forEach((entry, index) => {\r\n\r\n // Regardless of the result, clear the entry from the progress list\r\n this.clearProgressEntry(filesToUpload[index].name);\r\n\r\n if (entry.status === 'rejected') {\r\n this.addError(this.props.resources.uploadFailed, filesToUpload[index].name);\r\n }\r\n else {\r\n const file = filesToUpload[index];\r\n this.fileList.push({\r\n name: file.name,\r\n size: file.size,\r\n identifier: file.url!.split('?')[0] // Strip the search string. Consider removing 'https://' as well, but it's not that important\r\n });\r\n }\r\n });\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Initiates upload of a single file\r\n //----------------------------------------------------------\r\n private async doUpload(file: UploadableFile) {\r\n\r\n const promise = new Promise((resolve, reject) => {\r\n\r\n // Init the file upload\r\n const fd = new FormData();\r\n fd.set('Content-Type', file.file!.type);\r\n fd.set('file', file.file!); // This must be last!\r\n var xhr = new XMLHttpRequest();\r\n\r\n // Generate a progress record\r\n const progressRecord = this.createProgressEntry(file.name, file.size);\r\n\r\n // Attach listeners\r\n xhr.upload.addEventListener(\"progress\", ev => progressRecord.progress = (ev.lengthComputable ? (ev.loaded / ev.total) : 0), false);\r\n xhr.addEventListener(\"error\", err => { reject('Error'); }, false);\r\n xhr.addEventListener(\"abort\", () => reject('Aborted'), false);\r\n xhr.addEventListener(\"load\", resp => (xhr.status >= 200 && xhr.status < 300) ? resolve(file) : reject('Failed'), false); // We need to check the response code to determine if it completed successfully or not\r\n\r\n // Finalize the request\r\n xhr.open(\"PUT\", file.url!);\r\n xhr.setRequestHeader('x-ms-blob-type', 'BlockBlob'); // Required header\r\n\r\n // Perform the request\r\n xhr.send(fd);\r\n });\r\n\r\n return promise;\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Creates a progress record, which the view uses to render\r\n // an upload progress bar\r\n //----------------------------------------------------------\r\n private createProgressEntry(filename: string, size: number): UploadProgress {\r\n\r\n const progress: UploadProgress = {\r\n name: filename,\r\n size: size,\r\n progress: 0\r\n };\r\n\r\n // It shouldn't be possible for two duplicate files unless the user\r\n // is pulling from different folders. In that case, the whole system will implode.\r\n // SAS tokens are based on unique names.\r\n // We'll still return an (orphaned) record for the progress event to work with\r\n if (this.progress.find(entry => entry.name === filename)) {\r\n console.warn(`Duplicate progress record found for ${filename}!`);\r\n }\r\n else {\r\n this.progress.push(progress);\r\n }\r\n\r\n // progress and the last entry of this.progress are NOT the same\r\n // this.progress is observable, so mobx cloned it and wrapped it\r\n return this.progress[this.progress.length - 1];\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Removes the progress record for an uploading file\r\n // Occurs when upload completes, whether success or not\r\n //----------------------------------------------------------\r\n private clearProgressEntry(filename: string): void {\r\n\r\n // Filter out entries with the matching filename. There better only be one!\r\n const filtered = this.progress.filter(entry => entry.name !== filename);\r\n\r\n // With mobx, we can't just reassign our array or the observability will be lost\r\n // We need to use replace instead, which requires a bit of type manipulation\r\n (this.progress as IObservableArray).replace(filtered);\r\n }\r\n\r\n //----------------------------------------------------------\r\n // \"Removes\" an upload by simply forgetting about it\r\n // The file isn't deleted from cloud storage -- it's left\r\n // as an orphan to be cleaned up by cloud storage policy\r\n //----------------------------------------------------------\r\n public removeFile(file: UploadableFile): void {\r\n // Find the entry\r\n const index = this.fileList.indexOf(file);\r\n\r\n if (index === -1) {\r\n return console.warn('Unable to find file reference!', file.name);\r\n }\r\n\r\n // Remove it from our list\r\n this.fileList.splice(index, 1);\r\n\r\n // Let our overlord know about the change\r\n this.props.changeHandler(this.fileList);\r\n }\r\n}\r\n\r\n//==========================================================\r\n//==========================================================\r\nexport function formatFileSize(size: number): string {\r\n\r\n // List of possible units. Add to the list to support gigabytes, terrabytes, etc.\r\n const units = ['bytes', 'kb', 'mb'];\r\n\r\n // Step through the units until we find the right one\r\n for (const unit of units) {\r\n if (size < 1024) {\r\n\r\n // Note that I'm using floor instead of round, which is a matter of preference\r\n // For 1 bytes less than 1MB, floor will show \"1023.9kb\" and round will show \"1024kb\" (not \"1mb\")\r\n return `${Math.floor(size * 10) / 10}${unit}`;\r\n }\r\n\r\n size /= 1024;\r\n }\r\n\r\n // There was no match, so use the largest unit in the list\r\n // Also note we have to undo the last divide by 1024\r\n // I decided to use round here, even though it's not consistent\r\n // Floor only makes sense when near a unit boundary\r\n return `${Math.round(size * 10 * 1024) / 10}${units[units.length - 1]}`;\r\n}\r\n\r\n\r\nexport default UploadManager;\r\n","//==============================================================================\r\n// Creates a styleable file upload button, replacing the ugly standard button\r\n//\r\n// Based on code by Masa Kudamatsu\r\n// https://medium.com/web-dev-survey-from-kyoto/how-to-customize-the-file-upload-button-in-react-b3866a5973d8\r\n//==============================================================================\r\nimport * as React from 'react';\r\n\r\n//==============================================================================\r\n//==============================================================================\r\nexport interface UploadButtonProps {\r\n className: string;\r\n acceptedExtensions: string[];\r\n buttonText: string;\r\n initiateUpload: (files: FileList) => Promise; // This is defined externally, but we want to limit external dependencies\r\n}\r\n\r\n//==============================================================================\r\n// Function Component\r\n//==============================================================================\r\nconst UploadButton: React.FC = (props) => {\r\n\r\n // Create a reference to the hidden file input element\r\n const fileInputRef = React.useRef(null);\r\n\r\n // Programatically click the hidden file input element\r\n // when the Button component is clicked\r\n const handleClick: React.MouseEventHandler = event => {\r\n fileInputRef.current?.click();\r\n };\r\n\r\n // Call a function (passed as a prop from the parent component)\r\n // to handle the user-selected file\r\n const handleChange: React.ChangeEventHandler = event => {\r\n if (event.target.files?.length) {\r\n void props.initiateUpload(event.target.files);\r\n\r\n // Clear the input's value so selecting the same file will trigger a change event\r\n fileInputRef.current!.value = '';\r\n }\r\n };\r\n\r\n // Convert the list of accepted file extensions to the format required by the file input tag\r\n const formattedExtensions = props.acceptedExtensions.map(entry => `.${entry}`).join(',');\r\n\r\n return (\r\n <>\r\n \r\n\r\n \r\n \r\n );\r\n};\r\n\r\nexport default UploadButton;","//==============================================================================\r\n// Drag and drop target for file uploads\r\n//\r\n// This is meant to work in conjunction with the upload-button component, but\r\n// the button isn't explicitly included here to allow for better control of\r\n// positioning and styling.\r\n//==============================================================================\r\n/* eslint-disable react/jsx-no-bind */\r\n\r\nimport * as React from 'react';\r\nimport { observer } from 'mobx-react';\r\nimport { observable } from 'mobx';\r\nimport classnames from 'classnames';\r\n\r\n//==============================================================================\r\n//==============================================================================\r\nexport interface UploadBoxProps {\r\n className: string;\r\n initiateUpload: (files: FileList) => Promise; // This is defined externally, but we want to limit external dependencies\r\n}\r\n\r\n//==============================================================================\r\n// Function Component\r\n//==============================================================================\r\n@observer\r\nclass UploadBox extends React.Component {\r\n\r\n @observable private isDropping: Boolean = false;\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n constructor(props: UploadBoxProps) {\r\n super(props);\r\n\r\n this.dragEnter = this.dragEnter.bind(this);\r\n this.dragLeave = this.dragLeave.bind(this);\r\n this.drop = this.drop.bind(this);\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n public render() {\r\n return (\r\n \r\n {this.props.children}\r\n \r\n );\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private dragEnter(e: React.DragEvent) {\r\n e.preventDefault();\r\n this.isDropping = true;\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private dragLeave(e: React.DragEvent) {\r\n e.preventDefault();\r\n this.isDropping = false;\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private drop(e: React.DragEvent) {\r\n this.dragLeave(e); // Includes preventDefault\r\n const filesToUpload = e.dataTransfer.files;\r\n\r\n if (e.dataTransfer.types.includes('Files') && filesToUpload.length) {\r\n void this.props.initiateUpload(filesToUpload);\r\n }\r\n }\r\n\r\n}\r\n\r\nexport default UploadBox;\r\n","//==============================================================================\r\n// Displays a progress bar that is filled according to an externally supplied object\r\n// It uses a
and adjusts the width rather than using a element\r\n//\r\n// This is a bit hacky in that it uses an observable object rather than a value\r\n// It would be difficult for an external observer to modify a value, but a\r\n// field in an object is fine.\r\n// The field is arbitrarily hard-coded to \"progress\". It would be better to\r\n// accept the field name as a property.\r\n//==============================================================================\r\nimport * as React from 'react';\r\nimport { observer } from 'mobx-react';\r\nimport { observable } from 'mobx';\r\n\r\n//==============================================================================\r\n//==============================================================================\r\ninterface hasProgress {\r\n progress: number;\r\n}\r\n\r\nexport interface ProgressBarProps {\r\n className: string;\r\n status: hasProgress;\r\n}\r\n\r\n//==============================================================================\r\n// Function Component\r\n//==============================================================================\r\n@observer\r\nclass ProgressBar extends React.Component {\r\n\r\n @observable private progress: hasProgress;\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n constructor(props: ProgressBarProps) {\r\n super(props);\r\n\r\n this.progress = props.status;\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n public render() {\r\n const percentComplete = `${Math.floor(this.progress.progress * 100)}%`;\r\n\r\n return (\r\n
\r\n
\r\n  \r\n
\r\n
\r\n );\r\n }\r\n\r\n}\r\n\r\nexport default ProgressBar;\r\n","//==============================================================================\r\n//==============================================================================\r\nimport * as React from 'react';\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\nimport { IUploadManagerViewProps, UploadableFile, UploadableFiles, UploadHandler, UploadProgress, RemoveFileHandler, formatFileSize, UploadError } from './upload-manager';\r\nimport { IHeadingData, IUploadManagerResources } from './upload-manager.props.autogenerated';\r\n\r\nimport UploadButton from './components/upload-button';\r\nimport UploadBox from './components/upload-box';\r\nimport ProgressBar from './components/progress-bar';\r\n\r\n//==============================================================================\r\n//==============================================================================\r\nconst BASE_CLASS = 'upload-manager';\r\nconst cls = (fragment: string) => `${BASE_CLASS}__${fragment}`;\r\n\r\n//==============================================================================\r\n//==============================================================================\r\n\r\n//==========================================================\r\n// Construct the header node\r\n//==========================================================\r\nfunction renderHeader(heading: IHeadingData): React.ReactNode {\r\n\r\n return heading.text && (\r\n \r\n );\r\n}\r\n\r\n//==========================================================\r\n// Construct the instructions node (left-most of 3 columns on desktop)\r\n//==========================================================\r\nfunction renderInstructions(instructions: Msdyn365.RichText): React.ReactNode {\r\n\r\n return (\r\n \r\n );\r\n}\r\n\r\n//==========================================================\r\n// Construct the upload target node (middle column on desktop)\r\n//==========================================================\r\nfunction renderUploadTarget(resources: IUploadManagerResources, acceptedFormats: string[], initiateUpload: UploadHandler): React.ReactNode {\r\n\r\n const formatString = acceptedFormats.length ? acceptedFormats.join(', ') : '';\r\n\r\n return (\r\n
\r\n\r\n \r\n
\r\n
{resources.dragAndDrop}
\r\n
{resources.or}
\r\n \r\n
\r\n\r\n {formatString &&\r\n
\r\n {resources.acceptedFormats}: {formatString}\r\n
\r\n }\r\n\r\n
\r\n );\r\n}\r\n\r\n//==========================================================\r\n// Construct the uploaded files node (right column on desktop)\r\n//==========================================================\r\nfunction renderUploadedFiles(resources: IUploadManagerResources, fileList: UploadableFiles, progress: UploadProgress[], removeFile: RemoveFileHandler): React.ReactNode {\r\n\r\n return (\r\n
\r\n\r\n
\r\n {resources.uploadedDocuments}\r\n
\r\n\r\n {!!(fileList?.length) &&\r\n
\r\n {fileList.map(file => renderFile(file, removeFile))}\r\n
\r\n }\r\n\r\n {!fileList?.length &&\r\n
\r\n {resources.noUploads}\r\n
\r\n }\r\n\r\n {!!progress.length &&\r\n
\r\n {progress.map(file => renderProgress(file))}\r\n
\r\n }\r\n\r\n
\r\n );\r\n}\r\n\r\n//==========================================================\r\n// Construct a node for a single uploaded file\r\n//==========================================================\r\nfunction renderFile(file: UploadableFile, removeFile: RemoveFileHandler) {\r\n return (\r\n
\r\n
{file.name}
\r\n
removeFile(file)}>
\r\n
{formatFileSize(file.size)}
\r\n
\r\n );\r\n}\r\n\r\n//==========================================================\r\n// Construct a node for a single uploaded file\r\n//==========================================================\r\nfunction renderProgress(file: UploadProgress) {\r\n return (\r\n
\r\n
{file.name}
\r\n \r\n
\r\n );\r\n}\r\n\r\n//==========================================================\r\n// Displays any errors generated by the upload module\r\n//==========================================================\r\nfunction renderErrors(resources: IUploadManagerResources, errors: UploadError[]) {\r\n return (\r\n
\r\n\r\n {errors.map((error, idx) => (\r\n <>\r\n {error.filename &&\r\n
\r\n {error.filename}: {error.message}\r\n
\r\n }\r\n\r\n {!error.filename &&\r\n
\r\n {error.message}\r\n
\r\n }\r\n \r\n ))}\r\n\r\n
\r\n );\r\n}\r\n\r\n//==========================================================\r\n// The main render function\r\n//==========================================================\r\nexport default (props: IUploadManagerViewProps) => {\r\n return (\r\n
\r\n {props.config.heading && renderHeader(props.config.heading)}\r\n
\r\n {props.config.instructions && renderInstructions(props.config.instructions)}\r\n {renderUploadTarget(props.resources, props.config.acceptedFormats || [], props.initiateUpload)}\r\n {renderUploadedFiles(props.resources, props.fileList, props.progress, props.removeFile)}\r\n {!!(props.errors?.length) && renderErrors(props.resources, props.errors)}\r\n
\r\n
\r\n );\r\n};\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['upload-manager'] = {\n c: () => require('partner/modules/upload-manager/upload-manager.tsx'),\n $type: 'contentModule',\n da: [],\n \n iNM: false,\n ns: '__local__',\n n: 'upload-manager',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/upload-manager'\n });\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|modules|upload-manager|upload-manager'] = {\n c: () => require('partner/modules/upload-manager/upload-manager.view.tsx'),\n cn: '__local__-__local__-upload-manager'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\nvar PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');\n\n// `Promise.allSettled` method\n// https://tc39.es/ecma262/#sec-promise.allsettled\n$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {\n allSettled: function allSettled(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var promiseResolve = aCallable(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n remaining++;\n call(promiseResolve, C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = { status: 'fulfilled', value: value };\n --remaining || resolve(values);\n }, function (error) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = { status: 'rejected', reason: error };\n --remaining || resolve(values);\n });\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.promise.all-settled.js');\n"],"names":["UploadManager","React","constructor","props","super","fileList","errors","progress","this","initiateUpload","bind","removeFile","render","length","viewProps","_objectSpread","renderView","addError","error","filename","push","message","files","validFiles","validateRequestedUploads","secureURLs","requestSecureUploadURLs","uploadFiles","changeHandler","validExtensions","config","acceptedFormats","map","entry","toLowerCase","simplifiedList","i","name","size","file","filter","extension","split","pop","includes","resources","invalidFileExtension","unknownFileType","requestPayload","Id","UploadFiles","Name","Size","Math","ceil","result","generateUrisAsync","callerContext","context","actionContext","mappedResults","mapResults","FilesWithSas","ErrorFiles","forEach","ValidationErrors","errorCodeToString","err","unknownError","code","ERR_INVALID_EXTENSION","ERR_FILE_SIZE_ZERO","uploadFileTooSmall","ERR_FILE_SIZE_EXCEEDS_MAX_LIMIT","uploadFileTooBig","replace","formatFileSize","maxFileSize","urlList","output","match","find","SasUri","console","url","filesToUpload","promises","doUpload","Promise","allSettled","index","clearProgressEntry","status","uploadFailed","identifier","resolve","reject","fd","FormData","set","type","xhr","XMLHttpRequest","progressRecord","createProgressEntry","upload","addEventListener","ev","lengthComputable","loaded","total","resp","open","setRequestHeader","send","warn","filtered","indexOf","splice","units","unit","floor","round","__decorate","observable","observer","fileInputRef","formattedExtensions","acceptedExtensions","join","className","onClick","event","_fileInputRef$current","current","click","buttonText","multiple","accept","ref","onChange","_event$target$files","target","value","style","display","UploadBox","isDropping","dragEnter","dragLeave","drop","classnames","onDragOver","onDragEnter","onDragEnd","onDragLeave","onDrop","children","e","preventDefault","dataTransfer","types","ProgressBar","percentComplete","width","BASE_CLASS","cls","fragment","renderUploadedFiles","uploadedDocuments","key","renderFile","noUploads","renderProgress","_props$errors","instructions","heading","text","Msdyn365","tag","formatString","dragAndDrop","or","UploadButton","browseFiles","renderUploadTarget","idx","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","viewDictionary","cn","module","exports","ReactDOM","$","call","aCallable","newPromiseCapabilityModule","perform","iterate","stat","forced","iterable","C","capability","f","promiseResolve","values","counter","remaining","promise","alreadyCalled","then","reason"],"sourceRoot":""}