@tap-payments/auth-jsconnect 2.1.38-test → 2.1.40-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/@types/form.d.ts +3 -6
- package/build/api/entity.d.ts +0 -8
- package/build/api/entity.js +0 -15
- package/build/api/file.d.ts +13 -0
- package/build/api/file.js +24 -0
- package/build/api/index.d.ts +6 -2
- package/build/api/index.js +3 -1
- package/build/assets/locales/ar.json +5 -1
- package/build/assets/locales/en.json +5 -1
- package/build/components/FileInput/DragAndDrop.js +1 -1
- package/build/components/ProgressBar/CircularProgressBar.d.ts +3 -1
- package/build/components/ProgressBar/CircularProgressBar.js +2 -2
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/bank/bankStore.js +1 -1
- package/build/features/app/business/businessStore.d.ts +7 -9
- package/build/features/app/business/businessStore.js +29 -67
- package/build/features/app/individual/individualStore.d.ts +4 -16
- package/build/features/app/individual/individualStore.js +11 -89
- package/build/features/business/screens/BusinessType/Article.js +10 -13
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -4
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +12 -50
- package/build/features/business/screens/BusinessType/validation.d.ts +3 -6
- package/build/features/business/screens/BusinessType/validation.js +1 -11
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +11 -62
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +11 -59
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +6 -12
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -23
- package/build/features/shared/UploadFile/UploadFile.js +1 -1
- package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +38 -0
- package/build/features/shared/UploadMultipleFile/UploadFile.js +184 -0
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +27 -0
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +147 -0
- package/build/features/shared/UploadMultipleFile/index.d.ts +2 -0
- package/build/features/shared/UploadMultipleFile/index.js +2 -0
- package/build/theme/typography.js +1 -1
- package/package.json +1 -1
|
@@ -285,10 +285,10 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
285
285
|
civilID = params.civilID, signatureFileId = params.signatureFileId;
|
|
286
286
|
businessCountry = settings.data.businessCountry;
|
|
287
287
|
documentsList = [];
|
|
288
|
-
if (
|
|
289
|
-
documentsList.push({ type: 'Civil ID File', images:
|
|
290
|
-
if (
|
|
291
|
-
documentsList.push({ type: 'Signature File', images:
|
|
288
|
+
if ((civilID || []).length > 0)
|
|
289
|
+
documentsList.push({ type: 'Civil ID File', images: civilID });
|
|
290
|
+
if ((signatureFileId || []).length > 0)
|
|
291
|
+
documentsList.push({ type: 'Signature File', images: signatureFileId });
|
|
292
292
|
requestBody = {
|
|
293
293
|
id: id,
|
|
294
294
|
type: type,
|
|
@@ -321,56 +321,6 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
321
321
|
}
|
|
322
322
|
});
|
|
323
323
|
}); });
|
|
324
|
-
export var uploadCivilIdFile = createAsyncThunk('uploadCivilIdFile', function (_a) {
|
|
325
|
-
var file = _a.file, onProgress = _a.onProgress, title = _a.title;
|
|
326
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
327
|
-
var uploadPayload, onUploadProgress, data;
|
|
328
|
-
return __generator(this, function (_b) {
|
|
329
|
-
switch (_b.label) {
|
|
330
|
-
case 0:
|
|
331
|
-
uploadPayload = {
|
|
332
|
-
file_link_create: false,
|
|
333
|
-
title: title,
|
|
334
|
-
purpose: 'identity_document',
|
|
335
|
-
file: file
|
|
336
|
-
};
|
|
337
|
-
onUploadProgress = function (progressEvent) {
|
|
338
|
-
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
339
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
340
|
-
};
|
|
341
|
-
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
342
|
-
case 1:
|
|
343
|
-
data = _b.sent();
|
|
344
|
-
return [2, { data: data, file: file }];
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
export var uploadSignatureFile = createAsyncThunk('uploadSignatureFile', function (_a) {
|
|
350
|
-
var file = _a.file, onProgress = _a.onProgress;
|
|
351
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
352
|
-
var uploadPayload, onUploadProgress, data;
|
|
353
|
-
return __generator(this, function (_b) {
|
|
354
|
-
switch (_b.label) {
|
|
355
|
-
case 0:
|
|
356
|
-
uploadPayload = {
|
|
357
|
-
file_link_create: false,
|
|
358
|
-
title: 'Merchant Signature',
|
|
359
|
-
purpose: 'customer_signature',
|
|
360
|
-
file: file
|
|
361
|
-
};
|
|
362
|
-
onUploadProgress = function (progressEvent) {
|
|
363
|
-
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
364
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
365
|
-
};
|
|
366
|
-
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
367
|
-
case 1:
|
|
368
|
-
data = _b.sent();
|
|
369
|
-
return [2, { data: data, file: file }];
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
324
|
export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
375
325
|
var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
|
|
376
326
|
var _c, _d, _e, _f;
|
|
@@ -421,10 +371,6 @@ var initialState = {
|
|
|
421
371
|
employerLocation: undefined,
|
|
422
372
|
isPEP: null,
|
|
423
373
|
isInfluencer: null
|
|
424
|
-
},
|
|
425
|
-
attachmentsData: {
|
|
426
|
-
civilIDUploading: false,
|
|
427
|
-
signatureFileUploading: false
|
|
428
374
|
}
|
|
429
375
|
}
|
|
430
376
|
};
|
|
@@ -440,6 +386,12 @@ export var individualSlice = createSlice({
|
|
|
440
386
|
},
|
|
441
387
|
resetOTPScreen: function (state) {
|
|
442
388
|
state.data.otpData.otp = '';
|
|
389
|
+
},
|
|
390
|
+
civilIDUploadingStatus: function (state, action) {
|
|
391
|
+
state.data.individualData.civilIDUploading = action.payload;
|
|
392
|
+
},
|
|
393
|
+
signatureFileUploadingStatus: function (state, action) {
|
|
394
|
+
state.data.individualData.signatureFileUploading = action.payload;
|
|
443
395
|
}
|
|
444
396
|
},
|
|
445
397
|
extraReducers: function (builder) {
|
|
@@ -590,36 +542,6 @@ export var individualSlice = createSlice({
|
|
|
590
542
|
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
591
543
|
state.error = action.error.message;
|
|
592
544
|
state.loading = false;
|
|
593
|
-
})
|
|
594
|
-
.addCase(uploadCivilIdFile.pending, function (state) {
|
|
595
|
-
state.error = null;
|
|
596
|
-
state.data.attachmentsData.civilIDUploading = true;
|
|
597
|
-
})
|
|
598
|
-
.addCase(uploadCivilIdFile.fulfilled, function (state, action) {
|
|
599
|
-
state.error = null;
|
|
600
|
-
state.data.attachmentsData.civilIDUploading = false;
|
|
601
|
-
var _a = action.payload, data = _a.data, file = _a.file;
|
|
602
|
-
state.data.attachmentsData.civilID = data === null || data === void 0 ? void 0 : data.id;
|
|
603
|
-
state.data.attachmentsData.civilIDFile = file;
|
|
604
|
-
})
|
|
605
|
-
.addCase(uploadCivilIdFile.rejected, function (state) {
|
|
606
|
-
state.data.attachmentsData.civilIDUploading = false;
|
|
607
|
-
state.error = 'file_upload_error';
|
|
608
|
-
})
|
|
609
|
-
.addCase(uploadSignatureFile.pending, function (state) {
|
|
610
|
-
state.error = null;
|
|
611
|
-
state.data.attachmentsData.signatureFileUploading = true;
|
|
612
|
-
})
|
|
613
|
-
.addCase(uploadSignatureFile.fulfilled, function (state, action) {
|
|
614
|
-
state.error = null;
|
|
615
|
-
state.data.attachmentsData.signatureFileUploading = false;
|
|
616
|
-
var _a = action.payload, data = _a.data, file = _a.file;
|
|
617
|
-
state.data.attachmentsData.signatureFileId = data === null || data === void 0 ? void 0 : data.id;
|
|
618
|
-
state.data.attachmentsData.signatureFile = file;
|
|
619
|
-
})
|
|
620
|
-
.addCase(uploadSignatureFile.rejected, function (state) {
|
|
621
|
-
state.data.attachmentsData.signatureFileUploading = false;
|
|
622
|
-
state.error = 'file_upload_error';
|
|
623
545
|
})
|
|
624
546
|
.addCase(updateBoardSuccess.fulfilled, function (state, action) {
|
|
625
547
|
var _a;
|
|
@@ -644,6 +566,6 @@ export var individualSlice = createSlice({
|
|
|
644
566
|
});
|
|
645
567
|
}
|
|
646
568
|
});
|
|
647
|
-
export var clearError = (_a = individualSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
569
|
+
export var clearError = (_a = individualSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, civilIDUploadingStatus = _a.civilIDUploadingStatus, signatureFileUploadingStatus = _a.signatureFileUploadingStatus;
|
|
648
570
|
export default individualSlice.reducer;
|
|
649
571
|
export var individualSelector = function (state) { return state.individual; };
|
|
@@ -28,17 +28,16 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
var Article = function (_a) {
|
|
31
|
-
var _b, _c;
|
|
32
31
|
var show = _a.show;
|
|
33
|
-
var
|
|
32
|
+
var _b = React.useState(), error = _b[0], setError = _b[1];
|
|
33
|
+
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
34
34
|
var t = useTranslation().t;
|
|
35
|
-
var
|
|
35
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
36
36
|
var articleFileControl = useController({ name: 'articleFile', control: control });
|
|
37
37
|
var articleIdControl = useController({ name: 'articleId', control: control });
|
|
38
|
-
var
|
|
38
|
+
var _e = useAppSelector(businessSelector), loading = _e.loading, uploadingArticle = _e.uploadingArticle, sysError = _e.uploadingArticleError, data = _e.data;
|
|
39
39
|
var dispatch = useAppDispatch();
|
|
40
40
|
var articleValue = articleFileControl.field.value;
|
|
41
|
-
var error = ((_b = articleFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = articleIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
|
|
42
41
|
var businessTypeData = data.businessTypeData;
|
|
43
42
|
var articleFile = businessTypeData.articleFile, articleId = businessTypeData.articleId;
|
|
44
43
|
React.useEffect(function () {
|
|
@@ -48,15 +47,16 @@ var Article = function (_a) {
|
|
|
48
47
|
}
|
|
49
48
|
}, [articleFile, articleId]);
|
|
50
49
|
var handleArticleChange = function (files) {
|
|
50
|
+
setError('');
|
|
51
51
|
var file = files === null || files === void 0 ? void 0 : files[0];
|
|
52
52
|
if (!file)
|
|
53
53
|
return;
|
|
54
54
|
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
55
|
-
setError('
|
|
55
|
+
setError('file_not_supported_alert');
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
59
|
-
setError('
|
|
59
|
+
setError('file_size_alert');
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
articleFileControl.field.onChange(file);
|
|
@@ -75,16 +75,13 @@ var Article = function (_a) {
|
|
|
75
75
|
};
|
|
76
76
|
React.useEffect(function () {
|
|
77
77
|
if (sysError === 'file_upload_error') {
|
|
78
|
-
setError(
|
|
78
|
+
setError(sysError);
|
|
79
79
|
articleFileControl.field.onChange(undefined);
|
|
80
80
|
setProgress(0);
|
|
81
81
|
}
|
|
82
82
|
}, [sysError]);
|
|
83
|
-
React.useEffect(function () {
|
|
84
|
-
if ((articleFileControl.formState.isValid || !!articleValue) && error != 'file_upload_error')
|
|
85
|
-
clearErrors();
|
|
86
|
-
}, [articleFileControl.formState.isValid, articleValue]);
|
|
87
83
|
var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
|
|
88
|
-
|
|
84
|
+
var errorValue = error || sysError || '';
|
|
85
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_article'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('article_of_association'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleArticleChange, isFileUploaded: !uploadingArticle && !!articleValue, isSubmitting: loading, isUploading: uploadingArticle, progress: progress, onReset: handleReset, error: errorValue && t(errorValue), initialFileName: fileName }) }) })));
|
|
89
86
|
};
|
|
90
87
|
export default Article;
|
|
@@ -28,7 +28,7 @@ import LicenseList from './LicenseList';
|
|
|
28
28
|
var BusinessType = function (_a) {
|
|
29
29
|
var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading, uploadingArticle = _b.uploadingArticle;
|
|
30
30
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
31
|
-
var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId,
|
|
31
|
+
var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, articleId = _c.articleId, articleFile = _c.articleFile;
|
|
32
32
|
var t = useTranslation().t;
|
|
33
33
|
var isAr = useLanguage().isAr;
|
|
34
34
|
var dispatch = useAppDispatch();
|
|
@@ -41,7 +41,6 @@ var BusinessType = function (_a) {
|
|
|
41
41
|
licenseNumber: licenseNumber,
|
|
42
42
|
entityLegalName: entityLegalName,
|
|
43
43
|
certificateId: certificateId,
|
|
44
|
-
certificateFile: certificateFile,
|
|
45
44
|
articleId: articleId,
|
|
46
45
|
articleFile: articleFile
|
|
47
46
|
},
|
|
@@ -57,8 +56,7 @@ var BusinessType = function (_a) {
|
|
|
57
56
|
selectedLicense: data.selectedLicense,
|
|
58
57
|
licenseNumber: data.licenseNumber,
|
|
59
58
|
entityLegalName: data.entityLegalName,
|
|
60
|
-
certificateId: data.certificateId
|
|
61
|
-
certificateFile: data.certificateFile
|
|
59
|
+
certificateId: data.certificateId
|
|
62
60
|
};
|
|
63
61
|
dispatch(updateLeadBusinessType(dataValues));
|
|
64
62
|
};
|
|
@@ -10,16 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import { styled } from '@mui/material/styles';
|
|
15
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
16
13
|
import { useTranslation } from 'react-i18next';
|
|
17
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
18
15
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
-
import {
|
|
20
|
-
import UploadFile from '../../../shared/UploadFile';
|
|
21
|
-
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
22
17
|
import Collapse from '../../../../components/Collapse';
|
|
18
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
19
|
+
import { businessSelector, uploadingStatus } from '../../../app/business/businessStore';
|
|
20
|
+
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
23
21
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
24
22
|
var theme = _a.theme;
|
|
25
23
|
return ({
|
|
@@ -27,54 +25,18 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
27
25
|
});
|
|
28
26
|
});
|
|
29
27
|
var LicenseCertificate = function (_a) {
|
|
30
|
-
var _b, _c;
|
|
31
28
|
var show = _a.show;
|
|
32
|
-
var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
|
|
33
29
|
var t = useTranslation().t;
|
|
34
|
-
var
|
|
35
|
-
var certificateFileControl = useController({ name: 'certificateFile', control: control });
|
|
36
|
-
var certificateIdControl = useController({ name: 'certificateId', control: control });
|
|
37
|
-
var _f = useAppSelector(businessSelector), loading = _f.loading, uploading = _f.uploading, sysError = _f.error;
|
|
30
|
+
var control = useFormContext().control;
|
|
38
31
|
var dispatch = useAppDispatch();
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var handleLicenseCertificateChange = function (
|
|
42
|
-
|
|
43
|
-
if (!file)
|
|
44
|
-
return;
|
|
45
|
-
if (!VALID_FILE_FORMATS.includes(file.type)) {
|
|
46
|
-
setError('certificateFile', { message: 'file_not_supported_alert' });
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (file.size > MAX_FILE_SIZE) {
|
|
50
|
-
setError('certificateFile', { message: 'file_size_alert' });
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
certificateFileControl.field.onChange(file);
|
|
54
|
-
dispatch(uploadLicenseCertificate({
|
|
55
|
-
file: file,
|
|
56
|
-
onProgress: function (value) {
|
|
57
|
-
setProgress(value);
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
32
|
+
var certificateIdControl = useController({ name: 'certificateId', control: control });
|
|
33
|
+
var loading = useAppSelector(businessSelector).loading;
|
|
34
|
+
var handleLicenseCertificateChange = function (ids) {
|
|
35
|
+
certificateIdControl.field.onChange(ids);
|
|
60
36
|
};
|
|
61
|
-
var handleReset = function () {
|
|
62
|
-
|
|
63
|
-
certificateIdControl.field.onChange('');
|
|
64
|
-
dispatch(clearCertificateId());
|
|
65
|
-
setProgress(0);
|
|
37
|
+
var handleReset = function (ids) {
|
|
38
|
+
certificateIdControl.field.onChange(ids);
|
|
66
39
|
};
|
|
67
|
-
|
|
68
|
-
if (sysError === 'file_upload_error') {
|
|
69
|
-
setError('certificateId', { message: sysError });
|
|
70
|
-
certificateFileControl.field.onChange(undefined);
|
|
71
|
-
setProgress(0);
|
|
72
|
-
}
|
|
73
|
-
}, [sysError]);
|
|
74
|
-
React.useEffect(function () {
|
|
75
|
-
if ((certificateFileControl.formState.isValid || !!certificateValue) && error != 'file_upload_error')
|
|
76
|
-
clearErrors();
|
|
77
|
-
}, [certificateFileControl.formState.isValid, certificateValue]);
|
|
78
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_license_certificate'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleLicenseCertificateChange, isFileUploaded: !uploading && !!certificateValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
|
|
40
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_license_certificate'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleLicenseCertificateChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, purpose: 'commercial_registration', fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); } }) }) })));
|
|
79
41
|
};
|
|
80
42
|
export default LicenseCertificate;
|
|
@@ -13,24 +13,21 @@ export declare const KWLicenseValidationSchema: yup.ObjectSchema<import("yup/lib
|
|
|
13
13
|
selectedLicense: any;
|
|
14
14
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
15
15
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
16
|
-
certificateId: yup.
|
|
17
|
-
certificateFile: any;
|
|
16
|
+
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
18
17
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
19
18
|
articleFile: any;
|
|
20
19
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
21
20
|
selectedLicense: any;
|
|
22
21
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
22
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
24
|
-
certificateId: yup.
|
|
25
|
-
certificateFile: any;
|
|
23
|
+
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
26
24
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
27
25
|
articleFile: any;
|
|
28
26
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
29
27
|
selectedLicense: any;
|
|
30
28
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
31
29
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
32
|
-
certificateId: yup.
|
|
33
|
-
certificateFile: any;
|
|
30
|
+
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
34
31
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
35
32
|
articleFile: any;
|
|
36
33
|
}>>>;
|
|
@@ -74,17 +74,7 @@ export var KWLicenseValidationSchema = yup.object().shape({
|
|
|
74
74
|
});
|
|
75
75
|
})
|
|
76
76
|
.required(''),
|
|
77
|
-
certificateId: yup.
|
|
78
|
-
certificateFile: yup
|
|
79
|
-
.mixed()
|
|
80
|
-
.test({
|
|
81
|
-
test: function (value) {
|
|
82
|
-
if (!!value)
|
|
83
|
-
return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE ? true : this.createError({ message: 'alert_file_upload' });
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
.optional(),
|
|
77
|
+
certificateId: yup.array().optional(),
|
|
88
78
|
articleId: yup.string().optional(),
|
|
89
79
|
articleFile: yup
|
|
90
80
|
.mixed()
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -48,14 +48,27 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
48
48
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
49
49
|
var countries = settingsData.countries;
|
|
50
50
|
var user = (data.verify.responseBody || {}).user;
|
|
51
|
+
var _c = data.individualData, occupation = _c.occupation, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, employerName = _c.employerName, employerLocation = _c.employerLocation, isPEP = _c.isPEP, isInfluencer = _c.isInfluencer, civilID = _c.civilID, signatureFileId = _c.signatureFileId, civilIDUploading = _c.civilIDUploading, signatureFileUploading = _c.signatureFileUploading;
|
|
51
52
|
var methods = useForm({
|
|
52
53
|
resolver: yupResolver(IndividualInfoValidationSchema),
|
|
53
|
-
defaultValues:
|
|
54
|
+
defaultValues: {
|
|
55
|
+
occupation: occupation,
|
|
56
|
+
sourceIncome: sourceIncome,
|
|
57
|
+
monthlyIncome: monthlyIncome,
|
|
58
|
+
employerName: employerName,
|
|
59
|
+
employerLocation: employerLocation,
|
|
60
|
+
isPEP: isPEP,
|
|
61
|
+
isInfluencer: isInfluencer,
|
|
62
|
+
civilID: civilID,
|
|
63
|
+
signatureFileId: signatureFileId,
|
|
64
|
+
civilIDUploading: civilIDUploading,
|
|
65
|
+
signatureFileUploading: signatureFileUploading
|
|
66
|
+
},
|
|
54
67
|
mode: 'onChange'
|
|
55
68
|
});
|
|
56
69
|
useSetFromDefaultValues(methods, data.individualData, true);
|
|
57
|
-
var
|
|
58
|
-
var
|
|
70
|
+
var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
|
|
71
|
+
var _e = React.useState(false), employerFieldsActive = _e[0], setEmployerFieldsActive = _e[1];
|
|
59
72
|
React.useEffect(function () {
|
|
60
73
|
var _a, _b;
|
|
61
74
|
if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.name.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'salary')
|
|
@@ -76,7 +89,8 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
76
89
|
var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
|
|
77
90
|
var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
|
|
78
91
|
var isOccupationListActive = listActive === ListType.OccupationList;
|
|
79
|
-
|
|
92
|
+
var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
|
|
93
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive && !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: user === null || user === void 0 ? void 0 : user.is_authorized })] })), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
80
94
|
};
|
|
81
95
|
export default React.memo(AdditionalIndividualInfo);
|
|
82
96
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
4
3
|
import { styled } from '@mui/material/styles';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { useController, useFormContext } from 'react-hook-form';
|
|
7
6
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import UploadFile from '../../../../features/shared/UploadFile';
|
|
11
|
-
import { maskFileName } from '../../../../utils';
|
|
7
|
+
import { civilIDUploadingStatus, individualSelector } from '../../../app/individual/individualStore';
|
|
8
|
+
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
12
9
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
13
10
|
var theme = _a.theme;
|
|
14
11
|
return ({
|
|
@@ -16,66 +13,18 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
16
13
|
});
|
|
17
14
|
});
|
|
18
15
|
var CivilIDFile = function () {
|
|
19
|
-
var _a
|
|
20
|
-
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
16
|
+
var _a;
|
|
21
17
|
var t = useTranslation().t;
|
|
22
|
-
var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors, setValue = _d.setValue;
|
|
23
|
-
var civilIDFileControl = useController({ name: 'civilIDFile', control: control });
|
|
24
|
-
var civilIDFileIdControl = useController({ name: 'civilID', control: control });
|
|
25
|
-
var _e = useAppSelector(individualSelector), data = _e.data, loading = _e.loading, sysError = _e.error;
|
|
26
|
-
var _f = data.attachmentsData, civilIDUploading = _f.civilIDUploading, civilIDFile = _f.civilIDFile, civilID = _f.civilID;
|
|
27
18
|
var dispatch = useAppDispatch();
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
34
|
-
setError('civilIDFile', { message: 'file_not_supported_alert' });
|
|
35
|
-
}
|
|
36
|
-
else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
37
|
-
setError('civilIDFile', { message: 'file_size_alert' });
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
civilIDFileControl.field.onChange(file);
|
|
41
|
-
dispatch(uploadCivilIdFile({
|
|
42
|
-
file: file,
|
|
43
|
-
onProgress: function (value) {
|
|
44
|
-
setProgress(value);
|
|
45
|
-
},
|
|
46
|
-
title: (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant_id
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
19
|
+
var control = useFormContext().control;
|
|
20
|
+
var civilIDFileIdControl = useController({ name: 'civilID', control: control });
|
|
21
|
+
var _b = useAppSelector(individualSelector), loading = _b.loading, data = _b.data;
|
|
22
|
+
var handleCivilIDChange = function (ids) {
|
|
23
|
+
civilIDFileIdControl.field.onChange(ids);
|
|
49
24
|
};
|
|
50
|
-
var handleReset = function () {
|
|
51
|
-
|
|
52
|
-
civilIDFileIdControl.field.onChange('');
|
|
53
|
-
setProgress(0);
|
|
25
|
+
var handleReset = function (ids) {
|
|
26
|
+
civilIDFileIdControl.field.onChange(ids);
|
|
54
27
|
};
|
|
55
|
-
|
|
56
|
-
if (!!civilIDFile) {
|
|
57
|
-
setValue('civilIDFile', civilIDFile);
|
|
58
|
-
setValue('civilID', civilID);
|
|
59
|
-
}
|
|
60
|
-
}, [civilIDFile, civilID]);
|
|
61
|
-
React.useEffect(function () {
|
|
62
|
-
if (sysError === 'file_upload_error') {
|
|
63
|
-
setError('civilIDFileId', { message: sysError });
|
|
64
|
-
civilIDFileControl.field.onChange(null);
|
|
65
|
-
setProgress(0);
|
|
66
|
-
}
|
|
67
|
-
}, [sysError]);
|
|
68
|
-
React.useEffect(function () {
|
|
69
|
-
if ((civilIDFileControl.formState.isValid || !!civilIDValue) && error != 'file_upload_error')
|
|
70
|
-
clearErrors();
|
|
71
|
-
}, [civilIDFileControl.formState.isValid, civilIDValue]);
|
|
72
|
-
React.useEffect(function () {
|
|
73
|
-
if (!!civilIDFile) {
|
|
74
|
-
civilIDFileControl.field.onChange(civilIDFile);
|
|
75
|
-
civilIDFileIdControl.field.onChange(civilID);
|
|
76
|
-
}
|
|
77
|
-
}, []);
|
|
78
|
-
var fileName = civilIDValue ? maskFileName(civilIDValue === null || civilIDValue === void 0 ? void 0 : civilIDValue.name) : '';
|
|
79
|
-
return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isFileUploaded: !civilIDUploading && !!civilIDValue, isSubmitting: loading, isUploading: civilIDUploading, progress: progress, onReset: handleReset, initialFileName: fileName, error: error && t(error) }) }));
|
|
28
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, fileTitle: (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant_id, purpose: 'identity_document', fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); } }) }));
|
|
80
29
|
};
|
|
81
30
|
export default CivilIDFile;
|
|
@@ -10,17 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
15
|
-
import { styled } from '@mui/material/styles';
|
|
16
13
|
import { useTranslation } from 'react-i18next';
|
|
17
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
18
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
17
|
+
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
18
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
19
|
+
import { individualSelector, signatureFileUploadingStatus } from '../../../app/individual/individualStore';
|
|
22
20
|
import Collapse from '../../../../components/Collapse';
|
|
23
|
-
import { maskFileName } from '../../../../utils';
|
|
24
21
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
25
22
|
var theme = _a.theme;
|
|
26
23
|
return ({
|
|
@@ -28,63 +25,18 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
28
25
|
});
|
|
29
26
|
});
|
|
30
27
|
var SignatureFile = function (_a) {
|
|
31
|
-
var _b, _c;
|
|
32
28
|
var show = _a.show;
|
|
33
|
-
var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
|
|
34
29
|
var t = useTranslation().t;
|
|
35
|
-
var
|
|
36
|
-
var signatureFileControl = useController({ name: 'signatureFile', control: control });
|
|
30
|
+
var control = useFormContext().control;
|
|
37
31
|
var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
|
|
38
|
-
var
|
|
39
|
-
var _g = data.attachmentsData, signatureFileUploading = _g.signatureFileUploading, signatureFile = _g.signatureFile, signatureFileId = _g.signatureFileId;
|
|
32
|
+
var loading = useAppSelector(individualSelector).loading;
|
|
40
33
|
var dispatch = useAppDispatch();
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
var handleSignatureChange = function (files) {
|
|
44
|
-
var file = files === null || files === void 0 ? void 0 : files[0];
|
|
45
|
-
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
46
|
-
setError('signatureFile', { message: 'file_not_supported_alert' });
|
|
47
|
-
}
|
|
48
|
-
else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
49
|
-
setError('signatureFile', { message: 'file_size_alert' });
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
signatureFileControl.field.onChange(file);
|
|
53
|
-
dispatch(uploadSignatureFile({
|
|
54
|
-
file: file,
|
|
55
|
-
onProgress: function (value) {
|
|
56
|
-
setProgress(value);
|
|
57
|
-
}
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
34
|
+
var handleSignatureChange = function (ids) {
|
|
35
|
+
signatureFileIdControl.field.onChange(ids);
|
|
60
36
|
};
|
|
61
|
-
var handleReset = function () {
|
|
62
|
-
|
|
63
|
-
signatureFileIdControl.field.onChange('');
|
|
64
|
-
setProgress(0);
|
|
37
|
+
var handleReset = function (ids) {
|
|
38
|
+
signatureFileIdControl.field.onChange(ids);
|
|
65
39
|
};
|
|
66
|
-
|
|
67
|
-
if (sysError === 'file_upload_error') {
|
|
68
|
-
setError('signatureFileId', { message: sysError });
|
|
69
|
-
signatureFileControl.field.onChange(null);
|
|
70
|
-
setProgress(0);
|
|
71
|
-
}
|
|
72
|
-
}, [sysError]);
|
|
73
|
-
React.useEffect(function () {
|
|
74
|
-
if ((signatureFileControl.formState.isValid || !!signatureValue) && error != 'file_upload_error')
|
|
75
|
-
clearErrors();
|
|
76
|
-
}, [signatureFileControl.formState.isValid, signatureValue]);
|
|
77
|
-
React.useEffect(function () {
|
|
78
|
-
if (!!signatureFile) {
|
|
79
|
-
setValue('signatureFile', signatureFile);
|
|
80
|
-
setValue('signatureFileId', signatureFileId);
|
|
81
|
-
}
|
|
82
|
-
}, [signatureFile, signatureFileId]);
|
|
83
|
-
React.useEffect(function () {
|
|
84
|
-
if (!!signatureValue)
|
|
85
|
-
signatureFileControl.field.onChange(signatureFile);
|
|
86
|
-
}, []);
|
|
87
|
-
var fileName = signatureValue ? maskFileName(signatureValue === null || signatureValue === void 0 ? void 0 : signatureValue.name) : '';
|
|
88
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isFileUploaded: !signatureFileUploading && !!signatureValue, isSubmitting: loading, initialFileName: fileName, isUploading: signatureFileUploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
|
|
40
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, purpose: 'customer_signature', fileTitle: 'Merchant Signature', fileUploadingStatus: function (uploading) { return dispatch(signatureFileUploadingStatus(uploading)); } }) }) })));
|
|
89
41
|
};
|
|
90
42
|
export default SignatureFile;
|