@cayuse-test/react 1.0.2 → 1.0.4
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.
- package/dist/{chunk-TYZPOXN5.js → chunk-BVB7EXJY.js} +180 -3
- package/dist/chunk-BVB7EXJY.js.map +1 -0
- package/dist/{chunk-QCQVYXFA.js → chunk-HRVK43NB.js} +3 -5
- package/dist/{chunk-QCQVYXFA.js.map → chunk-HRVK43NB.js.map} +1 -1
- package/dist/{chunk-RYAW4XZF.js → chunk-JPEBFDVI.js} +6 -8
- package/dist/{chunk-RYAW4XZF.js.map → chunk-JPEBFDVI.js.map} +1 -1
- package/dist/{chunk-KJUT65VD.js → chunk-LDCYFDOO.js} +192 -5
- package/dist/chunk-LDCYFDOO.js.map +1 -0
- package/dist/{chunk-LFWPG3ND.js → chunk-OYNDGU67.js} +2 -2
- package/dist/{chunk-WAQWICRJ.js → chunk-QPEQWFAR.js} +2 -2
- package/dist/components/index.js +5 -6
- package/dist/context/tenant/index.js +2 -3
- package/dist/hooks/index.d.ts +114 -5
- package/dist/hooks/index.js +8 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -13
- package/dist/utils/index.js +6 -8
- package/package.json +3 -28
- package/dist/chunk-KJUT65VD.js.map +0 -1
- package/dist/chunk-SZMEZFAR.js +0 -193
- package/dist/chunk-SZMEZFAR.js.map +0 -1
- package/dist/chunk-TYZPOXN5.js.map +0 -1
- /package/dist/{chunk-LFWPG3ND.js.map → chunk-OYNDGU67.js.map} +0 -0
- /package/dist/{chunk-WAQWICRJ.js.map → chunk-QPEQWFAR.js.map} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
executeRequest
|
|
3
|
-
|
|
2
|
+
executeRequest,
|
|
3
|
+
isFunction
|
|
4
|
+
} from "./chunk-LDCYFDOO.js";
|
|
4
5
|
|
|
5
6
|
// packages/hooks/use-file-uploader/uppy/constants.ts
|
|
6
7
|
var uppyEvents = [
|
|
@@ -215,6 +216,181 @@ var UppyService = class {
|
|
|
215
216
|
}
|
|
216
217
|
};
|
|
217
218
|
|
|
219
|
+
// packages/hooks/use-file-uploader/use-file-uploader.tsx
|
|
220
|
+
import React from "react";
|
|
221
|
+
import { merge as merge2 } from "lodash-es";
|
|
222
|
+
import { prettierBytes } from "@transloadit/prettier-bytes";
|
|
223
|
+
var uppyService = new UppyService();
|
|
224
|
+
var notify = (
|
|
225
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
226
|
+
global.__CAYUSE__?.notify ?? (() => {
|
|
227
|
+
console.error(
|
|
228
|
+
"function is not defined. check is banner-notification package install"
|
|
229
|
+
);
|
|
230
|
+
})
|
|
231
|
+
);
|
|
232
|
+
var defaultUseFileUploaderOptions = {
|
|
233
|
+
dictionary: {},
|
|
234
|
+
options: {
|
|
235
|
+
restrictions: {
|
|
236
|
+
maxFileSize: MAX_FILE_SIZE_75_MB
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
var useFileUploader = (hookProps = defaultUseFileUploaderOptions) => {
|
|
241
|
+
const props = merge2({}, hookProps, defaultUseFileUploaderOptions);
|
|
242
|
+
const uppyInstance = React.useRef({});
|
|
243
|
+
const [state, setState] = React.useState(uppyInitialState);
|
|
244
|
+
const dictionary = React.useMemo(
|
|
245
|
+
() => merge2({}, defaultDictionary, props.dictionary?.fileUploaderHook),
|
|
246
|
+
[props.dictionary?.fileUploaderHook]
|
|
247
|
+
);
|
|
248
|
+
const onError = (error) => {
|
|
249
|
+
if (isFunction(hookProps.onErrorCallback)) {
|
|
250
|
+
hookProps.onErrorCallback(error);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
const handleEvent = (eventName, ...args) => {
|
|
254
|
+
switch (eventName) {
|
|
255
|
+
case "error": {
|
|
256
|
+
const [error] = args;
|
|
257
|
+
if (error.details !== "File removed") {
|
|
258
|
+
notify(error.message, { type: "error" });
|
|
259
|
+
onError(error);
|
|
260
|
+
}
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case "restriction-failed": {
|
|
264
|
+
const [, error] = args;
|
|
265
|
+
notify(error.message, { type: "error" });
|
|
266
|
+
onError(error);
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
default:
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
React.useEffect(() => {
|
|
274
|
+
const uppyOptions = {
|
|
275
|
+
...props.options ?? {},
|
|
276
|
+
locale: {
|
|
277
|
+
strings: dictionary
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
uppyInstance.current = uppyService.register(uppyOptions);
|
|
281
|
+
uppyService.onAnyEvent(
|
|
282
|
+
uppyInstance.current.id,
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
284
|
+
(eventName, ...args) => {
|
|
285
|
+
const newState = uppyInstance.current.getState();
|
|
286
|
+
setState(newState);
|
|
287
|
+
uppyInstance.current.log(`The state was updated by an event: ${eventName}`);
|
|
288
|
+
uppyInstance.current.log(newState);
|
|
289
|
+
handleEvent(eventName, ...args);
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
return () => {
|
|
293
|
+
uppyService.destroy(uppyInstance.current.id);
|
|
294
|
+
};
|
|
295
|
+
}, []);
|
|
296
|
+
const addFiles = (files2, onSuccessCallback, onRejectCallback) => {
|
|
297
|
+
const exceedSizeDescriptors = [];
|
|
298
|
+
const descriptors = [];
|
|
299
|
+
const invalidExtensionFiles = [];
|
|
300
|
+
const exceedSizeFiles = [];
|
|
301
|
+
const { maxFileSize = MAX_FILE_SIZE_75_MB } = props?.options?.restrictions ?? {};
|
|
302
|
+
for (const file of files2) {
|
|
303
|
+
const ext = file.name.split(".").reverse()?.[0]?.toLowerCase();
|
|
304
|
+
const descriptor = {
|
|
305
|
+
source: uppyInstance.current.id,
|
|
306
|
+
name: file.name,
|
|
307
|
+
type: file.type,
|
|
308
|
+
data: file
|
|
309
|
+
};
|
|
310
|
+
if (ext === "exe") {
|
|
311
|
+
invalidExtensionFiles.push(file);
|
|
312
|
+
uppyInstance.current.emit(
|
|
313
|
+
"restriction-failed",
|
|
314
|
+
descriptor,
|
|
315
|
+
new Error(
|
|
316
|
+
"Attachments with filetype .exe cannot be accepted. Please try a different file type."
|
|
317
|
+
)
|
|
318
|
+
);
|
|
319
|
+
} else if (maxFileSize && file.size != null && file.size > maxFileSize) {
|
|
320
|
+
exceedSizeFiles.push(file);
|
|
321
|
+
exceedSizeDescriptors.push(descriptor);
|
|
322
|
+
} else {
|
|
323
|
+
descriptors.push(descriptor);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (isFunction(onRejectCallback)) {
|
|
327
|
+
onRejectCallback(invalidExtensionFiles, exceedSizeFiles);
|
|
328
|
+
}
|
|
329
|
+
if (files2.length === 1 && exceedSizeDescriptors.length === 1) {
|
|
330
|
+
uppyInstance.current.emit(
|
|
331
|
+
"restriction-failed",
|
|
332
|
+
exceedSizeDescriptors[0],
|
|
333
|
+
new Error(
|
|
334
|
+
`The uploaded file exceeds the ${prettierBytes(maxFileSize)} limit.`
|
|
335
|
+
)
|
|
336
|
+
);
|
|
337
|
+
} else if (files2.length > 1 && exceedSizeDescriptors.length >= 1) {
|
|
338
|
+
uppyInstance.current.emit(
|
|
339
|
+
"restriction-failed",
|
|
340
|
+
exceedSizeDescriptors,
|
|
341
|
+
new Error(
|
|
342
|
+
`${exceedSizeFiles.length} of the ${files2.length} uploaded files exceed the ${prettierBytes(maxFileSize)} limit.`
|
|
343
|
+
)
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
try {
|
|
347
|
+
if (descriptors.length > 0) {
|
|
348
|
+
uppyInstance.current.addFiles(descriptors);
|
|
349
|
+
}
|
|
350
|
+
if (isFunction(onSuccessCallback)) {
|
|
351
|
+
const acceptedFiles = files2.filter(
|
|
352
|
+
(f) => descriptors.find((d) => d.name === f.name)
|
|
353
|
+
);
|
|
354
|
+
onSuccessCallback(acceptedFiles);
|
|
355
|
+
}
|
|
356
|
+
} catch (err) {
|
|
357
|
+
uppyInstance.current.log(err);
|
|
358
|
+
onError(err);
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
const removeFile = (file, reason, event) => {
|
|
362
|
+
if (file.uppyId) {
|
|
363
|
+
uppyInstance.current.removeFile(file.uppyId, reason, event);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
const files = React.useMemo(() => {
|
|
367
|
+
return Object.entries(state.files).map(([, file]) => ({
|
|
368
|
+
uppyId: file.id,
|
|
369
|
+
id: file.meta.id,
|
|
370
|
+
name: file.name,
|
|
371
|
+
size: Number(file.size),
|
|
372
|
+
downloadUrl: file.meta.downloadUrl,
|
|
373
|
+
uploadedBy: file.meta.uploadedBy,
|
|
374
|
+
createdAt: file.meta.createdAt,
|
|
375
|
+
finalizedAt: file.meta.finalizedAt,
|
|
376
|
+
completedAt: file.meta.completedAt,
|
|
377
|
+
tenantId: file.meta.tenantId,
|
|
378
|
+
type: file.meta.type,
|
|
379
|
+
uploadedByInfo: file.meta.uploadedByInfo,
|
|
380
|
+
progress: file.progress,
|
|
381
|
+
uploadMetadataId: file.meta.uploadMetadataId,
|
|
382
|
+
error: file.error
|
|
383
|
+
}));
|
|
384
|
+
}, [state.files]);
|
|
385
|
+
return {
|
|
386
|
+
info: state.info,
|
|
387
|
+
error: state.error,
|
|
388
|
+
files,
|
|
389
|
+
addFiles,
|
|
390
|
+
removeFile
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
|
|
218
394
|
// packages/hooks/use-click-outside/use-click-outside.tsx
|
|
219
395
|
import { useEffect } from "react";
|
|
220
396
|
var useClickOutside = (elementRef, callback) => {
|
|
@@ -238,6 +414,7 @@ export {
|
|
|
238
414
|
defaultDictionary,
|
|
239
415
|
api,
|
|
240
416
|
UppyService,
|
|
417
|
+
useFileUploader,
|
|
241
418
|
useClickOutside
|
|
242
419
|
};
|
|
243
|
-
//# sourceMappingURL=chunk-
|
|
420
|
+
//# sourceMappingURL=chunk-BVB7EXJY.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,EAClB,cAAc,CACb,MACA,YACgC;AAChC,UAAM,iBAAiB;AAAA,MACtB,QAAQ;AAAA,MACR,MAAM,KAAK,UAAU,IAAI;AAAA,MACzB,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,QAAQ,SAAS;AAAA,IAClB;AAEA,WAAO,eAAe,8BAA8B,cAAc;AAAA,EACnE;AAAA,EAEA,gBAAgB,CAAC,OAAgD;AAChE,UAAM,iBAAiB;AAAA,MACtB,QAAQ;AAAA,IACT;AAEA,WAAO;AAAA,MACN,8BAA8B,EAAE;AAAA,MAChC;AA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WAAW,KAAK,KAAK;AAAA,MACrB,aAAa,KAAK,KAAK;AAAA,MACvB,aAAa,KAAK,KAAK;AAAA,MACvB,UAAU,KAAK,KAAK;AAAA,MACpB,MAAM,KAAK,KAAK;AAAA,MAChB,gBAAgB,KAAK,KAAK;AAAA,MAC1B,UAAU,KAAK;AAAA,MACf,kBAAkB,KAAK,KAAK;AAAA,MAC5B,OAAO,KAAK;AAAA,IACb,EAAE;AAAA,EACH,GAAG,CAAC,MAAM,KAAK,CAAC;AAEhB,SAAO;AAAA,IACN,MAAM,MAAM;AAAA,IACZ,OAAO,MAAM;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;;;AC7TA,SAAS,iBAA4B;AAE9B,IAAM,kBAAkB,CAC9B,YACA,aACU;AACV,YAAU,MAAM;AACf,UAAM,qBAAqB,CAAC,UAA4B;AACvD,UACC,cACA,WAAW,WACX,CAAC,WAAW,QAAQ,SAAS,MAAM,MAAc,GAChD;AACD,iBAAS;AAAA,MACV;AAAA,IACD;AAEA,aAAS,iBAAiB,SAAS,oBAAoB,IAAI;AAE3D,WAAO,MAAM;AACZ,eAAS,oBAAoB,SAAS,oBAAoB,IAAI;AAAA,IAC/D;AAAA,EACD,GAAG,CAAC,YAAY,QAAQ,CAAC;AAC1B;","names":["instance","merge","merge","files"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
executeRequest,
|
|
2
3
|
useAuth
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
executeRequest
|
|
6
|
-
} from "./chunk-SZMEZFAR.js";
|
|
4
|
+
} from "./chunk-LDCYFDOO.js";
|
|
7
5
|
|
|
8
6
|
// packages/context/tenant/tenant-context-provider.tsx
|
|
9
7
|
import React2, { useEffect } from "react";
|
|
@@ -105,4 +103,4 @@ export {
|
|
|
105
103
|
useTenantContext,
|
|
106
104
|
TenantProvider
|
|
107
105
|
};
|
|
108
|
-
//# sourceMappingURL=chunk-
|
|
106
|
+
//# sourceMappingURL=chunk-HRVK43NB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/context/tenant/tenant-context-provider.tsx","../packages/context/tenant/tenant-context.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useAuth } from '@/utils/auth';\nimport { executeRequest } from '@/utils/http';\nimport {\n\tITenantContext,\n\tTenantContext,\n\tTenantContextData,\n} from './tenant-context.js';\n\nexport const TenantProvider = ({ children }: { children: React.ReactNode }) => {\n\tconst auth = useAuth();\n\n\tconst [loading, setLoading] = React.useState({\n\t\tisLoaded: false,\n\t\tisLoading: false,\n\t\tisError: false,\n\t});\n\n\tconst [data, setData] = React.useState<TenantContextData>({\n\t\tgroups: [],\n\t\tperson: {},\n\t\ttenant: {},\n\t\ttenantProducts: [],\n\t\tuser: {},\n\t} as unknown as TenantContextData);\n\n\tuseEffect(() => {\n\t\tlet canceled = false;\n\n\t\tconst load = async () => {\n\t\t\tsetLoading({ isLoaded: false, isLoading: true, isError: false });\n\n\t\t\ttry {\n\t\t\t\tconst response = await executeRequest(\n\t\t\t\t\t`/api/v2/tenant/product/user/${auth.user?.username}`,\n\t\t\t\t);\n\t\t\t\tif (!canceled) {\n\t\t\t\t\tsetData(response);\n\t\t\t\t\tsetLoading({\n\t\t\t\t\t\tisLoaded: true,\n\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t\tisError: false,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t} catch (error: any) {\n\t\t\t\tconsole.error(error);\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t(global as any).__CAYUSE__?.notify?.(\n\t\t\t\t\terror.message ?? 'Something went wrong when loading user information.',\n\t\t\t\t\t{ type: 'error' },\n\t\t\t\t);\n\t\t\t\tif (!canceled) {\n\t\t\t\t\tsetLoading({\n\t\t\t\t\t\tisLoaded: false,\n\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (auth?.user && !loading.isLoaded && !loading.isError && !loading.isLoading) {\n\t\t\tload();\n\t\t}\n\n\t\treturn () => {\n\t\t\tcanceled = true;\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [auth?.user]);\n\n\treturn (\n\t\t<TenantContext.Provider\n\t\t\tvalue={\n\t\t\t\t{\n\t\t\t\t\tdata,\n\t\t\t\t\tisLoaded: loading.isLoaded,\n\t\t\t\t\tisLoading: loading.isLoading,\n\t\t\t\t\tisError: loading.isError,\n\t\t\t\t} satisfies ITenantContext\n\t\t\t}\n\t\t>\n\t\t\t{children}\n\t\t</TenantContext.Provider>\n\t);\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\n\nexport interface TenantProduct {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\tbaseAccessRoles: string[];\n\tdescription: string;\n\tdisplayName: string;\n\tdisplayOrder: number;\n\timage: string;\n\tinternalName: string;\n\tisExternal: boolean;\n\tisProvisionable: boolean;\n\tisCustom: boolean;\n\tname: string;\n\tpath: string;\n\tplaceholder?: string;\n\tthumbnail: string;\n\tcustomerId: string;\n\tproductSettings: any;\n\tproductId: string;\n\tcustomerName: string;\n\ttenantProductId: string;\n\tinstanceURL?: string;\n\tappId?: string;\n\tproductBulkLoad: boolean;\n\tproductBulkDelete: boolean;\n\tproductInfoReady: boolean;\n\tproductUseSimpleFormBuilder: boolean;\n\tproductNewCoiUi: boolean;\n\ttenantProductSettings: any;\n\ttenantId: string;\n\ttenantName: string;\n\tcustomerProductId: string;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface User {\n\tactive: boolean;\n\temail: string;\n\temailVerified: boolean;\n\tfirstName: string;\n\tlastName: string;\n\tguestUser: boolean;\n\tunitName: any;\n\ttenantId: string;\n\tupdatePassword: boolean;\n\tupdateProfile: boolean;\n\tusername: string;\n\tverifyEmail: boolean;\n\tuserStatus: string;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface Person {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\tfirstName: string;\n\tfullName: string;\n\tlastName: string;\n\taffiliations: Affiliation[];\n\texternalAffiliations: ExternalAffiliation[];\n\tuserAccountType: string;\n\tusername: string;\n\tmiddleName: string;\n\tcontactEmail: string;\n\tuserAccountId: string;\n\ttenantId: string;\n\tuserStatus: string;\n\tuserAccountStatus: boolean;\n\tprofileTypes: unknown[];\n\trolesCount: number;\n\tcontactId: string;\n\tpersonUserLinkId: string;\n\tprefix: string | null;\n\tsuffix: string | null;\n\tpreferredName: string | null;\n\temployeeId: string;\n\tdemographicsId: string | null;\n\texternalIdentifiersId: string | null;\n\tguestUser: boolean;\n\tuserAccountStatusName: string | null;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface Affiliation {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\tcontactId: string | null;\n\tprimaryAppointment: boolean;\n\tprimaryAppointmentDisplay?: string;\n\temployeeId?: string;\n\tgovAgency: string | null;\n\tstartDate: string;\n\tendDate?: string;\n\tpersonId: string;\n\tuserId: string;\n\tperformanceSiteId: string | null;\n\ttitle: string;\n\tunitId: string;\n\tunitName: string;\n\ttenantId: string;\n\tappointmentTypeId: string;\n\teraRoleId: string | null;\n\troutingProfileId: string | null;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface ExternalAffiliation {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\torganizationId: string;\n\tpersonId: string;\n\ttitle: string;\n\ttenantId: string;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface Group {\n\tuserId: string;\n\tgroupId: string;\n\ttenantId: string;\n\tunitId: string | null;\n\tgroupGroupName: string;\n\tgroupGroupDescription?: string;\n\tuserEmail: string;\n\tuserUsername: string;\n\tsubunits: boolean;\n\tactive: boolean;\n\tlinks: any[];\n}\n\nexport interface Tenant {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\tbulkDelete: boolean;\n\tbulkLoad: boolean;\n\thrConnect: boolean;\n\tdataLakeEnabled: boolean;\n\tcurrentFiscalYear: number;\n\tcustomerId: string;\n\tcustomerActive: boolean;\n\tcustomerName: string;\n\tdescription: string;\n\tfiscalYearStartDay: number;\n\tfiscalYearStartMonth: number;\n\thostname: string;\n\tname: string;\n\torcidClientId: any;\n\torcidClientSecret: any;\n\tssoIdpEntityIdName: any;\n\tssoLoginType: string;\n\tssoPrimaryUserAttribute: any;\n\ttenantProductDtoList: any;\n\ttimezone: string;\n\tdemographics: any;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface TenantContextData {\n\ttenantProducts: TenantProduct[];\n\tuser: User;\n\tperson: Person;\n\tgroups: Group[];\n\ttenant: Tenant;\n}\n\nexport interface ITenantContext {\n\tisLoaded: boolean;\n\tisLoading: boolean;\n\tisError: boolean;\n\tdata: TenantContextData;\n}\n\nexport const TenantContext = React.createContext<ITenantContext>({\n\tisLoaded: false,\n\tisLoading: false,\n\tisError: false,\n\tdata: {\n\t\tgroups: [],\n\t\tperson: {},\n\t\ttenant: {},\n\t\ttenantProducts: [],\n\t\tuser: {},\n\t},\n} as unknown as ITenantContext);\n\nexport const useTenantContext = () => {\n\tconst ctx: ITenantContext = React.useContext<ITenantContext>(TenantContext);\n\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t'TenantContext is not initialized. Wrap your component with TenantContext.Provider',\n\t\t);\n\t}\n\n\treturn ctx;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../packages/context/tenant/tenant-context-provider.tsx","../packages/context/tenant/tenant-context.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useAuth } from '@/utils/auth';\nimport { executeRequest } from '@/utils/http';\nimport {\n\tITenantContext,\n\tTenantContext,\n\tTenantContextData,\n} from './tenant-context.js';\n\nexport const TenantProvider = ({ children }: { children: React.ReactNode }) => {\n\tconst auth = useAuth();\n\n\tconst [loading, setLoading] = React.useState({\n\t\tisLoaded: false,\n\t\tisLoading: false,\n\t\tisError: false,\n\t});\n\n\tconst [data, setData] = React.useState<TenantContextData>({\n\t\tgroups: [],\n\t\tperson: {},\n\t\ttenant: {},\n\t\ttenantProducts: [],\n\t\tuser: {},\n\t} as unknown as TenantContextData);\n\n\tuseEffect(() => {\n\t\tlet canceled = false;\n\n\t\tconst load = async () => {\n\t\t\tsetLoading({ isLoaded: false, isLoading: true, isError: false });\n\n\t\t\ttry {\n\t\t\t\tconst response = await executeRequest(\n\t\t\t\t\t`/api/v2/tenant/product/user/${auth.user?.username}`,\n\t\t\t\t);\n\t\t\t\tif (!canceled) {\n\t\t\t\t\tsetData(response);\n\t\t\t\t\tsetLoading({\n\t\t\t\t\t\tisLoaded: true,\n\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t\tisError: false,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t} catch (error: any) {\n\t\t\t\tconsole.error(error);\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t(global as any).__CAYUSE__?.notify?.(\n\t\t\t\t\terror.message ?? 'Something went wrong when loading user information.',\n\t\t\t\t\t{ type: 'error' },\n\t\t\t\t);\n\t\t\t\tif (!canceled) {\n\t\t\t\t\tsetLoading({\n\t\t\t\t\t\tisLoaded: false,\n\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (auth?.user && !loading.isLoaded && !loading.isError && !loading.isLoading) {\n\t\t\tload();\n\t\t}\n\n\t\treturn () => {\n\t\t\tcanceled = true;\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [auth?.user]);\n\n\treturn (\n\t\t<TenantContext.Provider\n\t\t\tvalue={\n\t\t\t\t{\n\t\t\t\t\tdata,\n\t\t\t\t\tisLoaded: loading.isLoaded,\n\t\t\t\t\tisLoading: loading.isLoading,\n\t\t\t\t\tisError: loading.isError,\n\t\t\t\t} satisfies ITenantContext\n\t\t\t}\n\t\t>\n\t\t\t{children}\n\t\t</TenantContext.Provider>\n\t);\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\n\nexport interface TenantProduct {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\tbaseAccessRoles: string[];\n\tdescription: string;\n\tdisplayName: string;\n\tdisplayOrder: number;\n\timage: string;\n\tinternalName: string;\n\tisExternal: boolean;\n\tisProvisionable: boolean;\n\tisCustom: boolean;\n\tname: string;\n\tpath: string;\n\tplaceholder?: string;\n\tthumbnail: string;\n\tcustomerId: string;\n\tproductSettings: any;\n\tproductId: string;\n\tcustomerName: string;\n\ttenantProductId: string;\n\tinstanceURL?: string;\n\tappId?: string;\n\tproductBulkLoad: boolean;\n\tproductBulkDelete: boolean;\n\tproductInfoReady: boolean;\n\tproductUseSimpleFormBuilder: boolean;\n\tproductNewCoiUi: boolean;\n\ttenantProductSettings: any;\n\ttenantId: string;\n\ttenantName: string;\n\tcustomerProductId: string;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface User {\n\tactive: boolean;\n\temail: string;\n\temailVerified: boolean;\n\tfirstName: string;\n\tlastName: string;\n\tguestUser: boolean;\n\tunitName: any;\n\ttenantId: string;\n\tupdatePassword: boolean;\n\tupdateProfile: boolean;\n\tusername: string;\n\tverifyEmail: boolean;\n\tuserStatus: string;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface Person {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\tfirstName: string;\n\tfullName: string;\n\tlastName: string;\n\taffiliations: Affiliation[];\n\texternalAffiliations: ExternalAffiliation[];\n\tuserAccountType: string;\n\tusername: string;\n\tmiddleName: string;\n\tcontactEmail: string;\n\tuserAccountId: string;\n\ttenantId: string;\n\tuserStatus: string;\n\tuserAccountStatus: boolean;\n\tprofileTypes: unknown[];\n\trolesCount: number;\n\tcontactId: string;\n\tpersonUserLinkId: string;\n\tprefix: string | null;\n\tsuffix: string | null;\n\tpreferredName: string | null;\n\temployeeId: string;\n\tdemographicsId: string | null;\n\texternalIdentifiersId: string | null;\n\tguestUser: boolean;\n\tuserAccountStatusName: string | null;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface Affiliation {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\tcontactId: string | null;\n\tprimaryAppointment: boolean;\n\tprimaryAppointmentDisplay?: string;\n\temployeeId?: string;\n\tgovAgency: string | null;\n\tstartDate: string;\n\tendDate?: string;\n\tpersonId: string;\n\tuserId: string;\n\tperformanceSiteId: string | null;\n\ttitle: string;\n\tunitId: string;\n\tunitName: string;\n\ttenantId: string;\n\tappointmentTypeId: string;\n\teraRoleId: string | null;\n\troutingProfileId: string | null;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface ExternalAffiliation {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\torganizationId: string;\n\tpersonId: string;\n\ttitle: string;\n\ttenantId: string;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface Group {\n\tuserId: string;\n\tgroupId: string;\n\ttenantId: string;\n\tunitId: string | null;\n\tgroupGroupName: string;\n\tgroupGroupDescription?: string;\n\tuserEmail: string;\n\tuserUsername: string;\n\tsubunits: boolean;\n\tactive: boolean;\n\tlinks: any[];\n}\n\nexport interface Tenant {\n\tcreateUser: string;\n\tcreateDate: string;\n\tupdateUser: string;\n\tupdateDate: string;\n\thibVersion: number;\n\tactive: boolean;\n\tbulkDelete: boolean;\n\tbulkLoad: boolean;\n\thrConnect: boolean;\n\tdataLakeEnabled: boolean;\n\tcurrentFiscalYear: number;\n\tcustomerId: string;\n\tcustomerActive: boolean;\n\tcustomerName: string;\n\tdescription: string;\n\tfiscalYearStartDay: number;\n\tfiscalYearStartMonth: number;\n\thostname: string;\n\tname: string;\n\torcidClientId: any;\n\torcidClientSecret: any;\n\tssoIdpEntityIdName: any;\n\tssoLoginType: string;\n\tssoPrimaryUserAttribute: any;\n\ttenantProductDtoList: any;\n\ttimezone: string;\n\tdemographics: any;\n\tlinks: any[];\n\tid: string;\n}\n\nexport interface TenantContextData {\n\ttenantProducts: TenantProduct[];\n\tuser: User;\n\tperson: Person;\n\tgroups: Group[];\n\ttenant: Tenant;\n}\n\nexport interface ITenantContext {\n\tisLoaded: boolean;\n\tisLoading: boolean;\n\tisError: boolean;\n\tdata: TenantContextData;\n}\n\nexport const TenantContext = React.createContext<ITenantContext>({\n\tisLoaded: false,\n\tisLoading: false,\n\tisError: false,\n\tdata: {\n\t\tgroups: [],\n\t\tperson: {},\n\t\ttenant: {},\n\t\ttenantProducts: [],\n\t\tuser: {},\n\t},\n} as unknown as ITenantContext);\n\nexport const useTenantContext = () => {\n\tconst ctx: ITenantContext = React.useContext<ITenantContext>(TenantContext);\n\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t'TenantContext is not initialized. Wrap your component with TenantContext.Provider',\n\t\t);\n\t}\n\n\treturn ctx;\n};\n"],"mappings":";;;;;;AAAA,OAAOA,UAAS,iBAAiB;;;ACCjC,OAAO,WAAW;AAwMX,IAAM,gBAAgB,MAAM,cAA8B;AAAA,EAChE,UAAU;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AACA,YAAI,CAAC,UAAU;AACd,qBAAW;AAAA,YACV,UAAU;AAAA,YACV,WAAW;AAAA,YACX,SAAS;AAAA,UACV,CAAC;AAAA,QACF;AAAA,MACD;AAAA,IACD;AAEA,QAAI,MAAM,QAAQ,CAAC,QAAQ,YAAY,CAAC,QAAQ,WAAW,CAAC,QAAQ,WAAW;AAC9E,WAAK;AAAA,IACN;AAEA,WAAO,MAAM;AACZ,iBAAW;AAAA,IACZ;AAAA,EAED,GAAG,CAAC,MAAM,IAAI,CAAC;AAEf,SACC;AAAA,IAAC,cAAc;AAAA,IAAd;AAAA,MACA,OACC;AAAA,QACC;AAAA,QACA,UAAU,QAAQ;AAAA,QAClB,WAAW,QAAQ;AAAA,QACnB,SAAS,QAAQ;AAAA,MAClB;AAAA,MAGA;AAAA;AAAA,EACF;AAEF;","names":["React","React"]}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MAX_FILE_SIZE_75_MB,
|
|
3
3
|
useClickOutside
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BVB7EXJY.js";
|
|
5
5
|
import {
|
|
6
6
|
capitalizeAndJoin,
|
|
7
7
|
flushStorage,
|
|
8
8
|
generateId,
|
|
9
9
|
getDatetimeFormat,
|
|
10
10
|
injectScript
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QPEQWFAR.js";
|
|
12
12
|
import {
|
|
13
13
|
useTenantContext
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
loginWithRedirect
|
|
17
|
-
} from "./chunk-KJUT65VD.js";
|
|
14
|
+
} from "./chunk-HRVK43NB.js";
|
|
18
15
|
import {
|
|
19
16
|
executeRequest,
|
|
20
17
|
isFunction,
|
|
@@ -25,8 +22,9 @@ import {
|
|
|
25
22
|
isObject,
|
|
26
23
|
isObjectWithKey,
|
|
27
24
|
isUrl,
|
|
25
|
+
loginWithRedirect,
|
|
28
26
|
request
|
|
29
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-LDCYFDOO.js";
|
|
30
28
|
import {
|
|
31
29
|
APP_ENV,
|
|
32
30
|
FIELD_TYPES,
|
|
@@ -10333,4 +10331,4 @@ export {
|
|
|
10333
10331
|
MilestoneProgress2 as MilestoneProgress,
|
|
10334
10332
|
TaskFormHeader
|
|
10335
10333
|
};
|
|
10336
|
-
//# sourceMappingURL=chunk-
|
|
10334
|
+
//# sourceMappingURL=chunk-JPEBFDVI.js.map
|