@tap-payments/auth-jsconnect 1.0.9 → 1.0.13
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 +5 -0
- package/build/assets/locales/ar.json +26 -10
- package/build/assets/locales/en.json +21 -5
- package/build/components/AnimationFlow/Dialog.js +12 -1
- package/build/components/DatePicker/DatePicker.d.ts +3 -1
- package/build/components/DatePicker/DatePicker.js +5 -2
- package/build/components/Radio/Radio.d.ts +5 -0
- package/build/components/Radio/Radio.js +31 -0
- package/build/components/Radio/index.d.ts +3 -0
- package/build/components/Radio/index.js +2 -0
- package/build/components/RadioGroup/RadioGroup.d.ts +5 -0
- package/build/components/RadioGroup/RadioGroup.js +41 -0
- package/build/components/RadioGroup/index.d.ts +3 -0
- package/build/components/RadioGroup/index.js +2 -0
- package/build/components/RadioLabel/RadioLabel.d.ts +7 -0
- package/build/components/RadioLabel/RadioLabel.js +34 -0
- package/build/components/RadioLabel/index.d.ts +3 -0
- package/build/components/RadioLabel/index.js +2 -0
- package/build/constants/app.js +5 -17
- package/build/constants/dummy.d.ts +5 -0
- package/build/constants/dummy.js +8 -0
- package/build/features/bank/Bank.js +1 -1
- package/build/features/business/Business.js +1 -1
- package/build/features/business/screens/Activities/Activities.js +14 -40
- package/build/features/business/screens/Activities/OperationStartDate.d.ts +6 -0
- package/build/features/business/screens/Activities/OperationStartDate.js +31 -0
- package/build/features/business/screens/Activities/SalesChannels.js +3 -10
- package/build/features/business/screens/Activities/validation.d.ts +3 -0
- package/build/features/business/screens/Activities/validation.js +3 -2
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -2
- package/build/features/business/screens/IDBOD/DOB.d.ts +2 -1
- package/build/features/business/screens/IDBOD/DOB.js +4 -1
- package/build/features/business/screens/IDBOD/ID.js +7 -48
- package/build/features/business/screens/IDBOD/IDBOD.js +9 -41
- package/build/features/business/screens/IDBOD/validation.js +2 -2
- package/build/features/connect/Connect.js +1 -1
- package/build/features/connect/screens/MID/BusinessCountry.js +3 -3
- package/build/features/connect/screens/MID/IDNumber.js +9 -6
- package/build/features/connect/screens/MID/MID.js +2 -2
- package/build/features/connect/screens/MID/MobileNumber.js +7 -15
- package/build/features/connect/screens/MID/validation.d.ts +1 -1
- package/build/features/connect/screens/MID/validation.js +5 -3
- package/build/features/connect/screens/Merchant/BrandName.js +2 -2
- package/build/features/connect/screens/Merchant/TAC.js +1 -1
- package/build/features/connect/screens/OTP/OTP.js +1 -1
- package/build/features/featuresScreens.d.ts +1 -1
- package/build/features/featuresScreens.js +12 -7
- package/build/features/owner/Owner.js +1 -1
- package/build/features/owner/screens/AdditionalOwnerInfo/AdditionalOwnerInfo.d.ts +8 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/AdditionalOwnerInfo.js +77 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerLocation.d.ts +10 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerLocation.js +80 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerName.d.ts +6 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerName.js +35 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/InfluencerSwitch.d.ts +6 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/InfluencerSwitch.js +45 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/MonthlyIncome.d.ts +6 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/MonthlyIncome.js +35 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/PEPSwitch.d.ts +6 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/PEPSwitch.js +45 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/SourceOfIncome.d.ts +9 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/SourceOfIncome.js +85 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/index.d.ts +3 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/index.js +2 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/validation.d.ts +25 -0
- package/build/features/owner/screens/AdditionalOwnerInfo/validation.js +32 -0
- package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.js +1 -1
- package/build/features/password/Password.js +1 -1
- package/build/features/shared/ExpandIcon/ExpandIcon.js +1 -1
- package/build/features/shared/Footer/Footer.js +1 -1
- package/build/features/shared/Input/Input.d.ts +0 -1
- package/build/features/shared/Input/Input.js +2 -5
- package/build/features/shared/Mandatory/Mandatory.d.ts +2 -0
- package/build/features/shared/Mandatory/Mandatory.js +20 -0
- package/build/features/shared/Mandatory/index.d.ts +2 -0
- package/build/features/shared/Mandatory/index.js +2 -0
- package/build/features/shared/OTP/OTP.js +2 -2
- package/build/index.css +128 -1
- package/build/theme/typography.js +2 -2
- package/build/utils/validation.d.ts +2 -0
- package/build/utils/validation.js +6 -0
- package/package.json +1 -1
|
@@ -7,11 +7,12 @@ export var ActivitiesValidationSchema = yup.object().shape({
|
|
|
7
7
|
})),
|
|
8
8
|
salesChannels: yup
|
|
9
9
|
.array()
|
|
10
|
-
.min(1)
|
|
10
|
+
.min(1, 'channel_of_service_error')
|
|
11
11
|
.of(yup.object().shape({
|
|
12
12
|
id: yup.number(),
|
|
13
13
|
name: yup.string(),
|
|
14
14
|
nameEn: yup.string()
|
|
15
15
|
}))
|
|
16
|
-
.required('Is required')
|
|
16
|
+
.required('Is required'),
|
|
17
|
+
operationStartDate: yup.string().required('Date is required')
|
|
17
18
|
});
|
|
@@ -69,11 +69,11 @@ var BusinessType = function (_a) {
|
|
|
69
69
|
};
|
|
70
70
|
var flList = [];
|
|
71
71
|
var crList = CR_LIST;
|
|
72
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SelectType, { show: !listActive, onSwitchToCR: function () { return setIsCR(true); }, onSwitchToFL: function () { return setIsCR(false); } }), _jsx(
|
|
72
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SelectType, { show: !listActive, onSwitchToCR: function () { return setIsCR(true); }, onSwitchToFL: function () { return setIsCR(false); } }), _jsx(CompanyLicense, { show: isCR, list: crList, onListOpen: function () {
|
|
73
73
|
setListActive(true);
|
|
74
74
|
}, onListClose: function () {
|
|
75
75
|
setListActive(false);
|
|
76
|
-
} }), _jsx(
|
|
76
|
+
} }), _jsx(FreelanceLicense, { show: !isCR, list: flList, onListOpen: function () {
|
|
77
77
|
setListActive(true);
|
|
78
78
|
}, onListClose: function () {
|
|
79
79
|
setListActive(false);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface BODProps {
|
|
3
|
+
onDateClicked?: (flag: boolean) => void;
|
|
3
4
|
}
|
|
4
|
-
declare const _default: React.MemoExoticComponent<({}: BODProps) => JSX.Element>;
|
|
5
|
+
declare const _default: React.MemoExoticComponent<({ onDateClicked }: BODProps) => JSX.Element>;
|
|
5
6
|
export default _default;
|
|
@@ -30,15 +30,18 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
30
30
|
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption), { cursor: 'pointer' }));
|
|
31
31
|
});
|
|
32
32
|
var BOD = function (_a) {
|
|
33
|
+
var _b;
|
|
34
|
+
var onDateClicked = _a.onDateClicked;
|
|
33
35
|
var t = useTranslation().t;
|
|
34
36
|
var control = useFormContext().control;
|
|
35
37
|
var dobControl = useController({ control: control, name: 'dob' });
|
|
36
38
|
var handleBirthDateChange = function (data) {
|
|
37
39
|
dobControl.field.onChange(data);
|
|
38
40
|
};
|
|
41
|
+
var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
39
42
|
return (_jsxs(BoxStyled, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
40
43
|
var spacing = _a.spacing;
|
|
41
44
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
42
|
-
} } }, { children: t('date_of_birth') })), _jsx(DatePicker, { defaultValue: new Date(
|
|
45
|
+
} } }, { children: t('date_of_birth') })), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', 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 })] }));
|
|
43
46
|
};
|
|
44
47
|
export default React.memo(BOD);
|
|
@@ -1,52 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import * as React from 'react';
|
|
14
|
-
import Box from '@mui/material/Box';
|
|
15
3
|
import { useTranslation } from 'react-i18next';
|
|
16
4
|
import { useController, useFormContext } from 'react-hook-form';
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
5
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
6
|
+
import Input from '../../../shared/Input';
|
|
7
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
8
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
21
9
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
22
10
|
import { ID_NUMBER_LENGTH } from '../../../../constants';
|
|
23
|
-
var BoxStyled = styled(Box)(function (_a) {
|
|
24
|
-
var theme = _a.theme;
|
|
25
|
-
return ({
|
|
26
|
-
display: 'flex',
|
|
27
|
-
flexDirection: 'column',
|
|
28
|
-
direction: theme.direction
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
32
|
-
var theme = _a.theme;
|
|
33
|
-
return (__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
34
|
-
});
|
|
35
|
-
var InputStyled = styled(Input)(function (_a) {
|
|
36
|
-
var theme = _a.theme;
|
|
37
|
-
return ({
|
|
38
|
-
padding: theme.spacing(0, 2, 0, 0)
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
42
|
-
var theme = _a.theme;
|
|
43
|
-
return ({
|
|
44
|
-
width: theme.spacing(2),
|
|
45
|
-
height: theme.spacing(2),
|
|
46
|
-
cursor: 'pointer',
|
|
47
|
-
color: alpha(theme.palette.text.primary, 0.4)
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
11
|
var IDNumber = function (_a) {
|
|
51
12
|
var _b;
|
|
52
13
|
var t = useTranslation().t;
|
|
@@ -61,9 +22,7 @@ var IDNumber = function (_a) {
|
|
|
61
22
|
nidControl.field.onChange('');
|
|
62
23
|
};
|
|
63
24
|
var nidValue = nidControl.field.value;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
67
|
-
} } }, { children: t('id_number_label') })), _jsx(InputStyled, { inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: nidValue && _jsx(ClearIconStyled, { onClick: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message })] }));
|
|
25
|
+
var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
26
|
+
return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('id_number_label'), 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) }) }));
|
|
68
27
|
};
|
|
69
28
|
export default React.memo(IDNumber);
|
|
@@ -11,7 +11,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import Box from '@mui/material/Box';
|
|
15
14
|
import { useTranslation } from 'react-i18next';
|
|
16
15
|
import { styled } from '@mui/material/styles';
|
|
17
16
|
import ID from './ID';
|
|
@@ -19,52 +18,18 @@ import DOB from './DOB';
|
|
|
19
18
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
20
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
21
20
|
import { NIDValidationSchema } from './validation';
|
|
22
|
-
import Loader from '../../../../components/Loader';
|
|
23
|
-
import { ICONS_NAMES } from '../../../../constants';
|
|
24
|
-
import Button from '../../../../components/Button';
|
|
25
21
|
import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
26
22
|
import { handleNextScreenStep } from '../../../../app/settings';
|
|
27
|
-
import Icon from '../../../../components/Icon';
|
|
28
23
|
import Form from '../../../../components/Form';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
direction: theme.direction,
|
|
33
|
-
display: 'flex',
|
|
34
|
-
flexDirection: 'column',
|
|
35
|
-
overflow: 'hidden'
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
39
|
-
var theme = _a.theme, isAr = _a.isAr;
|
|
40
|
-
return ({
|
|
41
|
-
width: theme.spacing(3),
|
|
42
|
-
height: theme.spacing(3),
|
|
43
|
-
paddingInlineStart: theme.spacing(1.5),
|
|
44
|
-
paddingInlineEnd: theme.spacing(0.5),
|
|
45
|
-
transform: isAr ? 'scaleX(-1)' : 'scaleX(1)'
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
var ButtonContainer = styled(Box)(function (_a) {
|
|
49
|
-
var theme = _a.theme;
|
|
50
|
-
return ({
|
|
51
|
-
margin: theme.spacing(5, 2.5, 2.5, 2.5)
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
var LoaderStyled = styled(Loader)(function (_a) {
|
|
55
|
-
var theme = _a.theme;
|
|
56
|
-
return ({
|
|
57
|
-
marginInlineStart: theme.spacing(-6.25),
|
|
58
|
-
'& .loader-box-container': {
|
|
59
|
-
marginInlineStart: theme.spacing(2.5)
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
24
|
+
import Button from '../../../shared/Button';
|
|
25
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
26
|
+
import Collapse from '../../../../components/Collapse';
|
|
63
27
|
var FormStyled = styled(Form)(function () { return ({
|
|
64
28
|
display: 'flex',
|
|
65
29
|
flexDirection: 'column'
|
|
66
30
|
}); });
|
|
67
31
|
var IDBOD = function (_a) {
|
|
32
|
+
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
68
33
|
var isAr = useLanguage().isAr;
|
|
69
34
|
var dispatch = useAppDispatch();
|
|
70
35
|
var t = useTranslation().t;
|
|
@@ -72,7 +37,7 @@ var IDBOD = function (_a) {
|
|
|
72
37
|
resolver: yupResolver(NIDValidationSchema),
|
|
73
38
|
defaultValues: {
|
|
74
39
|
nid: '',
|
|
75
|
-
dob: ''
|
|
40
|
+
dob: '1998-08-22'
|
|
76
41
|
},
|
|
77
42
|
mode: 'onChange'
|
|
78
43
|
});
|
|
@@ -80,6 +45,9 @@ var IDBOD = function (_a) {
|
|
|
80
45
|
console.log('data', data);
|
|
81
46
|
dispatch(handleNextScreenStep());
|
|
82
47
|
};
|
|
83
|
-
|
|
48
|
+
var handleCollapseOpenClose = function (flag) {
|
|
49
|
+
setCollapse(flag);
|
|
50
|
+
};
|
|
51
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ID, {}) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ sx: { mt: 6 }, isAr: isAr, disabled: !methods.formState.isValid }, { children: t('next') })) }))] })) })) }));
|
|
84
52
|
};
|
|
85
53
|
export default React.memo(IDBOD);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export var NIDValidationSchema = yup.object().shape({
|
|
3
|
-
dob: yup.string().min(5).required('
|
|
4
|
-
nid: yup.string().min(8).max(10).required('
|
|
3
|
+
dob: yup.string().min(5).required('dob_is_required'),
|
|
4
|
+
nid: yup.string().min(8, 'id_number_label_error').max(10, 'id_number_label_error').required('id_number_label_error')
|
|
5
5
|
});
|
|
@@ -34,7 +34,7 @@ var Connect = memo(function (props) {
|
|
|
34
34
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
|
|
35
35
|
var Element = _a.element, name = _a.name;
|
|
36
36
|
var isActive = activeScreen.name === name;
|
|
37
|
-
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter:
|
|
37
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
38
38
|
}) }) })) })));
|
|
39
39
|
});
|
|
40
40
|
export function ConnectLib(props) {
|
|
@@ -29,10 +29,10 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
29
29
|
import Text from '../../../../components/Text';
|
|
30
30
|
import Collapse from '../../../../components/Collapse';
|
|
31
31
|
import CheckIcon from '@mui/icons-material/Check';
|
|
32
|
-
import ScreenContainer from '
|
|
32
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
33
33
|
import Icon from '../../../../components/Icon';
|
|
34
|
-
import Input from '
|
|
35
|
-
import ExpandIcon from '
|
|
34
|
+
import Input from '../../../shared/Input';
|
|
35
|
+
import ExpandIcon from '../../../shared/ExpandIcon';
|
|
36
36
|
import SimpleList from '../../../../components/SimpleList';
|
|
37
37
|
import { useLanguage } from '../../../../hooks';
|
|
38
38
|
var CountryItemContainer = styled(Box)(function () { return ({
|
|
@@ -18,8 +18,9 @@ import { styled, alpha } from '@mui/material/styles';
|
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
19
|
import Tooltip from '@mui/material/Tooltip';
|
|
20
20
|
import Icon from '../../../../components/Icon';
|
|
21
|
-
import Input from '
|
|
22
|
-
import ClearIcon from '
|
|
21
|
+
import Input from '../../../shared/Input';
|
|
22
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
23
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
23
24
|
import Collapse from '../../../../components/Collapse';
|
|
24
25
|
import DatePicker from '../../../../components/DatePicker';
|
|
25
26
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
@@ -46,10 +47,10 @@ var IconStyled = styled(Icon)(function (_a) {
|
|
|
46
47
|
});
|
|
47
48
|
});
|
|
48
49
|
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
49
|
-
var _b;
|
|
50
|
+
var _b, _c;
|
|
50
51
|
var onSwitchToMobileNumber = _a.onSwitchToMobileNumber, show = _a.show;
|
|
51
52
|
var t = useTranslation().t;
|
|
52
|
-
var
|
|
53
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
53
54
|
var nidControl = useController({ control: control, name: 'nid' });
|
|
54
55
|
var dobControl = useController({ control: control, name: 'dob' });
|
|
55
56
|
React.useEffect(function () {
|
|
@@ -70,9 +71,11 @@ var IDNumber = React.forwardRef(function (_a, ref) {
|
|
|
70
71
|
dobControl.field.onChange(data);
|
|
71
72
|
};
|
|
72
73
|
var nidValue = nidControl.field.value;
|
|
73
|
-
|
|
74
|
+
var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
75
|
+
var dateValue = (_c = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _c === void 0 ? void 0 : _c.value;
|
|
76
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('id_number_label') }), _jsx(Tooltip, __assign({ title: t('switch_to_mobile') }, { children: _jsx(IconStyled, { onClick: onSwitchToMobileNumber, alt: 'switcher icon', src: ICONS_NAMES.MOBILE_IMAGE }) }))] }), _jsx(Input, { dir: 'ltr', 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), required: true }), _jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
74
77
|
var spacing = _a.spacing;
|
|
75
78
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
76
|
-
} } }, { children: t('date_of_birth') })), _jsx(DatePicker, { defaultValue: new Date(
|
|
79
|
+
} } }, { children: t('date_of_birth') })), _jsx(DatePicker, { defaultValue: dateValue ? new Date(dateValue) : new Date(), readOnly: true, dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange })] })) })));
|
|
77
80
|
});
|
|
78
81
|
export default React.memo(IDNumber);
|
|
@@ -54,7 +54,7 @@ var MID = function (_a) {
|
|
|
54
54
|
var _c = React.useState(), listType = _c[0], setListType = _c[1];
|
|
55
55
|
var dispatch = useAppDispatch();
|
|
56
56
|
var methods = useForm({
|
|
57
|
-
resolver: yupResolver(isNID ? NIDValidationSchema : PhoneValidationSchema),
|
|
57
|
+
resolver: yupResolver(isNID ? NIDValidationSchema : PhoneValidationSchema(10)),
|
|
58
58
|
defaultValues: {
|
|
59
59
|
countryCode: defaultCountry,
|
|
60
60
|
businessCountry: defaultCountry,
|
|
@@ -76,6 +76,6 @@ var MID = function (_a) {
|
|
|
76
76
|
var isBusinessListActive = listType === ListType.BusinessList;
|
|
77
77
|
var isCountryListActive = listType === ListType.CountryCodeList;
|
|
78
78
|
var listActive = isBusinessListActive || isCountryListActive;
|
|
79
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('
|
|
79
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('mobile_id_title'), description: t('mobile_id_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(BusinessCountry, { show: !isCountryListActive, countries: businessCountries, onListOpen: function () { return handleMenuListClick(ListType.BusinessList); }, onListClose: function () { return handleMenuListClick(); } }), _jsx(Collapse, __assign({ in: !isNID }, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: countriesCode, onSwitchToIdNumber: function () { return setIsNID(true); }, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) })), _jsx(Collapse, __assign({ in: isNID }, { children: _jsx(IDNumber, { show: !listActive, onSwitchToMobileNumber: function () { return setIsNID(false); } }) }))] })), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ isAr: isAr, disabled: !methods.formState.isValid, loading: false }, { children: t('next') })) }))] })) }))] }));
|
|
80
80
|
};
|
|
81
81
|
export default React.memo(MID);
|
|
@@ -29,12 +29,12 @@ import { styled, alpha } from '@mui/material/styles';
|
|
|
29
29
|
import Text from '../../../../components/Text';
|
|
30
30
|
import Collapse from '../../../../components/Collapse';
|
|
31
31
|
import Tooltip from '@mui/material/Tooltip';
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import ScreenContainer from '
|
|
32
|
+
import ExpandIcon from '../../../shared/ExpandIcon';
|
|
33
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
34
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
35
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
36
36
|
import Icon from '../../../../components/Icon';
|
|
37
|
-
import Input from '
|
|
37
|
+
import Input from '../../../shared/Input';
|
|
38
38
|
import SimpleList from '../../../../components/SimpleList';
|
|
39
39
|
import { ICONS_NAMES } from '../../../../constants';
|
|
40
40
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
@@ -66,14 +66,6 @@ var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
66
66
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
67
67
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
68
68
|
});
|
|
69
|
-
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
70
|
-
var theme = _a.theme;
|
|
71
|
-
return ({
|
|
72
|
-
color: theme.palette.success.main,
|
|
73
|
-
display: 'flex',
|
|
74
|
-
alignItems: 'flex-end'
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
69
|
var CountryCodeStyled = styled(Text)(function (_a) {
|
|
78
70
|
var theme = _a.theme;
|
|
79
71
|
return (__assign(__assign({ cursor: 'pointer' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightRegular, display: 'flex', alignItems: 'center', minWidth: theme.spacing(8.75) }));
|
|
@@ -125,8 +117,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
125
117
|
var mobileValue = phoneControl.field.value;
|
|
126
118
|
var countryCodeValue = countryCodeControl.field.value;
|
|
127
119
|
var error = (_b = phoneControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
128
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('mobile_number_label') }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(Tooltip, __assign({ title: t('switch_to_id') }, { children: _jsx(IconStyled, { onClick: rest.onSwitchToIdNumber, alt: 'switcher icon', src: ICONS_NAMES.ID_IMAGE }) })) }))] }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits) || 10 }, onChange: onPhoneNumberChange, value: mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: onOpenCountryList }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), _jsx(ExpandIcon, { anchorEl: !!anchorEl })] })), endAdornment: mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber }), placeholder: "".concat((countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA' ? '5' : '0', "00000000"), warningType: 'alert', warningMessage:
|
|
129
|
-
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(
|
|
120
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('mobile_number_label') }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(Tooltip, __assign({ title: t('switch_to_id') }, { children: _jsx(IconStyled, { onClick: rest.onSwitchToIdNumber, alt: 'switcher icon', src: ICONS_NAMES.ID_IMAGE }) })) }))] }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits) || 10 }, onChange: onPhoneNumberChange, value: mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: onOpenCountryList }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), _jsx(ExpandIcon, { anchorEl: !!anchorEl })] })), endAdornment: !error && mobileValue ? _jsx(CheckIcon, {}) : mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber }), placeholder: "".concat((countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA' ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
121
|
+
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, {})] }));
|
|
130
122
|
} }) }))] })) })));
|
|
131
123
|
});
|
|
132
124
|
export default React.memo(MobileNumber);
|
|
@@ -9,7 +9,7 @@ export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/objec
|
|
|
9
9
|
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
10
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
11
|
}>>>;
|
|
12
|
-
export declare const PhoneValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
12
|
+
export declare const PhoneValidationSchema: (min: number) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
13
13
|
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
14
14
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
15
|
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
@@ -3,6 +3,8 @@ export var NIDValidationSchema = yup.object().shape({
|
|
|
3
3
|
dob: yup.string().min(5).required('DOB is required'),
|
|
4
4
|
nid: yup.string().min(8).max(10).required('NID is required')
|
|
5
5
|
});
|
|
6
|
-
export var PhoneValidationSchema =
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export var PhoneValidationSchema = function (min) {
|
|
7
|
+
return yup.object().shape({
|
|
8
|
+
mobile: yup.string().min(min).required('mobile_number_error')
|
|
9
|
+
});
|
|
10
|
+
};
|
|
@@ -22,7 +22,7 @@ import Text from '../../../../components/Text';
|
|
|
22
22
|
import Input from '../../../shared/Input';
|
|
23
23
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
24
24
|
import Tooltip from '../../../../components/Tooltip';
|
|
25
|
-
import {
|
|
25
|
+
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
26
26
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
27
27
|
var theme = _a.theme;
|
|
28
28
|
return ({
|
|
@@ -61,7 +61,7 @@ var BrandName = function (_a) {
|
|
|
61
61
|
var brandControl = useController({ control: control, name: 'brandName' });
|
|
62
62
|
var handleBrandNameChange = function (_a) {
|
|
63
63
|
var target = _a.target;
|
|
64
|
-
var value =
|
|
64
|
+
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
65
65
|
brandControl.field.onChange(value);
|
|
66
66
|
};
|
|
67
67
|
var clearBrandName = function () {
|
|
@@ -52,7 +52,7 @@ var CheckboxStyled = styled(CheckBox)(function (_a) {
|
|
|
52
52
|
marginInlineEnd: theme.spacing(1.5),
|
|
53
53
|
color: theme.palette.primary.main,
|
|
54
54
|
'& .MuiSvgIcon-root': {
|
|
55
|
-
fontSize:
|
|
55
|
+
fontSize: theme.spacing(3.75)
|
|
56
56
|
},
|
|
57
57
|
'&.Mui-checked': {
|
|
58
58
|
color: theme.palette.text.primary,
|
|
@@ -63,7 +63,7 @@ var OTP = function (_a) {
|
|
|
63
63
|
return dispatch(handleNextScreenStep('CONNECT_PASSWORD_STEP'));
|
|
64
64
|
dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
|
|
65
65
|
};
|
|
66
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [t('
|
|
66
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [t('otp_sent_title'), " ", _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disabled: !methods.formState.isValid, type: 'submit', isAr: isAr, loading: false }, { children: t('next') }))] })) })) }));
|
|
67
67
|
};
|
|
68
68
|
OTP.defaultProps = {
|
|
69
69
|
phone: '+996564656085'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FeatureScreenStep } from '../@types';
|
|
2
2
|
export declare const connectFeatureScreens: Array<FeatureScreenStep>;
|
|
3
3
|
export declare const businessFeatureScreens: Array<FeatureScreenStep>;
|
|
4
|
-
export declare const ownerFeatureScreens: Array<FeatureScreenStep>;
|
|
5
4
|
export declare const passwordFeatureScreens: Array<FeatureScreenStep>;
|
|
5
|
+
export declare const ownerFeatureScreens: Array<FeatureScreenStep>;
|
|
6
6
|
export declare const bankFeatureScreens: Array<FeatureScreenStep>;
|
|
7
7
|
export declare const taxFeatureScreens: Array<FeatureScreenStep>;
|
|
@@ -14,6 +14,7 @@ import SuccessPage from './business/screens/Success';
|
|
|
14
14
|
import ConfirmPage from './business/screens/Confirm';
|
|
15
15
|
import CreatePasswordPage from './password/screens/CreatePassword';
|
|
16
16
|
import ShowOwnerInfoPage from './owner/screens/ShowOwnerInfo';
|
|
17
|
+
import AdditionalOwnerInfoPage from './owner/screens/AdditionalOwnerInfo';
|
|
17
18
|
import BankDetailsPage from './bank/screens/BankDetails';
|
|
18
19
|
import TaxDetailsPage from './tax/screens/TaxDetails';
|
|
19
20
|
export var connectFeatureScreens = [
|
|
@@ -73,27 +74,31 @@ export var businessFeatureScreens = [
|
|
|
73
74
|
},
|
|
74
75
|
{ name: 'BUSINESS_SUCCESS_STEP', element: SuccessPage }
|
|
75
76
|
];
|
|
77
|
+
export var passwordFeatureScreens = [
|
|
78
|
+
{
|
|
79
|
+
name: 'PASSWORD_CREATE_PASSWORD_STEP',
|
|
80
|
+
element: CreatePasswordPage
|
|
81
|
+
}
|
|
82
|
+
];
|
|
76
83
|
export var ownerFeatureScreens = [
|
|
77
84
|
{
|
|
78
85
|
name: 'OWNER_SHOW_OWNER_INFO_STEP',
|
|
79
86
|
element: ShowOwnerInfoPage
|
|
80
|
-
}
|
|
81
|
-
];
|
|
82
|
-
export var passwordFeatureScreens = [
|
|
87
|
+
},
|
|
83
88
|
{
|
|
84
|
-
name: '
|
|
85
|
-
element:
|
|
89
|
+
name: 'OWNER_ADDITIONAL_OWNER_INFO_STEP',
|
|
90
|
+
element: AdditionalOwnerInfoPage
|
|
86
91
|
}
|
|
87
92
|
];
|
|
88
93
|
export var bankFeatureScreens = [
|
|
89
94
|
{
|
|
90
|
-
name: '
|
|
95
|
+
name: 'BANK_BANK_DETAILS_STEP',
|
|
91
96
|
element: BankDetailsPage
|
|
92
97
|
}
|
|
93
98
|
];
|
|
94
99
|
export var taxFeatureScreens = [
|
|
95
100
|
{
|
|
96
|
-
name: '
|
|
101
|
+
name: 'TAX_TAX_DETAILS_STEP',
|
|
97
102
|
element: TaxDetailsPage
|
|
98
103
|
}
|
|
99
104
|
];
|
|
@@ -36,7 +36,7 @@ var Owner = memo(function (props) {
|
|
|
36
36
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: ownerFeatureScreens.map(function (_a, index) {
|
|
37
37
|
var Element = _a.element, name = _a.name;
|
|
38
38
|
var isActive = activeScreen.name === name;
|
|
39
|
-
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter:
|
|
39
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
40
40
|
}) }) })) })));
|
|
41
41
|
});
|
|
42
42
|
export function OwnerLib(props) {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
15
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
19
|
+
import { handleNextScreenStep } from '../../../../app/settings';
|
|
20
|
+
import { styled } from '@mui/material/styles';
|
|
21
|
+
import Form from '../../../../components/Form';
|
|
22
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import Button from '../../../shared/Button';
|
|
24
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
25
|
+
import { useLanguage } from '../../../../hooks';
|
|
26
|
+
import PEPSwitch from './PEPSwitch';
|
|
27
|
+
import { OwnerInfoValidationSchema } from './validation';
|
|
28
|
+
import InfluencerSwitch from './InfluencerSwitch';
|
|
29
|
+
import MonthlyIncome from './MonthlyIncome';
|
|
30
|
+
import EmployerName from './EmployerName';
|
|
31
|
+
import EmployerLocation from './EmployerLocation';
|
|
32
|
+
import SourceOfIncome from './SourceOfIncome';
|
|
33
|
+
import { countriesCode, SOURCE_OF_INCOME } from '../../../../constants';
|
|
34
|
+
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
35
|
+
var _b;
|
|
36
|
+
var theme = _a.theme, listActive = _a.listActive;
|
|
37
|
+
return (_b = {
|
|
38
|
+
paddingBottom: theme.spacing(listActive ? 0 : 5),
|
|
39
|
+
overflow: 'scroll',
|
|
40
|
+
maxHeight: 'calc(100vh - 250px)'
|
|
41
|
+
},
|
|
42
|
+
_b[theme.transitions.create(['padding-bottom'])] = {
|
|
43
|
+
duration: theme.transitions.duration.standard
|
|
44
|
+
},
|
|
45
|
+
_b);
|
|
46
|
+
});
|
|
47
|
+
var AdditionalOwnerInfo = function (_a) {
|
|
48
|
+
var methods = useForm({
|
|
49
|
+
resolver: yupResolver(OwnerInfoValidationSchema),
|
|
50
|
+
defaultValues: {
|
|
51
|
+
monthlyIncome: '',
|
|
52
|
+
employerName: '',
|
|
53
|
+
isPEP: null,
|
|
54
|
+
isInfluencer: null
|
|
55
|
+
},
|
|
56
|
+
mode: 'onChange'
|
|
57
|
+
});
|
|
58
|
+
var t = useTranslation().t;
|
|
59
|
+
var isAr = useLanguage().isAr;
|
|
60
|
+
var dispatch = useAppDispatch();
|
|
61
|
+
var _b = React.useState(false), listActive = _b[0], setListActive = _b[1];
|
|
62
|
+
var _c = React.useState(false), employerFieldsActive = _c[0], setEmployerFieldsActive = _c[1];
|
|
63
|
+
var onSubmit = function (data) {
|
|
64
|
+
console.log('data', data);
|
|
65
|
+
dispatch(handleNextScreenStep());
|
|
66
|
+
};
|
|
67
|
+
var handleSelectSource = function (country) {
|
|
68
|
+
var _a;
|
|
69
|
+
if (((_a = country.nameEn) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary')
|
|
70
|
+
setEmployerFieldsActive(true);
|
|
71
|
+
else
|
|
72
|
+
setEmployerFieldsActive(false);
|
|
73
|
+
};
|
|
74
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SourceOfIncome, { show: !listActive, list: SOURCE_OF_INCOME, onSelectSource: handleSelectSource }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries: countriesCode, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ isAr: isAr, disabled: !methods.formState.isValid, loading: false }, { children: t('next') })) }))] })) })) }));
|
|
75
|
+
};
|
|
76
|
+
export default React.memo(AdditionalOwnerInfo);
|
|
77
|
+
AdditionalOwnerInfo.defaultProps = {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CountryCode } from '../../../../@types';
|
|
3
|
+
interface EmployerLocationProps {
|
|
4
|
+
countries: Array<CountryCode>;
|
|
5
|
+
show: boolean;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<EmployerLocationProps & React.RefAttributes<unknown>>>;
|
|
10
|
+
export default _default;
|