@tap-payments/auth-jsconnect 1.0.68 → 1.0.71
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 +3 -3
- package/build/api/data.d.ts +1 -0
- package/build/api/data.js +5 -1
- package/build/api/index.d.ts +1 -0
- package/build/assets/locales/ar.json +2 -1
- package/build/assets/locales/en.json +2 -1
- package/build/components/SimpleList/SimpleList.js +3 -0
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +2 -0
- package/build/constants/assets.d.ts +7 -0
- package/build/constants/assets.js +13 -6
- package/build/constants/dummy.d.ts +1 -1
- package/build/constants/dummy.js +6 -6
- package/build/features/app/business/businessStore.js +4 -2
- package/build/features/app/connect/connectStore.js +4 -2
- package/build/features/app/individual/individualStore.d.ts +8 -1
- package/build/features/app/individual/individualStore.js +85 -15
- package/build/features/bank/screens/BankDetails/BankName.js +18 -5
- package/build/features/bank/screens/BankDetails/IBAN.js +1 -8
- package/build/features/bank/screens/BankDetails/validation.d.ts +3 -3
- package/build/features/bank/screens/BankDetails/validation.js +1 -1
- package/build/features/bank/screens/Verify/Verify.js +3 -4
- package/build/features/business/screens/Activities/Activities.js +2 -3
- package/build/features/business/screens/Activities/ActivitiesList.js +2 -3
- package/build/features/business/screens/Activities/SalesChannels.js +2 -3
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -3
- package/build/features/business/screens/BusinessType/LicenseList.js +2 -3
- package/build/features/business/screens/Customers/CustomerLocations.js +2 -3
- package/build/features/business/screens/Customers/Customers.js +2 -3
- package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -3
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +2 -3
- package/build/features/business/screens/IDBOD/DOB.js +6 -0
- package/build/features/business/screens/IDBOD/IDBOD.js +3 -8
- package/build/features/business/screens/OTP/OTP.js +3 -4
- package/build/features/business/screens/OTP/OTPInput.js +2 -3
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/business/screens/Verify/Verify.js +3 -4
- package/build/features/connect/screens/Individual/Individual.js +2 -3
- package/build/features/connect/screens/Individual/MobileNumber.js +22 -8
- package/build/features/connect/screens/Merchant/BrandName.js +2 -3
- package/build/features/connect/screens/Merchant/Merchant.js +2 -3
- package/build/features/connect/screens/Mobile/Mobile.js +3 -4
- package/build/features/connect/screens/Mobile/MobileNumber.js +25 -9
- package/build/features/connect/screens/NID/DOB.js +2 -3
- package/build/features/connect/screens/NID/NID.js +3 -4
- package/build/features/connect/screens/OTP/OTP.js +2 -3
- package/build/features/connect/screens/OTP/OTPInput.js +2 -3
- package/build/features/individual/Individual.js +6 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -11
- package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.js +5 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +1 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +18 -12
- package/build/features/individual/screens/Verify/Verify.js +3 -4
- package/build/features/password/screens/Verify/Verify.js +3 -4
- package/build/features/shared/Button/SuccessButton.d.ts +9 -0
- package/build/features/shared/Button/SuccessButton.js +71 -0
- package/build/features/shared/Button/index.d.ts +2 -1
- package/build/features/shared/Button/index.js +2 -1
- package/build/features/shared/Footer/Footer.js +2 -3
- package/build/features/shared/Search/Search.d.ts +7 -0
- package/build/features/shared/Search/Search.js +25 -0
- package/build/features/shared/Search/index.d.ts +2 -0
- package/build/features/shared/Search/index.js +2 -0
- package/build/features/shared/SearchIcon/SearchIcon.d.ts +6 -0
- package/build/features/shared/SearchIcon/SearchIcon.js +26 -0
- package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -3
- package/build/features/tax/screens/Verify/Verify.js +3 -4
- package/package.json +1 -1
|
@@ -11,13 +11,12 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import { useTranslation } from 'react-i18next';
|
|
16
15
|
import { alpha, styled } from '@mui/material/styles';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import { NIDValidationSchema } from './validation';
|
|
20
|
-
import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
21
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
22
21
|
import { clearError, connectSelector, createNIDAuth } from '../../../app/connect/connectStore';
|
|
23
22
|
import Form from '../../../../components/Form';
|
|
@@ -62,8 +61,8 @@ var NID = function (_a) {
|
|
|
62
61
|
var isAr = useLanguage().isAr;
|
|
63
62
|
var dispatch = useAppDispatch();
|
|
64
63
|
var t = useTranslation().t;
|
|
65
|
-
var _c =
|
|
66
|
-
var settingsStore =
|
|
64
|
+
var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
65
|
+
var settingsStore = useAppSelector(settingsSelector);
|
|
67
66
|
var methods = useForm({
|
|
68
67
|
resolver: yupResolver(NIDValidationSchema),
|
|
69
68
|
defaultValues: data.nidData,
|
|
@@ -10,7 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useSelector } from 'react-redux';
|
|
14
13
|
import Box from '@mui/material/Box/Box';
|
|
15
14
|
import { styled } from '@mui/material/styles';
|
|
16
15
|
import * as React from 'react';
|
|
@@ -19,7 +18,7 @@ import Text from '../../../../components/Text';
|
|
|
19
18
|
import { clearError, connectSelector, resetOTPScreen, verifyAuth } from '../../../app/connect/connectStore';
|
|
20
19
|
import Button from '../../../shared/Button';
|
|
21
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
24
23
|
import { useLanguage } from '../../../../hooks';
|
|
25
24
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var OTP = function () {
|
|
51
50
|
var _a;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _b =
|
|
52
|
+
var _b = useAppSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -11,7 +11,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useSelector } from 'react-redux';
|
|
15
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
15
|
import { useTranslation } from 'react-i18next';
|
|
17
16
|
import Box from '@mui/material/Box/Box';
|
|
@@ -19,7 +18,7 @@ import { styled } from '@mui/material/styles';
|
|
|
19
18
|
import OTPField from '../../../shared/OTP';
|
|
20
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
21
20
|
import { connectSelector, createMobileAuth, createNIDAuth } from '../../../app/connect/connectStore';
|
|
22
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
22
|
var BoxStyled = styled(Box)(function (_a) {
|
|
24
23
|
var theme = _a.theme;
|
|
25
24
|
return ({
|
|
@@ -33,7 +32,7 @@ var OTPInput = function (_a) {
|
|
|
33
32
|
var t = useTranslation().t;
|
|
34
33
|
var dispatch = useAppDispatch();
|
|
35
34
|
var otpControl = useController({ name: 'otp', control: control });
|
|
36
|
-
var data =
|
|
35
|
+
var data = useAppSelector(connectSelector).data;
|
|
37
36
|
var mobileData = data.mobileData;
|
|
38
37
|
var nidData = data.nidData;
|
|
39
38
|
var isAbsher = data.otpData.isAbsher;
|
|
@@ -21,13 +21,14 @@ import { getParameterByName, reactElement } from '../../utils';
|
|
|
21
21
|
import { FeatureContainer } from '../shared/Containers';
|
|
22
22
|
import { INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
|
|
23
23
|
import { individualFeatureScreens } from '../featuresScreens';
|
|
24
|
-
import { verifyLeadToken } from '../app/individual/individualStore';
|
|
24
|
+
import { getCountries, individualSelector, verifyLeadToken } from '../app/individual/individualStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
26
|
var Individual = memo(function (props) {
|
|
27
27
|
var open = React.useState(true)[0];
|
|
28
28
|
var theme = useAppTheme().theme;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
|
+
var customLoading = useAppSelector(individualSelector).customLoading;
|
|
31
32
|
var loading = useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props)).loading;
|
|
32
33
|
useErrorListener();
|
|
33
34
|
var activeScreen = data.activeScreen;
|
|
@@ -41,7 +42,10 @@ var Individual = memo(function (props) {
|
|
|
41
42
|
if (!loading)
|
|
42
43
|
verifyToken();
|
|
43
44
|
}, [loading]);
|
|
44
|
-
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
dispatch(getCountries());
|
|
47
|
+
}, []);
|
|
48
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
|
|
45
49
|
var Element = _a.element, name = _a.name;
|
|
46
50
|
var isActive = activeScreen.name === name;
|
|
47
51
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -15,7 +15,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
15
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import { useTranslation } from 'react-i18next';
|
|
18
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
20
20
|
import { styled } from '@mui/material/styles';
|
|
21
21
|
import Form from '../../../../components/Form';
|
|
@@ -30,8 +30,6 @@ import MonthlyIncome from './MonthlyIncome';
|
|
|
30
30
|
import EmployerName from './EmployerName';
|
|
31
31
|
import EmployerLocation from './EmployerLocation';
|
|
32
32
|
import SourceOfIncome from './SourceOfIncome';
|
|
33
|
-
import { countriesCode, SOURCE_OF_INCOME } from '../../../../constants';
|
|
34
|
-
import { useSelector } from 'react-redux';
|
|
35
33
|
import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
|
|
36
34
|
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
37
35
|
var _b;
|
|
@@ -59,7 +57,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
59
57
|
var t = useTranslation().t;
|
|
60
58
|
var isAr = useLanguage().isAr;
|
|
61
59
|
var dispatch = useAppDispatch();
|
|
62
|
-
var _b =
|
|
60
|
+
var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
63
61
|
var methods = useForm({
|
|
64
62
|
resolver: yupResolver(IndividualInfoValidationSchema),
|
|
65
63
|
defaultValues: data.individualData,
|
|
@@ -67,21 +65,26 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
67
65
|
});
|
|
68
66
|
var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
|
|
69
67
|
var _d = React.useState(false), employerFieldsActive = _d[0], setEmployerFieldsActive = _d[1];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var handleSelectSource = function (country) {
|
|
74
|
-
var _a;
|
|
75
|
-
if (((_a = country.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary')
|
|
68
|
+
React.useEffect(function () {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.name_en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'salary')
|
|
76
71
|
setEmployerFieldsActive(true);
|
|
77
72
|
else {
|
|
78
73
|
setEmployerFieldsActive(false);
|
|
79
74
|
}
|
|
75
|
+
}, [methods.watch('sourceIncome')]);
|
|
76
|
+
React.useEffect(function () {
|
|
77
|
+
if (data.individualData.employerLocation) {
|
|
78
|
+
methods.setValue('employerLocation', data.individualData.employerLocation);
|
|
79
|
+
}
|
|
80
|
+
}, [data.individualData.employerLocation]);
|
|
81
|
+
var onSubmit = function (data) {
|
|
82
|
+
dispatch(updateIndividualInfo(data));
|
|
80
83
|
};
|
|
81
84
|
var onBack = function () {
|
|
82
85
|
dispatch(handlePrevScreenStep());
|
|
83
86
|
};
|
|
84
|
-
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
|
|
87
|
+
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 }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries: data.countries, 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(ButtonStyled, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
85
88
|
};
|
|
86
89
|
export default React.memo(AdditionalIndividualInfo);
|
|
87
90
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -20,14 +20,11 @@ import CheckIcon from '../../../shared/CheckIcon';
|
|
|
20
20
|
import Collapse from '../../../../components/Collapse';
|
|
21
21
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
22
22
|
import { styled } from '@mui/material/styles';
|
|
23
|
-
var InputStyled = styled(Input)(function (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
23
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
24
|
+
input: {
|
|
25
|
+
textTransform: 'capitalize'
|
|
26
|
+
}
|
|
27
|
+
}); });
|
|
31
28
|
var EmployerName = function (_a) {
|
|
32
29
|
var _b;
|
|
33
30
|
var show = _a.show;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SourceOfIncome as SourceOfIncomeType } from '../../../../@types';
|
|
3
3
|
interface SourceOfIncomeProps {
|
|
4
|
-
list: Array<SourceOfIncomeType>;
|
|
5
4
|
show: boolean;
|
|
6
5
|
onSelectSource?: (country: SourceOfIncomeType) => void;
|
|
7
6
|
}
|
|
8
|
-
declare const _default: React.MemoExoticComponent<({
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ ...rest }: SourceOfIncomeProps) => JSX.Element>;
|
|
9
8
|
export default _default;
|
|
@@ -26,6 +26,8 @@ import Box from '@mui/material/Box';
|
|
|
26
26
|
import { styled } from '@mui/material/styles';
|
|
27
27
|
import { useTranslation } from 'react-i18next';
|
|
28
28
|
import { useController, useFormContext } from 'react-hook-form';
|
|
29
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
30
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
29
31
|
import Text from '../../../../components/Text';
|
|
30
32
|
import Collapse from '../../../../components/Collapse';
|
|
31
33
|
import CheckIcon from '@mui/icons-material/Check';
|
|
@@ -33,7 +35,6 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
33
35
|
import Input from '../../../shared/Input';
|
|
34
36
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
35
37
|
import SimpleList from '../../../../components/SimpleList';
|
|
36
|
-
import { useLanguage } from '../../../../hooks';
|
|
37
38
|
var Container = styled(Box)(function () { return ({
|
|
38
39
|
display: 'flex'
|
|
39
40
|
}); });
|
|
@@ -58,30 +59,35 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
|
58
59
|
});
|
|
59
60
|
});
|
|
60
61
|
var SourceOfIncome = function (_a) {
|
|
61
|
-
var _b;
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
-
var
|
|
62
|
+
var _b, _c;
|
|
63
|
+
var rest = __rest(_a, []);
|
|
64
|
+
var _d = React.useState([]), sourceList = _d[0], setSourceList = _d[1];
|
|
65
|
+
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
65
66
|
var t = useTranslation().t;
|
|
66
67
|
var isAr = useLanguage().isAr;
|
|
68
|
+
var data = useAppSelector(individualSelector).data;
|
|
67
69
|
var control = useFormContext().control;
|
|
70
|
+
var sourceIncomeList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.sourceIncomeList) || [];
|
|
68
71
|
var sourceIncomeControl = useController({ control: control, name: 'sourceIncome' });
|
|
72
|
+
React.useEffect(function () {
|
|
73
|
+
if ((sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.length) > 0) {
|
|
74
|
+
setSourceList(sourceIncomeList);
|
|
75
|
+
}
|
|
76
|
+
}, [sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.sourceIncome]);
|
|
69
77
|
var onOpenList = function (event) {
|
|
70
78
|
setAnchorEl(event.currentTarget);
|
|
71
79
|
};
|
|
72
80
|
var onCloseList = function () {
|
|
73
81
|
setAnchorEl(null);
|
|
74
82
|
};
|
|
75
|
-
var onSelectItem = function (
|
|
76
|
-
var _a;
|
|
83
|
+
var onSelectItem = function (source) {
|
|
77
84
|
onCloseList();
|
|
78
|
-
|
|
79
|
-
sourceIncomeControl.field.onChange(country);
|
|
85
|
+
sourceIncomeControl.field.onChange(source);
|
|
80
86
|
};
|
|
81
87
|
var source = sourceIncomeControl.field.value;
|
|
82
|
-
var error = (
|
|
83
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.
|
|
84
|
-
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.
|
|
88
|
+
var error = (_c = sourceIncomeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
89
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.name_ar : source === null || source === void 0 ? void 0 : source.name_en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name_en', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
90
|
+
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.name_ar : item === null || item === void 0 ? void 0 : item.name_en })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIconStyled, {})] }));
|
|
85
91
|
} }) }))] })) })));
|
|
86
92
|
};
|
|
87
93
|
export default React.memo(SourceOfIncome);
|
|
@@ -13,13 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useAppDispatch } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useSelector } from 'react-redux';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import Box from '@mui/material/Box/Box';
|
|
20
19
|
import { styled } from '@mui/material/styles';
|
|
21
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
|
-
import { useLanguage } from '../../../../hooks';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { maskPhone } from '../../../../utils';
|
|
24
23
|
import Form from '../../../../components/Form';
|
|
25
24
|
import Text from '../../../../components/Text';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var VerifyNumber = function (_a) {
|
|
51
50
|
var _b, _c, _d;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _e =
|
|
52
|
+
var _e = useAppSelector(individualSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
72
|
};
|
|
74
73
|
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
75
74
|
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
76
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
75
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
76
|
};
|
|
78
77
|
export default React.memo(VerifyNumber);
|
|
@@ -13,13 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useAppDispatch } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useSelector } from 'react-redux';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import Box from '@mui/material/Box/Box';
|
|
20
19
|
import { styled } from '@mui/material/styles';
|
|
21
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
|
-
import { useLanguage } from '../../../../hooks';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { maskPhone } from '../../../../utils';
|
|
24
23
|
import Form from '../../../../components/Form';
|
|
25
24
|
import Text from '../../../../components/Text';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var VerifyNumber = function (_a) {
|
|
51
50
|
var _b, _c, _d;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _e =
|
|
52
|
+
var _e = useAppSelector(passwordSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
72
|
};
|
|
74
73
|
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
75
74
|
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
76
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
75
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
76
|
};
|
|
78
77
|
export default React.memo(VerifyNumber);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ButtonProps } from '../../../components/Button';
|
|
3
|
+
interface SuccessButtonProps extends ButtonProps {
|
|
4
|
+
isAr: boolean;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
hideIcon?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function SuccessButton({ children, isAr, hideIcon, disabled, ...props }: SuccessButtonProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import Button from '../../../components/Button';
|
|
25
|
+
import Icon from '../../../components/Icon';
|
|
26
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
27
|
+
import Box from '@mui/material/Box';
|
|
28
|
+
import { ICONS_NAMES } from '../../../constants';
|
|
29
|
+
var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
|
|
30
|
+
var theme = _a.theme, disabled = _a.disabled;
|
|
31
|
+
return (__assign({ width: theme.spacing(3), height: theme.spacing(3), marginInlineStart: theme.spacing(0.75) }, (disabled && {
|
|
32
|
+
opacity: 0.3
|
|
33
|
+
})));
|
|
34
|
+
});
|
|
35
|
+
var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
36
|
+
var theme = _a.theme;
|
|
37
|
+
return ({
|
|
38
|
+
margin: theme.spacing(0, 2.5, 2.5, 2.5)
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
var ButtonStyled = styled(Button)(function (_a) {
|
|
42
|
+
var _b;
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return (_b = {
|
|
45
|
+
paddingInlineStart: theme.spacing(0.75),
|
|
46
|
+
textTransform: 'none',
|
|
47
|
+
backgroundColor: theme.palette.common.white,
|
|
48
|
+
border: "1px solid ".concat(theme.palette.primary.main),
|
|
49
|
+
color: theme.palette.primary.main,
|
|
50
|
+
'&:hover': {
|
|
51
|
+
backgroundColor: theme.palette.common.white,
|
|
52
|
+
color: theme.palette.primary.main
|
|
53
|
+
},
|
|
54
|
+
'&:disabled': {
|
|
55
|
+
backgroundColor: theme.palette.common.white,
|
|
56
|
+
color: alpha(theme.palette.primary.main, 0.3)
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
60
|
+
'&:hover': {
|
|
61
|
+
backgroundColor: theme.palette.common.white,
|
|
62
|
+
border: "1px solid ".concat(theme.palette.primary.main),
|
|
63
|
+
color: theme.palette.primary.main
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
_b);
|
|
67
|
+
});
|
|
68
|
+
export default function SuccessButton(_a) {
|
|
69
|
+
var children = _a.children, isAr = _a.isAr, hideIcon = _a.hideIcon, disabled = _a.disabled, props = __rest(_a, ["children", "isAr", "hideIcon", "disabled"]);
|
|
70
|
+
return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ disabled: disabled, type: 'button', startIcon: !hideIcon && _jsx(IconStyled, { disabled: disabled, src: ICONS_NAMES.MOBILE_ICON }) }, props, { children: children })) }));
|
|
71
|
+
}
|
|
@@ -3,5 +3,6 @@ import AbsherButton from './AbsherButton';
|
|
|
3
3
|
import MobileButton from './MobileButton';
|
|
4
4
|
import EmailProvidersButton from './EmailProvidersButtons';
|
|
5
5
|
import FlowsButtons from './FlowsButtons';
|
|
6
|
-
|
|
6
|
+
import SuccessButton from './SuccessButton';
|
|
7
|
+
export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton };
|
|
7
8
|
export default Button;
|
|
@@ -3,5 +3,6 @@ import AbsherButton from './AbsherButton';
|
|
|
3
3
|
import MobileButton from './MobileButton';
|
|
4
4
|
import EmailProvidersButton from './EmailProvidersButtons';
|
|
5
5
|
import FlowsButtons from './FlowsButtons';
|
|
6
|
-
|
|
6
|
+
import SuccessButton from './SuccessButton';
|
|
7
|
+
export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton };
|
|
7
8
|
export default Button;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { LanguageMode } from '../../../@types';
|
|
3
|
-
import { useAppDispatch, useLanguage } from '../../../hooks';
|
|
3
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../hooks';
|
|
4
4
|
import { handleLanguage } from '../../../app/settings';
|
|
5
5
|
import Footer from '../../../components/Footer';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { useSelector } from 'react-redux';
|
|
8
7
|
import { connectSelector } from '../../app/connect/connectStore';
|
|
9
8
|
export default function CustomFooter() {
|
|
10
9
|
var isEn = useLanguage().isEn;
|
|
11
10
|
var t = useTranslation().t;
|
|
12
11
|
var dispatch = useAppDispatch();
|
|
13
|
-
var _a =
|
|
12
|
+
var _a = useAppSelector(connectSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
14
13
|
var handleChangeLanguage = function () {
|
|
15
14
|
var language = isEn ? LanguageMode.AR : LanguageMode.EN;
|
|
16
15
|
dispatch(handleLanguage(language));
|
|
@@ -0,0 +1,25 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import Input from '../../shared/Input';
|
|
16
|
+
import Collapse from '../../../components/Collapse';
|
|
17
|
+
var Search = function (_a) {
|
|
18
|
+
var onSearchValue = _a.onSearchValue, showSearch = _a.showSearch;
|
|
19
|
+
var t = useTranslation().t;
|
|
20
|
+
var handleOnChange = function (event) {
|
|
21
|
+
onSearchValue === null || onSearchValue === void 0 ? void 0 : onSearchValue(event.target.value);
|
|
22
|
+
};
|
|
23
|
+
return (_jsx(React.Fragment, { children: _jsx(Collapse, __assign({ in: showSearch }, { children: _jsx(Input, { placeholder: t('search_placeholder'), onChange: handleOnChange }) })) }));
|
|
24
|
+
};
|
|
25
|
+
export default Search;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
13
|
+
import Icon from '../../../components/Icon';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import { ICONS_NAMES } from '../../../constants';
|
|
16
|
+
var SearchIcon = styled(Icon)(function (_a) {
|
|
17
|
+
var theme = _a.theme;
|
|
18
|
+
return ({
|
|
19
|
+
width: theme.spacing(2),
|
|
20
|
+
height: theme.spacing(2),
|
|
21
|
+
cursor: 'pointer'
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
export default function CustomSearchIcon(props) {
|
|
25
|
+
return _jsx(SearchIcon, __assign({ src: ICONS_NAMES.SEARCH_ICON }, props));
|
|
26
|
+
}
|
|
@@ -16,7 +16,7 @@ import * as React from 'react';
|
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import Text from '../../../components/Text';
|
|
18
18
|
import Container from '../Containers/ScreenContainer';
|
|
19
|
-
import {
|
|
19
|
+
import { EmailProvidersButton, SuccessButton } from '../../shared/Button';
|
|
20
20
|
import Icon from '../../../components/Icon';
|
|
21
21
|
import { ICONS_NAMES } from '../../../constants';
|
|
22
22
|
import { useLanguage } from '../../../hooks';
|
|
@@ -67,6 +67,6 @@ var ThankYou = function (_a) {
|
|
|
67
67
|
var title = _a.title, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess, successTitle = _a.successTitle, disabledSuccessButton = _a.disabledSuccessButton;
|
|
68
68
|
var t = useTranslation().t;
|
|
69
69
|
var isAr = useLanguage().isAr;
|
|
70
|
-
return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('gmail_btn_open_title'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('outlook_btn_open_title'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('apple_btn_open_title'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(
|
|
70
|
+
return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('gmail_btn_open_title'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('outlook_btn_open_title'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('apple_btn_open_title'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(SuccessButton, __assign({ disabled: disabledSuccessButton, hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t(successTitle || 'open_mail_box') })) }))] }));
|
|
71
71
|
};
|
|
72
72
|
export default React.memo(ThankYou);
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
14
14
|
import Button from '../../../shared/Button';
|
|
15
|
-
import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
15
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -21,14 +21,13 @@ import { Validation } from './validation';
|
|
|
21
21
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
22
22
|
import { taxSelector, updateTaxInfo } from '../../../app/tax/taxStore';
|
|
23
23
|
import VATId from './VATId';
|
|
24
|
-
import { useSelector } from 'react-redux';
|
|
25
24
|
var FormStyled = styled(Form)(function () { return ({
|
|
26
25
|
display: 'flex',
|
|
27
26
|
flexDirection: 'column'
|
|
28
27
|
}); });
|
|
29
28
|
var TaxDetails = function () {
|
|
30
29
|
var dispatch = useAppDispatch();
|
|
31
|
-
var _a =
|
|
30
|
+
var _a = useAppSelector(taxSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
32
31
|
var methods = useForm({
|
|
33
32
|
resolver: yupResolver(Validation),
|
|
34
33
|
defaultValues: data.taxData,
|
|
@@ -13,13 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useAppDispatch } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useSelector } from 'react-redux';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import Box from '@mui/material/Box/Box';
|
|
20
19
|
import { styled } from '@mui/material/styles';
|
|
21
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
|
-
import { useLanguage } from '../../../../hooks';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { maskPhone } from '../../../../utils';
|
|
24
23
|
import Form from '../../../../components/Form';
|
|
25
24
|
import Text from '../../../../components/Text';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var VerifyNumber = function (_a) {
|
|
51
50
|
var _b, _c, _d;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _e =
|
|
52
|
+
var _e = useAppSelector(taxSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
72
|
};
|
|
74
73
|
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
75
74
|
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
76
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
75
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
76
|
};
|
|
78
77
|
export default React.memo(VerifyNumber);
|