@tap-payments/auth-jsconnect 2.4.14-test → 2.4.16-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +28 -1
- package/build/features/app/individual/individualStore.js +8 -5
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +7 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +28 -21
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +10 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +13 -10
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +14 -19
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +1 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +9 -18
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +12 -9
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +9 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +14 -18
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +5 -13
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +5 -13
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Email.js +3 -8
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +2 -3
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +3 -2
- package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ID.js +3 -5
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +58 -20
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +6 -15
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +5 -8
- package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Name.js +3 -10
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +6 -15
- package/package.json +1 -1
|
@@ -10,12 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
13
14
|
import { useTranslation } from 'react-i18next';
|
|
14
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
16
|
import { styled } from '@mui/material/styles';
|
|
16
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
18
|
import { DocumentPurpose } from '../../../../@types';
|
|
18
19
|
import { FileType } from '../../../../constants';
|
|
20
|
+
import { hasVerifiedValue } from '../../../../utils';
|
|
19
21
|
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
20
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
23
|
import { individualSelector, signatureFileUploadingStatus, clearError } from '../../../app/individual/individualStore';
|
|
@@ -27,12 +29,16 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
27
29
|
});
|
|
28
30
|
});
|
|
29
31
|
var SignatureFile = function (_a) {
|
|
32
|
+
var _b;
|
|
30
33
|
var show = _a.show, readOnly = _a.readOnly, defaultFiles = _a.defaultFiles;
|
|
31
34
|
var t = useTranslation().t;
|
|
32
35
|
var control = useFormContext().control;
|
|
33
|
-
var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
|
|
34
|
-
var _b = useAppSelector(individualSelector), loading = _b.loading, error = _b.error;
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
37
|
+
var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
|
|
38
|
+
var _c = useAppSelector(individualSelector), loading = _c.loading, error = _c.error, data = _c.data;
|
|
39
|
+
var data_verification = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.user) || {}).data_verification;
|
|
40
|
+
var uploadedIds = signatureFileIdControl.field.value;
|
|
41
|
+
var isDocumentVerified = React.useMemo(function () { var _a; return !!((_a = defaultFiles === null || defaultFiles === void 0 ? void 0 : defaultFiles[0]) === null || _a === void 0 ? void 0 : _a.docId) && hasVerifiedValue(data_verification, "documents.".concat(defaultFiles[0].docId)); }, [data_verification]);
|
|
36
42
|
var handleSignatureChange = function (ids) {
|
|
37
43
|
if (error)
|
|
38
44
|
dispatch(clearError());
|
|
@@ -43,6 +49,6 @@ var SignatureFile = function (_a) {
|
|
|
43
49
|
dispatch(clearError());
|
|
44
50
|
signatureFileIdControl.field.onChange(ids);
|
|
45
51
|
};
|
|
46
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'signatureFileId', control: control, label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.CUSTOMER_SIGNATURE, fileUploadingStatus: function (uploading) { return dispatch(signatureFileUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }) })));
|
|
52
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'signatureFileId', control: control, label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.CUSTOMER_SIGNATURE, fileUploadingStatus: function (uploading) { return dispatch(signatureFileUploadingStatus(uploading)); }, fileType: FileType.IMAGES, isVerified: !(uploadedIds === null || uploadedIds === void 0 ? void 0 : uploadedIds.length) && isDocumentVerified }) }) })));
|
|
47
53
|
};
|
|
48
54
|
export default SignatureFile;
|
|
@@ -9,21 +9,22 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import Box from '@mui/material/Box';
|
|
15
|
-
import { styled } from '@mui/material/styles';
|
|
16
14
|
import { useTranslation } from 'react-i18next';
|
|
17
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { useAppSelector, useLanguage, useAppDispatch } from '../../../../hooks';
|
|
19
|
-
import {
|
|
19
|
+
import { hasVerifiedValue } from '../../../../utils';
|
|
20
20
|
import Text from '../../../../components/Text';
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
|
-
import CheckIcon from '@mui/icons-material/Check';
|
|
23
|
-
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
24
|
-
import Input from '../../../shared/Input';
|
|
25
22
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
26
23
|
import SimpleList from '../../../../components/SimpleList';
|
|
24
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
25
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
26
|
+
import Input from '../../../shared/Input';
|
|
27
|
+
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
27
28
|
var InputStyled = styled(Input)(function (_a) {
|
|
28
29
|
var readOnly = _a.readOnly;
|
|
29
30
|
return ({
|
|
@@ -39,14 +40,6 @@ var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop
|
|
|
39
40
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
40
41
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
41
42
|
});
|
|
42
|
-
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
43
|
-
var theme = _a.theme;
|
|
44
|
-
return ({
|
|
45
|
-
color: theme.palette.success.main,
|
|
46
|
-
display: 'flex',
|
|
47
|
-
alignItems: 'flex-end'
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
43
|
var SourceOfIncome = function (props) {
|
|
51
44
|
var _a, _b;
|
|
52
45
|
var _c = React.useState([]), sourceList = _c[0], setSourceList = _c[1];
|
|
@@ -54,11 +47,14 @@ var SourceOfIncome = function (props) {
|
|
|
54
47
|
var t = useTranslation().t;
|
|
55
48
|
var isAr = useLanguage().isAr;
|
|
56
49
|
var _e = useAppSelector(individualSelector), data = _e.data, bckError = _e.error;
|
|
50
|
+
var user = (data.verify.responseBody || {}).user;
|
|
57
51
|
var dispatch = useAppDispatch();
|
|
58
52
|
var control = useFormContext().control;
|
|
59
53
|
var sourceIncomeList = ((_a = data.individualData.responseBody) === null || _a === void 0 ? void 0 : _a.sourceIncomeList) || [];
|
|
60
54
|
var sourceIncomeControl = useController({ control: control, name: 'sourceIncome' });
|
|
61
|
-
var
|
|
55
|
+
var isSourceIncomeVerified = function (item) {
|
|
56
|
+
return hasVerifiedValue(user === null || user === void 0 ? void 0 : user.data_verification, "source_of_income.".concat(item.id));
|
|
57
|
+
};
|
|
62
58
|
React.useEffect(function () {
|
|
63
59
|
if ((sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.length) > 0) {
|
|
64
60
|
setSourceList(sourceIncomeList);
|
|
@@ -84,8 +80,8 @@ var SourceOfIncome = function (props) {
|
|
|
84
80
|
};
|
|
85
81
|
var source = sourceIncomeControl.field.value;
|
|
86
82
|
var error = (_b = sourceIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
87
|
-
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(InputStyled, { required: true,
|
|
88
|
-
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.name.ar : item === null || item === void 0 ? void 0 : item.name.en })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(
|
|
83
|
+
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(InputStyled, { required: true, label: t('tap_js_source_of_income'), readOnly: props.readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.name.ar : source === null || source === void 0 ? void 0 : source.name.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
84
|
+
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.name.ar : item === null || item === void 0 ? void 0 : item.name.en })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIcon, { isVerified: isSourceIncomeVerified(item) })] }));
|
|
89
85
|
} }) }))] })) })));
|
|
90
86
|
};
|
|
91
87
|
export default React.memo(SourceOfIncome);
|
|
@@ -4,6 +4,7 @@ interface BirthCityProps {
|
|
|
4
4
|
onListOpen?: () => void;
|
|
5
5
|
onListClose?: () => void;
|
|
6
6
|
readOnly?: boolean;
|
|
7
|
+
isVerified?: boolean;
|
|
7
8
|
}
|
|
8
9
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BirthCityProps & React.RefAttributes<unknown>>>;
|
|
9
10
|
export default _default;
|
|
@@ -24,16 +24,16 @@ import Box from '@mui/material/Box';
|
|
|
24
24
|
import { useTranslation } from 'react-i18next';
|
|
25
25
|
import { useController, useFormContext } from 'react-hook-form';
|
|
26
26
|
import { styled } from '@mui/material/styles';
|
|
27
|
-
import CheckIcon from '@mui/icons-material/Check';
|
|
28
27
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
29
28
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
30
29
|
import Collapse from '../../../../components/Collapse';
|
|
31
|
-
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
32
30
|
import Text from '../../../../components/Text';
|
|
33
31
|
import SimpleList from '../../../../components/SimpleList';
|
|
34
32
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
35
33
|
import Input from '../../../shared/Input';
|
|
36
34
|
import { getCityList, individualSelector } from '../../../app/individual/individualStore';
|
|
35
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
36
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
37
37
|
var CountryItemContainer = styled(Box)(function () { return ({
|
|
38
38
|
display: 'flex'
|
|
39
39
|
}); });
|
|
@@ -49,17 +49,9 @@ var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
49
49
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
50
50
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
51
51
|
});
|
|
52
|
-
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
53
|
-
var theme = _a.theme;
|
|
54
|
-
return ({
|
|
55
|
-
color: theme.palette.success.main,
|
|
56
|
-
display: 'flex',
|
|
57
|
-
alignItems: 'flex-end'
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
52
|
var BirthCity = React.forwardRef(function (_a, ref) {
|
|
61
53
|
var _b;
|
|
62
|
-
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly;
|
|
54
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
63
55
|
var _c = React.useState([]), locationCities = _c[0], setCities = _c[1];
|
|
64
56
|
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
65
57
|
var t = useTranslation().t;
|
|
@@ -112,8 +104,8 @@ var BirthCity = React.forwardRef(function (_a, ref) {
|
|
|
112
104
|
var _a, _b;
|
|
113
105
|
return isAr ? (_a = city === null || city === void 0 ? void 0 : city.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = city === null || city === void 0 ? void 0 : city.name) === null || _b === void 0 ? void 0 : _b.en;
|
|
114
106
|
};
|
|
115
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(InputStyled, { label: t('place_birth_city_label'), readOnly: readOnly, placeholder: t('choose_place_birth_city'), value: getName(cityValue) || '', warningMessage: error && t(error), onClick: cityLoading ? undefined : !!anchorEl ? function () { return onCloseCitySelect(); } : onOpenCitySelect, endAdornment: cityLoading ? _jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } }) : _jsx(
|
|
116
|
-
return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) }, { children: getName(item) })) }), item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) && _jsx(
|
|
107
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(InputStyled, { label: t('place_birth_city_label'), readOnly: readOnly, placeholder: t('choose_place_birth_city'), value: getName(cityValue) || '', warningMessage: error && t(error), onClick: cityLoading ? undefined : !!anchorEl ? function () { return onCloseCitySelect(); } : onOpenCitySelect, endAdornment: cityLoading ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : (_jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified })) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en'], list: locationCities, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
108
|
+
return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) }, { children: getName(item) })) }), item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
117
109
|
} }) }))] })) })));
|
|
118
110
|
});
|
|
119
111
|
export default React.memo(BirthCity);
|
|
@@ -6,6 +6,7 @@ interface BirthCountryProps {
|
|
|
6
6
|
onListOpen?: () => void;
|
|
7
7
|
onListClose?: () => void;
|
|
8
8
|
readOnly?: boolean;
|
|
9
|
+
isVerified?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BirthCountryProps & React.RefAttributes<unknown>>>;
|
|
11
12
|
export default _default;
|
|
@@ -26,14 +26,14 @@ import Box from '@mui/material/Box';
|
|
|
26
26
|
import { useTranslation } from 'react-i18next';
|
|
27
27
|
import { useController, useFormContext } from 'react-hook-form';
|
|
28
28
|
import { styled } from '@mui/material/styles';
|
|
29
|
-
import CheckIcon from '@mui/icons-material/Check';
|
|
30
29
|
import { useLanguage } from '../../../../hooks';
|
|
31
30
|
import Collapse from '../../../../components/Collapse';
|
|
32
|
-
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
31
|
import Text from '../../../../components/Text';
|
|
34
32
|
import SimpleList from '../../../../components/SimpleList';
|
|
35
33
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
36
34
|
import Input from '../../../shared/Input';
|
|
35
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
36
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
37
37
|
var CountryItemContainer = styled(Box)(function () { return ({
|
|
38
38
|
display: 'flex'
|
|
39
39
|
}); });
|
|
@@ -49,17 +49,9 @@ var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
49
49
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
50
50
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
51
51
|
});
|
|
52
|
-
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
53
|
-
var theme = _a.theme;
|
|
54
|
-
return ({
|
|
55
|
-
color: theme.palette.success.main,
|
|
56
|
-
display: 'flex',
|
|
57
|
-
alignItems: 'flex-end'
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
52
|
var BirthCountry = React.forwardRef(function (_a, ref) {
|
|
61
53
|
var _b, _c, _d;
|
|
62
|
-
var countries = _a.countries, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "readOnly"]);
|
|
54
|
+
var countries = _a.countries, readOnly = _a.readOnly, isVerified = _a.isVerified, rest = __rest(_a, ["countries", "readOnly", "isVerified"]);
|
|
63
55
|
var _e = React.useState(countries), locationCountries = _e[0], setCountries = _e[1];
|
|
64
56
|
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
65
57
|
var t = useTranslation().t;
|
|
@@ -85,8 +77,8 @@ var BirthCountry = React.forwardRef(function (_a, ref) {
|
|
|
85
77
|
};
|
|
86
78
|
var location = placeOfBirthCountryControl.field.value;
|
|
87
79
|
var error = (_b = placeOfBirthCountryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
88
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(InputStyled, { label: t('place_of_birth_country_label'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(
|
|
89
|
-
return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(
|
|
80
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(InputStyled, { label: t('place_of_birth_country_label'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }), placeholder: t('choose_place_of_birth_country'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
81
|
+
return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
90
82
|
} }) }))] })) })));
|
|
91
83
|
});
|
|
92
84
|
export default React.memo(BirthCountry);
|
|
@@ -2,7 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
interface BODProps {
|
|
3
3
|
show: boolean;
|
|
4
4
|
onDateClicked?: (flag: boolean) => void;
|
|
5
|
+
isVerified?: boolean;
|
|
5
6
|
readOnly?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const _default: React.MemoExoticComponent<({ onDateClicked, show, readOnly }: BODProps) => JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ onDateClicked, show, readOnly, isVerified }: BODProps) => JSX.Element>;
|
|
8
9
|
export default _default;
|
|
@@ -26,7 +26,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
26
26
|
});
|
|
27
27
|
var BOD = function (_a) {
|
|
28
28
|
var _b;
|
|
29
|
-
var onDateClicked = _a.onDateClicked, show = _a.show, readOnly = _a.readOnly;
|
|
29
|
+
var onDateClicked = _a.onDateClicked, show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
30
30
|
var t = useTranslation().t;
|
|
31
31
|
var control = useFormContext().control;
|
|
32
32
|
var dispatch = useAppDispatch();
|
|
@@ -41,6 +41,6 @@ var BOD = function (_a) {
|
|
|
41
41
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
42
42
|
var spacing = _a.spacing;
|
|
43
43
|
return spacing(2.5, 2.5, 2.5, 2.5);
|
|
44
|
-
} } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { readOnly: true, disabled: readOnly, defaultValue: dateValue ? new Date(dateValue) : undefined, dir: 'ltr', isDob: true, locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
|
|
44
|
+
} } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { readOnly: true, isVerified: isVerified, disabled: readOnly, defaultValue: dateValue ? new Date(dateValue) : undefined, dir: 'ltr', isDob: true, locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
|
|
45
45
|
};
|
|
46
46
|
export default React.memo(BOD);
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
export interface EmailProps {
|
|
3
3
|
show: boolean;
|
|
4
4
|
readOnly?: boolean;
|
|
5
|
+
isVerified?: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<({ show, readOnly }: EmailProps) => JSX.Element>;
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly, isVerified }: EmailProps) => JSX.Element>;
|
|
7
8
|
export default _default;
|
|
@@ -14,13 +14,10 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
|
-
import { useAppSelector } from '../../../../hooks';
|
|
18
17
|
import Collapse from '../../../../components/Collapse';
|
|
19
18
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
19
|
import Input from '../../../shared/Input';
|
|
21
|
-
import
|
|
22
|
-
import CheckIcon from '../../../shared/CheckIcon';
|
|
23
|
-
import { individualSelector } from '../../../app/individual/individualStore';
|
|
20
|
+
import { EndAdornment } from '../../../../features/shared/EndAdornment';
|
|
24
21
|
var InputStyled = styled(Input)(function () { return ({
|
|
25
22
|
input: {
|
|
26
23
|
textTransform: 'lowercase'
|
|
@@ -28,11 +25,10 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
28
25
|
}); });
|
|
29
26
|
var Email = function (_a) {
|
|
30
27
|
var _b;
|
|
31
|
-
var show = _a.show, readOnly = _a.readOnly;
|
|
28
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
32
29
|
var t = useTranslation().t;
|
|
33
30
|
var control = useFormContext().control;
|
|
34
31
|
var emailControl = useController({ name: 'email', control: control });
|
|
35
|
-
var data = useAppSelector(individualSelector).data;
|
|
36
32
|
var emailValue = emailControl.field.value;
|
|
37
33
|
var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
38
34
|
var handleEmailChange = function (event) {
|
|
@@ -41,7 +37,6 @@ var Email = function (_a) {
|
|
|
41
37
|
var clearNumber = function () {
|
|
42
38
|
emailControl.field.onChange('');
|
|
43
39
|
};
|
|
44
|
-
|
|
45
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { readOnly: readOnly, label: t('signup_email_lable'), value: emailValue, onChange: handleEmailChange, type: 'email', disabled: disabled, placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && emailValue ? _jsx(CheckIcon, {}) : emailValue && _jsx(ClearIcon, { onClick: clearNumber }) }) }) })));
|
|
40
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { readOnly: readOnly, label: t('signup_email_lable'), value: emailValue, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: emailValue, isVerified: isVerified, onClear: clearNumber, error: error }) }) }) })));
|
|
46
41
|
};
|
|
47
42
|
export default React.memo(Email);
|
|
@@ -3,6 +3,7 @@ interface ExpiryDateProps {
|
|
|
3
3
|
show: boolean;
|
|
4
4
|
onDateClicked?: (flag: boolean) => void;
|
|
5
5
|
readOnly?: boolean;
|
|
6
|
+
isVerified?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const _default: React.MemoExoticComponent<({ onDateClicked, show, readOnly }: ExpiryDateProps) => JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ onDateClicked, show, readOnly, isVerified }: ExpiryDateProps) => JSX.Element>;
|
|
8
9
|
export default _default;
|
|
@@ -27,7 +27,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
27
27
|
});
|
|
28
28
|
var ExpiryDate = function (_a) {
|
|
29
29
|
var _b;
|
|
30
|
-
var onDateClicked = _a.onDateClicked, show = _a.show, readOnly = _a.readOnly;
|
|
30
|
+
var onDateClicked = _a.onDateClicked, show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
31
31
|
var t = useTranslation().t;
|
|
32
32
|
var control = useFormContext().control;
|
|
33
33
|
var dispatch = useAppDispatch();
|
|
@@ -39,10 +39,9 @@ var ExpiryDate = function (_a) {
|
|
|
39
39
|
dobControl.field.onChange(data);
|
|
40
40
|
};
|
|
41
41
|
var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
42
|
-
var disabled = false;
|
|
43
42
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
44
43
|
var spacing = _a.spacing;
|
|
45
44
|
return spacing(2.5, 2.5, 2.5, 2.5);
|
|
46
|
-
} } }, { children: t('enter_expiry_date') })), _jsx(DatePicker, { readOnly: true,
|
|
45
|
+
} } }, { children: t('enter_expiry_date') })), _jsx(DatePicker, { readOnly: true, isVerified: isVerified, disabled: readOnly, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', maxDate: getFutureDate(), onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
|
|
47
46
|
};
|
|
48
47
|
export default React.memo(ExpiryDate);
|
|
@@ -30,6 +30,7 @@ export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledCom
|
|
|
30
30
|
declare type GenderProps = {
|
|
31
31
|
show: boolean;
|
|
32
32
|
readOnly?: boolean;
|
|
33
|
+
isVerified?: boolean;
|
|
33
34
|
};
|
|
34
|
-
declare const Gender: ({ show, readOnly }: GenderProps) => JSX.Element;
|
|
35
|
+
declare const Gender: ({ show, readOnly, isVerified }: GenderProps) => JSX.Element;
|
|
35
36
|
export default Gender;
|
|
@@ -22,6 +22,7 @@ import RadioLabel from '../../../../components/RadioLabel';
|
|
|
22
22
|
import RadioGroup from '../../../../components/RadioGroup';
|
|
23
23
|
import Radio from '../../../../components/Radio';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
25
26
|
var LabelTextStyled = styled(Text)(function (_a) {
|
|
26
27
|
var theme = _a.theme;
|
|
27
28
|
return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
|
|
@@ -67,7 +68,7 @@ export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
|
67
68
|
});
|
|
68
69
|
});
|
|
69
70
|
var Gender = function (_a) {
|
|
70
|
-
var show = _a.show, readOnly = _a.readOnly;
|
|
71
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
71
72
|
var t = useTranslation().t;
|
|
72
73
|
var control = useFormContext().control;
|
|
73
74
|
var genderControl = useController({ control: control, name: 'gender' });
|
|
@@ -78,6 +79,6 @@ var Gender = function (_a) {
|
|
|
78
79
|
genderControl.field.onChange(target.value);
|
|
79
80
|
};
|
|
80
81
|
var genderValue = genderControl.field.value;
|
|
81
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5, pl: 2.5, pr: 2.5, pt: 2.5 } }, { children: [_jsx(LabelTextStyled, { children: t('individual_gender_title') }), _jsxs(RadioGroupStyled, __assign({ readOnly: readOnly, value: genderValue != null ? genderValue : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: IndividualGender.MALE, label:
|
|
82
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5, pl: 2.5, pr: 2.5, pt: 2.5 } }, { children: [_jsx(LabelTextStyled, { children: t('individual_gender_title') }), _jsxs(RadioGroupStyled, __assign({ readOnly: readOnly, value: genderValue != null ? genderValue : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: IndividualGender.MALE, label: _jsxs(LabelStyled, { children: [t('gender_male'), genderValue === IndividualGender.MALE && isVerified && _jsx(CheckIcon, { sx: { marginInlineStart: '5px' }, isVerified: isVerified })] }), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) }), _jsx(RadioLabel, { value: IndividualGender.FEMALE, sx: { marginInlineEnd: '0px' }, label: _jsxs(LabelStyled, { children: [t('gender_female'), genderValue === IndividualGender.FEMALE && isVerified && _jsx(CheckIcon, { sx: { marginInlineStart: '5px' }, isVerified: isVerified })] }), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) })] }))] })) })));
|
|
82
83
|
};
|
|
83
84
|
export default Gender;
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
interface IDNumberProps {
|
|
3
3
|
show: boolean;
|
|
4
4
|
readOnly?: boolean;
|
|
5
|
+
isVerified?: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<({ show, readOnly }: IDNumberProps) => JSX.Element>;
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly, isVerified }: IDNumberProps) => JSX.Element>;
|
|
7
8
|
export default _default;
|
|
@@ -18,11 +18,10 @@ import { ID_NUMBER_LENGTH } from '../../../../constants';
|
|
|
18
18
|
import Collapse from '../../../../components/Collapse';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
21
|
-
import
|
|
22
|
-
import CheckIcon from '../../../shared/CheckIcon';
|
|
21
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
23
22
|
var IDNumber = function (_a) {
|
|
24
23
|
var _b;
|
|
25
|
-
var show = _a.show, readOnly = _a.readOnly;
|
|
24
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
26
25
|
var t = useTranslation().t;
|
|
27
26
|
var control = useFormContext().control;
|
|
28
27
|
var nidControl = useController({ control: control, name: 'nid' });
|
|
@@ -36,7 +35,6 @@ var IDNumber = function (_a) {
|
|
|
36
35
|
};
|
|
37
36
|
var nidValue = nidControl.field.value;
|
|
38
37
|
var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
39
|
-
|
|
40
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t('enter_national_id'), disabled: disabled, inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }) }) }) })));
|
|
38
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t('enter_national_id'), inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, isVerified: isVerified, onClear: clearIdNumber, error: error }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }) }) }) })));
|
|
41
39
|
};
|
|
42
40
|
export default React.memo(IDNumber);
|
|
@@ -17,8 +17,9 @@ import { useTranslation } from 'react-i18next';
|
|
|
17
17
|
import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
18
18
|
import Box from '@mui/material/Box';
|
|
19
19
|
import { alpha, styled } from '@mui/material/styles';
|
|
20
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
20
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
21
21
|
import { IndividualType } from '../../../../@types';
|
|
22
|
+
import { convertToEnglishDateFormat, getUserName } from '../../../../utils';
|
|
22
23
|
import Form from '../../../../components/Form';
|
|
23
24
|
import Collapse from '../../../../components/Collapse';
|
|
24
25
|
import Text from '../../../../components/Text';
|
|
@@ -54,15 +55,17 @@ var ListType;
|
|
|
54
55
|
ListType["NationalityList"] = "NationalityList";
|
|
55
56
|
})(ListType || (ListType = {}));
|
|
56
57
|
var IndividualPersonalInfo = function (_a) {
|
|
58
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
57
59
|
var t = useTranslation().t;
|
|
58
60
|
var isAr = useLanguage().isAr;
|
|
59
61
|
var dispatch = useAppDispatch();
|
|
60
|
-
var
|
|
62
|
+
var _l = useAppSelector(individualSelector), data = _l.data, loading = _l.loading, error = _l.error, cityLoading = _l.cityLoading;
|
|
61
63
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
62
64
|
var countries = settingsData.countries;
|
|
63
65
|
var verify = data.verify, individualPersonalData = data.individualPersonalData;
|
|
64
|
-
var
|
|
66
|
+
var _m = verify.responseBody || {}, user = _m.user, flows = _m.flows;
|
|
65
67
|
var name = individualPersonalData.name, email = individualPersonalData.email, mobile = individualPersonalData.mobile, countryCode = individualPersonalData.countryCode, gender = individualPersonalData.gender, nid = individualPersonalData.nid, issuedCountry = individualPersonalData.issuedCountry, expiryDate = individualPersonalData.expiryDate, dob = individualPersonalData.dob, placeOfBirthCountry = individualPersonalData.placeOfBirthCountry, placeOfBirthCity = individualPersonalData.placeOfBirthCity, nationality = individualPersonalData.nationality;
|
|
68
|
+
var _o = user || {}, data_status = _o.data_status, is_authorized = _o.is_authorized, data_verification = _o.data_verification, names = _o.names, role = _o.role, type = _o.type, contact = _o.contact, genderRes = _o.gender, identification = _o.identification, birth = _o.birth, nationalityRes = _o.nationality;
|
|
66
69
|
var methods = useForm({
|
|
67
70
|
resolver: yupResolver(IndividualInfoValidationSchema),
|
|
68
71
|
defaultValues: {
|
|
@@ -81,13 +84,15 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
81
84
|
},
|
|
82
85
|
mode: 'onChange'
|
|
83
86
|
});
|
|
87
|
+
var watch = methods.watch;
|
|
84
88
|
useSetFromDefaultValues(methods, data.individualPersonalData);
|
|
85
|
-
var
|
|
86
|
-
var
|
|
87
|
-
var
|
|
89
|
+
var _p = React.useState(), listActive = _p[0], setListActive = _p[1];
|
|
90
|
+
var _q = React.useState(false), dobActive = _q[0], setDobActive = _q[1];
|
|
91
|
+
var _r = React.useState(false), expiryDateActive = _r[0], setExpiryDateActive = _r[1];
|
|
88
92
|
var originalReadOnly = useFormReadOnly(methods);
|
|
89
|
-
var noneEditable = useDataNoneEditable(
|
|
90
|
-
'name',
|
|
93
|
+
var noneEditable = useDataNoneEditable(data_status, [
|
|
94
|
+
'name.en',
|
|
95
|
+
'name.ar',
|
|
91
96
|
'contact.phone.number',
|
|
92
97
|
'contact.phone.country_code',
|
|
93
98
|
'contact.email',
|
|
@@ -98,10 +103,43 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
98
103
|
'birth.date',
|
|
99
104
|
'birth.country',
|
|
100
105
|
'birth.city',
|
|
101
|
-
'nationality'
|
|
106
|
+
'nationality',
|
|
107
|
+
'gender'
|
|
102
108
|
]);
|
|
103
109
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
104
110
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
111
|
+
var dataVerified = useDataVerified(data_verification, [
|
|
112
|
+
'name.en',
|
|
113
|
+
'name.ar',
|
|
114
|
+
'contact.phone.number',
|
|
115
|
+
'contact.phone.country_code',
|
|
116
|
+
'contact.email',
|
|
117
|
+
'identification.id',
|
|
118
|
+
'identification.type',
|
|
119
|
+
'identification.issuer_country',
|
|
120
|
+
'identification.expiry',
|
|
121
|
+
'birth.date',
|
|
122
|
+
'birth.country',
|
|
123
|
+
'birth.city',
|
|
124
|
+
'nationality',
|
|
125
|
+
'gender'
|
|
126
|
+
]);
|
|
127
|
+
var expDateRes = (identification === null || identification === void 0 ? void 0 : identification.expiry) && convertToEnglishDateFormat(new Date(identification === null || identification === void 0 ? void 0 : identification.expiry));
|
|
128
|
+
var dobDateRes = (birth === null || birth === void 0 ? void 0 : birth.date) && convertToEnglishDateFormat(new Date(birth === null || birth === void 0 ? void 0 : birth.date));
|
|
129
|
+
var isNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && getUserName(user, isAr) === watch('name');
|
|
130
|
+
var isPhoneNumberVerified = dataVerified['contact.phone.number'] &&
|
|
131
|
+
dataVerified['contact.phone.country_code'] &&
|
|
132
|
+
((_b = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _b === void 0 ? void 0 : _b.number) === watch('mobile') &&
|
|
133
|
+
((_c = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _c === void 0 ? void 0 : _c.country_code) === ((_e = (_d = watch('countryCode')) === null || _d === void 0 ? void 0 : _d.idd_prefix) === null || _e === void 0 ? void 0 : _e.toString());
|
|
134
|
+
var isEmailVerified = dataVerified['contact.email'] && (contact === null || contact === void 0 ? void 0 : contact.email) === watch('email');
|
|
135
|
+
var isGenderVerified = dataVerified['gender'] && genderRes === watch('gender');
|
|
136
|
+
var isIDVerified = dataVerified['identification.id'] && (identification === null || identification === void 0 ? void 0 : identification.id) === watch('nid');
|
|
137
|
+
var isIssuedCountryVerified = dataVerified['identification.issuer_country'] && (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) === ((_f = watch('issuedCountry')) === null || _f === void 0 ? void 0 : _f.iso2);
|
|
138
|
+
var isExpiryDateVerified = dataVerified['identification.expiry'] && expDateRes === watch('expiryDate');
|
|
139
|
+
var isDOBVerified = dataVerified['birth.date'] && dobDateRes === watch('dob');
|
|
140
|
+
var isBirthCountryVerified = dataVerified['birth.country'] && (birth === null || birth === void 0 ? void 0 : birth.country) === ((_g = watch('placeOfBirthCountry')) === null || _g === void 0 ? void 0 : _g.iso2);
|
|
141
|
+
var isBirthCityVerified = dataVerified['birth.city'] && ((_h = birth === null || birth === void 0 ? void 0 : birth.city) === null || _h === void 0 ? void 0 : _h.cityId) === ((_j = watch('placeOfBirthCity')) === null || _j === void 0 ? void 0 : _j.id);
|
|
142
|
+
var isNationalityVerified = dataVerified['nationality'] && nationalityRes === ((_k = watch('nationality')) === null || _k === void 0 ? void 0 : _k.iso2);
|
|
105
143
|
var onSubmit = function (data) {
|
|
106
144
|
dispatch(updateIndividualPersonalInfo(getFelids(data)));
|
|
107
145
|
};
|
|
@@ -112,7 +150,7 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
112
150
|
var onBack = function () {
|
|
113
151
|
if (error)
|
|
114
152
|
dispatch(clearError());
|
|
115
|
-
if (
|
|
153
|
+
if (is_authorized) {
|
|
116
154
|
dispatch(handleCurrentActiveScreen('INDIVIDUAL_LIST_STEP'));
|
|
117
155
|
return;
|
|
118
156
|
}
|
|
@@ -131,18 +169,18 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
131
169
|
var handleExpiryDateActive = function (flag) {
|
|
132
170
|
setExpiryDateActive(flag);
|
|
133
171
|
};
|
|
134
|
-
var
|
|
135
|
-
var _a, _b
|
|
136
|
-
var name = isAr ? (
|
|
172
|
+
var getName = function () {
|
|
173
|
+
var _a, _b;
|
|
174
|
+
var name = isAr ? (_a = names === null || names === void 0 ? void 0 : names.ar) === null || _a === void 0 ? void 0 : _a.first : (_b = names === null || names === void 0 ? void 0 : names.en) === null || _b === void 0 ? void 0 : _b.first;
|
|
137
175
|
return name;
|
|
138
176
|
};
|
|
139
177
|
var getUserOccupation = function () {
|
|
140
|
-
var _a, _b, _c, _d
|
|
141
|
-
if (((
|
|
142
|
-
return isAr ? (
|
|
143
|
-
if (
|
|
178
|
+
var _a, _b, _c, _d;
|
|
179
|
+
if (((role === null || role === void 0 ? void 0 : role.length) || 0) > 0)
|
|
180
|
+
return isAr ? (_b = (_a = user.role[0]) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.ar : (_d = (_c = user.role[0]) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.en;
|
|
181
|
+
if (type === IndividualType.SHARE_HOLDER)
|
|
144
182
|
return t('type_share_holder');
|
|
145
|
-
if (
|
|
183
|
+
if (type === IndividualType.BOARD_MEMBER)
|
|
146
184
|
return t('type_board_member');
|
|
147
185
|
return t('type_user');
|
|
148
186
|
};
|
|
@@ -154,11 +192,11 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
154
192
|
var isBirthCountryListActive = listActive === ListType.BirthCountryList;
|
|
155
193
|
var isBirthCityListActive = listActive === ListType.BirthCityList;
|
|
156
194
|
var isNationalityListActive = listActive === ListType.NationalityList;
|
|
157
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: showField && !!
|
|
195
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: showField && !!is_authorized, timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getName() || '', _jsx(RoleTextStyled, { children: getUserOccupation() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: readOnly['name'] || (noneEditable['name.en'] && noneEditable['name.ar']), isVerified: isNameVerified }), _jsx(MobileNumber, { readOnly: readOnly['mobile'] || noneEditable['contact.phone.number'] || noneEditable['contact.phone.country_code'], show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive && !isIssuedCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isPhoneNumberVerified }), _jsx(Email, { show: showField, readOnly: readOnly['email'] || noneEditable['contact.email'], isVerified: isEmailVerified }), _jsx(Gender, { show: showField, readOnly: readOnly['gender'] || noneEditable['gender'], isVerified: isGenderVerified }), _jsx(ID, { show: showField, readOnly: readOnly['nid'] || noneEditable['identification.id'], isVerified: isIDVerified }), _jsx(IssuedCountry, { readOnly: readOnly['issuedCountry'] || noneEditable['identification.issuer_country'], show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isIssuedCountryVerified }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: readOnly['expiryDate'] || noneEditable['identification.expiry'], isVerified: isExpiryDateVerified }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: readOnly['dob'] || noneEditable['birth.date'], isVerified: isDOBVerified }), _jsx(BirthCountry, { readOnly: readOnly['placeOfBirthCountry'] || noneEditable['birth.country'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCountryVerified }), _jsx(BirthCity, { readOnly: readOnly['placeOfBirthCity'] || noneEditable['birth.city'], show: !isMobileCountryListActive &&
|
|
158
196
|
!isDateFieldActive &&
|
|
159
197
|
!isIssuedCountryListActive &&
|
|
160
198
|
!isBirthCountryListActive &&
|
|
161
|
-
!isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Nationality, { readOnly: readOnly['nationality'] || noneEditable['nationality'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); } })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
|
|
199
|
+
!isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCityVerified }), _jsx(Nationality, { readOnly: readOnly['nationality'] || noneEditable['nationality'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isNationalityVerified })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
|
|
162
200
|
};
|
|
163
201
|
IndividualPersonalInfo.defaultProps = {};
|
|
164
202
|
export default React.memo(IndividualPersonalInfo);
|
|
@@ -6,6 +6,7 @@ interface IssuedCountryProps {
|
|
|
6
6
|
onListOpen?: () => void;
|
|
7
7
|
onListClose?: () => void;
|
|
8
8
|
readOnly?: boolean;
|
|
9
|
+
isVerified?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IssuedCountryProps & React.RefAttributes<unknown>>>;
|
|
11
12
|
export default _default;
|