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