@tap-payments/auth-jsconnect 2.3.83-test → 2.3.85-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/features/app/connectExpress/connectExpressStore.d.ts +3 -3
- package/build/features/app/connectExpress/connectExpressStore.js +80 -76
- package/build/features/app/individual/individualStore.d.ts +4 -4
- package/build/features/app/individual/individualStore.js +227 -219
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +5 -4
- package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +5 -4
- package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +3 -9
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +19 -18
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +3 -2
- package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +3 -2
- package/build/features/shared/Button/IndividualActionButtons.js +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues } from '../../../@types';
|
|
2
|
+
import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues, AsyncThunkParams } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
export declare const retrieveLeadIdentityByIdAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
5
|
data: any;
|
|
@@ -87,11 +87,11 @@ interface verifyPACIAsyncParams {
|
|
|
87
87
|
export declare const updateLeadIndividualAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
88
88
|
response: any;
|
|
89
89
|
formData: IndividualFormValues;
|
|
90
|
-
}, IndividualFormValues
|
|
90
|
+
}, AsyncThunkParams<IndividualFormValues>, {}>;
|
|
91
91
|
export declare const updateLeadBusinessDataAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
92
92
|
response: any;
|
|
93
93
|
formData: BusinessDataFormValues;
|
|
94
|
-
}, BusinessDataFormValues
|
|
94
|
+
}, AsyncThunkParams<BusinessDataFormValues>, {}>;
|
|
95
95
|
interface ResponseData {
|
|
96
96
|
responseData?: Record<string, any>;
|
|
97
97
|
}
|
|
@@ -639,84 +639,88 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
|
|
|
639
639
|
}
|
|
640
640
|
});
|
|
641
641
|
}); });
|
|
642
|
-
export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLeadIndividualAsync', function (
|
|
643
|
-
var
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number']
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP')); });
|
|
667
|
-
}
|
|
668
|
-
if (!needToCollectMoreInfo) return [3, 4];
|
|
669
|
-
isSaudi = isSA(settings.data.businessCountry.iso2);
|
|
670
|
-
if (!isSaudi) return [3, 3];
|
|
671
|
-
return [4, thunkApi.dispatch(retrieveEntityListAsync(data.lead.id)).unwrap()];
|
|
672
|
-
case 2:
|
|
673
|
-
_h.sent();
|
|
674
|
-
_h.label = 3;
|
|
675
|
-
case 3:
|
|
676
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP')); });
|
|
677
|
-
_h.label = 4;
|
|
678
|
-
case 4: return [2, { response: data, formData: params }];
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
}); });
|
|
682
|
-
export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDataAsync ', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
683
|
-
var _a, settings, connectExpress, isNonSA, isFL, _b, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
|
|
684
|
-
var _c, _d, _e, _f;
|
|
685
|
-
return __generator(this, function (_g) {
|
|
686
|
-
switch (_g.label) {
|
|
687
|
-
case 0:
|
|
688
|
-
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
689
|
-
isNonSA = !isSA(settings.data.businessCountry.iso2);
|
|
690
|
-
isFL = ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL;
|
|
691
|
-
_b = connectExpress.data, responseData = _b.responseData, isLeadIdPassed = _b.isLeadIdPassed;
|
|
692
|
-
id = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).id;
|
|
693
|
-
brandNameBody = {
|
|
694
|
-
name: {
|
|
695
|
-
en: params.brandName,
|
|
696
|
-
ar: params.brandName,
|
|
697
|
-
zh: params.brandName
|
|
642
|
+
export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLeadIndividualAsync', function (_a, thunkApi) {
|
|
643
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
644
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
645
|
+
var _b, settings, connectExpress, id, countryCode, name, email, mobile, phoneCountry, isContactAvailable, payload, data, needToCollectMoreInfo, creatingAccount, isSaudi;
|
|
646
|
+
var _c, _d, _e, _f, _g;
|
|
647
|
+
return __generator(this, function (_h) {
|
|
648
|
+
switch (_h.label) {
|
|
649
|
+
case 0:
|
|
650
|
+
_b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
|
|
651
|
+
id = (((_c = connectExpress.data.responseData) === null || _c === void 0 ? void 0 : _c.leadData) || {}).id;
|
|
652
|
+
countryCode = formData.countryCode, name = formData.name, email = formData.email, mobile = formData.mobile;
|
|
653
|
+
phoneCountry = (_d = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString();
|
|
654
|
+
isContactAvailable = email || mobile;
|
|
655
|
+
payload = __assign(__assign({ id: id || '', country_code: (_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2, name: getIndividualName(name) }, (isContactAvailable && {
|
|
656
|
+
contact: __assign({ email: email }, (mobile && { phone: { country_code: phoneCountry, number: mobile } }))
|
|
657
|
+
})), { step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL, encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number'] });
|
|
658
|
+
return [4, API.leadService.updateLeadExpress(payload)];
|
|
659
|
+
case 1:
|
|
660
|
+
data = _h.sent();
|
|
661
|
+
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, formData);
|
|
662
|
+
needToCollectMoreInfo = data.step_name === 'collect_info';
|
|
663
|
+
creatingAccount = data.step_name === 'create_account';
|
|
664
|
+
if (creatingAccount) {
|
|
665
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP')); });
|
|
698
666
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
case 1:
|
|
713
|
-
data = _g.sent();
|
|
714
|
-
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
715
|
-
thunkApi.dispatch(handleNextScreenStep());
|
|
716
|
-
return [2, { response: data, formData: params }];
|
|
717
|
-
}
|
|
667
|
+
if (!needToCollectMoreInfo) return [3, 4];
|
|
668
|
+
isSaudi = isSA(settings.data.businessCountry.iso2);
|
|
669
|
+
if (!isSaudi) return [3, 3];
|
|
670
|
+
return [4, thunkApi.dispatch(retrieveEntityListAsync(data.lead.id)).unwrap()];
|
|
671
|
+
case 2:
|
|
672
|
+
_h.sent();
|
|
673
|
+
_h.label = 3;
|
|
674
|
+
case 3:
|
|
675
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP')); });
|
|
676
|
+
_h.label = 4;
|
|
677
|
+
case 4: return [2, { response: data, formData: originalFormData }];
|
|
678
|
+
}
|
|
679
|
+
});
|
|
718
680
|
});
|
|
719
|
-
});
|
|
681
|
+
});
|
|
682
|
+
export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDataAsync ', function (_a, thunkApi) {
|
|
683
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
684
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
685
|
+
var _b, settings, connectExpress, selectedLicense, brandName, licenseNumber, termAndConditionChecked, isNonSA, isFL, _c, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
|
|
686
|
+
var _d, _e;
|
|
687
|
+
return __generator(this, function (_f) {
|
|
688
|
+
switch (_f.label) {
|
|
689
|
+
case 0:
|
|
690
|
+
_b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
|
|
691
|
+
selectedLicense = formData.selectedLicense, brandName = formData.brandName, licenseNumber = formData.licenseNumber, termAndConditionChecked = formData.termAndConditionChecked;
|
|
692
|
+
isNonSA = !isSA(settings.data.businessCountry.iso2);
|
|
693
|
+
isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
694
|
+
_c = connectExpress.data, responseData = _c.responseData, isLeadIdPassed = _c.isLeadIdPassed;
|
|
695
|
+
id = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).id;
|
|
696
|
+
brandNameBody = {
|
|
697
|
+
name: {
|
|
698
|
+
en: brandName,
|
|
699
|
+
ar: brandName,
|
|
700
|
+
zh: brandName
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
payload = {
|
|
704
|
+
id: id || '',
|
|
705
|
+
brand: brandNameBody,
|
|
706
|
+
license_number: isNonSA && isFL ? '' : licenseNumber,
|
|
707
|
+
license_type: (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) ? (isFL ? LicenseType.FL : LicenseType.CR) : undefined,
|
|
708
|
+
business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type,
|
|
709
|
+
is_acknowledged: true,
|
|
710
|
+
terms_conditions_accepted: !isLeadIdPassed ? termAndConditionChecked : undefined,
|
|
711
|
+
step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_BRAND_BUSINESS,
|
|
712
|
+
encryption_contract: ['license_number', 'business_type', 'license_type']
|
|
713
|
+
};
|
|
714
|
+
return [4, API.leadService.updateLeadExpress(payload)];
|
|
715
|
+
case 1:
|
|
716
|
+
data = _f.sent();
|
|
717
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, formData);
|
|
718
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
719
|
+
return [2, { response: data, formData: originalFormData }];
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
});
|
|
720
724
|
var initialState = {
|
|
721
725
|
error: null,
|
|
722
726
|
loading: false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState, User, IndividualPersonalInfoFormValues, IndividualEmailMobileFormValues, IndividualMobileFormValues } from '../../../@types';
|
|
2
|
+
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState, User, IndividualPersonalInfoFormValues, IndividualEmailMobileFormValues, IndividualMobileFormValues, AsyncThunkParams } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
interface VerifyLeadTokenProps {
|
|
5
5
|
token: string;
|
|
@@ -91,15 +91,15 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
91
91
|
export declare const updatePhoneInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
92
92
|
data: any;
|
|
93
93
|
formData: IndividualMobileFormValues;
|
|
94
|
-
}, IndividualMobileFormValues
|
|
94
|
+
}, AsyncThunkParams<IndividualMobileFormValues>, {}>;
|
|
95
95
|
export declare const updateIndividualPersonalInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
96
96
|
data: any;
|
|
97
97
|
formData: IndividualPersonalInfoFormValues;
|
|
98
|
-
}, IndividualPersonalInfoFormValues
|
|
98
|
+
}, AsyncThunkParams<IndividualPersonalInfoFormValues>, {}>;
|
|
99
99
|
export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
100
100
|
data: any;
|
|
101
101
|
formData: IndividualExtraFormValues;
|
|
102
|
-
}, IndividualExtraFormValues
|
|
102
|
+
}, AsyncThunkParams<IndividualExtraFormValues>, {}>;
|
|
103
103
|
export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThunk<{
|
|
104
104
|
response: any;
|
|
105
105
|
formData: string;
|
|
@@ -508,230 +508,238 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
508
508
|
}
|
|
509
509
|
});
|
|
510
510
|
}); });
|
|
511
|
-
export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', function (
|
|
512
|
-
var
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
511
|
+
export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', function (_a, thunkApi) {
|
|
512
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
513
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
514
|
+
var individual, _b, token, responseBody, _c, id, type, mobile, countryCode, requestBody, data;
|
|
515
|
+
var _d;
|
|
516
|
+
return __generator(this, function (_e) {
|
|
517
|
+
switch (_e.label) {
|
|
518
|
+
case 0:
|
|
519
|
+
individual = thunkApi.getState().individual;
|
|
520
|
+
_b = individual.data.verify, token = _b.token, responseBody = _b.responseBody;
|
|
521
|
+
_c = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.source) || {}, id = _c.id, type = _c.type;
|
|
522
|
+
mobile = formData.mobile, countryCode = formData.countryCode;
|
|
523
|
+
requestBody = {
|
|
524
|
+
id: id,
|
|
525
|
+
type: type,
|
|
526
|
+
contact: {
|
|
527
|
+
phone: {
|
|
528
|
+
country_code: (_d = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
529
|
+
number: mobile || ''
|
|
530
|
+
}
|
|
528
531
|
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
532
|
+
};
|
|
533
|
+
return [4, API.individualService.updateIndividual(requestBody)];
|
|
534
|
+
case 1:
|
|
535
|
+
data = _e.sent();
|
|
536
|
+
return [4, thunkApi.dispatch(verifyToken({ token: token, isUpdatePhoneInfo: true }))];
|
|
537
|
+
case 2:
|
|
538
|
+
_e.sent();
|
|
539
|
+
return [2, { data: data, formData: originalFormData }];
|
|
540
|
+
}
|
|
541
|
+
});
|
|
539
542
|
});
|
|
540
|
-
});
|
|
541
|
-
export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (
|
|
542
|
-
var
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
543
|
+
});
|
|
544
|
+
export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
|
|
545
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
546
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
547
|
+
var _b, settings, individual, _c, notification, user, entity, _d, id, type, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isNameNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, contact, requestBody, data;
|
|
548
|
+
var _e, _f, _g, _h, _j;
|
|
549
|
+
return __generator(this, function (_k) {
|
|
550
|
+
switch (_k.label) {
|
|
551
|
+
case 0:
|
|
552
|
+
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
553
|
+
_c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user, entity = _c.entity;
|
|
554
|
+
_d = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _d.id, type = _d.type;
|
|
555
|
+
name = formData.name, email = formData.email, mobile = formData.mobile, countryCode = formData.countryCode, gender = formData.gender, nid = formData.nid, issuedCountry = formData.issuedCountry, expiryDate = formData.expiryDate, dob = formData.dob, placeOfBirthCountry = formData.placeOfBirthCountry, placeOfBirthCity = formData.placeOfBirthCity, nationality = formData.nationality;
|
|
556
|
+
code = entity === null || entity === void 0 ? void 0 : entity.country;
|
|
557
|
+
data_status = (user || {}).data_status;
|
|
558
|
+
userName = getUserNameObject(name);
|
|
559
|
+
identification_id_type = nid ? (nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA) : undefined;
|
|
560
|
+
isNameNonEditable = hasNoneEditableValue(data_status, 'name');
|
|
561
|
+
isEmailNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.contact, 'email');
|
|
562
|
+
isMobileNumberNonEditable = hasNoneEditableValue((_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone, 'number');
|
|
563
|
+
isMobileCountryNonEditable = hasNoneEditableValue((_f = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _f === void 0 ? void 0 : _f.phone, 'country_code');
|
|
564
|
+
isNidNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'id');
|
|
565
|
+
isIssuedCountryNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'issuer_country');
|
|
566
|
+
isExpiryNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'expiry');
|
|
567
|
+
isIdTypeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'type');
|
|
568
|
+
isNationalityNonEditable = hasNoneEditableValue(data_status, 'nationality');
|
|
569
|
+
isDOBNonEditable = hasNoneEditableValue(data_status, 'birth.date');
|
|
570
|
+
isBirthCityNonEditable = hasNoneEditableValue(data_status, 'birth.city');
|
|
571
|
+
isBirthCountryNonEditable = hasNoneEditableValue(data_status, 'birth.country');
|
|
572
|
+
hasContact = email || mobile || countryCode;
|
|
573
|
+
hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
|
|
574
|
+
hasIdentification = nid || issuedCountry || identification_id_type || expiryDate;
|
|
575
|
+
hasBirth = placeOfBirthCity || placeOfBirthCountry;
|
|
576
|
+
contact = hasContact && !(isEmailNonEditable && isMobileCountryNonEditable && isMobileNumberNonEditable)
|
|
577
|
+
? __assign({ email: isEmailNonEditable ? undefined : email }, (!((isMobileCountryNonEditable && isMobileNumberNonEditable) || !hasPhone) && {
|
|
578
|
+
phone: {
|
|
579
|
+
country_code: isMobileCountryNonEditable ? undefined : (_g = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _g === void 0 ? void 0 : _g.toString(),
|
|
580
|
+
number: isMobileNumberNonEditable || !mobile ? undefined : mobile
|
|
581
|
+
}
|
|
582
|
+
})) : undefined;
|
|
583
|
+
requestBody = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ id: id, type: type, gender: gender || undefined }, (!(isNameNonEditable || !userName.first) && {
|
|
584
|
+
names: {
|
|
585
|
+
en: userName,
|
|
586
|
+
ar: userName
|
|
576
587
|
}
|
|
577
|
-
})) :
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
!(isNidNonEditable && isIssuedCountryNonEditable && isExpiryNonEditable && isIdTypeNonEditable) && {
|
|
585
|
-
identification: {
|
|
586
|
-
id: isNidNonEditable || !nid ? undefined : nid,
|
|
587
|
-
issued_country_code: isIssuedCountryNonEditable ? undefined : issuedCountry === null || issuedCountry === void 0 ? void 0 : issuedCountry.iso2,
|
|
588
|
-
expiry: isExpiryNonEditable || !expiryDate ? undefined : new Date(expiryDate).getTime(),
|
|
589
|
-
type: isIdTypeNonEditable || !identification_id_type ? undefined : identification_id_type
|
|
590
|
-
}
|
|
591
|
-
})), (!isDOBNonEditable && {
|
|
592
|
-
date_of_birth: dob
|
|
593
|
-
})), (!((isBirthCityNonEditable && isBirthCountryNonEditable) || !hasBirth) && {
|
|
594
|
-
birth: {
|
|
595
|
-
city: isBirthCityNonEditable ? undefined : placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.id,
|
|
596
|
-
country: isBirthCountryNonEditable ? undefined : placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
|
|
597
|
-
}
|
|
598
|
-
})), (!isNationalityNonEditable && {
|
|
599
|
-
nationality: nationality === null || nationality === void 0 ? void 0 : nationality.iso2
|
|
600
|
-
})), { encryption_contract: [
|
|
601
|
-
'gender',
|
|
602
|
-
'contact.email',
|
|
603
|
-
'contact.phone.country_code',
|
|
604
|
-
'contact.phone.number',
|
|
605
|
-
'identification.id',
|
|
606
|
-
'identification.issued_country_code',
|
|
607
|
-
'identification.expiry',
|
|
608
|
-
'identification.type',
|
|
609
|
-
'birth.country',
|
|
610
|
-
'date_of_birth',
|
|
611
|
-
'nationality'
|
|
612
|
-
], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
|
|
613
|
-
return [4, API.individualService.updateIndividual(requestBody)];
|
|
614
|
-
case 1:
|
|
615
|
-
data = _j.sent();
|
|
616
|
-
if (!(type === IndividualType.USER || type === IndividualType.BUYER)) return [3, 3];
|
|
617
|
-
return [4, thunkApi.dispatch(retrieveDataList(code))];
|
|
618
|
-
case 2:
|
|
619
|
-
_j.sent();
|
|
620
|
-
_j.label = 3;
|
|
621
|
-
case 3:
|
|
622
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
623
|
-
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
|
|
624
|
-
return [2, { data: data, formData: params }];
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
}); });
|
|
628
|
-
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
629
|
-
var _a, settings, individual, _b, notification, user, _c, id, type, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data, civilID, signatureFileId, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
|
|
630
|
-
var _d, _e;
|
|
631
|
-
return __generator(this, function (_f) {
|
|
632
|
-
switch (_f.label) {
|
|
633
|
-
case 0:
|
|
634
|
-
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
635
|
-
_b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user;
|
|
636
|
-
_c = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
637
|
-
occupation = params.occupation, sourceIncome = params.sourceIncome, monthlyIncome = params.monthlyIncome, isPEP = params.isPEP, isInfluencer = params.isInfluencer, shareCount = params.shareCount, shareValue = params.shareValue;
|
|
638
|
-
isOccupationNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'occupation');
|
|
639
|
-
isSourceIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'source_of_income');
|
|
640
|
-
isPEPNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_relative_PEP');
|
|
641
|
-
isInfluencerNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_influencer');
|
|
642
|
-
isMonthlyIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'monthly_income');
|
|
643
|
-
isSharesAvailable = shareCount || shareValue;
|
|
644
|
-
pepInfo = isPEPNonEditable ? undefined : isPEP;
|
|
645
|
-
influencerInfo = isInfluencerNonEditable ? undefined : isInfluencer;
|
|
646
|
-
occupationInfo = isOccupationNonEditable || !(occupation === null || occupation === void 0 ? void 0 : occupation.id) ? undefined : { id: occupation.id };
|
|
647
|
-
sourceIncomeInfo = isSourceIncomeNonEditable || !(sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id) ? undefined : [{ id: sourceIncome.id }];
|
|
648
|
-
monthlyIncomeInfo = isMonthlyIncomeNonEditable || !(monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id) ? undefined : { id: monthlyIncome.id };
|
|
649
|
-
userPayload = {
|
|
650
|
-
occupation: occupationInfo,
|
|
651
|
-
source_income: sourceIncomeInfo,
|
|
652
|
-
monthly_income: monthlyIncomeInfo,
|
|
653
|
-
is_relative_PEP: pepInfo,
|
|
654
|
-
is_influencer: influencerInfo
|
|
655
|
-
};
|
|
656
|
-
shareHolderPayload = {
|
|
657
|
-
shares: isSharesAvailable
|
|
658
|
-
? {
|
|
659
|
-
count: shareCount && Number(shareCount),
|
|
660
|
-
value: shareValue && Number(shareValue)
|
|
588
|
+
})), { contact: contact }), (hasIdentification &&
|
|
589
|
+
!(isNidNonEditable && isIssuedCountryNonEditable && isExpiryNonEditable && isIdTypeNonEditable) && {
|
|
590
|
+
identification: {
|
|
591
|
+
id: isNidNonEditable || !nid ? undefined : nid,
|
|
592
|
+
issued_country_code: isIssuedCountryNonEditable ? undefined : issuedCountry === null || issuedCountry === void 0 ? void 0 : issuedCountry.iso2,
|
|
593
|
+
expiry: isExpiryNonEditable || !expiryDate ? undefined : new Date(expiryDate).getTime(),
|
|
594
|
+
type: isIdTypeNonEditable || !identification_id_type ? undefined : identification_id_type
|
|
661
595
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
699
|
-
case 2:
|
|
700
|
-
_f.sent();
|
|
701
|
-
_f.label = 3;
|
|
702
|
-
case 3:
|
|
703
|
-
if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 5];
|
|
704
|
-
documentBody = {
|
|
705
|
-
id: signatureDocument.id,
|
|
706
|
-
images: signatureFileId
|
|
707
|
-
};
|
|
708
|
-
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
709
|
-
case 4:
|
|
710
|
-
_f.sent();
|
|
711
|
-
_f.label = 5;
|
|
712
|
-
case 5:
|
|
713
|
-
documentsList = [];
|
|
714
|
-
if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
|
|
715
|
-
documentsList.push({ type: DocumentPurpose.IDENTITY_DOCUMENT, images: civilID });
|
|
716
|
-
if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
|
|
717
|
-
documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
|
|
718
|
-
if (!(documentsList.length > 0)) return [3, 7];
|
|
719
|
-
documentBody = {
|
|
720
|
-
individual_type_id: id || '',
|
|
721
|
-
country: businessCountry.iso2,
|
|
722
|
-
documents: documentsList
|
|
723
|
-
};
|
|
724
|
-
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
725
|
-
case 6:
|
|
726
|
-
_f.sent();
|
|
727
|
-
_f.label = 7;
|
|
728
|
-
case 7:
|
|
729
|
-
thunkApi.dispatch(handleNextScreenStep());
|
|
730
|
-
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
|
|
731
|
-
return [2, { data: data, formData: params }];
|
|
732
|
-
}
|
|
596
|
+
})), (!isDOBNonEditable && {
|
|
597
|
+
date_of_birth: dob
|
|
598
|
+
})), (!((isBirthCityNonEditable && isBirthCountryNonEditable) || !hasBirth) && {
|
|
599
|
+
birth: {
|
|
600
|
+
city: isBirthCityNonEditable ? undefined : placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.id,
|
|
601
|
+
country: isBirthCountryNonEditable ? undefined : placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
|
|
602
|
+
}
|
|
603
|
+
})), (!isNationalityNonEditable && {
|
|
604
|
+
nationality: nationality === null || nationality === void 0 ? void 0 : nationality.iso2
|
|
605
|
+
})), { encryption_contract: [
|
|
606
|
+
'gender',
|
|
607
|
+
'contact.email',
|
|
608
|
+
'contact.phone.country_code',
|
|
609
|
+
'contact.phone.number',
|
|
610
|
+
'identification.id',
|
|
611
|
+
'identification.issued_country_code',
|
|
612
|
+
'identification.expiry',
|
|
613
|
+
'identification.type',
|
|
614
|
+
'birth.country',
|
|
615
|
+
'date_of_birth',
|
|
616
|
+
'nationality'
|
|
617
|
+
], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
|
|
618
|
+
return [4, API.individualService.updateIndividual(requestBody)];
|
|
619
|
+
case 1:
|
|
620
|
+
data = _k.sent();
|
|
621
|
+
if (!(type === IndividualType.USER || type === IndividualType.BUYER)) return [3, 3];
|
|
622
|
+
return [4, thunkApi.dispatch(retrieveDataList(code))];
|
|
623
|
+
case 2:
|
|
624
|
+
_k.sent();
|
|
625
|
+
_k.label = 3;
|
|
626
|
+
case 3:
|
|
627
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
628
|
+
(_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
|
|
629
|
+
return [2, { data: data, formData: originalFormData }];
|
|
630
|
+
}
|
|
631
|
+
});
|
|
733
632
|
});
|
|
734
|
-
});
|
|
633
|
+
});
|
|
634
|
+
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
|
|
635
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
636
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
637
|
+
var _b, settings, individual, _c, notification, user, _d, id, type, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
|
|
638
|
+
var _e, _f;
|
|
639
|
+
return __generator(this, function (_g) {
|
|
640
|
+
switch (_g.label) {
|
|
641
|
+
case 0:
|
|
642
|
+
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
643
|
+
_c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user;
|
|
644
|
+
_d = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _d.id, type = _d.type;
|
|
645
|
+
occupation = formData.occupation, sourceIncome = formData.sourceIncome, monthlyIncome = formData.monthlyIncome, isPEP = formData.isPEP, isInfluencer = formData.isInfluencer, shareCount = formData.shareCount, shareValue = formData.shareValue, civilID = formData.civilID, signatureFileId = formData.signatureFileId;
|
|
646
|
+
isOccupationNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'occupation');
|
|
647
|
+
isSourceIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'source_of_income');
|
|
648
|
+
isPEPNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_relative_PEP');
|
|
649
|
+
isInfluencerNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_influencer');
|
|
650
|
+
isMonthlyIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'monthly_income');
|
|
651
|
+
isSharesAvailable = shareCount || shareValue;
|
|
652
|
+
pepInfo = isPEPNonEditable ? undefined : isPEP;
|
|
653
|
+
influencerInfo = isInfluencerNonEditable ? undefined : isInfluencer;
|
|
654
|
+
occupationInfo = isOccupationNonEditable || !(occupation === null || occupation === void 0 ? void 0 : occupation.id) ? undefined : { id: occupation.id };
|
|
655
|
+
sourceIncomeInfo = isSourceIncomeNonEditable || !(sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id) ? undefined : [{ id: sourceIncome.id }];
|
|
656
|
+
monthlyIncomeInfo = isMonthlyIncomeNonEditable || !(monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id) ? undefined : { id: monthlyIncome.id };
|
|
657
|
+
userPayload = {
|
|
658
|
+
occupation: occupationInfo,
|
|
659
|
+
source_income: sourceIncomeInfo,
|
|
660
|
+
monthly_income: monthlyIncomeInfo,
|
|
661
|
+
is_relative_PEP: pepInfo,
|
|
662
|
+
is_influencer: influencerInfo
|
|
663
|
+
};
|
|
664
|
+
shareHolderPayload = {
|
|
665
|
+
shares: isSharesAvailable
|
|
666
|
+
? {
|
|
667
|
+
count: shareCount && Number(shareCount),
|
|
668
|
+
value: shareValue && Number(shareValue)
|
|
669
|
+
}
|
|
670
|
+
: undefined
|
|
671
|
+
};
|
|
672
|
+
boardMemberPayload = {
|
|
673
|
+
is_relative_PEP: pepInfo,
|
|
674
|
+
is_influencer: influencerInfo
|
|
675
|
+
};
|
|
676
|
+
buyerMemberPayload = {
|
|
677
|
+
occupation: occupationInfo,
|
|
678
|
+
source_income: sourceIncomeInfo,
|
|
679
|
+
monthly_income: monthlyIncomeInfo
|
|
680
|
+
};
|
|
681
|
+
payload = userPayload;
|
|
682
|
+
if (type === IndividualType.SHARE_HOLDER)
|
|
683
|
+
payload = shareHolderPayload;
|
|
684
|
+
if (type === IndividualType.BOARD_MEMBER)
|
|
685
|
+
payload = boardMemberPayload;
|
|
686
|
+
if (type === IndividualType.BUYER)
|
|
687
|
+
payload = buyerMemberPayload;
|
|
688
|
+
if (type === IndividualType.CUSTOMER)
|
|
689
|
+
payload = {};
|
|
690
|
+
requestBody = __assign(__assign({ id: id, type: type }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
|
|
691
|
+
return [4, API.individualService.updateIndividual(requestBody)];
|
|
692
|
+
case 1:
|
|
693
|
+
data = _g.sent();
|
|
694
|
+
businessCountry = settings.data.businessCountry;
|
|
695
|
+
hasCivilIdDocument = (civilID || []).length > 0;
|
|
696
|
+
hasSignatureDocument = (signatureFileId || []).length > 0;
|
|
697
|
+
isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && (type === IndividualType.USER || type === IndividualType.BUYER);
|
|
698
|
+
civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
|
|
699
|
+
signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
|
|
700
|
+
if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 3];
|
|
701
|
+
documentBody = {
|
|
702
|
+
id: civilIdDocument.id,
|
|
703
|
+
images: civilID
|
|
704
|
+
};
|
|
705
|
+
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
706
|
+
case 2:
|
|
707
|
+
_g.sent();
|
|
708
|
+
_g.label = 3;
|
|
709
|
+
case 3:
|
|
710
|
+
if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 5];
|
|
711
|
+
documentBody = {
|
|
712
|
+
id: signatureDocument.id,
|
|
713
|
+
images: signatureFileId
|
|
714
|
+
};
|
|
715
|
+
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
716
|
+
case 4:
|
|
717
|
+
_g.sent();
|
|
718
|
+
_g.label = 5;
|
|
719
|
+
case 5:
|
|
720
|
+
documentsList = [];
|
|
721
|
+
if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
|
|
722
|
+
documentsList.push({ type: DocumentPurpose.IDENTITY_DOCUMENT, images: civilID });
|
|
723
|
+
if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
|
|
724
|
+
documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
|
|
725
|
+
if (!(documentsList.length > 0)) return [3, 7];
|
|
726
|
+
documentBody = {
|
|
727
|
+
individual_type_id: id || '',
|
|
728
|
+
country: businessCountry.iso2,
|
|
729
|
+
documents: documentsList
|
|
730
|
+
};
|
|
731
|
+
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
732
|
+
case 6:
|
|
733
|
+
_g.sent();
|
|
734
|
+
_g.label = 7;
|
|
735
|
+
case 7:
|
|
736
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
737
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
738
|
+
return [2, { data: data, formData: originalFormData }];
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
});
|
|
742
|
+
});
|
|
735
743
|
export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', function (_a) {
|
|
736
744
|
var email = _a.email, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
|
|
737
745
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -14,7 +14,7 @@ import * as React from 'react';
|
|
|
14
14
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
18
18
|
import { isSA } from '../../../../utils';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
@@ -49,6 +49,9 @@ var CollectBusinessInfo = function (_a) {
|
|
|
49
49
|
mode: 'onChange'
|
|
50
50
|
});
|
|
51
51
|
useSetFromDefaultValues(methods, data.businessData);
|
|
52
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
53
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
54
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
52
55
|
React.useEffect(function () {
|
|
53
56
|
if (error)
|
|
54
57
|
dispatch(clearError());
|
|
@@ -64,13 +67,11 @@ var CollectBusinessInfo = function (_a) {
|
|
|
64
67
|
licenseNumber: data.licenseNumber,
|
|
65
68
|
termAndConditionChecked: data.termAndConditionChecked
|
|
66
69
|
};
|
|
67
|
-
dispatch(updateLeadBusinessDataAsync(dataValues));
|
|
70
|
+
dispatch(updateLeadBusinessDataAsync(getFelids(dataValues)));
|
|
68
71
|
};
|
|
69
72
|
var onBack = function () {
|
|
70
73
|
dispatch(handlePrevScreenStep());
|
|
71
74
|
};
|
|
72
|
-
var originalReadOnly = useFormReadOnly(methods);
|
|
73
|
-
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
74
75
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
75
76
|
var disabled = brandErrChecks || brandNameChecking || isBrandNameAvailable == false;
|
|
76
77
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'], show: true, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(LicenseList, { readOnly: readOnly['selectedLicense'], onListOpen: function () {
|
package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js
CHANGED
|
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
|
|
19
19
|
import { AuthForType } from '../../../../@types';
|
|
20
20
|
import { useLanguage } from '../../../../hooks';
|
|
21
21
|
import { isKW } from '../../../../utils';
|
|
@@ -56,12 +56,15 @@ var CollectIndividualInfo = function (_a) {
|
|
|
56
56
|
mode: 'onChange'
|
|
57
57
|
});
|
|
58
58
|
useSetFromDefaultValues(methods, individualData, true);
|
|
59
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
60
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
61
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
59
62
|
React.useEffect(function () {
|
|
60
63
|
if (countryCode.iso2 !== methods.getValues('countryCode.iso2'))
|
|
61
64
|
methods.setValue('countryCode', countryCode);
|
|
62
65
|
}, [countryCode]);
|
|
63
66
|
var onSubmit = function (formData) {
|
|
64
|
-
dispatch(updateLeadIndividualAsync(formData));
|
|
67
|
+
dispatch(updateLeadIndividualAsync(getFelids(formData)));
|
|
65
68
|
};
|
|
66
69
|
var onBack = function () {
|
|
67
70
|
var _a;
|
|
@@ -81,8 +84,6 @@ var CollectIndividualInfo = function (_a) {
|
|
|
81
84
|
if (isEmailAvailable === false)
|
|
82
85
|
methods.setError('email', { message: 'tap_js_email_already_exist' });
|
|
83
86
|
}, [responseData]);
|
|
84
|
-
var originalReadOnly = useFormReadOnly(methods);
|
|
85
|
-
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
86
87
|
var isLeadEmailAvailable = (contact === null || contact === void 0 ? void 0 : contact.email) === methods.watch('email');
|
|
87
88
|
var isEmailValid = typeof isEmailAvailable === 'undefined' ? isLeadEmailAvailable : isEmailAvailable;
|
|
88
89
|
var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
|
|
@@ -67,9 +67,8 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
67
67
|
}); });
|
|
68
68
|
var cancelToken = null;
|
|
69
69
|
var Email = function (_a) {
|
|
70
|
-
var _b;
|
|
70
|
+
var _b, _c, _d, _e;
|
|
71
71
|
var show = _a.show, fetchingEmail = _a.fetchingEmail, emailChecking = _a.emailChecking, readOnly = _a.readOnly;
|
|
72
|
-
var _c = React.useState(''), storedEmail = _c[0], setStoredEmail = _c[1];
|
|
73
72
|
var dispatch = useAppDispatch();
|
|
74
73
|
var data = useAppSelector(connectExpressSelector).data;
|
|
75
74
|
var t = useTranslation().t;
|
|
@@ -77,6 +76,7 @@ var Email = function (_a) {
|
|
|
77
76
|
var emailControl = useController({ name: 'email', control: control });
|
|
78
77
|
var emailValue = emailControl.field.value;
|
|
79
78
|
var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
79
|
+
var email = (_e = (_d = (_c = data.responseData) === null || _c === void 0 ? void 0 : _c.leadData) === null || _d === void 0 ? void 0 : _d.contact) === null || _e === void 0 ? void 0 : _e.email;
|
|
80
80
|
var checkEmail = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
81
|
var onSuccess;
|
|
82
82
|
return __generator(this, function (_a) {
|
|
@@ -92,15 +92,9 @@ var Email = function (_a) {
|
|
|
92
92
|
var handleEmailChange = function (event) {
|
|
93
93
|
emailControl.field.onChange(event.target.value);
|
|
94
94
|
};
|
|
95
|
-
React.useEffect(function () {
|
|
96
|
-
var _a, _b, _c;
|
|
97
|
-
var email = (_c = (_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.leadData) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.email;
|
|
98
|
-
if (!!email)
|
|
99
|
-
setStoredEmail(email);
|
|
100
|
-
}, [data.responseData]);
|
|
101
95
|
React.useEffect(function () {
|
|
102
96
|
var isValid = emailValue && !error && emailValue.length > 3;
|
|
103
|
-
if (isValid && emailValue !=
|
|
97
|
+
if (isValid && emailValue != email) {
|
|
104
98
|
fetchingEmail(true);
|
|
105
99
|
checkEmail(emailValue);
|
|
106
100
|
}
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -17,7 +17,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
17
17
|
import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
|
|
18
18
|
import Box from '@mui/material/Box';
|
|
19
19
|
import { alpha, styled } from '@mui/material/styles';
|
|
20
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
20
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
21
21
|
import { DocumentPurpose, IndividualType } from '../../../../@types';
|
|
22
22
|
import { isSA } from '../../../../utils';
|
|
23
23
|
import Form from '../../../../components/Form';
|
|
@@ -80,10 +80,27 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
80
80
|
mode: 'onChange'
|
|
81
81
|
});
|
|
82
82
|
useSetFromDefaultValues(methods, data.individualData, true);
|
|
83
|
+
var defaultCivilIdFiles = React.useMemo(function () { return getFileDetailsFromDocument(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT); }, [user === null || user === void 0 ? void 0 : user.documents]);
|
|
84
|
+
var defaultSignatureFiles = React.useMemo(function () { return getFileDetailsFromDocument(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE); }, [user === null || user === void 0 ? void 0 : user.documents]);
|
|
85
|
+
var originalReadOnly = useFormReadOnly(methods, {
|
|
86
|
+
isPEP: typeof isPEP === 'boolean',
|
|
87
|
+
isInfluencer: typeof isInfluencer === 'boolean',
|
|
88
|
+
civilID: defaultCivilIdFiles,
|
|
89
|
+
signatureFileId: defaultSignatureFiles
|
|
90
|
+
});
|
|
91
|
+
var noneEditable = useDataNoneEditable(user === null || user === void 0 ? void 0 : user.data_status, [
|
|
92
|
+
'occupation',
|
|
93
|
+
'source_of_income',
|
|
94
|
+
'monthly_income',
|
|
95
|
+
'is_relative_PEP',
|
|
96
|
+
'is_influencer'
|
|
97
|
+
]);
|
|
98
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
99
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
83
100
|
var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
|
|
84
101
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
85
102
|
var onSubmit = function (data) {
|
|
86
|
-
dispatch(updateIndividualInfo(data));
|
|
103
|
+
dispatch(updateIndividualInfo(getFelids(data)));
|
|
87
104
|
};
|
|
88
105
|
var onBack = function () {
|
|
89
106
|
dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
@@ -106,22 +123,6 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
106
123
|
return t('type_board_member');
|
|
107
124
|
return t('type_user');
|
|
108
125
|
};
|
|
109
|
-
var defaultCivilIdFiles = React.useMemo(function () { return getFileDetailsFromDocument(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT); }, [user === null || user === void 0 ? void 0 : user.documents]);
|
|
110
|
-
var defaultSignatureFiles = React.useMemo(function () { return getFileDetailsFromDocument(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE); }, [user === null || user === void 0 ? void 0 : user.documents]);
|
|
111
|
-
var originalReadOnly = useFormReadOnly(methods, {
|
|
112
|
-
isPEP: typeof isPEP === 'boolean',
|
|
113
|
-
isInfluencer: typeof isInfluencer === 'boolean',
|
|
114
|
-
civilID: defaultCivilIdFiles,
|
|
115
|
-
signatureFileId: defaultSignatureFiles
|
|
116
|
-
});
|
|
117
|
-
var noneEditable = useDataNoneEditable(user === null || user === void 0 ? void 0 : user.data_status, [
|
|
118
|
-
'occupation',
|
|
119
|
-
'source_of_income',
|
|
120
|
-
'monthly_income',
|
|
121
|
-
'is_relative_PEP',
|
|
122
|
-
'is_influencer'
|
|
123
|
-
]);
|
|
124
|
-
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
125
126
|
var showSignatureFile = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
|
|
126
127
|
var showOccupationFile = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
|
|
127
128
|
var showSourceOfIncome = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
|
|
@@ -17,7 +17,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
17
17
|
import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
18
18
|
import Box from '@mui/material/Box';
|
|
19
19
|
import { alpha, styled } from '@mui/material/styles';
|
|
20
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
20
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
21
21
|
import { IndividualType } from '../../../../@types';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -101,8 +101,9 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
101
101
|
'nationality'
|
|
102
102
|
]);
|
|
103
103
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
104
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
104
105
|
var onSubmit = function (data) {
|
|
105
|
-
dispatch(updateIndividualPersonalInfo(data));
|
|
106
|
+
dispatch(updateIndividualPersonalInfo(getFelids(data)));
|
|
106
107
|
};
|
|
107
108
|
React.useEffect(function () {
|
|
108
109
|
if (error)
|
|
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
|
-
import { useAppDispatch, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
20
|
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
21
21
|
import Form from '../../../../components/Form';
|
|
22
22
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -49,8 +49,9 @@ var PhoneInfo = function (_a) {
|
|
|
49
49
|
var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
|
|
50
50
|
var originalReadOnly = useFormReadOnly(methods);
|
|
51
51
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
52
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
52
53
|
var onSubmit = function (formData) {
|
|
53
|
-
dispatch(updatePhoneInfo(formData));
|
|
54
|
+
dispatch(updatePhoneInfo(getFelids(formData)));
|
|
54
55
|
};
|
|
55
56
|
React.useEffect(function () {
|
|
56
57
|
if (error && methods.formState.isValid)
|
|
@@ -26,7 +26,7 @@ var ArrowIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return
|
|
|
26
26
|
height: theme.spacing(2),
|
|
27
27
|
transform: isAr ? 'scaleX(-1)' : 'scaleX(1)',
|
|
28
28
|
marginInlineEnd: theme.spacing(-0.375),
|
|
29
|
-
verticalAlign: '
|
|
29
|
+
verticalAlign: 'unset'
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
@@ -67,7 +67,7 @@ var Image = styled('img')(function (_a) {
|
|
|
67
67
|
height: theme.spacing(3),
|
|
68
68
|
fontSize: theme.spacing(3),
|
|
69
69
|
marginInlineStart: theme.spacing(1),
|
|
70
|
-
verticalAlign: '
|
|
70
|
+
verticalAlign: 'sub'
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
var TextStyled = styled('span')(function () { return ({
|