@tap-payments/auth-jsconnect 2.8.45-test → 2.8.48-development
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/bank/bankStore.js +6 -5
- package/build/features/app/brand/brandStore.js +90 -68
- package/build/features/app/entity/entityStore.d.ts +5 -1
- package/build/features/app/entity/entityStore.js +55 -42
- package/build/features/app/individual/individualStore.d.ts +1 -1
- package/build/features/app/individual/individualStore.js +27 -18
- package/build/features/app/tax/taxStore.js +1 -0
- package/build/features/bank/screens/BankDetails/BankDetails.js +0 -1
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +37 -9
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +15 -3
- package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +11 -4
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +23 -8
- package/build/features/entity/screens/EntityName/EntityName.js +24 -13
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +34 -9
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +59 -18
- package/build/hooks/useFormDirtyCheck.d.ts +5 -1
- package/build/hooks/useFormDirtyCheck.js +47 -10
- package/package.json +2 -2
|
@@ -562,9 +562,9 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
|
|
|
562
562
|
});
|
|
563
563
|
});
|
|
564
564
|
export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
|
|
565
|
-
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
565
|
+
var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
|
|
566
566
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
567
|
-
var _b, settings, individual, _c, recipient, user, entity, id,
|
|
567
|
+
var _b, settings, individual, _c, recipient, user, entity, id, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, _d, data_status, objects, ids, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, individualData, data, _e, isUser, isBuyer, isUserORBuyerType;
|
|
568
568
|
var _f, _g, _h, _j, _k;
|
|
569
569
|
return __generator(this, function (_l) {
|
|
570
570
|
switch (_l.label) {
|
|
@@ -572,11 +572,10 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
572
572
|
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
573
573
|
_c = individual.data.verify.responseBody || {}, recipient = _c.recipient, user = _c.user, entity = _c.entity;
|
|
574
574
|
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : recipient) || {}).id;
|
|
575
|
-
_d = user || {}, objects = _d.objects, ids = _d.ids;
|
|
576
575
|
countryCode = (originalFormData || {}).countryCode;
|
|
577
576
|
name = formData.name, email = formData.email, mobile = formData.mobile, gender = formData.gender, nid = formData.nid, issuedCountry = formData.issuedCountry, expiryDate = formData.expiryDate, dob = formData.dob, placeOfBirthCountry = formData.placeOfBirthCountry, placeOfBirthCity = formData.placeOfBirthCity, nationality = formData.nationality;
|
|
578
577
|
code = entity === null || entity === void 0 ? void 0 : entity.country;
|
|
579
|
-
|
|
578
|
+
_d = user || {}, data_status = _d.data_status, objects = _d.objects, ids = _d.ids;
|
|
580
579
|
userName = getUserNameObject(name);
|
|
581
580
|
identification_id_type = nid ? (nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA) : undefined;
|
|
582
581
|
if (isOtherThanKWOrSA(settings.data.businessCountry.iso2)) {
|
|
@@ -645,28 +644,33 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
645
644
|
'date_of_birth',
|
|
646
645
|
'nationality'
|
|
647
646
|
], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
|
|
647
|
+
individualData = undefined;
|
|
648
|
+
if (!isDirty) return [3, 2];
|
|
648
649
|
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
649
650
|
case 1:
|
|
650
651
|
data = _l.sent();
|
|
652
|
+
individualData = data;
|
|
653
|
+
_l.label = 2;
|
|
654
|
+
case 2:
|
|
651
655
|
_e = getIndividualType(objects), isUser = _e.isUser, isBuyer = _e.isBuyer;
|
|
652
656
|
isUserORBuyerType = isUser || isBuyer;
|
|
653
|
-
if (!isUserORBuyerType) return [3,
|
|
657
|
+
if (!isUserORBuyerType) return [3, 4];
|
|
654
658
|
return [4, thunkApi.dispatch(retrieveDataList(code))];
|
|
655
|
-
case 2:
|
|
656
|
-
_l.sent();
|
|
657
|
-
_l.label = 3;
|
|
658
659
|
case 3:
|
|
660
|
+
_l.sent();
|
|
661
|
+
_l.label = 4;
|
|
662
|
+
case 4:
|
|
659
663
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
660
664
|
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
|
|
661
|
-
return [2, { data:
|
|
665
|
+
return [2, { data: individualData, formData: originalFormData }];
|
|
662
666
|
}
|
|
663
667
|
});
|
|
664
668
|
});
|
|
665
669
|
});
|
|
666
670
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
|
|
667
|
-
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
671
|
+
var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
|
|
668
672
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
669
|
-
var _b, settings, individual, _c, recipient, user, userList, business, id, _d, objects, ids, isKWOrSAValue, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isAuthorized, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isAuthorizedNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, isAuthorizedInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody,
|
|
673
|
+
var _b, settings, individual, _c, recipient, user, userList, business, id, _d, objects, ids, isKWOrSAValue, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isAuthorized, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isAuthorizedNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, isAuthorizedInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, data, individualData, requestBody, user_2, userListRes;
|
|
670
674
|
var _f, _g;
|
|
671
675
|
return __generator(this, function (_h) {
|
|
672
676
|
switch (_h.label) {
|
|
@@ -762,18 +766,23 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
762
766
|
_h.sent();
|
|
763
767
|
_h.label = 6;
|
|
764
768
|
case 6:
|
|
769
|
+
data = undefined, individualData = user || {};
|
|
765
770
|
requestBody = __assign(__assign({ ids: (ids === null || ids === void 0 ? void 0 : ids.length) ? ids : [id] }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
|
|
771
|
+
if (!isDirty) return [3, 8];
|
|
766
772
|
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
767
773
|
case 7:
|
|
768
774
|
data = _h.sent();
|
|
769
|
-
|
|
775
|
+
user_2 = (sortUserList(mapUserList(data === null || data === void 0 ? void 0 : data.individuals)) || [])[0];
|
|
776
|
+
individualData = user_2;
|
|
777
|
+
_h.label = 8;
|
|
778
|
+
case 8:
|
|
770
779
|
userListRes = userList || [];
|
|
771
|
-
if (!((user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id) && !(user === null || user === void 0 ? void 0 : user.is_authorized) && isAuthorized && (business === null || business === void 0 ? void 0 : business.id))) return [3,
|
|
780
|
+
if (!((user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id) && !(user === null || user === void 0 ? void 0 : user.is_authorized) && isAuthorized && (business === null || business === void 0 ? void 0 : business.id))) return [3, 10];
|
|
772
781
|
return [4, thunkApi.dispatch(getIndividualList(business === null || business === void 0 ? void 0 : business.id)).unwrap()];
|
|
773
|
-
case 8:
|
|
774
|
-
userListRes = _h.sent();
|
|
775
|
-
_h.label = 9;
|
|
776
782
|
case 9:
|
|
783
|
+
userListRes = _h.sent();
|
|
784
|
+
_h.label = 10;
|
|
785
|
+
case 10:
|
|
777
786
|
thunkApi.dispatch(handleNextScreenStep());
|
|
778
787
|
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
|
|
779
788
|
return [2, { data: data, formData: originalFormData, individualData: individualData, userList: userListRes, isKWOrSACountry: isKWOrSAValue }];
|
|
@@ -1263,11 +1272,11 @@ export var individualSlice = createSlice({
|
|
|
1263
1272
|
state.loading = false;
|
|
1264
1273
|
state.error = null;
|
|
1265
1274
|
var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData, userList = _a.userList, isKWOrSACountry = _a.isKWOrSACountry;
|
|
1266
|
-
state.data.individualData = formData;
|
|
1275
|
+
state.data.individualData = __assign(__assign({}, formData), { civilID: undefined, signatureFileId: undefined });
|
|
1267
1276
|
state.data.individualData.responseBody = data;
|
|
1268
1277
|
var user = (state.data.verify.responseBody || {}).user;
|
|
1269
1278
|
var isSameUser = (user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id);
|
|
1270
|
-
var userInfo = __assign(__assign({}, user), (isSameUser &&
|
|
1279
|
+
var userInfo = __assign(__assign({}, user), (isSameUser && individualData && __assign({}, individualData)));
|
|
1271
1280
|
if (isSameUser && !isKWOrSACountry)
|
|
1272
1281
|
userInfo = __assign(__assign({}, user), { is_authorized: individualData.is_authorized });
|
|
1273
1282
|
var list = userList || [];
|
|
@@ -439,6 +439,7 @@ export var taxSlice = createSlice({
|
|
|
439
439
|
state.error = null;
|
|
440
440
|
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
441
441
|
state.data.taxData = formData;
|
|
442
|
+
state.data.taxData = __assign(__assign({}, formData), { documentId: undefined });
|
|
442
443
|
state.data.taxData.responseBody = data;
|
|
443
444
|
})
|
|
444
445
|
.addCase(updateTaxInfo.rejected, function (state, action) {
|
|
@@ -107,7 +107,6 @@ var BankDetails = function () {
|
|
|
107
107
|
bankName: bank_name,
|
|
108
108
|
confirmPolicy: is_acknowledged
|
|
109
109
|
}).isDirty;
|
|
110
|
-
console.log('isDirty', isDirty);
|
|
111
110
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
112
111
|
var onSubmit = function (data) {
|
|
113
112
|
var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
|
|
@@ -15,7 +15,7 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
15
15
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
16
|
import Form from '../../../../components/Form';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { BrandActivitiesValidationSchema } from './validation';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
@@ -36,11 +36,11 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
36
36
|
flexDirection: 'column'
|
|
37
37
|
}); });
|
|
38
38
|
var BrandActivities = function (_a) {
|
|
39
|
-
var _b, _c, _d, _e
|
|
40
|
-
var
|
|
39
|
+
var _b, _c, _d, _e;
|
|
40
|
+
var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
|
|
41
41
|
var dispatch = useAppDispatch();
|
|
42
|
-
var
|
|
43
|
-
var
|
|
42
|
+
var _g = useAppSelector(brandSelector), data = _g.data, loading = _g.loading, error = _g.error;
|
|
43
|
+
var _h = data.brandActivities, activities = _h.activities, customerLocations = _h.customerLocations, expectedCustomer = _h.expectedCustomer, expectedSale = _h.expectedSale, termAndConditionChecked = _h.termAndConditionChecked, refundPolicy = _h.refundPolicy, transactionPolicy = _h.transactionPolicy;
|
|
44
44
|
var ListType;
|
|
45
45
|
(function (ListType) {
|
|
46
46
|
ListType["ActivitiesList"] = "ActivitiesList";
|
|
@@ -62,7 +62,8 @@ var BrandActivities = function (_a) {
|
|
|
62
62
|
mode: 'onChange'
|
|
63
63
|
});
|
|
64
64
|
useSetFromDefaultValues(methods, data.brandActivities, true);
|
|
65
|
-
var
|
|
65
|
+
var _j = data.verify.responseBody || {}, activitiesDefaultValues = _j.activitiesDefaultValues, brand = _j.brand;
|
|
66
|
+
var _k = brand || {}, data_status = _k.data_status, data_verification = _k.data_verification, operations = _k.operations;
|
|
66
67
|
var originalReadOnly = useFormReadOnly(methods);
|
|
67
68
|
var noneEditable = useDataNoneEditable(data_status, [
|
|
68
69
|
'activities',
|
|
@@ -78,6 +79,32 @@ var BrandActivities = function (_a) {
|
|
|
78
79
|
'operations.sales_range'
|
|
79
80
|
]);
|
|
80
81
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
82
|
+
var isDirty = useFormDirtyCheck(methods, {
|
|
83
|
+
activities: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.activities,
|
|
84
|
+
customerLocations: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.customerLocations,
|
|
85
|
+
expectedCustomer: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.expectedCustomer,
|
|
86
|
+
expectedSale: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.expectedSale,
|
|
87
|
+
termAndConditionChecked: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.termAndConditionChecked,
|
|
88
|
+
refundPolicy: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.transactionPolicy,
|
|
89
|
+
transactionPolicy: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.refundPolicy
|
|
90
|
+
}, [
|
|
91
|
+
{
|
|
92
|
+
name: 'activities',
|
|
93
|
+
keys: ['id']
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'customerLocations',
|
|
97
|
+
keys: ['id']
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'expectedCustomer',
|
|
101
|
+
keys: ['id']
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'expectedSale',
|
|
105
|
+
keys: ['id']
|
|
106
|
+
}
|
|
107
|
+
]).isDirty;
|
|
81
108
|
var locations = methods.watch('customerLocations');
|
|
82
109
|
var isCustomerLocationsHasVerifiedValue = React.useMemo(function () {
|
|
83
110
|
var _a, _b;
|
|
@@ -92,10 +119,11 @@ var BrandActivities = function (_a) {
|
|
|
92
119
|
return (locationIds === null || locationIds === void 0 ? void 0 : locationIds.length) === (Ids === null || Ids === void 0 ? void 0 : Ids.length) && locationIds.every(function (locationId) { return Ids.includes(locationId); });
|
|
93
120
|
}, [locations, operations]);
|
|
94
121
|
var isCustomerLocationsVerified = dataVerified['operations.customer_base_location'] && isCustomerLocationsHasVerifiedValue;
|
|
95
|
-
var isExpectedSalesRangeVerified = dataVerified['operations.sales_range'] && ((
|
|
96
|
-
var isExpectedCustomersVerified = dataVerified['operations.customer_base'] && ((
|
|
122
|
+
var isExpectedSalesRangeVerified = dataVerified['operations.sales_range'] && ((_b = operations === null || operations === void 0 ? void 0 : operations.sales) === null || _b === void 0 ? void 0 : _b.id) === ((_c = methods.watch('expectedSale')) === null || _c === void 0 ? void 0 : _c.id);
|
|
123
|
+
var isExpectedCustomersVerified = dataVerified['operations.customer_base'] && ((_d = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _d === void 0 ? void 0 : _d.id) === ((_e = methods.watch('expectedCustomer')) === null || _e === void 0 ? void 0 : _e.id);
|
|
97
124
|
var onSubmit = function (data) {
|
|
98
|
-
|
|
125
|
+
var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
|
|
126
|
+
dispatch(updateBrandActivities(formData));
|
|
99
127
|
};
|
|
100
128
|
var onBack = function () {
|
|
101
129
|
dispatch(handlePrevScreenStep());
|
|
@@ -14,7 +14,7 @@ import React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
|
|
18
18
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
@@ -39,7 +39,7 @@ var BrandInfo = function (_a) {
|
|
|
39
39
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
40
40
|
var _d = data.brandData, brandName = _d.brandName, salesChannels = _d.salesChannels, brandLogoId = _d.brandLogoId, responseBody = _d.responseBody;
|
|
41
41
|
var _e = data.verify.responseBody || {}, brand = _e.brand, flows = _e.flows;
|
|
42
|
-
var _f = brand || {}, logo_details = _f.logo_details, data_status = _f.data_status, data_verification = _f.data_verification, name = _f.name;
|
|
42
|
+
var _f = brand || {}, logo_details = _f.logo_details, data_status = _f.data_status, data_verification = _f.data_verification, name = _f.name, channel_services = _f.channel_services;
|
|
43
43
|
var methods = useForm({
|
|
44
44
|
resolver: yupResolver(BrandValidationSchema()),
|
|
45
45
|
defaultValues: {
|
|
@@ -52,6 +52,17 @@ var BrandInfo = function (_a) {
|
|
|
52
52
|
var watch = methods.watch;
|
|
53
53
|
useSetFromDefaultValues(methods, data.brandData, true);
|
|
54
54
|
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
55
|
+
var initialSalesChannels = React.useMemo(function () { return mapSalesChannel(channel_services || []); }, [channel_services]);
|
|
56
|
+
var isDirty = useFormDirtyCheck(methods, {
|
|
57
|
+
brandName: ((name === null || name === void 0 ? void 0 : name.en) || '').trim(),
|
|
58
|
+
salesChannels: initialSalesChannels,
|
|
59
|
+
brandLogoId: defaultBrandLogoFile === null || defaultBrandLogoFile === void 0 ? void 0 : defaultBrandLogoFile.id
|
|
60
|
+
}, [
|
|
61
|
+
{
|
|
62
|
+
name: 'salesChannels',
|
|
63
|
+
keys: ['id', 'address', 'code', 'sub']
|
|
64
|
+
}
|
|
65
|
+
]).isDirty;
|
|
55
66
|
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
56
67
|
var noneEditable = useDataNoneEditable(data_status, ['name.en', 'name.ar', 'channel_services', 'logo']);
|
|
57
68
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
@@ -59,7 +70,8 @@ var BrandInfo = function (_a) {
|
|
|
59
70
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
60
71
|
var isBrandNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && ((name === null || name === void 0 ? void 0 : name.en) === watch('brandName') || (name === null || name === void 0 ? void 0 : name.ar) === watch('brandName'));
|
|
61
72
|
var onSubmit = function (data) {
|
|
62
|
-
|
|
73
|
+
var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
|
|
74
|
+
dispatch(updateBrand(formData));
|
|
63
75
|
};
|
|
64
76
|
var onBack = function () {
|
|
65
77
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
|
|
@@ -14,7 +14,7 @@ import React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
|
|
18
18
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -47,8 +47,8 @@ var BrandInfo = function (_a) {
|
|
|
47
47
|
var isAr = useLanguage().isAr;
|
|
48
48
|
var _l = useAppSelector(brandSelector), data = _l.data, loading = _l.loading, error = _l.error;
|
|
49
49
|
var _m = data.brandSegmentData, segmentLocation = _m.segmentLocation, segmentProfit = _m.segmentProfit, segmentTech = _m.segmentTech, teamSize = _m.teamSize;
|
|
50
|
-
var
|
|
51
|
-
var
|
|
50
|
+
var _o = data.verify.responseBody || {}, brand = _o.brand, segmentDefaultValues = _o.segmentDefaultValues;
|
|
51
|
+
var _p = brand || {}, data_status = _p.data_status, data_verification = _p.data_verification, resSegment = _p.segment;
|
|
52
52
|
var methods = useForm({
|
|
53
53
|
resolver: yupResolver(BrandValidationSchema()),
|
|
54
54
|
defaultValues: {
|
|
@@ -61,6 +61,12 @@ var BrandInfo = function (_a) {
|
|
|
61
61
|
});
|
|
62
62
|
var watch = methods.watch;
|
|
63
63
|
useSetFromDefaultValues(methods, data.brandSegmentData, true);
|
|
64
|
+
var isDirty = useFormDirtyCheck(methods, {
|
|
65
|
+
segmentLocation: segmentDefaultValues === null || segmentDefaultValues === void 0 ? void 0 : segmentDefaultValues.segmentLocation,
|
|
66
|
+
segmentProfit: segmentDefaultValues === null || segmentDefaultValues === void 0 ? void 0 : segmentDefaultValues.segmentProfit,
|
|
67
|
+
segmentTech: segmentDefaultValues === null || segmentDefaultValues === void 0 ? void 0 : segmentDefaultValues.segmentTech,
|
|
68
|
+
teamSize: segmentDefaultValues === null || segmentDefaultValues === void 0 ? void 0 : segmentDefaultValues.teamSize
|
|
69
|
+
}).isDirty;
|
|
64
70
|
var originalReadOnly = useFormReadOnly(methods);
|
|
65
71
|
var noneEditable = useDataNoneEditable(data_status, [
|
|
66
72
|
'segment.location_type',
|
|
@@ -81,7 +87,8 @@ var BrandInfo = function (_a) {
|
|
|
81
87
|
var isSegmentTechVerified = dataVerified['segment.tech_type'] && ((_f = resSegment === null || resSegment === void 0 ? void 0 : resSegment.tech_type) === null || _f === void 0 ? void 0 : _f.id) === ((_g = watch('segmentTech')) === null || _g === void 0 ? void 0 : _g.id);
|
|
82
88
|
var isTeamSizeVerified = dataVerified['segment.teams'] && ((_h = resSegment === null || resSegment === void 0 ? void 0 : resSegment.team) === null || _h === void 0 ? void 0 : _h.id) === ((_j = watch('teamSize')) === null || _j === void 0 ? void 0 : _j.id);
|
|
83
89
|
var onSubmit = function (data) {
|
|
84
|
-
|
|
90
|
+
var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
|
|
91
|
+
dispatch(updateSegmentBrand(formData));
|
|
85
92
|
};
|
|
86
93
|
var onBack = function () {
|
|
87
94
|
dispatch(handlePrevScreenStep());
|
|
@@ -15,8 +15,8 @@ import { FormProvider, useForm } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import Collapse from '@mui/material/Collapse';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
19
|
-
import { deepCopy, removeAllCharsFromNumber } from '../../../../utils';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
|
|
19
|
+
import { deepCopy, formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
20
20
|
import { clearError, entitySelector, updateEntityCapital } from '../../../app/entity/entityStore';
|
|
21
21
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
22
22
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
@@ -41,19 +41,33 @@ var EntityCapital = function (_a) {
|
|
|
41
41
|
var dispatch = useAppDispatch();
|
|
42
42
|
var _k = data.entityCapitalData, responseBody = _k.responseBody, capitalPaid = _k.capitalPaid, capitalShareCount = _k.capitalShareCount, capitalShareValue = _k.capitalShareValue, activities = _k.activities;
|
|
43
43
|
var entity = (data.verify.responseBody || {}).entity;
|
|
44
|
-
var _l = entity || {}, data_verification = _l.data_verification, capital = _l.capital;
|
|
44
|
+
var _l = entity || {}, data_verification = _l.data_verification, capital = _l.capital, resActivities = _l.activities;
|
|
45
|
+
var resCapitalPaidValue = (_b = capital === null || capital === void 0 ? void 0 : capital.paid) === null || _b === void 0 ? void 0 : _b.toString();
|
|
46
|
+
var resCapitalShareCount = (_d = (_c = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _c === void 0 ? void 0 : _c.count) === null || _d === void 0 ? void 0 : _d.toString();
|
|
47
|
+
var resCapitalShareValue = (_f = (_e = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.toString();
|
|
45
48
|
var methods = useForm({
|
|
46
49
|
resolver: yupResolver(EntityCapitalValidationSchema()),
|
|
47
50
|
defaultValues: {
|
|
48
51
|
activities: activities,
|
|
49
52
|
capitalPaid: capitalPaid,
|
|
50
|
-
capitalShareCount: capitalShareCount,
|
|
53
|
+
capitalShareCount: capitalShareCount === null || capitalShareCount === void 0 ? void 0 : capitalShareCount.toString(),
|
|
51
54
|
capitalShareValue: capitalShareValue
|
|
52
55
|
},
|
|
53
56
|
mode: 'onChange'
|
|
54
57
|
});
|
|
55
58
|
useSetFromDefaultValues(methods, data.entityCapitalData, true);
|
|
56
59
|
var watch = methods.watch;
|
|
60
|
+
var isDirty = useFormDirtyCheck(methods, {
|
|
61
|
+
activities: resActivities,
|
|
62
|
+
capitalPaid: resCapitalPaidValue && formatNumberAsCurrency(resCapitalPaidValue),
|
|
63
|
+
capitalShareCount: resCapitalShareCount,
|
|
64
|
+
capitalShareValue: resCapitalShareValue && formatNumberAsCurrency(resCapitalShareValue)
|
|
65
|
+
}, [
|
|
66
|
+
{
|
|
67
|
+
name: 'activities',
|
|
68
|
+
keys: ['id']
|
|
69
|
+
}
|
|
70
|
+
]).isDirty;
|
|
57
71
|
var originalReadOnly = useFormReadOnly(methods);
|
|
58
72
|
var noneEditable = useDataNoneEditable(entity === null || entity === void 0 ? void 0 : entity.data_status, [
|
|
59
73
|
'activities',
|
|
@@ -64,11 +78,12 @@ var EntityCapital = function (_a) {
|
|
|
64
78
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
65
79
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
66
80
|
var dataVerified = useDataVerified(data_verification, ['capital.paid', 'capital.shares.count', 'capital.shares.value']);
|
|
67
|
-
var isCapitalPaidVerified = dataVerified['capital.paid'] &&
|
|
68
|
-
var isCapitalShareCountVerified = dataVerified['capital.shares.count'] &&
|
|
69
|
-
var isCapitalShareValueVerified = dataVerified['capital.shares.value'] &&
|
|
81
|
+
var isCapitalPaidVerified = dataVerified['capital.paid'] && resCapitalPaidValue === removeAllCharsFromNumber(watch('capitalPaid'));
|
|
82
|
+
var isCapitalShareCountVerified = dataVerified['capital.shares.count'] && resCapitalShareCount === ((_g = watch('capitalShareCount')) === null || _g === void 0 ? void 0 : _g.toString());
|
|
83
|
+
var isCapitalShareValueVerified = dataVerified['capital.shares.value'] && resCapitalShareValue === removeAllCharsFromNumber(watch('capitalShareValue'));
|
|
70
84
|
var onSubmit = function (data) {
|
|
71
|
-
|
|
85
|
+
var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
|
|
86
|
+
dispatch(updateEntityCapital(formData));
|
|
72
87
|
};
|
|
73
88
|
var onBack = function () {
|
|
74
89
|
dispatch(handlePrevScreenStep());
|
|
@@ -15,7 +15,7 @@ import { FormProvider, useForm } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import { convertToEnglishDateFormat, deepCopy, getFileDetailsFromDocument, isKW, isSA } from '../../../../utils';
|
|
21
21
|
import { BusinessType, DocumentPurpose } from '../../../../@types';
|
|
@@ -38,22 +38,22 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
38
38
|
flexDirection: 'column'
|
|
39
39
|
}); });
|
|
40
40
|
var EntityName = function (_a) {
|
|
41
|
-
var _b;
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
41
|
+
var _b, _c;
|
|
42
|
+
var _d = React.useState(false), issueAnchorEl = _d[0], setIssueAnchorEl = _d[1];
|
|
43
|
+
var _e = React.useState(false), expiryAnchorEl = _e[0], setExpiryAnchorEl = _e[1];
|
|
44
|
+
var _f = React.useState(false), entityTypeAnchorEl = _f[0], setEntityTypeAnchorEl = _f[1];
|
|
45
|
+
var _g = useAppSelector(entitySelector), data = _g.data, loading = _g.loading, error = _g.error, uploading = _g.uploading, uploadingArticle = _g.uploadingArticle;
|
|
46
46
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
47
47
|
var isAr = useLanguage().isAr;
|
|
48
48
|
var t = useTranslation().t;
|
|
49
49
|
var dispatch = useAppDispatch();
|
|
50
|
-
var
|
|
50
|
+
var _h = data.entityNameData, legalName = _h.legalName, licenseNumber = _h.licenseNumber, licenseType = _h.licenseType, entityType = _h.entityType, issuingDate = _h.issuingDate, expiryDate = _h.expiryDate, unifiedNumber = _h.unifiedNumber, certificateId = _h.certificateId, articleId = _h.articleId;
|
|
51
51
|
var country_code = settingsData.businessCountry.iso2;
|
|
52
52
|
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
53
53
|
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
54
54
|
var isCR = licenseType === BusinessType.CR;
|
|
55
|
-
var
|
|
56
|
-
var
|
|
55
|
+
var _j = data.verify.responseBody || {}, entity = _j.entity, flows = _j.flows, entityTypes = _j.entityTypes;
|
|
56
|
+
var _k = entity || {}, AOA_file = _k.AOA_file, id = _k.id, documents = _k.documents, data_status = _k.data_status, data_verification = _k.data_verification, legal_name = _k.legal_name, type = _k.type, license = _k.license;
|
|
57
57
|
var getSchema = function () {
|
|
58
58
|
if (isSACountry)
|
|
59
59
|
return EntityNameValidationSchema();
|
|
@@ -80,6 +80,18 @@ var EntityName = function (_a) {
|
|
|
80
80
|
useSetFromDefaultValues(methods, data.entityNameData, true);
|
|
81
81
|
var defaultCertificateFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.CR); }, [documents]);
|
|
82
82
|
var defaultArticleFile = React.useMemo(function () { return AOA_file && __assign(__assign({}, AOA_file), { docId: id }); }, [AOA_file]);
|
|
83
|
+
var issueDateRes = (license === null || license === void 0 ? void 0 : license.issuing_date) && convertToEnglishDateFormat(new Date(license.issuing_date));
|
|
84
|
+
var expDateRes = (license === null || license === void 0 ? void 0 : license.expiry_date) && convertToEnglishDateFormat(new Date(license.expiry_date));
|
|
85
|
+
var isDirty = useFormDirtyCheck(methods, {
|
|
86
|
+
legalName: (legal_name === null || legal_name === void 0 ? void 0 : legal_name.en) || (legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar),
|
|
87
|
+
licenseNumber: license === null || license === void 0 ? void 0 : license.number,
|
|
88
|
+
licenseType: (license === null || license === void 0 ? void 0 : license.type) === 'freelance' ? BusinessType.FL : BusinessType.CR,
|
|
89
|
+
entityType: type || (entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes[0]),
|
|
90
|
+
issuingDate: issueDateRes,
|
|
91
|
+
expiryDate: expDateRes,
|
|
92
|
+
unifiedNumber: (_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number,
|
|
93
|
+
articleId: defaultArticleFile === null || defaultArticleFile === void 0 ? void 0 : defaultArticleFile.id
|
|
94
|
+
}).isDirty;
|
|
83
95
|
var originalReadOnly = useFormReadOnly(methods, { certificateId: defaultCertificateFiles, articleId: defaultArticleFile });
|
|
84
96
|
var noneEditable = useDataNoneEditable(data_status, [
|
|
85
97
|
'legal_name.en',
|
|
@@ -104,17 +116,16 @@ var EntityName = function (_a) {
|
|
|
104
116
|
'license.expiry_date',
|
|
105
117
|
'AOA_file_id'
|
|
106
118
|
]);
|
|
107
|
-
var issueDateRes = (license === null || license === void 0 ? void 0 : license.issuing_date) && convertToEnglishDateFormat(new Date(license.issuing_date));
|
|
108
|
-
var expDateRes = (license === null || license === void 0 ? void 0 : license.expiry_date) && convertToEnglishDateFormat(new Date(license.expiry_date));
|
|
109
119
|
var isLegalNameVerified = dataVerified['legal_name.en'] && dataVerified['legal_name.ar'] && ((legal_name === null || legal_name === void 0 ? void 0 : legal_name.en) === watch('legalName') || (legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar) === watch('legalName'));
|
|
110
120
|
var isEntityTypeVerified = dataVerified['type'] && type === watch('entityType');
|
|
111
121
|
var isLicenseNumberVerified = dataVerified['license.number'] && (license === null || license === void 0 ? void 0 : license.number) === watch('licenseNumber');
|
|
112
|
-
var isUnifiedNumberVerified = dataVerified['license.additional_info'] && ((
|
|
122
|
+
var isUnifiedNumberVerified = dataVerified['license.additional_info'] && ((_c = license === null || license === void 0 ? void 0 : license.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) === watch('unifiedNumber');
|
|
113
123
|
var isIssuingDateVerified = dataVerified['license.issuing_date'] && issueDateRes === watch('issuingDate');
|
|
114
124
|
var isExpiryDateVerified = dataVerified['license.expiry_date'] && expDateRes === watch('expiryDate');
|
|
115
125
|
var isArticleIdVerified = dataVerified['AOA_file_id'];
|
|
116
126
|
var onSubmit = function (data) {
|
|
117
|
-
|
|
127
|
+
var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
|
|
128
|
+
dispatch(updateEntityName(formData));
|
|
118
129
|
};
|
|
119
130
|
var handleIssueDateOpenClose = function (flag) {
|
|
120
131
|
setIssueAnchorEl(flag);
|
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, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
20
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
|
|
21
21
|
import { DocumentPurpose, IndividualType } from '../../../../@types';
|
|
22
22
|
import { deepCopy, getIndividualType, isKW, isKWOrSA } from '../../../../utils';
|
|
23
23
|
import Form from '../../../../components/Form';
|
|
@@ -53,16 +53,16 @@ var ListType;
|
|
|
53
53
|
ListType["OccupationList"] = "OccupationList";
|
|
54
54
|
})(ListType || (ListType = {}));
|
|
55
55
|
var AdditionalIndividualInfo = function (_a) {
|
|
56
|
-
var _b;
|
|
56
|
+
var _b, _c, _d, _e;
|
|
57
57
|
var t = useTranslation().t;
|
|
58
58
|
var isAr = useLanguage().isAr;
|
|
59
59
|
var dispatch = useAppDispatch();
|
|
60
|
-
var
|
|
60
|
+
var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading, error = _f.error;
|
|
61
61
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
62
62
|
var verify = data.verify;
|
|
63
63
|
var user = (verify.responseBody || {}).user;
|
|
64
|
-
var
|
|
65
|
-
var
|
|
64
|
+
var _g = data.individualData, occupation = _g.occupation, sourceIncome = _g.sourceIncome, monthlyIncome = _g.monthlyIncome, employerName = _g.employerName, isPEP = _g.isPEP, isInfluencer = _g.isInfluencer, civilID = _g.civilID, signatureFileId = _g.signatureFileId, civilIDUploading = _g.civilIDUploading, signatureFileUploading = _g.signatureFileUploading, shareCount = _g.shareCount, shareValue = _g.shareValue, isAuthorized = _g.isAuthorized;
|
|
65
|
+
var _h = user || {}, documents = _h.documents, is_authorized = _h.is_authorized, data_status = _h.data_status, data_verification = _h.data_verification, names = _h.names, role = _h.role, occupationRes = _h.occupation, source_income = _h.source_income, monthly_income = _h.monthly_income, shares = _h.shares, is_relative_PEP = _h.is_relative_PEP, is_influencer = _h.is_influencer, objects = _h.objects;
|
|
66
66
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
67
67
|
var isOtherThanKWAndSa = React.useMemo(function () { return !isKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
68
68
|
var showIsAuthorized = isOtherThanKWAndSa;
|
|
@@ -95,6 +95,30 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
95
95
|
civilID: defaultCivilIdFiles,
|
|
96
96
|
signatureFileId: defaultSignatureFiles
|
|
97
97
|
});
|
|
98
|
+
var isDirty = useFormDirtyCheck(methods, {
|
|
99
|
+
occupation: ((_b = occupationRes === null || occupationRes === void 0 ? void 0 : occupationRes.chapter) === null || _b === void 0 ? void 0 : _b.id) && { id: occupationRes.chapter.id },
|
|
100
|
+
sourceIncome: source_income === null || source_income === void 0 ? void 0 : source_income[0],
|
|
101
|
+
monthlyIncome: monthly_income,
|
|
102
|
+
employerName: '',
|
|
103
|
+
isPEP: is_relative_PEP,
|
|
104
|
+
isInfluencer: is_influencer,
|
|
105
|
+
shareCount: (_c = shares === null || shares === void 0 ? void 0 : shares.count) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
106
|
+
shareValue: (_d = shares === null || shares === void 0 ? void 0 : shares.value) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
107
|
+
isAuthorized: is_authorized
|
|
108
|
+
}, [
|
|
109
|
+
{
|
|
110
|
+
name: 'occupation',
|
|
111
|
+
keys: ['id']
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'sourceIncome',
|
|
115
|
+
keys: ['id']
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'monthlyIncome',
|
|
119
|
+
keys: ['id']
|
|
120
|
+
}
|
|
121
|
+
]).isDirty;
|
|
98
122
|
var noneEditable = useDataNoneEditable(data_status, [
|
|
99
123
|
'occupation',
|
|
100
124
|
'source_of_income',
|
|
@@ -106,13 +130,14 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
106
130
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
107
131
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
108
132
|
var dataVerified = useDataVerified(data_verification, ['occupation', 'is_relative_PEP', 'is_influencer']);
|
|
109
|
-
var isOccupationVerified = dataVerified['occupation'] && (occupationRes === null || occupationRes === void 0 ? void 0 : occupationRes.id) === ((
|
|
133
|
+
var isOccupationVerified = dataVerified['occupation'] && (occupationRes === null || occupationRes === void 0 ? void 0 : occupationRes.id) === ((_e = watch('occupation')) === null || _e === void 0 ? void 0 : _e.id);
|
|
110
134
|
var isPEPSwitchVerified = dataVerified['is_relative_PEP'] && is_relative_PEP === watch('isPEP');
|
|
111
135
|
var isInfluencerSwitchVerified = dataVerified['is_influencer'] && is_influencer === watch('isInfluencer');
|
|
112
136
|
var isAuthorizedSwitchVerified = dataVerified['is_authorized'] && is_authorized === watch('isAuthorized');
|
|
113
|
-
var
|
|
137
|
+
var _j = React.useState(), listActive = _j[0], setListActive = _j[1];
|
|
114
138
|
var onSubmit = function (data) {
|
|
115
|
-
|
|
139
|
+
var formData = __assign(__assign({}, deepCopy(getFelids(__assign(__assign({}, data), { signatureFileUploading: signatureFileUploading, civilIDUploading: civilIDUploading })))), { isDirty: isDirty });
|
|
140
|
+
dispatch(updateIndividualInfo(formData));
|
|
116
141
|
};
|
|
117
142
|
var onBack = function () {
|
|
118
143
|
dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
@@ -137,7 +162,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
137
162
|
return t('type_board_member');
|
|
138
163
|
return t('type_user');
|
|
139
164
|
};
|
|
140
|
-
var
|
|
165
|
+
var _k = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _k.isUser, isShareholder = _k.isShareholder, isBoardMember = _k.isBoardMember, isBuyer = _k.isBuyer;
|
|
141
166
|
var isUserORBuyerType = isUser || isBuyer;
|
|
142
167
|
var isUserORBoardMemberType = isUser || isBoardMember;
|
|
143
168
|
var isAuthorizedValue = watch('isAuthorized');
|