@tap-payments/auth-jsconnect 2.3.6-test → 2.3.8-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 +0 -1
- package/build/components/DatePicker/DatePicker.js +5 -3
- package/build/constants/app.d.ts +27 -0
- package/build/constants/app.js +21 -0
- package/build/features/app/entity/entityStore.d.ts +2 -12
- package/build/features/app/entity/entityStore.js +7 -52
- package/build/features/bank/screens/BankDetails/BankStatement.js +2 -1
- package/build/features/business/screens/BusinessType/Article.js +1 -1
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +2 -1
- package/build/features/entity/screens/EntityName/Article.js +12 -53
- package/build/features/entity/screens/EntityName/EntityName.js +2 -3
- package/build/features/entity/screens/EntityName/LicenseCertificate.js +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +2 -1
- package/build/features/shared/UploadFile/FileUpload.d.ts +27 -0
- package/build/features/shared/UploadFile/FileUpload.js +220 -0
- package/build/features/shared/UploadFile/UploadWrapper.d.ts +31 -0
- package/build/features/shared/UploadFile/UploadWrapper.js +114 -0
- package/build/features/shared/UploadFile/index.d.ts +2 -1
- package/build/features/shared/UploadFile/index.js +2 -1
- package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +5 -26
- package/build/features/shared/UploadMultipleFile/UploadFile.js +47 -49
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +4 -2
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +9 -15
- package/build/features/tax/screens/TaxDetails/TaxDocument.js +2 -1
- package/build/utils/array.js +11 -4
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import Divider from '@mui/material/Divider';
|
|
|
30
30
|
import Collapse from '../Collapse';
|
|
31
31
|
import ExpandIcon from '../ExpandIcon';
|
|
32
32
|
import CalendarTodayOutlined from '@mui/icons-material/CalendarTodayOutlined';
|
|
33
|
-
import { scrollDown, scrollUp } from '../../utils';
|
|
33
|
+
import { convertNumbers2English, dateFormat, scrollDown, scrollUp } from '../../utils';
|
|
34
34
|
import Input from '../Input';
|
|
35
35
|
import Text from '../Text';
|
|
36
36
|
import './customStyle.css';
|
|
@@ -84,8 +84,10 @@ var DatePicker = function (_a) {
|
|
|
84
84
|
setTimeout(function () { return scrollUp(elementId); }, 550);
|
|
85
85
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
86
86
|
};
|
|
87
|
-
var formattedDate = function (
|
|
88
|
-
|
|
87
|
+
var formattedDate = function (d) {
|
|
88
|
+
var date = new Date(d);
|
|
89
|
+
var formattedDate = dateFormat(date, 'YYYY-MM-DD');
|
|
90
|
+
return convertNumbers2English(formattedDate);
|
|
89
91
|
};
|
|
90
92
|
var handleOnDateChange = function (date) {
|
|
91
93
|
setDate(date);
|
package/build/constants/app.d.ts
CHANGED
|
@@ -193,3 +193,30 @@ export declare const BUSINESS_FLOW_SUCCESS: {
|
|
|
193
193
|
status: string;
|
|
194
194
|
url: string;
|
|
195
195
|
}[];
|
|
196
|
+
export declare enum FileType {
|
|
197
|
+
IMAGES = "images",
|
|
198
|
+
FILES = "files"
|
|
199
|
+
}
|
|
200
|
+
export declare enum FileStatus {
|
|
201
|
+
INIT = "init",
|
|
202
|
+
UPLOADING = "uploading",
|
|
203
|
+
DOWNLOADING = "downloading",
|
|
204
|
+
SUCCESS = "success",
|
|
205
|
+
ERROR = "error",
|
|
206
|
+
ALREADY_UPLOADED = "already_uploaded"
|
|
207
|
+
}
|
|
208
|
+
export declare enum DeleteFileStatus {
|
|
209
|
+
NONE = "none",
|
|
210
|
+
DELETING = "deleting",
|
|
211
|
+
ERROR = "error",
|
|
212
|
+
SUCCESS = "success"
|
|
213
|
+
}
|
|
214
|
+
export declare type FileInfo = {
|
|
215
|
+
fileId: string;
|
|
216
|
+
docId: string;
|
|
217
|
+
name: string;
|
|
218
|
+
status: FileStatus;
|
|
219
|
+
progress: number;
|
|
220
|
+
error: string;
|
|
221
|
+
deleteStatus: DeleteFileStatus;
|
|
222
|
+
};
|
package/build/constants/app.js
CHANGED
|
@@ -696,3 +696,24 @@ export var PASSWORD_OPERATION_TYPE = {
|
|
|
696
696
|
RESET_PASSWORD: 'reset_password'
|
|
697
697
|
};
|
|
698
698
|
export var BUSINESS_FLOW_SUCCESS = [{ name: 'business', status: 'completed', url: '' }];
|
|
699
|
+
export var FileType;
|
|
700
|
+
(function (FileType) {
|
|
701
|
+
FileType["IMAGES"] = "images";
|
|
702
|
+
FileType["FILES"] = "files";
|
|
703
|
+
})(FileType || (FileType = {}));
|
|
704
|
+
export var FileStatus;
|
|
705
|
+
(function (FileStatus) {
|
|
706
|
+
FileStatus["INIT"] = "init";
|
|
707
|
+
FileStatus["UPLOADING"] = "uploading";
|
|
708
|
+
FileStatus["DOWNLOADING"] = "downloading";
|
|
709
|
+
FileStatus["SUCCESS"] = "success";
|
|
710
|
+
FileStatus["ERROR"] = "error";
|
|
711
|
+
FileStatus["ALREADY_UPLOADED"] = "already_uploaded";
|
|
712
|
+
})(FileStatus || (FileStatus = {}));
|
|
713
|
+
export var DeleteFileStatus;
|
|
714
|
+
(function (DeleteFileStatus) {
|
|
715
|
+
DeleteFileStatus["NONE"] = "none";
|
|
716
|
+
DeleteFileStatus["DELETING"] = "deleting";
|
|
717
|
+
DeleteFileStatus["ERROR"] = "error";
|
|
718
|
+
DeleteFileStatus["SUCCESS"] = "success";
|
|
719
|
+
})(DeleteFileStatus || (DeleteFileStatus = {}));
|
|
@@ -46,15 +46,6 @@ export declare const updateEntityName: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
46
46
|
data: any;
|
|
47
47
|
formData: EntityNameFormValues;
|
|
48
48
|
}, EntityNameFormValues, {}>;
|
|
49
|
-
interface UploadArticleParams {
|
|
50
|
-
file: File;
|
|
51
|
-
onProgress?: (value: number) => void;
|
|
52
|
-
onSuccess?: (fileId: string) => void;
|
|
53
|
-
onFailure?: (error: string) => void;
|
|
54
|
-
}
|
|
55
|
-
export declare const uploadArticle: import("@reduxjs/toolkit").AsyncThunk<{
|
|
56
|
-
data: any;
|
|
57
|
-
}, UploadArticleParams, {}>;
|
|
58
49
|
export declare const updateEntityCapital: import("@reduxjs/toolkit").AsyncThunk<{
|
|
59
50
|
data: any;
|
|
60
51
|
formData: EntityCapitalFormValues;
|
|
@@ -77,16 +68,15 @@ export interface EntityState extends SharedState<EntityData> {
|
|
|
77
68
|
customLoading?: boolean;
|
|
78
69
|
uploading?: boolean;
|
|
79
70
|
uploadingArticle?: boolean;
|
|
80
|
-
uploadingArticleError?: string | null;
|
|
81
71
|
}
|
|
82
72
|
export declare const entitySlice: import("@reduxjs/toolkit").Slice<EntityState, {
|
|
83
73
|
clearError: (state: EntityState) => void;
|
|
84
74
|
stopLoader: (state: EntityState) => void;
|
|
85
75
|
resetOTPScreen: (state: EntityState) => void;
|
|
86
76
|
uploadingStatus: (state: EntityState, action: ActionState<boolean>) => void;
|
|
87
|
-
|
|
77
|
+
uploadingArticleStatus: (state: EntityState, action: ActionState<boolean>) => void;
|
|
88
78
|
}, "entity/store">;
|
|
89
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, uploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>,
|
|
79
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, uploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, uploadingArticleStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
|
|
90
80
|
declare const _default: import("redux").Reducer<EntityState, import("redux").AnyAction>;
|
|
91
81
|
export default _default;
|
|
92
82
|
export declare const entitySelector: (state: RootState) => EntityState;
|
|
@@ -240,7 +240,7 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
240
240
|
});
|
|
241
241
|
}); });
|
|
242
242
|
export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
243
|
-
var _a, settings, entity, entityData, _b, id, data_status,
|
|
243
|
+
var _a, settings, entity, entityData, _b, id, data_status, issuingDate, expiryDate, isFL, isLegalNameEditable, isLicenseTypeEditable, isEntityTypeEditable, isLicenseNumberEditable, isUnifiedNumberEditable, isIssuingDateEditable, isExpiryDateEditable, documentResponse, document, documentBody, documentBody, payload, data, list;
|
|
244
244
|
var _c, _d;
|
|
245
245
|
return __generator(this, function (_e) {
|
|
246
246
|
switch (_e.label) {
|
|
@@ -248,7 +248,6 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
248
248
|
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
249
249
|
entityData = (entity.data.verify.responseBody || {}).entity;
|
|
250
250
|
_b = entityData || {}, id = _b.id, data_status = _b.data_status;
|
|
251
|
-
articleId = entity.data.entityNameData.articleId;
|
|
252
251
|
issuingDate = new Date(params.issuingDate).getTime();
|
|
253
252
|
expiryDate = new Date(params.expiryDate).getTime();
|
|
254
253
|
isFL = params.licenseType === BusinessType.FL;
|
|
@@ -264,7 +263,7 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
264
263
|
if (!((params.certificateId || []).length > 0)) return [3, 4];
|
|
265
264
|
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 2];
|
|
266
265
|
documentBody = {
|
|
267
|
-
id: document
|
|
266
|
+
id: document.id,
|
|
268
267
|
images: params.certificateId
|
|
269
268
|
};
|
|
270
269
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
@@ -287,7 +286,7 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
287
286
|
case 4:
|
|
288
287
|
payload = {
|
|
289
288
|
id: id,
|
|
290
|
-
AOA_file_id: articleId,
|
|
289
|
+
AOA_file_id: params.articleId,
|
|
291
290
|
license: {
|
|
292
291
|
number: isLicenseNumberEditable && params.licenseNumber ? params.licenseNumber : undefined,
|
|
293
292
|
type: isLicenseTypeEditable ? (isFL ? 'freelance' : 'commercial_registration') : undefined,
|
|
@@ -331,35 +330,6 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
331
330
|
}
|
|
332
331
|
});
|
|
333
332
|
}); });
|
|
334
|
-
export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
|
|
335
|
-
var file = _a.file, onProgress = _a.onProgress;
|
|
336
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
337
|
-
var typeArray, type, uploadPayload, onUploadProgress, data;
|
|
338
|
-
var _b;
|
|
339
|
-
return __generator(this, function (_c) {
|
|
340
|
-
switch (_c.label) {
|
|
341
|
-
case 0:
|
|
342
|
-
typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
|
|
343
|
-
type = typeArray[1] || '';
|
|
344
|
-
uploadPayload = {
|
|
345
|
-
file_link_create: true,
|
|
346
|
-
title: file === null || file === void 0 ? void 0 : file.name,
|
|
347
|
-
purpose: DocumentPurpose.ARTICLE_ASSOCIATION,
|
|
348
|
-
type: type,
|
|
349
|
-
file: file
|
|
350
|
-
};
|
|
351
|
-
onUploadProgress = function (progressEvent) {
|
|
352
|
-
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
353
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
354
|
-
};
|
|
355
|
-
return [4, API.fileService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
356
|
-
case 1:
|
|
357
|
-
data = _c.sent();
|
|
358
|
-
return [2, { data: data }];
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
333
|
export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
364
334
|
var _a, settings, entity, entityData, _b, id, data_status, isCapitalPaidEditable, isCapitalShareEditable, activities, payload, data;
|
|
365
335
|
var _c, _d, _e;
|
|
@@ -434,7 +404,6 @@ var initialState = {
|
|
|
434
404
|
customLoading: false,
|
|
435
405
|
uploading: false,
|
|
436
406
|
uploadingArticle: false,
|
|
437
|
-
uploadingArticleError: null,
|
|
438
407
|
data: {
|
|
439
408
|
flowName: FlowsTypes.ENTITY,
|
|
440
409
|
verify: {
|
|
@@ -476,8 +445,8 @@ export var entitySlice = createSlice({
|
|
|
476
445
|
uploadingStatus: function (state, action) {
|
|
477
446
|
state.uploading = action.payload;
|
|
478
447
|
},
|
|
479
|
-
|
|
480
|
-
state.
|
|
448
|
+
uploadingArticleStatus: function (state, action) {
|
|
449
|
+
state.uploadingArticle = action.payload;
|
|
481
450
|
}
|
|
482
451
|
},
|
|
483
452
|
extraReducers: function (builder) {
|
|
@@ -635,7 +604,7 @@ export var entitySlice = createSlice({
|
|
|
635
604
|
state.error = null;
|
|
636
605
|
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
637
606
|
var _b = data || {}, activityList = _b.activityList, rest = __rest(_b, ["activityList"]);
|
|
638
|
-
state.data.entityNameData = formData;
|
|
607
|
+
state.data.entityNameData = __assign(__assign({}, formData), { certificateId: undefined });
|
|
639
608
|
state.data.entityNameData.responseBody = __assign(__assign({}, state.data.entityNameData.responseBody), { rest: rest });
|
|
640
609
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: data === null || data === void 0 ? void 0 : data.entity, activityList: activityList });
|
|
641
610
|
if (rest === null || rest === void 0 ? void 0 : rest.activities)
|
|
@@ -644,20 +613,6 @@ export var entitySlice = createSlice({
|
|
|
644
613
|
.addCase(updateEntityName.rejected, function (state, action) {
|
|
645
614
|
state.loading = false;
|
|
646
615
|
state.error = action.error.message;
|
|
647
|
-
})
|
|
648
|
-
.addCase(uploadArticle.pending, function (state) {
|
|
649
|
-
state.uploadingArticleError = null;
|
|
650
|
-
state.uploadingArticle = true;
|
|
651
|
-
})
|
|
652
|
-
.addCase(uploadArticle.fulfilled, function (state, action) {
|
|
653
|
-
state.uploadingArticleError = null;
|
|
654
|
-
state.uploadingArticle = false;
|
|
655
|
-
var data = action.payload.data;
|
|
656
|
-
state.data.entityNameData.articleId = data === null || data === void 0 ? void 0 : data.id;
|
|
657
|
-
})
|
|
658
|
-
.addCase(uploadArticle.rejected, function (state) {
|
|
659
|
-
state.uploadingArticle = false;
|
|
660
|
-
state.uploadingArticleError = 'file_upload_article_error';
|
|
661
616
|
})
|
|
662
617
|
.addCase(updateEntityCapital.pending, function (state) {
|
|
663
618
|
state.loading = true;
|
|
@@ -711,6 +666,6 @@ export var entitySlice = createSlice({
|
|
|
711
666
|
});
|
|
712
667
|
}
|
|
713
668
|
});
|
|
714
|
-
export var clearError = (_a = entitySlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, uploadingStatus = _a.uploadingStatus,
|
|
669
|
+
export var clearError = (_a = entitySlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, uploadingStatus = _a.uploadingStatus, uploadingArticleStatus = _a.uploadingArticleStatus;
|
|
715
670
|
export default entitySlice.reducer;
|
|
716
671
|
export var entitySelector = function (state) { return state.entity; };
|
|
@@ -7,6 +7,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
7
7
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
8
8
|
import { DocumentPurpose } from '../../../../@types';
|
|
9
9
|
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
10
|
+
import { FileType } from '../../../../constants';
|
|
10
11
|
import { bankSelector, bankStatementUploadingStatus } from '../../../app/bank/bankStore';
|
|
11
12
|
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
12
13
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
@@ -31,6 +32,6 @@ var BankStatement = function (_a) {
|
|
|
31
32
|
bankStatementIdControl.field.onChange(ids);
|
|
32
33
|
};
|
|
33
34
|
var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(document ? [document] : [], DocumentPurpose.BANK_STATEMENT); }, [document]);
|
|
34
|
-
return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'bankStatementId', control: control, 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, isSubmitting: loading, required: required, onDeleteFile: handleReset, purpose: DocumentPurpose.BANK_STATEMENT, defaultFiles: defaultFiles, maxLimit: 4, fileUploadingStatus: function (uploading) { return dispatch(bankStatementUploadingStatus(uploading)); } }) }));
|
|
35
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'bankStatementId', control: control, 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, isSubmitting: loading, required: required, onDeleteFile: handleReset, purpose: DocumentPurpose.BANK_STATEMENT, defaultFiles: defaultFiles, maxLimit: 4, fileUploadingStatus: function (uploading) { return dispatch(bankStatementUploadingStatus(uploading)); }, fileType: FileType.FILES }) }));
|
|
35
36
|
};
|
|
36
37
|
export default BankStatement;
|
|
@@ -17,7 +17,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
17
17
|
import { useController, useFormContext } from 'react-hook-form';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { businessSelector, clearArticleId, uploadArticle } from '../../../app/business/businessStore';
|
|
20
|
-
import UploadFile from '../../../shared/UploadFile';
|
|
20
|
+
import { UploadFile } from '../../../shared/UploadFile';
|
|
21
21
|
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
22
22
|
import { maskFileName } from '../../../../utils';
|
|
23
23
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -14,6 +14,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
14
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
15
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
16
|
import { DocumentPurpose } from '../../../../@types';
|
|
17
|
+
import { FileType } from '../../../../constants';
|
|
17
18
|
import { styled } from '@mui/material/styles';
|
|
18
19
|
import Collapse from '../../../../components/Collapse';
|
|
19
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -38,6 +39,6 @@ var LicenseCertificate = function (_a) {
|
|
|
38
39
|
var handleReset = function (ids) {
|
|
39
40
|
certificateIdControl.field.onChange(ids);
|
|
40
41
|
};
|
|
41
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'certificateId', control: control, 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: DocumentPurpose.CR, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); } }) }) })));
|
|
42
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'certificateId', control: control, 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: DocumentPurpose.CR, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }) })));
|
|
42
43
|
};
|
|
43
44
|
export default LicenseCertificate;
|
|
@@ -10,17 +10,15 @@ 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
13
|
import { useTranslation } from 'react-i18next';
|
|
15
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
15
|
import { styled } from '@mui/material/styles';
|
|
17
|
-
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
18
|
-
import { maskFileName } from '../../../../utils';
|
|
19
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
|
+
import { DocumentPurpose } from '../../../../@types';
|
|
20
18
|
import Collapse from '../../../../components/Collapse';
|
|
21
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
20
|
+
import { UploadWrapper } from '../../../shared/UploadFile';
|
|
21
|
+
import { entitySelector, uploadingArticleStatus } from '../../../app/entity/entityStore';
|
|
24
22
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
25
23
|
var theme = _a.theme;
|
|
26
24
|
return ({
|
|
@@ -28,60 +26,21 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
28
26
|
});
|
|
29
27
|
});
|
|
30
28
|
var Article = function (_a) {
|
|
29
|
+
var _b, _c;
|
|
31
30
|
var show = _a.show;
|
|
32
|
-
var _b = React.useState(), error = _b[0], setError = _b[1];
|
|
33
|
-
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
34
31
|
var t = useTranslation().t;
|
|
35
|
-
var
|
|
36
|
-
var articleFileControl = useController({ name: 'articleFile', control: control });
|
|
32
|
+
var control = useFormContext().control;
|
|
37
33
|
var articleIdControl = useController({ name: 'articleId', control: control });
|
|
38
|
-
var
|
|
34
|
+
var loading = useAppSelector(entitySelector).loading;
|
|
39
35
|
var dispatch = useAppDispatch();
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
React.useEffect(function () {
|
|
44
|
-
if (!articleValue) {
|
|
45
|
-
setValue('articleFile', articleFile);
|
|
46
|
-
setValue('articleId', articleId);
|
|
47
|
-
}
|
|
48
|
-
}, [articleFile, articleId]);
|
|
49
|
-
var handleArticleChange = function (files) {
|
|
50
|
-
setError('');
|
|
51
|
-
var file = files === null || files === void 0 ? void 0 : files[0];
|
|
52
|
-
if (!file)
|
|
53
|
-
return;
|
|
54
|
-
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
55
|
-
setError('file_not_supported_alert');
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
59
|
-
setError('file_size_alert');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
articleFileControl.field.onChange(file);
|
|
63
|
-
dispatch(uploadArticle({
|
|
64
|
-
file: file,
|
|
65
|
-
onProgress: function (value) {
|
|
66
|
-
setProgress(value);
|
|
67
|
-
}
|
|
68
|
-
}));
|
|
36
|
+
var data = useAppSelector(entitySelector).data;
|
|
37
|
+
var handleArticleChange = function (id) {
|
|
38
|
+
articleIdControl.field.onChange(id);
|
|
69
39
|
};
|
|
70
40
|
var handleReset = function () {
|
|
71
|
-
|
|
72
|
-
articleIdControl.field.onChange('');
|
|
73
|
-
dispatch(clearArticleId());
|
|
74
|
-
setProgress(0);
|
|
41
|
+
articleIdControl.field.onChange(undefined);
|
|
75
42
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
setError(sysError);
|
|
79
|
-
articleFileControl.field.onChange(undefined);
|
|
80
|
-
setProgress(0);
|
|
81
|
-
}
|
|
82
|
-
}, [sysError]);
|
|
83
|
-
var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
|
|
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 }) }) })));
|
|
43
|
+
var defaultFile = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.AOA_file;
|
|
44
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'articleId', control: control, 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, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.ARTICLE_ASSOCIATION, fileUploadingStatus: function (uploading) { return dispatch(uploadingArticleStatus(uploading)); } }) }) })));
|
|
86
45
|
};
|
|
87
46
|
export default Article;
|
|
@@ -46,7 +46,7 @@ var EntityName = function (_a) {
|
|
|
46
46
|
var isAr = useLanguage().isAr;
|
|
47
47
|
var t = useTranslation().t;
|
|
48
48
|
var dispatch = useAppDispatch();
|
|
49
|
-
var _f = data.entityNameData, legalName = _f.legalName, licenseNumber = _f.licenseNumber, licenseType = _f.licenseType, entityType = _f.entityType, issuingDate = _f.issuingDate, expiryDate = _f.expiryDate, unifiedNumber = _f.unifiedNumber, certificateId = _f.certificateId, articleId = _f.articleId
|
|
49
|
+
var _f = data.entityNameData, legalName = _f.legalName, licenseNumber = _f.licenseNumber, licenseType = _f.licenseType, entityType = _f.entityType, issuingDate = _f.issuingDate, expiryDate = _f.expiryDate, unifiedNumber = _f.unifiedNumber, certificateId = _f.certificateId, articleId = _f.articleId;
|
|
50
50
|
var country_code = settingsData.businessCountry.iso2;
|
|
51
51
|
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
52
52
|
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
@@ -63,8 +63,7 @@ var EntityName = function (_a) {
|
|
|
63
63
|
expiryDate: expiryDate,
|
|
64
64
|
unifiedNumber: unifiedNumber,
|
|
65
65
|
certificateId: certificateId,
|
|
66
|
-
articleId: articleId
|
|
67
|
-
articleFile: articleFile
|
|
66
|
+
articleId: articleId
|
|
68
67
|
},
|
|
69
68
|
mode: 'onChange'
|
|
70
69
|
});
|
|
@@ -16,6 +16,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import Collapse from '../../../../components/Collapse';
|
|
18
18
|
import { DocumentPurpose } from '../../../../@types';
|
|
19
|
+
import { FileType } from '../../../../constants';
|
|
19
20
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
20
21
|
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
21
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -43,6 +44,6 @@ var LicenseCertificate = function (_a) {
|
|
|
43
44
|
certificateIdControl.field.onChange(ids);
|
|
44
45
|
};
|
|
45
46
|
var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.CR); }, [documents]);
|
|
46
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'certificateId', control: control, 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, defaultFiles: defaultFiles, purpose: DocumentPurpose.CR, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); } }) }) })));
|
|
47
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'certificateId', control: control, 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, defaultFiles: defaultFiles, purpose: DocumentPurpose.CR, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }) })));
|
|
47
48
|
};
|
|
48
49
|
export default LicenseCertificate;
|
|
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
6
|
import { useController, useFormContext } from 'react-hook-form';
|
|
7
7
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
8
8
|
import { DocumentPurpose } from '../../../../@types';
|
|
9
|
+
import { FileType } from '../../../../constants';
|
|
9
10
|
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
10
11
|
import { civilIDUploadingStatus, individualSelector } from '../../../app/individual/individualStore';
|
|
11
12
|
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
@@ -30,6 +31,6 @@ var CivilIDFile = function () {
|
|
|
30
31
|
civilIDFileIdControl.field.onChange(ids);
|
|
31
32
|
};
|
|
32
33
|
var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.IDENTITY_DOCUMENT); }, [documents]);
|
|
33
|
-
return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'civilID', control: control, 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, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); } }) }));
|
|
34
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'civilID', control: control, 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, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }));
|
|
34
35
|
};
|
|
35
36
|
export default CivilIDFile;
|
|
@@ -16,6 +16,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
18
|
import { DocumentPurpose } from '../../../../@types';
|
|
19
|
+
import { FileType } from '../../../../constants';
|
|
19
20
|
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
20
21
|
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
21
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -43,6 +44,6 @@ var SignatureFile = function (_a) {
|
|
|
43
44
|
signatureFileIdControl.field.onChange(ids);
|
|
44
45
|
};
|
|
45
46
|
var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.CUSTOMER_SIGNATURE); }, [documents]);
|
|
46
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'signatureFileId', control: control, 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, defaultFiles: defaultFiles, purpose: DocumentPurpose.CUSTOMER_SIGNATURE, fileUploadingStatus: function (uploading) { return dispatch(signatureFileUploadingStatus(uploading)); } }) }) })));
|
|
47
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'signatureFileId', control: control, 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, defaultFiles: defaultFiles, purpose: DocumentPurpose.CUSTOMER_SIGNATURE, fileUploadingStatus: function (uploading) { return dispatch(signatureFileUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }) })));
|
|
47
48
|
};
|
|
48
49
|
export default SignatureFile;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { FileInfo } from '../../../constants';
|
|
4
|
+
export declare const InputContainerStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
component?: React.ElementType<any> | undefined;
|
|
7
|
+
ref?: React.Ref<unknown> | undefined;
|
|
8
|
+
sx?: SxProps<Theme> | undefined;
|
|
9
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
11
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "ref" | "children" | "component" | "sx"> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
12
|
+
export declare type FileUploadProps = {
|
|
13
|
+
key?: string;
|
|
14
|
+
show: boolean;
|
|
15
|
+
purpose: string;
|
|
16
|
+
file: File;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
title?: string;
|
|
19
|
+
uploadedFile: FileInfo;
|
|
20
|
+
onSuccess: (file: FileInfo) => void;
|
|
21
|
+
onDelete: () => void;
|
|
22
|
+
onUpdate: (file: FileInfo, loadingStatus: boolean) => void;
|
|
23
|
+
sx?: SxProps<Theme> | undefined;
|
|
24
|
+
isSubmitting?: boolean;
|
|
25
|
+
};
|
|
26
|
+
declare const FileUpload: ({ key, show, title, file, uploadedFile, onSuccess, onDelete, onUpdate, sx, purpose, isSubmitting }: FileUploadProps) => JSX.Element;
|
|
27
|
+
export default FileUpload;
|