@tap-payments/auth-jsconnect 1.0.71 → 1.0.76
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 +16 -7
- package/build/@types/form.d.ts +3 -3
- package/build/api/auth.d.ts +7 -0
- package/build/api/auth.js +5 -1
- package/build/api/data.d.ts +1 -0
- package/build/api/data.js +5 -1
- package/build/api/entity.d.ts +1 -0
- package/build/api/entity.js +5 -1
- package/build/api/index.d.ts +9 -2
- package/build/api/index.js +3 -1
- package/build/api/individual.d.ts +8 -0
- package/build/api/individual.js +9 -0
- package/build/assets/locales/ar.json +9 -5
- package/build/assets/locales/en.json +14 -4
- package/build/components/SimpleList/SimpleList.js +4 -4
- package/build/constants/api.d.ts +3 -0
- package/build/constants/api.js +11 -5
- package/build/constants/app.js +18 -6
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/features/app/bank/bankStore.d.ts +3 -0
- package/build/features/app/bank/bankStore.js +45 -9
- package/build/features/app/business/businessStore.d.ts +4 -5
- package/build/features/app/business/businessStore.js +106 -66
- package/build/features/app/connect/connectStore.d.ts +1 -0
- package/build/features/app/connect/connectStore.js +19 -10
- package/build/features/app/individual/individualStore.d.ts +7 -1
- package/build/features/app/individual/individualStore.js +79 -30
- package/build/features/app/password/passwordStore.d.ts +4 -0
- package/build/features/app/password/passwordStore.js +71 -15
- package/build/features/bank/screens/Success/Success.js +5 -2
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +87 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/Activities/SalesChannels.js +1 -1
- package/build/features/business/screens/Activities/validation.d.ts +24 -24
- package/build/features/business/screens/Activities/validation.js +2 -2
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +2 -2
- package/build/features/business/screens/Customers/Customers.js +4 -4
- package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -2
- package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +1 -1
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +60 -33
- package/build/features/business/screens/Customers/validation.js +2 -2
- package/build/features/business/screens/Success/Success.js +1 -1
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +24 -20
- package/build/features/connect/screens/Individual/MobileNumber.js +11 -2
- package/build/features/connect/screens/Merchant/Merchant.js +9 -2
- package/build/features/connect/screens/Mobile/MobileNumber.js +11 -2
- package/build/features/connect/screens/ThankYou/ThankYou.js +1 -1
- package/build/features/featuresScreens.js +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +5 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +62 -9
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +3 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +5 -9
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -11
- package/build/features/individual/screens/Success/Success.js +5 -2
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +87 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -10
- package/build/features/password/screens/Success/Success.js +7 -1
- package/build/features/shared/Button/FlowsButtons.d.ts +2 -0
- package/build/features/shared/Button/FlowsButtons.js +2 -2
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/Search/Search.d.ts +1 -1
- package/build/features/shared/Search/Search.js +2 -14
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +2 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.js +9 -20
- package/build/features/tax/screens/Success/Success.js +1 -1
- package/build/utils/array.d.ts +1 -0
- package/build/utils/array.js +6 -0
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +7 -0
- package/package.json +1 -1
|
@@ -9,18 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
13
|
import * as React from 'react';
|
|
25
14
|
import Box from '@mui/material/Box';
|
|
26
15
|
import { styled } from '@mui/material/styles';
|
|
@@ -30,50 +19,88 @@ import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
|
30
19
|
import SimpleList from '../../../../components/SimpleList';
|
|
31
20
|
import Collapse from '../../../../components/Collapse';
|
|
32
21
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
22
|
+
import { businessSelector } from '../../../../features/app/business/businessStore';
|
|
23
|
+
import { isExist } from '../../../../utils';
|
|
33
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
25
|
import { InputLabelStyled, CheckIconStyled, InputStyled, NameContainer } from './CustomerLocations';
|
|
35
|
-
|
|
26
|
+
var ListItem = styled(Box)(function (_a) {
|
|
27
|
+
var theme = _a.theme;
|
|
28
|
+
return ({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
justifyContent: 'space-between',
|
|
31
|
+
width: '100%',
|
|
32
|
+
paddingInlineStart: theme.spacing(2.5),
|
|
33
|
+
paddingInlineEnd: theme.spacing(2.5),
|
|
34
|
+
paddingTop: theme.spacing(1.5),
|
|
35
|
+
paddingBottom: theme.spacing(1.5)
|
|
36
|
+
});
|
|
37
|
+
});
|
|
36
38
|
var ListItemContainer = styled(Box)(function () { return ({
|
|
37
|
-
display: 'flex'
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
width: '100%'
|
|
38
42
|
}); });
|
|
39
43
|
var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
40
44
|
height: 'fit-content'
|
|
41
45
|
}); });
|
|
42
46
|
var ExpectedSalesRange = function (_a) {
|
|
43
|
-
var
|
|
47
|
+
var show = _a.show, onListClose = _a.onListClose, onListOpen = _a.onListOpen;
|
|
44
48
|
var _b = React.useState([]), expectedSalesRangeList = _b[0], setExpectedSalesRangeList = _b[1];
|
|
45
49
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
50
|
+
var _d = React.useState(''), subIndex = _d[0], setSubIndex = _d[1];
|
|
46
51
|
var t = useTranslation().t;
|
|
47
52
|
var isAr = useLanguage().isAr;
|
|
48
53
|
var control = useFormContext().control;
|
|
49
|
-
var
|
|
54
|
+
var expectedSaleControl = useController({ name: 'expectedSale', control: control });
|
|
50
55
|
var data = useAppSelector(businessSelector).data;
|
|
51
56
|
var activitiesData = data.activitiesData;
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
|
|
57
|
+
var expectedSales = (activitiesData.responseBody || {}).expectedSales;
|
|
58
|
+
var expectedSalesRangeValue = expectedSaleControl.field.value;
|
|
59
|
+
var handleOpenMainMenu = function (event) {
|
|
55
60
|
setAnchorEl(event.currentTarget);
|
|
56
|
-
|
|
61
|
+
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
57
62
|
};
|
|
58
|
-
var
|
|
59
|
-
var _a;
|
|
63
|
+
var handleCloseMainMenu = function () {
|
|
60
64
|
setAnchorEl(null);
|
|
61
|
-
|
|
65
|
+
onListClose === null || onListClose === void 0 ? void 0 : onListClose();
|
|
66
|
+
handleCloseSubMenu();
|
|
67
|
+
};
|
|
68
|
+
var handleOpenSubMenu = function (index) {
|
|
69
|
+
if (subIndex === index)
|
|
70
|
+
setSubIndex('');
|
|
71
|
+
else
|
|
72
|
+
setSubIndex(index);
|
|
73
|
+
};
|
|
74
|
+
var handleCloseSubMenu = function () {
|
|
75
|
+
setSubIndex('');
|
|
62
76
|
};
|
|
63
77
|
React.useEffect(function () {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
setExpectedSalesRangeList(response === null || response === void 0 ? void 0 : response.expectedSales);
|
|
78
|
+
if ((expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.length) > 0) {
|
|
79
|
+
setExpectedSalesRangeList(expectedSales);
|
|
67
80
|
}
|
|
68
|
-
}, [
|
|
81
|
+
}, [expectedSales]);
|
|
69
82
|
var onSelectItem = function (expectedSalesRange) {
|
|
70
|
-
|
|
71
|
-
|
|
83
|
+
handleCloseMainMenu();
|
|
84
|
+
expectedSaleControl.field.onChange(expectedSalesRange);
|
|
72
85
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
React.useEffect(function () {
|
|
87
|
+
var item = isExist(expectedSales || [], expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id);
|
|
88
|
+
if (item)
|
|
89
|
+
setSubIndex(item.id);
|
|
90
|
+
}, [anchorEl]);
|
|
91
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_yearly') }), _jsx(InputStyled, { readOnly: true, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name_ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name_en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
|
|
92
|
+
var isOnlyOneItem = !item.sub || item.sub.length === 1;
|
|
93
|
+
if (isOnlyOneItem)
|
|
94
|
+
onSelectItem(item);
|
|
95
|
+
else
|
|
96
|
+
handleOpenSubMenu(item.id);
|
|
97
|
+
}, renderItem: function (item) {
|
|
98
|
+
var _a;
|
|
99
|
+
var isOnlyOneItem = !item.sub || ((_a = item.sub) === null || _a === void 0 ? void 0 : _a.length) === 1;
|
|
100
|
+
var showCheck = item.id === (expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id) && isOnlyOneItem;
|
|
101
|
+
return (_jsxs(ListItemContainer, { children: [_jsxs(ListItem, __assign({ sx: __assign({ bgcolor: 'rgb(196 184 184 / 8%)', borderBottom: '1px solid rgba(227, 232, 238, 0.8)' }, (isOnlyOneItem && { bgcolor: 'inherit', borderBottom: 'none' })) }, { children: [_jsx(NameContainer, __assign({ isSelected: item.id === (expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id), sx: __assign({}, (isOnlyOneItem && { paddingInlineStart: '5px' })) }, { children: isAr ? item.name_ar : item.name_en })), showCheck ? _jsx(CheckIconStyled, {}) : !isOnlyOneItem && _jsx(ExpandIcon, { anchorEl: subIndex === item.id })] })), _jsx(Collapse, __assign({ in: item.id === subIndex && !isOnlyOneItem }, { children: _jsx(SimpleListStyled, { sx: { pt: 0, pb: 0 }, list: (!isOnlyOneItem && item.sub) || [], onSelectItem: onSelectItem, listItemProps: { sx: { padding: 0, '&:last-child': { paddingBottom: 0 } } }, renderItem: function (item, idx) {
|
|
102
|
+
return (_jsxs(ListItem, __assign({ sx: { mt: idx === 0 ? 1 : 0 } }, { children: [_jsx(NameContainer, __assign({ isSelected: item.id === (expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id) }, { children: isAr ? item.name_ar : item.name_en })), item.id === (expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id) && _jsx(CheckIconStyled, {})] })));
|
|
103
|
+
} }) }))] }));
|
|
77
104
|
} }) }))] }) })));
|
|
78
105
|
};
|
|
79
106
|
export default ExpectedSalesRange;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
var objectElements = {
|
|
3
3
|
id: yup.number(),
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
name_ar: yup.string(),
|
|
5
|
+
name_en: yup.string()
|
|
6
6
|
};
|
|
7
7
|
export var CustomerInfoValidation = yup.object().shape({
|
|
8
8
|
customerLocations: yup.array().required('please_choose_base'),
|
|
@@ -15,6 +15,6 @@ var Success = function (_a) {
|
|
|
15
15
|
var onSuccess = function () {
|
|
16
16
|
dispatch(handleNextScreenStep());
|
|
17
17
|
};
|
|
18
|
-
return (_jsx(SuccessScreen, { title: t('
|
|
18
|
+
return (_jsx(SuccessScreen, { title: t('business_completed_title'), description: t('business_completed_description'), onSuccess: onSuccess, successTitle: t('business_completed_button'), disabledSuccessButton: loading }));
|
|
19
19
|
};
|
|
20
20
|
export default React.memo(Success);
|
|
@@ -13,27 +13,17 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { memo, useEffect, useState } from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { styled } from '@mui/material/styles';
|
|
16
|
-
import Box from '@mui/material/Box';
|
|
17
|
-
import Text from '../../../../components/Text';
|
|
18
|
-
import Container from '../../../shared/Containers/ScreenContainer';
|
|
19
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
20
17
|
import { ICONS_NAMES } from '../../../../constants';
|
|
21
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
22
19
|
import { businessSelector } from '../../../app/business/businessStore';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
border: '1px solid',
|
|
28
|
-
width: '100%',
|
|
29
|
-
borderColor: theme.palette.divider,
|
|
30
|
-
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
31
|
-
marginBottom: theme.spacing(7.5)
|
|
32
|
-
});
|
|
33
|
-
});
|
|
20
|
+
import { showLastFour } from '../../../../utils';
|
|
21
|
+
import Box from '@mui/material/Box';
|
|
22
|
+
import Text from '../../../../components/Text';
|
|
23
|
+
import Container from '../../../shared/Containers/ScreenContainer';
|
|
34
24
|
var TitleStyled = styled(Text)(function (_a) {
|
|
35
25
|
var theme = _a.theme;
|
|
36
|
-
return (__assign({ fontWeight: theme.typography.
|
|
26
|
+
return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), marginBlockStart: theme.spacing(2.875), lineHeight: 1.75, padding: '0px 20px' }));
|
|
37
27
|
});
|
|
38
28
|
var ContainerStyled = styled(Container)(function (_a) {
|
|
39
29
|
var theme = _a.theme;
|
|
@@ -50,20 +40,33 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
|
50
40
|
});
|
|
51
41
|
});
|
|
52
42
|
var SuccessWithFlowButtons = function () {
|
|
43
|
+
var _a;
|
|
53
44
|
var t = useTranslation().t;
|
|
54
45
|
var isAr = useLanguage().isAr;
|
|
55
46
|
var data = useAppSelector(businessSelector).data;
|
|
56
|
-
var
|
|
57
|
-
var
|
|
47
|
+
var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank, tax = _b.tax_id;
|
|
48
|
+
var _c = useState([]), buttons = _c[0], setButtons = _c[1];
|
|
58
49
|
var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
|
|
50
|
+
var licenseNumber = ((_a = entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
51
|
+
var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
|
|
52
|
+
var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
|
|
53
|
+
var taxID = tax || '';
|
|
59
54
|
var reMapFlowData = function (flows) {
|
|
60
55
|
if (flows === void 0) { flows = []; }
|
|
61
56
|
var images = ICONS_NAMES;
|
|
62
57
|
var mappedFlows = flows.map(function (_a) {
|
|
63
58
|
var name = _a.name, url = _a.url, status = _a.status;
|
|
64
59
|
var type = status === 'initiated' ? 'pending' : 'completed';
|
|
65
|
-
var title = t("".concat(name, "_flow_").concat(type), {
|
|
60
|
+
var title = t("".concat(name, "_flow_").concat(type), {
|
|
61
|
+
individual_name: username.toLowerCase(),
|
|
62
|
+
business_type: businessType,
|
|
63
|
+
license_number: t('masking_symbols') + showLastFour(licenseNumber),
|
|
64
|
+
bank_name: bankName,
|
|
65
|
+
iban: t('masking_symbols') + iban,
|
|
66
|
+
tax_id: t('masking_symbols') + taxID
|
|
67
|
+
});
|
|
66
68
|
var isCompleted = status === 'completed' && name !== 'password';
|
|
69
|
+
var isIndividual = name === 'individual';
|
|
67
70
|
var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
|
|
68
71
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
69
72
|
return {
|
|
@@ -71,7 +74,8 @@ var SuccessWithFlowButtons = function () {
|
|
|
71
74
|
href: url,
|
|
72
75
|
src: images[src],
|
|
73
76
|
hoverSrc: images[hoverSrc],
|
|
74
|
-
isCompleted: isCompleted
|
|
77
|
+
isCompleted: isCompleted,
|
|
78
|
+
sx: isIndividual ? { textTransform: 'capitalize' } : {}
|
|
75
79
|
};
|
|
76
80
|
});
|
|
77
81
|
setButtons(mappedFlows);
|
|
@@ -80,6 +84,6 @@ var SuccessWithFlowButtons = function () {
|
|
|
80
84
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
81
85
|
reMapFlowData(flows);
|
|
82
86
|
}, [flows, isAr]);
|
|
83
|
-
return (_jsxs(ContainerStyled, { children: [
|
|
87
|
+
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
|
|
84
88
|
};
|
|
85
89
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -72,6 +72,15 @@ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
|
|
|
72
72
|
marginInlineStart: theme.spacing(1)
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
|
+
var InputStyled = styled(Input)(function (_a) {
|
|
76
|
+
var theme = _a.theme;
|
|
77
|
+
return ({
|
|
78
|
+
direction: 'ltr',
|
|
79
|
+
'& .MuiInputBase-input': {
|
|
80
|
+
cursor: 'auto'
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
75
84
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
76
85
|
var _b, _c, _d;
|
|
77
86
|
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
@@ -85,7 +94,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
85
94
|
var countryCodeValue = countryCodeControl.field.value;
|
|
86
95
|
var mobileValue = phoneControl.field.value || '';
|
|
87
96
|
var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
|
|
88
|
-
var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
97
|
+
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
89
98
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
90
99
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
91
100
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
@@ -130,7 +139,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
130
139
|
});
|
|
131
140
|
setCountries(filteredCountries);
|
|
132
141
|
};
|
|
133
|
-
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(
|
|
142
|
+
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, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: 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 })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
134
143
|
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, {})] }));
|
|
135
144
|
} })] }))] })) })));
|
|
136
145
|
});
|
|
@@ -69,18 +69,25 @@ var Merchant = function (_a) {
|
|
|
69
69
|
methods.setError('brandName', { message: 'Profile Name already exists' });
|
|
70
70
|
}, [responseBody]);
|
|
71
71
|
React.useEffect(function () {
|
|
72
|
+
var _a, _b;
|
|
72
73
|
if (isNewUser === true) {
|
|
73
74
|
setUserType(ValidationOptions.NEW_USER);
|
|
74
75
|
}
|
|
75
76
|
if (isNewUser === false && methods.getValues('selectedBrandItem').id === 'other') {
|
|
76
77
|
setUserType(ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND);
|
|
77
78
|
methods.clearErrors();
|
|
78
|
-
setTimeout(function () {
|
|
79
|
+
setTimeout(function () {
|
|
80
|
+
var sites = { website: '', twitter: '', instagram: '' };
|
|
81
|
+
methods.setValue('brandName', '', { shouldValidate: true });
|
|
82
|
+
methods.setValue('links', sites);
|
|
83
|
+
}, 100);
|
|
79
84
|
}
|
|
80
85
|
if (isNewUser === false && methods.getValues('selectedBrandItem').id !== 'other') {
|
|
81
86
|
setUserType(ValidationOptions.EXISTING_USER_WITH_EXIST_BRAND);
|
|
82
87
|
methods.clearErrors();
|
|
83
|
-
var
|
|
88
|
+
var twitter = ((_a = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.includes('twitter.com'); })) || '';
|
|
89
|
+
var instagram = ((_b = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _b === void 0 ? void 0 : _b.find(function (item) { return item.includes('instagram.com'); })) || '';
|
|
90
|
+
var sites_1 = __assign(__assign({}, links), { website: selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.website, twitter: twitter, instagram: instagram });
|
|
84
91
|
setTimeout(function () { return methods.setValue('links', sites_1, { shouldValidate: true }); }, 100);
|
|
85
92
|
}
|
|
86
93
|
}, [methods.getValues('selectedBrandItem'), isNewUser]);
|
|
@@ -73,6 +73,15 @@ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
|
|
|
73
73
|
marginInlineStart: theme.spacing(1)
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
+
var InputStyled = styled(Input)(function (_a) {
|
|
77
|
+
var theme = _a.theme;
|
|
78
|
+
return ({
|
|
79
|
+
direction: 'ltr',
|
|
80
|
+
'& .MuiInputBase-input': {
|
|
81
|
+
cursor: 'auto'
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
76
85
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
77
86
|
var _b, _c, _d;
|
|
78
87
|
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
@@ -87,7 +96,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
87
96
|
var countryCodeValue = countryCodeControl.field.value;
|
|
88
97
|
var mobileValue = phoneControl.field.value || '';
|
|
89
98
|
var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
|
|
90
|
-
var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
99
|
+
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
91
100
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
92
101
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
93
102
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
@@ -132,7 +141,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
132
141
|
});
|
|
133
142
|
setCountries(filteredCountries);
|
|
134
143
|
};
|
|
135
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(
|
|
144
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: 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 })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
136
145
|
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, {})] }));
|
|
137
146
|
} })] }))] })) })));
|
|
138
147
|
});
|
|
@@ -10,6 +10,6 @@ var ThankYou = function (_a) {
|
|
|
10
10
|
React.useEffect(function () {
|
|
11
11
|
dispatch(updateLeadSuccess());
|
|
12
12
|
}, []);
|
|
13
|
-
return _jsx(SuccessScreen, { title: t(
|
|
13
|
+
return (_jsx(SuccessScreen, { title: t("connect_completed_title"), description: t("connect_completed_description"), showEmailProviders: true }));
|
|
14
14
|
};
|
|
15
15
|
export default React.memo(ThankYou);
|
|
@@ -18,9 +18,11 @@ import SuccessPasswordPage from './password/screens/Success';
|
|
|
18
18
|
import IndividualVerifyPage from './individual/screens/Verify';
|
|
19
19
|
import AdditionalIndividualInfoPage from './individual/screens/AdditionalIndividualInfo';
|
|
20
20
|
import SuccessOwnerPage from './individual/screens/Success';
|
|
21
|
+
import IndividualSuccessWithFlowPage from './individual/screens/SuccessWithFlowButtons';
|
|
21
22
|
import BankVerifyPage from './bank/screens/Verify';
|
|
22
23
|
import BankDetailsPage from './bank/screens/BankDetails';
|
|
23
24
|
import BankSuccessPage from './bank/screens/Success';
|
|
25
|
+
import BankSuccessWithFlowPage from './bank/screens/SuccessWithFlowButtons';
|
|
24
26
|
import TaxVerifyPage from './tax/screens/Verify';
|
|
25
27
|
import TaxDetailsPage from './tax/screens/TaxDetails';
|
|
26
28
|
import TaxSuccessPage from './tax/screens/Success';
|
|
@@ -105,6 +107,10 @@ export var individualFeatureScreens = [
|
|
|
105
107
|
{
|
|
106
108
|
name: 'INDIVIDUAL_SUCCESS_STEP',
|
|
107
109
|
element: SuccessOwnerPage
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
113
|
+
element: IndividualSuccessWithFlowPage
|
|
108
114
|
}
|
|
109
115
|
];
|
|
110
116
|
export var bankFeatureScreens = [
|
|
@@ -119,6 +125,10 @@ export var bankFeatureScreens = [
|
|
|
119
125
|
{
|
|
120
126
|
name: 'BANK_DETAILS_SUCCESS_STEP',
|
|
121
127
|
element: BankSuccessPage
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
131
|
+
element: BankSuccessWithFlowPage
|
|
122
132
|
}
|
|
123
133
|
];
|
|
124
134
|
export var taxFeatureScreens = [
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -53,6 +53,12 @@ var ButtonStyled = styled(Button)(function (_a) {
|
|
|
53
53
|
marginBlockStart: theme.spacing(-5)
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
|
+
var ListType;
|
|
57
|
+
(function (ListType) {
|
|
58
|
+
ListType["SourceOfIncomeList"] = "SourceOfIncomeList";
|
|
59
|
+
ListType["EmployerLocationList"] = "EmployerLocationList";
|
|
60
|
+
ListType["MonthlyIncomeList"] = "MonthlyIncomeList";
|
|
61
|
+
})(ListType || (ListType = {}));
|
|
56
62
|
var AdditionalIndividualInfo = function (_a) {
|
|
57
63
|
var t = useTranslation().t;
|
|
58
64
|
var isAr = useLanguage().isAr;
|
|
@@ -63,7 +69,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
63
69
|
defaultValues: data.individualData,
|
|
64
70
|
mode: 'onChange'
|
|
65
71
|
});
|
|
66
|
-
var _c = React.useState(
|
|
72
|
+
var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
|
|
67
73
|
var _d = React.useState(false), employerFieldsActive = _d[0], setEmployerFieldsActive = _d[1];
|
|
68
74
|
React.useEffect(function () {
|
|
69
75
|
var _a, _b;
|
|
@@ -84,7 +90,13 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
84
90
|
var onBack = function () {
|
|
85
91
|
dispatch(handlePrevScreenStep());
|
|
86
92
|
};
|
|
87
|
-
|
|
93
|
+
var handleMenuClick = function (flag) {
|
|
94
|
+
setListActive(flag);
|
|
95
|
+
};
|
|
96
|
+
var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
|
|
97
|
+
var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
|
|
98
|
+
var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
|
|
99
|
+
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, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive, countries: data.countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _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') })) }))] })) })) }));
|
|
88
100
|
};
|
|
89
101
|
export default React.memo(AdditionalIndividualInfo);
|
|
90
102
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { MonthlyIncome as MonthlyIncomeType } from '../../../../@types';
|
|
2
3
|
interface MonthlyIncomeProps {
|
|
3
4
|
show: boolean;
|
|
5
|
+
onSelectSource?: (country: MonthlyIncomeType) => void;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
4
8
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ ...rest }: MonthlyIncomeProps) => JSX.Element>;
|
|
6
10
|
export default _default;
|
|
@@ -9,28 +9,81 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
24
|
import * as React from 'react';
|
|
14
25
|
import { useTranslation } from 'react-i18next';
|
|
15
26
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
-
import
|
|
27
|
+
import Box from '@mui/material/Box';
|
|
28
|
+
import { styled } from '@mui/material/styles';
|
|
17
29
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
18
30
|
import Input from '../../../shared/Input';
|
|
19
31
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
20
32
|
import Collapse from '../../../../components/Collapse';
|
|
33
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
34
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
35
|
+
import Text from '../../../../components/Text';
|
|
36
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
37
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
38
|
+
var Container = styled(Box)(function () { return ({
|
|
39
|
+
display: 'flex'
|
|
40
|
+
}); });
|
|
41
|
+
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
42
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
43
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
44
|
+
});
|
|
45
|
+
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
46
|
+
var theme = _a.theme;
|
|
47
|
+
return ({
|
|
48
|
+
color: theme.palette.success.main,
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'flex-end'
|
|
51
|
+
});
|
|
52
|
+
});
|
|
21
53
|
var MonthlyIncome = function (_a) {
|
|
22
54
|
var _b;
|
|
23
|
-
var
|
|
55
|
+
var rest = __rest(_a, []);
|
|
56
|
+
var _c = React.useState([]), incomeList = _c[0], setIncomeList = _c[1];
|
|
57
|
+
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
24
58
|
var t = useTranslation().t;
|
|
59
|
+
var isAr = useLanguage().isAr;
|
|
60
|
+
var data = useAppSelector(individualSelector).data;
|
|
25
61
|
var control = useFormContext().control;
|
|
62
|
+
var monthlyIncomeList = (data.individualData.responseBody || {}).monthlyIncomeList;
|
|
26
63
|
var monthlyIncomeControl = useController({ control: control, name: 'monthlyIncome' });
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
64
|
+
React.useEffect(function () {
|
|
65
|
+
if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
|
|
66
|
+
setIncomeList(monthlyIncomeList);
|
|
67
|
+
}
|
|
68
|
+
}, [monthlyIncomeList]);
|
|
69
|
+
var onOpenList = function (event) {
|
|
70
|
+
var _a;
|
|
71
|
+
setAnchorEl(event.currentTarget);
|
|
72
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
73
|
+
};
|
|
74
|
+
var onCloseList = function () {
|
|
75
|
+
var _a;
|
|
76
|
+
setAnchorEl(null);
|
|
77
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
78
|
+
};
|
|
79
|
+
var onSelectItem = function (source) {
|
|
80
|
+
onCloseList();
|
|
81
|
+
monthlyIncomeControl.field.onChange(source);
|
|
31
82
|
};
|
|
32
|
-
var
|
|
83
|
+
var income = monthlyIncomeControl.field.value;
|
|
33
84
|
var error = (_b = monthlyIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
34
|
-
return (_jsx(Collapse, __assign({ in: show }, { children:
|
|
85
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(Input, { label: t('please_enter_actual_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.name_ar : income === null || income === void 0 ? void 0 : income.name_en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name_en', list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
86
|
+
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.name_ar : item === null || item === void 0 ? void 0 : item.name_en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIconStyled, {})] }));
|
|
87
|
+
} }) }))] })) })));
|
|
35
88
|
};
|
|
36
89
|
export default React.memo(MonthlyIncome);
|
|
@@ -2,7 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import { SourceOfIncome as SourceOfIncomeType } from '../../../../@types';
|
|
3
3
|
interface SourceOfIncomeProps {
|
|
4
4
|
show: boolean;
|
|
5
|
-
onSelectSource?: (
|
|
5
|
+
onSelectSource?: (source: SourceOfIncomeType) => void;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
6
8
|
}
|
|
7
9
|
declare const _default: React.MemoExoticComponent<({ ...rest }: SourceOfIncomeProps) => JSX.Element>;
|
|
8
10
|
export default _default;
|
|
@@ -38,14 +38,6 @@ import SimpleList from '../../../../components/SimpleList';
|
|
|
38
38
|
var Container = styled(Box)(function () { return ({
|
|
39
39
|
display: 'flex'
|
|
40
40
|
}); });
|
|
41
|
-
var SimpleListStyled = styled((SimpleList))(function (_a) {
|
|
42
|
-
var theme = _a.theme;
|
|
43
|
-
return ({
|
|
44
|
-
height: 'fit-content',
|
|
45
|
-
backgroundColor: theme.palette.common.white,
|
|
46
|
-
borderBottom: "".concat(theme.spacing(0.125), " solid ").concat(theme.palette.divider)
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
41
|
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
50
42
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
51
43
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
@@ -75,10 +67,14 @@ var SourceOfIncome = function (_a) {
|
|
|
75
67
|
}
|
|
76
68
|
}, [sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.sourceIncome]);
|
|
77
69
|
var onOpenList = function (event) {
|
|
70
|
+
var _a;
|
|
78
71
|
setAnchorEl(event.currentTarget);
|
|
72
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
79
73
|
};
|
|
80
74
|
var onCloseList = function () {
|
|
75
|
+
var _a;
|
|
81
76
|
setAnchorEl(null);
|
|
77
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
82
78
|
};
|
|
83
79
|
var onSelectItem = function (source) {
|
|
84
80
|
onCloseList();
|
|
@@ -86,7 +82,7 @@ var SourceOfIncome = function (_a) {
|
|
|
86
82
|
};
|
|
87
83
|
var source = sourceIncomeControl.field.value;
|
|
88
84
|
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(
|
|
85
|
+
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(SimpleList, { searchKeyPath: 'name_en', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
90
86
|
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, {})] }));
|
|
91
87
|
} }) }))] })) })));
|
|
92
88
|
};
|