@tap-payments/auth-jsconnect 2.0.60-test → 2.0.62-test
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/build/api/entity.d.ts +1 -1
- package/build/api/entity.js +13 -7
- package/build/api/index.d.ts +1 -1
- package/build/components/FileInput/DragAndDrop.d.ts +2 -1
- package/build/components/FileInput/DragAndDrop.js +15 -21
- package/build/constants/validation.js +1 -1
- package/build/features/app/bank/bankStore.d.ts +5 -1
- package/build/features/app/bank/bankStore.js +25 -18
- package/build/features/bank/screens/BankDetails/BankStatement.js +12 -4
- package/build/features/shared/UploadFile/UploadFile.d.ts +2 -1
- package/build/features/shared/UploadFile/UploadFile.js +3 -3
- package/package.json +1 -1
package/build/api/entity.d.ts
CHANGED
|
@@ -52,6 +52,6 @@ declare const entityService: {
|
|
|
52
52
|
retrieveBankAccount: (id: string) => Promise<any>;
|
|
53
53
|
retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
54
54
|
updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
|
|
55
|
-
uploadFileInfo: (data: UploadFileBody) => Promise<any>;
|
|
55
|
+
uploadFileInfo: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<any>;
|
|
56
56
|
};
|
|
57
57
|
export { entityService };
|
package/build/api/entity.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
13
|
var t = {};
|
|
3
14
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -31,13 +42,8 @@ var retrieveBankAccount = function (id) {
|
|
|
31
42
|
url: "".concat(ENDPOINT_PATHS.BANK, "/").concat(id)
|
|
32
43
|
});
|
|
33
44
|
};
|
|
34
|
-
var uploadFileInfo = function (data) {
|
|
35
|
-
return httpClient({
|
|
36
|
-
method: 'post',
|
|
37
|
-
url: "".concat(ENDPOINT_PATHS.FILES_PATH),
|
|
38
|
-
data: data,
|
|
39
|
-
headers: { 'Content-Type': 'multipart/form-data' }
|
|
40
|
-
});
|
|
45
|
+
var uploadFileInfo = function (data, config) {
|
|
46
|
+
return httpClient(__assign({ method: 'post', url: "".concat(ENDPOINT_PATHS.FILES_PATH), data: data, headers: { 'Content-Type': 'multipart/form-data' } }, config));
|
|
41
47
|
};
|
|
42
48
|
var updateIndividualInfo = function (_a) {
|
|
43
49
|
var id = _a.id, data = __rest(_a, ["id"]);
|
package/build/api/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ declare const API: {
|
|
|
40
40
|
retrieveBankAccount: (id: string) => Promise<any>;
|
|
41
41
|
retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
42
42
|
updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
|
|
43
|
-
uploadFileInfo: (data: import("./entity").UploadFileBody) => Promise<any>;
|
|
43
|
+
uploadFileInfo: (data: import("./entity").UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<any>;
|
|
44
44
|
};
|
|
45
45
|
availabilityServices: {
|
|
46
46
|
checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -6,10 +6,11 @@ interface DragAndDropProps {
|
|
|
6
6
|
uploadingTitle: string;
|
|
7
7
|
successTitle: string;
|
|
8
8
|
error?: string;
|
|
9
|
+
progress?: number;
|
|
9
10
|
uploading?: boolean;
|
|
10
11
|
uploadSuccess?: boolean;
|
|
11
12
|
fileExists: boolean;
|
|
12
13
|
onSuccess?: (files: File) => void;
|
|
13
14
|
}
|
|
14
|
-
declare const DragAndDrop: ({ title, subTitle, description, error, uploadingTitle, successTitle, uploading, fileExists, uploadSuccess, onSuccess }: DragAndDropProps) => JSX.Element;
|
|
15
|
+
declare const DragAndDrop: ({ title, subTitle, description, error, uploadingTitle, successTitle, progress, uploading, fileExists, uploadSuccess, onSuccess }: DragAndDropProps) => JSX.Element;
|
|
15
16
|
export default DragAndDrop;
|
|
@@ -91,16 +91,22 @@ var DropFileIcon = styled(Icon)(function (_a) {
|
|
|
91
91
|
marginInline: theme.spacing(-1.25)
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
|
+
var TextDoneStyled = styled(Text)(function (_a) {
|
|
95
|
+
var theme = _a.theme;
|
|
96
|
+
return ({
|
|
97
|
+
marginBlockStart: theme.spacing(1),
|
|
98
|
+
color: theme.palette.text.primary
|
|
99
|
+
});
|
|
100
|
+
});
|
|
94
101
|
var WarningContainer = styled(Box)(function (_a) {
|
|
95
102
|
var theme = _a.theme;
|
|
96
103
|
return (__assign({ background: theme.palette.warning.dark, paddingBlock: theme.spacing(1.5), paddingInlineStart: theme.spacing(2.5), border: '0.5px solid', display: 'flex', justifyContent: 'space-around', borderColor: theme.palette.warning.main, color: theme.palette.warning.light, padding: theme.spacing(0.5, 1), borderRadius: theme.spacing(12.5) }, theme.typography.caption));
|
|
97
104
|
});
|
|
98
105
|
var DragAndDrop = function (_a) {
|
|
99
|
-
var title = _a.title, subTitle = _a.subTitle, description = _a.description, error = _a.error, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, uploading = _a.uploading, fileExists = _a.fileExists, uploadSuccess = _a.uploadSuccess, onSuccess = _a.onSuccess;
|
|
100
|
-
var _b = React.useState(
|
|
101
|
-
var _c = React.useState(false),
|
|
102
|
-
var _d =
|
|
103
|
-
var _e = useDropzone({
|
|
106
|
+
var title = _a.title, subTitle = _a.subTitle, description = _a.description, error = _a.error, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, progress = _a.progress, uploading = _a.uploading, fileExists = _a.fileExists, uploadSuccess = _a.uploadSuccess, onSuccess = _a.onSuccess;
|
|
107
|
+
var _b = React.useState(false), dragActive = _b[0], setDragActive = _b[1];
|
|
108
|
+
var _c = React.useState(false), showDone = _c[0], setShowDone = _c[1];
|
|
109
|
+
var _d = useDropzone({
|
|
104
110
|
maxFiles: 1,
|
|
105
111
|
noKeyboard: true,
|
|
106
112
|
noClick: false,
|
|
@@ -114,30 +120,18 @@ var DragAndDrop = function (_a) {
|
|
|
114
120
|
},
|
|
115
121
|
onDrop: function (files) {
|
|
116
122
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(files === null || files === void 0 ? void 0 : files[0]);
|
|
123
|
+
setDragActive(false);
|
|
117
124
|
}
|
|
118
|
-
}), getRootProps =
|
|
125
|
+
}), getRootProps = _d.getRootProps, getInputProps = _d.getInputProps;
|
|
119
126
|
React.useEffect(function () {
|
|
120
127
|
setDragActive(false);
|
|
121
128
|
if (uploadSuccess) {
|
|
122
129
|
setShowDone(true);
|
|
123
130
|
setTimeout(function () {
|
|
124
|
-
setProgress(100);
|
|
125
131
|
setShowDone(false);
|
|
126
|
-
},
|
|
127
|
-
}
|
|
128
|
-
else if (uploading) {
|
|
129
|
-
var timer_1 = setInterval(function () {
|
|
130
|
-
setProgress(function (prevProgress) { return (prevProgress >= 75 ? 1 : prevProgress + 25); });
|
|
131
|
-
}, 800);
|
|
132
|
-
return function () {
|
|
133
|
-
clearInterval(timer_1);
|
|
134
|
-
};
|
|
132
|
+
}, 400);
|
|
135
133
|
}
|
|
136
134
|
}, [uploading]);
|
|
137
|
-
|
|
138
|
-
if (!fileExists)
|
|
139
|
-
setProgress(25);
|
|
140
|
-
}, [fileExists]);
|
|
141
|
-
return (_jsx(Box, __assign({ id: 'upload-container' }, { children: _jsxs(BoxStyled, __assign({ active: dragActive }, getRootProps({ className: 'dropzone' }), { children: [_jsx(Fade, __assign({ in: (!uploading && !uploadSuccess) || !fileExists, unmountOnExit: true, timeout: 100 }, { children: _jsxs(Box, { children: [_jsx(CenterBoxStyled, { children: _jsx(IconStyled, { src: dragActive ? ICONS_NAMES.ACTIVE_UPLOAD_ICON : ICONS_NAMES.UPLOAD_ICON }) }), _jsxs(VerticalCenterBox, __assign({ sx: { marginBlockEnd: '20px' } }, { children: [_jsxs(CenterBoxStyled, { children: [_jsx(Text, __assign({ sx: { fontSize: '16px' } }, { children: title })), _jsx(SubTitleStyled, { children: subTitle })] }), _jsx(DescTextStyled, { children: description }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsxs(WarningContainer, { children: [_jsx(WarningIconStyled, { src: ICONS_NAMES.WARNING_ICON }), _jsx(Text, { children: error })] }) }))] })), _jsx(UploadInputStyled, { inputProps: __assign({}, getInputProps()) })] }) })), _jsx(CenterBoxStyled, { children: showDone ? (_jsxs(VerticalCenterBox, { children: [_jsx(DoneIconStyled, { src: ICONS_NAMES.DONE_ICON }), _jsx(Text, { children: successTitle })] })) : uploading ? (_jsxs(VerticalCenterBox, { children: [_jsx(CircularProgress, { value: progress, size: 54 }), _jsx(Text, { children: uploadingTitle })] })) : (_jsx(_Fragment, {})) }), _jsx(Fade, __assign({ unmountOnExit: true, timeout: 100, in: dragActive }, { children: _jsx(DropFileIcon, { src: ICONS_NAMES.DROP_FILE_ICON }) }))] })) })));
|
|
135
|
+
return (_jsx(Box, __assign({ id: 'upload-container' }, { children: _jsxs(BoxStyled, __assign({ active: dragActive }, getRootProps({ className: 'dropzone' }), { children: [_jsx(Fade, __assign({ in: (!uploading && !uploadSuccess) || !fileExists, unmountOnExit: true, timeout: 100 }, { children: _jsxs(Box, { children: [_jsx(CenterBoxStyled, { children: _jsx(IconStyled, { src: dragActive ? ICONS_NAMES.ACTIVE_UPLOAD_ICON : ICONS_NAMES.UPLOAD_ICON }) }), _jsxs(VerticalCenterBox, __assign({ sx: { marginBlockEnd: '20px' } }, { children: [_jsxs(CenterBoxStyled, { children: [_jsx(Text, __assign({ sx: { fontSize: '16px' } }, { children: title })), _jsx(SubTitleStyled, { children: subTitle })] }), _jsx(DescTextStyled, { children: description }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsxs(WarningContainer, { children: [_jsx(WarningIconStyled, { src: ICONS_NAMES.WARNING_ICON }), _jsx(Text, { children: error })] }) }))] })), _jsx(UploadInputStyled, { inputProps: __assign({}, getInputProps()) })] }) })), _jsx(CenterBoxStyled, { children: showDone ? (_jsxs(VerticalCenterBox, { children: [_jsx(DoneIconStyled, { src: ICONS_NAMES.DONE_ICON }), _jsx(TextDoneStyled, { children: successTitle })] })) : uploading ? (_jsxs(VerticalCenterBox, { children: [_jsx(CircularProgress, { value: progress, size: 54 }), _jsx(Text, { children: uploadingTitle })] })) : (_jsx(_Fragment, {})) })] })) })));
|
|
142
136
|
};
|
|
143
137
|
export default DragAndDrop;
|
|
@@ -10,6 +10,6 @@ export var MAX_FILE_SIZE = 5000000;
|
|
|
10
10
|
export var VALID_FILE_FORMATS = ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'];
|
|
11
11
|
export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
|
|
12
12
|
export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
|
|
13
|
-
export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z\s])*$/g;
|
|
13
|
+
export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z()\s])*$/g;
|
|
14
14
|
export var REGEX_BRAND_NAME = /^(([a-zA-Z0-9])+\s)*[a-zA-Z0-9]+$/;
|
|
15
15
|
export var EMAIL_MAX_LENGTH = 50;
|
|
@@ -33,9 +33,13 @@ export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
33
33
|
cancelToken: CancelToken;
|
|
34
34
|
onSuccess?: (() => void) | undefined;
|
|
35
35
|
}, {}>;
|
|
36
|
+
interface UploadBankStatementParams {
|
|
37
|
+
file: File;
|
|
38
|
+
onProgress?: (value: number) => void;
|
|
39
|
+
}
|
|
36
40
|
export declare const uploadBankStatement: import("@reduxjs/toolkit").AsyncThunk<{
|
|
37
41
|
data: any;
|
|
38
|
-
},
|
|
42
|
+
}, UploadBankStatementParams, {}>;
|
|
39
43
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
40
44
|
response: any;
|
|
41
45
|
formData: void;
|
|
@@ -209,24 +209,31 @@ export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
|
|
|
209
209
|
});
|
|
210
210
|
});
|
|
211
211
|
});
|
|
212
|
-
export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (
|
|
213
|
-
var
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
212
|
+
export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (_a) {
|
|
213
|
+
var file = _a.file, onProgress = _a.onProgress;
|
|
214
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
215
|
+
var uploadPayload, onUploadProgress, data;
|
|
216
|
+
return __generator(this, function (_b) {
|
|
217
|
+
switch (_b.label) {
|
|
218
|
+
case 0:
|
|
219
|
+
uploadPayload = {
|
|
220
|
+
file_link_create: true,
|
|
221
|
+
title: file === null || file === void 0 ? void 0 : file.name,
|
|
222
|
+
purpose: 'identity_document',
|
|
223
|
+
file: file
|
|
224
|
+
};
|
|
225
|
+
onUploadProgress = function (progressEvent) {
|
|
226
|
+
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
227
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
228
|
+
};
|
|
229
|
+
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
230
|
+
case 1:
|
|
231
|
+
data = _b.sent();
|
|
232
|
+
return [2, { data: data }];
|
|
233
|
+
}
|
|
234
|
+
});
|
|
228
235
|
});
|
|
229
|
-
});
|
|
236
|
+
});
|
|
230
237
|
export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
231
238
|
var _a, settings, bank, _b, id, infoId, payload, data;
|
|
232
239
|
var _c, _d, _e, _f;
|
|
@@ -431,7 +438,7 @@ export var bankSlice = createSlice({
|
|
|
431
438
|
var data = action.payload.data;
|
|
432
439
|
state.data.bankData.bankStatementId = data === null || data === void 0 ? void 0 : data.id;
|
|
433
440
|
})
|
|
434
|
-
.addCase(uploadBankStatement.rejected, function (state
|
|
441
|
+
.addCase(uploadBankStatement.rejected, function (state) {
|
|
435
442
|
state.uploading = false;
|
|
436
443
|
state.error = 'file_upload_error';
|
|
437
444
|
});
|
|
@@ -16,11 +16,12 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
16
16
|
});
|
|
17
17
|
var BankStatement = function () {
|
|
18
18
|
var _a, _b;
|
|
19
|
+
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
19
20
|
var t = useTranslation().t;
|
|
20
|
-
var
|
|
21
|
+
var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors;
|
|
21
22
|
var bankStatementFileControl = useController({ name: 'bankStatementFile', control: control });
|
|
22
23
|
var bankStatementIdControl = useController({ name: 'bankStatementId', control: control });
|
|
23
|
-
var
|
|
24
|
+
var _e = useAppSelector(bankSelector), loading = _e.loading, uploading = _e.uploading, sysError = _e.error;
|
|
24
25
|
var dispatch = useAppDispatch();
|
|
25
26
|
var bankStatementValue = bankStatementFileControl.field.value;
|
|
26
27
|
var error = ((_a = bankStatementFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = bankStatementIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
|
|
@@ -33,23 +34,30 @@ var BankStatement = function () {
|
|
|
33
34
|
}
|
|
34
35
|
else {
|
|
35
36
|
bankStatementFileControl.field.onChange(file);
|
|
36
|
-
dispatch(uploadBankStatement(
|
|
37
|
+
dispatch(uploadBankStatement({
|
|
38
|
+
file: file,
|
|
39
|
+
onProgress: function (value) {
|
|
40
|
+
setProgress(value);
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
37
43
|
}
|
|
38
44
|
};
|
|
39
45
|
var handleReset = function () {
|
|
40
46
|
bankStatementFileControl.field.onChange(null);
|
|
41
47
|
bankStatementIdControl.field.onChange('');
|
|
48
|
+
setProgress(0);
|
|
42
49
|
};
|
|
43
50
|
React.useEffect(function () {
|
|
44
51
|
if (sysError === 'file_upload_error') {
|
|
45
52
|
setError('bankStatementId', { message: sysError });
|
|
46
53
|
bankStatementFileControl.field.onChange(null);
|
|
54
|
+
setProgress(0);
|
|
47
55
|
}
|
|
48
56
|
}, [sysError]);
|
|
49
57
|
React.useEffect(function () {
|
|
50
58
|
if ((bankStatementFileControl.formState.isValid || !!bankStatementValue) && error != 'file_upload_error')
|
|
51
59
|
clearErrors();
|
|
52
60
|
}, [bankStatementFileControl.formState.isValid, bankStatementValue]);
|
|
53
|
-
return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isFileUploaded: !uploading && !!bankStatementValue, isSubmitting: loading, isUploading: uploading, onReset: handleReset, error: error && t(error) }) }));
|
|
61
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isFileUploaded: !uploading && !!bankStatementValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error) }) }));
|
|
54
62
|
};
|
|
55
63
|
export default BankStatement;
|
|
@@ -16,11 +16,12 @@ interface UploadFileProps {
|
|
|
16
16
|
uploadingTitle: string;
|
|
17
17
|
successTitle: string;
|
|
18
18
|
error?: string;
|
|
19
|
+
progress?: number;
|
|
19
20
|
isSubmitting?: boolean;
|
|
20
21
|
isUploading?: boolean;
|
|
21
22
|
isFileUploaded?: boolean;
|
|
22
23
|
onFileUploaded: (file: File) => void;
|
|
23
24
|
onReset: () => void;
|
|
24
25
|
}
|
|
25
|
-
declare const UploadFile: ({ label, required, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, isUploading, isFileUploaded, error, onFileUploaded, onReset }: UploadFileProps) => JSX.Element;
|
|
26
|
+
declare const UploadFile: ({ label, required, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, isUploading, isFileUploaded, error, progress, onFileUploaded, onReset }: UploadFileProps) => JSX.Element;
|
|
26
27
|
export default UploadFile;
|
|
@@ -64,7 +64,7 @@ export var InputContainerStyled = styled(Box)(function (_a) {
|
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
var UploadFile = function (_a) {
|
|
67
|
-
var label = _a.label, required = _a.required, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, isUploading = _a.isUploading, isFileUploaded = _a.isFileUploaded, error = _a.error, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset;
|
|
67
|
+
var label = _a.label, required = _a.required, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, isUploading = _a.isUploading, isFileUploaded = _a.isFileUploaded, error = _a.error, progress = _a.progress, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset;
|
|
68
68
|
var _b = React.useState(''), fileName = _b[0], setFileName = _b[1];
|
|
69
69
|
var _c = React.useState(false), showFile = _c[0], setShowFile = _c[1];
|
|
70
70
|
var handleFileChange = function (file) {
|
|
@@ -81,11 +81,11 @@ var UploadFile = function (_a) {
|
|
|
81
81
|
if (isFileUploaded && !!fileName) {
|
|
82
82
|
setTimeout(function () {
|
|
83
83
|
setShowFile(true);
|
|
84
|
-
},
|
|
84
|
+
}, 600);
|
|
85
85
|
}
|
|
86
86
|
else
|
|
87
87
|
setShowFile(false);
|
|
88
88
|
}, [isFileUploaded]);
|
|
89
|
-
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !showFile }, { children: _jsx(InputContainerStyled, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: !!fileName, uploadingTitle: uploadingTitle, successTitle: successTitle, uploading: isUploading, uploadSuccess: isFileUploaded, onSuccess: handleFileChange, error: error }) }) })), _jsx(Collapse, __assign({ in: showFile, timeout: 300 }, { children: _jsxs(InputContainerStyled, { children: [_jsxs(BoxStyled, { children: [_jsxs(Box, __assign({ sx: { display: 'flex' } }, { children: [_jsx(Icon, { src: ICONS_NAMES.DOC_ICON }), _jsx(Text, { children: fileName })] })), _jsx(Box, { children: _jsx(CheckIcon, {}) })] }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(ClearIconStyled, {}) }))] }) }))] }));
|
|
89
|
+
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !showFile }, { children: _jsx(InputContainerStyled, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: !!fileName, uploadingTitle: uploadingTitle, successTitle: successTitle, progress: progress, uploading: isUploading, uploadSuccess: isFileUploaded, onSuccess: handleFileChange, error: error }) }) })), _jsx(Collapse, __assign({ in: showFile, timeout: 300 }, { children: _jsxs(InputContainerStyled, { children: [_jsxs(BoxStyled, { children: [_jsxs(Box, __assign({ sx: { display: 'flex' } }, { children: [_jsx(Icon, { src: ICONS_NAMES.DOC_ICON }), _jsx(Text, { children: fileName })] })), _jsx(Box, { children: _jsx(CheckIcon, {}) })] }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(ClearIconStyled, {}) }))] }) }))] }));
|
|
90
90
|
};
|
|
91
91
|
export default UploadFile;
|