@tap-payments/auth-jsconnect 2.1.32-test → 2.1.34-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 +6 -6
- package/build/api/entity.d.ts +3 -1
- package/build/api/individual.d.ts +2 -1
- package/build/features/app/business/businessStore.d.ts +3 -1
- package/build/features/app/business/businessStore.js +30 -26
- package/build/features/app/individual/individualStore.d.ts +2 -0
- package/build/features/app/individual/individualStore.js +50 -28
- package/build/features/business/screens/BusinessType/Article.js +4 -3
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +4 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +18 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +15 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -1
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
|
@@ -51,8 +51,8 @@ export declare type BusinessTypeFormValues = {
|
|
|
51
51
|
licenseNumber: string;
|
|
52
52
|
entityLegalName?: string;
|
|
53
53
|
selectedLicense?: License;
|
|
54
|
-
certificateId?:
|
|
55
|
-
certificateFile?:
|
|
54
|
+
certificateId?: string;
|
|
55
|
+
certificateFile?: File;
|
|
56
56
|
articleId?: string;
|
|
57
57
|
articleFile?: File;
|
|
58
58
|
};
|
|
@@ -80,7 +80,7 @@ export declare type TaxFormValues = {
|
|
|
80
80
|
vatId: string;
|
|
81
81
|
confirmPolicy: false;
|
|
82
82
|
};
|
|
83
|
-
export
|
|
83
|
+
export interface IndividualExtraFormValues extends IndividualAttachmentsFormValues {
|
|
84
84
|
occupation: Occupation | undefined;
|
|
85
85
|
sourceIncome: SourceOfIncome | undefined;
|
|
86
86
|
monthlyIncome: MonthlyIncome | undefined;
|
|
@@ -88,12 +88,12 @@ export declare type IndividualExtraFormValues = {
|
|
|
88
88
|
employerLocation: CountryCode | undefined;
|
|
89
89
|
isPEP: boolean | null;
|
|
90
90
|
isInfluencer: boolean | null;
|
|
91
|
-
}
|
|
91
|
+
}
|
|
92
92
|
export declare type IndividualAttachmentsFormValues = {
|
|
93
93
|
civilID?: string;
|
|
94
|
-
civilIDFile?:
|
|
94
|
+
civilIDFile?: File;
|
|
95
95
|
signatureFileId?: string;
|
|
96
|
-
signatureFile?:
|
|
96
|
+
signatureFile?: File;
|
|
97
97
|
civilIDUploading?: boolean;
|
|
98
98
|
signatureFileUploading?: boolean;
|
|
99
99
|
};
|
package/build/api/entity.d.ts
CHANGED
|
@@ -109,7 +109,9 @@ export declare type DocumentInfo = {
|
|
|
109
109
|
images: Array<string>;
|
|
110
110
|
};
|
|
111
111
|
export declare type DocumentUpdateBody = {
|
|
112
|
-
entity_id
|
|
112
|
+
entity_id?: boolean;
|
|
113
|
+
individual_type_id?: number;
|
|
114
|
+
country?: string;
|
|
113
115
|
documents: Array<DocumentInfo>;
|
|
114
116
|
};
|
|
115
117
|
declare const entityService: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DocumentInfo } from '../api/entity';
|
|
1
2
|
export declare type BrandListBody = {
|
|
2
3
|
individual_id: string;
|
|
3
4
|
};
|
|
@@ -79,7 +80,7 @@ export declare type UpdateIndividualBody = {
|
|
|
79
80
|
};
|
|
80
81
|
is_relative_PEP?: boolean | null;
|
|
81
82
|
is_influencer?: boolean | null;
|
|
82
|
-
documents?: Array<
|
|
83
|
+
documents?: Array<DocumentInfo | undefined>;
|
|
83
84
|
occupation?: {
|
|
84
85
|
id?: string;
|
|
85
86
|
};
|
|
@@ -121,8 +121,10 @@ export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessSta
|
|
|
121
121
|
clearError: (state: BusinessState) => void;
|
|
122
122
|
stopLoader: (state: BusinessState) => void;
|
|
123
123
|
resetOTPScreen: (state: BusinessState) => void;
|
|
124
|
+
clearCertificateId: (state: BusinessState) => void;
|
|
125
|
+
clearArticleId: (state: BusinessState) => void;
|
|
124
126
|
}, "business/store">;
|
|
125
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
127
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearCertificateId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearArticleId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
126
128
|
declare const _default: import("redux").Reducer<BusinessState, import("redux").AnyAction>;
|
|
127
129
|
export default _default;
|
|
128
130
|
export declare const businessSelector: (state: RootState) => BusinessState;
|
|
@@ -56,7 +56,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
56
56
|
};
|
|
57
57
|
var _a;
|
|
58
58
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
59
|
-
import moment from 'moment';
|
|
60
59
|
import API from '../../../api';
|
|
61
60
|
import { BusinessType, FlowsTypes } from '../../../@types';
|
|
62
61
|
import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
@@ -452,36 +451,36 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
|
|
|
452
451
|
});
|
|
453
452
|
}); });
|
|
454
453
|
export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
455
|
-
var _a, settings, business, isNonSA, isFL, payload, data, entity_activities, list, accountBody, accountData, documentData, entityData, entityId, articleId, documentBody, payload_1;
|
|
456
|
-
var
|
|
457
|
-
return __generator(this, function (
|
|
458
|
-
switch (
|
|
454
|
+
var _a, settings, business, isNonSA, isFL, payload, data, entity_activities, list, accountBody, accountData, documentData, entityData, entityId, _b, articleId, certificateId, documentBody, payload_1;
|
|
455
|
+
var _c, _d, _e, _f, _g, _h;
|
|
456
|
+
return __generator(this, function (_j) {
|
|
457
|
+
switch (_j.label) {
|
|
459
458
|
case 0:
|
|
460
459
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
461
460
|
isNonSA = !isSA(settings.data.businessCountry.iso2);
|
|
462
|
-
isFL = ((
|
|
461
|
+
isFL = ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL;
|
|
463
462
|
payload = {
|
|
464
|
-
id: ((
|
|
463
|
+
id: ((_d = business.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
|
|
465
464
|
license_number: isNonSA && isFL ? '' : params.licenseNumber,
|
|
466
465
|
license_type: isFL ? 'freelance' : 'commercial_registration',
|
|
467
|
-
business_type: (
|
|
466
|
+
business_type: (_e = params.selectedLicense) === null || _e === void 0 ? void 0 : _e.type,
|
|
468
467
|
step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
|
|
469
468
|
business: isNonSA && isFL ? undefined : { ar: params.entityLegalName, en: params.entityLegalName },
|
|
470
469
|
encryption_contract: ['license_number', 'business_type', 'license_type']
|
|
471
470
|
};
|
|
472
471
|
return [4, API.leadService.updateLead(payload)];
|
|
473
472
|
case 1:
|
|
474
|
-
data =
|
|
473
|
+
data = _j.sent();
|
|
475
474
|
entity_activities = data.entity_activities;
|
|
476
475
|
if (!!entity_activities) return [3, 3];
|
|
477
476
|
return [4, API.dataService.getActivities()];
|
|
478
477
|
case 2:
|
|
479
|
-
list = (
|
|
478
|
+
list = (_j.sent()).list;
|
|
480
479
|
data.entity_activities = list;
|
|
481
|
-
|
|
480
|
+
_j.label = 3;
|
|
482
481
|
case 3:
|
|
483
482
|
accountBody = {
|
|
484
|
-
lead_id: (
|
|
483
|
+
lead_id: (_f = business.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.lead_id,
|
|
485
484
|
notify: {
|
|
486
485
|
email: false,
|
|
487
486
|
phone: false
|
|
@@ -492,23 +491,23 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
492
491
|
};
|
|
493
492
|
return [4, API.accountService.createAccount(accountBody)];
|
|
494
493
|
case 4:
|
|
495
|
-
accountData =
|
|
494
|
+
accountData = _j.sent();
|
|
496
495
|
entityData = undefined;
|
|
497
496
|
entityId = accountData === null || accountData === void 0 ? void 0 : accountData.entity_id;
|
|
498
|
-
|
|
499
|
-
if (!
|
|
497
|
+
_b = business.data.businessTypeData, articleId = _b.articleId, certificateId = _b.certificateId;
|
|
498
|
+
if (!certificateId) return [3, 6];
|
|
500
499
|
documentBody = {
|
|
501
500
|
entity_id: entityId || '',
|
|
502
501
|
documents: [
|
|
503
502
|
{
|
|
504
|
-
images:
|
|
503
|
+
images: [certificateId]
|
|
505
504
|
}
|
|
506
505
|
]
|
|
507
506
|
};
|
|
508
507
|
return [4, API.entityService.updateDocumentInfo(documentBody)];
|
|
509
508
|
case 5:
|
|
510
|
-
documentData =
|
|
511
|
-
|
|
509
|
+
documentData = _j.sent();
|
|
510
|
+
_j.label = 6;
|
|
512
511
|
case 6:
|
|
513
512
|
if (!(articleId && entityId)) return [3, 8];
|
|
514
513
|
payload_1 = {
|
|
@@ -517,11 +516,11 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
517
516
|
};
|
|
518
517
|
return [4, API.entityService.updateEntity(payload_1)];
|
|
519
518
|
case 7:
|
|
520
|
-
entityData =
|
|
521
|
-
|
|
519
|
+
entityData = _j.sent();
|
|
520
|
+
_j.label = 8;
|
|
522
521
|
case 8:
|
|
523
522
|
thunkApi.dispatch(handleNextScreenStep());
|
|
524
|
-
(
|
|
523
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, params);
|
|
525
524
|
return [2, { data: data, formData: params, accountData: accountData, documentData: documentData, entityData: entityData }];
|
|
526
525
|
}
|
|
527
526
|
});
|
|
@@ -789,6 +788,12 @@ export var businessSlice = createSlice({
|
|
|
789
788
|
},
|
|
790
789
|
resetOTPScreen: function (state) {
|
|
791
790
|
state.data.otpData.otp = '';
|
|
791
|
+
},
|
|
792
|
+
clearCertificateId: function (state) {
|
|
793
|
+
state.data.businessTypeData.certificateId = '';
|
|
794
|
+
},
|
|
795
|
+
clearArticleId: function (state) {
|
|
796
|
+
state.data.businessTypeData.articleId = '';
|
|
792
797
|
}
|
|
793
798
|
},
|
|
794
799
|
extraReducers: function (builder) {
|
|
@@ -810,7 +815,7 @@ export var businessSlice = createSlice({
|
|
|
810
815
|
if (isRequireOTP)
|
|
811
816
|
return;
|
|
812
817
|
var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
|
|
813
|
-
var issuingDate = (brandData === null || brandData === void 0 ? void 0 : brandData.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date);
|
|
818
|
+
var issuingDate = (brandData === null || brandData === void 0 ? void 0 : brandData.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date) || new Date().getTime();
|
|
814
819
|
if (issuingDate)
|
|
815
820
|
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
816
821
|
var activities = entity_activities || [];
|
|
@@ -877,7 +882,7 @@ export var businessSlice = createSlice({
|
|
|
877
882
|
state.data.otpData.responseBody = data;
|
|
878
883
|
state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
|
|
879
884
|
var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
|
|
880
|
-
var issuingDate = (brand === null || brand === void 0 ? void 0 : brand.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date);
|
|
885
|
+
var issuingDate = (brand === null || brand === void 0 ? void 0 : brand.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date) || new Date().getTime();
|
|
881
886
|
if (issuingDate)
|
|
882
887
|
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
883
888
|
var activities = entity_activities || [];
|
|
@@ -1060,8 +1065,7 @@ export var businessSlice = createSlice({
|
|
|
1060
1065
|
return;
|
|
1061
1066
|
}
|
|
1062
1067
|
if (issuingDate) {
|
|
1063
|
-
|
|
1064
|
-
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
1068
|
+
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
1065
1069
|
}
|
|
1066
1070
|
var activities = entity_activities || [];
|
|
1067
1071
|
state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
|
|
@@ -1181,6 +1185,6 @@ export var businessSlice = createSlice({
|
|
|
1181
1185
|
});
|
|
1182
1186
|
}
|
|
1183
1187
|
});
|
|
1184
|
-
export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
1188
|
+
export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, clearCertificateId = _a.clearCertificateId, clearArticleId = _a.clearArticleId;
|
|
1185
1189
|
export default businessSlice.reducer;
|
|
1186
1190
|
export var businessSelector = function (state) { return state.business; };
|
|
@@ -68,9 +68,11 @@ interface UploadFileParams {
|
|
|
68
68
|
}
|
|
69
69
|
export declare const uploadCivilIdFile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
70
70
|
data: any;
|
|
71
|
+
file: File;
|
|
71
72
|
}, UploadFileParams, {}>;
|
|
72
73
|
export declare const uploadSignatureFile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
73
74
|
data: any;
|
|
75
|
+
file: File;
|
|
74
76
|
}, UploadFileParams, {}>;
|
|
75
77
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
76
78
|
response: any;
|
|
@@ -275,38 +275,48 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
275
275
|
});
|
|
276
276
|
}); });
|
|
277
277
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
278
|
-
var _a, settings, individual, _b, id, type,
|
|
279
|
-
var _d, _e, _f, _g, _h, _j, _k
|
|
280
|
-
return __generator(this, function (
|
|
281
|
-
switch (
|
|
278
|
+
var _a, settings, individual, _b, id, type, civilID, signatureFileId, businessCountry, documentsList, requestBody, documentBody, data;
|
|
279
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
280
|
+
return __generator(this, function (_l) {
|
|
281
|
+
switch (_l.label) {
|
|
282
282
|
case 0:
|
|
283
283
|
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
284
|
-
_b = ((
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
_b = ((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id = _b.id, type = _b.type;
|
|
285
|
+
civilID = params.civilID, signatureFileId = params.signatureFileId;
|
|
286
|
+
businessCountry = settings.data.businessCountry;
|
|
287
|
+
documentsList = [];
|
|
287
288
|
if (!!civilID)
|
|
288
|
-
|
|
289
|
+
documentsList.push({ type: 'Civil ID File', images: [civilID] });
|
|
289
290
|
if (!!signatureFileId)
|
|
290
|
-
|
|
291
|
+
documentsList.push({ type: 'Signature File', images: [signatureFileId] });
|
|
291
292
|
requestBody = {
|
|
292
293
|
id: id,
|
|
293
294
|
type: type,
|
|
294
|
-
occupation: { id: (
|
|
295
|
+
occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
|
|
295
296
|
employer_name: params.employerName,
|
|
296
|
-
employer_country: (
|
|
297
|
-
source_income: [{ id: (
|
|
298
|
-
monthly_income: { id: (
|
|
297
|
+
employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
|
|
298
|
+
source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
|
|
299
|
+
monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
|
|
299
300
|
is_relative_PEP: params.isPEP,
|
|
300
301
|
is_influencer: params.isInfluencer,
|
|
301
|
-
documents: documentBody,
|
|
302
302
|
encryption_contract: ['employer_name', 'employer_country'],
|
|
303
303
|
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
|
|
304
304
|
};
|
|
305
|
-
|
|
305
|
+
documentBody = {
|
|
306
|
+
individual_type_id: id || '',
|
|
307
|
+
country: businessCountry.iso2,
|
|
308
|
+
documents: documentsList
|
|
309
|
+
};
|
|
310
|
+
if (!(documentsList.length > 0)) return [3, 2];
|
|
311
|
+
return [4, API.entityService.updateDocumentInfo(documentBody)];
|
|
306
312
|
case 1:
|
|
307
|
-
|
|
313
|
+
_l.sent();
|
|
314
|
+
_l.label = 2;
|
|
315
|
+
case 2: return [4, API.individualService.updateIndividual(requestBody)];
|
|
316
|
+
case 3:
|
|
317
|
+
data = (_l.sent()).data;
|
|
308
318
|
thunkApi.dispatch(handleNextScreenStep());
|
|
309
|
-
(
|
|
319
|
+
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
|
|
310
320
|
return [2, { data: data, formData: params }];
|
|
311
321
|
}
|
|
312
322
|
});
|
|
@@ -331,7 +341,7 @@ export var uploadCivilIdFile = createAsyncThunk('uploadCivilIdFile', function (_
|
|
|
331
341
|
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
332
342
|
case 1:
|
|
333
343
|
data = _b.sent();
|
|
334
|
-
return [2, { data: data }];
|
|
344
|
+
return [2, { data: data, file: file }];
|
|
335
345
|
}
|
|
336
346
|
});
|
|
337
347
|
});
|
|
@@ -356,7 +366,7 @@ export var uploadSignatureFile = createAsyncThunk('uploadSignatureFile', functio
|
|
|
356
366
|
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
357
367
|
case 1:
|
|
358
368
|
data = _b.sent();
|
|
359
|
-
return [2, { data: data }];
|
|
369
|
+
return [2, { data: data, file: file }];
|
|
360
370
|
}
|
|
361
371
|
});
|
|
362
372
|
});
|
|
@@ -462,6 +472,14 @@ export var individualSlice = createSlice({
|
|
|
462
472
|
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
463
473
|
state.data.individualData.employerLocation = employerLocation;
|
|
464
474
|
}
|
|
475
|
+
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
476
|
+
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
477
|
+
});
|
|
478
|
+
var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
|
|
479
|
+
return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
|
|
480
|
+
});
|
|
481
|
+
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
482
|
+
state.data.individualData.occupation = selectedOccupation;
|
|
465
483
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
466
484
|
state.data.individualData.isInfluencer = is_influencer;
|
|
467
485
|
})
|
|
@@ -515,6 +533,14 @@ export var individualSlice = createSlice({
|
|
|
515
533
|
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
516
534
|
state.data.individualData.employerLocation = employerLocation;
|
|
517
535
|
}
|
|
536
|
+
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
537
|
+
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
538
|
+
});
|
|
539
|
+
var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
|
|
540
|
+
return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
|
|
541
|
+
});
|
|
542
|
+
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
543
|
+
state.data.individualData.occupation = selectedOccupation;
|
|
518
544
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
519
545
|
state.data.individualData.isInfluencer = is_influencer;
|
|
520
546
|
})
|
|
@@ -542,15 +568,9 @@ export var individualSlice = createSlice({
|
|
|
542
568
|
state.error = null;
|
|
543
569
|
})
|
|
544
570
|
.addCase(updateIndividualInfo.fulfilled, function (state, action) {
|
|
545
|
-
var _a;
|
|
546
571
|
state.loading = false;
|
|
547
572
|
state.error = null;
|
|
548
|
-
var
|
|
549
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
550
|
-
if (description) {
|
|
551
|
-
state.error = description;
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
573
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
554
574
|
state.data.individualData = formData;
|
|
555
575
|
state.data.individualData.responseBody = data;
|
|
556
576
|
})
|
|
@@ -580,8 +600,9 @@ export var individualSlice = createSlice({
|
|
|
580
600
|
.addCase(uploadCivilIdFile.fulfilled, function (state, action) {
|
|
581
601
|
state.error = null;
|
|
582
602
|
state.data.attachmentsData.civilIDUploading = false;
|
|
583
|
-
var
|
|
603
|
+
var _a = action.payload, data = _a.data, file = _a.file;
|
|
584
604
|
state.data.attachmentsData.civilID = data === null || data === void 0 ? void 0 : data.id;
|
|
605
|
+
state.data.attachmentsData.civilIDFile = file;
|
|
585
606
|
})
|
|
586
607
|
.addCase(uploadCivilIdFile.rejected, function (state) {
|
|
587
608
|
state.data.attachmentsData.civilIDUploading = false;
|
|
@@ -594,8 +615,9 @@ export var individualSlice = createSlice({
|
|
|
594
615
|
.addCase(uploadSignatureFile.fulfilled, function (state, action) {
|
|
595
616
|
state.error = null;
|
|
596
617
|
state.data.attachmentsData.signatureFileUploading = false;
|
|
597
|
-
var
|
|
618
|
+
var _a = action.payload, data = _a.data, file = _a.file;
|
|
598
619
|
state.data.attachmentsData.signatureFileId = data === null || data === void 0 ? void 0 : data.id;
|
|
620
|
+
state.data.attachmentsData.signatureFile = file;
|
|
599
621
|
})
|
|
600
622
|
.addCase(uploadSignatureFile.rejected, function (state) {
|
|
601
623
|
state.data.attachmentsData.signatureFileUploading = false;
|
|
@@ -16,7 +16,7 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { useController, useFormContext } from 'react-hook-form';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
-
import { businessSelector, uploadArticle } from '../../../app/business/businessStore';
|
|
19
|
+
import { businessSelector, clearArticleId, uploadArticle } from '../../../app/business/businessStore';
|
|
20
20
|
import UploadFile from '../../../shared/UploadFile';
|
|
21
21
|
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
22
22
|
import { maskFileName } from '../../../../utils';
|
|
@@ -68,14 +68,15 @@ var Article = function (_a) {
|
|
|
68
68
|
}));
|
|
69
69
|
};
|
|
70
70
|
var handleReset = function () {
|
|
71
|
-
articleFileControl.field.onChange(
|
|
71
|
+
articleFileControl.field.onChange(undefined);
|
|
72
72
|
articleIdControl.field.onChange('');
|
|
73
|
+
dispatch(clearArticleId());
|
|
73
74
|
setProgress(0);
|
|
74
75
|
};
|
|
75
76
|
React.useEffect(function () {
|
|
76
77
|
if (sysError === 'file_upload_error') {
|
|
77
78
|
setError('articleId', { message: sysError });
|
|
78
|
-
articleFileControl.field.onChange(
|
|
79
|
+
articleFileControl.field.onChange(undefined);
|
|
79
80
|
setProgress(0);
|
|
80
81
|
}
|
|
81
82
|
}, [sysError]);
|
|
@@ -16,7 +16,7 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { useController, useFormContext } from 'react-hook-form';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
-
import { businessSelector, uploadLicenseCertificate } from '../../../app/business/businessStore';
|
|
19
|
+
import { businessSelector, clearCertificateId, uploadLicenseCertificate } from '../../../app/business/businessStore';
|
|
20
20
|
import UploadFile from '../../../shared/UploadFile';
|
|
21
21
|
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
22
22
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -59,14 +59,15 @@ var LicenseCertificate = function (_a) {
|
|
|
59
59
|
}));
|
|
60
60
|
};
|
|
61
61
|
var handleReset = function () {
|
|
62
|
-
certificateFileControl.field.onChange(
|
|
62
|
+
certificateFileControl.field.onChange(undefined);
|
|
63
63
|
certificateIdControl.field.onChange('');
|
|
64
|
+
dispatch(clearCertificateId());
|
|
64
65
|
setProgress(0);
|
|
65
66
|
};
|
|
66
67
|
React.useEffect(function () {
|
|
67
68
|
if (sysError === 'file_upload_error') {
|
|
68
69
|
setError('certificateId', { message: sysError });
|
|
69
|
-
certificateFileControl.field.onChange(
|
|
70
|
+
certificateFileControl.field.onChange(undefined);
|
|
70
71
|
setProgress(0);
|
|
71
72
|
}
|
|
72
73
|
}, [sysError]);
|
|
@@ -8,6 +8,7 @@ import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
|
8
8
|
import { individualSelector, uploadCivilIdFile } from '../../../../features/app/individual/individualStore';
|
|
9
9
|
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
10
10
|
import UploadFile from '../../../../features/shared/UploadFile';
|
|
11
|
+
import { maskFileName } from '../../../../utils';
|
|
11
12
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
12
13
|
var theme = _a.theme;
|
|
13
14
|
return ({
|
|
@@ -18,11 +19,11 @@ var CivilIDFile = function () {
|
|
|
18
19
|
var _a, _b;
|
|
19
20
|
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
20
21
|
var t = useTranslation().t;
|
|
21
|
-
var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors;
|
|
22
|
+
var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors, setValue = _d.setValue;
|
|
22
23
|
var civilIDFileControl = useController({ name: 'civilIDFile', control: control });
|
|
23
|
-
var civilIDFileIdControl = useController({ name: '
|
|
24
|
+
var civilIDFileIdControl = useController({ name: 'civilID', control: control });
|
|
24
25
|
var _e = useAppSelector(individualSelector), data = _e.data, loading = _e.loading, sysError = _e.error;
|
|
25
|
-
var
|
|
26
|
+
var _f = data.attachmentsData, civilIDUploading = _f.civilIDUploading, civilIDFile = _f.civilIDFile, civilID = _f.civilID;
|
|
26
27
|
var dispatch = useAppDispatch();
|
|
27
28
|
var civilIDValue = civilIDFileControl.field.value;
|
|
28
29
|
var error = ((_a = civilIDFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = civilIDFileIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
|
|
@@ -51,6 +52,12 @@ var CivilIDFile = function () {
|
|
|
51
52
|
civilIDFileIdControl.field.onChange('');
|
|
52
53
|
setProgress(0);
|
|
53
54
|
};
|
|
55
|
+
React.useEffect(function () {
|
|
56
|
+
if (!!civilIDFile) {
|
|
57
|
+
setValue('civilIDFile', civilIDFile);
|
|
58
|
+
setValue('civilID', civilID);
|
|
59
|
+
}
|
|
60
|
+
}, [civilIDFile, civilID]);
|
|
54
61
|
React.useEffect(function () {
|
|
55
62
|
if (sysError === 'file_upload_error') {
|
|
56
63
|
setError('civilIDFileId', { message: sysError });
|
|
@@ -62,6 +69,13 @@ var CivilIDFile = function () {
|
|
|
62
69
|
if ((civilIDFileControl.formState.isValid || !!civilIDValue) && error != 'file_upload_error')
|
|
63
70
|
clearErrors();
|
|
64
71
|
}, [civilIDFileControl.formState.isValid, civilIDValue]);
|
|
65
|
-
|
|
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) }) }));
|
|
66
80
|
};
|
|
67
81
|
export default CivilIDFile;
|
|
@@ -91,7 +91,8 @@ var Occupation = function (_a) {
|
|
|
91
91
|
var occupation = occupationControl.field.value;
|
|
92
92
|
var error = (_c = occupationControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
93
93
|
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('occupation_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_occupation'), value: (isAr ? occupation === null || occupation === void 0 ? void 0 : occupation.name.ar : occupation === null || occupation === void 0 ? void 0 : occupation.name.en) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.en', list: occupationList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
94
|
-
|
|
94
|
+
var _a, _b;
|
|
95
|
+
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) }), item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id) && _jsx(CheckIconStyled, {})] }));
|
|
95
96
|
} })] }))] })) })));
|
|
96
97
|
};
|
|
97
98
|
export default Occupation;
|
|
@@ -20,6 +20,7 @@ import { individualSelector, uploadSignatureFile } from '../../../../features/ap
|
|
|
20
20
|
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
21
21
|
import UploadFile from '../../../../features/shared/UploadFile';
|
|
22
22
|
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import { maskFileName } from '../../../../utils';
|
|
23
24
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
24
25
|
var theme = _a.theme;
|
|
25
26
|
return ({
|
|
@@ -31,11 +32,11 @@ var SignatureFile = function (_a) {
|
|
|
31
32
|
var show = _a.show;
|
|
32
33
|
var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
|
|
33
34
|
var t = useTranslation().t;
|
|
34
|
-
var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors;
|
|
35
|
+
var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors, setValue = _e.setValue;
|
|
35
36
|
var signatureFileControl = useController({ name: 'signatureFile', control: control });
|
|
36
37
|
var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
|
|
37
38
|
var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading, sysError = _f.error;
|
|
38
|
-
var
|
|
39
|
+
var _g = data.attachmentsData, signatureFileUploading = _g.signatureFileUploading, signatureFile = _g.signatureFile, signatureFileId = _g.signatureFileId;
|
|
39
40
|
var dispatch = useAppDispatch();
|
|
40
41
|
var signatureValue = signatureFileControl.field.value;
|
|
41
42
|
var error = ((_b = signatureFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = signatureFileIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
|
|
@@ -73,6 +74,17 @@ var SignatureFile = function (_a) {
|
|
|
73
74
|
if ((signatureFileControl.formState.isValid || !!signatureValue) && error != 'file_upload_error')
|
|
74
75
|
clearErrors();
|
|
75
76
|
}, [signatureFileControl.formState.isValid, signatureValue]);
|
|
76
|
-
|
|
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) }) }) })));
|
|
77
89
|
};
|
|
78
90
|
export default SignatureFile;
|
|
@@ -6,7 +6,7 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
|
|
|
6
6
|
sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
7
7
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
8
8
|
employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
|
|
9
|
-
|
|
9
|
+
civilID: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
10
10
|
civilIDFile: any;
|
|
11
11
|
signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
12
|
signatureFile: any;
|
|
@@ -17,7 +17,7 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
|
|
|
17
17
|
sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
18
18
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
19
19
|
employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
|
|
20
|
-
|
|
20
|
+
civilID: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
21
21
|
civilIDFile: any;
|
|
22
22
|
signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
23
23
|
signatureFile: any;
|
|
@@ -28,7 +28,7 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
|
|
|
28
28
|
sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
29
29
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
30
30
|
employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
|
|
31
|
-
|
|
31
|
+
civilID: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
32
|
civilIDFile: any;
|
|
33
33
|
signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
34
34
|
signatureFile: any;
|