@tap-payments/auth-jsconnect 2.1.41-test → 2.1.42-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/app.d.ts +0 -4
- package/build/@types/form.d.ts +6 -3
- package/build/api/entity.d.ts +8 -0
- package/build/api/entity.js +15 -0
- package/build/api/index.d.ts +2 -6
- package/build/api/index.js +1 -3
- package/build/api/lead.d.ts +0 -4
- package/build/assets/locales/ar.json +1 -5
- package/build/assets/locales/en.json +1 -7
- package/build/components/FileInput/DragAndDrop.js +1 -1
- package/build/components/ProgressBar/CircularProgressBar.d.ts +1 -3
- package/build/components/ProgressBar/CircularProgressBar.js +2 -2
- package/build/constants/assets.d.ts +0 -1
- package/build/constants/assets.js +0 -1
- package/build/constants/validation.d.ts +0 -1
- package/build/constants/validation.js +0 -1
- package/build/features/app/bank/bankStore.js +1 -1
- package/build/features/app/business/businessStore.d.ts +9 -7
- package/build/features/app/business/businessStore.js +67 -29
- package/build/features/app/connect/connectStore.d.ts +1 -1
- package/build/features/app/connect/connectStore.js +29 -66
- package/build/features/app/individual/individualStore.d.ts +16 -4
- package/build/features/app/individual/individualStore.js +89 -11
- package/build/features/business/screens/BusinessType/Article.js +13 -10
- package/build/features/business/screens/BusinessType/BusinessType.js +4 -2
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +50 -12
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +11 -1
- package/build/features/connect/screens/Merchant/BrandList.js +2 -15
- package/build/features/connect/screens/Merchant/Merchant.js +5 -24
- package/build/features/connect/screens/Merchant/validation.d.ts +0 -6
- package/build/features/connect/screens/Merchant/validation.js +1 -5
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -18
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +62 -11
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +59 -11
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +12 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +23 -2
- package/build/features/shared/UploadFile/UploadFile.js +1 -1
- package/build/theme/typography.js +1 -1
- package/package.json +1 -1
- package/build/api/file.d.ts +0 -13
- package/build/api/file.js +0 -24
- package/build/features/connect/screens/Merchant/Segments.d.ts +0 -8
- package/build/features/connect/screens/Merchant/Segments.js +0 -79
- package/build/features/connect/screens/Merchant/TeamSize.d.ts +0 -8
- package/build/features/connect/screens/Merchant/TeamSize.js +0 -79
- package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +0 -38
- package/build/features/shared/UploadMultipleFile/UploadFile.js +0 -184
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +0 -27
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +0 -147
- package/build/features/shared/UploadMultipleFile/index.d.ts +0 -2
- package/build/features/shared/UploadMultipleFile/index.js +0 -2
|
@@ -66,12 +66,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
66
66
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
67
|
};
|
|
68
68
|
var _a;
|
|
69
|
-
import API from '../../../api';
|
|
70
|
-
import { handleNextScreenStep } from '../../../app/settings';
|
|
71
|
-
import { CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_BRAND } from '../../../constants';
|
|
72
69
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
70
|
+
import { handleNextScreenStep } from '../../../app/settings';
|
|
71
|
+
import { FlowsTypes, AuthForType } from '../../../@types';
|
|
72
|
+
import API from '../../../api';
|
|
73
|
+
import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_BRAND } from '../../../constants';
|
|
74
|
+
import { defaultCountry } from '../../../constants';
|
|
75
|
+
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep, findCountryByIddPrefix, concatenateObjectValues, isTwitter, isWebsite, fixBrandList } from '../../../utils';
|
|
75
76
|
export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
77
|
var settings, requestBody, data;
|
|
77
78
|
var _a, _b;
|
|
@@ -131,7 +132,7 @@ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (p
|
|
|
131
132
|
});
|
|
132
133
|
}); });
|
|
133
134
|
export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
134
|
-
var _a, settings, connect, _b, mobile, countryCode, requestBody;
|
|
135
|
+
var _a, settings, connect, _b, mobile, countryCode, requestBody, data;
|
|
135
136
|
return __generator(this, function (_c) {
|
|
136
137
|
switch (_c.label) {
|
|
137
138
|
case 0:
|
|
@@ -151,7 +152,9 @@ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (param
|
|
|
151
152
|
encryption_contract: ['user_credentail.phone', 'user_credentail.code']
|
|
152
153
|
};
|
|
153
154
|
return [4, API.authService.createAuth(requestBody)];
|
|
154
|
-
case 1:
|
|
155
|
+
case 1:
|
|
156
|
+
data = _c.sent();
|
|
157
|
+
return [2, data];
|
|
155
158
|
}
|
|
156
159
|
});
|
|
157
160
|
}); });
|
|
@@ -357,7 +360,7 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
357
360
|
});
|
|
358
361
|
}); });
|
|
359
362
|
export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
360
|
-
var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse,
|
|
363
|
+
var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse, brand;
|
|
361
364
|
var _b, _c, _d, _e, _f;
|
|
362
365
|
return __generator(this, function (_g) {
|
|
363
366
|
switch (_g.label) {
|
|
@@ -376,35 +379,13 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
376
379
|
return [4, API.leadService.updateLead(payload)];
|
|
377
380
|
case 1:
|
|
378
381
|
leadResponse = _g.sent();
|
|
379
|
-
|
|
380
|
-
case 2:
|
|
381
|
-
_g.trys.push([2, 4, , 5]);
|
|
382
|
-
return [4, API.dataService.getSegments({ page: 0 })];
|
|
383
|
-
case 3:
|
|
384
|
-
segments = _g.sent();
|
|
385
|
-
leadResponse.segments_list = segments.list;
|
|
386
|
-
return [3, 5];
|
|
387
|
-
case 4:
|
|
388
|
-
err_3 = _g.sent();
|
|
389
|
-
return [3, 5];
|
|
390
|
-
case 5:
|
|
391
|
-
_g.trys.push([5, 7, , 8]);
|
|
392
|
-
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
393
|
-
case 6:
|
|
394
|
-
teamSize = _g.sent();
|
|
395
|
-
leadResponse.team_size_list = teamSize.list;
|
|
396
|
-
return [3, 8];
|
|
397
|
-
case 7:
|
|
398
|
-
err_4 = _g.sent();
|
|
399
|
-
return [3, 8];
|
|
400
|
-
case 8:
|
|
401
|
-
if (!leadResponse.brand) return [3, 10];
|
|
382
|
+
if (!leadResponse.brand) return [3, 3];
|
|
402
383
|
return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
|
|
403
|
-
case
|
|
384
|
+
case 2:
|
|
404
385
|
brand = (_g.sent()).brand;
|
|
405
386
|
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
|
|
406
|
-
_g.label =
|
|
407
|
-
case
|
|
387
|
+
_g.label = 3;
|
|
388
|
+
case 3:
|
|
408
389
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
409
390
|
thunkApi.dispatch(handleNextScreenStep());
|
|
410
391
|
return [2, { leadResponse: leadResponse, formData: params }];
|
|
@@ -413,9 +394,9 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
413
394
|
}); });
|
|
414
395
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
415
396
|
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
|
|
416
|
-
var _b, _c, _d, _e, _f
|
|
417
|
-
return __generator(this, function (
|
|
418
|
-
switch (
|
|
397
|
+
var _b, _c, _d, _e, _f;
|
|
398
|
+
return __generator(this, function (_g) {
|
|
399
|
+
switch (_g.label) {
|
|
419
400
|
case 0:
|
|
420
401
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
421
402
|
responseBody = connect.data.otpData.responseBody;
|
|
@@ -449,21 +430,20 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
449
430
|
};
|
|
450
431
|
return [4, API.leadService.updateLead(payload_1)];
|
|
451
432
|
case 1:
|
|
452
|
-
|
|
453
|
-
|
|
433
|
+
_g.sent();
|
|
434
|
+
_g.label = 2;
|
|
454
435
|
case 2:
|
|
455
436
|
brandReqBody_1 = {
|
|
456
437
|
id: (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id) || '',
|
|
457
438
|
channel_services: channel_services,
|
|
458
|
-
segment: { type: ((_b = params.segment) === null || _b === void 0 ? void 0 : _b.id) || '', team: ((_c = params.teamSize) === null || _c === void 0 ? void 0 : _c.id) || '' },
|
|
459
439
|
step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
|
|
460
440
|
};
|
|
461
441
|
return [4, API.brandService.updateBrandInfo(brandReqBody_1)];
|
|
462
442
|
case 3:
|
|
463
|
-
brand_1 =
|
|
443
|
+
brand_1 = _g.sent();
|
|
464
444
|
thunkApi.dispatch(updateLeadSuccess());
|
|
465
445
|
thunkApi.dispatch(handleNextScreenStep());
|
|
466
|
-
(
|
|
446
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, params);
|
|
467
447
|
return [2, { response: brand_1, formData: params }];
|
|
468
448
|
case 4:
|
|
469
449
|
brandNameBody = {
|
|
@@ -481,24 +461,23 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
481
461
|
};
|
|
482
462
|
return [4, API.leadService.updateLead(payload)];
|
|
483
463
|
case 5:
|
|
484
|
-
lead =
|
|
464
|
+
lead = _g.sent();
|
|
485
465
|
if (!lead.brand) {
|
|
486
466
|
console.error('Internal server error: brand is not created');
|
|
487
467
|
throw new Error('Internal server error');
|
|
488
468
|
}
|
|
489
469
|
brandReqBody = {
|
|
490
|
-
id: ((
|
|
470
|
+
id: ((_d = lead.brand) === null || _d === void 0 ? void 0 : _d.id) || '',
|
|
491
471
|
channel_services: channel_services,
|
|
492
472
|
term: ['general'],
|
|
493
|
-
step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
|
|
494
|
-
segment: { type: ((_g = params.segment) === null || _g === void 0 ? void 0 : _g.id) || '', team: ((_h = params.teamSize) === null || _h === void 0 ? void 0 : _h.id) || '' }
|
|
473
|
+
step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
|
|
495
474
|
};
|
|
496
475
|
return [4, API.brandService.updateBrandInfo(brandReqBody)];
|
|
497
476
|
case 6:
|
|
498
|
-
brand =
|
|
477
|
+
brand = _g.sent();
|
|
499
478
|
thunkApi.dispatch(updateLeadSuccess());
|
|
500
479
|
thunkApi.dispatch(handleNextScreenStep());
|
|
501
|
-
(
|
|
480
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
502
481
|
return [2, { response: brand, formData: params }];
|
|
503
482
|
}
|
|
504
483
|
});
|
|
@@ -599,17 +578,11 @@ var initialState = {
|
|
|
599
578
|
name: '',
|
|
600
579
|
email: '',
|
|
601
580
|
mobile: '',
|
|
602
|
-
countryCode: defaultCountry
|
|
603
|
-
responseBody: {
|
|
604
|
-
segments_list: [],
|
|
605
|
-
team_size_list: []
|
|
606
|
-
}
|
|
581
|
+
countryCode: defaultCountry
|
|
607
582
|
},
|
|
608
583
|
brandData: {
|
|
609
584
|
brandName: '',
|
|
610
585
|
salesChannels: [],
|
|
611
|
-
segment: undefined,
|
|
612
|
-
teamSize: undefined,
|
|
613
586
|
termAndConditionChecked: false,
|
|
614
587
|
selectedBrandItem: {},
|
|
615
588
|
responseBody: {
|
|
@@ -817,10 +790,9 @@ export var connectSlice = createSlice({
|
|
|
817
790
|
state.error = action.error.message;
|
|
818
791
|
})
|
|
819
792
|
.addCase(updateLeadIndividual.fulfilled, function (state, action) {
|
|
820
|
-
var _a, _b;
|
|
821
793
|
state.loading = false;
|
|
822
794
|
state.error = null;
|
|
823
|
-
var
|
|
795
|
+
var _a = action.payload, formData = _a.formData, leadResponse = _a.leadResponse;
|
|
824
796
|
var brand = leadResponse.brand, rest = __rest(leadResponse, ["brand"]);
|
|
825
797
|
if (brand) {
|
|
826
798
|
var channel_services = brand.channel_services, terms = brand.terms;
|
|
@@ -831,15 +803,6 @@ export var connectSlice = createSlice({
|
|
|
831
803
|
});
|
|
832
804
|
state.data.brandData.termAndConditionChecked = !!termAndCondition;
|
|
833
805
|
}
|
|
834
|
-
var firstBrand = (_b = (_a = state.data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.brand_list[0];
|
|
835
|
-
state.data.brandData.segment = rest.segments_list.find(function (_a) {
|
|
836
|
-
var id = _a.id;
|
|
837
|
-
return firstBrand.segment.type === id;
|
|
838
|
-
});
|
|
839
|
-
state.data.brandData.teamSize = rest.team_size_list.find(function (_a) {
|
|
840
|
-
var id = _a.id;
|
|
841
|
-
return firstBrand.segment.team === id;
|
|
842
|
-
});
|
|
843
806
|
state.data.individualData = formData;
|
|
844
807
|
state.data.individualData.responseBody = rest;
|
|
845
808
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState
|
|
2
|
+
import { CountryCode, FlowsTypes, IndividualAttachmentsFormValues, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
4
|
data: any;
|
|
5
5
|
boardResponse: {
|
|
@@ -53,6 +53,19 @@ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk
|
|
|
53
53
|
data: any;
|
|
54
54
|
formData: IndividualExtraFormValues;
|
|
55
55
|
}, IndividualExtraFormValues, {}>;
|
|
56
|
+
interface UploadFileParams {
|
|
57
|
+
file: File;
|
|
58
|
+
onProgress?: (value: number) => void;
|
|
59
|
+
title?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare const uploadCivilIdFile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
62
|
+
data: any;
|
|
63
|
+
file: File;
|
|
64
|
+
}, UploadFileParams, {}>;
|
|
65
|
+
export declare const uploadSignatureFile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
66
|
+
data: any;
|
|
67
|
+
file: File;
|
|
68
|
+
}, UploadFileParams, {}>;
|
|
56
69
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
57
70
|
response: any;
|
|
58
71
|
formData: void;
|
|
@@ -64,6 +77,7 @@ export interface IndividualData {
|
|
|
64
77
|
verify: ResponseData & VerifyData;
|
|
65
78
|
otpData: OTPFormValues & ResponseData;
|
|
66
79
|
individualData: IndividualExtraFormValues & ResponseData;
|
|
80
|
+
attachmentsData: IndividualAttachmentsFormValues & ResponseData;
|
|
67
81
|
flowName: FlowsTypes;
|
|
68
82
|
}
|
|
69
83
|
export interface IndividualState extends SharedState<IndividualData> {
|
|
@@ -73,10 +87,8 @@ export declare const individualSlice: import("@reduxjs/toolkit").Slice<Individua
|
|
|
73
87
|
clearError: (state: IndividualState) => void;
|
|
74
88
|
stopLoader: (state: IndividualState) => void;
|
|
75
89
|
resetOTPScreen: (state: IndividualState) => void;
|
|
76
|
-
civilIDUploadingStatus: (state: IndividualState, action: ActionState<boolean>) => void;
|
|
77
|
-
signatureFileUploadingStatus: (state: IndividualState, action: ActionState<boolean>) => void;
|
|
78
90
|
}, "individual/store">;
|
|
79
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string
|
|
91
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
80
92
|
declare const _default: import("redux").Reducer<IndividualState, import("redux").AnyAction>;
|
|
81
93
|
export default _default;
|
|
82
94
|
export declare const individualSelector: (state: RootState) => IndividualState;
|
|
@@ -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: civilID });
|
|
290
|
-
if (
|
|
291
|
-
documentsList.push({ type: 'Signature File', images: signatureFileId });
|
|
288
|
+
if (!!civilID)
|
|
289
|
+
documentsList.push({ type: 'Civil ID File', images: [civilID] });
|
|
290
|
+
if (!!signatureFileId)
|
|
291
|
+
documentsList.push({ type: 'Signature File', images: [signatureFileId] });
|
|
292
292
|
requestBody = {
|
|
293
293
|
id: id,
|
|
294
294
|
type: type,
|
|
@@ -321,6 +321,56 @@ 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
|
+
});
|
|
324
374
|
export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
325
375
|
var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
|
|
326
376
|
var _c, _d, _e, _f;
|
|
@@ -371,6 +421,10 @@ var initialState = {
|
|
|
371
421
|
employerLocation: undefined,
|
|
372
422
|
isPEP: null,
|
|
373
423
|
isInfluencer: null
|
|
424
|
+
},
|
|
425
|
+
attachmentsData: {
|
|
426
|
+
civilIDUploading: false,
|
|
427
|
+
signatureFileUploading: false
|
|
374
428
|
}
|
|
375
429
|
}
|
|
376
430
|
};
|
|
@@ -386,12 +440,6 @@ export var individualSlice = createSlice({
|
|
|
386
440
|
},
|
|
387
441
|
resetOTPScreen: function (state) {
|
|
388
442
|
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;
|
|
395
443
|
}
|
|
396
444
|
},
|
|
397
445
|
extraReducers: function (builder) {
|
|
@@ -542,6 +590,36 @@ export var individualSlice = createSlice({
|
|
|
542
590
|
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
543
591
|
state.error = action.error.message;
|
|
544
592
|
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';
|
|
545
623
|
})
|
|
546
624
|
.addCase(updateBoardSuccess.fulfilled, function (state, action) {
|
|
547
625
|
var _a;
|
|
@@ -566,6 +644,6 @@ export var individualSlice = createSlice({
|
|
|
566
644
|
});
|
|
567
645
|
}
|
|
568
646
|
});
|
|
569
|
-
export var clearError = (_a = individualSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen
|
|
647
|
+
export var clearError = (_a = individualSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
570
648
|
export default individualSlice.reducer;
|
|
571
649
|
export var individualSelector = function (state) { return state.individual; };
|
|
@@ -28,16 +28,17 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
var Article = function (_a) {
|
|
31
|
+
var _b, _c;
|
|
31
32
|
var show = _a.show;
|
|
32
|
-
var
|
|
33
|
-
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
33
|
+
var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
|
|
34
34
|
var t = useTranslation().t;
|
|
35
|
-
var
|
|
35
|
+
var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors, setValue = _e.setValue;
|
|
36
36
|
var articleFileControl = useController({ name: 'articleFile', control: control });
|
|
37
37
|
var articleIdControl = useController({ name: 'articleId', control: control });
|
|
38
|
-
var
|
|
38
|
+
var _f = useAppSelector(businessSelector), loading = _f.loading, uploadingArticle = _f.uploadingArticle, sysError = _f.error, data = _f.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);
|
|
41
42
|
var businessTypeData = data.businessTypeData;
|
|
42
43
|
var articleFile = businessTypeData.articleFile, articleId = businessTypeData.articleId;
|
|
43
44
|
React.useEffect(function () {
|
|
@@ -47,16 +48,15 @@ var Article = function (_a) {
|
|
|
47
48
|
}
|
|
48
49
|
}, [articleFile, articleId]);
|
|
49
50
|
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('file_not_supported_alert');
|
|
55
|
+
setError('articleFile', { message: '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('file_size_alert');
|
|
59
|
+
setError('articleFile', { message: 'file_size_alert' });
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
articleFileControl.field.onChange(file);
|
|
@@ -75,13 +75,16 @@ var Article = function (_a) {
|
|
|
75
75
|
};
|
|
76
76
|
React.useEffect(function () {
|
|
77
77
|
if (sysError === 'file_upload_error') {
|
|
78
|
-
setError(sysError);
|
|
78
|
+
setError('articleId', { message: 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]);
|
|
83
87
|
var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
|
|
84
|
-
|
|
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 }) }) })));
|
|
88
|
+
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: error && t(error), initialFileName: fileName }) }) })));
|
|
86
89
|
};
|
|
87
90
|
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, articleId = _c.articleId, articleFile = _c.articleFile;
|
|
31
|
+
var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, certificateFile = _c.certificateFile, articleId = _c.articleId, articleFile = _c.articleFile;
|
|
32
32
|
var t = useTranslation().t;
|
|
33
33
|
var isAr = useLanguage().isAr;
|
|
34
34
|
var dispatch = useAppDispatch();
|
|
@@ -41,6 +41,7 @@ var BusinessType = function (_a) {
|
|
|
41
41
|
licenseNumber: licenseNumber,
|
|
42
42
|
entityLegalName: entityLegalName,
|
|
43
43
|
certificateId: certificateId,
|
|
44
|
+
certificateFile: certificateFile,
|
|
44
45
|
articleId: articleId,
|
|
45
46
|
articleFile: articleFile
|
|
46
47
|
},
|
|
@@ -56,7 +57,8 @@ var BusinessType = function (_a) {
|
|
|
56
57
|
selectedLicense: data.selectedLicense,
|
|
57
58
|
licenseNumber: data.licenseNumber,
|
|
58
59
|
entityLegalName: data.entityLegalName,
|
|
59
|
-
certificateId: data.certificateId
|
|
60
|
+
certificateId: data.certificateId,
|
|
61
|
+
certificateFile: data.certificateFile
|
|
60
62
|
};
|
|
61
63
|
dispatch(updateLeadBusinessType(dataValues));
|
|
62
64
|
};
|
|
@@ -10,14 +10,16 @@ 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';
|
|
13
16
|
import { useTranslation } from 'react-i18next';
|
|
14
17
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
|
-
import {
|
|
19
|
+
import { businessSelector, clearCertificateId, uploadLicenseCertificate } from '../../../app/business/businessStore';
|
|
20
|
+
import UploadFile from '../../../shared/UploadFile';
|
|
21
|
+
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
17
22
|
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';
|
|
21
23
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
22
24
|
var theme = _a.theme;
|
|
23
25
|
return ({
|
|
@@ -25,18 +27,54 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
25
27
|
});
|
|
26
28
|
});
|
|
27
29
|
var LicenseCertificate = function (_a) {
|
|
30
|
+
var _b, _c;
|
|
28
31
|
var show = _a.show;
|
|
32
|
+
var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
|
|
29
33
|
var t = useTranslation().t;
|
|
30
|
-
var
|
|
31
|
-
var
|
|
34
|
+
var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors;
|
|
35
|
+
var certificateFileControl = useController({ name: 'certificateFile', control: control });
|
|
32
36
|
var certificateIdControl = useController({ name: 'certificateId', control: control });
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
|
|
37
|
+
var _f = useAppSelector(businessSelector), loading = _f.loading, uploading = _f.uploading, sysError = _f.error;
|
|
38
|
+
var dispatch = useAppDispatch();
|
|
39
|
+
var certificateValue = certificateFileControl.field.value;
|
|
40
|
+
var error = ((_b = certificateFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = certificateIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
|
|
41
|
+
var handleLicenseCertificateChange = function (files) {
|
|
42
|
+
var file = (files || [])[0];
|
|
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
|
+
}));
|
|
36
60
|
};
|
|
37
|
-
var handleReset = function (
|
|
38
|
-
|
|
61
|
+
var handleReset = function () {
|
|
62
|
+
certificateFileControl.field.onChange(undefined);
|
|
63
|
+
certificateIdControl.field.onChange('');
|
|
64
|
+
dispatch(clearCertificateId());
|
|
65
|
+
setProgress(0);
|
|
39
66
|
};
|
|
40
|
-
|
|
67
|
+
React.useEffect(function () {
|
|
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) }) }) })));
|
|
41
79
|
};
|
|
42
80
|
export default LicenseCertificate;
|
|
@@ -13,21 +13,24 @@ 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.
|
|
16
|
+
certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
|
+
certificateFile: any;
|
|
17
18
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
19
|
articleFile: any;
|
|
19
20
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
20
21
|
selectedLicense: any;
|
|
21
22
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
22
23
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
|
-
certificateId: yup.
|
|
24
|
+
certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
|
+
certificateFile: any;
|
|
24
26
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
27
|
articleFile: any;
|
|
26
28
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
27
29
|
selectedLicense: any;
|
|
28
30
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
29
31
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
30
|
-
certificateId: yup.
|
|
32
|
+
certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
33
|
+
certificateFile: any;
|
|
31
34
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
35
|
articleFile: any;
|
|
33
36
|
}>>>;
|
|
@@ -74,7 +74,17 @@ export var KWLicenseValidationSchema = yup.object().shape({
|
|
|
74
74
|
});
|
|
75
75
|
})
|
|
76
76
|
.required(''),
|
|
77
|
-
certificateId: yup.
|
|
77
|
+
certificateId: yup.string().optional(),
|
|
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(),
|
|
78
88
|
articleId: yup.string().optional(),
|
|
79
89
|
articleFile: yup
|
|
80
90
|
.mixed()
|