@cayuse-test/react 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -126,7 +126,7 @@ var UppyService = class {
126
126
  }
127
127
  destroy(id) {
128
128
  const instance = this.getInstance(id);
129
- instance?.close(() => this.instances.delete(id));
129
+ instance?.close?.(() => this.instances.delete(id));
130
130
  }
131
131
  onAnyEvent(id, eventCallback) {
132
132
  const inst = this.getInstance(id);
@@ -417,4 +417,4 @@ export {
417
417
  useFileUploader,
418
418
  useClickOutside
419
419
  };
420
- //# sourceMappingURL=chunk-BVB7EXJY.js.map
420
+ //# sourceMappingURL=chunk-XVA4YFXM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/hooks/use-file-uploader/uppy/constants.ts","../packages/hooks/use-file-uploader/uppy/api.ts","../packages/hooks/use-file-uploader/uppy/service.ts","../packages/hooks/use-file-uploader/use-file-uploader.tsx","../packages/hooks/use-click-outside/use-click-outside.tsx"],"sourcesContent":["export type UppyEvent =\n\t| 'file-added'\n\t| 'files-added'\n\t| 'file-removed'\n\t| 'upload'\n\t| 'progress'\n\t| 'preprocess-complete'\n\t| 'upload-progress'\n\t| 'upload-success'\n\t| 'complete'\n\t| 'error'\n\t| 'upload-error'\n\t| 'upload-retry'\n\t| 'retry-all'\n\t| 'info-visible'\n\t| 'info-hidden'\n\t| 'cancel-all'\n\t| 'restriction-failed'\n\t| 'reset-progress';\n\nexport const uppyEvents: UppyEvent[] = [\n\t'file-added',\n\t'files-added',\n\t'file-removed',\n\t'upload',\n\t'progress',\n\t'preprocess-complete',\n\t'upload-progress',\n\t'upload-success',\n\t'complete',\n\t'error',\n\t'upload-error',\n\t'upload-retry',\n\t'retry-all',\n\t'info-visible',\n\t'info-hidden',\n\t'cancel-all',\n\t'restriction-failed',\n\t'reset-progress',\n];\n\ninterface UppyState {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tplugins: { [key: string]: any };\n\terror: string;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tfiles: { [key: string]: any };\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tcurrentUploads: { [key: string]: any };\n\tallowNewUpload: boolean;\n\tcapabilities: {\n\t\tuploadProgress: boolean;\n\t\tindividualCancellation: boolean;\n\t\tresumableUploads: boolean;\n\t};\n\ttotalProgress: number;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tmeta: { [key: string]: any };\n\tinfo: Array<{ type: string; message: string; details: string }>;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\trecoveredState: null | { [key: string]: any };\n}\n\nexport const uppyInitialState: UppyState = {\n\tplugins: {},\n\terror: '',\n\tfiles: {},\n\tcurrentUploads: {},\n\tallowNewUpload: true,\n\tcapabilities: {\n\t\tuploadProgress: true,\n\t\tindividualCancellation: true,\n\t\tresumableUploads: false,\n\t},\n\ttotalProgress: 0,\n\tmeta: {},\n\tinfo: [],\n\trecoveredState: null,\n};\n\nexport const MAX_FILE_SIZE_75_MB: number = 75 * Math.pow(1024, 2);\n\ninterface DefaultDictionary {\n\texeFileTypeRestriction: string;\n\t[key: string]: string;\n}\n\nexport const defaultDictionary: DefaultDictionary = {\n\texeFileTypeRestriction:\n\t\t'Attachments with filetype .exe cannot be accepted. Please try a different file type.',\n};\n","import { executeRequest } from '@/utils/http';\n\ninterface UploadUrlResponse {\n\tpreSignedUrl: string;\n\tuploadMetadataId: string;\n}\n\ninterface CompleteUploadResponse {\n\tcompletedAt: string;\n\tcreatedAt: string;\n\tfileName: string;\n\tfileSize: number;\n\tfinalizedAt: unknown;\n\tid: string;\n\ttenantId: string;\n\tuploadedBy: string;\n}\n\ninterface PersonDetails {\n\tid: string;\n\ttenantId: string;\n\tfirstName: string;\n\tlastName: string;\n\tfullName: string;\n\tmiddleName: string;\n\tcontactEmail: string;\n\tuserAccountId: string;\n}\n\ninterface UploadUrlRequestBody {\n\tfileName: string;\n\tfileSize: number;\n}\n\ninterface RequestOptions {\n\tsignal?: AbortSignal;\n}\n\nexport const api = {\n\tgetUploadURL: (\n\t\tbody: UploadUrlRequestBody,\n\t\toptions?: RequestOptions,\n\t): Promise<UploadUrlResponse> => {\n\t\tconst requestOptions = {\n\t\t\tmethod: 'POST',\n\t\t\tbody: JSON.stringify(body),\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tsignal: options?.signal,\n\t\t};\n\n\t\treturn executeRequest('/api/v2/attachments/upload', requestOptions);\n\t},\n\n\tcompleteUpload: (id: string): Promise<CompleteUploadResponse> => {\n\t\tconst requestOptions = {\n\t\t\tmethod: 'POST',\n\t\t};\n\n\t\treturn executeRequest(\n\t\t\t`/api/v2/attachments/upload/${id}/complete`,\n\t\t\trequestOptions,\n\t\t);\n\t},\n\n\tgetDownloadUrl: (id: string): Promise<string> => {\n\t\treturn executeRequest(`/api/v2/attachments/download?uploadMetadataId=${id}`);\n\t},\n\n\tgetPersonDetailsById: (\n\t\tid: string,\n\t): Promise<PersonDetails | { errors: unknown[] }> => {\n\t\treturn executeRequest(`/api/v2/person/user/${id}`);\n\t},\n};\n","import { v4 as uuidv4 } from 'uuid';\nimport Uppy from '@uppy/core';\nimport AwsS3 from '@uppy/aws-s3';\nimport { merge } from 'lodash-es';\n\nimport { MAX_FILE_SIZE_75_MB, uppyEvents, UppyEvent } from './constants.js';\nimport { api } from './api.js';\n\ninterface UppyDefaultOptions {\n\tautoProceed?: boolean;\n\trestrictions?: {\n\t\tmaxFileSize?: number;\n\t\tmaxNumberOfFiles?: number;\n\t\tallowedFileTypes?: string[] | null;\n\t};\n}\n\ninterface UppyFile {\n\tid: string;\n\tname: string;\n\tsize: number;\n\ttype: string;\n\tmeta: {\n\t\tuploadMetadataId: string;\n\t\tuploadedBy: string;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t[key: string]: any;\n\t};\n}\n\ninterface UploadUrlResponse {\n\tpreSignedUrl: string;\n\tuploadMetadataId: string;\n}\n\ninterface CompleteUploadResponse {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[k: string]: any;\n\tcompletedAt: string;\n\tcreatedAt: string;\n\tfileName: string;\n\tfileSize: number;\n\tfinalizedAt: unknown;\n\tid: string;\n\ttenantId: string;\n\tuploadedBy: string;\n}\n\ninterface PersonDetails {\n\tfirstName: string;\n\tlastName: string;\n}\n\nexport class UppyService {\n\tprivate instances: Map<string, Uppy> = new Map();\n\tprivate retryCount: number = 0;\n\tprivate defaultOptions: UppyDefaultOptions = {\n\t\tautoProceed: true,\n\t\trestrictions: {\n\t\t\tmaxFileSize: MAX_FILE_SIZE_75_MB,\n\t\t\tmaxNumberOfFiles: 9,\n\t\t\tallowedFileTypes: null,\n\t\t},\n\t};\n\n\tgetInstance(id: string): Uppy | null {\n\t\treturn this.instances.get(id) || null;\n\t}\n\n\tregister(options: UppyDefaultOptions): Uppy {\n\t\tconst id: string = uuidv4();\n\n\t\tconst getUploadParameters =\n\t\t\t(instanceId: string) =>\n\t\t\tasync (\n\t\t\t\tfile: UppyFile,\n\t\t\t\t_options: { signal?: AbortSignal },\n\t\t\t): Promise<{\n\t\t\t\tmethod: string;\n\t\t\t\turl: string;\n\t\t\t\tfields: Record<string, never>;\n\t\t\t\theaders: { 'Content-Type': string };\n\t\t\t}> => {\n\t\t\t\tconst response: UploadUrlResponse = await api.getUploadURL(\n\t\t\t\t\t{\n\t\t\t\t\t\tfileName: file.name,\n\t\t\t\t\t\tfileSize: file.size,\n\t\t\t\t\t},\n\t\t\t\t\t_options,\n\t\t\t\t);\n\n\t\t\t\tconst instance = this.getInstance(instanceId);\n\t\t\t\tif (instance) {\n\t\t\t\t\t// @ts-expect-error type mismatch\n\t\t\t\t\tinstance.setFileMeta(file.id, response);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\turl: response.preSignedUrl,\n\t\t\t\t\tfields: {},\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': file.type,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t};\n\n\t\tconst instance: Uppy = new Uppy(this.#getOptions(id, options)).use(AwsS3, {\n\t\t\t// @ts-expect-error type mismatch\n\t\t\tgetUploadParameters: getUploadParameters(id),\n\t\t});\n\n\t\tObject.defineProperty(instance, 'id', { value: id, enumerable: true });\n\n\t\tthis.instances.set(id, instance);\n\n\t\tthis.#subscribeOnEvents(id);\n\n\t\treturn instance;\n\t}\n\n\tdestroy(id: string): void {\n\t\tconst instance = this.getInstance(id);\n\t\t// @ts-expect-error type mismatch\n\t\tinstance?.close?.(() => this.instances.delete(id));\n\t}\n\n\tonAnyEvent(\n\t\tid: string,\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\teventCallback: (eventName: UppyEvent, ...args: any[]) => void,\n\t): void {\n\t\tconst inst = this.getInstance(id);\n\t\tif (inst) {\n\t\t\tuppyEvents.forEach((event: UppyEvent) => {\n\t\t\t\tinst.on(\n\t\t\t\t\t// @ts-expect-error type mismatch\n\t\t\t\t\tevent,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t(...args: any[]) => {\n\t\t\t\t\t\teventCallback(event, ...args);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t}\n\n\t#subscribeOnEvents(instanceId: string): void {\n\t\tconst instance = this.getInstance(instanceId);\n\t\tif (instance) {\n\t\t\t// @ts-expect-error type miss match\n\t\t\tinstance.on('upload-success', async (file: UppyFile) => {\n\t\t\t\tawait this.#completeUploading(instanceId, file);\n\t\t\t});\n\t\t}\n\t}\n\n\t#getOptions(\n\t\tid: string,\n\t\toptions: UppyDefaultOptions,\n\t): UppyDefaultOptions & { id: string; debug: boolean } {\n\t\treturn {\n\t\t\t...merge(this.defaultOptions, options),\n\t\t\tid,\n\t\t\tdebug: true,\n\t\t};\n\t}\n\n\tasync #completeUploading(instanceId: string, file: UppyFile): Promise<void> {\n\t\tconst instance = this.getInstance(instanceId);\n\t\tif (!instance) return;\n\n\t\ttry {\n\t\t\tconst completedResponse: CompleteUploadResponse = await api.completeUpload(\n\t\t\t\tfile.meta.uploadMetadataId,\n\t\t\t);\n\t\t\tinstance.setFileMeta(file.id, completedResponse);\n\n\t\t\tinstance.emit('complete', completedResponse);\n\n\t\t\tthis.#getDownloadUrl(instanceId, file.id);\n\t\t\tthis.#loadAdditionalFileMetadata(instanceId, file.id);\n\t\t} catch (error) {\n\t\t\t// @ts-expect-error type miss match\n\t\t\tinstance.emit('upload-error', file, error);\n\t\t}\n\t}\n\n\tasync #getDownloadUrl(instanceId: string, fileId: string): Promise<void> {\n\t\tconst instance = this.getInstance(instanceId);\n\t\tif (!instance) return;\n\n\t\ttry {\n\t\t\tconst file = instance.getFile(fileId);\n\t\t\tif (!file) return;\n\n\t\t\tconst downloadUrl: string = await api.getDownloadUrl(\n\t\t\t\tfile.meta.uploadMetadataId as string,\n\t\t\t);\n\n\t\t\tif (typeof downloadUrl === 'string') {\n\t\t\t\tinstance.setFileMeta(fileId, { downloadUrl });\n\t\t\t} else {\n\t\t\t\tinstance.emit('error', downloadUrl);\n\t\t\t}\n\n\t\t\tinstance.emit('complete', { downloadUrl });\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\tinstance.emit('error', error);\n\t\t}\n\t}\n\n\tasync #loadAdditionalFileMetadata(\n\t\tinstanceId: string,\n\t\tfileId: string,\n\t): Promise<void> {\n\t\tconst instance = this.getInstance(instanceId);\n\t\tif (!instance) return;\n\n\t\ttry {\n\t\t\tconst file = instance.getFile(fileId);\n\t\t\tif (!file) return;\n\n\t\t\tconst response: PersonDetails | { errors: unknown[] } =\n\t\t\t\tawait api.getPersonDetailsById(file.meta.uploadedBy as string);\n\n\t\t\tif ('firstName' in response) {\n\t\t\t\tinstance.setFileMeta(fileId, {\n\t\t\t\t\tuploadedByInfo: {\n\t\t\t\t\t\tfirstName: response.firstName,\n\t\t\t\t\t\tlastName: response.lastName,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\tinstance.emit('error', response as any);\n\t\t\t}\n\n\t\t\tinstance.emit('complete', {});\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\tinstance.emit('error', error);\n\t\t}\n\t}\n}\n","import React from 'react';\nimport { merge } from 'lodash-es';\nimport { prettierBytes } from '@transloadit/prettier-bytes';\nimport { isFunction } from '../../utils';\n\nimport {\n\tUppyService,\n\tuppyInitialState,\n\tdefaultDictionary,\n\tMAX_FILE_SIZE_75_MB,\n} from './uppy';\n\n// Type definitions\nexport interface FileObject {\n\tuppyId: string;\n\tid: string;\n\tname: string;\n\tsize: number;\n\tdownloadUrl: string;\n\tuploadedBy: string;\n\tcreatedAt: string;\n\tfinalizedAt: string;\n\tcompletedAt: string;\n\ttenantId: string;\n\ttype: string;\n\tprogress: {\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t[key: string]: any;\n\t};\n\tuploadMetadataId: string;\n\terror: string;\n}\n\nexport interface UppyInstance {\n\tid: string;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\temit: (eventName: string, ...args: any[]) => void;\n\taddFiles: (\n\t\tfiles: Array<{\n\t\t\tsource: string;\n\t\t\tname: string;\n\t\t\ttype: string;\n\t\t\tdata: File;\n\t\t}>,\n\t) => void;\n\tremoveFile: (fileId: string, reason?: string, event?: Event) => void;\n\tgetState: () => UppyState;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tlog: (message: any, ...args: any[]) => void;\n}\n\nexport interface UppyDefaultOptions {\n\tautoProceed?: boolean;\n\trestrictions?: {\n\t\tmaxFileSize?: number;\n\t\tmaxNumberOfFiles?: number;\n\t\tallowedFileTypes?: string[] | null;\n\t};\n}\n\nexport interface UseFileUploaderOptions {\n\tdictionary?: {\n\t\tfileUploaderHook?: {\n\t\t\t[key: string]: string;\n\t\t};\n\t};\n\toptions?: UppyDefaultOptions;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tonErrorCallback?: (error: any) => void;\n}\n\nexport interface UppyState {\n\tfiles: {\n\t\t[key: string]: {\n\t\t\tid: string;\n\t\t\tname: string;\n\t\t\tsize: number;\n\t\t\tmeta: {\n\t\t\t\tid: string;\n\t\t\t\tdownloadUrl: string;\n\t\t\t\tuploadedBy: string;\n\t\t\t\tcreatedAt: string;\n\t\t\t\tfinalizedAt: string;\n\t\t\t\tcompletedAt: string;\n\t\t\t\ttenantId: string;\n\t\t\t\ttype: string;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\tuploadedByInfo: any;\n\t\t\t\tuploadMetadataId: string;\n\t\t\t};\n\t\t\tprogress: {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t[key: string]: any;\n\t\t\t};\n\t\t\terror: string;\n\t\t};\n\t};\n\tinfo: Array<{ type: string; message: string; details: string }>;\n\terror: string;\n}\n\nconst uppyService = new UppyService();\n\nconst notify =\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(global as any).__CAYUSE__?.notify ??\n\t(() => {\n\t\tconsole.error(\n\t\t\t'function is not defined. check is banner-notification package install',\n\t\t);\n\t});\n\nconst defaultUseFileUploaderOptions: UseFileUploaderOptions = {\n\tdictionary: {},\n\toptions: {\n\t\trestrictions: {\n\t\t\tmaxFileSize: MAX_FILE_SIZE_75_MB,\n\t\t},\n\t},\n};\n\nexport const useFileUploader = (\n\thookProps: UseFileUploaderOptions = defaultUseFileUploaderOptions,\n) => {\n\tconst props = merge({}, hookProps, defaultUseFileUploaderOptions);\n\tconst uppyInstance = React.useRef<UppyInstance>({} as UppyInstance);\n\tconst [state, setState] = React.useState<UppyState>(uppyInitialState);\n\n\tconst dictionary = React.useMemo(\n\t\t() => merge({}, defaultDictionary, props.dictionary?.fileUploaderHook),\n\t\t[props.dictionary?.fileUploaderHook],\n\t);\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tconst onError = (error: any) => {\n\t\tif (isFunction(hookProps.onErrorCallback)) {\n\t\t\thookProps.onErrorCallback(error);\n\t\t}\n\t};\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tconst handleEvent = (eventName: string, ...args: any[]) => {\n\t\tswitch (eventName) {\n\t\t\tcase 'error': {\n\t\t\t\tconst [error] = args;\n\t\t\t\tif (error.details !== 'File removed') {\n\t\t\t\t\tnotify(error.message, { type: 'error' });\n\t\t\t\t\tonError(error);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'restriction-failed': {\n\t\t\t\tconst [, error] = args;\n\t\t\t\tnotify(error.message, { type: 'error' });\n\t\t\t\tonError(error);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tReact.useEffect(() => {\n\t\tconst uppyOptions = {\n\t\t\t...(props.options ?? {}),\n\t\t\tlocale: {\n\t\t\t\tstrings: dictionary,\n\t\t\t},\n\t\t};\n\n\t\t// @ts-expect-error correct type for UppyService\n\t\tuppyInstance.current = uppyService.register(uppyOptions);\n\n\t\tuppyService.onAnyEvent(\n\t\t\tuppyInstance.current.id,\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(eventName: string, ...args: any[]) => {\n\t\t\t\tconst newState = uppyInstance.current.getState();\n\t\t\t\tsetState(newState);\n\t\t\t\tuppyInstance.current.log(`The state was updated by an event: ${eventName}`);\n\t\t\t\tuppyInstance.current.log(newState);\n\n\t\t\t\thandleEvent(eventName, ...args);\n\t\t\t},\n\t\t);\n\n\t\treturn () => {\n\t\t\tuppyService.destroy(uppyInstance.current.id);\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\tconst addFiles = (\n\t\tfiles: File[],\n\t\tonSuccessCallback?: (acceptedFiles: File[]) => void,\n\t\tonRejectCallback?: (\n\t\t\tinvalidExtensionFiles: File[],\n\t\t\texceedSizeFiles: File[],\n\t\t) => void,\n\t) => {\n\t\tconst exceedSizeDescriptors: Array<{\n\t\t\tsource: string;\n\t\t\tname: string;\n\t\t\ttype: string;\n\t\t\tdata: File;\n\t\t}> = [];\n\t\tconst descriptors: Array<{\n\t\t\tsource: string;\n\t\t\tname: string;\n\t\t\ttype: string;\n\t\t\tdata: File;\n\t\t}> = [];\n\t\tconst invalidExtensionFiles: File[] = [];\n\t\tconst exceedSizeFiles: File[] = [];\n\n\t\tconst { maxFileSize = MAX_FILE_SIZE_75_MB } = props?.options?.restrictions ?? {};\n\n\t\tfor (const file of files) {\n\t\t\tconst ext = file.name.split('.').reverse()?.[0]?.toLowerCase();\n\t\t\tconst descriptor = {\n\t\t\t\tsource: uppyInstance.current.id,\n\t\t\t\tname: file.name,\n\t\t\t\ttype: file.type,\n\t\t\t\tdata: file,\n\t\t\t};\n\n\t\t\tif (ext === 'exe') {\n\t\t\t\tinvalidExtensionFiles.push(file);\n\t\t\t\tuppyInstance.current.emit(\n\t\t\t\t\t'restriction-failed',\n\t\t\t\t\tdescriptor,\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t'Attachments with filetype .exe cannot be accepted. Please try a different file type.',\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else if (maxFileSize && file.size != null && file.size > maxFileSize) {\n\t\t\t\texceedSizeFiles.push(file);\n\t\t\t\texceedSizeDescriptors.push(descriptor);\n\t\t\t} else {\n\t\t\t\tdescriptors.push(descriptor);\n\t\t\t}\n\t\t}\n\n\t\tif (isFunction(onRejectCallback)) {\n\t\t\tonRejectCallback(invalidExtensionFiles, exceedSizeFiles);\n\t\t}\n\n\t\tif (files.length === 1 && exceedSizeDescriptors.length === 1) {\n\t\t\tuppyInstance.current.emit(\n\t\t\t\t'restriction-failed',\n\t\t\t\texceedSizeDescriptors[0],\n\t\t\t\tnew Error(\n\t\t\t\t\t`The uploaded file exceeds the ${prettierBytes(maxFileSize)} limit.`,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (files.length > 1 && exceedSizeDescriptors.length >= 1) {\n\t\t\tuppyInstance.current.emit(\n\t\t\t\t'restriction-failed',\n\t\t\t\texceedSizeDescriptors,\n\t\t\t\tnew Error(\n\t\t\t\t\t`${exceedSizeFiles.length} of the ${\n\t\t\t\t\t\tfiles.length\n\t\t\t\t\t} uploaded files exceed the ${prettierBytes(maxFileSize)} limit.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tif (descriptors.length > 0) {\n\t\t\t\tuppyInstance.current.addFiles(descriptors);\n\t\t\t}\n\n\t\t\tif (isFunction(onSuccessCallback)) {\n\t\t\t\tconst acceptedFiles = files.filter((f) =>\n\t\t\t\t\tdescriptors.find((d) => d.name === f.name),\n\t\t\t\t);\n\t\t\t\tonSuccessCallback(acceptedFiles);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tuppyInstance.current.log(err);\n\t\t\tonError(err);\n\t\t}\n\t};\n\n\tconst removeFile = (file: FileObject, reason: string, event?: Event) => {\n\t\tif (file.uppyId) {\n\t\t\tuppyInstance.current.removeFile(file.uppyId, reason, event);\n\t\t}\n\t};\n\n\tconst files = React.useMemo(() => {\n\t\treturn Object.entries(state.files).map(([, file]) => ({\n\t\t\tuppyId: file.id,\n\t\t\tid: file.meta.id,\n\t\t\tname: file.name,\n\t\t\tsize: Number(file.size),\n\t\t\tdownloadUrl: file.meta.downloadUrl,\n\t\t\tuploadedBy: file.meta.uploadedBy,\n\t\t\tcreatedAt: file.meta.createdAt,\n\t\t\tfinalizedAt: file.meta.finalizedAt,\n\t\t\tcompletedAt: file.meta.completedAt,\n\t\t\ttenantId: file.meta.tenantId,\n\t\t\ttype: file.meta.type,\n\t\t\tuploadedByInfo: file.meta.uploadedByInfo,\n\t\t\tprogress: file.progress,\n\t\t\tuploadMetadataId: file.meta.uploadMetadataId,\n\t\t\terror: file.error,\n\t\t}));\n\t}, [state.files]);\n\n\treturn {\n\t\tinfo: state.info,\n\t\terror: state.error,\n\t\tfiles,\n\t\taddFiles,\n\t\tremoveFile,\n\t};\n};\n","import { useEffect, RefObject } from 'react';\n\nexport const useClickOutside = <T extends HTMLElement>(\n\telementRef: RefObject<T>,\n\tcallback: () => void,\n): void => {\n\tuseEffect(() => {\n\t\tconst handleClickOutside = (event: MouseEvent): void => {\n\t\t\tif (\n\t\t\t\telementRef &&\n\t\t\t\telementRef.current &&\n\t\t\t\t!elementRef.current.contains(event.target as Node)\n\t\t\t) {\n\t\t\t\tcallback();\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener('click', handleClickOutside, true);\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('click', handleClickOutside, true);\n\t\t};\n\t}, [elementRef, callback]);\n};\n"],"mappings":";;;;;;AAoBO,IAAM,aAA0B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAwBO,IAAM,mBAA8B;AAAA,EAC1C,SAAS,CAAC;AAAA,EACV,OAAO;AAAA,EACP,OAAO,CAAC;AAAA,EACR,gBAAgB,CAAC;AAAA,EACjB,gBAAgB;AAAA,EAChB,cAAc;AAAA,IACb,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,IACxB,kBAAkB;AAAA,EACnB;AAAA,EACA,eAAe;AAAA,EACf,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,gBAAgB;AACjB;AAEO,IAAM,sBAA8B,KAAK,KAAK,IAAI,MAAM,CAAC;AAOzD,IAAM,oBAAuC;AAAA,EACnD,wBACC;AACF;;;ACpDO,IAAM,MAAM;AAAA,EA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row {
1647
1647
  position: relative;
1648
1648
  padding: 5px;
1649
+ margin: -8px;
1649
1650
  height: 30px;
1650
1651
  width: 30px;
1651
1652
  -webkit-appearance: none;