@tap-payments/auth-jsconnect 2.8.55-beta → 2.8.55-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/@types/app.d.ts +1 -0
- package/build/@types/form.d.ts +1 -0
- package/build/@types/redux.d.ts +1 -0
- package/build/api/entity.d.ts +2 -2
- package/build/api/entity.js +12 -4
- package/build/api/index.d.ts +2 -2
- package/build/constants/api.d.ts +0 -1
- package/build/constants/api.js +0 -2
- package/build/constants/app.d.ts +0 -2
- package/build/constants/app.js +0 -2
- package/build/features/app/bank/bankStore.d.ts +13 -18
- package/build/features/app/bank/bankStore.js +184 -165
- package/build/features/app/board/boardStore.js +52 -30
- package/build/features/app/brand/brandStore.d.ts +16 -33
- package/build/features/app/brand/brandStore.js +239 -242
- package/build/features/app/business/businessStore.d.ts +0 -5
- package/build/features/app/business/businessStore.js +76 -87
- package/build/features/app/connectExpress/connectExpressStore.d.ts +15 -6
- package/build/features/app/connectExpress/connectExpressStore.js +110 -52
- package/build/features/app/entity/entityStore.d.ts +20 -36
- package/build/features/app/entity/entityStore.js +196 -246
- package/build/features/app/individual/individualStore.d.ts +22 -38
- package/build/features/app/individual/individualStore.js +263 -266
- package/build/features/app/password/passwordStore.d.ts +40 -23
- package/build/features/app/password/passwordStore.js +226 -233
- package/build/features/app/tax/taxStore.d.ts +13 -7
- package/build/features/app/tax/taxStore.js +168 -147
- package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +13 -1
- package/build/features/auth/screens/BusinessCountry/BusinessCountry.js +7 -1
- package/build/features/bank/Bank.d.ts +1 -0
- package/build/features/bank/Bank.js +7 -4
- package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
- package/build/features/bank/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/bank/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/bank/screens/OperatorError/index.d.ts +3 -0
- package/build/features/bank/screens/OperatorError/index.js +2 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/bank/screens/Verify/Verify.js +5 -5
- package/build/features/board/Board.js +8 -4
- package/build/features/board/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/board/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/board/screens/OperatorError/index.d.ts +3 -0
- package/build/features/board/screens/OperatorError/index.js +2 -0
- package/build/features/board/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -4
- package/build/features/brand/Brand.d.ts +1 -0
- package/build/features/brand/Brand.js +7 -4
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +49 -12
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +6 -3
- package/build/features/brand/screens/BrandActivities/RefundPolicy.js +1 -1
- package/build/features/brand/screens/BrandActivities/TAC.js +1 -1
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +1 -1
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +23 -5
- package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +23 -7
- package/build/features/brand/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/brand/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/brand/screens/OperatorError/index.d.ts +3 -0
- package/build/features/brand/screens/OperatorError/index.js +2 -0
- package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/brand/screens/Verify/Verify.js +1 -1
- package/build/features/business/Business.js +9 -4
- package/build/features/business/screens/Activities/Activities.js +12 -3
- package/build/features/business/screens/BusinessType/BusinessType.js +10 -2
- package/build/features/business/screens/CivilID/CivilID.js +1 -1
- package/build/features/business/screens/Customers/Customers.js +12 -3
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +6 -3
- package/build/features/business/screens/IDBOD/IDBOD.js +10 -2
- package/build/features/business/screens/OTP/OTP.js +1 -1
- package/build/features/business/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/business/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/business/screens/OperatorError/index.d.ts +3 -0
- package/build/features/business/screens/OperatorError/index.js +2 -0
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -3
- package/build/features/business/screens/Verify/Verify.js +13 -3
- package/build/features/connect/Connect.js +3 -2
- package/build/features/connect/screens/BrandSegment/BrandSegment.js +1 -1
- package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +9 -2
- package/build/features/connect/screens/CivilID/CivilID.js +1 -1
- package/build/features/connect/screens/Individual/Email.js +3 -1
- package/build/features/connect/screens/Individual/Individual.js +1 -1
- package/build/features/connect/screens/Merchant/BrandList.js +3 -3
- package/build/features/connect/screens/Merchant/Merchant.js +1 -1
- package/build/features/connect/screens/Merchant/SalesChannels.js +1 -1
- package/build/features/connect/screens/Mobile/Mobile.js +11 -8
- package/build/features/connect/screens/NID/NID.js +1 -1
- package/build/features/connect/screens/OperatorError/OperatorError.js +1 -1
- package/build/features/connectExpress/ConnectExpress.js +2 -1
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +5 -2
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +9 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +90 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +6 -1
- package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +3 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.js +10 -0
- package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +7 -1
- package/build/features/connectExpress/screens/CivilID/CivilID.js +1 -1
- package/build/features/connectExpress/screens/CivilIDMissed/CivilID.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +1 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +3 -1
- package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +14 -24
- package/build/features/connectExpress/screens/Mobile/Mobile.js +9 -2
- package/build/features/connectExpress/screens/NID/NID.js +1 -1
- package/build/features/connectExpress/screens/NIDMissed/NID.js +1 -1
- package/build/features/connectExpress/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/connectExpress/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/connectExpress/screens/OperatorError/index.d.ts +3 -0
- package/build/features/connectExpress/screens/OperatorError/index.js +2 -0
- package/build/features/connectExpress/screens/PrepareDataLoading/PrepareDataLoading.d.ts +5 -0
- package/build/features/connectExpress/screens/PrepareDataLoading/PrepareDataLoading.js +34 -0
- package/build/features/connectExpress/screens/PrepareDataLoading/index.d.ts +2 -0
- package/build/features/connectExpress/screens/PrepareDataLoading/index.js +2 -0
- package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/entity/Entity.d.ts +1 -0
- package/build/features/entity/Entity.js +7 -4
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +8 -4
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +8 -4
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +34 -10
- package/build/features/entity/screens/EntityName/EntityName.js +32 -15
- package/build/features/entity/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/entity/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/entity/screens/OperatorError/index.d.ts +3 -0
- package/build/features/entity/screens/OperatorError/index.js +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/entity/screens/Verify/Verify.js +1 -1
- package/build/features/featuresScreens.js +67 -7
- package/build/features/individual/Individual.d.ts +1 -0
- package/build/features/individual/Individual.js +7 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +54 -14
- package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +14 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.js +76 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +5 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +8 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +4 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +3 -2
- package/build/features/individual/screens/IndividualList/Email.js +3 -2
- package/build/features/individual/screens/IndividualList/IndividualList.js +18 -5
- package/build/features/individual/screens/IndividualList/UserList.js +13 -9
- package/build/features/individual/screens/IndividualPersonalInfo/Email.js +4 -2
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +76 -20
- package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +1 -1
- package/build/features/individual/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/individual/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/individual/screens/OperatorError/index.d.ts +3 -0
- package/build/features/individual/screens/OperatorError/index.js +2 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/individual/screens/Verify/Verify.js +1 -1
- package/build/features/password/Password.d.ts +1 -0
- package/build/features/password/Password.js +75 -28
- package/build/features/password/screens/CreatePassword/CreatePassword.js +8 -4
- package/build/features/password/screens/OTP/OTP.js +1 -1
- package/build/features/password/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/password/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/password/screens/OperatorError/index.d.ts +3 -0
- package/build/features/password/screens/OperatorError/index.js +2 -0
- package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
- package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.js +10 -0
- package/build/features/password/screens/PrepareDataLoading/index.d.ts +2 -0
- package/build/features/password/screens/PrepareDataLoading/index.js +2 -0
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/password/screens/Verify/Verify.js +5 -5
- package/build/features/shared/Button/FlowsButtons.js +13 -3
- package/build/features/shared/Containers/FeatureContainer.d.ts +1 -0
- package/build/features/shared/Containers/FeatureContainer.js +3 -3
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +5 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +3 -3
- package/build/features/signIn/SignIn.js +12 -3
- package/build/features/signIn/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/signIn/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/signIn/screens/OperatorError/index.d.ts +3 -0
- package/build/features/signIn/screens/OperatorError/index.js +2 -0
- package/build/features/tax/Tax.d.ts +1 -0
- package/build/features/tax/Tax.js +7 -4
- package/build/features/tax/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/tax/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/tax/screens/OperatorError/index.d.ts +3 -0
- package/build/features/tax/screens/OperatorError/index.js +2 -0
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +7 -2
- package/build/features/tax/screens/Verify/Verify.js +5 -5
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useFormDirtyCheck.d.ts +10 -0
- package/build/hooks/useFormDirtyCheck.js +66 -0
- package/build/hooks/useVerifyToken.d.ts +5 -2
- package/build/hooks/useVerifyToken.js +10 -5
- package/build/utils/common.js +4 -4
- package/build/utils/locale.js +2 -1
- package/build/utils/string.d.ts +5 -2
- package/build/utils/string.js +34 -5
- package/package.json +2 -2
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -17,9 +17,9 @@ 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
|
-
import { deepCopy, getIndividualType, isKW } from '../../../../utils';
|
|
22
|
+
import { deepCopy, getIndividualType, isKW, isKWOrSA, sendCustomEventToGTM } from '../../../../utils';
|
|
23
23
|
import Form from '../../../../components/Form';
|
|
24
24
|
import Collapse from '../../../../components/Collapse';
|
|
25
25
|
import Text from '../../../../components/Text';
|
|
@@ -37,6 +37,7 @@ import SignatureFile from './SignatureFile';
|
|
|
37
37
|
import ShareCount from './ShareCount';
|
|
38
38
|
import ShareValue from './ShareValue';
|
|
39
39
|
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
40
|
+
import IsAuthorizedSwitch from './IsAuthorizedSwitch';
|
|
40
41
|
var TextBoxStyled = styled(Box)(function (_a) {
|
|
41
42
|
var theme = _a.theme;
|
|
42
43
|
return (__assign(__assign({ display: 'flex', justifyContent: 'center', flexDirection: 'row', padding: theme.spacing(1.8, 2.5, 1.8, 2.5) }, theme.typography.body1), { lineHeight: theme.spacing(2.5), color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium }));
|
|
@@ -52,19 +53,21 @@ var ListType;
|
|
|
52
53
|
ListType["OccupationList"] = "OccupationList";
|
|
53
54
|
})(ListType || (ListType = {}));
|
|
54
55
|
var AdditionalIndividualInfo = function (_a) {
|
|
55
|
-
var _b;
|
|
56
|
+
var _b, _c, _d, _e;
|
|
56
57
|
var t = useTranslation().t;
|
|
57
58
|
var isAr = useLanguage().isAr;
|
|
58
59
|
var dispatch = useAppDispatch();
|
|
59
|
-
var
|
|
60
|
+
var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading, error = _f.error;
|
|
60
61
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
61
62
|
var verify = data.verify;
|
|
62
63
|
var user = (verify.responseBody || {}).user;
|
|
63
|
-
var
|
|
64
|
-
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;
|
|
65
66
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
67
|
+
var isOtherThanKWAndSa = React.useMemo(function () { return !isKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
68
|
+
var showIsAuthorized = isOtherThanKWAndSa;
|
|
66
69
|
var methods = useForm({
|
|
67
|
-
resolver: yupResolver(IndividualInfoValidationSchema(objects, isKWCountry)),
|
|
70
|
+
resolver: yupResolver(IndividualInfoValidationSchema(objects, isKWCountry, showIsAuthorized)),
|
|
68
71
|
defaultValues: {
|
|
69
72
|
occupation: occupation,
|
|
70
73
|
sourceIncome: sourceIncome,
|
|
@@ -77,7 +80,8 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
77
80
|
civilIDUploading: civilIDUploading,
|
|
78
81
|
signatureFileUploading: signatureFileUploading,
|
|
79
82
|
shareCount: shareCount,
|
|
80
|
-
shareValue: shareValue
|
|
83
|
+
shareValue: shareValue,
|
|
84
|
+
isAuthorized: isAuthorized
|
|
81
85
|
},
|
|
82
86
|
mode: 'onChange'
|
|
83
87
|
});
|
|
@@ -91,22 +95,57 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
91
95
|
civilID: defaultCivilIdFiles,
|
|
92
96
|
signatureFileId: defaultSignatureFiles
|
|
93
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;
|
|
94
122
|
var noneEditable = useDataNoneEditable(data_status, [
|
|
95
123
|
'occupation',
|
|
96
124
|
'source_of_income',
|
|
97
125
|
'monthly_income',
|
|
98
126
|
'is_relative_PEP',
|
|
99
|
-
'is_influencer'
|
|
127
|
+
'is_influencer',
|
|
128
|
+
'is_authorized'
|
|
100
129
|
]);
|
|
101
130
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
102
131
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
103
132
|
var dataVerified = useDataVerified(data_verification, ['occupation', 'is_relative_PEP', 'is_influencer']);
|
|
104
|
-
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);
|
|
105
134
|
var isPEPSwitchVerified = dataVerified['is_relative_PEP'] && is_relative_PEP === watch('isPEP');
|
|
106
135
|
var isInfluencerSwitchVerified = dataVerified['is_influencer'] && is_influencer === watch('isInfluencer');
|
|
107
|
-
var
|
|
136
|
+
var isAuthorizedSwitchVerified = dataVerified['is_authorized'] && is_authorized === watch('isAuthorized');
|
|
137
|
+
var _j = React.useState(), listActive = _j[0], setListActive = _j[1];
|
|
138
|
+
React.useEffect(function () {
|
|
139
|
+
sendCustomEventToGTM({
|
|
140
|
+
event: 'Send Event',
|
|
141
|
+
event_category: 'Board Flows - Individual',
|
|
142
|
+
event_action: 'Income Details Page',
|
|
143
|
+
event_label: settingsData.businessCountry.iso2
|
|
144
|
+
});
|
|
145
|
+
}, []);
|
|
108
146
|
var onSubmit = function (data) {
|
|
109
|
-
|
|
147
|
+
var formData = __assign(__assign({}, deepCopy(getFelids(__assign(__assign({}, data), { signatureFileUploading: signatureFileUploading, civilIDUploading: civilIDUploading })))), { isDirty: isDirty });
|
|
148
|
+
dispatch(updateIndividualInfo(formData));
|
|
110
149
|
};
|
|
111
150
|
var onBack = function () {
|
|
112
151
|
dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
@@ -131,9 +170,10 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
131
170
|
return t('type_board_member');
|
|
132
171
|
return t('type_user');
|
|
133
172
|
};
|
|
134
|
-
var
|
|
173
|
+
var _k = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _k.isUser, isShareholder = _k.isShareholder, isBoardMember = _k.isBoardMember, isBuyer = _k.isBuyer;
|
|
135
174
|
var isUserORBuyerType = isUser || isBuyer;
|
|
136
175
|
var isUserORBoardMemberType = isUser || isBoardMember;
|
|
176
|
+
var isAuthorizedValue = watch('isAuthorized');
|
|
137
177
|
var showSignatureFile = isUserORBuyerType;
|
|
138
178
|
var showOccupationFile = isUserORBuyerType;
|
|
139
179
|
var showSourceOfIncome = isUserORBuyerType;
|
|
@@ -144,7 +184,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
144
184
|
var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
|
|
145
185
|
var isOccupationListActive = listActive === ListType.OccupationList;
|
|
146
186
|
var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
|
|
147
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children:
|
|
187
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { isVerified: isOccupationVerified, readOnly: readOnly['occupation'] || noneEditable['occupation'], onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { readOnly: readOnly['sourceIncome'] || noneEditable['source_of_income'], onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { readOnly: readOnly['monthlyIncome'] || noneEditable['monthly_income'], show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares, readOnly: readOnly['shareCount'] }), _jsx(ShareValue, { show: !listActive && showShares, readOnly: readOnly['shareValue'] }), _jsx(IsAuthorizedSwitch, { show: !listActive && showIsAuthorized, readOnly: readOnly['isAuthorized'] || noneEditable['is_authorized'], isVerified: isAuthorizedSwitchVerified }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: isKWCountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show: isAuthorizedValue && showSignatureFile, readOnly: readOnly['signatureFileId'], defaultFiles: defaultSignatureFiles })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive, readOnly: readOnly['isPEP'] || noneEditable['is_relative_PEP'], isVerified: isPEPSwitchVerified }), _jsx(InfluencerSwitch, { show: showIsInfluencer && isKWCountry && !listActive, readOnly: readOnly['isInfluencer'] || noneEditable['is_influencer'], isVerified: isInfluencerSwitchVerified })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
|
|
148
188
|
};
|
|
149
189
|
export default React.memo(AdditionalIndividualInfo);
|
|
150
190
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const InfoIconStyled: import("@emotion/styled").StyledComponent<import("@mui/material").SvgIconOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
4
|
+
}, "className" | "style" | "classes" | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
5
|
+
export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledComponent<import("@mui/material").SvgIconOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
7
|
+
}, "className" | "style" | "classes" | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
8
|
+
export interface IsAuthorizedSwitchProps {
|
|
9
|
+
show: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
isVerified?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly, isVerified }: IsAuthorizedSwitchProps) => import("react/jsx-runtime").JSX.Element>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
16
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
17
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
18
|
+
import Box from '@mui/material/Box';
|
|
19
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
22
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import RadioGroup from '../../../../components/RadioGroup';
|
|
24
|
+
import RadioLabel from '../../../../components/RadioLabel';
|
|
25
|
+
import Text from '../../../../components/Text';
|
|
26
|
+
import Mandatory from '../../../shared/Mandatory';
|
|
27
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
28
|
+
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
29
|
+
var LabelTextStyled = styled(Text)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
|
|
32
|
+
});
|
|
33
|
+
var RadioGroupStyled = styled(RadioGroup)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return ({
|
|
36
|
+
marginInlineStart: theme.spacing(0.25)
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
export var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return ({
|
|
42
|
+
width: theme.spacing(2.75),
|
|
43
|
+
height: theme.spacing(2.125),
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
49
|
+
var theme = _a.theme;
|
|
50
|
+
return ({
|
|
51
|
+
width: theme.spacing(2.75),
|
|
52
|
+
height: theme.spacing(2.125),
|
|
53
|
+
cursor: 'pointer',
|
|
54
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
var RadioLabelStyled = styled('span')(function () { return ({
|
|
58
|
+
display: 'flex'
|
|
59
|
+
}); });
|
|
60
|
+
var IsAuthorizedSwitch = function (_a) {
|
|
61
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
62
|
+
var control = useFormContext().control;
|
|
63
|
+
var t = useTranslation().t;
|
|
64
|
+
var authorizedControl = useController({ name: 'isAuthorized', control: control });
|
|
65
|
+
var error = useAppSelector(individualSelector).error;
|
|
66
|
+
var dispatch = useAppDispatch();
|
|
67
|
+
var handleOnChange = function (_a) {
|
|
68
|
+
var target = _a.target;
|
|
69
|
+
if (error)
|
|
70
|
+
dispatch(clearError());
|
|
71
|
+
authorizedControl.field.onChange(target.value === 'yes');
|
|
72
|
+
};
|
|
73
|
+
var authorizedValue = authorizedControl.field.value;
|
|
74
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsx(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: _jsxs(LabelTextStyled, { children: [t('is_authorized_user_label'), _jsx(Mandatory, {})] }) })), _jsxs(RadioGroupStyled, __assign({ readOnly: readOnly, value: authorizedValue ? 'yes' : 'no', onChange: readOnly ? undefined : handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: _jsxs(RadioLabelStyled, { children: [t('yes'), authorizedValue && isVerified && _jsx(CheckIcon, { sx: { marginInlineStart: '5px' }, isVerified: isVerified })] }) }), _jsx(RadioLabel, { value: 'no', label: _jsxs(RadioLabelStyled, { children: [t('no'), authorizedValue === false && isVerified && _jsx(CheckIcon, { sx: { marginInlineStart: '5px' }, isVerified: isVerified })] }) })] }))] })) })));
|
|
75
|
+
};
|
|
76
|
+
export default React.memo(IsAuthorizedSwitch);
|
|
@@ -16,7 +16,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
|
-
import { hasVerifiedValue } from '../../../../utils';
|
|
19
|
+
import { getCurrencyByCountryIso2, hasVerifiedValue } from '../../../../utils';
|
|
20
20
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -52,6 +52,9 @@ var MonthlyIncome = function (props) {
|
|
|
52
52
|
return false;
|
|
53
53
|
return hasVerifiedValue(user === null || user === void 0 ? void 0 : user.data_verification, "monthly_income.".concat(item.id));
|
|
54
54
|
};
|
|
55
|
+
var getCurrency = React.useMemo(function () {
|
|
56
|
+
return t(getCurrencyByCountryIso2(countryCode.iso2));
|
|
57
|
+
}, [countryCode.iso2]);
|
|
55
58
|
React.useEffect(function () {
|
|
56
59
|
if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
|
|
57
60
|
setIncomeList(monthlyIncomeList);
|
|
@@ -81,7 +84,7 @@ var MonthlyIncome = function (props) {
|
|
|
81
84
|
var income = monthlyIncomeControl.field.value;
|
|
82
85
|
var error = (_a = monthlyIncomeControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
83
86
|
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(InputSelect, { label: t('please_enter_actual_income', {
|
|
84
|
-
currency:
|
|
87
|
+
currency: getCurrency
|
|
85
88
|
}), required: true, readOnly: props.readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error), endAdornment: _jsx(EndAdornmentExpanded, { isVerified: isMonthlyIncomeVerified(income), anchorEl: anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'range.en', searchValuePath: ['range.en', 'range.ar'], list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
86
89
|
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIcon, { isVerified: isMonthlyIncomeVerified(item) })] }));
|
|
87
90
|
} }) }))] })) })));
|
|
@@ -14,8 +14,9 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import Collapse from '@mui/material/Collapse';
|
|
17
|
-
import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
17
|
+
import { formatNumberAsCurrency, getCurrencyByCountryIso2, removeAllCharsFromNumber } from '../../../../utils';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
19
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
21
|
import Input from '../../../shared/Input';
|
|
21
22
|
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
@@ -24,10 +25,11 @@ var ShareValue = function (_a) {
|
|
|
24
25
|
var _b;
|
|
25
26
|
var show = _a.show, readOnly = _a.readOnly;
|
|
26
27
|
var t = useTranslation().t;
|
|
27
|
-
var
|
|
28
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
28
29
|
var control = useFormContext().control;
|
|
29
30
|
var bckError = useAppSelector(individualSelector).error;
|
|
30
31
|
var dispatch = useAppDispatch();
|
|
32
|
+
var countryCode = settingsData.businessCountry;
|
|
31
33
|
var handleChange = function (_a) {
|
|
32
34
|
var target = _a.target;
|
|
33
35
|
if (bckError)
|
|
@@ -35,11 +37,14 @@ var ShareValue = function (_a) {
|
|
|
35
37
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
36
38
|
shareValueControl.field.onChange(value);
|
|
37
39
|
};
|
|
40
|
+
var getCurrency = React.useMemo(function () {
|
|
41
|
+
return t(getCurrencyByCountryIso2(countryCode.iso2));
|
|
42
|
+
}, [countryCode.iso2]);
|
|
38
43
|
var shareValueControl = useController({ control: control, name: 'shareValue' });
|
|
39
44
|
var shareValue = shareValueControl.field.value;
|
|
40
45
|
var error = (_b = shareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
41
46
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('share_value_label', {
|
|
42
|
-
currency:
|
|
47
|
+
currency: getCurrency
|
|
43
48
|
}), onChange: handleChange, value: shareValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: shareValue, error: error }) }) })) })));
|
|
44
49
|
};
|
|
45
50
|
export default React.memo(ShareValue);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { IndividualType } from '../../../../@types';
|
|
3
|
-
export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean, hasAuthorizedField: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
4
|
occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
5
5
|
sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
6
6
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
@@ -10,6 +10,7 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
10
10
|
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
11
11
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
12
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
13
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
13
14
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
14
15
|
occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
15
16
|
sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
@@ -20,6 +21,7 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
20
21
|
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
21
22
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
23
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
24
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
23
25
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
26
|
occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
25
27
|
sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
@@ -30,4 +32,5 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
30
32
|
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
31
33
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
34
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
35
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
33
36
|
}>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { getIndividualType } from '../../../../utils';
|
|
3
|
-
export var IndividualInfoValidationSchema = function (objects, isKWCountry) {
|
|
3
|
+
export var IndividualInfoValidationSchema = function (objects, isKWCountry, hasAuthorizedField) {
|
|
4
4
|
var isUserType = getIndividualType(objects).isUser;
|
|
5
5
|
return yup.object().shape({
|
|
6
6
|
occupation: isUserType ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
|
|
@@ -11,6 +11,7 @@ export var IndividualInfoValidationSchema = function (objects, isKWCountry) {
|
|
|
11
11
|
isPEP: isUserType ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional().nullable(),
|
|
12
12
|
isInfluencer: isUserType && isKWCountry ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional().nullable(),
|
|
13
13
|
shareCount: yup.string().optional(),
|
|
14
|
-
shareValue: yup.string().optional()
|
|
14
|
+
shareValue: yup.string().optional(),
|
|
15
|
+
isAuthorized: hasAuthorizedField ? yup.boolean().required('please_choose_is_authorized') : yup.boolean().optional()
|
|
15
16
|
});
|
|
16
17
|
};
|
|
@@ -54,7 +54,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
54
54
|
import { styled } from '@mui/material/styles';
|
|
55
55
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
56
56
|
import { useAppDispatch } from '../../../../hooks';
|
|
57
|
-
import { isValidEmail } from '../../../../utils';
|
|
57
|
+
import { isValidEmail, removeAllOtherThanCharsNumbersAtAndDot } from '../../../../utils';
|
|
58
58
|
import Collapse from '../../../../components/Collapse';
|
|
59
59
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
60
60
|
import Input from '../../../shared/Input';
|
|
@@ -103,7 +103,8 @@ var Email = function (_a) {
|
|
|
103
103
|
}
|
|
104
104
|
}, [emailValue, error]);
|
|
105
105
|
var handleEmailChange = function (event) {
|
|
106
|
-
|
|
106
|
+
var value = removeAllOtherThanCharsNumbersAtAndDot(event.target.value);
|
|
107
|
+
emailControl.field.onChange(value);
|
|
107
108
|
};
|
|
108
109
|
var clearEmail = function () {
|
|
109
110
|
emailControl.field.onChange('');
|
|
@@ -16,11 +16,13 @@ import Box from '@mui/material/Box';
|
|
|
16
16
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
17
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
|
-
import Button from '../../../../components/Button';
|
|
20
19
|
import Collapse from '../../../../components/Collapse';
|
|
21
20
|
import Warning from '../../../../components/Warning';
|
|
21
|
+
import Button from '../../../../components/Button';
|
|
22
|
+
import Loader from '../../../../components/Loader';
|
|
23
|
+
import { sendCustomEventToGTM } from '../../../../utils';
|
|
22
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
|
-
import { individualSelector } from '../../../app/individual/individualStore';
|
|
25
|
+
import { individualSelector, retrieveBoardStatus } from '../../../app/individual/individualStore';
|
|
24
26
|
import UserList from './UserList';
|
|
25
27
|
var BoxStyled = styled(Box)(function (_a) {
|
|
26
28
|
var theme = _a.theme;
|
|
@@ -49,12 +51,23 @@ export var SubTitleStyled = styled(Text)(function (_a) {
|
|
|
49
51
|
var IndividualList = function () {
|
|
50
52
|
var dispatch = useAppDispatch();
|
|
51
53
|
var t = useTranslation().t;
|
|
52
|
-
var
|
|
54
|
+
var _a = useAppSelector(individualSelector), error = _a.error, data = _a.data, loading = _a.loading;
|
|
53
55
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
56
|
+
var flows = (data.verify.responseBody || {}).flows;
|
|
54
57
|
var onBack = function () {
|
|
55
|
-
|
|
58
|
+
sendCustomEventToGTM({
|
|
59
|
+
event: 'Send Event',
|
|
60
|
+
event_category: 'Board Flows - Individual',
|
|
61
|
+
event_action: 'Individual Details Back Button',
|
|
62
|
+
event_label: settingsData.businessCountry.iso2
|
|
63
|
+
});
|
|
64
|
+
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
|
|
65
|
+
dispatch(handlePrevScreenStep());
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
dispatch(retrieveBoardStatus());
|
|
56
69
|
};
|
|
57
70
|
var hideBack = settingsData.appConfig.mode === 'content';
|
|
58
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(BoxStyled, { children: [_jsxs(ContentStyled, { children: [_jsx(TitleStyled, { children: t('company_individuals') }), _jsx(SubTitleStyled, { children: t('company_individuals_add_or_request_details') })] }), _jsx(UserList, {})] }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'error' }, { children: t(error || '') })) })), !hideBack && (_jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return onBack(); }, variant: 'text' }, { children: t('back') })))] }));
|
|
71
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(BoxStyled, { children: [_jsxs(ContentStyled, { children: [_jsx(TitleStyled, { children: t('company_individuals') }), _jsx(SubTitleStyled, { children: t('company_individuals_add_or_request_details') })] }), _jsx(UserList, {})] }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'error' }, { children: t(error || '') })) })), !hideBack && (_jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return onBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') })))] }));
|
|
59
72
|
};
|
|
60
73
|
export default IndividualList;
|
|
@@ -25,7 +25,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
25
25
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
26
26
|
import { alpha, styled, useTheme } from '@mui/material/styles';
|
|
27
27
|
import Box from '@mui/material/Box';
|
|
28
|
-
import { getUserName, isValidEmail } from '../../../../utils';
|
|
28
|
+
import { getUserName, isKWOrSA, isValidEmail } from '../../../../utils';
|
|
29
29
|
import { useLanguage, useAppSelector, useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
|
|
30
30
|
import { IndividualType } from '../../../../@types';
|
|
31
31
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -35,9 +35,10 @@ import Text from '../../../../components/Text';
|
|
|
35
35
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
36
36
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
37
37
|
import { addDetailsAsync, individualSelector, requestDetailsByEmail, resetIndividualData } from '../../../app/individual/individualStore';
|
|
38
|
-
import IndividualActionButtons from '
|
|
38
|
+
import IndividualActionButtons from '../../../shared/Button/IndividualActionButtons';
|
|
39
39
|
import { IndividualCollectInfoValidationSchema } from './validation';
|
|
40
40
|
import CollectPhoneEmail from './CollectPhoneEmail';
|
|
41
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
41
42
|
var ScreenContainerStyled = styled(ScreenContainer)(function (_a) {
|
|
42
43
|
var theme = _a.theme;
|
|
43
44
|
return ({
|
|
@@ -84,11 +85,12 @@ var UserList = function (_a) {
|
|
|
84
85
|
var dispatch = useAppDispatch();
|
|
85
86
|
var _j = React.useState(false), emailChecking = _j[0], setEmailChecking = _j[1];
|
|
86
87
|
var theme = useTheme();
|
|
87
|
-
var _k = useAppSelector(individualSelector), data = _k.data,
|
|
88
|
+
var _k = useAppSelector(individualSelector), data = _k.data, addOrRequestDetailLoading = _k.addOrRequestDetailLoading, error = _k.error;
|
|
89
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
88
90
|
var _l = data.individualCollectData, email = _l.email, mobile = _l.mobile, responseBody = _l.responseBody;
|
|
89
91
|
var is_available = (responseBody || {}).is_available;
|
|
90
92
|
var verify = data.verify;
|
|
91
|
-
var _m = verify.responseBody || {}, userList = _m.userList,
|
|
93
|
+
var _m = verify.responseBody || {}, userList = _m.userList, recipient = _m.recipient, userRes = _m.user;
|
|
92
94
|
var methods = useForm({
|
|
93
95
|
resolver: yupResolver(IndividualCollectInfoValidationSchema(activeUser)),
|
|
94
96
|
defaultValues: {
|
|
@@ -157,8 +159,10 @@ var UserList = function (_a) {
|
|
|
157
159
|
return (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id;
|
|
158
160
|
};
|
|
159
161
|
var isSameUserRequestedBefore = function (user) {
|
|
160
|
-
var _a
|
|
161
|
-
|
|
162
|
+
var _a;
|
|
163
|
+
if (!(userRes === null || userRes === void 0 ? void 0 : userRes.is_authorized) && !isKWOrSA(settingsData.businessCountry.iso2))
|
|
164
|
+
return false;
|
|
165
|
+
return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes(recipient === null || recipient === void 0 ? void 0 : recipient.id);
|
|
162
166
|
};
|
|
163
167
|
var getUserStatus = function (user) {
|
|
164
168
|
return user === null || user === void 0 ? void 0 : user.individual_data_state;
|
|
@@ -188,11 +192,11 @@ var UserList = function (_a) {
|
|
|
188
192
|
return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
|
|
189
193
|
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ sx: {
|
|
190
194
|
cursor: emailChecking ? 'default' : 'pointer'
|
|
191
|
-
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [
|
|
195
|
+
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { children: [_jsx("span", { children: getName(user) || '' }), _jsx(RoleTextStyled, { children: getUserRole(user) || '' })] }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && isActiveUser(user) })] })), _jsx(Collapse, __assign({ in: !!anchorEl && isActiveUser(user), timeout: 300 }, { children: _jsx(IndividualActionButtons, { isAr: isAr, addDetails: {
|
|
192
196
|
status: getUserStatus(user),
|
|
193
197
|
title: t('add_details'),
|
|
194
198
|
onClick: onAddDetails,
|
|
195
|
-
loading: isActiveUser(user) &&
|
|
199
|
+
loading: isActiveUser(user) && !!addOrRequestDetailLoading && type === IndividualRequestType.ADD
|
|
196
200
|
}, requestEmail: {
|
|
197
201
|
children: getCollectForm(user),
|
|
198
202
|
title: t('request_details_by_email'),
|
|
@@ -200,7 +204,7 @@ var UserList = function (_a) {
|
|
|
200
204
|
disabled: showCollectForm ? disabled : false,
|
|
201
205
|
onClick: onRequestEmail,
|
|
202
206
|
show: !isSameUserRequestedBefore(user),
|
|
203
|
-
loading: isActiveUser(user) &&
|
|
207
|
+
loading: isActiveUser(user) && !!addOrRequestDetailLoading && type === IndividualRequestType.REQUEST_EMAIL
|
|
204
208
|
} }) }))] }), index));
|
|
205
209
|
}) }));
|
|
206
210
|
};
|
|
@@ -15,9 +15,10 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import Collapse from '../../../../components/Collapse';
|
|
18
|
+
import { removeAllOtherThanCharsNumbersAtAndDot } from '../../../../utils';
|
|
18
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
19
20
|
import Input from '../../../shared/Input';
|
|
20
|
-
import { EndAdornment } from '
|
|
21
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
21
22
|
var InputStyled = styled(Input)(function () { return ({
|
|
22
23
|
input: {
|
|
23
24
|
textTransform: 'lowercase'
|
|
@@ -32,7 +33,8 @@ var Email = function (_a) {
|
|
|
32
33
|
var emailValue = emailControl.field.value;
|
|
33
34
|
var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
34
35
|
var handleEmailChange = function (event) {
|
|
35
|
-
|
|
36
|
+
var value = removeAllOtherThanCharsNumbersAtAndDot(event.target.value);
|
|
37
|
+
emailControl.field.onChange(value);
|
|
36
38
|
};
|
|
37
39
|
var clearNumber = function () {
|
|
38
40
|
emailControl.field.onChange('');
|