@tap-payments/auth-jsconnect 2.4.13-test → 2.4.15-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/components/DatePicker/DatePicker.d.ts +2 -1
- package/build/components/DatePicker/DatePicker.js +12 -11
- package/build/features/app/individual/individualStore.js +8 -5
- package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +0 -14
- package/build/features/entity/screens/EntityCapital/ActivityList.js +9 -14
- package/build/features/entity/screens/EntityCapital/CapitalPaid.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +4 -5
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +3 -4
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +7 -8
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +13 -5
- package/build/features/entity/screens/EntityName/Article.d.ts +2 -1
- package/build/features/entity/screens/EntityName/Article.js +3 -2
- package/build/features/entity/screens/EntityName/EntityName.js +34 -12
- package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +1 -14
- package/build/features/entity/screens/EntityName/EntityTypeList.js +7 -16
- package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +2 -1
- package/build/features/entity/screens/EntityName/ExpiryDate.js +2 -4
- package/build/features/entity/screens/EntityName/IssuingDate.d.ts +2 -1
- package/build/features/entity/screens/EntityName/IssuingDate.js +2 -4
- package/build/features/entity/screens/EntityName/LegalName.d.ts +2 -1
- package/build/features/entity/screens/EntityName/LegalName.js +3 -4
- package/build/features/entity/screens/EntityName/LicenseCertificate.js +8 -2
- package/build/features/entity/screens/EntityName/LicenseNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityName/LicenseNumber.js +4 -5
- package/build/features/entity/screens/EntityName/UnifiedNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +3 -4
- 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/build/features/shared/EndAdornment/EndAdornment.d.ts +1 -1
- package/build/features/shared/EndAdornment/EndAdornment.js +1 -1
- package/build/utils/date.d.ts +1 -0
- package/build/utils/date.js +6 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -20,20 +20,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import {
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
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,24 +49,15 @@ 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 IssuedCountry = 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;
|
|
66
58
|
var isAr = useLanguage().isAr;
|
|
67
59
|
var control = useFormContext().control;
|
|
68
60
|
var issuedCountryControl = useController({ control: control, name: 'issuedCountry' });
|
|
69
|
-
var disabled = false;
|
|
70
61
|
var onOpenCountrySelect = function (event) {
|
|
71
62
|
var _a;
|
|
72
63
|
if (readOnly)
|
|
@@ -86,8 +77,8 @@ var IssuedCountry = React.forwardRef(function (_a, ref) {
|
|
|
86
77
|
};
|
|
87
78
|
var location = issuedCountryControl.field.value;
|
|
88
79
|
var error = (_b = issuedCountryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
89
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(InputStyled, { label: t('issued_country_label'), readOnly: readOnly,
|
|
90
|
-
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('issued_country_label'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }), placeholder: t('choose_issued_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 })] }));
|
|
91
82
|
} }) }))] })) })));
|
|
92
83
|
});
|
|
93
84
|
export default React.memo(IssuedCountry);
|
|
@@ -6,6 +6,7 @@ interface MobileNumberProps {
|
|
|
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<MobileNumberProps & React.RefAttributes<unknown>>>;
|
|
11
12
|
export default _default;
|
|
@@ -27,16 +27,15 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
27
27
|
import Box from '@mui/material/Box';
|
|
28
28
|
import { styled, alpha } from '@mui/material/styles';
|
|
29
29
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
30
|
-
import { useLanguage
|
|
30
|
+
import { useLanguage } from '../../../../hooks';
|
|
31
31
|
import Text from '../../../../components/Text';
|
|
32
32
|
import Collapse from '../../../../components/Collapse';
|
|
33
33
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
34
34
|
import SimpleList from '../../../../components/SimpleList';
|
|
35
|
-
import ClearIcon from '../../../shared/ClearIcon';
|
|
36
35
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
37
36
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
38
37
|
import Input from '../../../shared/Input';
|
|
39
|
-
import {
|
|
38
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
40
39
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
41
40
|
var theme = _a.theme;
|
|
42
41
|
return ({
|
|
@@ -83,13 +82,12 @@ var InputStyled = styled(Input)(function (_a) {
|
|
|
83
82
|
});
|
|
84
83
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
85
84
|
var _b, _c, _d;
|
|
86
|
-
var countries = _a.countries, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "readOnly"]);
|
|
85
|
+
var countries = _a.countries, readOnly = _a.readOnly, isVerified = _a.isVerified, rest = __rest(_a, ["countries", "readOnly", "isVerified"]);
|
|
87
86
|
var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
|
|
88
87
|
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
89
88
|
var t = useTranslation().t;
|
|
90
89
|
var isAr = useLanguage().isAr;
|
|
91
90
|
var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
|
|
92
|
-
var data = useAppSelector(individualSelector).data;
|
|
93
91
|
var phoneControl = useController({ name: 'mobile', control: control });
|
|
94
92
|
var countryCodeControl = useController({ name: 'countryCode', control: control });
|
|
95
93
|
var countryCodeValue = countryCodeControl.field.value;
|
|
@@ -100,7 +98,6 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
100
98
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
101
99
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
102
100
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
103
|
-
var disabled = false;
|
|
104
101
|
React.useEffect(function () {
|
|
105
102
|
if (mobileValue)
|
|
106
103
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
@@ -138,8 +135,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
138
135
|
setValue('mobile', '');
|
|
139
136
|
countryCodeControl.field.onChange(country);
|
|
140
137
|
};
|
|
141
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength: requiredLen }, type: 'tel', disabled:
|
|
142
|
-
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
138
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: readOnly ? undefined : function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : (_jsx(EndAdornment, { value: mobileValue, isVerified: isVerified, onClear: clearMobileNumber, error: error })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
139
|
+
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
143
140
|
} }) }))] })) })));
|
|
144
141
|
});
|
|
145
142
|
export default React.memo(MobileNumber);
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
export interface NameProps {
|
|
3
3
|
show: boolean;
|
|
4
4
|
readOnly?: boolean;
|
|
5
|
+
isVerified?: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<({ show, readOnly }: NameProps) => JSX.Element>;
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly, isVerified }: NameProps) => JSX.Element>;
|
|
7
8
|
export default _default;
|
|
@@ -15,13 +15,10 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
|
|
18
|
-
import { useAppSelector } from '../../../../hooks';
|
|
19
18
|
import Collapse from '../../../../components/Collapse';
|
|
20
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
20
|
import Input from '../../../shared/Input';
|
|
22
|
-
import
|
|
23
|
-
import CheckIcon from '../../../shared/CheckIcon';
|
|
24
|
-
import { individualSelector } from '../../../app/individual/individualStore';
|
|
21
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
25
22
|
var InputStyled = styled(Input)(function () { return ({
|
|
26
23
|
input: {
|
|
27
24
|
textTransform: 'capitalize'
|
|
@@ -29,23 +26,19 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
29
26
|
}); });
|
|
30
27
|
var Name = function (_a) {
|
|
31
28
|
var _b;
|
|
32
|
-
var show = _a.show, readOnly = _a.readOnly;
|
|
29
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
33
30
|
var t = useTranslation().t;
|
|
34
31
|
var control = useFormContext().control;
|
|
35
32
|
var nameControl = useController({ name: 'name', control: control });
|
|
36
|
-
var data = useAppSelector(individualSelector).data;
|
|
37
|
-
var verify = data.verify;
|
|
38
|
-
var user = (verify.responseBody || {}).user;
|
|
39
33
|
var handleNameChange = function (event) {
|
|
40
34
|
var value = removeAllOtherThanAlphabetAndSpace(event.target.value);
|
|
41
35
|
nameControl.field.onChange(value);
|
|
42
36
|
};
|
|
43
37
|
var nameValue = nameControl.field.value;
|
|
44
38
|
var error = (_b = nameControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
45
|
-
var disabled = false;
|
|
46
39
|
var clearNumber = function () {
|
|
47
40
|
nameControl.field.onChange('');
|
|
48
41
|
};
|
|
49
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { readOnly: readOnly, label: t('signup_merchant_name_label'), value: nameValue,
|
|
42
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { readOnly: readOnly, label: t('signup_merchant_name_label'), value: nameValue, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: nameValue, isVerified: isVerified, onClear: clearNumber, error: error }) }) })) })));
|
|
50
43
|
};
|
|
51
44
|
export default React.memo(Name);
|
|
@@ -6,6 +6,7 @@ interface NationalityProps {
|
|
|
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<NationalityProps & React.RefAttributes<unknown>>>;
|
|
11
12
|
export default _default;
|
|
@@ -20,20 +20,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import {
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
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,24 +49,15 @@ 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 Nationality = 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;
|
|
66
58
|
var isAr = useLanguage().isAr;
|
|
67
59
|
var control = useFormContext().control;
|
|
68
60
|
var nationalityControl = useController({ control: control, name: 'nationality' });
|
|
69
|
-
var disabled = false;
|
|
70
61
|
var onOpenCountrySelect = function (event) {
|
|
71
62
|
var _a;
|
|
72
63
|
if (readOnly)
|
|
@@ -86,8 +77,8 @@ var Nationality = React.forwardRef(function (_a, ref) {
|
|
|
86
77
|
};
|
|
87
78
|
var location = nationalityControl.field.value;
|
|
88
79
|
var error = (_b = nationalityControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
89
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(InputStyled, { label: t('nationality_label'), readOnly: readOnly,
|
|
90
|
-
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('nationality_label'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }), placeholder: t('choose_nationality'), 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 })] }));
|
|
91
82
|
} }) }))] })) })));
|
|
92
83
|
});
|
|
93
84
|
export default React.memo(Nationality);
|
|
@@ -4,7 +4,7 @@ interface EndAdornmentProps {
|
|
|
4
4
|
isVerified?: boolean;
|
|
5
5
|
error?: string;
|
|
6
6
|
value?: string;
|
|
7
|
-
onClear
|
|
7
|
+
onClear?: () => void;
|
|
8
8
|
}
|
|
9
9
|
declare const EndAdornment: ({ isVerified, loading, error, value, onClear }: EndAdornmentProps) => JSX.Element;
|
|
10
10
|
export default EndAdornment;
|
|
@@ -9,7 +9,7 @@ var EndAdornment = function (_a) {
|
|
|
9
9
|
return _jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } });
|
|
10
10
|
if (!error && value)
|
|
11
11
|
return _jsx(CheckIcon, { isVerified: isVerified });
|
|
12
|
-
if (value)
|
|
12
|
+
if (value && onClear)
|
|
13
13
|
return _jsx(ClearIcon, { onClick: onClear });
|
|
14
14
|
};
|
|
15
15
|
return _jsx(_Fragment, { children: getEndAdornment() });
|